BPF List
 help / color / mirror / Atom feed
* [PATCH v2 0/2] linux-6.1.y: fix build errors with newer GCC/glibc
@ 2026-06-17  1:13 Clark Williams
  2026-06-17  1:13 ` [PATCH v2 1/2] tools/lib/bpf: fix const-qualifier discard in resolve_full_path Clark Williams
  2026-06-17  1:13 ` [PATCH v2 2/2] KVM: VMX: guard regparm(0) on vmread_error_trampoline for x86_32 only Clark Williams
  0 siblings, 2 replies; 6+ messages in thread
From: Clark Williams @ 2026-06-17  1:13 UTC (permalink / raw)
  To: stable; +Cc: bpf, x86, kvm

Please apply to linux-6.1.y.

Two build fixes for newer toolchains (GCC 15+ / glibc 2.43+):

1) tools/lib/bpf: strchr() now propagates const in newer glibc,
   causing -Werror=discarded-qualifiers on next_path in
   resolve_full_path().  Equivalent to upstream commit d70f79fef658.

2) KVM: VMX: regparm(0) on vmread_error_trampoline is a no-op on
   x86-64 and newer GCC emits -Wattributes for it.  Guard with
   CONFIG_X86_32.  Simpler equivalent of upstream commit 0b5e7a16a0a7
   which redesigns the declaration entirely.

Changes since v1:
- Fixed Assisted-by tag format per coding-assistants.html
- Added upstream commit references per stable-kernel-rules.html
- Updated KVM subsystem prefix to conventional KVM: VMX: style
- Fixed Author/Signed-off-by email mismatch

Clark Williams (2):
  tools/lib/bpf: fix const-qualifier discard in resolve_full_path
  KVM: VMX: guard regparm(0) on vmread_error_trampoline for x86_32 only

 arch/x86/kvm/vmx/vmx_ops.h | 7 +++++--
 tools/lib/bpf/libbpf.c     | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)


base-commit: 228da13e907e2b46b7222cfc35290fbfad920bef
-- 
2.54.0


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

* [PATCH v2 1/2] tools/lib/bpf: fix const-qualifier discard in resolve_full_path
  2026-06-17  1:13 [PATCH v2 0/2] linux-6.1.y: fix build errors with newer GCC/glibc Clark Williams
@ 2026-06-17  1:13 ` Clark Williams
  2026-06-17  3:10   ` Alexei Starovoitov
  2026-07-02 14:23   ` Greg KH
  2026-06-17  1:13 ` [PATCH v2 2/2] KVM: VMX: guard regparm(0) on vmread_error_trampoline for x86_32 only Clark Williams
  1 sibling, 2 replies; 6+ messages in thread
From: Clark Williams @ 2026-06-17  1:13 UTC (permalink / raw)
  To: stable; +Cc: bpf, x86, kvm

[ Upstream commit d70f79fef65810faf64dbae1f3a1b5623cdb2345 ]

strchr() now propagates const when passed a const char * argument in
newer GCC/glibc combinations, causing -Werror=discarded-qualifiers to
fire on the assignment to next_path. Declare next_path as const char *
since it is only used for pointer arithmetic, never written through.

[ clrkwllms: only the next_path change from the upstream commit applies
  to 6.1.y ]

Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Clark Williams <clrkwllms@kernel.org>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 7bd6aff6e260..33b214a91338 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -10748,7 +10748,7 @@ static int resolve_full_path(const char *file, char *result, size_t result_sz)
 		if (!search_paths[i])
 			continue;
 		for (s = search_paths[i]; s != NULL; s = strchr(s, ':')) {
-			char *next_path;
+			const char *next_path;
 			int seg_len;
 
 			if (s[0] == ':')
-- 
2.54.0


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

* [PATCH v2 2/2] KVM: VMX: guard regparm(0) on vmread_error_trampoline for x86_32 only
  2026-06-17  1:13 [PATCH v2 0/2] linux-6.1.y: fix build errors with newer GCC/glibc Clark Williams
  2026-06-17  1:13 ` [PATCH v2 1/2] tools/lib/bpf: fix const-qualifier discard in resolve_full_path Clark Williams
@ 2026-06-17  1:13 ` Clark Williams
  2026-06-17 11:20   ` Hanne-Lotta Mäenpää
  1 sibling, 1 reply; 6+ messages in thread
From: Clark Williams @ 2026-06-17  1:13 UTC (permalink / raw)
  To: stable; +Cc: bpf, x86, kvm

[ Upstream commit 0b5e7a16a0a79a3742f0df9e45bca46f01b40e6a ]

regparm(0) overrides the kernel's -mregparm=3 convention on x86-32 so
that vmread_error_trampoline receives its arguments on the stack, matching
the inline asm callers that push args before the call.  On x86-64 the
attribute is a no-op and newer GCC now emits -Wattributes for it, which
becomes a build error under -Werror.  Guard it with CONFIG_X86_32.

[ clrkwllms: the upstream commit redesigns the trampoline declaration as
  an opaque symbol; this simpler approach guards the regparm(0) attribute
  with CONFIG_X86_32 since the attribute is only meaningful on x86-32. ]

Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Clark Williams <clrkwllms@kernel.org>
---
 arch/x86/kvm/vmx/vmx_ops.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx_ops.h b/arch/x86/kvm/vmx/vmx_ops.h
index 5edab28dfb2e..50328be40b2b 100644
--- a/arch/x86/kvm/vmx/vmx_ops.h
+++ b/arch/x86/kvm/vmx/vmx_ops.h
@@ -11,8 +11,11 @@
 #include "../x86.h"
 
 void vmread_error(unsigned long field, bool fault);
-__attribute__((regparm(0))) void vmread_error_trampoline(unsigned long field,
-							 bool fault);
+/* regparm(0) overrides -mregparm=3 so args are stack-passed, matching asm callers */
+#ifdef CONFIG_X86_32
+__attribute__((regparm(0)))
+#endif
+void vmread_error_trampoline(unsigned long field, bool fault);
 void vmwrite_error(unsigned long field, unsigned long value);
 void vmclear_error(struct vmcs *vmcs, u64 phys_addr);
 void vmptrld_error(struct vmcs *vmcs, u64 phys_addr);
-- 
2.54.0


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

* Re: [PATCH v2 1/2] tools/lib/bpf: fix const-qualifier discard in resolve_full_path
  2026-06-17  1:13 ` [PATCH v2 1/2] tools/lib/bpf: fix const-qualifier discard in resolve_full_path Clark Williams
@ 2026-06-17  3:10   ` Alexei Starovoitov
  2026-07-02 14:23   ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Alexei Starovoitov @ 2026-06-17  3:10 UTC (permalink / raw)
  To: Clark Williams; +Cc: stable, bpf, x86, kvm

On Tue, Jun 16, 2026 at 6:13 PM Clark Williams <clrkwllms@kernel.org> wrote:
>
> [ Upstream commit d70f79fef65810faf64dbae1f3a1b5623cdb2345 ]
>
> strchr() now propagates const when passed a const char * argument in
> newer GCC/glibc combinations, causing -Werror=discarded-qualifiers to
> fire on the assignment to next_path. Declare next_path as const char *
> since it is only used for pointer arithmetic, never written through.
>
> [ clrkwllms: only the next_path change from the upstream commit applies
>   to 6.1.y ]
>
> Assisted-by: Claude:claude-sonnet-4.6
> Signed-off-by: Clark Williams <clrkwllms@kernel.org>

No. There is no reason to backport this patch.
Distros build and ship libbpf from official github source.
The kernel source tree is the source of truth though.
From there it gets synced into github automatically.
Anything but the latest bpf-next and bpf trees are irrelevant.
Hence, please do NOT backport any tools/lib/bpf/ patches. Ever.
It is just a waste of electrons.

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

* Re: [PATCH v2 2/2] KVM: VMX: guard regparm(0) on vmread_error_trampoline for x86_32 only
  2026-06-17  1:13 ` [PATCH v2 2/2] KVM: VMX: guard regparm(0) on vmread_error_trampoline for x86_32 only Clark Williams
@ 2026-06-17 11:20   ` Hanne-Lotta Mäenpää
  0 siblings, 0 replies; 6+ messages in thread
From: Hanne-Lotta Mäenpää @ 2026-06-17 11:20 UTC (permalink / raw)
  To: Clark Williams, stable; +Cc: bpf, x86, kvm

On 6/17/26 4:13 AM, Clark Williams wrote:
> [ Upstream commit 0b5e7a16a0a79a3742f0df9e45bca46f01b40e6a ]
> 
> regparm(0) overrides the kernel's -mregparm=3 convention on x86-32 so
> that vmread_error_trampoline receives its arguments on the stack, matching
> the inline asm callers that push args before the call.  On x86-64 the
> attribute is a no-op and newer GCC now emits -Wattributes for it, which
> becomes a build error under -Werror.  Guard it with CONFIG_X86_32.
> 
> [ clrkwllms: the upstream commit redesigns the trampoline declaration as
>    an opaque symbol; this simpler approach guards the regparm(0) attribute
>    with CONFIG_X86_32 since the attribute is only meaningful on x86-32. ]
> 
> Assisted-by: Claude:claude-sonnet-4.6
> Signed-off-by: Clark Williams <clrkwllms@kernel.org>
> ---
>   arch/x86/kvm/vmx/vmx_ops.h | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/vmx_ops.h b/arch/x86/kvm/vmx/vmx_ops.h
> index 5edab28dfb2e..50328be40b2b 100644
> --- a/arch/x86/kvm/vmx/vmx_ops.h
> +++ b/arch/x86/kvm/vmx/vmx_ops.h
> @@ -11,8 +11,11 @@
>   #include "../x86.h"
>   
>   void vmread_error(unsigned long field, bool fault);
> -__attribute__((regparm(0))) void vmread_error_trampoline(unsigned long field,
> -							 bool fault);
> +/* regparm(0) overrides -mregparm=3 so args are stack-passed, matching asm callers */
> +#ifdef CONFIG_X86_32
> +__attribute__((regparm(0)))
> +#endif
> +void vmread_error_trampoline(unsigned long field, bool fault);
>   void vmwrite_error(unsigned long field, unsigned long value);
>   void vmclear_error(struct vmcs *vmcs, u64 phys_addr);
>   void vmptrld_error(struct vmcs *vmcs, u64 phys_addr);

Hi,

I've sent a backport patch for this commit, see here:

https://lore.kernel.org/lkml/20260617105100.22094-1-hannelotta@gmail.com/

The commit applies cleanly without any modifications, and compiles 
without errors with gcc-16, and boots.

For commits that apply cleanly, you can simply use:

     git cherry-pick -s -x <commit-id>

And after that

     git commit --amend

to add the required [ Upstream commit <commit-id> ] line.

I wasn't able to see other compilation errors for v6.1.175 using gcc-16. 
I tried with allyesconfig and my local config.

Hope this helps.

Best regards,

Hanne-Lotta Mäenpää

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

* Re: [PATCH v2 1/2] tools/lib/bpf: fix const-qualifier discard in resolve_full_path
  2026-06-17  1:13 ` [PATCH v2 1/2] tools/lib/bpf: fix const-qualifier discard in resolve_full_path Clark Williams
  2026-06-17  3:10   ` Alexei Starovoitov
@ 2026-07-02 14:23   ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2026-07-02 14:23 UTC (permalink / raw)
  To: Clark Williams; +Cc: stable, bpf, x86, kvm

On Tue, Jun 16, 2026 at 08:13:01PM -0500, Clark Williams wrote:
> [ Upstream commit d70f79fef65810faf64dbae1f3a1b5623cdb2345 ]
> 
> strchr() now propagates const when passed a const char * argument in
> newer GCC/glibc combinations, causing -Werror=discarded-qualifiers to
> fire on the assignment to next_path. Declare next_path as const char *
> since it is only used for pointer arithmetic, never written through.
> 
> [ clrkwllms: only the next_path change from the upstream commit applies
>   to 6.1.y ]
> 
> Assisted-by: Claude:claude-sonnet-4.6
> Signed-off-by: Clark Williams <clrkwllms@kernel.org>
> ---
>  tools/lib/bpf/libbpf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Looks nothing like the original, including stripping off the tags :(

Please be more careful when you resend a new series.

thanks,

greg k-h

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

end of thread, other threads:[~2026-07-02 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17  1:13 [PATCH v2 0/2] linux-6.1.y: fix build errors with newer GCC/glibc Clark Williams
2026-06-17  1:13 ` [PATCH v2 1/2] tools/lib/bpf: fix const-qualifier discard in resolve_full_path Clark Williams
2026-06-17  3:10   ` Alexei Starovoitov
2026-07-02 14:23   ` Greg KH
2026-06-17  1:13 ` [PATCH v2 2/2] KVM: VMX: guard regparm(0) on vmread_error_trampoline for x86_32 only Clark Williams
2026-06-17 11:20   ` Hanne-Lotta Mäenpää

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox