Re: [RFC PATCH bpf-next 0/7] bpf: Support struct value argument for trampoline base progs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2022-07-26 at 10:11 -0700, Yonghong Song wrote:
> Currently struct arguments are not supported for trampoline based
> progs.
> One of major reason is that struct argument may pass by value which
> may
> use more than one registers. This breaks trampoline progs where
> each argument is assumed to take one register. bcc community reported
> the
> issue ([1]) where struct argument is not supported for fentry
> program.
>   typedef struct {
>         uid_t val;
>   } kuid_t;
>   typedef struct {
>         gid_t val;
>   } kgid_t;
>   int security_path_chown(struct path *path, kuid_t uid, kgid_t gid);
> Inside Meta, we also have a use case to attach to tcp_setsockopt()
>   typedef struct {
>         union {
>                 void            *kernel;
>                 void __user     *user;
>         };
>         bool            is_kernel : 1;
>   } sockptr_t;
>   int tcp_setsockopt(struct sock *sk, int level, int optname,
>                      sockptr_t optval, unsigned int optlen);
> 
> This patch added struct value support for bpf tracing programs which
> uses trampoline. struct argument size needs to be 16 or less so
> it can fit in one or two registers. Based on analysis on llvm and
> experiments, atruct argument size greater than 16 will be passed
> as pointer to the struct.

Is it possible to force llvm to always pass a pointer to a struct over
8 bytes (the size of single register) for the BPF traget?





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux