Re: [PATCH 1/1] security: Propagate universal pointer data in bpf hooks

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

 



On Wed, Feb 26, 2025 at 8:00 AM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> On Tue, Feb 25, 2025 at 11:06 PM Song Liu <song@xxxxxxxxxx> wrote:
> >
> > On Tue, Feb 25, 2025 at 4:31 PM Blaise Boscaccy
> > <bboscaccy@xxxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > Certain bpf syscall subcommands are available for usage from both
> > > userspace and the kernel. LSM modules or eBPF gatekeeper programs may
> > > need to take a different course of action depending on whether or not
> > > a BPF syscall originated from the kernel or userspace.
> > >
> > > Additionally, some of the bpf_attr struct fields contain pointers to
> > > arbitrary memory. Currently the functionality to determine whether or
> > > not a pointer refers to kernel memory or userspace memory is exposed
> > > to the bpf verifier, but that information is missing from various LSM
> > > hooks.
> > >
> > > Here we augment the LSM hooks to provide this data, by simply passing
> > > the corresponding universal pointer in any hook that contains already
> > > contains a bpf_attr struct that corresponds to a subcommand that may
> > > be called from the kernel.
> >
> > I think this information is useful for LSM hooks.
> >
> > Question: Do we need a full bpfptr_t for these hooks, or just a boolean
> > "is_kernel or not"?
>
> +1
> Just passing the bool should do.
> Passing uattr is a footgun. Last thing we need is to open up TOCTOU concerns.

Shall we also replace uattr with bool is_kernel in verifier.c? It appears to be
a good cleanup.

Thanks,
Song





[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