Re: [PATCH v2 1/3] exec: Dynamically allocate memory to store task's full name
From: Bhupesh Sharma
Date: Wed Apr 09 2025 - 07:31:33 EST
Hi Kees,
Sorry for the delay - I was out for a couple of days.
On 4/4/25 10:54 PM, Kees Cook wrote:
On Fri, Apr 04, 2025 at 12:18:56PM +0530, Bhupesh Sharma wrote:
In another review for this series, Yafang mentioned the following cleanup +
approach suggested by Linus (see [0]).
Also I have summarized my understanding on the basis of the suggestions
Linus shared and the accompanying background threads (please see [1]).
Kindly share your views on the same, so that I can change the implementation
in v3 series accordingly.
In thinking about this a little more I think we can't universally change
all the APIs to use the new full_name since it is a pointer, which may
be getting changed out from under readers if a setter changes it. So
this may need some careful redesign, likely with RCU. hmm.
Thinking more about this, Linus mentioned in [0]:
'Since user space can randomly change their names anyway, using locking
was always wrong for readers (for writers it probably does make sense
to have some lock'
So, if we go with the union approach, probably we can do with just a writer-lock, whereas if we go with a task->full_name like pointer one, we would probably need a rcu lock.
Please let me know your comments.
[0]. https://lore.kernel.org/all/CAHk-=wivfrF0_zvf+oj6==Sh=-npJooP8chLPEfaFV0oNYTTBA@xxxxxxxxxxxxxx/