[RFC 06/10] media: platform: Add Sunxi Cedrus decoder driver

2016-08-25 Thread Florent Revest
ngineering on which I based my work comes from the "Cedrus" project: http://linux-sunxi.org/Cedrus The driver currently only runs on the A13 and this patch doesn't include any codec. Signed-off-by: Florent Revest <florent.rev...@free-electrons.com> --- driv

[RFC 01/10] clk: sunxi-ng: Add a couple of A13 clocks

2016-08-25 Thread Florent Revest
Add a new style driver for the clock control unit in Allwinner A13. Only AVS and VE are supported since they weren't provided until now and are needed for "sunxi-cedrus". Signed-off-by: Florent Revest <florent.rev...@free-electrons.com> --- .../devicetree/bindings/clo

[RFC 02/10] v4l: Add private compound control type.

2016-08-25 Thread Florent Revest
From: Pawel Osciak <posc...@chromium.org> V4L2_CTRL_TYPE_PRIVATE is to be used for private driver compound controls that use the "ptr" member of struct v4l2_ext_control. Signed-off-by: Pawel Osciak <posc...@chromium.org> Signed-off-by: Jung Zhao <jung.z...@rock-chips.co

[RFC 05/10] v4l: Add MPEG4 low-level decoder API control

2016-08-25 Thread Florent Revest
This control is to be used with the new low-level decoder API for MPEG4 to provide additional parameters for the hardware that cannot parse the input stream. Some fields are still missing for this structure to be complete. Signed-off-by: Florent Revest <florent.rev...@free-electrons.

[RFC 09/10] ARM: dts: sun5i: Use video-engine node

2016-08-25 Thread Florent Revest
Now that we have a driver matching "allwinner,sun5i-a13-video-engine" we can load it. The "video-engine" node depends on the new sunxi-ng's CCU clock and reset bindings. This patch also includes a ve_reserved DMA pool for videobuf2 buffer allocations in sunxi-cedrus. Si

[RFC 04/10] v4l: Add MPEG2 low-level decoder API control

2016-08-25 Thread Florent Revest
This control is to be used with the new low-level decoder API for MPEG2 to provide additional parameters for the hardware that cannot parse the input stream. Signed-off-by: Florent Revest <florent.rev...@free-electrons.com> --- drivers/media/v4l2-core/v4l2-ctrls.c | 11 +++ drivers

[RFC 10/10] sunxi-cedrus: Add device tree binding document

2016-08-25 Thread Florent Revest
Device Tree bindings for the Allwinner's video engine Signed-off-by: Florent Revest <florent.rev...@free-electrons.com> --- .../devicetree/bindings/media/sunxi-cedrus.txt | 44 ++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings

[RFC 07/10] sunxi-cedrus: Add a MPEG 2 codec

2016-08-25 Thread Florent Revest
This patch introduces the support of MPEG2 video decoding to the sunxi-cedrus video decoder driver. Signed-off-by: Florent Revest <florent.rev...@free-electrons.com> --- drivers/media/platform/sunxi-cedrus/Makefile | 2 +- drivers/media/platform/sunxi-cedrus/sunxi_cedrus.c

[RFC 00/10] Add Sunxi Cedrus Video Decoder Driver

2016-08-25 Thread Florent Revest
d/1RLkH3QxdmrcW_t41KllEvUmVsrHMbMOgd6CqAgzR7U4/pub?slide=id.p [3] https://lwn.net/Articles/688585/ [4] https://lwn.net/Articles/641204/ [5] https://github.com/FlorentRevest/linux-sunxi-cedrus [6] https://github.com/FlorentRevest/sunxi-cedrus-drv-video Florent Revest (9): clk: sunxi-ng: Add a couple

[RFC 03/10] v4l: Add sunxi Video Engine pixel format

2016-08-25 Thread Florent Revest
Add support for the allwinner's proprietary pixel format described in details here: http://linux-sunxi.org/File:Ve_tile_format_v1.pdf This format is similar to V4L2_PIX_FMT_NV12M but the planes are divided in tiles of 32x32px. Signed-off-by: Florent Revest <florent.rev...@free-electrons.

[RFC 08/10] sunxi-cedrus: Add a MPEG 4 codec

2016-08-25 Thread Florent Revest
This patch introduces the support of MPEG4 video decoding to the sunxi-cedrus video decoder driver. Signed-off-by: Florent Revest <florent.rev...@free-electrons.com> --- drivers/media/platform/sunxi-cedrus/Makefile | 3 +- drivers/media/platform/sunxi-cedrus/sunxi_cedrus.c

Re: [RFC 04/11] KVM, arm, arm64: Offer PAs to IPAs idmapping to internal VMs

