Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3963185pxp; Wed, 23 Mar 2022 08:53:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDT0h3J7XW0gSqjiNxobuFoL6q3F/cBL7osUCt6PPEWdIMZvWFe5TWJ2ChXIud+MLN77FI X-Received: by 2002:a17:907:9706:b0:6db:566a:4408 with SMTP id jg6-20020a170907970600b006db566a4408mr703260ejc.374.1648050782664; Wed, 23 Mar 2022 08:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648050782; cv=none; d=google.com; s=arc-20160816; b=wsyAppS5rkbaRRMQ075OAVifYho+k61xQ/jF/ZDVYZIT08yEbHZBIyCfwLYh5RMFHT L5rmEDpQqVIbO8RyTlFLUpZmdLugi0JKhVyLRIt0NFMSUc+erOyadgUK+WODvreLc4F+ H0Qk3wCrK+7dJEMEVX8GNZbbaUBKQzdKDcMrHakcJeTgy0oyaOtLtl0VZfRntAbky/7n 8KrhW//Mks1TcAPH5hoWXEffzpjJKu8dxXzAqQAV0a14WkFDsClVTTm1pj1N+ZqP7dH5 SFymaDncLCU6o7QkyoGvr0/m/BMCvBqaC+MR96kmhGFZV8u9Lof7JE6WN5YAQYyRFr+k +qZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gsCfEGZiEJpELEvH3Hlz7ltwXtLYW7kp1y/UUBmLUGw=; b=UC11q2A2oFEsry/3iOSvlDEJevWGgdbN1jda5XN60+q0igTovuap2CYJrfJmh7dBrx CtkQUYf8fuG+zrrr8jCN1EXv64ZBQypw0A4CRgpb7DIirwTZlQuuO0YlL/PAOqGya2LL Usy3N03OvuldaPS1B72xIWLDplRmAaUpO//VMqwM3NbcEPWTeOnS2jTCSMH7hAuOD9Us ExfCX4LVqFVehjvpk5CWQ3g3RGVR7sTO/jFmNX3gAQWMRJ0cBAoX5HsgBHKpp2OTn2CZ dxBU1wzqhagpt7J//hz6TtZwTEjJN6lWZYV+/ugI16NyizjrgwAnf6wGDNruOTY6HIcV yv+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=BjntHDHo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a50c449000000b00418c2b5bd70si16750670edf.82.2022.03.23.08.52.25; Wed, 23 Mar 2022 08:53:01 -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=@google.com header.s=20210112 header.b=BjntHDHo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230283AbiCVX6t (ORCPT + 99 others); Tue, 22 Mar 2022 19:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230378AbiCVX6r (ORCPT ); Tue, 22 Mar 2022 19:58:47 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4005F5D672 for ; Tue, 22 Mar 2022 16:57:19 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id h16so2266wmd.0 for ; Tue, 22 Mar 2022 16:57:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gsCfEGZiEJpELEvH3Hlz7ltwXtLYW7kp1y/UUBmLUGw=; b=BjntHDHo5Rok7X/JojbjOmEGXEzsFxS/8jtAeWR7kloSDRwLTxuqSy9rDv9LfehUSE kqQOW0MQ8J6WTpput0+gy+XoriuS3NJaTkDUGqhcSPMUrILbviw90pDO7tNz9wnqPmw1 rWAl4+MgNiQXfCXNKfdfn2VGnZaearWODoaJyHx9w0xTRvCyASYmPEJIDw+4BExglFop l5BggHUz04T3gLL4o0e7909vd+k6plewlT2oecwEQRU1Ktu76EDoiIoiwNAJnr+RHT3J AuzLuDH77/C9lHrIfj1lM1YzEV7pln4C85yVNa+FxKIEuLpARx51l/IvIf/1ghCo9COJ QnXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gsCfEGZiEJpELEvH3Hlz7ltwXtLYW7kp1y/UUBmLUGw=; b=aU+55EhoqhjUgptyjsiB1kDkiKvV8tVphhTqp9y1+0QOZNvwMIvqKmZ52pfMUZqNOK 5Griv4CZ1iHub/vMCo3QuxwbKf9cpd5X4aUjlF/s+MhqU8K70a58PFfI007CY/bX8yTF Koalw/PoQZgohS60isWGpPPS6P26iKc/LbbJInksX+9OSpd2pu/37EELtJeq/jD+eIKf MIejboENKZ2dYgXyz0E0XECvPoc2Xa294x9d/W79m9txc3JIa+EJSiwAU4QZtfU5Kmpv Y3FdlLUtHzb12JCzeugQnuzvNIeDZRxPI+VX5v5XA4NzKTAdXCj4BlTm08sYQGOHTwwd tLpQ== X-Gm-Message-State: AOAM533LL97EWbErDMiXsybRIFsbgdVogVQTBRvrvVAOy4qGQbQ7GGdg rH0Qp5eLa41PEV29CN3yQgpyDd4LIkgT0vc+c1CnCQ== X-Received: by 2002:a05:600c:4f48:b0:38c:a460:cb6 with SMTP id m8-20020a05600c4f4800b0038ca4600cb6mr6357014wmq.96.1647993437716; Tue, 22 Mar 2022 16:57:17 -0700 (PDT) MIME-Version: 1.0 References: <20220322173547.677760-1-nathan@kernel.org> In-Reply-To: <20220322173547.677760-1-nathan@kernel.org> From: David Gow Date: Wed, 23 Mar 2022 07:57:06 +0800 Message-ID: Subject: Re: [PATCH] um: Fix filtering '-mno-global-merge' To: Nathan Chancellor Cc: Richard Weinberger , Anton Ivanov , Johannes Berg , Nick Desaulniers , linux-um , Linux Kernel Mailing List , llvm@lists.linux.dev Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="00000000000077215905dad75feb" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 --00000000000077215905dad75feb Content-Type: text/plain; charset="UTF-8" On Wed, Mar 23, 2022 at 1:39 AM Nathan Chancellor wrote: > > When booting a clang compiled UML kernel, the kernel panics when trying > to run init: > > wait_stub_done : failed to wait for SIGTRAP, pid = 651294, n = 651294, errno = 0, status = 0xb7f > Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b > > After the commit in Fixes, many flags from KBUILD_CFLAGS do not appear > in USER_CFLAGS, likely due to USER_CFLAGS initially being a recursive > variable ("VAR =") then being switched to a simple ("VAR :=") variable. > For example, diffing arch/x86/um/.ptrace_user.o.cmd shows flags such as > '-Os' and '-fno-delete-null-pointer-checks' getting dropped, which both > impact code generation. > > Rework the filtering to use filter-out instead of patsubst, which allows > all the patterns that USER_CFLAGS cares about to be excluded in one > command and ensures all flags from KBUILD_CFLAGS are transferred over to > USER_CFLAGS properly, which resolves the boot issue noted above. > > Fixes: 6580c5c18fb3 ("um: clang: Strip out -mno-global-merge from USER_CFLAGS") > Signed-off-by: Nathan Chancellor > --- Thanks. I was able to reproduce the panic here, and this indeed fixes it. Reviewed-by: David Gow Cheers, -- David > arch/um/Makefile | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/arch/um/Makefile b/arch/um/Makefile > index 320b09cd513c..d202f501e9e1 100644 > --- a/arch/um/Makefile > +++ b/arch/um/Makefile > @@ -70,15 +70,11 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \ > > KBUILD_AFLAGS += $(ARCH_INCLUDE) > > -USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \ > +USER_CFLAGS = $(filter-out $(KERNEL_DEFINES) -I% -mno-global-merge,$(KBUILD_CFLAGS)) \ > $(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \ > -D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \ > -idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__ > > -ifdef CONFIG_CC_IS_CLANG > -USER_CFLAGS := $(patsubst -mno-global-merge,,$(USER_CFLAGS)) > -endif > - > #This will adjust *FLAGS accordingly to the platform. > include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) > > > base-commit: 82017457957a550d7d00dde419435dd74a890887 > -- > 2.35.1 > --00000000000077215905dad75feb Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIPnwYJKoZIhvcNAQcCoIIPkDCCD4wCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg ggz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