From patchwork Tue Mar 22 17:35:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 1608282 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=soaNy21X; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=PuOe6xXl; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KNJdV6nxGz9s0m for ; Wed, 23 Mar 2022 04:39:25 +1100 (AEDT) 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=uRkQLh3O86fRep1axK0utPdaWYuaNdm74F8p/9mL3tA=; b=soaNy21XQQ5roc hB1vh/bCaLy9HBXFPxvlQFWxaqmdWjlGxxdYPP+lUk14qr9bQ/9BmlBuXPZIPvqHRVd2YmjarnUa6 Q9O1X70uSbpkERGHIzUPoBCayqug6MigJCGyNgNzB/gEaP05s621MpADmXqfROPnS+6ijW0sueLY2 7dz/VM4qybOoA0H61TKctJePOHGjIV/cWeNct+57dEjWNYJUtr6DygC9jWXZrilAQIMq4l2DK5mBj n16Y4lTfvP2co/Vp/iTgBX3IB7zl53f+83rpuGcHa8SLC+8p7Jxohek/OIq6vZSzPX7D4ipe2bgN6 0Xw4RChc+T28yJxNqFQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWiTQ-00Bkk7-Ep; Tue, 22 Mar 2022 17:39:12 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWiTN-00BkjT-3M for linux-um@lists.infradead.org; Tue, 22 Mar 2022 17:39:10 +0000 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 ams.source.kernel.org (Postfix) with ESMTPS id 11572B81D1C; Tue, 22 Mar 2022 17:39:07 +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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220322_103909_348600_D8558CE6 X-CRM114-Status: GOOD ( 11.44 ) X-Spam-Score: -5.4 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 Content analysis details: (-5.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [2604:1380:4601:e00:0:0:0:1 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.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 Reviewed-by: David Gow --- arch/um/Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) base-commit: 82017457957a550d7d00dde419435dd74a890887 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)