Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5853834rwd; Mon, 5 Jun 2023 09:22:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vsjZgIoPxu2h13BtdZ8X9iS6txGmfR6Xe1xIyyVbiFxMIC/oG3WwLj4aGn7DzI6H3oRZY X-Received: by 2002:a05:6a20:9187:b0:10b:7400:cef7 with SMTP id v7-20020a056a20918700b0010b7400cef7mr8213100pzd.17.1685982157688; Mon, 05 Jun 2023 09:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685982157; cv=none; d=google.com; s=arc-20160816; b=w6vBVUGfP0F/mJcqb2aizhzj6g9UMZb8QyHqsiTGzcyWw4K075XYKH59f8ioQdAtPm dDUbkjHxtAZT8VOqX66V6ksMwHeHyHkLVsdytE5PZIq93pY9jaKNwutDh2QGnw3z3k4S tTH0Z85S/ZMeGg/UgsLUo03xYfmvUYwrxUs9RYlb7ndnLkLc4b6aEsqQh5eYJnJBTWhJ pWugdfp28BewUB4BbO3vw7esfJIwANE8LdAoqH3Kz3qZE+oXID1xrMHBPlVPBNyOJM7v NFA/lRsVpuxczPqIL2keH1ZOauKyY0tOSXzij2ciAF9pHHpRzZXewb4UNeLRsYcPFdkd nUHA== 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=d3R7T6ZGsk/setHnRATwshWCDNjsw90xXFeLu0+FoWQ=; b=xX2ONUpDbNuJuzuQiNK9SMOWgKgn9lP+4QtxfJe4h5LAFX4pzMoNcwj18wpDZQDxPZ 7ilS4zD7jhIHFnlJrPEEiJpwY6NgrbUCVnk5dLlOi9IuiIy+Alw8E5v8jFY9GMZAKbDE h7ybMcd6HHUr3Xg83Of2y+eKmalEyTTFLmNd/Wpnm3sYGyGiljPG3EPPIHtbA68Nb226 NIOFzVCx70dZPMhzzKRdqyNtWPeKhnuECKI+Dhl5qtos0BZ/bFjtPs+9Dgk8U0eQ/mwh 7sJz5C4u30yh6mH7j3bS9PyCocfFV5HA/KlokV5IVx3CXv3vnnHq1cBKBEVGE66+deTm UROw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PhicJi3E; 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 v12-20020a63bf0c000000b0052c8234a858si5640882pgf.168.2023.06.05.09.22.22; Mon, 05 Jun 2023 09:22:37 -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=PhicJi3E; 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 S234792AbjFEQMj (ORCPT + 99 others); Mon, 5 Jun 2023 12:12:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233545AbjFEQMc (ORCPT ); Mon, 5 Jun 2023 12:12:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3510BBD for ; Mon, 5 Jun 2023 09:12:32 -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 9C1EC627F4 for ; Mon, 5 Jun 2023 16:12:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB561C433A4; Mon, 5 Jun 2023 16:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685981551; bh=GbiswfqlPKxb8y7Cgh7d9fzBotuGBKD2mu+cvUJpcr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PhicJi3EulNDmKVT5zOxoXSJn8Gf9Ok6AcSu2Q4X/qtJ8svD2SxRIhxqV4QoEQ7Jz mslv+YWbWjpGC5c2mluIh5YPn3aPAhYOwO/Au2IRgxV6VttYqBGKllB1kTCG39R1Yn uRcrWyMFVUW8b3VPBeQC3DG3e8PKNxfAb5q9pOZEnSfQz2RRop8Pmh/bOAkvEe7r3x b/ntM4UQ1nPaMtPZU+8QYXS1ofomme3x9xrfOp91VnInn4jW7cI4mWvNiXE+/1MXae ZwofIIPgM/E1kdH1c7+LL9v1uw7odHN165s4CPspOItUOu5Lq8lUG1cc3ec8c2phdR JLhSV/jb4B7xw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Miroslav Benes , linux-graphics-maintainer@vmware.com, Zack Rusin , kernel test robot Subject: [PATCH v2 2/2] drm/vmwgfx: Add unwind hints around RBP clobber Date: Mon, 5 Jun 2023 09:12:22 -0700 Message-Id: <4c795f2d87bc0391cf6543bcb224fa540b55ce4b.1685981486.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 VMware high-bandwidth hypercalls take the RBP register as input. This breaks basic frame pointer convention, as RBP should never be clobbered. So frame pointer unwinding is broken for the instructions surrounding the hypercalls. Fortunately this doesn't break live patching with CONFIG_FRAME_POINTER, as it only unwinds from blocking tasks, and stack traces from preempted tasks are already marked unreliable anyway. However, for live patching with ORC, this could actually be a theoretical problem if vmw_port_hb_{in,out}() were still compiled with a frame pointer due to having an aligned stack. In practice that hasn't seemed to be an issue since the objtool warnings have only been seen with CONFIG_FRAME_POINTER. Add unwind hint annotations to tell the ORC unwinder to mark stack traces as unreliable. Fixes the following warnings: vmlinux.o: warning: objtool: vmw_port_hb_in+0x1df: return with modified stack frame vmlinux.o: warning: objtool: vmw_port_hb_out+0x1dd: return with modified stack frame Fixes: 89da76fde68d ("drm/vmwgfx: Add VMWare host messaging capability") Reported-by: kernel test robot Link: https://lore.kernel.org/oe-kbuild-all/202305160135.97q0Elax-lkp@intel.com/ Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/unwind_hints.h | 9 +++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_msg_x86.h | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/unwind_hints.h b/arch/x86/include/asm/unwind_hints.h index 01cb9692b160..85cc57cb6539 100644 --- a/arch/x86/include/asm/unwind_hints.h +++ b/arch/x86/include/asm/unwind_hints.h @@ -76,9 +76,18 @@ #else +#define UNWIND_HINT_UNDEFINED \ + UNWIND_HINT(UNWIND_HINT_TYPE_UNDEFINED, 0, 0, 0) + #define UNWIND_HINT_FUNC \ UNWIND_HINT(UNWIND_HINT_TYPE_FUNC, ORC_REG_SP, 8, 0) +#define UNWIND_HINT_SAVE \ + UNWIND_HINT(UNWIND_HINT_TYPE_SAVE, 0, 0, 0) + +#define UNWIND_HINT_RESTORE \ + UNWIND_HINT(UNWIND_HINT_TYPE_RESTORE, 0, 0, 0) + #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_UNWIND_HINTS_H */ diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg_x86.h b/drivers/gpu/drm/vmwgfx/vmwgfx_msg_x86.h index 0b74ca2dfb7b..23899d743a90 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg_x86.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg_x86.h @@ -105,10 +105,14 @@ flags, magic, bp, \ eax, ebx, ecx, edx, si, di) \ ({ \ - asm volatile ("push %%rbp;" \ + asm volatile ( \ + UNWIND_HINT_SAVE \ + "push %%rbp;" \ + UNWIND_HINT_UNDEFINED \ "mov %12, %%rbp;" \ VMWARE_HYPERCALL_HB_OUT \ - "pop %%rbp;" : \ + "pop %%rbp;" \ + UNWIND_HINT_RESTORE : \ "=a"(eax), \ "=b"(ebx), \ "=c"(ecx), \ @@ -130,10 +134,14 @@ flags, magic, bp, \ eax, ebx, ecx, edx, si, di) \ ({ \ - asm volatile ("push %%rbp;" \ + asm volatile ( \ + UNWIND_HINT_SAVE \ + "push %%rbp;" \ + UNWIND_HINT_UNDEFINED \ "mov %12, %%rbp;" \ VMWARE_HYPERCALL_HB_IN \ - "pop %%rbp" : \ + "pop %%rbp;" \ + UNWIND_HINT_RESTORE : \ "=a"(eax), \ "=b"(ebx), \ "=c"(ecx), \ -- 2.40.1