* [PATCH] selftests/bpf: Fix bpf selftest build error
@ 2025-05-09 12:23 Saket Kumar Bhaskar
2025-05-09 17:04 ` Alexei Starovoitov
2025-05-12 3:54 ` Venkat Rao Bagalkote
0 siblings, 2 replies; 6+ messages in thread
From: Saket Kumar Bhaskar @ 2025-05-09 12:23 UTC (permalink / raw)
To: bpf, linux-kselftest, linux-kernel, linux-arm-kernel, linux-stm32,
linux-next
Cc: ast, hbathini, maddy, andrii, daniel, mykolal, martin.lau, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah
On linux-next, build for bpf selftest displays an error due to
mismatch in the expected function signature of bpf_testmod_test_read
and bpf_testmod_test_write.
Commit 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
changed the required type for struct bin_attribute to const struct bin_attribute.
To resolve the error, update corresponding signature for the callback.
Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
---
tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
index 2e54b95ad898..194c442580ee 100644
--- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
+++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
@@ -385,7 +385,7 @@ int bpf_testmod_fentry_ok;
noinline ssize_t
bpf_testmod_test_read(struct file *file, struct kobject *kobj,
- struct bin_attribute *bin_attr,
+ const struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t len)
{
struct bpf_testmod_test_read_ctx ctx = {
@@ -465,7 +465,7 @@ ALLOW_ERROR_INJECTION(bpf_testmod_test_read, ERRNO);
noinline ssize_t
bpf_testmod_test_write(struct file *file, struct kobject *kobj,
- struct bin_attribute *bin_attr,
+ const struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t len)
{
struct bpf_testmod_test_write_ctx ctx = {
--
2.43.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests/bpf: Fix bpf selftest build error
2025-05-09 12:23 [PATCH] selftests/bpf: Fix bpf selftest build error Saket Kumar Bhaskar
@ 2025-05-09 17:04 ` Alexei Starovoitov
2025-05-10 1:04 ` Stephen Rothwell
2025-05-12 3:54 ` Venkat Rao Bagalkote
1 sibling, 1 reply; 6+ messages in thread
From: Alexei Starovoitov @ 2025-05-09 17:04 UTC (permalink / raw)
To: Saket Kumar Bhaskar
Cc: bpf, open list:KERNEL SELFTEST FRAMEWORK, LKML, linux-arm-kernel,
linux-stm32, Linux-Next Mailing List, Alexei Starovoitov,
Hari Bathini, Madhavan Srinivasan, Andrii Nakryiko,
Daniel Borkmann, Mykola Lysenko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan
On Fri, May 9, 2025 at 5:24 AM Saket Kumar Bhaskar <skb99@linux.ibm.com> wrote:
>
> On linux-next, build for bpf selftest displays an error due to
> mismatch in the expected function signature of bpf_testmod_test_read
> and bpf_testmod_test_write.
>
> Commit 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
> changed the required type for struct bin_attribute to const struct bin_attribute.
>
> To resolve the error, update corresponding signature for the callback.
>
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
> Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
> ---
> tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> index 2e54b95ad898..194c442580ee 100644
> --- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> +++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> @@ -385,7 +385,7 @@ int bpf_testmod_fentry_ok;
>
> noinline ssize_t
> bpf_testmod_test_read(struct file *file, struct kobject *kobj,
> - struct bin_attribute *bin_attr,
> + const struct bin_attribute *bin_attr,
> char *buf, loff_t off, size_t len)
You didn't even compile it :(
Instead of fixing the build, it breaks the build.
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests/bpf: Fix bpf selftest build error
2025-05-09 17:04 ` Alexei Starovoitov
@ 2025-05-10 1:04 ` Stephen Rothwell
2025-05-12 5:25 ` Saket Kumar Bhaskar
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2025-05-10 1:04 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Saket Kumar Bhaskar, bpf, open list:KERNEL SELFTEST FRAMEWORK,
LKML, linux-arm-kernel, linux-stm32, Linux-Next Mailing List,
Alexei Starovoitov, Hari Bathini, Madhavan Srinivasan,
Andrii Nakryiko, Daniel Borkmann, Mykola Lysenko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Greg KH
[-- Attachment #1: Type: text/plain, Size: 1987 bytes --]
Hi Alexei,
On Fri, 9 May 2025 10:04:18 -0700 Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>
> On Fri, May 9, 2025 at 5:24 AM Saket Kumar Bhaskar <skb99@linux.ibm.com> wrote:
> >
> > On linux-next, build for bpf selftest displays an error due to
> > mismatch in the expected function signature of bpf_testmod_test_read
> > and bpf_testmod_test_write.
> >
> > Commit 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
> > changed the required type for struct bin_attribute to const struct bin_attribute.
> >
> > To resolve the error, update corresponding signature for the callback.
> >
> > Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
> > Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
> > ---
> > tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> > index 2e54b95ad898..194c442580ee 100644
> > --- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> > +++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> > @@ -385,7 +385,7 @@ int bpf_testmod_fentry_ok;
> >
> > noinline ssize_t
> > bpf_testmod_test_read(struct file *file, struct kobject *kobj,
> > - struct bin_attribute *bin_attr,
> > + const struct bin_attribute *bin_attr,
> > char *buf, loff_t off, size_t len)
>
> You didn't even compile it :(
>
> Instead of fixing the build, it breaks the build.
>
> pw-bot: cr
This patch is only needed in linux-next. It should be applied to the
driver-core tree - since that includes commit 97d06802d10a. It should
also have a Fixes tag referencing commit 97d06802d10a.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests/bpf: Fix bpf selftest build error
2025-05-09 12:23 [PATCH] selftests/bpf: Fix bpf selftest build error Saket Kumar Bhaskar
2025-05-09 17:04 ` Alexei Starovoitov
@ 2025-05-12 3:54 ` Venkat Rao Bagalkote
1 sibling, 0 replies; 6+ messages in thread
From: Venkat Rao Bagalkote @ 2025-05-12 3:54 UTC (permalink / raw)
To: Saket Kumar Bhaskar, bpf, linux-kselftest, linux-kernel,
linux-arm-kernel, linux-stm32, linux-next
Cc: ast, hbathini, maddy, andrii, daniel, mykolal, martin.lau, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah
On 09/05/25 5:53 pm, Saket Kumar Bhaskar wrote:
> On linux-next, build for bpf selftest displays an error due to
> mismatch in the expected function signature of bpf_testmod_test_read
> and bpf_testmod_test_write.
>
> Commit 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
> changed the required type for struct bin_attribute to const struct bin_attribute.
>
> To resolve the error, update corresponding signature for the callback.
>
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
> Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
> ---
> tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> index 2e54b95ad898..194c442580ee 100644
> --- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> +++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> @@ -385,7 +385,7 @@ int bpf_testmod_fentry_ok;
>
> noinline ssize_t
> bpf_testmod_test_read(struct file *file, struct kobject *kobj,
> - struct bin_attribute *bin_attr,
> + const struct bin_attribute *bin_attr,
> char *buf, loff_t off, size_t len)
> {
> struct bpf_testmod_test_read_ctx ctx = {
> @@ -465,7 +465,7 @@ ALLOW_ERROR_INJECTION(bpf_testmod_test_read, ERRNO);
>
> noinline ssize_t
> bpf_testmod_test_write(struct file *file, struct kobject *kobj,
> - struct bin_attribute *bin_attr,
> + const struct bin_attribute *bin_attr,
> char *buf, loff_t off, size_t len)
> {
> struct bpf_testmod_test_write_ctx ctx = {
Tested this patch by applying on top of next-20250508 and if fixes the
build issue. Hence,
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
commit f48887a98b78880b7711aca311fbbbcaad6c4e3b (tag: next-20250508,
origin/master, origin/HEAD, bpf_arena)
Author: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu May 8 18:45:50 2025 +1000
Add linux-next specific files for 20250508
After this patch:
TEST-OBJ [test_progs-cpuv4] xdp_flowtable.test.o
TEST-OBJ [test_progs-cpuv4] xdp_info.test.o
TEST-OBJ [test_progs-cpuv4] xdp_link.test.o
TEST-OBJ [test_progs-cpuv4] xdp_metadata.test.o
TEST-OBJ [test_progs-cpuv4] xdp_noinline.test.o
TEST-OBJ [test_progs-cpuv4] xdp_perf.test.o
TEST-OBJ [test_progs-cpuv4] xdp_synproxy.test.o
TEST-OBJ [test_progs-cpuv4] xdp_vlan.test.o
TEST-OBJ [test_progs-cpuv4] xdpwall.test.o
TEST-OBJ [test_progs-cpuv4] xfrm_info.test.o
BINARY bench
BINARY test_maps
BINARY test_progs
BINARY test_progs-no_alu32
BINARY test_progs-cpuv4
Before this patch:
CLANG
/root/linux-next/tools/testing/selftests/bpf/tools/build/bpftool/profiler.bpf.o
bpf_testmod.c:494:17: error: initialization of ‘ssize_t (*)(struct file
*, struct kobject *, const struct bin_attribute *, char *, loff_t,
size_t)’ {aka ‘long int (*)(struct file *, struct kobject *, const
struct bin_attribute *, char *, long long int, long unsigned int)’}
from incompatible pointer type ‘ssize_t (*)(struct file *, struct
kobject *, struct bin_attribute *, char *, loff_t, size_t)’ {aka ‘long
int (*)(struct file *, struct kobject *, struct bin_attribute *, char *,
long long int, long unsigned int)’} [-Wincompatible-pointer-types]
494 | .read = bpf_testmod_test_read,
| ^~~~~~~~~~~~~~~~~~~~~
bpf_testmod.c:494:17: note: (near initialization for
‘bin_attr_bpf_testmod_file.read’)
bpf_testmod.c:495:18: error: initialization of ‘ssize_t (*)(struct file
*, struct kobject *, const struct bin_attribute *, char *, loff_t,
size_t)’ {aka ‘long int (*)(struct file *, struct kobject *, const
struct bin_attribute *, char *, long long int, long unsigned int)’}
from incompatible pointer type ‘ssize_t (*)(struct file *, struct
kobject *, struct bin_attribute *, char *, loff_t, size_t)’ {aka ‘long
int (*)(struct file *, struct kobject *, struct bin_attribute *, char *,
long long int, long unsigned int)’} [-Wincompatible-pointer-types]
495 | .write = bpf_testmod_test_write,
| ^~~~~~~~~~~~~~~~~~~~~~
bpf_testmod.c:495:18: note: (near initialization for
‘bin_attr_bpf_testmod_file.write’)
make[4]: *** [/root/linux-next/scripts/Makefile.build:203:
bpf_testmod.o] Error 1
make[3]: *** [/root/linux-next/Makefile:2009: .] Error 2
make[2]: *** [Makefile:248: __sub-make] Error 2
make[1]: *** [Makefile:18: all] Error 2
make: *** [Makefile:282: test_kmods/bpf_testmod.ko] Error 2
Regards,
Venkat.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests/bpf: Fix bpf selftest build error
2025-05-10 1:04 ` Stephen Rothwell
@ 2025-05-12 5:25 ` Saket Kumar Bhaskar
2025-05-12 6:40 ` Stephen Rothwell
0 siblings, 1 reply; 6+ messages in thread
From: Saket Kumar Bhaskar @ 2025-05-12 5:25 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Alexei Starovoitov, bpf, open list:KERNEL SELFTEST FRAMEWORK,
LKML, linux-arm-kernel, linux-stm32, Linux-Next Mailing List,
Alexei Starovoitov, Hari Bathini, Madhavan Srinivasan,
Andrii Nakryiko, Daniel Borkmann, Mykola Lysenko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Greg KH
On Sat, May 10, 2025 at 11:04:55AM +1000, Stephen Rothwell wrote:
> Hi Alexei,
>
> On Fri, 9 May 2025 10:04:18 -0700 Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> >
> > On Fri, May 9, 2025 at 5:24 AM Saket Kumar Bhaskar <skb99@linux.ibm.com> wrote:
> > >
> > > On linux-next, build for bpf selftest displays an error due to
> > > mismatch in the expected function signature of bpf_testmod_test_read
> > > and bpf_testmod_test_write.
> > >
> > > Commit 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
> > > changed the required type for struct bin_attribute to const struct bin_attribute.
> > >
> > > To resolve the error, update corresponding signature for the callback.
> > >
> > > Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > > Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
> > > Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
> > > ---
> > > tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> > > index 2e54b95ad898..194c442580ee 100644
> > > --- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> > > +++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> > > @@ -385,7 +385,7 @@ int bpf_testmod_fentry_ok;
> > >
> > > noinline ssize_t
> > > bpf_testmod_test_read(struct file *file, struct kobject *kobj,
> > > - struct bin_attribute *bin_attr,
> > > + const struct bin_attribute *bin_attr,
> > > char *buf, loff_t off, size_t len)
> >
> > You didn't even compile it :(
> >
> > Instead of fixing the build, it breaks the build.
> >
> > pw-bot: cr
>
> This patch is only needed in linux-next. It should be applied to the
> driver-core tree - since that includes commit 97d06802d10a. It should
> also have a Fixes tag referencing commit 97d06802d10a.
> --
> Cheers,
> Stephen Rothwell
Hi Stephen,
Apologies for missing the Fixes tag. Would you like me to resend the patch with the
Fixes tag included?
Thanks,
Saket
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests/bpf: Fix bpf selftest build error
2025-05-12 5:25 ` Saket Kumar Bhaskar
@ 2025-05-12 6:40 ` Stephen Rothwell
0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2025-05-12 6:40 UTC (permalink / raw)
To: Saket Kumar Bhaskar
Cc: Alexei Starovoitov, bpf, open list:KERNEL SELFTEST FRAMEWORK,
LKML, linux-arm-kernel, linux-stm32, Linux-Next Mailing List,
Alexei Starovoitov, Hari Bathini, Madhavan Srinivasan,
Andrii Nakryiko, Daniel Borkmann, Mykola Lysenko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Greg KH
[-- Attachment #1: Type: text/plain, Size: 351 bytes --]
Hi Saket,
On Mon, 12 May 2025 10:55:59 +0530 Saket Kumar Bhaskar <skb99@linux.ibm.com> wrote:
>
> Apologies for missing the Fixes tag. Would you like me to resend the patch with the
> Fixes tag included?
Yes, please, but send it to Greg (keeping the ccs) so that he can apply
it to the driver-core tree.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-05-12 6:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09 12:23 [PATCH] selftests/bpf: Fix bpf selftest build error Saket Kumar Bhaskar
2025-05-09 17:04 ` Alexei Starovoitov
2025-05-10 1:04 ` Stephen Rothwell
2025-05-12 5:25 ` Saket Kumar Bhaskar
2025-05-12 6:40 ` Stephen Rothwell
2025-05-12 3:54 ` Venkat Rao Bagalkote
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).