lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220328175033.2437312-3-roberto.sassu@huawei.com>
Date:   Mon, 28 Mar 2022 19:50:17 +0200
From:   Roberto Sassu <roberto.sassu@...wei.com>
To:     <corbet@....net>, <viro@...iv.linux.org.uk>, <ast@...nel.org>,
        <daniel@...earbox.net>, <andrii@...nel.org>, <kpsingh@...nel.org>,
        <shuah@...nel.org>, <mcoquelin.stm32@...il.com>,
        <alexandre.torgue@...s.st.com>, <zohar@...ux.ibm.com>
CC:     <linux-doc@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
        <netdev@...r.kernel.org>, <bpf@...r.kernel.org>,
        <linux-kselftest@...r.kernel.org>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-integrity@...r.kernel.org>,
        <linux-security-module@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>,
        Roberto Sassu <roberto.sassu@...wei.com>
Subject: [PATCH 02/18] bpf-preload: Move bpf_preload.h to include/linux

Move bpf_preload.h to include/linux, so that third-party providers can
develop out-of-tree kernel modules to preload eBPF programs.

Export the bpf_preload_ops global variable if CONFIG_BPF_SYSCALL is
defined.

Signed-off-by: Roberto Sassu <roberto.sassu@...wei.com>
---
 {kernel/bpf/preload => include/linux}/bpf_preload.h | 4 ++++
 kernel/bpf/inode.c                                  | 2 +-
 kernel/bpf/preload/bpf_preload_kern.c               | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
 rename {kernel/bpf/preload => include/linux}/bpf_preload.h (85%)

diff --git a/kernel/bpf/preload/bpf_preload.h b/include/linux/bpf_preload.h
similarity index 85%
rename from kernel/bpf/preload/bpf_preload.h
rename to include/linux/bpf_preload.h
index f065c91213a0..09d55d9f1131 100644
--- a/kernel/bpf/preload/bpf_preload.h
+++ b/include/linux/bpf_preload.h
@@ -11,6 +11,10 @@ struct bpf_preload_ops {
 	int (*preload)(struct bpf_preload_info *);
 	struct module *owner;
 };
+
+#ifdef CONFIG_BPF_SYSCALL
 extern struct bpf_preload_ops *bpf_preload_ops;
+#endif /*CONFIG_BPF_SYSCALL*/
+
 #define BPF_PRELOAD_LINKS 2
 #endif
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 4f841e16779e..1f2d468abf58 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -20,7 +20,7 @@
 #include <linux/filter.h>
 #include <linux/bpf.h>
 #include <linux/bpf_trace.h>
-#include "preload/bpf_preload.h"
+#include <linux/bpf_preload.h>
 
 enum bpf_type {
 	BPF_TYPE_UNSPEC	= 0,
diff --git a/kernel/bpf/preload/bpf_preload_kern.c b/kernel/bpf/preload/bpf_preload_kern.c
index 5106b5372f0c..f43391d1c49c 100644
--- a/kernel/bpf/preload/bpf_preload_kern.c
+++ b/kernel/bpf/preload/bpf_preload_kern.c
@@ -2,7 +2,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/init.h>
 #include <linux/module.h>
-#include "bpf_preload.h"
+#include <linux/bpf_preload.h>
 #include "iterators/iterators.lskel.h"
 
 static struct bpf_link *maps_link, *progs_link;
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