On 27/10/2023 15:09, Zachary Leaf wrote: [...]
For the copy_*_to functions in patch 8, I think it remains readable, since there's no extra zeroing.
Isn't there? We still do memset(0) on the info structs?
However I wouldn't call the variable target_attr there, as it suggests it is a destination. Maybe source_attr instead.
Make sense. I'll probably go for src_attr and the copy_*_from might be better as dst_info as well (rather than target).
Thinking some more after looking at patch 10: that suggestion removes the need for both copy_from_bpfptr_with_ptr and bpf_copy_from_user_with_ptr I believe. Maybe we're better off using the same approach for copy_*_to, up to you.
I think this way works better than above since we avoid bpf_copy_from_user_with_ptr() and we don't have the added check_attr() duplication in there too.
I probably wouldn't be against leaving copy_bpf_attr_from_user() as is, and only amending the ones from patch 8.
^ ignore all this and sorry for the noise. I had misunderstood what you were suggesting.
I have ended up doing as you suggest with: - copy_bpf_attr_from_user - copy_bpf_{btf,prog,link}_from_user
copy_bpf_{btf,prog,link}_to_user remains the same, although s/target_info/src_info.
I'm not certain copy_bpf_attr_from_user() is that much of an improvement once we add in the check_attr() etc - see what you think.
I'll send v4 early next week after a final check over.
Thanks, Zach
Thanks, Zach
Kevin
linux-morello mailing list -- linux-morello@op-lists.linaro.org To unsubscribe send an email to linux-morello-leave@op-lists.linaro.org