Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/vmwgfx: Add unwind hints around RBP clobber

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 <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202305160135.97q0Elax-lkp@intel.com/
Link: https://lore.kernel.org/r/4c795f2d87bc0391cf6543bcb224fa540b55ce4b.1685981486.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+21 -4
+9
arch/x86/include/asm/unwind_hints.h
··· 76 76 77 77 #else 78 78 79 + #define UNWIND_HINT_UNDEFINED \ 80 + UNWIND_HINT(UNWIND_HINT_TYPE_UNDEFINED, 0, 0, 0) 81 + 79 82 #define UNWIND_HINT_FUNC \ 80 83 UNWIND_HINT(UNWIND_HINT_TYPE_FUNC, ORC_REG_SP, 8, 0) 84 + 85 + #define UNWIND_HINT_SAVE \ 86 + UNWIND_HINT(UNWIND_HINT_TYPE_SAVE, 0, 0, 0) 87 + 88 + #define UNWIND_HINT_RESTORE \ 89 + UNWIND_HINT(UNWIND_HINT_TYPE_RESTORE, 0, 0, 0) 81 90 82 91 #endif /* __ASSEMBLY__ */ 83 92
+12 -4
drivers/gpu/drm/vmwgfx/vmwgfx_msg_x86.h
··· 105 105 flags, magic, bp, \ 106 106 eax, ebx, ecx, edx, si, di) \ 107 107 ({ \ 108 - asm volatile ("push %%rbp;" \ 108 + asm volatile ( \ 109 + UNWIND_HINT_SAVE \ 110 + "push %%rbp;" \ 111 + UNWIND_HINT_UNDEFINED \ 109 112 "mov %12, %%rbp;" \ 110 113 VMWARE_HYPERCALL_HB_OUT \ 111 - "pop %%rbp;" : \ 114 + "pop %%rbp;" \ 115 + UNWIND_HINT_RESTORE : \ 112 116 "=a"(eax), \ 113 117 "=b"(ebx), \ 114 118 "=c"(ecx), \ ··· 134 130 flags, magic, bp, \ 135 131 eax, ebx, ecx, edx, si, di) \ 136 132 ({ \ 137 - asm volatile ("push %%rbp;" \ 133 + asm volatile ( \ 134 + UNWIND_HINT_SAVE \ 135 + "push %%rbp;" \ 136 + UNWIND_HINT_UNDEFINED \ 138 137 "mov %12, %%rbp;" \ 139 138 VMWARE_HYPERCALL_HB_IN \ 140 - "pop %%rbp" : \ 139 + "pop %%rbp;" \ 140 + UNWIND_HINT_RESTORE : \ 141 141 "=a"(eax), \ 142 142 "=b"(ebx), \ 143 143 "=c"(ecx), \