2017-09-26 Thread Florent Revest
On Thu, 2017-08-31 at 11:23 +0200, Christoffer Dall wrote: > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > > index 2ea21da..1d2d3df 100644 > > --- a/virt/kvm/arm/mmu.c > > +++ b/virt/kvm/arm/mmu.c > > @@ -772,6 +772,11 @@ static void stage2_unmap_memslot(struct kvm > > *kvm, > >

Re: [RFC 00/11] KVM, EFI, arm64: EFI Runtime Services Sandboxing

2017-09-26 Thread Florent Revest
On Thu, 2017-08-31 at 11:26 +0200, Christoffer Dall wrote: > I wonder if this should be split into two series; one that sets up > anything you may need from KVM, and another one that uses that for > UEFI. > > There's a lot KVM and UEFI intertwined logic and assumptions in patch > 10, which makes

Re: [RFC 00/11] KVM, EFI, arm64: EFI Runtime Services Sandboxing

2017-09-26 Thread Florent Revest
On Fri, 2017-09-22 at 14:44 -0700, Ard Biesheuvel wrote: > From the EFI side, there are some minor concerns on my part regarding > the calling convention, and the fact that we can no longer invoke > runtime services from a kernel running at EL1, but those all seem > fixable. I will respond to the

Re: [RFC 00/11] KVM, EFI, arm64: EFI Runtime Services Sandboxing

2017-08-25 Thread Florent Revest
Hi, I just realised that my email client was not configured correctly and the confidential disclaimer at the bottom of my emails obviously don't apply. Sorry about that. Florent IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If

[RFC 05/11] KVM: Expose VM/VCPU creation functions

2017-08-25 Thread Florent Revest
ion - kvm_vm_create_vcpu: simple alias of kvm_vm_ioctl_create_vcpu for clarity Signed-off-by: Florent Revest <florent.rev...@arm.com> --- include/linux/kvm_host.h | 3 +++ virt/kvm/kvm_main.c | 10 ++ 2 files changed, 13 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_hos

[RFC 09/11] EFI, arm, arm64: Enable EFI Runtime Services later

2017-08-25 Thread Florent Revest
-by: Florent Revest <florent.rev...@arm.com> --- arch/arm/include/asm/efi.h | 2 ++ arch/arm64/include/asm/efi.h | 2 ++ arch/x86/include/asm/efi.h | 2 ++ drivers/firmware/efi/arm-runtime.c | 3 +-- drivers/firmware/efi/efi.c | 3 +++ 5 files changed, 10 insertions

[RFC 02/11] KVM: arm64: Return an Unknown ID on unhandled HVC

2017-08-25 Thread Florent Revest
Identifier is returned in x0. This implements the behavior defined by SMCCC and paves the way for other hvc handlers. Signed-off-by: Florent Revest <florent.rev...@arm.com> --- arch/arm/include/asm/kvm_psci.h | 1 + arch/arm64/include/asm/kvm_psci.h | 1 + arch/arm64/kvm/handle_

[RFC 00/11] KVM, EFI, arm64: EFI Runtime Services Sandboxing

2017-08-25 Thread Florent Revest
se patches apply cleanly on the Linus' v4.13-rc6 tag and have no other dependencies. Florent Revest (11): arm64: Add an SMCCC function IDs header KVM: arm64: Return an Unknown ID on unhandled HVC KVM: Allow VM lifecycle management without userspace KVM, arm, arm64: Offer PAs to IPAs

[RFC 06/11] KVM, arm64: Expose a VCPU initialization function

2017-08-25 Thread Florent Revest
ke it less misleading. Signed-off-by: Florent Revest <florent.rev...@arm.com> --- arch/arm64/include/asm/kvm_host.h | 2 ++ virt/kvm/arm/arm.c| 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/

[RFC 07/11] KVM: Allow initialization before the module target

2017-08-25 Thread Florent Revest
-by: Florent Revest <florent.rev...@arm.com> --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 28 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index dd10d3b..15a0a8d 100644 --- a/include

[RFC 04/11] KVM, arm, arm64: Offer PAs to IPAs idmapping to internal VMs

2017-08-25 Thread Florent Revest
ote: this patch should have pretty much no performance impact on the critical path of traditional VMs since only one unlikely branch had to be added to the page fault handler. Signed-off-by: Florent Revest <florent.rev...@arm.com> --- arch/arm64/include/asm/kvm_host.h | 1 + virt/kvm/

[RFC 03/11] KVM: Allow VM lifecycle management without userspace

2017-08-25 Thread Florent Revest
This patch simply encloses the userspace-specific pieces of code of kvm_main in conditions checking if kvm->mm is present and modifies the prototype of kvm_create_vm to enable NULL mm. Signed-off-by: Florent Revest <florent.rev...@arm.com> --- vir

[RFC 08/11] KVM, arm, arm64: Initialize KVM's core earlier

2017-08-25 Thread Florent Revest
on arm and arm64, the initialization of KVM system registers, is also rescheduled to be effective as soon as KVM's core is initialized. Signed-off-by: Florent Revest <florent.rev...@arm.com> --- arch/arm/include/asm/kvm_coproc.h| 3 +++ arch/arm/include/asm/kvm_host.h | 1 + arch/a

[RFC 10/11] efi, arm64: Sandbox Runtime Services in a VM

2017-08-25 Thread Florent Revest
when calling an EFI Runtime Service. Indeed, the buffers arguments are just pushed onto a stack in a data page without any regards to the ARM Calling Convention alignments. Signed-off-by: Florent Revest <florent.rev...@arm.com> --- arch/arm/include/asm/efi.h | 5 + arch

[RFC 11/11] KVM, arm64: Don't trap internal VMs SMC calls

2017-08-25 Thread Florent Revest
handle_smc. However, this would require some level of knowledge of the SMC calls arguments and EFI Runtime Services implementations. Signed-off-by: Florent Revest <florent.rev...@arm.com> --- arch/arm64/include/asm/kvm_emulate.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch

[RFC 01/11] arm64: Add an SMCCC function IDs header

2017-08-25 Thread Florent Revest
) The document also defines standard return values to be written into x0 after a hypercall handling. Once again, those macros can potentially be used from both the hypervisor or the guest. Signed-off-by: Florent Revest <florent.rev...@arm.com> --- include/linux/smccc_fn.

