From owner-svn-src-all@freebsd.org Wed Nov 18 21:15:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E4EE472805 for ; Wed, 18 Nov 2020 21:15:39 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CbwZg0Cg0z4gPs for ; Wed, 18 Nov 2020 21:15:38 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f49.google.com with SMTP id p22so4406700wmg.3 for ; Wed, 18 Nov 2020 13:15:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=7q6Z5kiPC65Z+W7vidC70pjbWNC3E/ifFqXsTjHe8+A=; b=Jpe6JFkcx3TqM7OvVl4cVb9NyP/iJSh5p3v59pATYDRIRjTIi8iFfY48VkCBNGq8RH hXf/7sodpFx1+79hyN+8O0UQCMe6GccekU9Wn0rcnGD+yfCilumMdO61UMz8xvBdGYOg ntPVwqaMiJuZpc0jfuBbA7vmLTHHnx3O0tinWA6Yhd7rW4zYdqiGbKj3rqfYyEhPlqim lAkTU463NfYg8yo+BtDJOATpWRE3qTNu+VB9POugr6gTBXMjpXmBwtCmxTA414Ok8E9x uT5f3xMFQtb07lfp8OSJM69UZj0d1vLFQ722fDD6X4rVL0q06aK6QF67ThdA85EJzv1W Hwqw== X-Gm-Message-State: AOAM532guBiP4OZ9G4+y0y+Z266SpzM05UQLHhovPIskYjtKfFU+w28V dr1jv2AUdeTpvYUQSxD04fZVKA== X-Google-Smtp-Source: ABdhPJyRxPI9N2bkEyj5lppWIJlFnryiu5swx8W05zXBQt0Qy8KjhsdOZw/N8RV96ABmI3O9uYCVKg== X-Received: by 2002:a1c:5446:: with SMTP id p6mr954748wmi.167.1605734137286; Wed, 18 Nov 2020 13:15:37 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id a14sm5471600wmj.40.2020.11.18.13.15.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Nov 2020 13:15:36 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: svn commit: r367813 - head/lib/libutil From: Jessica Clarke In-Reply-To: <202011181944.0AIJiUU3003699@repo.freebsd.org> Date: Wed, 18 Nov 2020 21:15:35 +0000 Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <25465269-5497-4981-A1E4-CC1FFAB68CF4@freebsd.org> References: <202011181944.0AIJiUU3003699@repo.freebsd.org> To: =?utf-8?Q?Stefan_E=C3=9Fer?= X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CbwZg0Cg0z4gPs X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Nov 2020 21:15:39 -0000 On 18 Nov 2020, at 19:44, Stefan E=C3=9Fer 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); > +}