github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/trace/capabilities/tracer/bpf/capable.h (about)

     1  // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
     2  //
     3  // Copyright 2022 Sony Group Corporation
     4  
     5  #ifndef __CAPABLE_H
     6  #define __CAPABLE_H
     7  
     8  #define TASK_COMM_LEN 16
     9  
    10  #ifndef BIT
    11  #define BIT(nr) (1UL << (nr))
    12  #endif /* !BIT */
    13  
    14  /*
    15   * Taken from:
    16   * https://github.com/torvalds/linux/blob/78b421b6a7c6/include/linux/security.h#L67-L69
    17   */
    18  #ifndef CAP_OPT_NOAUDIT
    19  #define CAP_OPT_NOAUDIT BIT(1)
    20  #endif /* !CAP_OPT_NOAUDIT */
    21  
    22  #ifndef CAP_OPT_INSETID
    23  #define CAP_OPT_INSETID BIT(2)
    24  #endif /* !CAP_OPT_INSETID */
    25  
    26  struct cap_event {
    27  	__u64 mntnsid;
    28  	__u64 current_userns;
    29  	__u64 target_userns;
    30  	__u64 cap_effective;
    31  	__u64 timestamp;
    32  	__u32 pid;
    33  	int cap;
    34  	__u32 tgid;
    35  	__u32 uid;
    36  	__u32 gid;
    37  	int ret;
    38  	int audit;
    39  	int insetid;
    40  	__u64 syscall;
    41  	__u8 task[TASK_COMM_LEN];
    42  };
    43  
    44  #endif /* __CAPABLE_H */