Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Nov 2020 21:15:35 +0000
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        =?utf-8?Q?Stefan_E=C3=9Fer?= <se@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head@freebsd.org
Subject:   Re: svn commit: r367813 - head/lib/libutil
Message-ID:  <25465269-5497-4981-A1E4-CC1FFAB68CF4@freebsd.org>
In-Reply-To: <202011181944.0AIJiUU3003699@repo.freebsd.org>
References:  <202011181944.0AIJiUU3003699@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 18 Nov 2020, at 19:44, Stefan E=C3=9Fer <se@freebsd.org> wrote:
> +		/*
> +		 * Check for some other thread already having=20
> +		 * 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] !=3D '\0' &&
> +		    (volatile const char*)localbase =3D=3D NULL)
> +			localbase =3D tmppath;
> +		else
> +			free((void*)tmppath);
> +		return (localbase);
> +	}
> +	return (_PATH_LOCALBASE);
> +}




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?25465269-5497-4981-A1E4-CC1FFAB68CF4>