Re: [PATCH][v2] uprobes/x86: emulate push insns for uprobe on x86

2017-11-13 Thread Yonghong Song
On 11/13/17 4:59 AM, Oleg Nesterov wrote: The patch looks good to me, but I have a question because I know nothing about insn encoding, On 11/10, Yonghong Song wrote: +static int push_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) +{ + u8 opc1 = OPCODE1(insn

[PATCH][v3] uprobes/x86: emulate push insns for uprobe on x86

2017-11-13 Thread Yonghong Song
1.413.5 uretprobe 1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song --- arch/x86/include/asm/uprobes.h | 4 ++ arch/x86/kernel/uprobes.

Re: [PATCH][v2] uprobes/x86: emulate push insns for uprobe on x86

2017-11-14 Thread Yonghong Song
On 11/14/17 7:34 AM, Oleg Nesterov wrote: On 11/13, Yonghong Song wrote: On 11/13/17 4:59 AM, Oleg Nesterov wrote: + switch (opc1) { + case 0x50: + reg_offset = offsetof(struct pt_regs, r8); + break

Re: [PATCH][v3] uprobes/x86: emulate push insns for uprobe on x86

2017-11-14 Thread Yonghong Song
On 11/14/17 7:51 AM, Oleg Nesterov wrote: On 11/13, Yonghong Song wrote: +static int push_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) +{ + u8 opc1 = OPCODE1(insn), reg_offset = 0; + + if (opc1 < 0x50 || opc1 > 0x57) + return -ENOSYS; + +

Re: [PATCH][v3] uprobes/x86: emulate push insns for uprobe on x86

2017-11-14 Thread Yonghong Song
On 11/14/17 8:03 AM, Oleg Nesterov wrote: On 11/14, Oleg Nesterov wrote: +#ifdef CONFIG_X86_64 + if (test_thread_flag(TIF_ADDR32)) + return -ENOSYS; +#endif No, this doesn't look right, see my previous email. You should do this check in the "if (insn->length == 2)" bran

Re: [lkp-robot] [tools/bpf] 8c417dc15f: BUG:sleeping_function_called_from_invalid_context_at_mm/slab.h

2018-01-27 Thread Yonghong Song
Thanks for reporting. This issue has been fixed by the below commit in bpf-next repo, which is waiting to be pulled into net-next. = commit 2310035fa03f651dd5b03f19a26a97512aa8842c Author: Yonghong Song Date: Mon Jan 22 22:53:51 2018 -0800 bpf: fix incorrect kmalloc usage in

bpf: handling non BPF register names in inline assembly with -target bpf

2018-04-11 Thread Yonghong Song
Hi, Arnaldo, When I studied the bpf compilation issue with latest linus/net-next kernel (https://patchwork.kernel.org/patch/10333829/), an alternative approach I tried is to use __BPF__ macro. The following patch introduced "#ifndef __BPF__" in arch/x86/include/asm/asm.h for some inline assembl

Re: bpf: handling non BPF register names in inline assembly with -target bpf

2018-04-11 Thread Yonghong Song
On 4/11/18 11:39 AM, Arnaldo Carvalho de Melo wrote: Em Wed, Apr 11, 2018 at 09:37:46AM -0700, Yonghong Song escreveu: Hi, Arnaldo, When I studied the bpf compilation issue with latest linus/net-next kernel (https://patchwork.kernel.org/patch/10333829/), an alternative approach I tried is

Re: bpf: handling non BPF register names in inline assembly with -target bpf

2018-04-11 Thread Yonghong Song
On 4/11/18 4:17 PM, Arnaldo Carvalho de Melo wrote: Em Wed, Apr 11, 2018 at 04:47:29PM -0300, Arnaldo Carvalho de Melo escreveu: Em Wed, Apr 11, 2018 at 12:22:37PM -0700, Yonghong Song escreveu: Look at test bpf-script-test-kbuild.c, I think you can drop uapi/asm/ptrace.h from include file

Re: [PATCH] test_bpf: Fix testing with CONFIG_BPF_JIT_ALWAYS_ON=y on other arches

2018-03-20 Thread Yonghong Song
On 3/20/18 5:58 AM, Thadeu Lima de Souza Cascardo wrote: Function bpf_fill_maxinsns11 is designed to not be able to be JITed on x86_64. So, it fails when CONFIG_BPF_JIT_ALWAYS_ON=y, and commit 09584b406742 ("bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y") makes sur

Re: [PATCH] test_bpf: Fix testing with CONFIG_BPF_JIT_ALWAYS_ON=y on other arches

2018-03-20 Thread Yonghong Song
On 3/20/18 10:00 AM, Thadeu Lima de Souza Cascardo wrote: On Tue, Mar 20, 2018 at 09:05:15AM -0700, Yonghong Song wrote: On 3/20/18 5:58 AM, Thadeu Lima de Souza Cascardo wrote: Function bpf_fill_maxinsns11 is designed to not be able to be JITed on x86_64. So, it fails when

[PATCH] x86/cpufeature: guard asm_volatile_goto usage with CC_HAVE_ASM_GOTO

2018-04-10 Thread Yonghong Song
compilation error will disappear. If later clang compiler starts to support asm_volatile_goto, the change in this patch can be reverted and there should be no impact on BPF compilation. Fixes: d0266046ad54 ("x86: Remove FAST_FEATURE_TESTS") Signed-off-by: Yonghong Song --- arch/x86/include/asm

Re: [PATCH] bpf: whitelist syscalls for error injection

2018-03-13 Thread Yonghong Song
On 3/13/18 4:45 PM, Omar Sandoval wrote: On Tue, Mar 13, 2018 at 04:16:27PM -0700, Howard McLauchlan wrote: Error injection is a useful mechanism to fail arbitrary kernel functions. However, it is often hard to guarantee an error propagates appropriately to user space programs. By injecting in

Re: [PATCH bpf-next 2/3] bpf: add bpffs pretty print for cgroup local storage maps

2018-12-07 Thread Yonghong Song
On 12/7/18 4:53 PM, Roman Gushchin wrote: > Implement bpffs pretty printing for cgroup local storage maps > (both shared and per-cpu). > Output example (captured for tools/testing/selftests/bpf/netcnt_prog.c): > > Shared: >$ cat /sys/fs/bpf/map_2 ># WARNING!! The output is for debug purp

Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6

2018-06-16 Thread Yonghong Song
On 6/16/18 5:26 AM, Arnaldo Carvalho de Melo wrote: Hi Wang, Yogong, While reviewing the BTF patches for pahole, I updated llvm/clang to HEAD and then building perf with clang embedded I noticed this, will investigate, posting here to document the regression, maybe this is something y

[PATCH] tools/perf: fix a clang 7.0 compilation error

2018-06-16 Thread Yonghong Song
lure. This patch fixed the issue with using proper function signatures under different compiler versions. Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Yonghong Song --- tools/perf/util/c++/clang.cpp | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/perf

Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6

2018-06-18 Thread Yonghong Song
On 6/18/18 7:31 AM, Arnaldo Carvalho de Melo wrote: Em Sat, Jun 16, 2018 at 10:20:21AM -0700, Yonghong Song escreveu: On 6/16/18 5:26 AM, Arnaldo Carvalho de Melo wrote: Hi Wang, Yogong, While reviewing the BTF patches for pahole, I updated llvm/clang to HEAD and then building

Re: [LKP] [tools/bpf] f6f3bac08f: stderr.failed_to_prepare_for_bpf

2018-11-05 Thread Yonghong Song
I cannot reproduce in my local fc28 system with the attached steps. The netlink_dumper.c file, could you confirm whether the following header files are missing form you rhel-7.2 host? #include #include I suspect you probably miss linux/tc_act/tc_bpf.h. But could you confirm it? If this is

Re: [LKP] [tools/bpf] f6f3bac08f: stderr.failed_to_prepare_for_bpf

2018-11-06 Thread Yonghong Song
On 11/6/18 2:04 AM, Li Zhijian wrote: > > On 11/6/2018 9:47 AM, Yonghong Song wrote: >> I cannot reproduce in my local fc28 system with the attached steps. >> >> The netlink_dumper.c file, could you confirm whether the following >> header files are missing form you

Re: [syzbot] [bpf?] [trace?] WARNING in group_send_sig_info

2024-04-29 Thread Yonghong Song
On 4/27/24 9:34 AM, syzbot wrote: Hello, syzbot found the following issue on: HEAD commit:443574b03387 riscv, bpf: Fix kfunc parameters incompatibil.. git tree: bpf console output: https://syzkaller.appspot.com/x/log.txt?x=11ca8fe718 kernel config: https://syzkaller.appspot.com

Re: [PATCH net] bpf: test_run: fix WARNING in format_decode

2023-11-21 Thread Yonghong Song
On 11/21/23 7:50 PM, Edward Adam Davis wrote: Confirm that skb->len is not 0 to ensure that skb length is valid. Fixes: 114039b34201 ("bpf: Move skb->len == 0 checks into __bpf_redirect") Reported-by: syzbot+e2c932aec5c8a6e1d...@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis Sta

Re: BUG: unable to handle kernel paging request in bpf_probe_read_compat_str

2023-12-20 Thread Yonghong Song
On 12/20/23 1:19 AM, Hou Tao wrote: Hi, On 12/14/2023 11:40 AM, xingwei lee wrote: Hello I found a bug in net/bpf in the lastest upstream linux and comfired in the lastest net tree and lastest net bpf titled BUG: unable to handle kernel paging request in bpf_probe_read_compat_str If you fix

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-27 Thread Yonghong Song
Hi, Peter, Just wanted to ping again so that you did not miss the email below. Please let me know your opinion. Thanks! Yonghong On 4/23/18 9:50 AM, Yonghong Song wrote: Hi, Peter, Please see comments below. On 4/23/18 3:52 AM, Peter Zijlstra wrote: On Fri, Apr 20, 2018 at 11:06:03AM

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-05-02 Thread Yonghong Song
Hi, Peter, Ping again. Did you get chances to think about this issue again? Thanks! Yonghong On 4/27/18 9:34 AM, Yonghong Song wrote: Hi, Peter, Just wanted to ping again so that you did not miss the email below. Please let me know your opinion. Thanks! Yonghong On 4/23/18 9:50 AM

Re: [PATCH v5 3/6] uaccess: Add non-pagefault user-space read functions

2019-02-28 Thread Yonghong Song
On 2/28/19 8:03 AM, Masami Hiramatsu wrote: > Add probe_user_read(), strncpy_from_unsafe_user() and > strnlen_unsafe_user() which allows caller to access user-space > in IRQ context. > > Current probe_kernel_read() and strncpy_from_unsafe() are > not available for user-space memory, because it s

Re: [PATCH v5 3/6] uaccess: Add non-pagefault user-space read functions

2019-02-28 Thread Yonghong Song
On 2/28/19 6:29 PM, Masami Hiramatsu wrote: > Hi Yonghong, > > On Thu, 28 Feb 2019 22:49:43 + > Yonghong Song wrote: > >> >> >> On 2/28/19 8:03 AM, Masami Hiramatsu wrote: >>> Add probe_user_read(), strncpy_from_unsafe_user() and >>>

Re: [PATCH] selftests/bpf: fix compile errors with older glibc

2019-04-17 Thread Yonghong Song
On 4/17/19 10:48 AM, Wang YanQing wrote: > The older glibc (for example, 2.23) doesn't handle __UAPI_DEF_* > in libc-compat.h properly, and it bring below compile errors: I have an even old glibc 2.17 and it still works. Not sure why it failed here. Could you explain more? But I applied the cha

Re: [PATCH v5 bpf-next 1/6] bpf: enable task local storage for tracing programs

2021-02-23 Thread Yonghong Song
On 2/23/21 2:28 PM, Song Liu wrote: To access per-task data, BPF programs usually creates a hash table with pid as the key. This is not ideal because: 1. The user need to estimate the proper size of the hash table, which may be inaccurate; 2. Big hash tables are slow; 3. To clean up

Re: [PATCH bpf-next v3] bpf: Propagate stack bounds to registers in atomics w/ BPF_FETCH

2021-02-03 Thread Yonghong Song
using assembly. Suggested-by: John Fastabend Signed-off-by: Brendan Jackman Ack with a nit below. Acked-by: Yonghong Song --- Difference from v2->v3 [1]: * Fixed missing ENABLE_ATOMICS_TESTS check. Difference from v1->v2: * Reworked commit message to clarify this only af

Re: ERROR: INT DW_ATE_unsigned_1 Error emitting BTF type

2021-02-05 Thread Yonghong Song
On 2/5/21 11:06 AM, Sedat Dilek wrote: On Fri, Feb 5, 2021 at 7:53 PM Sedat Dilek wrote: On Fri, Feb 5, 2021 at 6:48 PM Sedat Dilek wrote: On Fri, Feb 5, 2021 at 4:28 PM Arnaldo Carvalho de Melo wrote: Em Fri, Feb 05, 2021 at 04:23:59PM +0100, Sedat Dilek escreveu: On Fri, Feb 5, 202

Re: ERROR: INT DW_ATE_unsigned_1 Error emitting BTF type

2021-02-05 Thread Yonghong Song
On 2/5/21 11:15 AM, Sedat Dilek wrote: On Fri, Feb 5, 2021 at 8:10 PM Yonghong Song wrote: On 2/5/21 11:06 AM, Sedat Dilek wrote: On Fri, Feb 5, 2021 at 7:53 PM Sedat Dilek wrote: On Fri, Feb 5, 2021 at 6:48 PM Sedat Dilek wrote: On Fri, Feb 5, 2021 at 4:28 PM Arnaldo Carvalho de

Re: ERROR: INT DW_ATE_unsigned_1 Error emitting BTF type

2021-02-05 Thread Yonghong Song
On 2/5/21 11:24 AM, Arnaldo Carvalho de Melo wrote: Em Fri, Feb 05, 2021 at 11:10:08AM -0800, Yonghong Song escreveu: On 2/5/21 11:06 AM, Sedat Dilek wrote: On Fri, Feb 5, 2021 at 7:53 PM Sedat Dilek wrote: Grepping through linux.git/tools I guess some BTF tools/libs need to know what

Re: KMSAN: uninit-value in bpf_iter_prog_supported

2021-02-09 Thread Yonghong Song
On 2/8/21 11:35 PM, Dmitry Vyukov wrote: On Sun, Feb 7, 2021 at 1:20 PM syzbot wrote: Hello, syzbot found the following issue on: HEAD commit:73d62e81 kmsan: random: prevent boot-time reports in _mix_.. git tree: https://github.com/google/kmsan.git master console output: https:/

Re: UBSAN: array-index-out-of-bounds in kernel/bpf/arraymap.c:177

2020-05-18 Thread Yonghong Song
On 5/18/20 5:25 PM, Andrii Nakryiko wrote: On Mon, May 18, 2020 at 5:09 PM Qian Cai wrote: On Mon, May 18, 2020 at 7:55 PM Andrii Nakryiko wrote: On Sun, May 17, 2020 at 7:45 PM Qian Cai wrote: With Clang 9.0.1, return array->value + array->elem_size * (index & array->index_mask); b

Re: UBSAN: array-index-out-of-bounds in kernel/bpf/arraymap.c:177

2020-05-18 Thread Yonghong Song
On 5/18/20 6:30 PM, Andrii Nakryiko wrote: On Mon, May 18, 2020 at 6:00 PM Yonghong Song wrote: On 5/18/20 5:25 PM, Andrii Nakryiko wrote: On Mon, May 18, 2020 at 5:09 PM Qian Cai wrote: On Mon, May 18, 2020 at 7:55 PM Andrii Nakryiko wrote: On Sun, May 17, 2020 at 7:45 PM Qian

Re: [PATCH v2 bpf-next 2/7] bpf: move to generic BTF show support, apply it to seq files/strings

2020-05-18 Thread Yonghong Song
On 5/18/20 2:46 AM, Alan Maguire wrote: On Wed, 13 May 2020, Yonghong Song wrote: +struct btf_show { + u64 flags; + void *target; /* target of show operation (seq file, buffer) */ + void (*showfn)(struct btf_show *show, const char *fmt, ...); + const struct btf

Re: [PATCH bpf-next] bpf: make __htab_lookup_and_delete_batch faster when map is almost empty

2020-08-01 Thread Yonghong Song
10 BM_DumpHashMap/1/16k14925 14895 47448 BM_DumpHashMap/1/64k58870 58674 1 Suggested-by: Luigi Rizzo Cc: Yonghong Song Signed-off-by: Brian Vazquez --- kernel/bpf/hashtab.c | 23 --- 1 file changed, 8 inser

Re: [PATCH V2 bpf-next] bpf: make __htab_lookup_and_delete_batch faster when map is almost empty

2020-08-01 Thread Yonghong Song
zzo Cc: Yonghong Song Signed-off-by: Brian Vazquez --- kernel/bpf/hashtab.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 024276787055..b6d28bd6345b 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/

Re: [PATCH bpf-next 3/6] bpf: sockmap: call sock_map_update_elem directly

2020-08-19 Thread Yonghong Song
_update_elem and rename the function to sock_map_update_elem_sys. Signed-off-by: Lorenz Bauer Acked-by: Yonghong Song

Re: [PATCH bpf-next 4/6] bpf: override the meaning of ARG_PTR_TO_MAP_VALUE for sockmap and sockhash

2020-08-19 Thread Yonghong Song
On 8/19/20 2:24 AM, Lorenz Bauer wrote: The verifier assumes that map values are simple blobs of memory, and therefore treats ARG_PTR_TO_MAP_VALUE, etc. as such. However, there are map types where this isn't true. For example, sockmap and sockhash store sockets. In general this isn't a big pro

Re: [PATCH bpf-next 5/6] bpf: sockmap: allow update from BPF

2020-08-19 Thread Yonghong Song
ing a callback via sk_prot->unhash. However, we can't just lock_sock like in sock_map_sk_acquire because that might sleep. So instead we disable softirq processing and use bh_lock_sock to prevent further modification. Signed-off-by: Lorenz Bauer Acked-by: Yonghong Song

Re: [PATCH bpf-next 6/6] selftests: bpf: test sockmap update from BPF

2020-08-19 Thread Yonghong Song
On 8/19/20 2:24 AM, Lorenz Bauer wrote: Add a test which copies a socket from a sockmap into another sockmap or sockhash. This excercises bpf_map_update_elem support from BPF context. Compare the socket cookies from source and destination to ensure that the copy succeeded. Signed-off-by: Lore

Re: [PATCH bpf-next 5/6] bpf: sockmap: allow update from BPF

2020-08-20 Thread Yonghong Song
On 8/20/20 4:33 AM, Lorenz Bauer wrote: On Wed, 19 Aug 2020 at 23:41, John Fastabend wrote: John Fastabend wrote: Lorenz Bauer wrote: Allow calling bpf_map_update_elem on sockmap and sockhash from a BPF context. The synchronization required for this is a bit fiddly: we need to prevent the

Re: [PATCH bpf-next 6/6] selftests: bpf: test sockmap update from BPF

2020-08-20 Thread Yonghong Song
On 8/20/20 4:58 AM, Lorenz Bauer wrote: On Wed, 19 Aug 2020 at 21:46, Yonghong Song wrote: On 8/19/20 2:24 AM, Lorenz Bauer wrote: Add a test which copies a socket from a sockmap into another sockmap or sockhash. This excercises bpf_map_update_elem support from BPF context. Compare the

Re: [PATCH bpf-next v1 1/8] bpf: Introduce pseudo_btf_id

2020-08-20 Thread Yonghong Song
On 8/19/20 3:40 PM, Hao Luo wrote: Pseudo_btf_id is a type of ld_imm insn that associates a btf_id to a ksym so that further dereferences on the ksym can use the BTF info to validate accesses. Internally, when seeing a pseudo_btf_id ld insn, the verifier reads the btf_id stored in the insn[0]'

Re: [PATCH bpf-next v2 4/6] bpf: override the meaning of ARG_PTR_TO_MAP_VALUE for sockmap and sockhash

2020-08-20 Thread Yonghong Song
On 8/20/20 6:57 AM, Lorenz Bauer wrote: The verifier assumes that map values are simple blobs of memory, and therefore treats ARG_PTR_TO_MAP_VALUE, etc. as such. However, there are map types where this isn't true. For example, sockmap and sockhash store sockets. In general this isn't a big pro

Re: [PATCH bpf-next v2 4/6] bpf: override the meaning of ARG_PTR_TO_MAP_VALUE for sockmap and sockhash

2020-08-20 Thread Yonghong Song
On 8/20/20 9:15 AM, Lorenz Bauer wrote: On Thu, 20 Aug 2020 at 17:10, Yonghong Song wrote: On 8/20/20 6:57 AM, Lorenz Bauer wrote: The verifier assumes that map values are simple blobs of memory, and therefore treats ARG_PTR_TO_MAP_VALUE, etc. as such. However, there are map types where

Re: [PATCH bpf-next v1 1/8] bpf: Introduce pseudo_btf_id

2020-08-20 Thread Yonghong Song
On 8/19/20 3:40 PM, Hao Luo wrote: Pseudo_btf_id is a type of ld_imm insn that associates a btf_id to a ksym so that further dereferences on the ksym can use the BTF info to validate accesses. Internally, when seeing a pseudo_btf_id ld insn, the verifier reads the btf_id stored in the insn[0]'

Re: [PATCH bpf-next v1 2/8] bpf: Propagate BPF_PSEUDO_BTF_ID to uapi headers in /tools

2020-08-20 Thread Yonghong Song
On 8/19/20 3:40 PM, Hao Luo wrote: Propagate BPF_PSEUDO_BTF_ID from include/linux/uapi/bpf.h to tools/include/linux/uapi/bpf.h. This can be folded into the previous patch. Signed-off-by: Hao Luo --- tools/include/uapi/linux/bpf.h | 38 ++ 1 file changed

Re: [PATCH bpf-next v1 3/8] bpf: Introduce help function to validate ksym's type.

2020-08-20 Thread Yonghong Song
On 8/19/20 3:40 PM, Hao Luo wrote: For a ksym to be safely dereferenced and accessed, its type defined in bpf program should basically match its type defined in kernel. Implement a help function for a quick matching, which is used by libbpf when resolving the kernel btf_id of a ksym. Signed-o

Re: [PATCH bpf-next v1 5/8] bpf/selftests: ksyms_btf to test typed ksyms

2020-08-20 Thread Yonghong Song
On 8/19/20 3:40 PM, Hao Luo wrote: Selftests for typed ksyms. Tests two types of ksyms: one is a struct, the other is a plain int. This tests two paths in the kernel. Struct ksyms will be converted into PTR_TO_BTF_ID by the verifier while int typed ksyms will be converted into PTR_TO_MEM. Sig

Re: [PATCH bpf-next v1 7/8] bpf: Propagate bpf_per_cpu_ptr() to /tools

2020-08-20 Thread Yonghong Song
On 8/19/20 3:40 PM, Hao Luo wrote: Sync tools/include/linux/uapi/bpf.h with include/linux/uapi/bpf.h This can be folded into the previous patch. Signed-off-by: Hao Luo --- tools/include/uapi/linux/bpf.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/tools/include

Re: [PATCH] libbpf: simplify the return expression of build_map_pin_path()

2020-08-18 Thread Yonghong Song
On 8/18/20 1:20 AM, Xu Wang wrote: Simplify the return expression. Signed-off-by: Xu Wang --- tools/lib/bpf/libbpf.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 5055e1531e43..b423fdaae0b6 100644 --- a/tools

Re: [PATCH] libbpf: simplify the return expression of build_map_pin_path()

2020-08-18 Thread Yonghong Song
On 8/18/20 1:20 AM, Xu Wang wrote: Simplify the return expression. Signed-off-by: Xu Wang Also, please tag your patch targeting to 'bpf-next' tree like [PATCH bpf-next] so people knows which tree the patch targets. --- tools/lib/bpf/libbpf.c | 6 +- 1 file changed, 1 insertion(+),

Re: [PATCH] libbpf: convert comma to semicolon

2020-08-18 Thread Yonghong Song
On 8/18/20 12:16 AM, Xu Wang wrote: Replace a comma between expression statements by a semicolon. Signed-off-by: Xu Wang Acked-by: Yonghong Song

Re: [PATCH bpf-next] libbpf: simplify the return expression of build_map_pin_path()

2020-08-18 Thread Yonghong Song
On 8/18/20 7:53 PM, Xu Wang wrote: Simplify the return expression. Signed-off-by: Xu Wang Acked-by: Yonghong Song

Re: [PATCH bpf] bpf: verifier: check for packet data access based on target prog

2020-08-18 Thread Yonghong Song
On 8/18/20 6:12 PM, Udip Pant wrote: While using dynamic program extension (of type BPF_PROG_TYPE_EXT), we need to check the program type of the target program to grant the read / write access to the packet data. The BPF_PROG_TYPE_EXT type can be used to extend types such as XDP, SKB and othe

Re: [PATCH bpf-next 2/6] bpf: sockmap: merge sockmap and sockhash update functions

2020-08-19 Thread Yonghong Song
On 8/19/20 2:24 AM, Lorenz Bauer wrote: Merge the two very similar functions sock_map_update_elem and sock_hash_update_elem into one. Signed-off-by: Lorenz Bauer Acked-by: Yonghong Song

Re: [PATCH bpf-next 1/4] bpf: enable task local storage for tracing programs

2021-01-10 Thread Yonghong Song
On 1/8/21 3:19 PM, Song Liu wrote: To access per-task data, BPF program typically creates a hash table with pid as the key. This is not ideal because: 1. The use need to estimate requires size of the hash table, with may be inaccurate; 2. Big hash tables are slow; 3. To clean up the

Re: [PATCH bpf-next 1/4] bpf: enable task local storage for tracing programs

2021-01-11 Thread Yonghong Song
On 1/11/21 2:17 AM, KP Singh wrote: On Mon, Jan 11, 2021 at 7:27 AM Yonghong Song wrote: On 1/8/21 3:19 PM, Song Liu wrote: To access per-task data, BPF program typically creates a hash table with pid as the key. This is not ideal because: 1. The use need to estimate requires size of

Re: [PATCH bpf-next 1/4] bpf: enable task local storage for tracing programs

2021-01-11 Thread Yonghong Song
On 1/8/21 3:19 PM, Song Liu wrote: To access per-task data, BPF program typically creates a hash table with pid as the key. This is not ideal because: 1. The use need to estimate requires size of the hash table, with may be inaccurate; 2. Big hash tables are slow; 3. To clean up the

Re: [PATCH bpf-next 2/4] selftests/bpf: add non-BPF_LSM test for task local storage

2021-01-11 Thread Yonghong Song
On 1/8/21 3:19 PM, Song Liu wrote: Task local storage is enabled for tracing programs. Add a test for it without CONFIG_BPF_LSM. Signed-off-by: Song Liu --- .../bpf/prog_tests/test_task_local_storage.c | 34 + .../selftests/bpf/progs/task_local_storage.c | 37 +++

Re: [PATCH bpf-next 3/4] bpf: runqslower: prefer use local vmlinux

2021-01-11 Thread Yonghong Song
On 1/8/21 3:19 PM, Song Liu wrote: Update the Makefile to prefer using ../../../vmlinux, which has latest definitions for vmlinux.h Signed-off-by: Song Liu --- tools/bpf/runqslower/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/bpf/runqslower/Makefile

Re: [PATCH bpf-next 4/4] bpf: runqslower: use task local storage

2021-01-11 Thread Yonghong Song
On 1/8/21 3:19 PM, Song Liu wrote: Replace hashtab with task local storage in runqslower. This improves the performance of these BPF programs. The following table summarizes average runtime of these programs, in nanoseconds: task-local hash-prealloc hash-no-prea

Re: [PATCH bpf-next 4/4] bpf: runqslower: use task local storage

2021-01-11 Thread Yonghong Song
On 1/11/21 2:54 PM, Song Liu wrote: On Jan 11, 2021, at 9:49 AM, Yonghong Song wrote: On 1/8/21 3:19 PM, Song Liu wrote: Replace hashtab with task local storage in runqslower. This improves the performance of these BPF programs. The following table summarizes average runtime of these

Re: [PATCH bpf-next 4/4] bpf: runqslower: use task local storage

2021-01-11 Thread Yonghong Song
On 1/11/21 11:14 PM, Andrii Nakryiko wrote: On Mon, Jan 11, 2021 at 7:24 PM Yonghong Song wrote: On 1/11/21 2:54 PM, Song Liu wrote: On Jan 11, 2021, at 9:49 AM, Yonghong Song wrote: On 1/8/21 3:19 PM, Song Liu wrote: Replace hashtab with task local storage in runqslower. This

Re: [PATCH bpf-next v3 10/14] bpf: Add bitwise atomic instructions

2020-12-07 Thread Yonghong Song
On 12/7/20 3:28 AM, Brendan Jackman wrote: On Fri, Dec 04, 2020 at 07:21:22AM -0800, Yonghong Song wrote: On 12/4/20 1:36 AM, Brendan Jackman wrote: On Thu, Dec 03, 2020 at 10:42:19PM -0800, Yonghong Song wrote: On 12/3/20 8:02 AM, Brendan Jackman wrote: This adds instructions for

Re: [PATCH] bpf: propagate __user annotations properly

2020-12-07 Thread Yonghong Song
xt tree is fine since this is not a correctness issue. Acked-by: Yonghong Song

Re: [PATCH bpf-next v4 05/11] bpf: Move BPF_STX reserved field check into BPF_STX verifier code

2020-12-07 Thread Yonghong Song
On 12/7/20 8:07 AM, Brendan Jackman wrote: I can't find a reason why this code is in resolve_pseudo_ldimm64; since I'll be modifying it in a subsequent commit, tidy it up. Signed-off-by: Brendan Jackman Acked-by: Yonghong Song

Re: [PATCH bpf-next v4 06/11] bpf: Add BPF_FETCH field / create atomic_fetch_add instruction

2020-12-07 Thread Yonghong Song
On 12/7/20 8:07 AM, Brendan Jackman wrote: The BPF_FETCH field can be set in bpf_insn.imm, for BPF_ATOMIC instructions, in order to have the previous value of the atomically-modified memory location loaded into the src register after an atomic op is carried out. Suggested-by: Yonghong Song

Re: [PATCH bpf-next v4 07/11] bpf: Add instructions for atomic_[cmp]xchg

2020-12-07 Thread Yonghong Song
On 12/7/20 8:07 AM, Brendan Jackman wrote: This adds two atomic opcodes, both of which include the BPF_FETCH flag. XCHG without the BPF_FETCH flag would naturally encode atomic_set. This is not supported because it would be of limited value to userspace (it doesn't imply any barriers). CMPXCHG

Re: [PATCH bpf-next v4 09/11] bpf: Add bitwise atomic instructions

2020-12-07 Thread Yonghong Song
On 12/7/20 8:07 AM, Brendan Jackman wrote: This adds instructions for atomic[64]_[fetch_]and atomic[64]_[fetch_]or atomic[64]_[fetch_]xor All these operations are isomorphic enough to implement with the same verifier, interpreter, and x86 JIT code, hence being a single commit. The main inte

Re: [PATCH bpf-next v4 10/11] bpf: Add tests for new BPF atomic operations

2020-12-07 Thread Yonghong Song
32. A variable called skip_tests is defined in the BPF object's data section, which tells the userspace object whether to skip the atomics test. Signed-off-by: Brendan Jackman Ack with minor comments below. Acked-by: Yonghong Song --- tools/testing/selftests/bpf/Makefile

Re: [PATCH bpf-next v4 11/11] bpf: Document new atomic instructions

2020-12-07 Thread Yonghong Song
On 12/7/20 8:07 AM, Brendan Jackman wrote: Document new atomic instructions. Signed-off-by: Brendan Jackman Ack with minor comments below. Acked-by: Yonghong Song --- Documentation/networking/filter.rst | 26 ++ 1 file changed, 26 insertions(+) diff --git a

Re: [PATCH bpf-next v4 10/11] bpf: Add tests for new BPF atomic operations

2020-12-08 Thread Yonghong Song
On 12/8/20 4:41 AM, Brendan Jackman wrote: On Mon, Dec 07, 2020 at 07:18:57PM -0800, Yonghong Song wrote: On 12/7/20 8:07 AM, Brendan Jackman wrote: The prog_test that's added depends on Clang/LLVM features added by Yonghong in commit 286daafd6512 (was https://reviews.llvm.org/D

Re: [PATCH bpf-next v4 10/11] bpf: Add tests for new BPF atomic operations

2020-12-08 Thread Yonghong Song
On 12/8/20 8:59 AM, Brendan Jackman wrote: On Tue, Dec 08, 2020 at 08:38:04AM -0800, Yonghong Song wrote: On 12/8/20 4:41 AM, Brendan Jackman wrote: On Mon, Dec 07, 2020 at 07:18:57PM -0800, Yonghong Song wrote: On 12/7/20 8:07 AM, Brendan Jackman wrote: The prog_test that's

Re: [PATCH bpf-next 1/4] bpf: enable task local storage for tracing programs

2021-01-12 Thread Yonghong Song
On 1/11/21 3:45 PM, Song Liu wrote: On Jan 11, 2021, at 1:58 PM, Martin Lau wrote: On Mon, Jan 11, 2021 at 10:35:43PM +0100, KP Singh wrote: On Mon, Jan 11, 2021 at 7:57 PM Martin KaFai Lau wrote: On Fri, Jan 08, 2021 at 03:19:47PM -0800, Song Liu wrote: [ ... ] diff --git a/kernel

Re: [PATCH bpf-next] bpf: Clarify return value of probe str helpers

2021-01-12 Thread Yonghong Song
could also refer to the length of the input. Signed-off-by: Brendan Jackman Acked-by: Yonghong Song

Re: [PATCH bpf-next] bpf: Fix a verifier message for alloc size helper arg

2021-01-12 Thread Yonghong Song
On 1/12/21 4:39 AM, Brendan Jackman wrote: The error message here is misleading, the argument will be rejected unless it is a known constant. Signed-off-by: Brendan Jackman Okay, this is for bpf_ringbuf_reserve() helper where the size must be a constant. Acked-by: Yonghong Song

Re: [PATCH 2/2] selftests/bpf: add verifier test for PTR_TO_MEM spill

2021-01-12 Thread Yonghong Song
On 1/12/21 7:43 AM, Daniel Borkmann wrote: On 1/12/21 4:35 PM, Gilad Reti wrote: On Tue, Jan 12, 2021 at 4:56 PM KP Singh wrote: On Tue, Jan 12, 2021 at 10:16 AM Gilad Reti wrote: Add test to check that the verifier is able to recognize spilling of PTR_TO_MEM registers. It would be nic

Re: [PATCH bpf-next 1/2] trace: bpf: Allow bpf to attach to bare tracepoints

2021-01-12 Thread Yonghong Song
On 1/11/21 10:20 AM, Qais Yousef wrote: Some subsystems only have bare tracepoints (a tracepoint with no associated trace event) to avoid the problem of trace events being an ABI that can't be changed. From bpf presepective, bare tracepoints are what it calls RAW_TRACEPOINT(). Since bpf ass

Re: [PATCH bpf v2 2/2] selftests/bpf: add verifier test for PTR_TO_MEM spill

2021-01-13 Thread Yonghong Song
area pointed by it. The patch was partially contributed by CyberArk Software, Inc. Signed-off-by: Gilad Reti I didn't verify result_unpriv = ACCEPT part. I think it is correct by checking code. Acked-by: Yonghong Song

Re: [PATCH bpf-next 1/2] trace: bpf: Allow bpf to attach to bare tracepoints

2021-01-13 Thread Yonghong Song
On 1/13/21 2:16 AM, Qais Yousef wrote: On 01/12/21 12:19, Yonghong Song wrote: I applied the patch to my local bpf-next repo, and got the following compilation error: [...] I dumped preprecessor result but after macro expansion, the code becomes really complex and I have not figured out

Re: [PATCH bpf 1/2] samples/bpf: Set flag __SANE_USERSPACE_TYPES__ for MIPS to fix build warnings

2021-01-13 Thread Yonghong Song
On 1/13/21 2:57 AM, Tiezhu Yang wrote: MIPS needs __SANE_USERSPACE_TYPES__ before to select 'int-ll64.h' in arch/mips/include/uapi/asm/types.h and avoid compile warnings when printing __u64 with %llu, %llx or %lld. could you mention which command produces the following warning? prin

Re: [PATCH 2/2] compiler.h: Include asm/rwonce.h under ARM64 and ALPHA to fix build errors

2021-01-13 Thread Yonghong Song
On 1/13/21 2:57 AM, Tiezhu Yang wrote: When make M=samples/bpf on the Loongson 3A3000 platform which belongs to MIPS arch, there exists many similar build errors about 'asm/rwonce.h' file not found, so include it only under CONFIG_ARM64 and CONFIG_ALPHA due to it exists only in arm64 and alpha

Re: [PATCH 0/2] Fix build errors and warnings when make M=samples/bpf

2021-01-13 Thread Yonghong Song
On 1/13/21 2:57 AM, Tiezhu Yang wrote: There exists many build errors and warnings when make M=samples/bpf, both fixes in this patch related to mips, please do mention in the commit message that this is mips related. x86 (and arm64 I assume) compiles just fine. this patch series fix some

Re: [PATCH 1/2] bpf, libbpf: Avoid unused function warning on bpf_tail_call_static

2021-01-13 Thread Yonghong Song
On 1/13/21 2:36 PM, Ian Rogers wrote: Add inline to __always_inline making it match the linux/compiler.h. Adding this avoids an unused function warning on bpf_tail_call_static when compining with -Wall. Signed-off-by: Ian Rogers Acked-by: Yonghong Song

Re: [PATCH bpf-next v2 2/2] docs: bpf: Clarify -mcpu=v3 requirement for atomic ops

2021-01-18 Thread Yonghong Song
com/T/#m07264fc18fdc43af02fc1320968afefcc73d96f4 Signed-off-by: Brendan Jackman Thanks for better description! Acked-by: Yonghong Song

Re: [PATCH v2 bpf-next 2/2] selftests: bpf: Add a new test for bare tracepoints

2021-01-18 Thread Yonghong Song
On 1/18/21 4:18 AM, Qais Yousef wrote: On 01/16/21 18:11, Yonghong Song wrote: On 1/16/21 10:21 AM, Qais Yousef wrote: Reuse module_attach infrastructure to add a new bare tracepoint to check we can attach to it as a raw tracepoint. Signed-off-by: Qais Yousef --- .../bpf/bpf_testmod

Re: [PATCH bpf] samples/bpf: Update README.rst for manually compiling LLVM and clang

2021-01-18 Thread Yonghong Song
On 1/18/21 12:53 AM, Tiezhu Yang wrote: In the current samples/bpf/README.rst, the url of llvm and clang git may be out of date, they are unable to access: $ git clone http://llvm.org/git/llvm.git Cloning into 'llvm'... fatal: unable to access 'http://llvm.org/git/llvm.git/ ': Maximum (20) r

Re: [PATCH bpf 1/2] samples/bpf: Set flag __SANE_USERSPACE_TYPES__ for MIPS to fix build warnings

2021-01-18 Thread Yonghong Song
On 1/17/21 7:22 PM, Tiezhu Yang wrote: On 01/14/2021 01:12 AM, Yonghong Song wrote: On 1/13/21 2:57 AM, Tiezhu Yang wrote: MIPS needs __SANE_USERSPACE_TYPES__ before to select 'int-ll64.h' in arch/mips/include/uapi/asm/types.h and avoid compile warnings when printing __u64

Re: [PATCH bpf] samples/bpf: Update README.rst and Makefile for manually compiling LLVM and clang

2021-01-18 Thread Yonghong Song
ate the related comment in Makefile. [1] https://clang.llvm.org/get_started.html Signed-off-by: Tiezhu Yang Ack with minor nits in the above. Also, this is a documentation update. I think it is okay to target the patch to bpf-next instead of bpf. Acked-by: Yonghong Song

Re: [PATCH v3 bpf-next 2/2] selftests: bpf: Add a new test for bare tracepoints

2021-01-19 Thread Yonghong Song
On 1/19/21 4:22 AM, Qais Yousef wrote: Reuse module_attach infrastructure to add a new bare tracepoint to check we can attach to it as a raw tracepoint. Signed-off-by: Qais Yousef Acked-by: Yonghong Song

Re: [PATCH bpf-next v2] samples/bpf: Update README.rst and Makefile for manually compiling LLVM and clang

2021-01-19 Thread Yonghong Song
ep consistent. I verified the procedure and it is proved to be feasible, so we should update README.rst to reflect the reality. At the same time, update the related comment in Makefile. [1] https://clang.llvm.org/get_started.html Signed-off-by: Tiezhu Yang Acked-by: Yonghong Song --- v2

Re: [PATCH] tools/bpf: Remove unnecessary parameter in bpf_object__probe_loading

2021-01-08 Thread Yonghong Song
On 1/7/21 6:08 PM, 彭浩(Richard) wrote: struct bpf_object *obj is not used in bpf_object__probe_loading, so we can remove it. Signed-off-by: Peng Hao Acked-by: Yonghong Song

Re: [PATCH 2/2] tools/bpftool: Add -Wall when building BPF programs

2021-01-13 Thread Yonghong Song
On 1/13/21 2:36 PM, Ian Rogers wrote: No additional warnings are generated by enabling this, but having it enabled will help avoid regressions. Signed-off-by: Ian Rogers Acked-by: Yonghong Song

Re: [PATCH bpf-next 2/3] bpf: Add size arg to build_id_parse function

2021-01-14 Thread Yonghong Song
On 1/14/21 5:40 AM, Jiri Olsa wrote: It's possible to have other build id types (other than default SHA1). Currently there's also ld support for MD5 build id. Currently, bpf build_id based stackmap does not returns the size of the build_id. Did you see an issue here? I guess user space can c

Re: [PATCH bpf-next 2/3] bpf: Add size arg to build_id_parse function

2021-01-14 Thread Yonghong Song
On 1/14/21 12:01 PM, Jiri Olsa wrote: On Thu, Jan 14, 2021 at 10:56:33AM -0800, Yonghong Song wrote: On 1/14/21 5:40 AM, Jiri Olsa wrote: It's possible to have other build id types (other than default SHA1). Currently there's also ld support for MD5 build id. Currently, bp

Re: [PATCH bpf-next 2/3] bpf: Add size arg to build_id_parse function

2021-01-14 Thread Yonghong Song
On 1/14/21 2:02 PM, Jiri Olsa wrote: On Thu, Jan 14, 2021 at 01:05:33PM -0800, Yonghong Song wrote: On 1/14/21 12:01 PM, Jiri Olsa wrote: On Thu, Jan 14, 2021 at 10:56:33AM -0800, Yonghong Song wrote: On 1/14/21 5:40 AM, Jiri Olsa wrote: It's possible to have other build id

Re: [PATCH v2] btf: support ints larger than 128 bits

2020-12-30 Thread Yonghong Song
_ExtInt extension enabled in clang, which is under review. Link: https://clang.llvm.org/docs/LanguageExtensions.html#extended-integer-types Link: https://reviews.llvm.org/D93103 Signed-off-by: Sean Young --- changes since v2: - added tests as suggested by Yonghong Song - added kernel pretty-printer

  1   2   3   4   >