linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] selftests/bpf: Fix bpf selftest build error
@ 2025-05-12  9:11 Saket Kumar Bhaskar
  2025-06-03 17:32 ` T.J. Mercier
  0 siblings, 1 reply; 5+ messages in thread
From: Saket Kumar Bhaskar @ 2025-05-12  9:11 UTC (permalink / raw)
  To: gregkh
  Cc: bpf, linux-kselftest, linux-kernel, linux-next, hbathini, maddy,
	venkat88, sfr, alexei.starovoitov, daniel, mykolal,
	yoong.siang.song, 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.

Fixes: 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
---

[RESEND]:
 - Added Fixes and Tested-by tag.
 - Added Greg as receipent for driver-core tree.

Original patch: https://lore.kernel.org/all/20250509122348.649064-1-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] 5+ messages in thread

* Re: [RESEND PATCH] selftests/bpf: Fix bpf selftest build error
  2025-05-12  9:11 [RESEND PATCH] selftests/bpf: Fix bpf selftest build error Saket Kumar Bhaskar
@ 2025-06-03 17:32 ` T.J. Mercier
  2025-06-03 17:50   ` Alexei Starovoitov
  2025-06-03 17:50   ` Song Liu
  0 siblings, 2 replies; 5+ messages in thread
From: T.J. Mercier @ 2025-06-03 17:32 UTC (permalink / raw)
  To: Saket Kumar Bhaskar
  Cc: gregkh, bpf, linux-kselftest, linux-kernel, linux-next, hbathini,
	maddy, venkat88, sfr, alexei.starovoitov, daniel, mykolal,
	yoong.siang.song, martin.lau, song, yonghong.song, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, shuah

On Mon, May 12, 2025 at 2:12 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.
>
> Fixes: 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
> Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
> ---
>
> [RESEND]:
>  - Added Fixes and Tested-by tag.
>  - Added Greg as receipent for driver-core tree.
>
> Original patch: https://lore.kernel.org/all/20250509122348.649064-1-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
>
>

The build is broken in Linus's tree right now. We also now need:

@@ -567,7 +567,7 @@ static void testmod_unregister_uprobe(void)

 static ssize_t
 bpf_testmod_uprobe_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)
 {

Should I send a separate patch, or can we update this and get it to Linus?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH] selftests/bpf: Fix bpf selftest build error
  2025-06-03 17:32 ` T.J. Mercier
@ 2025-06-03 17:50   ` Alexei Starovoitov
  2025-06-03 17:50   ` Song Liu
  1 sibling, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2025-06-03 17:50 UTC (permalink / raw)
  To: T.J. Mercier
  Cc: Saket Kumar Bhaskar, Greg Kroah-Hartman, bpf,
	open list:KERNEL SELFTEST FRAMEWORK, LKML,
	Linux-Next Mailing List, Hari Bathini, Madhavan Srinivasan,
	Venkat Rao Bagalkote, Stephen Rothwell, Daniel Borkmann,
	Mykola Lysenko, Song, Yoong Siang, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, Shuah Khan

On Tue, Jun 3, 2025 at 10:33 AM T.J. Mercier <tjmercier@google.com> wrote:
>
> On Mon, May 12, 2025 at 2:12 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.
> >
> > Fixes: 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
> > Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
> > Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
> > ---
> >
> > [RESEND]:
> >  - Added Fixes and Tested-by tag.
> >  - Added Greg as receipent for driver-core tree.
> >
> > Original patch: https://lore.kernel.org/all/20250509122348.649064-1-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
> >
> >
>
> The build is broken in Linus's tree right now. We also now need:
>
> @@ -567,7 +567,7 @@ static void testmod_unregister_uprobe(void)
>
>  static ssize_t
>  bpf_testmod_uprobe_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)
>  {
>
> Should I send a separate patch, or can we update this and get it to Linus?

It was fixed in bpf tree couple days ago.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH] selftests/bpf: Fix bpf selftest build error
  2025-06-03 17:32 ` T.J. Mercier
  2025-06-03 17:50   ` Alexei Starovoitov
@ 2025-06-03 17:50   ` Song Liu
  2025-06-03 17:55     ` T.J. Mercier
  1 sibling, 1 reply; 5+ messages in thread
From: Song Liu @ 2025-06-03 17:50 UTC (permalink / raw)
  To: T.J. Mercier
  Cc: Saket Kumar Bhaskar, gregkh, bpf, linux-kselftest, linux-kernel,
	linux-next, hbathini, maddy, venkat88, sfr, alexei.starovoitov,
	daniel, mykolal, yoong.siang.song, martin.lau, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah

On Tue, Jun 3, 2025 at 10:33 AM T.J. Mercier <tjmercier@google.com> wrote:
>
> On Mon, May 12, 2025 at 2:12 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.
> >
> > Fixes: 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
> > Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
> > Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
> > ---
> >
> > [RESEND]:
> >  - Added Fixes and Tested-by tag.
> >  - Added Greg as receipent for driver-core tree.
> >
> > Original patch: https://lore.kernel.org/all/20250509122348.649064-1-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
> >
> >
>
> The build is broken in Linus's tree right now. We also now need:
>
> @@ -567,7 +567,7 @@ static void testmod_unregister_uprobe(void)
>
>  static ssize_t
>  bpf_testmod_uprobe_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)
>  {
>
> Should I send a separate patch, or can we update this and get it to Linus?

A fix is already in the bpf tree, with this fix as well:

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/commit/?id=4b65d5ae971430287855a89635a184c489bd02a5

Thanks,
Song

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH] selftests/bpf: Fix bpf selftest build error
  2025-06-03 17:50   ` Song Liu
