Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3778311pxp; Wed, 23 Mar 2022 05:50:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3V3/7FWfWpZr/D9hDPhSzPccp1kgYK2NqqonCL6QP91wkMh7lLcJ87xizz8J0Xe/PHl1S X-Received: by 2002:a17:906:d205:b0:6d1:4446:d950 with SMTP id w5-20020a170906d20500b006d14446d950mr30446905ejz.702.1648039809027; Wed, 23 Mar 2022 05:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648039809; cv=none; d=google.com; s=arc-20160816; b=RAYpDl/H1hmL8EdUs6AhEIl7m+s5RwezcswnY+H0iAIEzng9XIl0Is1Ct6rLjHyE9X 97rX7nO9bHMbA8HzOlTMRAdIPhuOK+Eaq9RL0rpEcJj4cC/99kKXxiXiyV5A/yPrec0w RsN6BOIw42FiMdORshA/K6QlqvEEasvGfuxBZh83nsADXUrRdHrCSfNcBw+B66RC0JCB xG+VhyodsWWHz5FSjDmIldCe1k/RyAG0So+DPlu9858LxU9/n+gvUPQlX9I3O1ftQ1hJ lAwkG+ABE/mYDxIPSNKbrr1540AZD7XvNxg50NtWgtgH6/kaajENliP+KjAWeyv7qlk+ 3Sfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nXyPfePuY51zbr2Fay1aCG+pKEWL/mdsa1gCzRKJTno=; b=hyzfjI9/gCYeOlop+iUBZypS8KB5PXKNclFXAfjoVUJYfZfXeHI//HtPxBpPZAU33F n/ZQ8JA37xkcoo0Lt0A8AKCoTE4y4VS/92uFMJToHdWl1kM6mcLVZcRwOdwxJO93pf+p 9yI37E1Gc0WJbqxOBtlgu3ZUJPP9SfrDLWCSEtRpuU7VVkvZ+7QJnT3N2TXStfvO4uCZ mrIdoTMqMQSBS8lrK88tFfOJkDnh07KivpRb9B1M6bcI+mQlNcHgjdQDAWKhl4W3KnDd Mlo+oi11Eq1h82h7w37Q7hnc1nrOlhhkUwkNAP3S5HJLwxw3YWbc18TbeG2btE5vw/AP OuHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PuOe6xXl; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a1709062ed100b006df76385da0si12262084eji.576.2022.03.23.05.49.41; Wed, 23 Mar 2022 05:50:09 -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=@kernel.org header.s=k20201202 header.b=PuOe6xXl; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239684AbiCVRkf (ORCPT + 99 others); Tue, 22 Mar 2022 13:40:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232667AbiCVRke (ORCPT ); Tue, 22 Mar 2022 13:40:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D19555B3ED for ; Tue, 22 Mar 2022 10:39:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6D39861559 for ; Tue, 22 Mar 2022 17:39:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ED99C340EC; Tue, 22 Mar 2022 17:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647970745; bh=DjiS32vPPzgMI5rZD9Y+sAxvdb/r9L8MYhIr+oCkLbY=; h=From:To:Cc:Subject:Date:From; b=PuOe6xXlR8M/pSW0JOJW/vpBNEMzZJsv5u93nq9rsn92kFQrafwTgu2K07GlyhCpL LNbGvT+LYU6IRHu+ucWvAKQQQ99o6ZzA+Bo6rl/Lva65oRy+CRCwODtr2+MgcszJqZ sL/U+4tFbFSyTsy1YsANuLE5x0aEBCev5kExZ5X+QxTqo38IpSmlZxyTkRqSN1Qxh/ c56s6IU8/V9bpHHkSxcqqfToRB8Q+GoPnKISIBhJJAetw5MbNyQFY8M6RjTiJvk/yN cHuoPhVUPhESTckSAJt+K30DnNTmKOu6g/L4IkA02KRjzR5bPr+T78FWZRu+7Xb+ui bHEqWBuZmsz7Q== From: Nathan Chancellor To: Richard Weinberger , Anton Ivanov , Johannes Berg Cc: Nick Desaulniers , David Gow , linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH] um: Fix filtering '-mno-global-merge' Date: Tue, 22 Mar 2022 10:35:47 -0700 Message-Id: <20220322173547.677760-1-nathan@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 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 --- 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