From patchwork Mon Apr 17 10:46:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 84174 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2040761vqo; Mon, 17 Apr 2023 04:16:58 -0700 (PDT) X-Google-Smtp-Source: AKy350a0PFPwyiaynYQM5epKo6XwxU0bO+UBPHshWAekU38qR45iYTTl2bfPOVVYfnGjZBXNRN3D X-Received: by 2002:a05:6a00:1955:b0:63b:2102:a1d4 with SMTP id s21-20020a056a00195500b0063b2102a1d4mr19093323pfk.13.1681730218377; Mon, 17 Apr 2023 04:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681730218; cv=none; d=google.com; s=arc-20160816; b=xdvfqzgU9Ru6rkrdb1QUiFTQRDXBbvBXkNUFNl/C0WjSERfGX/8hv0S/onblbB+8/n DXsVY462VjDJrEWEXM43UD6loEbenfpK9xovufgZpWa43Vt5o6UDVGA4ipWwFT4LgCaN Rx6G+e5//aqkmlx0sTgu4qF0stzRM7qQT+qXEeeVweU/PJkwFopAWIPCBAmU0tUyU6dS xFLvOQr+w3g62lbhvfUCzBsbmuFSZZXpYcvEhJUjyL35PBMr7px9EhpD724kcETwBG7O VNMb5YesqhESPoI/EA5aWeTTBFCFxKbB+PBaFL/3saahHvslA5FRgcO7jYjchzCin3s1 w+ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=W5gz0IAPwW8Ml+TPwzI2zzEnnHxfoa0E4AWfaz+JnGM=; b=l5okPHOMKCSJyIFSjRN76tyJdzpOgCEd0Xfh7iGy1LeDqLLUW5jSPj8xW/TDj8BJ/x l7keV8gfKqfZKUk/giBGUHDzuJlqBORnmYKXlvJnIvY+PGzYjThERuEAujzzo9n2sgVm uF7/jvmdU6DIDpYkYfUd/AzRxFETOenvRlvhI3F/DLjMBMstfDuEs0lQZ2Ti0/Zdi4j9 R9qMZhdIPOw+YiTcO2imkgkMTRC3iUW3Fty7rfD2yZwEfLznxOspqyfvjvCBU4y8Dspv kB00H/AZvfwSv8/Y/qYZ9B89FeVTCTkqnq4Gb5kg34N4bJqJSs8BlNXziIqqpB//pIfN WrAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ycu5EFvg; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IatCR1nr; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020a63d003000000b005075581074bsi11643418pgf.446.2023.04.17.04.16.46; Mon, 17 Apr 2023 04:16:58 -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=@linutronix.de header.s=2020 header.b=ycu5EFvg; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IatCR1nr; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbjDQKtI (ORCPT + 99 others); Mon, 17 Apr 2023 06:49:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbjDQKsm (ORCPT ); Mon, 17 Apr 2023 06:48:42 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 298BFA9; Mon, 17 Apr 2023 03:47:52 -0700 (PDT) Date: Mon, 17 Apr 2023 10:46:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681728405; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W5gz0IAPwW8Ml+TPwzI2zzEnnHxfoa0E4AWfaz+JnGM=; b=ycu5EFvgo2VWpyjSRBGDmDd/h4hpo2wBiH2VbxpHQWJCJTgxEpgsCJTLSSNe5wtQdzF82k 1wP0+5Dj/23IkzjhhHkjT4ZutwjKoOfIZtOt0D6wVxLuq6agj7czZhRAOmEbZUZty/jAjW BhUsh26jqs6wtY4z7VadeOmaBTSO0Ubt8ECebRkMqupeZ8ijziTm8zowr2wOKG347CVCWW qNE1g6PST6VoZ4f3gNNDtvH4Al2MBKQ9RCpPa8lxJhrWHGY0eNemvIPyLCjpTPYywnSnJi MJsxaCOIoHhFfVmO+dj89I5f702XDHIue0NuQhtnkzfH+1HZJPG/a5e7bJPk+Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681728405; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W5gz0IAPwW8Ml+TPwzI2zzEnnHxfoa0E4AWfaz+JnGM=; b=IatCR1nrLl6AdV6PUJGG4QhrGoFAjl7fG+oIycCyls0pO3vzN7IlLYcokWLz9hFJhm0bMm Rw+FNMkVxSBqTSDw== From: "tip-bot2 for Guilherme G. Piccoli" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] x86/hyperv: Mark hv_ghcb_terminate() as noreturn Cc: Arnd Bergmann , "Guilherme G. Piccoli" , Josh Poimboeuf , "Peter Zijlstra (Intel)" , Michael Kelley , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <32453a703dfcf0d007b473c9acbf70718222b74b.1681342859.git.jpoimboe@kernel.org> References: <32453a703dfcf0d007b473c9acbf70718222b74b.1681342859.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <168172840540.404.15994550116544514863.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763016430448019722?= X-GMAIL-MSGID: =?utf-8?q?1763421945109880789?= The following commit has been merged into the objtool/core branch of tip: Commit-ID: 611d4c716db0141cfc436994dc5aff1d69c924ad Gitweb: https://git.kernel.org/tip/611d4c716db0141cfc436994dc5aff1d69c924ad Author: Guilherme G. Piccoli AuthorDate: Wed, 12 Apr 2023 16:49:41 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 14 Apr 2023 17:31:28 +02:00 x86/hyperv: Mark hv_ghcb_terminate() as noreturn Annotate the function prototype and definition as noreturn to prevent objtool warnings like: vmlinux.o: warning: objtool: hyperv_init+0x55c: unreachable instruction Also, as per Josh's suggestion, add it to the global_noreturns list. As a comparison, an objdump output without the annotation: [...] 1b63: mov $0x1,%esi 1b68: xor %edi,%edi 1b6a: callq ffffffff8102f680 1b6f: jmpq ffffffff82f217ec # unreachable 1b74: cmpq $0xffffffffffffffff,-0x702a24(%rip) [...] Now, after adding the __noreturn to the function prototype: [...] 17df: callq ffffffff8102f6d0 17e4: test %al,%al 17e6: je ffffffff82f21bb9 [...] 1bb9: mov $0x1,%esi 1bbe: xor %edi,%edi 1bc0: callq ffffffff8102f680 1bc5: nopw %cs:0x0(%rax,%rax,1) # end of function Reported-by: Arnd Bergmann Signed-off-by: Guilherme G. Piccoli Signed-off-by: Josh Poimboeuf Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Michael Kelley Link: https://lore.kernel.org/r/32453a703dfcf0d007b473c9acbf70718222b74b.1681342859.git.jpoimboe@kernel.org --- arch/x86/hyperv/ivm.c | 2 +- arch/x86/include/asm/mshyperv.h | 2 +- tools/objtool/check.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c index 1dbcbd9..4f79dc7 100644 --- a/arch/x86/hyperv/ivm.c +++ b/arch/x86/hyperv/ivm.c @@ -127,7 +127,7 @@ static enum es_result hv_ghcb_hv_call(struct ghcb *ghcb, u64 exit_code, return ES_OK; } -void hv_ghcb_terminate(unsigned int set, unsigned int reason) +void __noreturn hv_ghcb_terminate(unsigned int set, unsigned int reason) { u64 val = GHCB_MSR_TERM_REQ; diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 4c4c0ec..09c26e6 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -212,7 +212,7 @@ int hv_set_mem_host_visibility(unsigned long addr, int numpages, bool visible); void hv_ghcb_msr_write(u64 msr, u64 value); void hv_ghcb_msr_read(u64 msr, u64 *value); bool hv_ghcb_negotiate_protocol(void); -void hv_ghcb_terminate(unsigned int set, unsigned int reason); +void __noreturn hv_ghcb_terminate(unsigned int set, unsigned int reason); #else static inline void hv_ghcb_msr_write(u64 msr, u64 value) {} static inline void hv_ghcb_msr_read(u64 msr, u64 *value) {} diff --git a/tools/objtool/check.c b/tools/objtool/check.c index e1b01ea..5b600bb 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -213,6 +213,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func, "ex_handler_msr_mce", "fortify_panic", "hlt_play_dead", + "hv_ghcb_terminate", "kthread_complete_and_exit", "kthread_exit", "kunit_try_catch_throw",