[Crash-utility] [PATCH] add a new command: ipcs

Wen Congyang ghostwcy at gmail.com
Wed Apr 11 15:14:39 UTC 2012


At 2012/4/11 22:50, Dave Anderson Wrote:
>
>
> ----- Original Message -----
>> Hello Dave,
>>
>> I cannot get all kernels at hand. So I have to ask you about the code.
>> Please show me.
>
> Why not?  Just download the upstream kernels from here:
>
>    http://www.kernel.org/pub/linux/kernel/v2.6/
>
>>>
>>> (a) On these kernel versions:
>>>
>>>       2.6.9-89.ELxenU
>>>       2.6.15-1.2054_FC5
>>>       2.6.16.33-xen
>>>       2.6.18-1.2714.el5xen
>>>       2.6.18-36.el5xen
>>>       2.6.18-58.el5xen
>>>       2.6.18-152.el5xen
>>>       2.6.31 uniprocessor kernel
>>>
>>>       the command fails immediatedly with this error:
>>>
>>>         ipcs: cannot resolve "hugetlbfs_file_operations"
>>>
>>>
>>> (b) On *all* RHEL5 2.6.18-era kernels, the message queue display
>>>       always fails like this:
>>>
>>>       ------ Message Queues --------
>>>       KEY        MSQID      UID        PERMS      USED-BYTES
>>>         MESSAGES
>>>       ipcs: invalid structure member offset: kern_ipc_perm_id
>>>             FILE: ipcs.c  LINE: 899  FUNCTION: get_msg_info()
>>
>> I want to see the struct msg_queue and struct struct kern_ipc_perm.
>
> Here is the output from a RHEL5 kernel:
>
>   crash>  msg_queue
>   struct msg_queue {
>       struct kern_ipc_perm q_perm;
>       int q_id;
>       time_t q_stime;
>       time_t q_rtime;
>       time_t q_ctime;
>       long unsigned int q_cbytes;
>       long unsigned int q_qnum;
>       long unsigned int q_qbytes;
>       pid_t q_lspid;
>       pid_t q_lrpid;
>       struct list_head q_messages;
>       struct list_head q_receivers;
>       struct list_head q_senders;
>   }
>   SIZE: 160
>   crash>  kern_ipc_perm
>   struct kern_ipc_perm {
>       spinlock_t lock;
>       int deleted;
>       key_t key;
>       uid_t uid;
>       gid_t gid;
>       uid_t cuid;
>       gid_t cgid;
>       mode_t mode;
>       long unsigned int seq;
>       void *security;
>   }
>   SIZE: 48
>   crash>
>
> which is the same as the upstream 2.6.18 kernel.

Ahh, I khow the reason now: msg_queue_q_id is not initialized!!!!

>
>>>
>>> (c) On this 2.6.36-0.16.rc3.git0.fc15 Fedora kernel, it shows:
>>>
>>>       ------ Shared Memory Segments ------
>>>       KEY        SHMID      UID        PERMS      BYTES      NATTCH
>>>           STATUS
>>>       ipcs: invalid kernel virtual address: 10  type: "nsproxy.ipc_ns"
>>
>> what is struct nsproxy? Or is there any symbol referring to ipc_ns?
>
>   crash>  nsproxy
>   struct nsproxy {
>       atomic_t count;
>       struct uts_namespace *uts_ns;
>       struct ipc_namespace *ipc_ns;
>       struct mnt_namespace *mnt_ns;
>       struct pid_namespace *pid_ns;
>       struct net *net_ns;
>   }
>   SIZE: 48
>   crash>
>
> It's the same as upstream 2.6.36, but it's not the offset that's invalid,
> it's the NULL "nsproxy" address.

I am surprised that nsproxy is NULL.

Each user task belongs to a namesapce, so current_task.nsproxy should not
be NULL. I guess the current task may be a kernel thread in your test.

Thanks
Wen Congyang

>
>>
>>>
>>>
>>> (d) On *all* RHEL4 2.6.9-era and SLES9 2.6.5-era kernels, the
>>> command fail like this:
>>>
>>>       ------ Shared Memory Segments ------
>>>       KEY        SHMID      UID        PERMS      BYTES      NATTCH
>>>           STATUS
>>>       ipcs: invalid structure member offset: ipc_id_ary_p
>>>             FILE: ipcs.c  LINE: 540  FUNCTION: ipc_search_array()
>>>
>>>       or this:
>>>
>>>       ------ Shared Memory Segments ------
>>>       KEY        SHMID      UID        PERMS      BYTES      NATTCH
>>>           STATUS
>>>       (none allocated)------ Semaphore Arrays --------
>>>       KEY        SEMID      UID        PERMS      NSEMS
>>>       ipcs: invalid structure member offset: ipc_id_ary_p
>>>             FILE: ipcs.c  LINE: 540  FUNCTION: ipc_search_array()
>>>
>>
>> what is struct ipc_id? And what is entries in struct ipc_id or something
>> similar to it?
>
> This is from a RHEL4 kernel -- and the upstream 2.6.9 kernel is the same:
>
>   crash>  ipc_id
>   struct ipc_id {
>       struct kern_ipc_perm *p;
>   }
>   SIZE: 8
>   crash>  kern_ipc_perm
>   struct kern_ipc_perm {
>       spinlock_t lock;
>       int deleted;
>       key_t key;
>       uid_t uid;
>       gid_t gid;
>       uid_t cuid;
>       gid_t cgid;
>       mode_t mode;
>       long unsigned int seq;
>       void *security;
>   }
>   SIZE: 56
>   crash>
>
> Dave
>
>
>
>
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
>




More information about the Crash-utility mailing list