----- Original Message -----
2.6.38 introduced another change in struct inet_sock that breaks net
-s
like this:
crash-5.1.8> net -s 2494
net: invalid structure member offset: inet_opt_daddr
FILE: net.c LINE: 829 FUNCTION: get_sock_info()
[/home/bobm/bin/crash-5.1.8] error trace: 4cccca => 4cb773 => 4ca4c0 => 4f766a
PID: 2494 TASK: ffff8801226de540 CPU: 1 COMMAND: "racoon"
FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT
4f766a: OFFSET_verify+202
4ca4c0: sym_socket_dump+1920
4cb773: dump_sockets_workhorse+1571
4cccca: cmd_net+3658
3 ffff8801229470c0 ffff88011f8dfc00 net: invalid structure member offset:
inet_opt_daddr
FILE: net.c LINE: 829 FUNCTION: get_sock_info()
This patch adds a new final clause to net_init to handle the case where
inet_sock no longer contains inet_daddr (the previous final clause):
struct inet_sock {
/* sk and pinet6 has to be the first two members of inet_sock
*/
struct sock sk;
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
struct ipv6_pinfo *pinet6;
#endif
/* Socket demultiplex comparisons on incoming packets. */
#define inet_daddr sk.__sk_common.skc_daddr
<<<<<<<<<<<
#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr
<<<<<<<<<<<<
The patch cheats by depending on inet_sock having struct sock as its
first element and struct sock having struct sock_common as its first
element without actually verifying that.
Bob,
Thanks for catching this. And since it's easy enough to verify the offsets,
I've added a qualifier to the final clause:
--- net.c 25 Feb 2011 20:24:46 -0000 1.30
+++ net.c 17 Oct 2011 14:32:06 -0000
@@ -210,12 +210,19 @@
MEMBER_OFFSET_INIT(inet_opt_dport,
"inet_sock", "dport");
MEMBER_OFFSET_INIT(inet_opt_sport,
"inet_sock", "sport");
MEMBER_OFFSET_INIT(inet_opt_num,
"inet_sock", "num");
- } else {
+ } else if (MEMBER_EXISTS("inet_sock",
"inet_daddr")) {
MEMBER_OFFSET_INIT(inet_opt_daddr,
"inet_sock", "inet_daddr");
MEMBER_OFFSET_INIT(inet_opt_rcv_saddr,
"inet_sock", "inet_rcv_saddr");
MEMBER_OFFSET_INIT(inet_opt_dport,
"inet_sock", "inet_dport");
MEMBER_OFFSET_INIT(inet_opt_sport,
"inet_sock", "inet_sport");
MEMBER_OFFSET_INIT(inet_opt_num,
"inet_sock", "inet_num");
+ } else if ((MEMBER_OFFSET("inet_sock",
"sk") == 0) &&
+ (MEMBER_OFFSET("sock",
"__sk_common") == 0)) {
+ MEMBER_OFFSET_INIT(inet_opt_daddr,
"sock_common", "skc_daddr");
+ MEMBER_OFFSET_INIT(inet_opt_rcv_saddr,
"sock_common", "skc_rcv_saddr");
+ MEMBER_OFFSET_INIT(inet_opt_dport,
"inet_sock", "inet_dport");
+ MEMBER_OFFSET_INIT(inet_opt_sport,
"inet_sock", "inet_sport");
+ MEMBER_OFFSET_INIT(inet_opt_num,
"inet_sock", "inet_num");
}
}
Queued for crash-5.1.9.
Thanks,
Dave