netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sandipan Das <sandipan@linux.vnet.ibm.com>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	Alexei Starovoitov <ast@fb.com>,
	netdev@vger.kernel.org
Cc: daniel@iogearbox.net, Martin KaFai Lau <kafai@fb.com>,
	linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
	Brendan Gregg <brendan.d.gregg@gmail.com>
Subject: Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members
Date: Mon, 6 Nov 2017 10:46:46 +0530	[thread overview]
Message-ID: <fbfed65c-f40e-bb07-1b82-a6af2cfe3bdf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1509815348.8zu63uatdo.naveen@linux.ibm.com>

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

  parent reply	other threads:[~2017-11-06  5:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03  6:58 [RFC PATCH] bpf: Add helpers to read useful task_struct members Sandipan Das
2017-11-04  9:34 ` Alexei Starovoitov
2017-11-04 17:31   ` Naveen N. Rao
2017-11-04 21:10     ` Alexei Starovoitov
2017-11-06 15:55       ` Naveen N. Rao
2017-11-07  8:08         ` Alexei Starovoitov
2017-11-07  8:37           ` Naveen N. Rao
2017-11-07 21:14             ` Y Song
2017-11-07 21:31               ` Atish Patra
2017-11-07 21:45                 ` Y Song
2017-11-07 21:39               ` Alexei Starovoitov
2017-11-07 21:47                 ` Y Song
2017-11-07 22:04                   ` Alexei Starovoitov
2017-11-07 22:42                     ` Y Song
2017-11-08  0:29                       ` Atish Patra
2017-11-08  1:25                         ` Y Song
2017-11-06  5:16     ` Sandipan Das [this message]
2017-11-07  0:16 ` Tushar Dave

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fbfed65c-f40e-bb07-1b82-a6af2cfe3bdf@linux.vnet.ibm.com \
    --to=sandipan@linux.vnet.ibm.com \
    --cc=ast@fb.com \
    --cc=brendan.d.gregg@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).