svn commit: r367813 - head/lib/libutil

Jessica Clarke jrtc27 at freebsd.org
Wed Nov 18 21:15:39 UTC 2020


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?

Jess

> +		if (tmppath[0] != '\0' &&
> +		    (volatile const char*)localbase == NULL)
> +			localbase = tmppath;
> +		else
> +			free((void*)tmppath);
> +		return (localbase);
> +	}
> +	return (_PATH_LOCALBASE);
> +}



More information about the svn-src-head mailing list