lkml.org 
[lkml]   [2017]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [RFC PATCH] bpf: Add helpers to read useful task_struct members
    From
    Date
    Hi Alexei, Naveen,

    On 11/04/2017 11:01 PM, Naveen N. Rao wrote:
    >
    > I think the offsets described in dwarf were incorrect with CONFIG_GCC_PLUGIN_RANDSTRUCT, but I'll let Sandipan confirm that.
    >

    I think that the offsets described in dwarf are probably incorrect when
    CONFIG_GCC_PLUGIN_RANDSTRUCT is enabled. To verify this, I used perf
    to attach a probe to try_to_wake_up() which is the also the function to
    which waker() is attached in the previously mentioned kernel sample. So,
    if the run the following:

    # perf probe "try_to_wake_up" "p->pid"
    # perf record -a -e probe:try_to_wake_up
    # perf script

    The value of p->pid is reported as 0. Similarly, if I try to read
    p->comm, it is reported to be an empty string. The same problem is
    seen with systemtap as well.

    Also, if I do a printk with offsetof(struct task_struct, pid) and
    offsetof(struct task_struct, comm) inside the kernel code and then
    compare the values with the offsets reported by pahole, they are
    completely different.

    - Sandipan

    \
     
     \ /
      Last update: 2017-11-06 06:17    [W:3.067 / U:0.304 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site