@ 2025-06-03 17:55     ` T.J. Mercier
  0 siblings, 0 replies; 5+ messages in thread
From: T.J. Mercier @ 2025-06-03 17:55 UTC (permalink / raw)
  To: Song Liu
  Cc: Saket Kumar Bhaskar, gregkh, bpf, linux-kselftest, linux-kernel,
	linux-next, hbathini, maddy, venkat88, sfr, alexei.starovoitov,
	daniel, mykolal, yoong.siang.song, martin.lau, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah

On Tue, Jun 3, 2025 at 10:50 AM Song Liu <song@kernel.org> wrote:
>
> On Tue, Jun 3, 2025 at 10:33 AM T.J. Mercier <tjmercier@google.com> wrote:
> >
> > On Mon, May 12, 2025 at 2:12 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.
> > >
> > > Fixes: 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()")
> > > Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > > Closes: https://lore.kernel.org/all/e915da49-2b9a-4c4c-a34f-877f378129f6@linux.ibm.com/
> > > Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > > Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
> > > ---
> > >
> > > [RESEND]:
> > >  - Added Fixes and Tested-by tag.
> > >  - Added Greg as receipent for driver-core tree.
> > >
> > > Original patch: https://lore.kernel.org/all/20250509122348.649064-1-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
> > >
> > >
> >
> > The build is broken in Linus's tree right now. We also now need:
> >
> > @@ -567,7 +567,7 @@ static void testmod_unregister_uprobe(void)
> >
> >  static ssize_t
> >  bpf_testmod_uprobe_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)
> >  {
> >
> > Should I send a separate patch, or can we update this and get it to Linus?
>
> A fix is already in the bpf tree, with this fix as well:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/commit/?id=4b65d5ae971430287855a89635a184c489bd02a5
>
> Thanks,
> Song

Thanks, I was looking for it in driver-core.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-03 17:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-12  9:11 [RESEND PATCH] selftests/bpf: Fix bpf selftest build error Saket Kumar Bhaskar
2025-06-03 17:32 ` T.J. Mercier
2025-06-03 17:50   ` Alexei Starovoitov
2025-06-03 17:50   ` Song Liu
2025-06-03 17:55     ` T.J. Mercier

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).