svn commit: r367813 - head/lib/libutil
Jessica Clarke
jrtc27 at freebsd.org
Wed Nov 18 21:27:17 UTC 2020
On 18 Nov 2020, at 21:15, Jessica Clarke <jrtc27 at freebsd.org> wrote:
>
> On 18 Nov 2020, at 19:44, Stefan Eßer <se at freebsd.org> wrote:
>> + /*
>> + * Check for some other thread already having
>> + * set localbase - this should use atomic ops.
>> + * The amount of memory allocated above may leak,
>> + * if a parallel update in another thread is not
>> + * detected and the non-NULL pointer is overwritten.
>> + */
>
> Why was this committed with a known racy/leaky implementation?
>
> What happens if I set the value with a sysctl and call this?
Notably, you go to all this trouble to have a localbase variable that
gets set, but you never actually use it properly as a cache since you
do the full lookup and only then realise that you already had a
(possibly stale) value cached.
Jess
More information about the svn-src-head
mailing list