[RFC 02/11] KVM: arm64: Return an Unknown ID on unhandled HVC

2017-08-25 Thread Florent Revest
Identifier is returned in x0. This implements the behavior defined by SMCCC and paves the way for other hvc handlers. Signed-off-by: Florent Revest --- arch/arm/include/asm/kvm_psci.h | 1 + arch/arm64/include/asm/kvm_psci.h | 1 + arch/arm64/kvm/handle_exit.c | 24

[RFC 00/11] KVM, EFI, arm64: EFI Runtime Services Sandboxing

2017-08-25 Thread Florent Revest
se patches apply cleanly on the Linus' v4.13-rc6 tag and have no other dependencies. Florent Revest (11): arm64: Add an SMCCC function IDs header KVM: arm64: Return an Unknown ID on unhandled HVC KVM: Allow VM lifecycle management without userspace KVM, arm, arm64: Offer PAs to IPAs

[RFC 05/11] KVM: Expose VM/VCPU creation functions

2017-08-25 Thread Florent Revest
ion - kvm_vm_create_vcpu: simple alias of kvm_vm_ioctl_create_vcpu for clarity Signed-off-by: Florent Revest --- include/linux/kvm_host.h | 3 +++ virt/kvm/kvm_main.c | 10 ++ 2 files changed, 13 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 21a6fd6..dd10d3b 100

[RFC 09/11] EFI, arm, arm64: Enable EFI Runtime Services later

2017-08-25 Thread Florent Revest
-by: Florent Revest --- arch/arm/include/asm/efi.h | 2 ++ arch/arm64/include/asm/efi.h | 2 ++ arch/x86/include/asm/efi.h | 2 ++ drivers/firmware/efi/arm-runtime.c | 3 +-- drivers/firmware/efi/efi.c | 3 +++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch

[RFC 11/11] KVM, arm64: Don't trap internal VMs SMC calls

2017-08-25 Thread Florent Revest
handle_smc. However, this would require some level of knowledge of the SMC calls arguments and EFI Runtime Services implementations. Signed-off-by: Florent Revest --- arch/arm64/include/asm/kvm_emulate.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/kvm_emulate.h b

[RFC 10/11] efi, arm64: Sandbox Runtime Services in a VM

2017-08-25 Thread Florent Revest
when calling an EFI Runtime Service. Indeed, the buffers arguments are just pushed onto a stack in a data page without any regards to the ARM Calling Convention alignments. Signed-off-by: Florent Revest --- arch/arm/include/asm/efi.h | 5 + arch/arm64/include/asm/efi.h

[RFC 08/11] KVM, arm, arm64: Initialize KVM's core earlier

2017-08-25 Thread Florent Revest
on arm and arm64, the initialization of KVM system registers, is also rescheduled to be effective as soon as KVM's core is initialized. Signed-off-by: Florent Revest --- arch/arm/include/asm/kvm_coproc.h| 3 +++ arch/arm/include/asm/kvm_host.h | 1 + arch/arm/kvm/coproc.c

[RFC 04/11] KVM, arm, arm64: Offer PAs to IPAs idmapping to internal VMs

2017-08-25 Thread Florent Revest
ote: this patch should have pretty much no performance impact on the critical path of traditional VMs since only one unlikely branch had to be added to the page fault handler. Signed-off-by: Florent Revest --- arch/arm64/include/asm/kvm_host.h | 1 + virt/kvm/arm/mmu.c|

[RFC 07/11] KVM: Allow initialization before the module target

2017-08-25 Thread Florent Revest
-by: Florent Revest --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 28 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index dd10d3b..15a0a8d 100644 --- a/include/linux/kvm_host.h +++ b/include

[RFC 03/11] KVM: Allow VM lifecycle management without userspace

2017-08-25 Thread Florent Revest
This patch simply encloses the userspace-specific pieces of code of kvm_main in conditions checking if kvm->mm is present and modifies the prototype of kvm_create_vm to enable NULL mm. Signed-off-by: Florent Revest --- virt/kvm/kvm_main.c | 64 ++

[RFC 06/11] KVM, arm64: Expose a VCPU initialization function

2017-08-25 Thread Florent Revest
ke it less misleading. Signed-off-by: Florent Revest --- arch/arm64/include/asm/kvm_host.h | 2 ++ virt/kvm/arm/arm.c| 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 65aab35..07b7

[RFC 01/11] arm64: Add an SMCCC function IDs header

2017-08-25 Thread Florent Revest
) The document also defines standard return values to be written into x0 after a hypercall handling. Once again, those macros can potentially be used from both the hypervisor or the guest. Signed-off-by: Florent Revest --- include/linux/smccc_fn.h | 50

Re: [RFC 00/11] KVM, EFI, arm64: EFI Runtime Services Sandboxing

2017-08-25 Thread Florent Revest
Hi, I just realised that my email client was not configured correctly and the confidential disclaimer at the bottom of my emails obviously don't apply. Sorry about that. Florent IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If

Re: [PATCH bpf-next v5 4/4] selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

2021-01-20 Thread Florent Revest
On Wed, Jan 20, 2021 at 8:04 PM Alexei Starovoitov wrote: > > On Wed, Jan 20, 2021 at 9:08 AM KP Singh wrote: > > > > On Tue, Jan 19, 2021 at 5:00 PM Florent Revest wrote: > > > > > > This builds up on the existing socket cookie test which checks whether >

Re: [PATCH bpf-next v4 2/4] bpf: Expose bpf_get_socket_cookie to tracing programs

