From owner-svn-src-all@freebsd.org Wed Nov 18 21:27:17 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 1C238472C1A for ; Wed, 18 Nov 2020 21:27:17 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 4Cbwr41zFXz4gkg for ; Wed, 18 Nov 2020 21:27:15 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f46.google.com with SMTP id h21so4062493wmb.2 for ; Wed, 18 Nov 2020 13:27:15 -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=PnfasZAXsgl+ZGBcpSwcsQsBtbgWqlMKDy82wizn38w=; b=VHVlWugPf9KSDqliiMuugHqJtzgz0wM3LTCZtaFQYEiPXk8YS90BxGZ48jJOJ0QCS5 n+trgjFY2KCUy+V/K6A+fE6ltbteVxzMsnVPvzOev0g5arqNpR/oXPqnjp3Moaxp5NZ9 0zXxripaY6DQ4yROnTulNDuyk2SuRsjEGKXK0Zp+KGJeb4OtOxKDjIX1X6rqnfZxUEpC G5VlisZdpZ5ZTSGmp0ao6aGc5+SMmQoVt9Qco7aZDjtk1EsqohdZJjIZriJfogIbILLO rkPOvP1jUxYRzFgz3C8ldAch23C6eIWCv7Q4qN6TqtRe9kaXftlO/Hw5EGdOoqn5GtLz qfHg== X-Gm-Message-State: AOAM531n51zBraiBLXAH3n07Q0F25YY2Wk0xeYgK1qCvkEjOIW7ZlJOj U+9B+7WCxk1nVOVIrgbSb/pY/A== X-Google-Smtp-Source: ABdhPJwWSLYj4jb9/SoiC3aqYVM091O5OkgaXBzt2XEbES/z5OI/iXG3zNxGEQl6WAawj75TmompIA== X-Received: by 2002:a1c:7704:: with SMTP id t4mr1133538wmi.48.1605734834730; Wed, 18 Nov 2020 13:27:14 -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 b124sm5921097wmh.13.2020.11.18.13.27.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Nov 2020 13:27:14 -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: <25465269-5497-4981-A1E4-CC1FFAB68CF4@freebsd.org> Date: Wed, 18 Nov 2020 21:27:13 +0000 Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202011181944.0AIJiUU3003699@repo.freebsd.org> <25465269-5497-4981-A1E4-CC1FFAB68CF4@freebsd.org> To: =?utf-8?Q?Stefan_E=C3=9Fer?= X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4Cbwr41zFXz4gkg X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.128.46:from]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.128.46:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.46:from]; R_DKIM_NA(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.46:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all] 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:27:17 -0000 On 18 Nov 2020, at 21:15, Jessica Clarke wrote: >=20 > 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. >> + */ >=20 > Why was this committed with a known racy/leaky implementation? >=20 > 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