Re: [PATCH bpf-next v2 8/9] bpf: Add MEM_RDONLY for helper args that are pointers to rdonly mem.

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

 



On Sat, Dec 18, 2021 at 1:49 PM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> On Thu, Dec 16, 2021 at 4:32 PM Hao Luo <haoluo@xxxxxxxxxx> wrote:
> >
> > Some helper functions may modify its arguments, for example,
> > bpf_d_path, bpf_get_stack etc. Previously, their argument types
> > were marked as ARG_PTR_TO_MEM, which is compatible with read-only
> > mem types, such as PTR_TO_RDONLY_BUF. Therefore it's legitimate
> > to modify a read-only memory by passing it into one of such helper
> > functions.
>
> I've added ", but technically incorrect" to the above sentence.
> Otherwise it sounds like it was an ok thing to do.
> I've considered adding a set of Fixes tag, but there would be too many
> and it's a laborious task to look through all such helpers just
> to beautify the commit log. This patch set isn't going to
> be backported anyway due to complexity.
>
> Please add a test to make sure that bpf_d_path on rdonly buf
> is rejected.
>

Done. Just sent out a selftest patch for that.

> Thank you very much for doing this work.
> It's a great improvement to the verifier type handling.
>

No problem. I'm really glad to help there. :)

> There is a concern that generality of flags may cause
> a regression, but no amount of code review will reveal that.
> Please watch out for strange verifier issues.

Sure thing.



[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