vmlinux.o: warning: objtool: __tdx_hypercall+0x7f: return with modified stack frame
Subsystems (2)
kernel test robot
build botCC: [email protected]
CC: [email protected]
TO: "Kirill A. Shutemov" <[email protected]>
CC: Dave Hansen <[email protected]>
Hi Kirill,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/tdx head: 8de62af018cc9262649d7688f7eb1409b2d8f594 commit: c30c4b2555ba93b845559a036293fcaf7ffd2b82 [3/7] x86/tdx: Refactor __tdx_hypercall() to allow pass down more arguments config: x86_64-randconfig-a013-20230123 (https://download.01.org/0day-ci/archive/20230129/[email protected]/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=c30c4b2555ba93b845559a036293fcaf7ffd2b82
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip x86/tdx
git checkout c30c4b2555ba93b845559a036293fcaf7ffd2b82
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
>> vmlinux.o: warning: objtool: __tdx_hypercall+0x7f: return with modified stack frame
vmlinux.o: warning: objtool: ibt_selftest+0x14: sibling call from callable instruction with modified stack frame vmlinux.o: warning: objtool: sync_regs+0x27: call to memcpy() leaves .noinstr.text section vmlinux.o: warning: objtool: fixup_bad_iret+0x2d: call to memset() leaves .noinstr.text section vmlinux.o: warning: objtool: ibt_selftest+0x1e: return with modified stack frame
objdump-func vmlinux.o __tdx_hypercall:
0000 00000000000052a0 <__tdx_hypercall>:
0000 52a0: f3 0f 1e fa endbr64 0004 52a4: 55 push %rbp 0005 52a5: 48 89 e5 mov %rsp,%rbp 0008 52a8: 41 57 push %r15 000a 52aa: 41 56 push %r14 000c 52ac: 41 55 push %r13 000e 52ae: 41 54 push %r12 0010 52b0: 55 push %rbp 0011 52b1: 48 89 f8 mov %rdi,%rax 0014 52b4: 48 89 f5 mov %rsi,%rbp 0017 52b7: 4c 8b 50 10 mov 0x10(%rax),%r10 001b 52bb: 4c 8b 58 18 mov 0x18(%rax),%r11 001f 52bf: 4c 8b 60 20 mov 0x20(%rax),%r12 0023 52c3: 4c 8b 68 28 mov 0x28(%rax),%r13 0027 52c7: 4c 8b 70 30 mov 0x30(%rax),%r14 002b 52cb: 4c 8b 78 38 mov 0x38(%rax),%r15 002f 52cf: 50 push %rax 0030 52d0: 31 c0 xor %eax,%eax 0032 52d2: b9 00 fc 00 00 mov $0xfc00,%ecx 0037 52d7: 48 f7 c5 02 00 00 00 test $0x2,%rbp 003e 52de: 74 01 je 52e1 <__tdx_hypercall+0x41> 0040 52e0: fb sti 0041 52e1: 66 0f 01 cc tdcall 0045 52e5: 48 85 c0 test %rax,%rax 0048 52e8: 75 36 jne 5320 <__tdx_hypercall+0x80> 004a 52ea: 58 pop %rax 004b 52eb: 48 f7 c5 01 00 00 00 test $0x1,%rbp 0052 52f2: 74 18 je 530c <__tdx_hypercall+0x6c> 0054 52f4: 4c 89 50 10 mov %r10,0x10(%rax) 0058 52f8: 4c 89 58 18 mov %r11,0x18(%rax) 005c 52fc: 4c 89 60 20 mov %r12,0x20(%rax) 0060 5300: 4c 89 68 28 mov %r13,0x28(%rax) 0064 5304: 4c 89 70 30 mov %r14,0x30(%rax) 0068 5308: 4c 89 78 38 mov %r15,0x38(%rax) 006c 530c: 4c 89 d0 mov %r10,%rax 006f 530f: 45 31 d2 xor %r10d,%r10d 0072 5312: 45 31 db xor %r11d,%r11d 0075 5315: 5d pop %rbp 0076 5316: 41 5c pop %r12 0078 5318: 41 5d pop %r13 007a 531a: 41 5e pop %r14 007c 531c: 41 5f pop %r15 007e 531e: 5d pop %rbp 007f 531f: c3 ret 0080 5320: e8 00 00 00 00 call 5325 <__tdx_hypercall+0x85> 5321: R_X86_64_PLT32 __tdx_hypercall_failed-0x4 0085 5325: eb f9 jmp 5320 <__tdx_hypercall+0x80> 0087 5327: cc int3 0088 5328: cc int3 0089 5329: cc int3 008a 532a: cc int3 008b 532b: cc int3 008c 532c: cc int3 008d 532d: cc int3 008e 532e: cc int3 008f 532f: cc int3
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
[tip: x86/tdx] x86/tdx: Do not corrupt frame-pointer in __tdx_hypercall()
The following commit has been merged into the x86/tdx branch of tip:
The following commit has been merged into the x86/tdx branch of tip:
Commit-ID: 1e70c680375aa33cca97bff0bca68c0f82f5023c Gitweb: https://git.kernel.org/tip/1e70c680375aa33cca97bff0bca68c0f82f5023c Author: Kirill A. Shutemov <[email protected]> AuthorDate: Mon, 30 Jan 2023 16:53:54 +03:00 Committer: Dave Hansen <[email protected]> CommitterDate: Thu, 02 Feb 2023 16:31:25 -08:00
x86/tdx: Do not corrupt frame-pointer in __tdx_hypercall()
If compiled with CONFIG_FRAME_POINTER=y, objtool is 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.
[ dhansen: minor changelog tweaks ]
--- arch/x86/coco/tdx/tdcall.S | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/x86/coco/tdx/tdcall.S +6 -6
@@ -131,11 +131,10 @@ SYM_FUNC_START(__tdx_hypercall) push %r13 push %r12 push %rbx - push %rbp /* Free RDI and RSI to be used as TDVMCALL arguments */ movq %rdi, %rax - movq %rsi, %rbp + push %rsi /* Copy hypercall registers from arg struct: */ movq TDX_HYPERCALL_r8(%rax), %r8
@@ -168,7 +167,7 @@ SYM_FUNC_START(__tdx_hypercall) * HLT operation indefinitely. Since this is the not the desired * result, conditionally call STI before TDCALL. */ - testq $TDX_HCALL_ISSUE_STI, %rbp + testq $TDX_HCALL_ISSUE_STI, 8(%rsp) jz .Lskip_sti sti .Lskip_sti:
@@ -188,7 +187,7 @@ SYM_FUNC_START(__tdx_hypercall) pop %rax /* Copy hypercall result registers to arg struct if needed */ - testq $TDX_HCALL_HAS_OUTPUT, %rbp + testq $TDX_HCALL_HAS_OUTPUT, (%rsp) jz .Lout movq %r8, TDX_HYPERCALL_r8(%rax)
@@ -218,11 +217,12 @@ SYM_FUNC_START(__tdx_hypercall) xor %r10d, %r10d xor %r11d, %r11d xor %rdi, %rdi - xor %rsi, %rsi xor %rdx, %rdx + /* Remove TDX_HCALL_* flags from the stack */ + pop %rsi + /* Restore callee-saved GPRs as mandated by the x86_64 ABI */ - pop %rbp pop %rbx pop %r12 pop %r13