Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26046C636CC for ; Tue, 31 Jan 2023 08:33:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231127AbjAaIdG (ORCPT ); Tue, 31 Jan 2023 03:33:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbjAaIdC (ORCPT ); Tue, 31 Jan 2023 03:33:02 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22BDABBB5 for ; Tue, 31 Jan 2023 00:32:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ANSSQvXLkAdB5vLFBiWOsNzzD5+Ok+WeTzqp79+9obU=; b=gThzmfIRxolj0u9xAVBDjK9jFn Lf8J7skNxuA0lPWxaZraA0WTyGXxau82RSlqm2UlTnsBpkuUGzROFlpq2aIICIhpyYD46OC7qbsgt Le6nsHRmWiJXUxNo9TtdaGH8JV++gjkOGIzGa38i1AW6uuIS6Jub+Npn9bm9SG/cUG1PiNkDSoaN8 zGI+VwsbfP3qurvij4w9J0Zqs97JBiTWOMhMKoa8kpocACi/AM/JwcCvInj7GPGEyat0zS+3f0ZgO YioYV0h8PSaqHEdIMZ93dBe05FPi9Wu33lnaQLFFNfu9vyOIj32Oj81rsqOunDog1M1s65HJVoyOw pr8054og==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMm4F-00B9KN-32; Tue, 31 Jan 2023 08:32:39 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (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) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id CEB903002BF; Tue, 31 Jan 2023 09:32:37 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ABF1B2083586E; Tue, 31 Jan 2023 09:32:37 +0100 (CET) Date: Tue, 31 Jan 2023 09:32:37 +0100 From: Peter Zijlstra To: "Kirill A. Shutemov" Cc: Dave Hansen , Borislav Petkov , Andy Lutomirski , Kuppuswamy Sathyanarayanan , Thomas Gleixner , Elena Reshetova , x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, kernel test robot Subject: Re: [PATCH] x86/tdx: Do not corrupt frame-pointer in __tdx_hypercall() Message-ID: References: <20230130135354.27674-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230130135354.27674-1-kirill.shutemov@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 30, 2023 at 04:53:54PM +0300, Kirill A. Shutemov wrote: > If compiled with CONFIG_FRAME_POINTER=y, objtool in not happy that > __tdx_hypercall() messes up RBP. > > objtool: __tdx_hypercall+0x7f: return with modified stack frame > > Rework the function to store TDX_HCALL_ flags on stack instead of RBP. > > Signed-off-by: Kirill A. Shutemov > Fixes: c30c4b2555ba ("x86/tdx: Refactor __tdx_hypercall() to allow pass down more arguments") > Link: https://lore.kernel.org/all/202301290255.buUBs99R-lkp@intel.com > Reported-by: kernel test robot > Cc: Peter Zijlstra > --- > > The patch is against tip/x86/tdx. tip/sched/core removes > TDX_HCALL_ISSUE_STI. The trird hunk of the patch is not relevant > after that. Right, this should work. But it does leave me wondering, should we perhaps strive to completely remove the flags thing and move to __tdx_hypercall() and __tdx_hypercall_ret() or something? That is, simply have two different functions, one with and one without return data. It should be trivial to generate that without actual code duplication.