Thread (14 messages) 14 messages, 2 authors, 2021-12-20

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

From: Alexei Starovoitov <hidden>
Date: 2021-12-18 21:49:11

On Thu, Dec 16, 2021 at 4:32 PM Hao Luo [off-list ref] 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.

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

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help