On Sat, Jun 08, 2024 at 03:15:56PM GMT, Daniel Xu wrote:
> This patchset enables both detecting as well as dumping compilable
> prototypes for kfuncs.
>
> The first commit instructs pahole to DECL_TAG kfuncs when available.
> This requires v1.27 or newer. v1.27 is nearing release at time of
> writ
The xfrm_info selftest locally defines an aliased type such that folks
with CONFIG_XFRM_INTERFACE=m/n configs can still build the selftests.
See commit aa67961f3243 ("selftests/bpf: Allow building bpf tests with
CONFIG_XFRM_INTERFACE=[m|n]").
Thus, it is simpler if this selftest opts out of using
The bpf-nf selftests play various games with aliased types such that
folks with CONFIG_NF_CONNTRACK=m/n configs can still build the
selftests. See commits:
1058b6a78db2 ("selftests/bpf: Do not fail build if CONFIG_NF_CONNTRACK=m/n")
92afc5329a5b ("selftests/bpf: Fix build errors if CONFIG_NF_CONNT
Previously, kfunc declarations in bpf_kfuncs.h (and others) used "user
facing" types for kfuncs prototypes while the actual kfunc definitions
used "kernel facing" types. More specifically: bpf_dynptr vs
bpf_dynptr_kern, __sk_buff vs sk_buff, and xdp_md vs xdp_buff.
It wasn't an issue before, as th
With generated kfunc prototypes, the existing callback names will
conflict. Fix by namespacing with a bpf_ prefix.
Signed-off-by: Daniel Xu
---
tools/testing/selftests/bpf/progs/bpf_dctcp.c | 36 +--
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/tools/testing/se
The prototype defined in bpf_kfuncs.h was not in line with how the
actual kfunc was defined. This causes compilation errors when kfunc
prototypes are generated from BTF.
Fix by aligning with actual kfunc definition.
Signed-off-by: Daniel Xu
---
tools/testing/selftests/bpf/bpf_kfuncs.h
The prototype in progs/map_percpu_stats.c is not in line with how the
actual kfuncs are defined in kernel/bpf/map_iter.c. This causes
compilation errors when kfunc prototypes are generated from BTF.
Fix by aligning with actual kfunc definitions.
Signed-off-by: Daniel Xu
---
tools/testing/selfte
The prototype in progs/nested_trust_common.h is not in line with how the
actual kfuncs are defined in kernel/bpf/cpumask.c. This causes compilation
errors when kfunc prototypes are generated from BTF.
Fix by aligning with actual kfunc definitions.
Signed-off-by: Daniel Xu
---
tools/testing/self
The prototypes in progs/get_func_ip_test.c were not in line with how the
actual kfuncs are defined in net/bpf/test_run.c. This causes compilation
errors when kfunc prototypes are generated from BTF.
Fix by aligning with actual kfunc definitions.
Signed-off-by: Daniel Xu
---
.../testing/selftest
bpf_iter_task_vma_new() is defined as taking a u64 as its 3rd argument.
u64 is a unsigned long long. bpf_experimental.h was defining the
prototype as unsigned long.
Fix by using __u64.
Signed-off-by: Daniel Xu
---
tools/testing/selftests/bpf/bpf_experimental.h | 2 +-
1 file changed, 1 insertio
This patchset enables both detecting as well as dumping compilable
prototypes for kfuncs.
The first commit instructs pahole to DECL_TAG kfuncs when available.
This requires v1.27 or newer. v1.27 is nearing release at time of
writing. Following this, users will be able to look at BTF inside
vmlinux
On Sat, Jun 8, 2024 at 1:04 AM Xu Kuohai wrote:
>
> On 6/7/2024 5:53 AM, Paul Moore wrote:
> > On Thu, Apr 11, 2024 at 8:24 AM Xu Kuohai wrote:
> >>
> >> From: Xu Kuohai
> >>
> >> Add macro LSM_RET_INT to annotate lsm hook return integer type and the
> >> default return value, and the expected r
On Fri, Jun 07, 2024 at 09:39:36PM -0700, Andrew Morton wrote:
> On Thu, 6 Jun 2024 20:36:19 + "Pankaj Raghav (Samsung)"
> wrote:
>
> > From: Pankaj Raghav
> >
> > create_pagecache_thp_and_fd() in split_huge_page_test.c used the
> > variable dummy to perform mmap read.
> >
> > However, t
On Tue, 4 Jun 2024 at 20:32, Ivan Orlov wrote:
>
> Since assert_test covers the part of the KUnit core (the assertion
> formatting functions), I believe it would be better to have it merged
> into kunit-test (as it is done for other tests for the KUnit core).
>
> Signed-off-by: Ivan Orlov
> ---
On Tue, 4 Jun 2024 at 20:32, Ivan Orlov wrote:
>
> Export non-static functions from the assert.c file into the KUnit
> namespace in order to be able to access them from the tests if
> they are compiled as modules.
>
> Signed-off-by: Ivan Orlov
> ---
I think this could be merged with patch 5, as
On Tue, 4 Jun 2024 at 20:32, Ivan Orlov wrote:
>
> Currently, the only way to build string-stream-test is by setting
> CONFIG_KUNIT_TEST=y. However, CONFIG_KUNIT_TEST is a config option for
> a different test (`kunit-test.c`).
>
> Introduce a new Kconfig entry in order to be able to build the
> st
On Tue, 4 Jun 2024 at 20:32, Ivan Orlov wrote:
>
> Since now we are exporting string-stream functions into the KUnit
> namespace, we can safely use them in kunit-test when it is compiled as
> a module as well. So, remove the stubs used when kunit-test is compiled
> as a module. Import the KUnit na
On Tue, 4 Jun 2024 at 20:32, Ivan Orlov wrote:
>
> Export non-static functions from the string-stream.c file into the KUnit
> namespace in order to be able to access them from the KUnit core tests
> (when they are loaded as modules).
>
> Signed-off-by: Ivan Orlov
> ---
Looks good to me, thanks.
It is useful to change the name, the phys and/or the uniq of a
struct hid_device during .rdesc_fixup().
For example, hid-uclogic.ko changes the uniq to store the firmware version
to differentiate between 2 devices sharing the same PID. In the same
way, changing the device name is useful when the d
The idea is to provide a list of stucts and their editable fields.
Currently no functional changes are introduced here, we will add some
more writeable fields in the next patch.
Signed-off-by: Benjamin Tissoires
---
changes in v3:
- rewrote WRITE_RANGE macro to not deal with offset from the ca
Without this helpers like bpf_printk() or bpf_map_update() are not
available, making anything but change of bytes impossible to do.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
new in v2
---
drivers/hid/bpf/hid_bpf_struct_ops.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dri
There is no real reasons to paper over warnings for such small programs.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/progs/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/bpf/progs/Makefile b/drivers/hid/
warning: unused variable ‘tilt’ [-Wunused-variable]
Signed-off-by: Peter Hutterer
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/progs/XPPen__Artist24.bpf.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/hid/bpf/progs/XPPen__Artist24.b
This is the current decision we took: we don't provide automatic loading
of HID-BPF by the kernel directly, but rely on an external tool for it.
This tool is currently udev-hid-bpf, so let's make people aware of it.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
Now that we are using struct_ops, the docs need to be changed.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
changes in v2
- use BPF_F_BEFORE
---
Documentation/hid/hid-bpf.rst | 156 +++---
include/linux/hid_bpf.h | 8 +--
2 files changed,
I got a weird verifier error with a subprog once, so let's have a test
for it.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
tools/testing/selftests/hid/hid_bpf.c | 41 +
tools/testing/selftests/hid/progs/hid.c | 24 +
We can now rely on struct_ops as we cleared the users in-tree.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
changes in v2:
- remove now unused enum hid_bpf_attach_flags
---
drivers/hid/bpf/Makefile| 2 +-
drivers/hid/bpf/entrypoints/Makefile| 9
Very mechanical:
- Change HID_BPF_DEVICE_EVENT and HID_BPF_RDESC_FIXUP #defines
- add a matching SEC(".struct_ops.link")
- in ArtistPro16Gen2 make the 2 functions static and have a new one
calling them
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/b
We are going to switch over struct_ops, so instead of having to manually
replace all fields one by one, let's have a common place to change it.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/progs/FR-TEC__Raptor-Mach-2.bpf.c | 4 ++--
drivers/h
This is mostly mechanical: attach_prog is dropped, and
the SEC are converted into struct_ops.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2 but the commit message.
---
samples/hid/Makefile | 5 ++--
samples/hid/hid_bpf_attach.bpf.c | 18 -
We drop the need for the attach() bpf syscall, but we need to set up
the hid_id field before calling __load().
The .bpf.c part is mechanical: we create one struct_ops per HID-BPF
program, as all the tests are for one program at a time.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
ch
We do this implementation in several steps to not have the CI failing:
- first (this patch), we add struct_ops while keeping the existing infra
available
- then we change the selftests, the examples and the existing in-tree
HID-BPF programs
- then we remove the existing trace points making old
no code change, but this way we reduce code duplication and we
can export it later.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/hid_bpf_dispatch.c | 47 ++
1 file changed, 27 insertions(+), 20 deletions(-)
di
Those operations are the ones from HID, not HID-BPF, and I'd like to
reuse hid_bpf_ops as the user facing struct_ops API.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/hid_bpf_dispatch.c | 22 +++---
drivers/hid/hid-core.c
The purpose of this series is to rethink how HID-BPF is invoked.
Currently it implies a jmp table, a prog fd bpf_map, a preloaded tracing
bpf program and a lot of manual work for handling the bpf program
lifetime and addition/removal.
OTOH, bpf_struct_ops take care of most of the bpf handling leav
On Mon, 20 May 2024 at 03:12, Kees Cook wrote:
>
> For tests that need to allocate using vm_mmap() (e.g. usercopy and
> execve), provide the interface to have the allocation tracked by KUnit
> itself. This requires bringing up a placeholder userspace mm.
>
> This combines my earlier attempt at thi
On Mon, 20 May 2024 at 03:12, Kees Cook wrote:
>
> Convert the runtime tests of hardened usercopy to standard KUnit tests.
>
> Co-developed-by: Vitor Massaru Iha
> Signed-off-by: Vitor Massaru Iha
> Link: https://lore.kernel.org/r/20200721174654.72132-1-vi...@massaru.org
> Signed-off-by: Kees Co
On 6/7/2024 5:53 AM, Paul Moore wrote:
On Thu, Apr 11, 2024 at 8:24 AM Xu Kuohai wrote:
From: Xu Kuohai
Add macro LSM_RET_INT to annotate lsm hook return integer type and the
default return value, and the expected return range.
The LSM_RET_INT is declared as:
LSM_RET_INT(defval, min, max)
On Jun 07 2024, Alexei Starovoitov wrote:
> On Fri, Jun 7, 2024 at 8:28 AM Benjamin Tissoires wrote:
> > +struct hid_bpf_ops {
> > + /* hid_id needs to stay first so we can easily change it
> > +* from userspace.
> > +*/
> > + int hid_id;
> > +
39 matches
Mail list logo