Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2054992ybb; Fri, 29 Mar 2019 17:49:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjilvYNQE3iSgZfteGzk9gcxO0KjVkLCV8Ryy8ZI4qtmx2inN9CsjTqBRCixr78cY1BKwT X-Received: by 2002:a17:902:1486:: with SMTP id k6mr51001374pla.3.1553906953577; Fri, 29 Mar 2019 17:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553906953; cv=none; d=google.com; s=arc-20160816; b=fJK5PJoM/VO1LYxYqOWY+mj2+rhIoY9keeih247DPb9+WIU1yv4NF5arRvL+d4DOfr PdhFT4h1JRe8elWEOIMXbIOPPAYhtR0Muk42M+79xWtVlG51UK4EFnhn37jz9wBVhwd+ iSLNWEhqTVY4puLcIHRVNnaCarWotWR8kJZG3Vzar3WF1RLGjUnzJQSaouzD8gVoGFEO I2mRxmetsPKJNUNcrr90UA03QXDAhZ7lu4K+LBDRKiQct/84748qjM6xaqLClOys2IdQ 2qQ1hZApimTDwD+x3iyeA7YAj6SnGh1DFOV9GUA4XPxpCllnduCQjLKkyrNP5aZVwuzN jqUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=CbBPqShPIexQ8K+4lp/cI28nBJIN+gClBiNIBbEoP0Y=; b=s5uklzAJXRZEvtGbgdCvjLNaaRLXybKJZZomoSeMfgEhgPsoT0SnCtuhqHs4VI2EsC OpOIuMUqz3YjDRudqoJLfsGT7RD1/w+EafynecPDwkhGFsKD0SRgiGHqv8hpiPbSmos9 1HL8ow9fjsK85jMprULH43fRCrt7DXq356JhKOWFHVFxL82LiKPaQse7SVIgwxi6J+Wa s14z81qwee4Uhmr0GZkG9sQ4WgFgWCx+4T7nCeeGXAqw/VBZuj3rkz5c7y1W0xNjDC4o cOkVsy0scxXHXWPuSd0P2sIHKydVI7wHR5xdY86nY6cVRqtssAijcfQqteg8mIpFSm7M SALQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s145si1597727pgs.228.2019.03.29.17.48.58; Fri, 29 Mar 2019 17:49:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730497AbfC3Ary (ORCPT + 99 others); Fri, 29 Mar 2019 20:47:54 -0400 Received: from mga04.intel.com ([192.55.52.120]:49819 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730453AbfC3Arw (ORCPT ); Fri, 29 Mar 2019 20:47:52 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 17:47:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,286,1549958400"; d="scan'208";a="138481251" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 17:47:50 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id D59E5301BE3; Fri, 29 Mar 2019 17:47:50 -0700 (PDT) From: Andi Kleen To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH v2 1/9] x86/asm: Mark all top level asm statements as .text Date: Fri, 29 Mar 2019 17:47:35 -0700 Message-Id: <20190330004743.29541-1-andi@firstfloor.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen With gcc toplevel assembler statements that do not mark themselves as .text may end up in other sections. I had LTO boot crashes because various assembler statements ended up in the middle of the initcall section. It's also a latent problem without LTO, although it's currently not known to cause any real problems. According to the gcc team it's expected behavior. Always mark all the top level assembler statements as text so that they switch to the right section. Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/amd.c | 3 ++- arch/x86/kernel/kprobes/core.c | 1 + arch/x86/lib/error-inject.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 01004bfb1a1b..1bcb489e07e7 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -83,7 +83,8 @@ static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val) */ extern __visible void vide(void); -__asm__(".globl vide\n" +__asm__(".text\n" + ".globl vide\n" ".type vide, @function\n" ".align 4\n" "vide: ret\n"); diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index a034cb808e7e..31ab91c9c4e9 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -715,6 +715,7 @@ NOKPROBE_SYMBOL(kprobe_int3_handler); * calls trampoline_handler() runs, which calls the kretprobe's handler. */ asm( + ".text\n" ".global kretprobe_trampoline\n" ".type kretprobe_trampoline, @function\n" "kretprobe_trampoline:\n" diff --git a/arch/x86/lib/error-inject.c b/arch/x86/lib/error-inject.c index 3cdf06128d13..be5b5fb1598b 100644 --- a/arch/x86/lib/error-inject.c +++ b/arch/x86/lib/error-inject.c @@ -6,6 +6,7 @@ asmlinkage void just_return_func(void); asm( + ".text\n" ".type just_return_func, @function\n" ".globl just_return_func\n" "just_return_func:\n" -- 2.20.1