Skip to content

bpf: Expose a bpf_sock_from_file helper to tracing programs #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

kernel-patches-bot
Copy link

Pull request for series with
subject: bpf: Expose a bpf_sock_from_file helper to tracing programs
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=383081

@kernel-patches-bot
Copy link
Author

Master branch: 9602182
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=383081
version: 1

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/netdevbpf/list/?series=383081
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am -3
  stdout: 'Applying: bpf: Expose a bpf_sock_from_file helper to tracing programs
Using index info to reconstruct a base tree...
M	include/uapi/linux/bpf.h
M	kernel/trace/bpf_trace.c
M	scripts/bpf_helpers_doc.py
M	tools/include/uapi/linux/bpf.h
Falling back to patching base and 3-way merge...
Auto-merging tools/include/uapi/linux/bpf.h
CONFLICT (content): Merge conflict in tools/include/uapi/linux/bpf.h
Auto-merging scripts/bpf_helpers_doc.py
Auto-merging kernel/trace/bpf_trace.c
Auto-merging include/uapi/linux/bpf.h
CONFLICT (content): Merge conflict in include/uapi/linux/bpf.h
Patch failed at 0001 bpf: Expose a bpf_sock_from_file helper to tracing programs
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".'
  stderr: 'error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch'

conflict:

diff --cc include/uapi/linux/bpf.h
index e6ceac3f7d62,6c96bf9c1f94..000000000000
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@@ -3742,6 -3743,56 +3742,59 @@@ union bpf_attr 
   * 	Return
   * 		The helper returns **TC_ACT_REDIRECT** on success or
   * 		**TC_ACT_SHOT** on error.
++<<<<<<< HEAD
++=======
+  *
+  * void *bpf_task_storage_get(struct bpf_map *map, struct task_struct *task, void *value, u64 flags)
+  *	Description
+  *		Get a bpf_local_storage from the *task*.
+  *
+  *		Logically, it could be thought of as getting the value from
+  *		a *map* with *task* as the **key**.  From this
+  *		perspective,  the usage is not much different from
+  *		**bpf_map_lookup_elem**\ (*map*, **&**\ *task*) except this
+  *		helper enforces the key must be an task_struct and the map must also
+  *		be a **BPF_MAP_TYPE_TASK_STORAGE**.
+  *
+  *		Underneath, the value is stored locally at *task* instead of
+  *		the *map*.  The *map* is used as the bpf-local-storage
+  *		"type". The bpf-local-storage "type" (i.e. the *map*) is
+  *		searched against all bpf_local_storage residing at *task*.
+  *
+  *		An optional *flags* (**BPF_LOCAL_STORAGE_GET_F_CREATE**) can be
+  *		used such that a new bpf_local_storage will be
+  *		created if one does not exist.  *value* can be used
+  *		together with **BPF_LOCAL_STORAGE_GET_F_CREATE** to specify
+  *		the initial value of a bpf_local_storage.  If *value* is
+  *		**NULL**, the new bpf_local_storage will be zero initialized.
+  *	Return
+  *		A bpf_local_storage pointer is returned on success.
+  *
+  *		**NULL** if not found or there was an error in adding
+  *		a new bpf_local_storage.
+  *
+  * long bpf_task_storage_delete(struct bpf_map *map, struct task_struct *task)
+  *	Description
+  *		Delete a bpf_local_storage from a *task*.
+  *	Return
+  *		0 on success.
+  *
+  *		**-ENOENT** if the bpf_local_storage cannot be found.
+  *
+  * struct task_struct *bpf_get_current_task_btf(void)
+  *	Description
+  *		Return a BTF pointer to the "current" task.
+  *		This pointer can also be used in helpers that accept an
+  *		*ARG_PTR_TO_BTF_ID* of type *task_struct*.
+  *	Return
+  *		Pointer to the current task.
+  *
+  * struct socket *bpf_sock_from_file(struct file *file)
+  *	Description
+  *		If the given file contains a socket, returns the associated socket.
+  *	Return
+  *		A pointer to a struct socket on success, or NULL on failure.
++>>>>>>> bpf: Expose a bpf_sock_from_file helper to tracing programs
   */
  #define __BPF_FUNC_MAPPER(FN)		\
  	FN(unspec),			\
@@@ -3900,6 -3951,10 +3953,13 @@@
  	FN(bpf_per_cpu_ptr),            \
  	FN(bpf_this_cpu_ptr),		\
  	FN(redirect_peer),		\
++<<<<<<< HEAD
++=======
+ 	FN(task_storage_get),		\
+ 	FN(task_storage_delete),	\
+ 	FN(get_current_task_btf),	\
+ 	FN(sock_from_file),		\
++>>>>>>> bpf: Expose a bpf_sock_from_file helper to tracing programs
  	/* */
  
  /* integer value in 'imm' field of BPF_CALL instruction selects which helper
diff --cc tools/include/uapi/linux/bpf.h
index e6ceac3f7d62,6c96bf9c1f94..000000000000
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@@ -3742,6 -3743,56 +3742,59 @@@ union bpf_attr 
   * 	Return
   * 		The helper returns **TC_ACT_REDIRECT** on success or
   * 		**TC_ACT_SHOT** on error.
++<<<<<<< HEAD
++=======
+  *
+  * void *bpf_task_storage_get(struct bpf_map *map, struct task_struct *task, void *value, u64 flags)
+  *	Description
+  *		Get a bpf_local_storage from the *task*.
+  *
+  *		Logically, it could be thought of as getting the value from
+  *		a *map* with *task* as the **key**.  From this
+  *		perspective,  the usage is not much different from
+  *		**bpf_map_lookup_elem**\ (*map*, **&**\ *task*) except this
+  *		helper enforces the key must be an task_struct and the map must also
+  *		be a **BPF_MAP_TYPE_TASK_STORAGE**.
+  *
+  *		Underneath, the value is stored locally at *task* instead of
+  *		the *map*.  The *map* is used as the bpf-local-storage
+  *		"type". The bpf-local-storage "type" (i.e. the *map*) is
+  *		searched against all bpf_local_storage residing at *task*.
+  *
+  *		An optional *flags* (**BPF_LOCAL_STORAGE_GET_F_CREATE**) can be
+  *		used such that a new bpf_local_storage will be
+  *		created if one does not exist.  *value* can be used
+  *		together with **BPF_LOCAL_STORAGE_GET_F_CREATE** to specify
+  *		the initial value of a bpf_local_storage.  If *value* is
+  *		**NULL**, the new bpf_local_storage will be zero initialized.
+  *	Return
+  *		A bpf_local_storage pointer is returned on success.
+  *
+  *		**NULL** if not found or there was an error in adding
+  *		a new bpf_local_storage.
+  *
+  * long bpf_task_storage_delete(struct bpf_map *map, struct task_struct *task)
+  *	Description
+  *		Delete a bpf_local_storage from a *task*.
+  *	Return
+  *		0 on success.
+  *
+  *		**-ENOENT** if the bpf_local_storage cannot be found.
+  *
+  * struct task_struct *bpf_get_current_task_btf(void)
+  *	Description
+  *		Return a BTF pointer to the "current" task.
+  *		This pointer can also be used in helpers that accept an
+  *		*ARG_PTR_TO_BTF_ID* of type *task_struct*.
+  *	Return
+  *		Pointer to the current task.
+  *
+  * struct socket *bpf_sock_from_file(struct file *file)
+  *	Description
+  *		If the given file contains a socket, returns the associated socket.
+  *	Return
+  *		A pointer to a struct socket on success, or NULL on failure.
++>>>>>>> bpf: Expose a bpf_sock_from_file helper to tracing programs
   */
  #define __BPF_FUNC_MAPPER(FN)		\
  	FN(unspec),			\
@@@ -3900,6 -3951,10 +3953,13 @@@
  	FN(bpf_per_cpu_ptr),            \
  	FN(bpf_this_cpu_ptr),		\
  	FN(redirect_peer),		\
++<<<<<<< HEAD
++=======
+ 	FN(task_storage_get),		\
+ 	FN(task_storage_delete),	\
+ 	FN(get_current_task_btf),	\
+ 	FN(sock_from_file),		\
++>>>>>>> bpf: Expose a bpf_sock_from_file helper to tracing programs
  	/* */
  
  /* integer value in 'imm' field of BPF_CALL instruction selects which helper

@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=383081 expired. Closing PR.

@kernel-patches-bot kernel-patches-bot deleted the series/383081=>bpf branch November 16, 2020 17:36
kernel-patches-daemon-bpf bot pushed a commit that referenced this pull request Jul 8, 2024
Add a test case which replaces an active ingress qdisc while keeping the
miniq in-tact during the transition period to the new clsact qdisc.

  # ./vmtest.sh -- ./test_progs -t tc_link
  [...]
  ./test_progs -t tc_link
  [    3.412871] bpf_testmod: loading out-of-tree module taints kernel.
  [    3.413343] bpf_testmod: module verification failed: signature and/or required key missing - tainting kernel
  #332     tc_links_after:OK
  #333     tc_links_append:OK
  #334     tc_links_basic:OK
  #335     tc_links_before:OK
  #336     tc_links_chain_classic:OK
  #337     tc_links_chain_mixed:OK
  #338     tc_links_dev_chain0:OK
  #339     tc_links_dev_cleanup:OK
  #340     tc_links_dev_mixed:OK
  #341     tc_links_ingress:OK
  #342     tc_links_invalid:OK
  #343     tc_links_prepend:OK
  #344     tc_links_replace:OK
  #345     tc_links_revision:OK
  Summary: 14/0 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Martin KaFai Lau <martin.lau@kernel.org>
kernel-patches-daemon-bpf bot pushed a commit that referenced this pull request Jul 8, 2024
Add a test case which replaces an active ingress qdisc while keeping the
miniq in-tact during the transition period to the new clsact qdisc.

  # ./vmtest.sh -- ./test_progs -t tc_link
  [...]
  ./test_progs -t tc_link
  [    3.412871] bpf_testmod: loading out-of-tree module taints kernel.
  [    3.413343] bpf_testmod: module verification failed: signature and/or required key missing - tainting kernel
  #332     tc_links_after:OK
  #333     tc_links_append:OK
  #334     tc_links_basic:OK
  #335     tc_links_before:OK
  #336     tc_links_chain_classic:OK
  #337     tc_links_chain_mixed:OK
  #338     tc_links_dev_chain0:OK
  #339     tc_links_dev_cleanup:OK
  #340     tc_links_dev_mixed:OK
  #341     tc_links_ingress:OK
  #342     tc_links_invalid:OK
  #343     tc_links_prepend:OK
  #344     tc_links_replace:OK
  #345     tc_links_revision:OK
  Summary: 14/0 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Martin KaFai Lau <martin.lau@kernel.org>
kernel-patches-daemon-bpf bot pushed a commit that referenced this pull request Jul 8, 2024
Add a test case which replaces an active ingress qdisc while keeping the
miniq in-tact during the transition period to the new clsact qdisc.

  # ./vmtest.sh -- ./test_progs -t tc_link
  [...]
  ./test_progs -t tc_link
  [    3.412871] bpf_testmod: loading out-of-tree module taints kernel.
  [    3.413343] bpf_testmod: module verification failed: signature and/or required key missing - tainting kernel
  #332     tc_links_after:OK
  #333     tc_links_append:OK
  #334     tc_links_basic:OK
  #335     tc_links_before:OK
  #336     tc_links_chain_classic:OK
  #337     tc_links_chain_mixed:OK
  #338     tc_links_dev_chain0:OK
  #339     tc_links_dev_cleanup:OK
  #340     tc_links_dev_mixed:OK
  #341     tc_links_ingress:OK
  #342     tc_links_invalid:OK
  #343     tc_links_prepend:OK
  #344     tc_links_replace:OK
  #345     tc_links_revision:OK
  Summary: 14/0 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20240708133130.11609-2-daniel@iogearbox.net
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant