From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D1CEC4345F for ; Thu, 2 May 2024 15:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/UADkPBN8cPNsd3zDHKX8YfmwKGn3DkAAci8X1SXY4w=; b=CaFmKhx7udvnNJ JLY2Ed62T6NEVwlJwfR8WixXQJtw7sYRcnUrvF7mhLnolwANH+o/gtYdCbR/o8kGSA6aWsVmYTraF VhbGyWcjLeVSfZQxSE2jE5J5hMtbwKV8Pf44DPjrjzDhVf0uzaOqHgHmMxnSS9ccZr3Q5EaNoRQsC gHHavjPrhStPwbu5WK5Ct9sSi1/2zblnxK/1Dety2DS/7JswlmNTLjL5afRVnw17MuQbMu8D3AOP6 s8Nms2Cd6Kuajr8JqC+bOXHuRcb20L8+Aco1AveR38Fu9SzWqlDAhOl2nsra+Zgnh7ZSBykPqmpcw HrzcW5XnFZzQqveW1/Rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2XvY-0000000D1wf-3Dyf; Thu, 02 May 2024 15:00:52 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2XvV-0000000D1v3-174Q for linux-arm-kernel@lists.infradead.org; Thu, 02 May 2024 15:00:51 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e5715a9ebdso67546295ad.2 for ; Thu, 02 May 2024 08:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714662046; x=1715266846; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=fgw/gW1T+dxXdhkHqh35xpW27WxDl5iViGaENoxdrdU=; b=fISktB7d0JP9dfAzRnXDgQSFAobh4OKyZe2xcI2c4ezQfpqLnWRtbQmlCtgjKJs1Tr yTRJrqncYI4AFvl0kyBfXnytWx90uBlLrfhmum+GzGgMZT8axDwh+G0VxJzijTsosroN vsrgV/sNBiAJavulYNW9V5xeq/oaAi59e6xgI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714662046; x=1715266846; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fgw/gW1T+dxXdhkHqh35xpW27WxDl5iViGaENoxdrdU=; b=FnWBzpCPH2JDOVwRyd2SlIEQoNv8GtsLbKK4A7FExGt/gHjpJ+Xf1sdoBA8rUMO8WX JIVYUn9eYP04ue4GOQ6mZJaYPC5qY7zH82aa719++EI4Ce2IwO9zilYvdtiJ0uZeYqgC 5/kK1ICFUo+ISFUA/EDM2EmdV0ZUpXwEKNovXKuThlbQ5ABHz0Q71ADK1A0nHs2T/v0G r4kM9ZL6NSsvS6JGtuDVWIMFjII4eoM2LGiwbqiTxC9DIa+Jm1X36U7/tq9BRmrOUVm5 RExenvKT4BXvRzBCa3vGbBqnh67kXcsNTDg7vMdGXuQT8OE2XAYrWAZDM+5MSunu412t l3ng== X-Forwarded-Encrypted: i=1; AJvYcCW0DS5fLcjfAKOZw3kHlIcC+tsUj+ewtWX0jhGmPDxwUvKkU2m92T90HQQ+GpqGd8kBJ2rl4r81Zhkw2Hr9UCB566uZP5MoCg9PblarMsqFNyBbe20= X-Gm-Message-State: AOJu0YwicbtSx32sfs8x0ge8oaXERV4YSpgx7rs4VBO11e6Vm3aCr6LC di8m9ecrKDwqj8Pp1G0kJxpaDNoXm3Y9/zg/AVvzmTcHY+9H/Tf43zGL2emyPw== X-Google-Smtp-Source: AGHT+IH29bay7toIy+Kv6yjDc1RgVK2wZSKXsZ9Gj+t64lyFsqoM5DD3wZ30/iSnTvCH8VXfcondMw== X-Received: by 2002:a17:902:ab95:b0:1eb:551f:99b2 with SMTP id f21-20020a170902ab9500b001eb551f99b2mr5093641plr.65.1714662046285; Thu, 02 May 2024 08:00:46 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id jc15-20020a17090325cf00b001ece59458fbsm1376105plb.286.2024.05.02.08.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 08:00:45 -0700 (PDT) Date: Thu, 2 May 2024 08:00:45 -0700 From: Kees Cook To: Will Deacon 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: <202405020759.55CD47C@keescook> References: <20240424191225.work.780-kees@kernel.org> <20240424191740.3088894-2-keescook@chromium.org> <20240502112127.GA17013@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240502112127.GA17013@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240502_080049_326756_27D901BF X-CRM114-Status: GOOD ( 18.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, May 02, 2024 at 12:21:28PM +0100, Will Deacon wrote: > 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? Those are all written in asm, so there's no open-coded C arithmetic that the sanitizers will notice. All is well there! :) -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel