in case of an architecture like powerpc64 which uses 64K
as the default page size (i.e. CONFIG_PPC_64K_PAGES is set).
So, instead of depending on the page size, use a constant value.
Fixes: ede95a63b5e8 ("bpf: add bpf_jit_limit knob to restrict unpriv
allocations")
Signed-off-by: Sa
ernel definitions of struct pt_regs")
Signed-off-by: Sandipan Das
---
arch/powerpc/include/asm/perf_event.h | 2 ++
arch/powerpc/include/uapi/asm/Kbuild | 1 -
arch/powerpc/include/uapi/asm/bpf_perf_event.h | 9 +
3 files changed, 11 insertions(+), 1 deletion(-)
create m
On 06/12/18 12:22 AM, Jiong Wang wrote:
> This patch implements code-gen for BPF_ALU | BPF_ARSH | BPF_*.
>
> Cc: Naveen N. Rao
> Cc: Sandipan Das
> Signed-off-by: Jiong Wang
> ---
> arch/powerpc/include/asm/ppc-opcode.h | 2 ++
> arch/powerpc/net/bpf_jit.h
Hi Jiong,
On 05/12/18 2:25 AM, Jiong Wang wrote:
> This patch implements code-gen for BPF_ALU | BPF_ARSH | BPF_*.
>
> Cc: Naveen N. Rao
> Cc: Sandipan Das
> Signed-off-by: Jiong Wang
> ---
[...]
> diff --git a/arch/powerpc/net/bpf_jit_comp64.c
> b/arch/powerpc/net/
Hi Daniel,
On 03/12/18 6:18 PM, Daniel Borkmann wrote:
>
> Thanks for the patch, just to clarify, it's targeted at bpf-next and
> not bpf, correct?
>
This patch is targeted at the bpf tree.
This depends on commit e2c95a61656d ("bpf, ppc64: generalize fetching
subprog into
hs of functions via syscall") forgot about doing so and therefore
> returns the #elems of the user set up buffer which is incorrect. It
> also needs to indicate a info.nr_jited_func_lens of zero.
>
> Fixes: 815581c11cc2 ("bpf: get JITed image lengths of functions via syscall"
On 05/24/2018 01:04 PM, Daniel Borkmann wrote:
> On 05/24/2018 08:56 AM, Sandipan Das wrote:
>> For multi-function programs, loading the address of a callee
>> function to a register requires emitting instructions whose
>> count varies from one to five depending on the nat
Syncing the bpf.h uapi header with tools so that struct
bpf_prog_info has the two new fields for passing on the
addresses of the kernel symbols corresponding to each
function in a program.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v3:
- Move new fields to t
of the instruction to determine
the callee's address. Instead, we use the alternative method of
getting it from the list of function addresses in the auxiliary
data of the caller by using the off field as an index.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v3:
- Fix memory leak for ji
0: nop
4: nop
8: mflrr0
c: std r0,16(r1)
10: stdur1,-112(r1)
14: std r31,104(r1)
18: addir31,r1,48
1c: li r3,10
...
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v4:
- If the image allocated in use
applications like bpftool
to split up the contiguous JITed dump, also obtained via
the system call, into more relatable chunks corresponding
to each function.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
include/uapi/linux/bpf.h | 2 ++
kernel/bpf/syscall.c
required to load this
address may vary from what was previously generated. This can
make the JITed image grow or shrink.
To avoid this, we should generate a constant five-instruction
when loading function addresses by padding the optimized load
sequence with NOPs.
Signed-off-by: Sandipan Das <sa
of a callee's corresponding
symbol by using the imm field as an index for the
list of kernel symbol addresses now available from
the program info.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v3:
- Co
for this list to lookup a callee's symbol's
address and resolve its name.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
Reviewed-by: Jakub Kicinski <jakub.kicin...@netronome.com>
---
v3:
- Avoid using redundant pointers.
- Fi
Syncing the bpf.h uapi header with tools so that struct
bpf_prog_info has the two new fields for passing on the
JITed image lengths of each function in a multi-function
program.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
tools/include/uapi/linux/bpf.h | 2 ++
1 file chan
t;: ["%rbp"
]
},{
...
},{
"pc": "0x71",
"operation": "retq",
"operands": [null
]
}
]
},{
"name&
after
the last pass due to the way the instruction sequence used
to load a callee's address maybe optimized.
- Make additional changes to the bpf system call and bpftool to
make multi-function JITed dumps easier to correlate.
v2:
- Incorporate review comments from Jakub.
Sandipan Das
instructions and using it to index into the list mentioned
above and lookup the callee's address.
To make sure that the existing JIT compilers continue to work
without requiring changes, we keep the imm field as it is.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
kern
On 05/23/2018 07:20 PM, Daniel Borkmann wrote:
> On 05/23/2018 12:37 PM, Sandipan Das wrote:
> [...]
>> Other than that, for powerpc64, there is a problem with the way the
>> binutils disassembler code (in "opcodes/ppc-dis.c") passes arguments
>
On 05/23/2018 02:38 PM, Daniel Borkmann wrote:
> On 05/22/2018 09:55 PM, Jakub Kicinski wrote:
>> On Tue, 22 May 2018 22:46:13 +0530, Sandipan Das wrote:
>>> + if (info.nr_jited_func_lens && info.jited_func_lens) {
>>> +
instructions and using it to index into the list mentioned
above and lookup the callee's address.
To make sure that the existing JIT compilers continue to work
without requiring changes, we keep the imm field as it is.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
kern
of the instruction to determine
the callee's address. Instead, we use the alternative method of
getting it from the list of function addresses in the auxiliary
data of the caller by using the off field as an index.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v3:
- Fix memory leak for ji
required to load this
address may vary from what was previously generated. This can
make the JITed image grow or shrink.
To avoid this, we should generate a constant five-instruction
when loading function addresses by padding the optimized load
sequence with NOPs.
Signed-off-by: Sandipan Das <sa
changes to the bpf system call and bpftool to
make multi-function JITed dumps easier to correlate.
v2:
- Incorporate review comments from Jakub.
Sandipan Das (10):
bpf: support 64-bit offsets for bpf function calls
bpf: powerpc64: pad function address loads with NOPs
bpf: powerpc64: add JIT
of a callee's corresponding
symbol by using the imm field as an index for the
list of kernel symbol addresses now available from
the program info.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v3:
- Co
for this list to lookup a callee's symbol's
address and resolve its name.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v3:
- Avoid using redundant pointers.
- Fix indentation.
v2:
- Order variables from longest to shortest.
0: nop
4: nop
8: mflrr0
c: std r0,16(r1)
10: stdur1,-112(r1)
14: std r31,104(r1)
18: addir31,r1,48
1c: li r3,10
...
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
kernel/bpf/syscall.
a8: mr r3,r8
ac: blr
bpf_prog_196af774a3477707_F:
0: nop
4: nop
8: mflrr0
c: std r0,16(r1)
10: stdur1,-112(r1)
14: std r31,104(r1)
...
88: mr r3,r8
8c: blr
Signed-off-by: Sandipan Das
Syncing the bpf.h uapi header with tools so that struct
bpf_prog_info has the two new fields for passing on the
JITed image lengths of each function in a multi-function
program.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
tools/include/uapi/linux/bpf.h | 2 ++
1 file chan
applications like bpftool
to split up the contiguous JITed dump, also obtained via
the system call, into more relatable chunks corresponding
to each function.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
include/uapi/linux/bpf.h | 2 ++
kernel/bpf/syscall.c
Syncing the bpf.h uapi header with tools so that struct
bpf_prog_info has the two new fields for passing on the
addresses of the kernel symbols corresponding to each
function in a program.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v3:
- Move new fields to t
Hi Daniel,
On 05/18/2018 09:21 PM, Daniel Borkmann wrote:
> On 05/18/2018 02:50 PM, Sandipan Das wrote:
>> Currently, for multi-function programs, we cannot get the JITed
>> instructions using the bpf system call's BPF_OBJ_GET_INFO_BY_FD
>> command. Because of
On 05/18/2018 08:45 PM, Daniel Borkmann wrote:
> On 05/18/2018 02:50 PM, Sandipan Das wrote:
>> The imm field of a bpf instruction is a signed 32-bit integer.
>> For JIT bpf-to-bpf function calls, it stores the offset of the
>> start address of the callee's JITed image
Syncing the bpf.h uapi header with tools so that struct
bpf_prog_info has the two new fields for passing on the
addresses of the kernel symbols corresponding to each
function in a JITed program.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
tools/include/uapi/linux/bpf
of the instruction to determine
the callee's address. Instead, we use the alternative method of
getting it from the list of function addresses in the auxillary
data of the caller by using the off field as an index.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
arch/powerpc/net/bpf_jit_co
0: nop
4: nop
8: mflrr0
c: std r0,16(r1)
10: stdur1,-112(r1)
14: std r31,104(r1)
18: addir31,r1,48
1c: li r3,10
...
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
kernel/bpf/syscall.
of a callee's corresponding
symbol by using the imm field as an index for the
list of kernel symbol addresses now available from
the program info.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
include/uapi
for this list to lookup a callee's symbol's
address and resolve its name.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v2:
- Order variables from longest to shortest
- Make sure that ksyms_ptr and ksyms_len are always
instructions and using it to index into the list mentioned
above and lookup the callee's address.
To make sure that the existing JIT compilers continue to work
without requiring changes, we keep the imm field as it is.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
kern
from
the bpf system call.
v2:
- Incorporate review comments from Jakub
Sandipan Das (6):
bpf: support 64-bit offsets for bpf function calls
bpf: powerpc64: add JIT support for multi-function programs
bpf: get kernel symbol addresses via syscall
tools: bpf: sync bpf uapi header
tools
Hi Jakub,
On 05/18/2018 12:21 AM, Jakub Kicinski wrote:
> On Thu, 17 May 2018 12:05:47 +0530, Sandipan Das wrote:
>> Currently, we resolve the callee's address for a JITed function
>> call by using the imm field of the call instruction as an offset
>> from __bpf_call_base
of the instruction to determine
the callee's address. Instead, we use the alternative method of
getting it from the list of function addresses in the auxillary
data of the caller by using the off field as an index.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
arch/powerpc/net/bpf_jit_co
instructions and using it to index into the list mentioned
above and lookup the callee's address.
To make sure that the existing JIT compilers continue to work
without requiring changes, we keep the imm field as it is.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
kern
Syncing the bpf.h uapi header with tools so that struct
bpf_prog_info has the two new fields for passing on the
addresses of the kernel symbols corresponding to each
function in a JITed program.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
tools/include/uapi/linux/bpf
0: nop
4: nop
8: mflrr0
c: std r0,16(r1)
10: stdur1,-112(r1)
14: std r31,104(r1)
18: addir31,r1,48
1c: li r3,10
...
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
kernel/bpf/syscall.
of a callee's corresponding
symbol by using the imm field as an index for the
list of kernel symbol addresses now available from
the program info.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
include/uapi
from
the bpf system call.
Sandipan Das (6):
bpf: support 64-bit offsets for bpf function calls
bpf: powerpc64: add JIT support for multi-function programs
bpf: get kernel symbol addresses via syscall
tools: bpf: sync bpf uapi header
tools: bpftool: resolve calls without using imm
for this list to lookup a callee's symbol's
address and resolve its name.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
tools/bpf/bpftool/prog.c | 31 +++
tools/bpf/bpftool/xlated_d
of a callee's corresponding
symbol by using the imm field as an index for the
list of function addresses now available from the
program info.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
include/uapi/linu
of the instruction to determine
the callee's address. Instead, we use the alternative method of
getting it from the list of function addresses in the auxillary
data of the caller by using the off field as an index.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v3: Mention briefly abo
Syncing the bpf.h uapi header with tools so that struct
bpf_prog_info has the new fields for storing the kernel
symbol addresses for the JITed functions in a program.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
tools/include/uapi/linux/bpf.h | 2 ++
1 file changed, 2 inse
instructions and using it to index into the list mentioned
above and lookup the callee's address.
To make sure that the existing JIT compilers continue to work
without requiring changes, we keep the imm field as it is.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v3: Rephrase
for this list to lookup a callee's symbol's
address and resolve its name.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
tools/bpf/bpftool/prog.c | 33 +
tools/bpf/bpftool/xlated_d
) r0 = 2
4: (95) exit
With this patch, it will look like this:
0: (85) call pc+2#bpf_prog_8f85936f29a7790a+3
1: (b7) r0 = 1
2: (95) exit
3: (b7) r0 = 2
4: (95) exit
where 8f85936f29a7790a is the tag of the bpf program and 3 is
the offset to the start of the subprog from t
nsn
as a way to index into aux->func and also set aux->func_cnt
so that this can be used for performing basic upper bound
checks for the off field.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v2: Make aux->func point to the list of functions determined
by the ve
is performed.
Since it is seen that the offsets may be as large as 64 bits for
powerpc64, we use the aux data associated with each caller to get
the correct branch target address rather than using the imm field
of the BPF_CALL instruction.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
v
On 02/10/2018 06:08 AM, Alexei Starovoitov wrote:
> On 2/9/18 8:54 AM, Naveen N. Rao wrote:
>> Naveen N. Rao wrote:
>>> Alexei Starovoitov wrote:
>>>> On 2/8/18 4:03 AM, Sandipan Das wrote:
>>>>> The imm field of a bpf_insn is a signed 32-bit intege
is performed.
Since it is seen that the offsets may be as large as 64 bits for
powerpc64, we use the aux data associated with each caller to get
the correct branch target address rather than using the imm field
of the BPF_CALL instruction.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
this
cannot be accomodated in the imm field without truncation.
To resolve this, we additionally use the aux data within each
bpf_prog associated with the caller functions to store the
addresses of their respective callees.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
kern
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
To avoid this, we add new BPF helpers that read the
correct values for some of the important task_struct
members such as pid, tgid, comm and flags which are
extensively used in BPF-based analysis tools such as
bcc. Since these helpers are built with GCC, they use
the correct offsets when refer
Take advantage of stack_depth tracking, originally introduced for
x64, in powerpc JIT as well. Round up allocated stack by 16 bytes
to make sure it stays aligned for functions called from JITed bpf
program.
Signed-off-by: Sandipan Das <sandi...@linux.vnet.ibm.com>
---
arch/powerpc/net/bpf
62 matches
Mail list logo