2021-01-19 Thread Florent Revest
On Wed, Dec 9, 2020 at 5:35 PM Daniel Borkmann wrote: > > On 12/9/20 2:26 PM, Florent Revest wrote: > > This needs two new helpers, one that works in a sleepable context (using > > sock_gen_cookie which disables/enables preemption) and one that does not > > (for perform

[PATCH bpf-next v5 4/4] selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

2021-01-19 Thread Florent Revest
attachment strategy and different headers. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/socket_cookie.c | 24 +++ .../selftests/bpf/progs/socket_cookie_prog.c | 41 --- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/tools/testing

[PATCH bpf-next v5 1/4] bpf: Be less specific about socket cookies guarantees

2021-01-19 Thread Florent Revest
by: Daniel Borkmann Signed-off-by: Florent Revest --- include/uapi/linux/bpf.h | 8 tools/include/uapi/linux/bpf.h | 8 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index c001766adcbc..0b735c2729b2 100644 ---

[PATCH bpf-next v5 3/4] selftests/bpf: Integrate the socket_cookie test to test_progs

2021-01-19 Thread Florent Revest
- rewriting the server/client code with network helpers - rewriting the cgroup code with test__join_cgroup - rewriting the error handling code with CHECKs Signed-off-by: Florent Revest --- tools/testing/selftests/bpf/Makefile | 3 +- .../selftests/bpf/prog_tests/socket_cookie.c | 82

[PATCH bpf-next v5 2/4] bpf: Expose bpf_get_socket_cookie to tracing programs

2021-01-19 Thread Florent Revest
This needs a new helper that: - can work in a sleepable context (using sock_gen_cookie) - takes a struct sock pointer and checks that it's not NULL Signed-off-by: Florent Revest --- include/linux/bpf.h| 1 + include/uapi/linux/bpf.h | 8 kernel/trace/bpf_trace.c

Re: [PATCH bpf-next v5 4/4] selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

2021-01-22 Thread Florent Revest
On Wed, Jan 20, 2021 at 8:06 PM Florent Revest wrote: > > On Wed, Jan 20, 2021 at 8:04 PM Alexei Starovoitov > wrote: > > > > On Wed, Jan 20, 2021 at 9:08 AM KP Singh wrote: > > > > > > On Tue, Jan 19, 2021 at 5:00 PM Florent Revest > > > wrote

Re: [PATCH bpf-next v5 3/4] selftests/bpf: Integrate the socket_cookie test to test_progs

2021-01-22 Thread Florent Revest
On Thu, Jan 21, 2021 at 8:55 AM Andrii Nakryiko wrote: > > On Tue, Jan 19, 2021 at 8:00 AM Florent Revest wrote: > > > > Currently, the selftest for the BPF socket_cookie helpers is built and > > run independently from test_progs. It's easy to forget and hard to > >

Re: [PATCH] ima: Fix NULL pointer dereference in ima_file_hash

2020-09-16 Thread Florent Revest
Reviewed-by: Florent Revest On Wed, 2020-09-16 at 12:05 +, KP Singh wrote: > From: KP Singh > > ima_file_hash can be called when there is no iint->ima_hash available > even though the inode exists in the integrity cache. > > An example where this can happen (s

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-11 Thread Florent Revest
On Wed, Dec 2, 2020 at 10:18 PM Alexei Starovoitov wrote: > I still think that adopting printk/vsnprintf for this instead of > reinventing the wheel > is more flexible and easier to maintain long term. > Almost the same layout can be done with vsnprintf > with exception of \0 char. > More

Re: [PATCH bpf-next v3 2/4] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-09 Thread Florent Revest
On Tue, 2020-12-08 at 23:08 +0100, KP Singh wrote: > My understanding is you can simply always call sock_gen_cookie and > not have two protos. > > This will disable preemption in sleepable programs and not have any > effect in non-sleepable programs since preemption will already be > disabled.

[PATCH bpf-next v4 3/4] selftests/bpf: Integrate the socket_cookie test to test_progs

2020-12-09 Thread Florent Revest
- rewriting the server/client code with network helpers - rewriting the cgroup code with test__join_cgroup - rewriting the error handling code with CHECKs Signed-off-by: Florent Revest --- tools/testing/selftests/bpf/Makefile | 3 +- .../selftests/bpf/prog_tests/socket_cookie.c | 82

[PATCH bpf-next v4 2/4] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-09 Thread Florent Revest
types such as LSM. Signed-off-by: Florent Revest --- include/linux/bpf.h| 1 + include/uapi/linux/bpf.h | 7 +++ kernel/trace/bpf_trace.c | 2 ++ net/core/filter.c | 12 tools/include/uapi/linux/bpf.h | 7 +++ 5 files changed, 29

[PATCH bpf-next v4 4/4] selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

2020-12-09 Thread Florent Revest
attachment strategy and different headers. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/socket_cookie.c | 24 +++ .../selftests/bpf/progs/socket_cookie_prog.c | 41 --- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/tools/testing

[PATCH bpf-next v4 1/4] bpf: Be less specific about socket cookies guarantees

2020-12-09 Thread Florent Revest
by: Daniel Borkmann Signed-off-by: Florent Revest --- include/uapi/linux/bpf.h | 8 tools/include/uapi/linux/bpf.h | 8 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 30b477a26482..ba59309f4d18 100644 ---

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-22 Thread Florent Revest
On Tue, Dec 22, 2020 at 3:18 PM Christoph Hellwig wrote: > > FYI, there is a reason why kallsyms_lookup is not exported any more. > I don't think adding that back through a backdoor is a good idea. Did you maybe mean kallsyms_lookup_name (the one that looks an address up based on a symbol name)

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-22 Thread Florent Revest
wrote: > > > > > > > > On Thu, Dec 17, 2020 at 09:26:09AM -0800, Yonghong Song wrote: > > > > > > > > > > > > > > > On 12/17/20 7:31 AM, Florent Revest wrote: > > > > > > On Mon, Dec 14, 2020 at 7:47 AM Yonghon

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-22 Thread Florent Revest
On Fri, Dec 18, 2020 at 4:20 AM Alexei Starovoitov wrote: > As far as 6 arg issue: > long bpf_snprintf(const char *out, u32 out_size, > const char *fmt, u32 fmt_size, > const void *data, u32 data_len); > Yeah. It won't work as-is, but fmt_size is unnecessary

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-17 Thread Florent Revest
On Mon, Dec 14, 2020 at 7:47 AM Yonghong Song wrote: > On 12/11/20 6:40 AM, Florent Revest wrote: > > On Wed, Dec 2, 2020 at 10:18 PM Alexei Starovoitov > > wrote: > >> I still think that adopting printk/vsnprintf for this instead of > >> reinventing the wheel

[PATCH] bpf: Expose bpf_sk_storage_* to iterator programs

2020-11-12 Thread Florent Revest
From: Florent Revest Iterators are currently used to expose kernel information to userspace over fast procfs-like files but iterators could also be used to initialize local storage. For example, the task_file iterator could be used to store associations between processes and sockets

[PATCH] bpf: Expose a bpf_sock_from_file helper to tracing programs

2020-11-12 Thread Florent Revest
From: Florent Revest eBPF programs can already check whether a file is a socket using file->f_op == _file_ops but they can not convert file->private_data into a struct socket with BTF information. For that, we need a new helper that is essentially just a wrapper for sock_fro

[PATCH v2 1/5] net: Remove the err argument from sock_from_file

2020-11-19 Thread Florent Revest
From: Florent Revest Currently, the sock_from_file prototype takes an "err" pointer that is either not set or set to -ENOTSOCK IFF the returned socket is NULL. This makes the error redundant and it is ignored by a few callers. This patch simplifies the API by letting callers deduce

[PATCH v2 5/5] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-19 Thread Florent Revest
From: Florent Revest The eBPF program iterates over all files and tasks. For all socket files, it stores the tgid of the last task it encountered with a handle to that socket. This is a heuristic for finding the "owner" of a socket similar to what's done by lsof, ss, netsta

[PATCH v2 4/5] bpf: Add an iterator selftest for bpf_sk_storage_delete

2020-11-19 Thread Florent Revest
From: Florent Revest The eBPF program iterates over all entries (well, only one) of a socket local storage map and deletes them all. The test makes sure that the entry is indeed deleted. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/bpf_iter.c | 64

[PATCH v2 2/5] bpf: Add a bpf_sock_from_file helper

2020-11-19 Thread Florent Revest
From: Florent Revest While eBPF programs can check whether a file is a socket by file->f_op == _file_ops, they cannot convert the void private_data pointer to a struct socket BTF pointer. In order to do this a new helper wrapping sock_from_file is added. This is useful to tracing progr

[PATCH v2 3/5] bpf: Expose bpf_sk_storage_* to iterator programs

2020-11-19 Thread Florent Revest
From: Florent Revest Iterators are currently used to expose kernel information to userspace over fast procfs-like files but iterators could also be used to manipulate local storage. For example, the task_file iterator could be used to initialize a socket local storage with associations between

Re: saner sock_from_file() calling conventions (was Re: [PATCH] bpf: Expose a bpf_sock_from_file helper to tracing programs)

2020-11-13 Thread Florent Revest
On Thu, 2020-11-12 at 20:28 +, Al Viro wrote: > On Thu, Nov 12, 2020 at 09:09:44PM +0100, Florent Revest wrote: > > From: Florent Revest > > > > eBPF programs can already check whether a file is a socket using > > file->f_op == _file_ops but they can not c

Re: [PATCH] bpf: Expose bpf_sk_storage_* to iterator programs

2020-11-13 Thread Florent Revest
On Thu, 2020-11-12 at 13:57 -0800, Martin KaFai Lau wrote: > Test(s) is needed. e.g. iterating a bpf_sk_storage_map and also > calling bpf_sk_storage_get/delete. > > I would expect to see another test/example showing how it works end- > to-end to solve the problem you have in hand. > This patch

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-11-30 Thread Florent Revest
On Sat, 2020-11-28 at 17:07 -0800, Alexei Starovoitov wrote: > On Thu, Nov 26, 2020 at 05:57:47PM +0100, Florent Revest wrote: > > This helper exposes the kallsyms_lookup function to eBPF tracing > > programs. This can be used to retrieve the name of the symbol at an > > addre

[PATCH bpf-next v5 3/6] bpf: Expose bpf_sk_storage_* to iterator programs

2020-12-04 Thread Florent Revest
or to selectively delete local storage values. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau Acked-by: KP Singh --- net/core/bpf_sk_storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index a32037daa933..4edd033e899c

[PATCH bpf-next v5 5/6] selftests/bpf: Add an iterator selftest for bpf_sk_storage_get

2020-12-04 Thread Florent Revest
nformation could be used from a cgroup_skb/*gress hook to try to associate network traffic with processes. The test makes sure that a socket it created is tagged with prog_tests's pid. Signed-off-by: Florent Revest Acked-by: Yonghong Song Acked-by: Martin KaFai Lau --- .../selftests/bpf/

[PATCH bpf-next v5 1/6] net: Remove the err argument from sock_from_file

2020-12-04 Thread Florent Revest
on whether the returned socket is NULL or not. Suggested-by: Al Viro Signed-off-by: Florent Revest Reviewed-by: KP Singh --- fs/eventpoll.c | 3 +-- fs/io_uring.c| 16 include/linux/net.h | 2 +- net/core/netclassid_cgroup.c | 3 +--

[PATCH bpf-next v5 6/6] selftests/bpf: Test bpf_sk_storage_get in tcp iterators

2020-12-04 Thread Florent Revest
in the local storage. Signed-off-by: Florent Revest Acked-by: Yonghong Song Acked-by: Martin KaFai Lau --- .../selftests/bpf/prog_tests/bpf_iter.c| 18 -- .../progs/bpf_iter_bpf_sk_storage_helpers.c| 18 ++ 2 files changed, 34 insertions(+), 2

[PATCH bpf-next v5 4/6] selftests/bpf: Add an iterator selftest for bpf_sk_storage_delete

2020-12-04 Thread Florent Revest
The eBPF program iterates over all entries (well, only one) of a socket local storage map and deletes them all. The test makes sure that the entry is indeed deleted. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau --- .../selftests/bpf/prog_tests/bpf_iter.c | 64

[PATCH bpf-next v5 2/6] bpf: Add a bpf_sock_from_file helper

2020-12-04 Thread Florent Revest
pes inheriting this set of helpers such as iterators or LSM programs. Signed-off-by: Florent Revest Acked-by: KP Singh Acked-by: Martin KaFai Lau --- include/uapi/linux/bpf.h | 9 + kernel/trace/bpf_trace.c | 20 scripts/bpf_helpers_doc.py |

Re: [PATCH bpf-next v4 6/6] bpf: Test bpf_sk_storage_get in tcp iterators

2020-12-04 Thread Florent Revest
On Thu, 2020-12-03 at 18:05 -0800, Martin KaFai Lau wrote: > On Wed, Dec 02, 2020 at 09:55:27PM +0100, Florent Revest wrote: > > This extends the existing bpf_sk_storage_get test where a socket is > > created and tagged with its creator's pid by a task_file iterator. > > >

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-01 Thread Florent Revest
On Mon, 2020-11-30 at 18:41 -0800, Alexei Starovoitov wrote: > On Mon, Nov 30, 2020 at 05:23:22PM +0100, Florent Revest wrote: > > On Sat, 2020-11-28 at 17:07 -0800, Alexei Starovoitov wrote: > > > Looks like debug-only helper. > > > I cannot think of a way to use in

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-02 Thread Florent Revest
On Tue, 2020-12-01 at 16:55 -0800, Andrii Nakryiko wrote: > On Fri, Nov 27, 2020 at 8:09 AM Yonghong Song wrote: > > > > > > On 11/27/20 3:20 AM, KP Singh wrote: > > > On Fri, Nov 27, 2020 at 8:35 AM Yonghong Song wrote: > > > > > > > > In this case, module name may be truncated and user did

[PATCH bpf-next v4 4/6] bpf: Add an iterator selftest for bpf_sk_storage_delete

2020-12-02 Thread Florent Revest
The eBPF program iterates over all entries (well, only one) of a socket local storage map and deletes them all. The test makes sure that the entry is indeed deleted. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau --- .../selftests/bpf/prog_tests/bpf_iter.c | 64

[PATCH bpf-next v4 6/6] bpf: Test bpf_sk_storage_get in tcp iterators

2020-12-02 Thread Florent Revest
in the local storage. Signed-off-by: Florent Revest Acked-by: Yonghong Song --- .../selftests/bpf/prog_tests/bpf_iter.c| 13 + .../progs/bpf_iter_bpf_sk_storage_helpers.c| 18 ++ 2 files changed, 31 insertions(+) diff --git a/tools/testing/selftests/bpf

[PATCH bpf-next v4 5/6] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-12-02 Thread Florent Revest
nformation could be used from a cgroup_skb/*gress hook to try to associate network traffic with processes. The test makes sure that a socket it created is tagged with prog_tests's pid. Signed-off-by: Florent Revest Acked-by: Yonghong Song --- .../selftests/bpf/prog_tests/bpf_iter.c

[PATCH bpf-next v4 3/6] bpf: Expose bpf_sk_storage_* to iterator programs

2020-12-02 Thread Florent Revest
or to selectively delete local storage values. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau Acked-by: KP Singh --- net/core/bpf_sk_storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index a32037daa933..4edd033e899c

[PATCH bpf-next v4 1/6] net: Remove the err argument from sock_from_file

2020-12-02 Thread Florent Revest
on whether the returned socket is NULL or not. Suggested-by: Al Viro Signed-off-by: Florent Revest Reviewed-by: KP Singh --- fs/eventpoll.c | 3 +-- fs/io_uring.c| 16 include/linux/net.h | 2 +- net/core/netclassid_cgroup.c | 3 +--

[PATCH bpf-next v4 2/6] bpf: Add a bpf_sock_from_file helper

2020-12-02 Thread Florent Revest
pes inheriting this set of helpers such as iterators or LSM programs. Signed-off-by: Florent Revest Acked-by: KP Singh Acked-by: Martin KaFai Lau --- include/uapi/linux/bpf.h | 9 + kernel/trace/bpf_trace.c | 20 scripts/bpf_helpers_doc.py |

[PATCH bpf-next v2 3/3] bpf: Add a selftest for the tracing bpf_get_socket_cookie

2020-12-03 Thread Florent Revest
attachment strategy and different headers. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/socket_cookie.c | 24 +++ .../selftests/bpf/progs/socket_cookie_prog.c | 41 --- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/tools/testing

[PATCH bpf-next v2 1/3] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-03 Thread Florent Revest
This creates a new helper proto because the existing bpf_get_socket_cookie_sock_proto has a ARG_PTR_TO_CTX argument and only works for BPF programs where the context is a sock. This helper could also be useful to other BPF program types such as LSM. Signed-off-by: Florent Revest --- include

[PATCH bpf-next v2 2/3] selftests/bpf: Integrate the socket_cookie test to test_progs

2020-12-03 Thread Florent Revest
- rewriting the server/client code with network helpers - rewriting the cgroup code with test__join_cgroup - rewriting the error handling code with CHECKs Signed-off-by: Florent Revest --- tools/testing/selftests/bpf/Makefile | 3 +- .../selftests/bpf/prog_tests/socket_cookie.c | 82

Re: [PATCH v2 5/5] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-26 Thread Florent Revest
On Thu, 2020-11-19 at 16:32 -0800, Martin KaFai Lau wrote: > Does it affect all sk(s) in the system? Can it be limited to > the sk that the test is testing? Oh I just realized I haven't answered you here yet! Thanks for the reviews. :D I'm sending a v3 addressing your comments

[PATCH bpf-next v3 2/6] bpf: Add a bpf_sock_from_file helper

2020-11-26 Thread Florent Revest
pes inheriting this set of helpers such as iterators or LSM programs. Signed-off-by: Florent Revest Acked-by: KP Singh Acked-by: Martin KaFai Lau --- include/uapi/linux/bpf.h | 9 + kernel/trace/bpf_trace.c | 20 scripts/bpf_helpers_doc.py |

[PATCH bpf-next v3 1/6] net: Remove the err argument from sock_from_file

2020-11-26 Thread Florent Revest
on whether the returned socket is NULL or not. Suggested-by: Al Viro Signed-off-by: Florent Revest --- fs/eventpoll.c | 3 +-- fs/io_uring.c| 16 include/linux/net.h | 2 +- net/core/netclassid_cgroup.c | 3 +-- net/core/netprio_cgroup.c|

[PATCH bpf-next v3 3/6] bpf: Expose bpf_sk_storage_* to iterator programs

2020-11-26 Thread Florent Revest
or to selectively delete local storage values. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau --- net/core/bpf_sk_storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index a32037daa933..4edd033e899c 100644 --- a/net/core

[PATCH bpf-next v3 6/6] bpf: Test bpf_sk_storage_get in tcp iterators

2020-11-26 Thread Florent Revest
in the local storage. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/bpf_iter.c| 13 + .../progs/bpf_iter_bpf_sk_storage_helpers.c| 18 ++ 2 files changed, 31 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b

[PATCH bpf-next v3 4/6] bpf: Add an iterator selftest for bpf_sk_storage_delete

2020-11-26 Thread Florent Revest
The eBPF program iterates over all entries (well, only one) of a socket local storage map and deletes them all. The test makes sure that the entry is indeed deleted. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau --- .../selftests/bpf/prog_tests/bpf_iter.c | 64

[PATCH bpf-next v3 5/6] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-26 Thread Florent Revest
nformation could be used from a cgroup_skb/*gress hook to try to associate network traffic with processes. The test makes sure that a socket it created is tagged with prog_tests's pid. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/bpf_iter.c | 40 +++

[PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-11-26 Thread Florent Revest
in which the symbol is located. Signed-off-by: Florent Revest --- include/uapi/linux/bpf.h | 16 + kernel/trace/bpf_trace.c | 41 ++ tools/include/uapi/linux/bpf.h | 16 + 3 files changed, 73 insertions(+) diff --git a/include/uapi

[PATCH bpf-next 2/2] selftests/bpf: Add bpf_kallsyms_lookup test

2020-11-26 Thread Florent Revest
This piggybacks on the existing "ksyms" test because this test also relies on a __ksym symbol and requires CONFIG_KALLSYMS. Signed-off-by: Florent Revest --- tools/testing/selftests/bpf/config| 1 + .../testing/selftests/bpf/prog_tests/ksyms.c | 46 ++

[PATCH bpf-next 2/2] bpf: Add a selftest for the tracing bpf_get_socket_cookie

2020-11-26 Thread Florent Revest
attachment strategy and different headers. Signed-off-by: Florent Revest --- .../selftests/bpf/progs/socket_cookie_prog.c | 41 --- .../selftests/bpf/test_socket_cookie.c| 18 +--- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests

[PATCH bpf-next 1/2] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-11-26 Thread Florent Revest
This creates a new helper proto because the existing bpf_get_socket_cookie_sock_proto has a ARG_PTR_TO_CTX argument and only works for BPF programs where the context is a sock. This helper could also be useful to other BPF program types such as LSM. Signed-off-by: Florent Revest --- kernel

Re: [PATCH bpf-next 2/2] bpf: Add a selftest for the tracing bpf_get_socket_cookie

2020-11-27 Thread Florent Revest
On Thu, 2020-11-26 at 23:56 -0800, Yonghong Song wrote: > > On 11/26/20 9:02 AM, Florent Revest wrote: > > This builds up on the existing socket cookie test which checks > > whether > > the bpf_get_socket_cookie helpers provide the same value in > > cgroup

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-11-27 Thread Florent Revest
On Thu, 2020-11-26 at 23:35 -0800, Yonghong Song wrote: > On 11/26/20 8:57 AM, Florent Revest wrote: > > +BPF_CALL_5(bpf_kallsyms_lookup, u64, address, char *, symbol, u32, > > symbol_size, > > + char *, module, u32, module_size) > > +{ > > + char buffer[K

  1   2   3   >