Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1201713lqm; Thu, 2 May 2024 08:01:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXuI2ulh80dHrSg57GQcsIwtfYbgVOQRSWXeppZ11FlyTzLViiUCiiHOmc2EEhQvLsq9AviMyXrt7Vcq1YN4+FPvvFRRKVJDwPQ/HvjUg== X-Google-Smtp-Source: AGHT+IEq/DFT4fP02m4s/b6W4QLpP+91YbK3/M3PaeP+ZYiUs/IFLiHYYy5cMPDUuX5Dd0mG6TKQ X-Received: by 2002:a25:aa91:0:b0:dcd:2d3a:b528 with SMTP id t17-20020a25aa91000000b00dcd2d3ab528mr97087ybi.9.1714662064465; Thu, 02 May 2024 08:01:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714662064; cv=pass; d=google.com; s=arc-20160816; b=KRGsO31k+yxe+0E3USRXNPeHaCQfYVNU7UO7ptHOmaPdsov777I7HeNRk6MlV73f03 V/vAGWvWmwM7tr3uu1eE1xZkCW4WwPI3pUMbIm6ey2mCU9uMTg6FWpHpTUL1ZD/c0iKx NNYPb4xmphoUfLENDZpYJXsN/q8QDpCocJhw/0cTz87VW4x8maK2ADyGwgQvBEjiPrrh nu8a5dud/8GCAe0LD4HUheaPQ6tYS2JgpVt+g01rBy8IkGRVH0MlHZ0pYvD7qRLGNOKg 3d7dwwj4QpeKv2ycviHd6HlwfxHPQ0UShsa9WDLvNyuevq54wMwWWrbZyRSrwfAaj66+ ofIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=fgw/gW1T+dxXdhkHqh35xpW27WxDl5iViGaENoxdrdU=; fh=L/7lSQA4OvOo2KcFbpTAAdDaKATWX2/fcR98Vz1FouA=; b=lW1yW+A+AjRtDCzGYlaPs1ZEcR2C1z9kTH9RnVMYQ2KORj80g+TKAkhPfDsHJqJT3D EObmUwmxN5v6OKX1FbNZ0R0X+qG8hsAsn5kbxUISpEjIBAL2Q4k2g4lRHRCLKMbVztbk 74mc6jNEcqaR0tvUQpOwiK1jbSDjfwv8rQFoJ6DWVvnXMQckzdY1IU/C3KxGWW5zHHHm DA9mtKNBz09G5LywQ+pm1s6qMwcckraKXVCft63PSIvlPR/oJIhf2GFbWm+R8XVk2oZa G8v/X70iIxKTkoLKsIlDp3GQbYb6NNyd0yiH7gTuflJvrWf8VFh3pW/AE40rm6v8n1QT fFTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mJlV47bB; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-166608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166608-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t94-20020a25aae7000000b00de3d183268dsi372795ybi.327.2024.05.02.08.01.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 08:01:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mJlV47bB; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-166608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166608-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 7BC551C22F96 for ; Thu, 2 May 2024 15:01:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2603B15AAB8; Thu, 2 May 2024 15:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mJlV47bB" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B845F9D4 for ; Thu, 2 May 2024 15:00:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714662048; cv=none; b=Ia12f6mygs/HsrLIvtReVdHs6FkM2WNgYNDyJPFO1g4eauY+zkkVCKyp6hBwkrcghq74cZaFNzobJbzm+WP7Z3Ejotpxc9nibemeyQ1EiwS7tviaianirjQ7AN1+p4Mr1twgM13d3qm9eIc1PEiWUhEzC3Mnh9OBdfwG3RvNpGc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714662048; c=relaxed/simple; bh=IXZ0XVHyeLiV27rkSUTUlGzkN9VnLtKzOMVCMNoC/O8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o1QNqbtQkJtKvEYb3WggMB94SxhoVTADC8ueojNM+UOSOQLWnCGbJpIfmRrFm9qWXtU5uDN9VQimYYBZN4Dn8bIzdzwFK00MF65NjJf97eyUgVIVsVmz1VgaIKpEhewqQku+0P1wdBEDPyIgmAi4J/u66qAJB3UmN4JAtZFP1sY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=mJlV47bB; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1ec486198b6so25472305ad.1 for ; Thu, 02 May 2024 08:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714662046; x=1715266846; darn=vger.kernel.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=mJlV47bBZG2YpQPx3If6bekdR7ovyeFR1tJ+caocLpyOOupx0y407Lln1O91HmQPGH 6gwqpC+LiTNn5Tg00r2fcYuE63Se2aZ80gp/ulaDtAHplyw7n7xuEUqoNxqhxFCuSQI8 ZTeRK9oKJ5+GsOVLw/dQcHrXxUP40u1BYRhws= 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=iCNfq4+DDMbSXK1ggYyvIqYVGvfj9fc5lPchIk7zlje6NBfxgFFvOE7YYaMaKDTyAy ScUNYK1XimIn05D9T0p9MIAB57cgQY6z4sLX1erDjZkH/BHejZecSNBCf1EjnZaGc44K /yhSj6SeF/QWQnDUvm9uuR4EqpirfyoixrSXil3vqOu8a9Poa6zo5I293RtEsaQN0fEJ Qwia6JKEaReOn7rTyNPrhowVuVHl2A4ANUiwRjtIQcPFlyC+ZvgBg0y5h7toUaLqcKDX 2uon37yNyAI1LI4w7t/KymDYlhkW3Ts1iqrwh6KRKrY4Y4VYdPq5X3q+XSQgY0H6kZsC Lh9Q== X-Forwarded-Encrypted: i=1; AJvYcCU0W+I24deVVGDZxtKvWyLPDVJWyEQ3gg+7kuhHzucBtW6zN4n4P0dfvUsVZvdQisTY8Grm1BE0w1wX+RHjUvYMWTyuNLdPxG6dUEiq X-Gm-Message-State: AOJu0Yx1nKWnPQdVJE6L0ub6K7/IgkU00wL/a/NYgaCTtxLP0vmApFdK mzynlaeTHKLp3cl92mx+TsDtJSQ2/rSxjxGoZHX1Gj1NWKzN0YoijY7YuPPdOA== 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> 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: <20240502112127.GA17013@willie-the-truck> 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