From owner-svn-src-head@freebsd.org Wed Nov 18 21:15:39 2020 Return-Path: Delivered-To: svn-src-head@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 167E447278C for ; Wed, 18 Nov 2020 21:15:39 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 4CbwZf74m1z4gPr for ; Wed, 18 Nov 2020 21:15:38 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f42.google.com with SMTP id 23so4934903wmg.1 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=ftXlJIKIXNMY25JaDrXWN5XUYNQrk0uBEc+MgYlZE3MFFdBaZx/zGKNCJxiTdK0XIH /VCGRBIKI/r8vVffcjwvFD5TYGxm7DdWW3bN0vxB/KdCORWydobNnLq2LOlGihz6Iq09 ve6SwfkPf3m03ku3BZOgIJGP6Mco4JEyG7W874/58l61X3ZcpljlL63CfQy1o1Deoxh2 7kI61xazkqvsW592LX4KiK30JgS8ihv4BICuI6kLmV03V1Jeequ8D+1sqs9dGqQxe1zw 4r2jYWJwcKuM8IaiwQ5WEBscDnmlUlJIuz/KrKgyJqnztlRSYEmM5x+YXgFkEnPuencP lk0Q== X-Gm-Message-State: AOAM532HKnI7L2Smn9uTgQbJ7gA/X0Xn1JlSk1KhT29mLUbcrD8Rv0hv qsm6VGPrlDudQB0UyDXQkKYTgg== 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: 4CbwZf74m1z4gPr 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-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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); > +}