Re: [PATCH v7 bpf-next 2/4] bpf: Add bpf_copy_from_user_task() helper

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

 



On Mon, Jan 24, 2022 at 2:18 PM Andrii Nakryiko
<andrii.nakryiko@xxxxxxxxx> wrote:
>
> On Mon, Jan 24, 2022 at 10:54 AM Kenny Yu <kennyyu@xxxxxx> wrote:
> >
> > This adds a helper for bpf programs to read the memory of other
> > tasks.
> >
> > As an example use case at Meta, we are using a bpf task iterator program
> > and this new helper to print C++ async stack traces for all threads of
> > a given process.
> >
> > Signed-off-by: Kenny Yu <kennyyu@xxxxxx>
> > ---
>
> LGTM.
>
> Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
>
> >  include/linux/bpf.h            |  1 +
> >  include/uapi/linux/bpf.h       | 11 +++++++++++
> >  kernel/bpf/helpers.c           | 34 ++++++++++++++++++++++++++++++++++
> >  kernel/trace/bpf_trace.c       |  2 ++
> >  tools/include/uapi/linux/bpf.h | 11 +++++++++++
> >  5 files changed, 59 insertions(+)
> >
>
> [...]
>
> > +       ret = access_process_vm(tsk, (unsigned long)user_ptr, dst, size, 0);
> > +       if (ret == size)
> > +               return 0;
> > +
> > +       memset(dst, 0, size);
> > +       /* Return -EFAULT for partial read */
> > +       return (ret < 0) ? ret : -EFAULT;
>
> nit: unnecessary ()

I fixed it while applying.
Also added a few unlikely().

Thanks everyone!



[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