Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1415181rwp; Thu, 13 Jul 2023 10:27:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlG21hS0rHJdrcDTSW1Nkk2KQenETQM4knFvYkVWh6lBh5NNv5Wsh4iJ/R1NGE4GvFMSm/ZB X-Received: by 2002:a05:6358:91b:b0:134:d1ff:8c97 with SMTP id r27-20020a056358091b00b00134d1ff8c97mr3176009rwi.3.1689269266526; Thu, 13 Jul 2023 10:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689269266; cv=none; d=google.com; s=arc-20160816; b=D/UH4PbuAPf4/uTrLOqQrXlXqzmNJOPRV5EbYgYYpAcxJeYT9+HruF2I7wS0/f3E0w lYCQ5HP7kedsvwZJsRkrYxqV+Ejy3GsBAsKs7L4yNqxQa6SspJWJXJ10iBH0V+R6Rdf4 UKAvMzN3QORo3rcqGHYTXms523djZ1kyQnkeQ6xKUa97Fa61gtWXT33RIxsXzkPltJhw L2j+cASGk+COh0gz5sk4raSzEQyBryIY7Lcy3TsxXBqyiHJ0qyakUQ+n7g+66dr7jcxH x850K83alMO+PV4zLURiOVDu3bnzjHpkzIqsib2NNGq3AG4Dh3xI7cvgyQpKNeqrC6eS T0XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mkaGpz0HgmAYOX7U+wy0aaz4NPPSIRJNciFQzG/7LfI=; fh=u/bzrY35D1cdFkV4ScnxKwjl2vE4k/OMPM8EI4ktpaM=; b=XqnpEomSXmGwC+/t8qAMtggMeGsmOI1pNBsIvC4GNmQTMFRmYcvSpTPRsjb+Ixb2G+ jvZ17nFg2KLKpCSdtXQyg4SbZnBXhNj90089AFfNfQbxbfSji+Vonl9GcVd8UFaaqYF3 b3Q71+p8Dg1ErE0QnK0IIpw6WtksV9FDpQqFSJemGR4ZQtcuzgRQHZneHv+gKLqaR8HA 5BCuRR+iAuElpIsikn8tUUnL8BRpZnAIxpG4dzmf9YhnD9AsU+TwAxHSDQ0AkJy0ZDZP tYYxwrmgBNsXG+zUxTAiP3AgMJJHS/zvn5nPJzzn3LkM1VQwoDKmcn8jXOGRfKtxB8OM Mv2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TZwe67oM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h187-20020a636cc4000000b0055b4c11043asi5243544pgc.875.2023.07.13.10.27.34; Thu, 13 Jul 2023 10:27:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TZwe67oM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230267AbjGMQzc (ORCPT + 99 others); Thu, 13 Jul 2023 12:55:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230038AbjGMQzb (ORCPT ); Thu, 13 Jul 2023 12:55:31 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD8551FC0 for ; Thu, 13 Jul 2023 09:55:30 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1b8b318c5a7so7352185ad.3 for ; Thu, 13 Jul 2023 09:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689267330; x=1691859330; 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=mkaGpz0HgmAYOX7U+wy0aaz4NPPSIRJNciFQzG/7LfI=; b=TZwe67oMehoOCnv+us7BR5JF/AE7LNBrg3r4pPZC7R7ZDhK9jO8UgFk1hggi+qRHiC ULJ1W2JSep57OckV9Rxdvk+fD9ZkqtvOm4L9za8ck5FAxDtBDN25sMyCM7JfUKCKKd6+ 6xNlHm6nOqyTfi2kF55UuYLEAUfJ+gleTI7oI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689267330; x=1691859330; 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=mkaGpz0HgmAYOX7U+wy0aaz4NPPSIRJNciFQzG/7LfI=; b=g3ivrM8JeojJUK1TeBnGCmmd6kb+H8QfKexDVAq/cB07eidCDtIELw3ly7lMgHv2p2 8HObaswZrvKeNzvXE3r379l+tzTMpKRz4/OdZcKz0Ff21/wmx3WZod35dmBBM85k640N ZmndfPfCHK2D1k6s7PYzf1AybHdKlcYaqCszQ53yUH7EVn7qGsPRAD/My0OAPuFC2SEF Ua22ZjdCzcRxEOXZen5VS+lCoqMY0MR7yJ9xad0wVNoamWWJzjTLcbSnmOa8fjkU+A3C rNviel47uVHkbyutxXCA1m61JQYDwn+i0QnBtLy5bain8lQlTC8LUWiFvX4ZMFiDysuu VXWg== X-Gm-Message-State: ABy/qLY7KcipfZp3mO1HTUMvHlOAm2M0JFf3WCFKPh4PArB0X4ncNS09 MFFYDFaQgLaldp4SFuaZb4uajw== X-Received: by 2002:a17:902:dad2:b0:1b8:b3f7:4872 with SMTP id q18-20020a170902dad200b001b8b3f74872mr2684402plx.28.1689267330307; Thu, 13 Jul 2023 09:55:30 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id jh6-20020a170903328600b001b8b26fa6a9sm6211880plb.19.2023.07.13.09.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:55:29 -0700 (PDT) Date: Thu, 13 Jul 2023 09:55:29 -0700 From: Kees Cook To: Palmer Dabbelt Cc: Mark Rutland , arnd@kernel.org, davem@davemloft.net, peterz@infradead.org, Arnd Bergmann , linux@roeck-us.net, geert@linux-m68k.org, mingo@kernel.org, andi.shyti@linux.intel.com, andrzej.hajda@intel.com, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sparc: mark __arch_xchg() as __always_inline Message-ID: <202307130954.562F14E@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 13, 2023 at 07:00:37AM -0700, Palmer Dabbelt wrote: > On Wed, 28 Jun 2023 04:45:43 PDT (-0700), Mark Rutland wrote: > > On Wed, Jun 28, 2023 at 11:49:18AM +0200, Arnd Bergmann wrote: > > > From: Arnd Bergmann > > > > > > An otherwise correct change to the atomic operations uncovered an > > > existing bug in the sparc __arch_xchg() function, which is calls > > > __xchg_called_with_bad_pointer() when its arguments are unknown at > > > compile time: > > > > > > ERROR: modpost: "__xchg_called_with_bad_pointer" [lib/atomic64_test.ko] undefined! > > > > > > This now happens because gcc determines that it's better to not inline the > > > function. Avoid this by just marking the function as __always_inline > > > to force the compiler to do the right thing here. > > > > > > Reported-by: Guenter Roeck > > > Link: https://lore.kernel.org/all/c525adc9-6623-4660-8718-e0c9311563b8@roeck-us.net/ > > > Fixes: d12157efc8e08 ("locking/atomic: make atomic*_{cmp,}xchg optional") > > > Signed-off-by: Arnd Bergmann > > > > Aha; you saved me writing a patch! :) > > > > We should probably do likewise for all the other bits like __cmpxchg(), but > > either way: > > > > Acked-by: Mark Rutland > > Acked-by: Palmer Dabbelt > > Though I'm not sure that means a whole lot over here ;) I've carried some other sparc stuff before. I can send this to Linus with other fixes. -- Kees Cook