All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf] Revert "bpf: program: Refuse non-O_RDWR flags in BPF_OBJ_GET"
@ 2021-06-18 10:55 Maciej Żenczykowski
  2021-06-18 11:55 ` Lorenz Bauer
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Maciej Żenczykowski @ 2021-06-18 10:55 UTC (permalink / raw)
  To: Maciej Żenczykowski, Alexei Starovoitov, Daniel Borkmann
  Cc: Linux Network Development Mailing List,
	Linux Kernel Mailing List, BPF Mailing List, David S . Miller,
	Andrii Nakryiko, Greg Kroah-Hartman, Lorenz Bauer

From: Maciej Żenczykowski <maze@google.com>

This reverts commit d37300ed182131f1757895a62e556332857417e5.

This breaks Android userspace which expects to be able to
fetch programs with just read permissions.

See: https://cs.android.com/android/platform/superproject/+/master:frameworks/libs/net/common/native/bpf_syscall_wrappers/include/BpfSyscallWrappers.h;drc=7005c764be23d31fa1d69e826b4a2f6689a8c81e;l=124

Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Greg Kroah-Hartman <gregkh@google.com>
Cc: Lorenz Bauer <lmb@cloudflare.com>
Fixes: d37300ed1821 ("bpf: program: Refuse non-O_RDWR flags in BPF_OBJ_GET")
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 kernel/bpf/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index b4ebd60a6c16..80da1db47c68 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -543,7 +543,7 @@ int bpf_obj_get_user(const char __user *pathname, int flags)
 		return PTR_ERR(raw);
 
 	if (type == BPF_TYPE_PROG)
-		ret = (f_flags != O_RDWR) ? -EINVAL : bpf_prog_new_fd(raw);
+		ret = bpf_prog_new_fd(raw);
 	else if (type == BPF_TYPE_MAP)
 		ret = bpf_map_new_fd(raw, f_flags);
 	else if (type == BPF_TYPE_LINK)
-- 
2.32.0.288.g62a8d224e6-goog


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

end of thread, other threads:[~2021-06-25  0:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 10:55 [PATCH bpf] Revert "bpf: program: Refuse non-O_RDWR flags in BPF_OBJ_GET" Maciej Żenczykowski
2021-06-18 11:55 ` Lorenz Bauer
2021-06-18 18:38   ` Maciej Żenczykowski
     [not found]   ` <CANP3RGdrpb+KiD+a29zTSU3LKR8Qo6aFdo4QseRvPdNhZ_AOJw@mail.gmail.com>
2021-06-21  9:02     ` Lorenz Bauer
2021-06-21 21:37       ` Maciej Żenczykowski
2021-06-22  8:59         ` Lorenz Bauer
2021-06-22 13:03           ` Daniel Borkmann
2021-06-25  0:27             ` Maciej Żenczykowski
2021-06-22  9:48 ` Greg Kroah-Hartman
2021-06-23  8:44 ` Lorenz Bauer
2021-06-25  0:13   ` Maciej Żenczykowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.