From patchwork Thu Jul 14 07:49:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Righi X-Patchwork-Id: 1656264 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=eJ6X/gcT; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=Cwe1g8LJ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::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:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk6Gw1WjLz9ryY for ; Thu, 14 Jul 2022 17:55:20 +1000 (AEST) 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:Subject:Cc:To: From:Date: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=PiDyvTf5nyU8Kl+XJTB0WdKw3bqeismeVK2Ph9/xUJA=; b=eJ6X/gcTf/Wlrt vOTOSkbv/oExfoVx5R64T8kJSqUP95kGK+IWTzTXqxv/FgGihgSwLy3flvh6veFw7lb9Vi2ELxK1/ cAp5z5xmepde6EKkZfYkmEkiGUpHYZ42vl0TnK7YdXI/lziuyelg/G0kCzH/ayiarAQAp+x8tScSA 57W7fB5hAuHtPNHU3pwU5S/M0rhglQrYfsIZB7QjSA8aogB2DJGWiLJbUXIS1vuACdbnbia8LZvZA h0z8VEFXsIP29U2EFbG+QqBX9Q9CjsxASbEi+3pFJ3LdyD47YYfKX2elwjS4TLK+6zhiG7luJWAWT gqAXG2Zcn45qxXHRU0Yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBtgh-00C4FN-HD; Thu, 14 Jul 2022 07:55:07 +0000 Received: from smtp-relay-internal-0.canonical.com ([185.125.188.122]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBtbA-00C0E5-8X for linux-um@lists.infradead.org; Thu, 14 Jul 2022 07:49:26 +0000 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 4F3694000D for ; Thu, 14 Jul 2022 07:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1657784959; bh=ru92NeW5g35ZFxOqI1Jb++780ZQeradGocVi2TLd6GE=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=Cwe1g8LJh1AWPpbKzlhGOMJFiYSVYhyY/VaO3iMUHIpNbqxc91Cnl8ChxWw4+EVPD fHGIXJmmts5hzzXQEN+JZlTCkbCQBWuAbA1v+UJOrZBwvknaFquad/K7ZyK4d95VkN SYMDUMafbPMMzJPY13ZfU6x188yKAvHe8guiucnS47XJgWUuGZDYqfNpS1EE468F+B //NOIZb7iN4wb0NP96JGEBse2/FSxDsWmC4Cjej9J2suVMjzguqZAy7FpBxykMu3DW bnkTm53Az5SL28ckVKwtpdsQyLVtYTFJd3MlKwTlAinZg7juPTSlaT2kJrwPBL6OIi 9Zjsq/4iNw0HA== Received: by mail-ed1-f71.google.com with SMTP id bs1-20020a056402304100b0043ad1e84611so979281edb.15 for ; Thu, 14 Jul 2022 00:49:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=ru92NeW5g35ZFxOqI1Jb++780ZQeradGocVi2TLd6GE=; b=m6NtVqJBWPnwBKCM3wEzZyo+1WzMcL0XaTxPxe96U8DM/4CoAkj3r0fWvUXuvWl+Yh oDktp/8lrx3XcNP5uQxfXqVqz5An8LZUvWG8xQOB9zIqkrmiwNvsBJ1H40UsQtAE7AS+ 7WEvkwkWyNsobqbqsawDijUy1EuxDH0eizlU1lmAWe8CT65cLorM1E/0uSnY6Zc4nFez eMK6yvAKzsIKkZkXYSy+/mb9cRrWO7DzA5HAIdM4HbWSo2DOvltseooIMCWhiHaGliHA 8a1GNRy2fMAujnXoidds2nZ4DMkH5XSzoAni7UexuT3sd3nJH3CAt3KDRXj+lnsrIppa BSEg== X-Gm-Message-State: AJIora83OwG9RVLJa6RzePtZeiErwIF7cjCadnnBbG/2VvF8kht/XGpT KOCy8ARB8YOUENM6cINNbLEHutxghlnPPiEDYRzBMtjvDOqrRldjCCVcxPuM6Qdb8iudwfqo5Go K8sAq+TUE3zbo7hZH5bKCMUmSHrirOBrl+q8FxCXpEg== X-Received: by 2002:a17:906:7386:b0:715:7024:3df7 with SMTP id f6-20020a170906738600b0071570243df7mr7641900ejl.543.1657784957532; Thu, 14 Jul 2022 00:49:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u0i3ByKydjHXecFgiEiZThLjzaR73ohdpt+ID4N4aAM1yy7oR5xNprhfnWRNlPexiKJoYvlg== X-Received: by 2002:a17:906:7386:b0:715:7024:3df7 with SMTP id f6-20020a170906738600b0071570243df7mr7641880ejl.543.1657784957322; Thu, 14 Jul 2022 00:49:17 -0700 (PDT) Received: from localhost ([2001:67c:1560:8007::aac:c1b6]) by smtp.gmail.com with ESMTPSA id y2-20020a170906524200b0072a66960843sm375935ejm.51.2022.07.14.00.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 00:49:16 -0700 (PDT) Date: Thu, 14 Jul 2022 09:49:15 +0200 From: Andrea Righi To: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Cc: "H. Peter Anvin" , Richard Weinberger , Anton Ivanov , Johannes Berg , Thadeu Lima de Souza Cascardo , x86@kernel.org, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2][RESEND] x86/entry: build thunk_$(BITS) only if CONFIG_PREEMPTION=y Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220714_004924_767232_C908C0D5 X-CRM114-Status: GOOD ( 13.15 ) X-Spam-Score: -2.7 (--) 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: With CONFIG_PREEMPTION disabled, arch/x86/entry/thunk_$(BITS).o becomes an empty object file. With some old versions of binutils (i.e., 2.35.90.20210113-1ubuntu1) the GNU assembler doesn't generate a symbol table for empty object files and objtool fails with the following error when a valid sy [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [185.125.188.122 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 With CONFIG_PREEMPTION disabled, arch/x86/entry/thunk_$(BITS).o becomes an empty object file. With some old versions of binutils (i.e., 2.35.90.20210113-1ubuntu1) the GNU assembler doesn't generate a symbol table for empty object files and objtool fails with the following error when a valid symbol table cannot be found: arch/x86/entry/thunk_64.o: warning: objtool: missing symbol table To prevent this from happening, build thunk_$(BITS).o only if CONFIG_PREEMPTION is enabled. BugLink: https://bugs.launchpad.net/bugs/1911359 Fixes: 320100a5ffe5 ("x86/entry: Remove the TRACE_IRQS cruft") Signed-off-by: Andrea Righi --- arch/x86/entry/Makefile | 3 ++- arch/x86/entry/thunk_32.S | 2 -- arch/x86/entry/thunk_64.S | 4 ---- arch/x86/um/Makefile | 3 ++- 4 files changed, 4 insertions(+), 8 deletions(-) ChangeLog (v1 -> v2): - rebased to the latest kernel - do not break UML build diff --git a/arch/x86/entry/Makefile b/arch/x86/entry/Makefile index eeadbd7d92cc..ca2fe186994b 100644 --- a/arch/x86/entry/Makefile +++ b/arch/x86/entry/Makefile @@ -11,12 +11,13 @@ CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) CFLAGS_common.o += -fno-stack-protector -obj-y := entry.o entry_$(BITS).o thunk_$(BITS).o syscall_$(BITS).o +obj-y := entry.o entry_$(BITS).o syscall_$(BITS).o obj-y += common.o obj-y += vdso/ obj-y += vsyscall/ +obj-$(CONFIG_PREEMPTION) += thunk_$(BITS).o obj-$(CONFIG_IA32_EMULATION) += entry_64_compat.o syscall_32.o obj-$(CONFIG_X86_X32_ABI) += syscall_x32.o diff --git a/arch/x86/entry/thunk_32.S b/arch/x86/entry/thunk_32.S index 7591bab060f7..ff6e7003da97 100644 --- a/arch/x86/entry/thunk_32.S +++ b/arch/x86/entry/thunk_32.S @@ -29,10 +29,8 @@ SYM_CODE_START_NOALIGN(\name) SYM_CODE_END(\name) .endm -#ifdef CONFIG_PREEMPTION THUNK preempt_schedule_thunk, preempt_schedule THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace EXPORT_SYMBOL(preempt_schedule_thunk) EXPORT_SYMBOL(preempt_schedule_notrace_thunk) -#endif diff --git a/arch/x86/entry/thunk_64.S b/arch/x86/entry/thunk_64.S index 505b488fcc65..f38b07d2768b 100644 --- a/arch/x86/entry/thunk_64.S +++ b/arch/x86/entry/thunk_64.S @@ -31,14 +31,11 @@ SYM_FUNC_END(\name) _ASM_NOKPROBE(\name) .endm -#ifdef CONFIG_PREEMPTION THUNK preempt_schedule_thunk, preempt_schedule THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace EXPORT_SYMBOL(preempt_schedule_thunk) EXPORT_SYMBOL(preempt_schedule_notrace_thunk) -#endif -#ifdef CONFIG_PREEMPTION SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore) popq %r11 popq %r10 @@ -53,4 +50,3 @@ SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore) RET _ASM_NOKPROBE(__thunk_restore) SYM_CODE_END(__thunk_restore) -#endif diff --git a/arch/x86/um/Makefile b/arch/x86/um/Makefile index ba5789c35809..a8cde4e8ab11 100644 --- a/arch/x86/um/Makefile +++ b/arch/x86/um/Makefile @@ -28,7 +28,8 @@ else obj-y += syscalls_64.o vdso/ -subarch-y = ../lib/csum-partial_64.o ../lib/memcpy_64.o ../entry/thunk_64.o +subarch-y = ../lib/csum-partial_64.o ../lib/memcpy_64.o +subarch-$(CONFIG_PREEMPTION) += ../entry/thunk_64.o endif