Re: [PATCH 0/2] listns(): validate the reserved spare2 field
From: Bradley Morgan
Date: Sat Nov 28 2026 - 10:49:57 EST
On 28 November 2026 15:44:07 GMT, Bradley Morgan <bradley.morgan@xxxxxxxxx>
wrote:
>On 28 November 2026 14:06:21 GMT, Nikolai Dokutovich
><ndokutovich@xxxxxxxxx> wrote:
>>copy_ns_id_req() rejects a non-zero @spare but not @spare2, although
>>struct ns_id_req documents both as reserved. Validate @spare2 the same
>>way, and extend the error-case selftest to cover it instead of only
>>@spare.
>>
>>Nikolai Dokutovich (2):
>> nstree: reject a non-zero spare2 in the listns() request
>> selftests/namespaces: check that listns() rejects a non-zero spare2
>
>Had a nice read through, thanks for the tests, for the whole series, let's
>put,
>
>Reviewed-by: Bradley Morgan <bradley.morgan@xxxxxxxxx>
>
>Also, a nice question, since I tend to be a bit ^Winsane^W
>
>Is this bug a edge case? Most bugs found nowadays in the kernel are edge
>cases, but they would still need to be merged, because again, it's still a
>case that can be reached.
>
>My question to you, is could this bug be actually reached? Like, would a
>future caller set spare2 as non zero? would the driver maintainer for
>example be silly enough to set non zero spare2, probably knowing the
>consequences (if they understood the code), well, if they didn't, it'd be
>their problem, no?
Aw I was wrong, sorry, the function is called thru tests and as a syscall.
Apologies for the wrongness :(
R-B stands.
>
>I had a look at some callers, mostly selftests, and they all patch up this
>correctly, so this wouldn't be reachable RIGHT now. I added my tag because
>we will have to account for the future callers silliness (adding non zero
>spare2)...
>
>
>
>>
>> kernel/nstree.c | 2 +-
>> tools/testing/selftests/namespaces/listns_test.c | 11 +++++++++++
>> 2 files changed, 12 insertions(+), 1 deletion(-)
>>
>>
>
>--- Thanks!
--- Thanks!