Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1062698lqm; Thu, 2 May 2024 04:21:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV35CqaxQHSO4LZK2sIfCCxrvcmkzkG28eb2CNY7zeOPd6aqOLc1tNeJOjchUIjvNMkCkBa+YmRknPAIn8NDJxDT+ujzKD063igjDhpCA== X-Google-Smtp-Source: AGHT+IG/4RI7vq201U8izICEM87rw8CGg0PJnbUCDKuN5qeAFAcz9/YW1DvpomkuIbVsMdeLI2Gv X-Received: by 2002:a05:622a:5406:b0:43a:c483:9fc3 with SMTP id en6-20020a05622a540600b0043ac4839fc3mr6567615qtb.26.1714648907177; Thu, 02 May 2024 04:21:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714648907; cv=pass; d=google.com; s=arc-20160816; b=feS21wuZSdXb/bLvcZ9xMc4K3fOPjGQ+nt8thwalbKf+ss3664TnwUQXTNcCd3fVGC heYB6u7RRJFUI9QV/1R8SrCPrVU6gIqWC8/ph/J+5wNbz+gmtoxJx34cJJ00U4EgNgsl nbKJ/1J2krAO6Vhapho3GayQGi9P/HR1p+JCcYAqt3kJEkaDnqLOpuhW9hvGLsOw1vA7 sZcYLcLa1x4p3NEkjy8Td6Y4W1J/TUd68sAeF2XFK0DpDKJIn5WUOtPkfZCkOoxR7YRR 6uBvzVYCVSHMeHklcJlbQ/N466A9FPpoZTun/zkSLxCXNWLnugbBWnGP7rvh7XsCk6uK PK9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=xS3F4v7wqhL1fiYcktFOJGqTzFh4pYJiFqd+QqS7vwU=; fh=54PPqpXeEHWSBI0zOZiI4gGSApgBnUopgDCa0li/0zA=; b=U1FR/37MxmU0DK7qrFKg9egLpB0Z5cJbe/+SOy20tAiwI6agELcS2CxNd+L1Gs3H4C gQn5aF5ek8pnbluy4rPQWEXSH6e7Na4fMHPg0E6wg/t91zLjTLpbLmMacJYmUFIX6SJH XqrcipGaRgkomzVbll+ZhlNphGmUEeZmR016VFnGxLnQpQ/XMWkBdLgBfAZG/oyuiWPF Z8utyaQbpxCLu8gNoEU++EWRdOecxi1LYmTdk1nCkJbaUEonv1tGt6NXS7bNd5lS7aal SZz07FXzDEY37HMqBBxc8CPfHlDmCj7rUJ8jLmAbd0plqIjxq9cUbG/qKT1cEEocgE+h +tdg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oEKEViO8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166386-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166386-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n2-20020a05622a11c200b0043a4dea01ccsi707855qtk.403.2024.05.02.04.21.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 04:21:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166386-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oEKEViO8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166386-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166386-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DF07F1C21947 for ; Thu, 2 May 2024 11:21:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6395D65189; Thu, 2 May 2024 11:21:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oEKEViO8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71A14605CE; Thu, 2 May 2024 11:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714648897; cv=none; b=XZqnYYs7K7c79g1FjMzyhuhLWLBwFAT4CsP84mbbr8ffifYBGDwdUogyUNXzF44secsfRWLQcbv08BmNVQH6Hgsp2bu9z1v9Wb4tegXZ0QmdNwxO+Xf9aKOJgwm+Gro8nvqjTU/ON4TWHVduiguMkqpjbx0VA92pasgd956FFbs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714648897; c=relaxed/simple; bh=0ln9TXID18gsJMnDENXiItJGRtQ3Til5tzw9qOWE/sc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ri+CVDNOo1jI28yXf34FJsPTKbqHucNCdUMUiLDmKTHJDkNL5PPBTBecK6+U7+gX33oBiHUSCTSikj047KAEaKvykKOrXHuYHx1xlyTIZ9POiA8dY9zNWZYPfrRdAkthpZJJUGMFD2NhQPQXGLcMyVUMqLIKzRVnC41+Yft4tPk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oEKEViO8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 307A2C4AF18; Thu, 2 May 2024 11:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714648897; bh=0ln9TXID18gsJMnDENXiItJGRtQ3Til5tzw9qOWE/sc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oEKEViO8AxOjXR6iIdgwCu7M9Gy8KOg7xF4nyGPC+Q6kiqWHLioCWc+TKN1O1xGFU R5r916favQUmXsHYwF3hhP1H4QIqQhlQ5wBll2sEvQCjHIUs30q9p6EEUJISyRnuoX PHUjcgdQN9lWXGwzx/xhDdXqpWVdoLEkQ1youg+dV29CHaL49sDwtdB0b1hRj6Eg69 lcXC8doU0yUE99/DKUCyscpgTShpcBrE9CN7lHget3Yx3haAYwZdFxiJdtAF84yIlo C6EgORkHpFEimOrGiEho7ncdyeWM6rlP3wOVXAEfpup/tHM7MZKMUzUJzKk2OPSgFw Ug3evdCl5UR1w== Date: Thu, 2 May 2024 12:21:28 +0100 From: Will Deacon To: Kees Cook Cc: Mark Rutland , Peter Zijlstra , Boqun Feng , Catalin Marinas , linux-arm-kernel@lists.infradead.org, Jakub Kicinski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Arnd Bergmann , Andrew Morton , "David S. Miller" , David Ahern , Eric Dumazet , Paolo Abeni , "Paul E. McKenney" , Uros Bizjak , linux-kernel@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 2/4] arm64: atomics: lse: Silence intentional wrapping addition Message-ID: <20240502112127.GA17013@willie-the-truck> References: <20240424191225.work.780-kees@kernel.org> <20240424191740.3088894-2-keescook@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240424191740.3088894-2-keescook@chromium.org> User-Agent: Mutt/1.10.1 (2018-07-13) On Wed, Apr 24, 2024 at 12:17:35PM -0700, Kees Cook wrote: > Annotate atomic_add_return() and atomic_sub_return() to avoid signed > overflow instrumentation. They are expected to wrap around. > > Signed-off-by: Kees Cook > --- > Cc: Will Deacon > Cc: Peter Zijlstra > Cc: Boqun Feng > Cc: Mark Rutland > Cc: Catalin Marinas > Cc: linux-arm-kernel@lists.infradead.org > --- > arch/arm64/include/asm/atomic_lse.h | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) How come the ll/sc routines (in atomic_ll_sc.h) don't need the same treatment? If that's just an oversight, then maybe it's better to instrument the higher-level wrappers in asm/atomic.h? Will