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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1545259460-13376-2-git-send-email-jiong.wang@netronome.com>
Date:   Wed, 19 Dec 2018 17:44:08 -0500
From:   Jiong Wang <jiong.wang@...ronome.com>
To:     ast@...nel.org, daniel@...earbox.net
Cc:     netdev@...r.kernel.org, oss-drivers@...ronome.com,
        Jiong Wang <jiong.wang@...ronome.com>
Subject: [PATH bpf-next 01/13] bpf: encoding description and macros for JMP32

This patch update kernel BPF documents for JMP32 encoding.

Two macros are added for JMP32 to easy programming.

Signed-off-by: Jiong Wang <jiong.wang@...ronome.com>
---
 Documentation/networking/filter.txt | 10 ++++++++++
 include/uapi/linux/bpf.h            |  4 ++++
 tools/include/uapi/linux/bpf.h      |  4 ++++
 3 files changed, 18 insertions(+)

diff --git a/Documentation/networking/filter.txt b/Documentation/networking/filter.txt
index 2196b82..5f6fafa 100644
--- a/Documentation/networking/filter.txt
+++ b/Documentation/networking/filter.txt
@@ -939,6 +939,16 @@ in eBPF means function exit only. The eBPF program needs to store return
 value into register R0 before doing a BPF_EXIT. Class 6 in eBPF is currently
 unused and reserved for future use.
 
+And BPF_JMP has sub-opcode. When BPF_SRC(code) == BPF_X, the encoding is at
+insn->imm, starting from LSB. When BPF_SRC(code) == BPF_K, the encoding is at
+insn->src_reg, starting from LSB as well. Only one bit is used for sub-opcode at
+the moment, all other bits in imm and src_reg are still reserved and should be
+zeroed. The BPF_JMP sub-opcode is:
+
+  BPF_JMP_SUBOP_32BIT	0x1
+
+It means jump insn use 32-bit sub-register when doing comparison.
+
 For load and store instructions the 8-bit 'code' field is divided as:
 
   +--------+--------+-------------------+
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index e7d57e89..f30d646 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -42,6 +42,10 @@
 #define BPF_CALL	0x80	/* function call */
 #define BPF_EXIT	0x90	/* function return */
 
+/* jmp has sub-opcode */
+#define BPF_JMP_SUBOP_MASK	0x1
+#define BPF_JMP_SUBOP_32BIT	0x1
+
 /* Register numbers */
 enum {
 	BPF_REG_0 = 0,
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index e7d57e89..f30d646 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -42,6 +42,10 @@
 #define BPF_CALL	0x80	/* function call */
 #define BPF_EXIT	0x90	/* function return */
 
+/* jmp has sub-opcode */
+#define BPF_JMP_SUBOP_MASK	0x1
+#define BPF_JMP_SUBOP_32BIT	0x1
+
 /* Register numbers */
 enum {
 	BPF_REG_0 = 0,
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