[Crash-utility] PATCH: fix get_sock_info failure on 2.6.38

Bob Montgomery bob.montgomery at hp.com
Fri Oct 14 21:26:45 UTC 2011


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 Montgomery


   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash_inet_daddr.patch
Type: text/x-patch
Size: 1135 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20111014/5ab2374c/attachment.bin>


More information about the Crash-utility mailing list