Re: [bpf PATCH] bpf: do not allow btf_ctx_access with __int128 types

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

 



Andrii Nakryiko wrote:
> On Tue, Jun 23, 2020 at 10:14 AM John Fastabend
> <john.fastabend@xxxxxxxxx> wrote:
> >
> > To ensure btf_ctx_access() is safe the verifier checks that the BTF
> > arg type is an int, enum, or pointer. When the function does the
> > BTF arg lookup it uses the calculation 'arg = off / 8'  using the
> > fact that registers are 8B. This requires that the first arg is
> > in the first reg, the second in the second, and so on. However,
> > for __int128 the arg will consume two registers by default LLVM
> > implementation. So this will cause the arg layout assumed by the
> > 'arg = off / 8' calculation to be incorrect.
> >
> > Because __int128 is uncommon this patch applies the easiest fix and
> > will force int types to be sizeof(u64) or smaller so that they will
> > fit in a single register.
> >
> > Fixes: 9e15db66136a1 ("bpf: Implement accurate raw_tp context access via BTF")
> > Signed-off-by: John Fastabend <john.fastabend@xxxxxxxxx>
> > ---
> 
> "small int" for u64 looks funny, but naming is hard :)
> 
> Acked-by: Andrii Nakryiko <andriin@xxxxxx>
> 

Fixed up the parens and sent a v2 keeping the ACK. I don't have any
better ideas for the name, let me know if you have a preference for
something else.



[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