Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpf: avoid uninitialized warnings in verifier_global_subprogs.c #6989

Closed

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: bpf: avoid uninitialized warnings in verifier_global_subprogs.c
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=851216

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 329a672
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=851216
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 329a672
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=851308
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 75b0fbf
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=851308
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 93d1c2d
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=851308
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 7e2c7a3
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=851308
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: e612b5c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=851308
version: 2

[Changes from V1:
- The warning to disable is -Wmaybe-uninitialized, not -Wuninitialized.
- This warning is only supported in GCC.]

The BPF selftest verifier_global_subprogs.c contains code that
purposedly performs out of bounds access to memory, to check whether
the kernel verifier is able to catch them.  For example:

  __noinline int global_unsupp(const int *mem)
  {
	if (!mem)
		return 0;
	return mem[100]; /* BOOM */
  }

With -O1 and higher and no inlining, GCC notices this fact and emits a
"maybe uninitialized" warning.  This is by design.  Note that the
emission of these warnings is highly dependent on the precise
optimizations that are performed.

This patch adds a compiler pragma to verifier_global_subprogs.c to
ignore these warnings.

Tested in bpf-next master.
No regressions.

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
Cc: david.faust@oracle.com
Cc: cupertino.miranda@oracle.com
Cc: Yonghong Song <yonghong.song@linux.dev>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=851308 irrelevant now. Closing PR.

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot deleted the series/851216=>bpf-next branch May 8, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant