mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-01 22:29:06 +08:00
bpf: Add bpf_bprm_opts_set helper
The helper allows modification of certain bits on the linux_binprm struct starting with the secureexec bit which can be updated using the BPF_F_BPRM_SECUREEXEC flag. secureexec can be set by the LSM for privilege gaining executions to set the AT_SECURE auxv for glibc. When set, the dynamic linker disables the use of certain environment variables (like LD_PRELOAD). Signed-off-by: KP Singh <kpsingh@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20201117232929.2156341-1-kpsingh@chromium.org
This commit is contained in:
committed by
Andrii Nakryiko
parent
de2edae80d
commit
6969a44914
@@ -3787,6 +3787,16 @@ union bpf_attr {
|
|||||||
* *ARG_PTR_TO_BTF_ID* of type *task_struct*.
|
* *ARG_PTR_TO_BTF_ID* of type *task_struct*.
|
||||||
* Return
|
* Return
|
||||||
* Pointer to the current task.
|
* Pointer to the current task.
|
||||||
|
*
|
||||||
|
* long bpf_bprm_opts_set(struct linux_binprm *bprm, u64 flags)
|
||||||
|
* Description
|
||||||
|
* Set or clear certain options on *bprm*:
|
||||||
|
*
|
||||||
|
* **BPF_F_BPRM_SECUREEXEC** Set the secureexec bit
|
||||||
|
* which sets the **AT_SECURE** auxv for glibc. The bit
|
||||||
|
* is cleared if the flag is not specified.
|
||||||
|
* Return
|
||||||
|
* **-EINVAL** if invalid *flags* are passed, zero otherwise.
|
||||||
*/
|
*/
|
||||||
#define __BPF_FUNC_MAPPER(FN) \
|
#define __BPF_FUNC_MAPPER(FN) \
|
||||||
FN(unspec), \
|
FN(unspec), \
|
||||||
@@ -3948,6 +3958,7 @@ union bpf_attr {
|
|||||||
FN(task_storage_get), \
|
FN(task_storage_get), \
|
||||||
FN(task_storage_delete), \
|
FN(task_storage_delete), \
|
||||||
FN(get_current_task_btf), \
|
FN(get_current_task_btf), \
|
||||||
|
FN(bprm_opts_set), \
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
|
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
|
||||||
@@ -4119,6 +4130,11 @@ enum bpf_lwt_encap_mode {
|
|||||||
BPF_LWT_ENCAP_IP,
|
BPF_LWT_ENCAP_IP,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Flags for bpf_bprm_opts_set helper */
|
||||||
|
enum {
|
||||||
|
BPF_F_BPRM_SECUREEXEC = (1ULL << 0),
|
||||||
|
};
|
||||||
|
|
||||||
#define __bpf_md_ptr(type, name) \
|
#define __bpf_md_ptr(type, name) \
|
||||||
union { \
|
union { \
|
||||||
type name; \
|
type name; \
|
||||||
|
|||||||
Reference in New Issue
Block a user