<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/trace/bpf_trace.c, branch v6.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-12-19T16:23:03Z</updated>
<entry>
<title>Revert BPF token-related functionality</title>
<updated>2023-12-19T16:23:03Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2023-12-19T15:37:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d17aff807f845cf93926c28705216639c7279110'/>
<id>urn:sha1:d17aff807f845cf93926c28705216639c7279110</id>
<content type='text'>
This patch includes the following revert (one  conflicting BPF FS
patch and three token patch sets, represented by merge commits):
  - revert 0f5d5454c723 "Merge branch 'bpf-fs-mount-options-parsing-follow-ups'";
  - revert 750e785796bb "bpf: Support uid and gid when mounting bpffs";
  - revert 733763285acf "Merge branch 'bpf-token-support-in-libbpf-s-bpf-object'";
  - revert c35919dcce28 "Merge branch 'bpf-token-and-bpf-fs-based-delegation'".

Link: https://lore.kernel.org/bpf/CAHk-=wg7JuFYwGy=GOMbRCtOL+jwSQsdUaBsRWkDVYbxipbM5A@mail.gmail.com
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Fail uprobe multi link with negative offset</title>
<updated>2023-12-18T17:51:30Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2023-12-17T21:55:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3983c00281d96af2ba611254d679107b5c390627'/>
<id>urn:sha1:3983c00281d96af2ba611254d679107b5c390627</id>
<content type='text'>
Currently the __uprobe_register will return 0 (success) when called with
negative offset. The reason is that the call to register_for_each_vma and
then build_map_info won't return error for negative offset. They just won't
do anything - no matching vma is found so there's no registered breakpoint
for the uprobe.

I don't think we can change the behaviour of __uprobe_register and fail
for negative uprobe offset, because apps might depend on that already.

But I think we can still make the change and check for it on bpf multi
link syscall level.

Also moving the __get_user call and check for the offsets to the top of
loop, to fail early without extra __get_user calls for ref_ctr_offset
and cookie arrays.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20231217215538.3361991-2-jolsa@kernel.org
</content>
</entry>
<entry>
<title>bpf: Limit the number of kprobes when attaching program to multiple kprobes</title>
<updated>2023-12-15T21:54:55Z</updated>
<author>
<name>Hou Tao</name>
<email>houtao1@huawei.com</email>
</author>
<published>2023-12-15T10:07:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d6d1e6c17cab2dcb7b8530c599f00e7de906d380'/>
<id>urn:sha1:d6d1e6c17cab2dcb7b8530c599f00e7de906d380</id>
<content type='text'>
An abnormally big cnt may also be assigned to kprobe_multi.cnt when
attaching multiple kprobes. It will trigger the following warning in
kvmalloc_node():

	if (unlikely(size &gt; INT_MAX)) {
	    WARN_ON_ONCE(!(flags &amp; __GFP_NOWARN));
	    return NULL;
	}

Fix the warning by limiting the maximal number of kprobes in
bpf_kprobe_multi_link_attach(). If the number of kprobes is greater than
MAX_KPROBE_MULTI_CNT, the attachment will fail and return -E2BIG.

Fixes: 0dcac2725406 ("bpf: Add multi kprobe link")
Signed-off-by: Hou Tao &lt;houtao1@huawei.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20231215100708.2265609-3-houtao@huaweicloud.com
</content>
</entry>
<entry>
<title>bpf: Limit the number of uprobes when attaching program to multiple uprobes</title>
<updated>2023-12-15T21:54:46Z</updated>
<author>
<name>Hou Tao</name>
<email>houtao1@huawei.com</email>
</author>
<published>2023-12-15T10:07:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8b2efe51ba85ca83460941672afac6fca4199df6'/>
<id>urn:sha1:8b2efe51ba85ca83460941672afac6fca4199df6</id>
<content type='text'>
An abnormally big cnt may be passed to link_create.uprobe_multi.cnt,
and it will trigger the following warning in kvmalloc_node():

	if (unlikely(size &gt; INT_MAX)) {
		WARN_ON_ONCE(!(flags &amp; __GFP_NOWARN));
		return NULL;
	}

Fix the warning by limiting the maximal number of uprobes in
bpf_uprobe_multi_link_attach(). If the number of uprobes is greater than
MAX_UPROBE_MULTI_CNT, the attachment will return -E2BIG.

Fixes: 89ae89f53d20 ("bpf: Add multi uprobe link")
Reported-by: Xingwei Lee &lt;xrivendell7@gmail.com&gt;
Signed-off-by: Hou Tao &lt;houtao1@huawei.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Closes: https://lore.kernel.org/bpf/CABOYnLwwJY=yFAGie59LFsUsBAgHfroVqbzZ5edAXbFE3YiNVA@mail.gmail.com
Link: https://lore.kernel.org/bpf/20231215100708.2265609-2-houtao@huaweicloud.com
</content>
</entry>
<entry>
<title>bpf: take into account BPF token when fetching helper protos</title>
<updated>2023-12-06T18:02:59Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2023-11-30T18:52:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4cbb270e115bc197ff2046aeb54cc951666b16ec'/>
<id>urn:sha1:4cbb270e115bc197ff2046aeb54cc951666b16ec</id>
<content type='text'>
Instead of performing unconditional system-wide bpf_capable() and
perfmon_capable() calls inside bpf_base_func_proto() function (and other
similar ones) to determine eligibility of a given BPF helper for a given
program, use previously recorded BPF token during BPF_PROG_LOAD command
handling to inform the decision.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20231130185229.2688956-8-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Add kfunc bpf_get_file_xattr</title>
<updated>2023-12-02T00:21:03Z</updated>
<author>
<name>Song Liu</name>
<email>song@kernel.org</email>
</author>
<published>2023-11-29T23:44:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ac9c05e0e453cfcab2866f6d28f257590e4f66e5'/>
<id>urn:sha1:ac9c05e0e453cfcab2866f6d28f257590e4f66e5</id>
<content type='text'>
It is common practice for security solutions to store tags/labels in
xattrs. To implement similar functionalities in BPF LSM, add new kfunc
bpf_get_file_xattr().

The first use case of bpf_get_file_xattr() is to implement file
verifications with asymmetric keys. Specificially, security applications
could use fsverity for file hashes and use xattr to store file signatures.
(kfunc for fsverity hash will be added in a separate commit.)

Currently, only xattrs with "user." prefix can be read with kfunc
bpf_get_file_xattr(). As use cases evolve, we may add a dedicated prefix
for bpf_get_file_xattr().

To avoid recursion, bpf_get_file_xattr can be only called from LSM hooks.

Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Acked-by: Christian Brauner &lt;brauner@kernel.org&gt;
Acked-by: KP Singh &lt;kpsingh@kernel.org&gt;
Link: https://lore.kernel.org/r/20231129234417.856536-2-song@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Add link_info support for uprobe multi link</title>
<updated>2023-11-29T05:50:09Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2023-11-25T19:31:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e56fdbfb06e26a7066b070967badef4148528df2'/>
<id>urn:sha1:e56fdbfb06e26a7066b070967badef4148528df2</id>
<content type='text'>
Adding support to get uprobe_link details through bpf_link_info
interface.

Adding new struct uprobe_multi to struct bpf_link_info to carry
the uprobe_multi link details.

The uprobe_multi.count is passed from user space to denote size
of array fields (offsets/ref_ctr_offsets/cookies). The actual
array size is stored back to uprobe_multi.count (allowing user
to find out the actual array size) and array fields are populated
up to the user passed size.

All the non-array fields (path/count/flags/pid) are always set.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
Link: https://lore.kernel.org/bpf/20231125193130.834322-4-jolsa@kernel.org
</content>
</entry>
<entry>
<title>bpf: Store ref_ctr_offsets values in bpf_uprobe array</title>
<updated>2023-11-29T05:50:09Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2023-11-25T19:31:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4930b7f53a298533bc31d7540b6ea8b79a000331'/>
<id>urn:sha1:4930b7f53a298533bc31d7540b6ea8b79a000331</id>
<content type='text'>
We will need to return ref_ctr_offsets values through link_info
interface in following change, so we need to keep them around.

Storing ref_ctr_offsets values directly into bpf_uprobe array.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20231125193130.834322-3-jolsa@kernel.org
</content>
</entry>
<entry>
<title>bpf: Add __bpf_dynptr_data* for in kernel use</title>
<updated>2023-11-10T03:07:38Z</updated>
<author>
<name>Song Liu</name>
<email>song@kernel.org</email>
</author>
<published>2023-11-07T04:57:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=74523c06ae20b83c5508a98af62393ac34913362'/>
<id>urn:sha1:74523c06ae20b83c5508a98af62393ac34913362</id>
<content type='text'>
Different types of bpf dynptr have different internal data storage.
Specifically, SKB and XDP type of dynptr may have non-continuous data.
Therefore, it is not always safe to directly access dynptr-&gt;data.

Add __bpf_dynptr_data and __bpf_dynptr_data_rw to replace direct access to
dynptr-&gt;data.

Update bpf_verify_pkcs7_signature to use __bpf_dynptr_data instead of
dynptr-&gt;data.

Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Vadim Fedorenko &lt;vadim.fedorenko@linux.dev&gt;
Link: https://lore.kernel.org/bpf/20231107045725.2278852-2-song@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Add __bpf_kfunc_{start,end}_defs macros</title>
<updated>2023-11-02T05:33:53Z</updated>
<author>
<name>Dave Marchevsky</name>
<email>davemarchevsky@fb.com</email>
</author>
<published>2023-10-31T21:56:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=391145ba2accc48b596f3d438af1a6255b62a555'/>
<id>urn:sha1:391145ba2accc48b596f3d438af1a6255b62a555</id>
<content type='text'>
BPF kfuncs are meant to be called from BPF programs. Accordingly, most
kfuncs are not called from anywhere in the kernel, which the
-Wmissing-prototypes warning is unhappy about. We've peppered
__diag_ignore_all("-Wmissing-prototypes", ... everywhere kfuncs are
defined in the codebase to suppress this warning.

This patch adds two macros meant to bound one or many kfunc definitions.
All existing kfunc definitions which use these __diag calls to suppress
-Wmissing-prototypes are migrated to use the newly-introduced macros.
A new __diag_ignore_all - for "-Wmissing-declarations" - is added to the
__bpf_kfunc_start_defs macro based on feedback from Andrii on an earlier
version of this patch [0] and another recent mailing list thread [1].

In the future we might need to ignore different warnings or do other
kfunc-specific things. This change will make it easier to make such
modifications for all kfunc defs.

  [0]: https://lore.kernel.org/bpf/CAEf4BzaE5dRWtK6RPLnjTW-MW9sx9K3Fn6uwqCTChK2Dcb1Xig@mail.gmail.com/
  [1]: https://lore.kernel.org/bpf/ZT+2qCc%2FaXep0%2FLf@krava/

Signed-off-by: Dave Marchevsky &lt;davemarchevsky@fb.com&gt;
Suggested-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Cc: Jiri Olsa &lt;olsajiri@gmail.com&gt;
Acked-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Acked-by: David Vernet &lt;void@manifault.com&gt;
Acked-by: Yafang Shao &lt;laoar.shao@gmail.com&gt;
Link: https://lore.kernel.org/r/20231031215625.2343848-1-davemarchevsky@fb.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
</feed>
