From: Nathan Chancellor <nathan@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org,
Josh Poimboeuf <jpoimboe@kernel.org>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
x86@kernel.org
Subject: Re: [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't used at runtime
Date: Wed, 14 Feb 2024 20:20:49 -0700 [thread overview]
Message-ID: <20240215032049.GA3944823@dev-arch.thelio-3990X> (raw)
In-Reply-To: <170774721951.398.8999401565129728535.tip-bot2@tip-bot2>
On Mon, Feb 12, 2024 at 02:13:39PM -0000, tip-bot2 for Josh Poimboeuf wrote:
> The following commit has been merged into the x86/bugs branch of tip:
>
> Commit-ID: 4461438a8405e800f90e0e40409e5f3d07eed381
> Gitweb: https://git.kernel.org/tip/4461438a8405e800f90e0e40409e5f3d07eed381
> Author: Josh Poimboeuf <jpoimboe@kernel.org>
> AuthorDate: Wed, 03 Jan 2024 19:36:26 +01:00
> Committer: Borislav Petkov (AMD) <bp@alien8.de>
> CommitterDate: Mon, 12 Feb 2024 11:42:15 +01:00
>
> x86/retpoline: Ensure default return thunk isn't used at runtime
>
> Make sure the default return thunk is not used after all return
> instructions have been patched by the alternatives because the default
> return thunk is insufficient when it comes to mitigating Retbleed or
> SRSO.
>
> Fix based on an earlier version by David Kaplan <david.kaplan@amd.com>.
>
> [ bp: Fix the compilation error of warn_thunk_thunk being an invisible
> symbol, hoist thunk macro into calling.h ]
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Co-developed-by: Borislav Petkov (AMD) <bp@alien8.de>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> Link: https://lore.kernel.org/r/20231010171020.462211-4-david.kaplan@amd.com
> Link: https://lore.kernel.org/r/20240104132446.GEZZaxnrIgIyat0pqf@fat_crate.local
This warning is now getting triggered for me in some of my builds,
specifically from Alpine Linux's configuration. A minimal reproducer on
top of defconfig:
$ echo 'CONFIG_X86_KERNEL_IBT=n
CONFIG_UNWINDER_ORC=n
CONFIG_UNWINDER_FRAME_POINTER=y' >arch/x86/configs/repro.config
$ make -skj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux- mrproper defconfig repro.config bzImage
$ qemu-system-x86_64 \
-display none \
-nodefaults \
-d unimp,guest_errors \
-append 'console=ttyS0 earlycon=uart8250,io,0x3f8' \
-kernel arch/x86/boot/bzImage \
-initrd rootfs.cpio \
-cpu host \
-enable-kvm \
-m 512m \
-smp 2 \
-serial mon:stdio
[ 0.000000] Linux version 6.7.0-01738-g4461438a8405-dirty (nathan@dev-arch.thelio-3990X) (x86_64-linux-gcc (GCC) 13.2.0, GNU ld (GNU Binutils) 2.41) #1 SMP PREEMPT_DYNAMIC Wed Feb 14 20:14:55 MST 2024
...
[ 0.337317] ------------[ cut here ]------------
[ 0.338282] Unpatched return thunk in use. This should not happen!
[ 0.339292] WARNING: CPU: 0 PID: 1 at arch/x86/kernel/cpu/bugs.c:2856 __warn_thunk+0x27/0x40
[ 0.340284] Modules linked in:
[ 0.341021] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.7.0-01738-g4461438a8405-dirty #1
[ 0.341281] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
[ 0.342281] RIP: 0010:__warn_thunk+0x27/0x40
[ 0.343281] Code: 90 90 90 80 3d 22 20 c3 01 00 74 05 e9 32 a5 eb 00 55 c6 05 13 20 c3 01 01 48 89 e5 90 48 c7 c7 80 80 50 89 e8 6a c4 03 00 90 <0f> 0b 90 90 5d e9 0f a5 eb 00 cc cc cc cc cc cc cc cc cc cc cc cc
[ 0.344286] RSP: 0018:ffff8ba9c0013e10 EFLAGS: 00010286
[ 0.345281] RAX: 0000000000000000 RBX: ffffffff89afba70 RCX: 0000000000000000
[ 0.346281] RDX: 0000000000000000 RSI: 00000000ffffdfff RDI: 0000000000000001
[ 0.347282] RBP: ffff8ba9c0013e10 R08: 00000000ffffdfff R09: ffff8ba9c0013c88
[ 0.348282] R10: 0000000000000001 R11: ffffffff89856ae0 R12: 0000000000000000
[ 0.349282] R13: ffff88c101126ac0 R14: ffff8ba9c0013e78 R15: 0000000000000000
[ 0.350285] FS: 0000000000000000(0000) GS:ffff88c11f000000(0000) knlGS:0000000000000000
[ 0.351283] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 0.352282] CR2: ffff88c119601000 CR3: 0000000018e2c000 CR4: 0000000000350ef0
[ 0.353284] Call Trace:
[ 0.354281] <TASK>
[ 0.355281] ? show_regs+0x60/0x70
[ 0.356281] ? __warn+0x84/0x150
[ 0.357281] ? __warn_thunk+0x27/0x40
[ 0.358281] ? report_bug+0x16d/0x1a0
[ 0.359088] ? console_unlock+0x4f/0xe0
[ 0.359281] ? handle_bug+0x43/0x80
[ 0.360228] ? exc_invalid_op+0x18/0x70
[ 0.360281] ? asm_exc_invalid_op+0x1b/0x20
[ 0.361282] ? ia32_binfmt_init+0x40/0x40
[ 0.362283] ? __warn_thunk+0x27/0x40
[ 0.363283] warn_thunk_thunk+0x16/0x30
[ 0.364283] do_one_initcall+0x59/0x230
[ 0.365284] kernel_init_freeable+0x1a4/0x2e0
[ 0.366248] ? __pfx_kernel_init+0x10/0x10
[ 0.366282] kernel_init+0x15/0x1b0
[ 0.367200] ret_from_fork+0x38/0x60
[ 0.367280] ? __pfx_kernel_init+0x10/0x10
[ 0.368175] ret_from_fork_asm+0x1b/0x30
[ 0.368285] </TASK>
[ 0.369280] ---[ end trace 0000000000000000 ]---
...
If there is any more information I can provide or patches I can test, I
am more than happy to do so.
Cheers,
Nathan
# bad: [2c3b09aac00d7835023bbc4473ee06696be64fa8] Add linux-next specific files for 20240214
# good: [7e90b5c295ec1e47c8ad865429f046970c549a66] Merge tag 'trace-tools-v6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
git bisect start '2c3b09aac00d7835023bbc4473ee06696be64fa8' '7e90b5c295ec1e47c8ad865429f046970c549a66'
# good: [a4f281576352365d7c83d9a2ff46c0430c8d6f1d] Merge branch 'main' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
git bisect good a4f281576352365d7c83d9a2ff46c0430c8d6f1d
# good: [2b837601fcd12acc492699f9148ca20a41d76b5d] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
git bisect good 2b837601fcd12acc492699f9148ca20a41d76b5d
# bad: [4b0fab17a40c71b1202109cca7ab4854722f6fee] Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
git bisect bad 4b0fab17a40c71b1202109cca7ab4854722f6fee
# bad: [09e1b07412d3a47f343acd2ab2459af3034e028b] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git bisect bad 09e1b07412d3a47f343acd2ab2459af3034e028b
# good: [2208f1364f1de82b19313f36e3e4758487183639] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-dt.git
git bisect good 2208f1364f1de82b19313f36e3e4758487183639
# good: [fbbf6ba42cd4bbe1675db713d230fccda1183a47] Merge branch into tip/master: 'timers/ptp'
git bisect good fbbf6ba42cd4bbe1675db713d230fccda1183a47
# good: [0da9a7e5c86b003a9b446b30c90eaf96b2e442c2] spi: get rid of some legacy macros
git bisect good 0da9a7e5c86b003a9b446b30c90eaf96b2e442c2
# good: [64ffc035640f3a74205ae57d21fb171a88748b60] Merge branch into tip/master: 'irq/urgent'
git bisect good 64ffc035640f3a74205ae57d21fb171a88748b60
# good: [d1ff85fdf0b8f63a6e042ae7559c630f9b1c50e2] spi: pl022: Use typedef for dma_filter_fn
git bisect good d1ff85fdf0b8f63a6e042ae7559c630f9b1c50e2
# bad: [743a9723b476831c7910e6e15a714a713ab5989f] Merge branch into tip/master: 'x86/bugs'
git bisect bad 743a9723b476831c7910e6e15a714a713ab5989f
# good: [ee4c1592b7e9a5bf89b962d7afd7e9b04c8d16ee] irqchip/gic-v3-its: Remove usage of the deprecated ida_simple_xx() API
git bisect good ee4c1592b7e9a5bf89b962d7afd7e9b04c8d16ee
# good: [850d0fd76557fa4ad2d389a7d380f8a40043f874] Merge branch into tip/master: 'x86/urgent'
git bisect good 850d0fd76557fa4ad2d389a7d380f8a40043f874
# bad: [4461438a8405e800f90e0e40409e5f3d07eed381] x86/retpoline: Ensure default return thunk isn't used at runtime
git bisect bad 4461438a8405e800f90e0e40409e5f3d07eed381
# first bad commit: [4461438a8405e800f90e0e40409e5f3d07eed381] x86/retpoline: Ensure default return thunk isn't used at runtime
next prev parent reply other threads:[~2024-02-15 3:20 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 17:10 [PATCH 0/3] Ensure default return thunk isn't used at runtime David Kaplan
2023-10-10 17:10 ` [PATCH 1/3] Revert "x86/retpoline: Remove .text..__x86.return_thunk section" David Kaplan
2023-10-10 17:48 ` Peter Zijlstra
2023-10-10 19:57 ` Josh Poimboeuf
2023-10-10 20:04 ` Borislav Petkov
2023-10-10 20:19 ` Josh Poimboeuf
2023-10-10 20:40 ` Kaplan, David
2023-10-10 21:22 ` Josh Poimboeuf
2023-10-11 7:41 ` Peter Zijlstra
2023-10-11 9:34 ` Borislav Petkov
2023-10-11 16:28 ` Josh Poimboeuf
2023-10-11 22:35 ` Peter Zijlstra
2023-10-11 22:42 ` Ingo Molnar
2023-10-12 2:27 ` Josh Poimboeuf
2023-10-12 2:47 ` [PATCH v2] objtool: Fix return thunk patching in retpolines Josh Poimboeuf
2023-10-12 6:25 ` [tip: x86/bugs] " tip-bot2 for Josh Poimboeuf
2023-10-12 8:16 ` [PATCH v2] " Peter Zijlstra
2023-10-12 17:50 ` [tip: x86/bugs] " tip-bot2 for Josh Poimboeuf
2023-10-20 11:37 ` tip-bot2 for Josh Poimboeuf
2023-10-12 8:16 ` [PATCH 1/3] Revert "x86/retpoline: Remove .text..__x86.return_thunk section" Peter Zijlstra
2023-10-10 17:10 ` [PATCH 2/3] x86/vdso: Run objtool on vdso32-setup David Kaplan
2023-10-12 17:50 ` [tip: x86/bugs] x86/vdso: Run objtool on vdso32-setup.o tip-bot2 for David Kaplan
2023-10-20 11:37 ` tip-bot2 for David Kaplan
2023-10-10 17:10 ` [PATCH 3/3] x86/retpoline: Ensure default return thunk isn't used at runtime David Kaplan
2023-10-10 19:36 ` Josh Poimboeuf
2023-10-10 20:14 ` Kaplan, David
2023-10-10 20:41 ` Josh Poimboeuf
2023-10-12 14:10 ` [PATCH -v2] " Borislav Petkov
2023-10-12 17:11 ` Josh Poimboeuf
2023-10-12 17:50 ` [tip: x86/bugs] " tip-bot2 for David Kaplan
2023-10-16 21:10 ` Nathan Chancellor
2023-10-16 21:29 ` Borislav Petkov
2023-10-16 21:48 ` Nathan Chancellor
2023-10-17 4:31 ` Kaplan, David
2023-10-17 5:28 ` Josh Poimboeuf
2023-10-17 13:54 ` Kaplan, David
2023-10-17 15:24 ` Nick Desaulniers
2023-10-17 15:26 ` Marco Elver
2023-10-17 15:32 ` Nathan Chancellor
2023-10-17 16:59 ` [PATCH] x86/srso: Fix panic in return thunk during boot Josh Poimboeuf
2023-10-17 17:52 ` [tip: x86/bugs] x86/retpoline: Make sure there are no unconverted return thunks due to KCSAN tip-bot2 for Josh Poimboeuf
2023-10-20 11:37 ` tip-bot2 for Josh Poimboeuf
2023-10-18 13:23 ` [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't used at runtime Borislav Petkov
2023-10-18 13:38 ` Ingo Molnar
2023-10-18 15:12 ` Borislav Petkov
2023-10-18 15:54 ` Josh Poimboeuf
2023-10-18 17:55 ` Borislav Petkov
2023-10-18 18:14 ` Josh Poimboeuf
2023-10-18 18:22 ` Borislav Petkov
2023-10-18 18:39 ` Josh Poimboeuf
2023-10-18 18:44 ` Borislav Petkov
2023-10-18 19:14 ` Josh Poimboeuf
2023-10-18 20:04 ` Borislav Petkov
2023-10-18 20:37 ` Borislav Petkov
2023-10-19 6:35 ` Josh Poimboeuf
2023-10-19 6:59 ` Josh Poimboeuf
2023-10-19 14:15 ` Borislav Petkov
2023-10-19 14:21 ` Kaplan, David
2023-10-19 14:39 ` Borislav Petkov
2023-10-19 15:20 ` Josh Poimboeuf
2023-10-24 20:19 ` Borislav Petkov
2024-01-03 18:46 ` Borislav Petkov
2024-01-04 13:12 ` Borislav Petkov
2024-01-04 13:24 ` [PATCH -v2] " Borislav Petkov
2024-01-04 13:26 ` Borislav Petkov
2024-02-07 17:50 ` Josh Poimboeuf
2024-02-07 18:53 ` Borislav Petkov
2024-02-07 19:49 ` Josh Poimboeuf
2024-02-12 10:43 ` Borislav Petkov
2024-04-03 17:10 ` Klara Modin
2024-04-03 17:30 ` Borislav Petkov
2024-04-03 20:26 ` Klara Modin
2024-04-03 20:41 ` Borislav Petkov
2024-04-03 22:25 ` Klara Modin
2024-04-04 14:44 ` Borislav Petkov
2024-04-16 9:27 ` Borislav Petkov
2024-04-17 3:59 ` Klara Modin
2024-04-17 16:20 ` [tip: x86/urgent] x86/retpolines: Enable the default thunk warning only on relevant configs tip-bot2 for Borislav Petkov (AMD)
2023-10-19 7:43 ` [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't used at runtime Peter Zijlstra
2023-10-19 9:40 ` [tip: x86/bugs] Revert "x86/retpoline: Remove .text..__x86.return_thunk section" tip-bot2 for Borislav Petkov (AMD)
2023-10-19 9:40 ` [tip: x86/bugs] Revert "x86/retpoline: Ensure default return thunk isn't used at runtime" tip-bot2 for Borislav Petkov (AMD)
2024-10-04 19:37 ` Peter Zijlstra
2024-02-12 14:13 ` [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't used at runtime tip-bot2 for Josh Poimboeuf
2024-02-15 3:20 ` Nathan Chancellor [this message]
2024-02-15 8:30 ` Nikolay Borisov
2024-02-15 15:53 ` Borislav Petkov
2024-02-16 5:42 ` Josh Poimboeuf
2024-02-16 21:27 ` Borislav Petkov
2024-02-20 5:57 ` [PATCH] x86/vdso: Fix rethunk patching for vdso-image-{32,64}.o Josh Poimboeuf
2024-02-20 12:31 ` [tip: x86/core] " tip-bot2 for Josh Poimboeuf
2023-10-10 17:52 ` [PATCH 0/3] Ensure default return thunk isn't used at runtime Peter Zijlstra
2023-10-20 11:28 ` Subject: [PATCH] x86/retpoline: Document some thunk handling aspects (was: Re: [PATCH 0/3] Ensure default return thunk isn't used at runtime) Borislav Petkov
2023-10-20 11:37 ` [tip: x86/bugs] x86/retpoline: Document some thunk handling aspects tip-bot2 for Borislav Petkov (AMD)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240215032049.GA3944823@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=bp@alien8.de \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox