Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 4:29 PM, Atish Patra wrote: > On 11/07/2017 04:42 PM, Y Song wrote: >> >> On Tue, Nov 7, 2017 at 2:04 PM, Alexei Starovoitov wrote: >>> >>> On 11/8/17 6:47 AM, Y Song wrote: On Tue, Nov 7, 2017 at 1:39 PM, Alexei

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Atish Patra
On 11/07/2017 04:42 PM, Y Song wrote: On Tue, Nov 7, 2017 at 2:04 PM, Alexei Starovoitov wrote: On 11/8/17 6:47 AM, Y Song wrote: On Tue, Nov 7, 2017 at 1:39 PM, Alexei Starovoitov wrote: On 11/8/17 6:14 AM, Y Song wrote: On Tue, Nov 7, 2017 at 12:37 AM,

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 2:04 PM, Alexei Starovoitov wrote: > On 11/8/17 6:47 AM, Y Song wrote: >> >> On Tue, Nov 7, 2017 at 1:39 PM, Alexei Starovoitov wrote: >>> >>> On 11/8/17 6:14 AM, Y Song wrote: On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Alexei Starovoitov
On 11/8/17 6:47 AM, Y Song wrote: On Tue, Nov 7, 2017 at 1:39 PM, Alexei Starovoitov wrote: On 11/8/17 6:14 AM, Y Song wrote: On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao wrote: Alexei Starovoitov wrote: On 11/7/17 12:55 AM, Naveen N. Rao

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 1:39 PM, Alexei Starovoitov wrote: > On 11/8/17 6:14 AM, Y Song wrote: >> >> On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao >> wrote: >>> >>> Alexei Starovoitov wrote: On 11/7/17 12:55 AM, Naveen N. Rao wrote:

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 1:31 PM, Atish Patra wrote: > On 11/07/2017 03:14 PM, Y Song wrote: >> >> On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao >> wrote: >>> >>> Alexei Starovoitov wrote: On 11/7/17 12:55 AM, Naveen N. Rao

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Alexei Starovoitov
On 11/8/17 6:14 AM, Y Song wrote: On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao wrote: Alexei Starovoitov wrote: On 11/7/17 12:55 AM, Naveen N. Rao wrote: I thought such struct shouldn't change layout. If it is we need to fix include/linux/compiler-clang.h

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Atish Patra
On 11/07/2017 03:14 PM, Y Song wrote: On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao wrote: Alexei Starovoitov wrote: On 11/7/17 12:55 AM, Naveen N. Rao wrote: I thought such struct shouldn't change layout. If it is we need to fix

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Y Song
On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao wrote: > Alexei Starovoitov wrote: >> >> On 11/7/17 12:55 AM, Naveen N. Rao wrote: I thought such struct shouldn't change layout. If it is we need to fix include/linux/compiler-clang.h to do that

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Naveen N. Rao
Alexei Starovoitov wrote: On 11/7/17 12:55 AM, Naveen N. Rao wrote: I thought such struct shouldn't change layout. If it is we need to fix include/linux/compiler-clang.h to do that anon struct as well. We considered that, but it looked to be very dependent on the version of gcc used to build

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-07 Thread Alexei Starovoitov
On 11/7/17 12:55 AM, Naveen N. Rao wrote: I thought such struct shouldn't change layout. If it is we need to fix include/linux/compiler-clang.h to do that anon struct as well. We considered that, but it looked to be very dependent on the version of gcc used to build the kernel. But, this may

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-06 Thread Tushar Dave
On 11/02/2017 11:58 PM, Sandipan Das wrote: For added security, the layout of some structures can be randomized by enabling CONFIG_GCC_PLUGIN_RANDSTRUCT. One such structure is task_struct. To build BPF programs, we use Clang which does not support this feature. So, if we attempt to read a

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-06 Thread Naveen N. Rao
Alexei Starovoitov wrote: On 11/5/17 2:31 AM, Naveen N. Rao wrote: Hi Alexei, Alexei Starovoitov wrote: On 11/3/17 3:58 PM, Sandipan Das wrote: For added security, the layout of some structures can be randomized by enabling CONFIG_GCC_PLUGIN_RANDSTRUCT. One such structure is task_struct. To

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-05 Thread Sandipan Das
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

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-04 Thread Alexei Starovoitov
On 11/5/17 2:31 AM, Naveen N. Rao wrote: Hi Alexei, Alexei Starovoitov wrote: On 11/3/17 3:58 PM, Sandipan Das wrote: For added security, the layout of some structures can be randomized by enabling CONFIG_GCC_PLUGIN_RANDSTRUCT. One such structure is task_struct. To build BPF programs, we use

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-04 Thread Naveen N. Rao
Hi Alexei, Alexei Starovoitov wrote: On 11/3/17 3:58 PM, Sandipan Das wrote: For added security, the layout of some structures can be randomized by enabling CONFIG_GCC_PLUGIN_RANDSTRUCT. One such structure is task_struct. To build BPF programs, we use Clang which does not support this feature.

Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-04 Thread Alexei Starovoitov
On 11/3/17 3:58 PM, Sandipan Das wrote: For added security, the layout of some structures can be randomized by enabling CONFIG_GCC_PLUGIN_RANDSTRUCT. One such structure is task_struct. To build BPF programs, we use Clang which does not support this feature. So, if we attempt to read a field of a

[RFC PATCH] bpf: Add helpers to read useful task_struct members

2017-11-03 Thread Sandipan Das
For added security, the layout of some structures can be randomized by enabling CONFIG_GCC_PLUGIN_RANDSTRUCT. One such structure is task_struct. To build BPF programs, we use Clang which does not support this feature. So, if we attempt to read a field of a structure with a randomized layout within