Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1657534rwl; Wed, 12 Apr 2023 16:51:28 -0700 (PDT) X-Google-Smtp-Source: AKy350bTqU2O9iBCiC9HtDckzQUpD9g/Km7e60nPr03cx+uwkScNI4yiCQErazFNh2dKcQMgryVy X-Received: by 2002:a17:902:a504:b0:1a6:4f67:970 with SMTP id s4-20020a170902a50400b001a64f670970mr559474plq.55.1681343487771; Wed, 12 Apr 2023 16:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681343487; cv=none; d=google.com; s=arc-20160816; b=xB/rqDAlEUyfxdjiQHFnHYGFfq07V6HNltFC+u51U7TV+cbvk3oH/p86NXl7UQa57C nEQ2llx3B48RyqxNcJXPIr2ir497myDvfrByUZ4BQDWwq/D7cSqoJPs6/GWTUTBpeOUd SECU93FDyEBXUSAgduguqncuTAQsev53ifn4RG8NJ6gIG/lptdzFeRZS+8v61fcKqh7x 4z//0CjPSjz+ck4EgoQCwk8IUFk6diGVG2O1xDECh2jsJ6wtYOSUTmq/m+WUaCYYC4Ly WGgcglHefs3ga7rtOsgdjIRzVAy3d6Wb08VrFeYN718LfU1N649rGqNbXApjoxCJWeny StpQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hIgT417YgTYjETMt7pPMv1tWwuECs1OzisgKFlfsWuM=; b=sMzrwJpox2G8/OYSrEKgKCFx8Vy/K3LIltb2vn6pAN/v8t9Uu/dlSIBvtPcwyHo9J9 nLSSwoTGzfycRbF5HEOvRHjLlav/yZOagWtbGDibK28bPSVN5v9bsQYiCFLPmKt5/EHF a5e1Yn4mfDrD6oLuP7Z5rwY9Ls/OxZsg+0LKqwP0laTSaCj8pxwoFjlBpJ2Wp+tt76ZX F/CE+IxRnW8dXl/UeShDaAX95Z0QbnIpRyrU5nZGqxPdm8T2oaGAqFCb/3u5AK6AHa4J 1uP8egQd0l/ft1p98Tutz5PLSjE8RAPGvkd5kOSDT4+vSXjaNVOapSulpB/dZr3uliSv 0CBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YGpI28Ur; 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 k19-20020a170902ba9300b001a1f5f00f59si364648pls.452.2023.04.12.16.51.16; Wed, 12 Apr 2023 16:51:27 -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=YGpI28Ur; 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 S230133AbjDLXu3 (ORCPT + 99 others); Wed, 12 Apr 2023 19:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjDLXuG (ORCPT ); Wed, 12 Apr 2023 19:50:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A543C7280; Wed, 12 Apr 2023 16:50:05 -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 82D026375F; Wed, 12 Apr 2023 23:50:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 766C0C4339C; Wed, 12 Apr 2023 23:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681343404; bh=fv7dp6bnjJALXLewb9lTFvUBDPbaWCiPUy0hgG3NFLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YGpI28UrR5Zv3CYWpQ0VUGjdfUzVFojUtUlbbKFI5Bwyx+iXrsuGIp8s4v1k8SoJI nONptSfN0QUqyQ8t2DgvmD7tYUwACn4ZT+b7jSmj1NfXtuJ8T3FSAnKA98Hso7t2V9 ppJawnoz8YeoM/ykNlsVPlkBpo8jB/1URJXGVgpbc2KwjMzX5FAIFDvqcNM6aHI2z8 osGmvarU93OQGE9PYaYzIBCAyoH2DpmhKPNQfBlUT/XZlZPOx9y6OEpB6Y0xGjMqpG CitYIh2s2Aag3+xNbvuJ51BhWD7tsF+vSHN/8bqdL1tgYkPGAAazNtDdNH6j4Dto4e 4f/PLPj1QPGag== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Miroslav Benes , linux-btrfs@vger.kernel.org, Mark Rutland , linux-scsi@vger.kernel.org, linux-hyperv@vger.kernel.org, Arnd Bergmann , "Guilherme G . Piccoli" , Michael Kelley , Nick Desaulniers , Nathan Chancellor Subject: [PATCH v2 11/11] x86/hyperv: Mark hv_ghcb_terminate() as noreturn Date: Wed, 12 Apr 2023 16:49:41 -0700 Message-Id: <32453a703dfcf0d007b473c9acbf70718222b74b.1681342859.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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 From: "Guilherme G. Piccoli" 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 Link: https://lore.kernel.org/r/9698eff1-9680-4f0a-94de-590eaa923e94@app.fastmail.com/ Signed-off-by: Guilherme G. Piccoli Reviewed-by: Michael Kelley Signed-off-by: Josh Poimboeuf --- 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 1dbcbd9da74d..4f79dc76042d 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 4c4c0ec3b62e..09c26e658bcc 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 8586d4c36600..e23d12041be0 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", -- 2.39.2