5.19.1-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 5.19.1-rc1 review
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 11 Aug 2022 17:55:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.1-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.19.1-rc1
Pawan Gupta <[email protected]>
x86/speculation: Add LFENCE to RSB fill sequence
Daniel Sneddon <[email protected]>
x86/speculation: Add RSB VM Exit protections
Ning Qiang <[email protected]>
macintosh/adb: fix oob read in do_adb_query() function
Hilda Wu <[email protected]>
Bluetooth: btusb: Add Realtek RTL8852C support ID 0x13D3:0x3586
Hilda Wu <[email protected]>
Bluetooth: btusb: Add Realtek RTL8852C support ID 0x13D3:0x3587
Hilda Wu <[email protected]>
Bluetooth: btusb: Add Realtek RTL8852C support ID 0x0CB8:0xC558
Hilda Wu <[email protected]>
Bluetooth: btusb: Add Realtek RTL8852C support ID 0x04C5:0x1675
Hilda Wu <[email protected]>
Bluetooth: btusb: Add Realtek RTL8852C support ID 0x04CA:0x4007
Aaron Ma <[email protected]>
Bluetooth: btusb: Add support of IMC Networks PID 0x3568
Ahmad Fatoum <[email protected]>
dt-bindings: bluetooth: broadcom: Add BCM4349B1 DT binding
Hakan Jansson <[email protected]>
Bluetooth: hci_bcm: Add DT compatible for CYW55572
Ahmad Fatoum <[email protected]>
Bluetooth: hci_bcm: Add BCM4349B1 variant
Sai Teja Aluvala <[email protected]>
Bluetooth: hci_qca: Return wakeup for qca_wakeup
Peter Collingbourne <[email protected]>
arm64: set UXN on swapper page tables
Andrew Lunn <[email protected]>
ata: sata_mv: Fixes expected number of resources now IRQs are gone
GUO Zihua <[email protected]>
crypto: arm64/poly1305 - fix a read out-of-bound
Tony Luck <[email protected]>
ACPI: APEI: Better fix to avoid spamming the console with old error logs
Werner Sembach <[email protected]>
ACPI: video: Shortening quirk list by identifying Clevo by board_name only
Werner Sembach <[email protected]>
ACPI: video: Force backlight native for some TongFang devices
Stéphane Graber <[email protected]>
tools/vm/slabinfo: Handle files in debugfs
Jan Kara <[email protected]>
block: fix default IO priority handling again
-------------
Diffstat:
Documentation/admin-guide/hw-vuln/spectre.rst | 8 ++ .../bindings/net/broadcom-bluetooth.yaml | 1 + Makefile | 4 +- arch/arm64/crypto/poly1305-glue.c | 2 +- arch/arm64/include/asm/kernel-pgtable.h | 4 +- arch/arm64/kernel/head.S | 2 +- arch/x86/include/asm/cpufeatures.h | 2 + arch/x86/include/asm/msr-index.h | 4 + arch/x86/include/asm/nospec-branch.h | 21 +++++- arch/x86/kernel/cpu/bugs.c | 86 ++++++++++++++++------ arch/x86/kernel/cpu/common.c | 12 ++- arch/x86/kvm/vmx/vmenter.S | 8 +- block/blk-ioc.c | 2 + block/ioprio.c | 4 +- drivers/acpi/apei/bert.c | 31 ++++++-- drivers/acpi/video_detect.c | 55 +++++++++----- drivers/ata/sata_mv.c | 2 +- drivers/bluetooth/btbcm.c | 2 + drivers/bluetooth/btusb.c | 15 ++++ drivers/bluetooth/hci_bcm.c | 2 + drivers/bluetooth/hci_qca.c | 2 +- drivers/macintosh/adb.c | 2 +- include/linux/ioprio.h | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 1 + tools/arch/x86/include/asm/msr-index.h | 4 + tools/vm/slabinfo.c | 26 ++++++- 26 files changed, 232 insertions(+), 72 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/21 block: fix default IO priority handling again
From: Jan Kara <[email protected]>
commit e589f46445960c274cc813a1cc8e2fc73b2a1849 upstream.
Commit e70344c05995 ("block: fix default IO priority handling") introduced an inconsistency in get_current_ioprio() that tasks without IO context return IOPRIO_DEFAULT priority while tasks with freshly allocated IO context will return 0 (IOPRIO_CLASS_NONE/0) IO priority. Tasks without IO context used to be rare before 5a9d041ba2f6 ("block:
move io_context creation into where it's needed") but after this commit they became common because now only BFQ IO scheduler setups task's IO context. Similar inconsistency is there for get_task_ioprio() so this inconsistency is now exposed to userspace and userspace will see different IO priority for tasks operating on devices with BFQ compared to devices without BFQ. Furthemore the changes done by commit e70344c05995 change the behavior when no IO priority is set for BFQ IO scheduler which is also documented in ioprio_set(2) manpage:
"If no I/O scheduler has been set for a thread, then by default the I/O priority will follow the CPU nice value (setpriority(2)). In Linux kernels before version 2.6.24, once an I/O priority had been set using ioprio_set(), there was no way to reset the I/O scheduling behavior to the default. Since Linux 2.6.24, specifying ioprio as 0 can be used to reset to the default I/O scheduling behavior."
So make sure we default to IOPRIO_CLASS_NONE as used to be the case before commit e70344c05995. Also cleanup alloc_io_context() to explicitely set this IO priority for the allocated IO context to avoid future surprises. Note that we tweak ioprio_best() to maintain ioprio_get(2) behavior and make this commit easily backportable.
--- block/blk-ioc.c | 2 ++ block/ioprio.c | 4 ++-- include/linux/ioprio.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
block/blk-ioc.c +2 -0
@@ -247,6 +247,8 @@ static struct io_context *alloc_io_conteINIT_HLIST_HEAD (&ioc->icq_list);INIT_WORK (&ioc->release_work, ioc_release_fn);#endif + ioc->ioprio =IOPRIO_DEFAULT ; +return ioc; }
block/ioprio.c +2 -2
@@ -157,9 +157,9 @@ out:int ioprio_best (unsigned short aprio,unsigned short bprio) {if (!ioprio_valid (aprio)) - aprio =IOPRIO_DEFAULT ; + aprio =IOPRIO_PRIO_VALUE (IOPRIO_CLASS_BE ,IOPRIO_BE_NORM );if (!ioprio_valid (bprio)) - bprio =IOPRIO_DEFAULT ; + bprio =IOPRIO_PRIO_VALUE (IOPRIO_CLASS_BE ,IOPRIO_BE_NORM );return min (aprio, bprio); }
include/linux/ioprio.h +1 -1
@@ -11,7 +11,7 @@/* * Default IO priority. */ -#define IOPRIO_DEFAULT IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_BE_NORM) +#define IOPRIO_DEFAULT IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0)/* * Check that a priority value has a valid class.
Greg Kroah-Hartman
maintainerPATCH 2/21 tools/vm/slabinfo: Handle files in debugfs
In reply to Greg Kroah-HartmanFrom: Stéphane Graber <[email protected]>
commit 0c7e0d699ef1430d7f4cf12b4b1d097af58b5515 upstream.
Commit 64dd68497be76 relocated and renamed the alloc_calls and free_calls files from /sys/kernel/slab/NAME/*_calls over to /sys/kernel/debug/slab/NAME/*_calls but didn't update the slabinfo tool with the new location.
This change will now have slabinfo look at the new location (and filenames) with a fallback to the prior files.
--- tools/vm/slabinfo.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
tools/vm/slabinfo.c +24 -2
@@ -233,6 +233,24 @@ static unsigned long read_slab_obj(strucreturn l; } +static unsigned long read_debug_slab_obj (struct slabinfo *s,const char *name) +{ +char x[128 ]; +FILE *f; +size_t l; + +snprintf (x,128 ,"/sys/kernel/debug/slab/%s/%s" , s->name, name); + f =fopen (x,"r" ); +if (!f) { + buffer[0 ] =0 ; + l =0 ; + }else { + l =fread (buffer,1 ,sizeof (buffer), f); + buffer[l] =0 ; +fclose (f); + } +return l; +}/* * Put a size string together
@@ -409,14 +427,18 @@ static void show_tracking(struct slabinf {printf ("\n%s: Kernel object allocation\n" , s->name);printf ("-----------------------------------------------------------------------\n" ); -if (read_slab_obj (s,"alloc_calls" )) +if (read_debug_slab_obj (s,"alloc_traces" )) +printf ("%s" , buffer); +else if (read_slab_obj (s,"alloc_calls" ))printf ("%s" , buffer);else printf ("No Data\n" );printf ("\n%s: Kernel object freeing\n" , s->name);printf ("------------------------------------------------------------------------\n" ); -if (read_slab_obj (s,"free_calls" )) +if (read_debug_slab_obj (s,"free_traces" )) +printf ("%s" , buffer); +else if (read_slab_obj (s,"free_calls" ))printf ("%s" , buffer);else printf ("No Data\n" );
Greg Kroah-Hartman
maintainerPATCH 3/21 ACPI: video: Force backlight native for some TongFang devices
In reply to Greg Kroah-HartmanFrom: Werner Sembach <[email protected]>
commit c752089f7cf5b5800c6ace4cdd1a8351ee78a598 upstream.
The TongFang PF5PU1G, PF4NU1F, PF5NU1G, and PF5LUXG/TUXEDO BA15 Gen10, Pulse 14/15 Gen1, and Pulse 15 Gen2 have the same problem as the Clevo NL5xRU and NL5xNU/TUXEDO Aura 15 Gen1 and Gen2:
They have a working native and video interface. However the default detection mechanism first registers the video interface before unregistering it again and switching to the native interface during boot. This results in a dangling SBIOS request for backlight change for some reason, causing the backlight to switch to ~2% once per boot on the first power cord connect or disconnect event. Setting the native interface explicitly circumvents this buggy behaviour by avoiding the unregistering process.
--- drivers/acpi/video_detect.c | 51 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-)
drivers/acpi/video_detect.c +50 -1
@@ -490,7 +490,56 @@ static const struct dmi_system_id video_ DMI_MATCH(DMI_BOARD_NAME, "NL5xNU"), }, }, - +/* +* The TongFang PF5PU1G, PF4NU1F, PF5NU1G, and PF5LUXG/TUXEDO BA15 Gen10, +* Pulse 14/15 Gen1, and Pulse 15 Gen2 have the same problem as the Clevo +* NL5xRU and NL5xNU/TUXEDO Aura 15 Gen1 and Gen2. See the description +* above. +*/ + { + .callback = video_detect_force_native, + .ident = "TongFang PF5PU1G", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "PF5PU1G"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF4NU1F", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "PF4NU1F"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF4NU1F", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + DMI_MATCH(DMI_BOARD_NAME, "PULSE1401"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF5NU1G", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "PF5NU1G"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF5NU1G", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + DMI_MATCH(DMI_BOARD_NAME, "PULSE1501"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF5LUXG", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "PF5LUXG"), + }, + }, /* * Desktops which falsely report a backlight and which our heuristics * for this do not catch.
Greg Kroah-Hartman
maintainerPATCH 4/21 ACPI: video: Shortening quirk list by identifying Clevo by board_name only
In reply to Greg Kroah-HartmanFrom: Werner Sembach <[email protected]>
commit f0341e67b3782603737f7788e71bd3530012a4f4 upstream.
Taking a recent change in the i8042 quirklist to this one: Clevo board_names are somewhat unique, and if not: The generic Board_-/Sys_Vendor string "Notebook" doesn't help much anyway. So identifying the devices just by the board_name helps keeping the list significantly shorter and might even hit more devices requiring the fix.
--- drivers/acpi/video_detect.c | 34 ---------------------------------- 1 file changed, 34 deletions(-)
drivers/acpi/video_detect.c +0 -34
@@ -430,23 +430,6 @@ static const struct dmi_system_id video_ .callback = video_detect_force_native, .ident = "Clevo NL5xRU", .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), - DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"), - }, - }, - { - .callback = video_detect_force_native, - .ident = "Clevo NL5xRU", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"SchenkerTechnologiesGmbH" ), - DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"), - }, - }, - { - .callback = video_detect_force_native, - .ident = "Clevo NL5xRU", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Notebook" ), DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"), }, },
@@ -470,23 +453,6 @@ static const struct dmi_system_id video_ .callback = video_detect_force_native, .ident = "Clevo NL5xNU", .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), - DMI_MATCH(DMI_BOARD_NAME, "NL5xNU"), - }, - }, - { - .callback = video_detect_force_native, - .ident = "Clevo NL5xNU", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"SchenkerTechnologiesGmbH" ), - DMI_MATCH(DMI_BOARD_NAME, "NL5xNU"), - }, - }, - { - .callback = video_detect_force_native, - .ident = "Clevo NL5xNU", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Notebook" ), DMI_MATCH(DMI_BOARD_NAME, "NL5xNU"), }, },
Greg Kroah-Hartman
maintainerPATCH 5/21 ACPI: APEI: Better fix to avoid spamming the console with old error logs
In reply to Greg Kroah-HartmanFrom: Tony Luck <[email protected]>
commit c3481b6b75b4797657838f44028fd28226ab48e0 upstream.
The fix in commit 3f8dec116210 ("ACPI/APEI: Limit printable size of BERT table data") does not work as intended on systems where the BIOS has a fixed size block of memory for the BERT table, relying on s/w to quit when it finds a record with estatus->block_status == 0. On these systems all errors are suppressed because the check:
if (region_len < ACPI_BERT_PRINT_MAX_LEN)
always fails.
New scheme skips individual CPER records that are too large, and also limits the total number of records that will be printed to 5.
--- drivers/acpi/apei/bert.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
drivers/acpi/apei/bert.c +23 -8
@@ -29,16 +29,26 @@#undef pr_fmt#define pr_fmt (fmt) "BERT: " fmt + +#define ACPI_BERT_PRINT_MAX_RECORDS 5#define ACPI_BERT_PRINT_MAX_LEN 1024static int bert_disable; +/* +* Print "all" the error records in the BERT table, but avoid huge spam to +* the console if the BIOS included oversize records, or too many records. +* Skipping some records here does not lose anything because the full +* data is available to user tools in: +* /sys/firmware/acpi/tables/data/BERT +*/ static void __init bert_print_all (struct acpi_bert_region *region,unsigned int region_len) {struct acpi_hest_generic_status *estatus = (struct acpi_hest_generic_status *)region;int remain = region_len; +int printed =0 , skipped =0 ;u32 estatus_len;while (remain >=sizeof (struct acpi_bert_region )) {
@@ -46,24 +56,26 @@ static void __init bert_print_all(structif (remain < estatus_len) {pr_err (FW_BUG "Truncated status block (length: %u).\n" , estatus_len); -return ; +break ; }/* No more error records. */ if (!estatus->block_status) -return ; +break ;if (cper_estatus_check (estatus)) {pr_err (FW_BUG "Invalid error record.\n" ); -return ; +break ; } -pr_info_once ("Error records from previous boot:\n" ); -if (region_len <ACPI_BERT_PRINT_MAX_LEN ) +if (estatus_len <ACPI_BERT_PRINT_MAX_LEN && + printed <ACPI_BERT_PRINT_MAX_RECORDS ) { +pr_info_once ("Error records from previous boot:\n" ); cper_estatus_print(KERN_INFO HW_ERR, estatus); -else -pr_info_once ("Max print length exceeded, table data is available at:\n" -"/sys/firmware/acpi/tables/data/BERT" ); + printed++; + }else { + skipped++; + }/* * Because the boot error source is "one-time polled" type,
@@ -75,6 +87,9 @@ static void __init bert_print_all(struct estatus = (void *)estatus + estatus_len; remain -= estatus_len; } + +if (skipped) +pr_info (HW_ERR "Skipped %d error records\n" , skipped); }static int __init setup_bert_disable (char *str)
Greg Kroah-Hartman
maintainerPATCH 6/21 crypto: arm64/poly1305 - fix a read out-of-bound
In reply to Greg Kroah-HartmanFrom: GUO Zihua <[email protected]>
commit 7ae19d422c7da84b5f13bc08b98bd737a08d3a53 upstream.
A kasan error was reported during fuzzing:
BUG: KASAN: slab-out-of-bounds in neon_poly1305_blocks.constprop.0+0x1b4/0x250 [poly1305_neon] Read of size 4 at addr ffff0010e293f010 by task syz-executor.5/1646715 CPU: 4 PID: 1646715 Comm: syz-executor.5 Kdump: loaded Not tainted 5.10.0.aarch64 #1 Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.59 01/31/2019 Call trace: dump_backtrace+0x0/0x394 show_stack+0x34/0x4c arch/arm64/kernel/stacktrace.c:196 __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x158/0x1e4 lib/dump_stack.c:118 print_address_description.constprop.0+0x68/0x204 mm/kasan/report.c:387 __kasan_report+0xe0/0x140 mm/kasan/report.c:547 kasan_report+0x44/0xe0 mm/kasan/report.c:564 check_memory_region_inline mm/kasan/generic.c:187 [inline] __asan_load4+0x94/0xd0 mm/kasan/generic.c:252 neon_poly1305_blocks.constprop.0+0x1b4/0x250 [poly1305_neon] neon_poly1305_do_update+0x6c/0x15c [poly1305_neon] neon_poly1305_update+0x9c/0x1c4 [poly1305_neon] crypto_shash_update crypto/shash.c:131 [inline] shash_finup_unaligned+0x84/0x15c crypto/shash.c:179 crypto_shash_finup+0x8c/0x140 crypto/shash.c:193 shash_digest_unaligned+0xb8/0xe4 crypto/shash.c:201 crypto_shash_digest+0xa4/0xfc crypto/shash.c:217 crypto_shash_tfm_digest+0xb4/0x150 crypto/shash.c:229 essiv_skcipher_setkey+0x164/0x200 [essiv] crypto_skcipher_setkey+0xb0/0x160 crypto/skcipher.c:612 skcipher_setkey+0x3c/0x50 crypto/algif_skcipher.c:305 alg_setkey+0x114/0x2a0 crypto/af_alg.c:220 alg_setsockopt+0x19c/0x210 crypto/af_alg.c:253 __sys_setsockopt+0x190/0x2e0 net/socket.c:2123 __do_sys_setsockopt net/socket.c:2134 [inline] __se_sys_setsockopt net/socket.c:2131 [inline] __arm64_sys_setsockopt+0x78/0x94 net/socket.c:2131 __invoke_syscall arch/arm64/kernel/syscall.c:36 [inline] invoke_syscall+0x64/0x100 arch/arm64/kernel/syscall.c:48 el0_svc_common.constprop.0+0x220/0x230 arch/arm64/kernel/syscall.c:155 do_el0_svc+0xb4/0xd4 arch/arm64/kernel/syscall.c:217 el0_svc+0x24/0x3c arch/arm64/kernel/entry-common.c:353 el0_sync_handler+0x160/0x164 arch/arm64/kernel/entry-common.c:369 el0_sync+0x160/0x180 arch/arm64/kernel/entry.S:683
This error can be reproduced by the following code compiled as ko on a system with kasan enabled:
#include <linux/module.h>
#include <linux/crypto.h>
#include <crypto/hash.h>
#include <crypto/poly1305.h>
char test_data[] = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13\x14\x15\x16\x17"
"\x18\x19\x1a\x1b\x1c\x1d\x1e";int init(void)
{
struct crypto_shash *tfm = NULL;
char *data = NULL, *out = NULL;
tfm = crypto_alloc_shash("poly1305", 0, 0);
data = kmalloc(POLY1305_KEY_SIZE - 1, GFP_KERNEL);
out = kmalloc(POLY1305_DIGEST_SIZE, GFP_KERNEL);
memcpy(data, test_data, POLY1305_KEY_SIZE - 1);
crypto_shash_tfm_digest(tfm, data, POLY1305_KEY_SIZE - 1, out);
kfree(data);
kfree(out);
return 0;
}void deinit(void)
{
}
module_init(init)module_exit(deinit)MODULE_LICENSE("GPL");
The root cause of the bug sits in neon_poly1305_blocks. The logic neon_poly1305_blocks() performed is that if it was called with both s[] and r[] uninitialized, it will first try to initialize them with the data from the first "block" that it believed to be 32 bytes in length. First 16 bytes are used as the key and the next 16 bytes for s[]. This would lead to the aforementioned read out-of-bound. However, after calling poly1305_init_arch(), only 16 bytes were deducted from the input and s[] is initialized yet again with the following 16 bytes. The second initialization of s[] is certainly redundent which indicates that the first initialization should be for r[] only.
This patch fixes the issue by calling poly1305_init_arm64() instead of poly1305_init_arch(). This is also the implementation for the same algorithm on arm platform.
--- arch/arm64/crypto/poly1305-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/crypto/poly1305-glue.c +1 -1
@@ -52,7 +52,7 @@ static void neon_poly1305_blocks(struct {if (unlikely (!dctx->sset)) {if (!dctx->rset) { -poly1305_init_arch (dctx, src); +poly1305_init_arm64 (&dctx->h, src); src +=POLY1305_BLOCK_SIZE ; len -=POLY1305_BLOCK_SIZE ; dctx->rset =1 ;
Greg Kroah-Hartman
maintainerPATCH 7/21 ata: sata_mv: Fixes expected number of resources now IRQs are gone
In reply to Greg Kroah-HartmanFrom: Andrew Lunn <[email protected]>
commit b3b2bec9646eb1d3f43c85f6d0d2211d6f8af42b upstream.
The commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core") stopped IRQ resources being available as platform resources. This broke the sanity check for the expected number of resources in the Marvell SATA driver which expected two resources, the IO memory and the interrupt.
Change the sanity check to only expect the IO memory.
--- drivers/ata/sata_mv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/sata_mv.c +1 -1
@@ -4057,7 +4057,7 @@ static int mv_platform_probe(struct plat/* * Simple resource validation .. */ -if (unlikely (pdev->num_resources !=2 )) { +if (unlikely (pdev->num_resources !=1 )) {dev_err (&pdev->dev,"invalid number of resources\n" );return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 8/21 arm64: set UXN on swapper page tables
In reply to Greg Kroah-HartmanFrom: Peter Collingbourne <[email protected]>
[ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
head: cover entire kernel image in initial ID map") as part of a large refactoring of the arm64 boot flow. This simple fix is therefore preferred for -stable backporting ]
On a system that implements FEAT_EPAN, read/write access to the idmap is denied because UXN is not set on the swapper PTEs. As a result, idmap_kpti_install_ng_mappings panics the kernel when accessing __idmap_kpti_flag. Fix it by setting UXN on these PTEs.
--- arch/arm64/include/asm/kernel-pgtable.h | 4 ++-- arch/arm64/kernel/head.S | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kernel-pgtable.h +2 -2
@@ -103,8 +103,8 @@/* * Initial memory map attributes. */ -#define SWAPPER_PTE_FLAGS (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED) -#define SWAPPER_PMD_FLAGS (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S) +#define SWAPPER_PTE_FLAGS (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED | PTE_UXN) +#define SWAPPER_PMD_FLAGS (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S | PMD_SECT_UXN)#if ARM64_KERNEL_USES_PMD_MAPS #define SWAPPER_MM_MMUFLAGS (PMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS)
arch/arm64/kernel/head.S +1 -1
@@ -285,7 +285,7 @@ SYM_FUNC_START_LOCAL(__create_page_table subs x1, x1, #64 b.ne 1b - mov x7, SWAPPER_MM_MMUFLAGS + mov_q x7, SWAPPER_MM_MMUFLAGS /* * Create the identity mapping.
Greg Kroah-Hartman
maintainerPATCH 9/21 Bluetooth: hci_qca: Return wakeup for qca_wakeup
In reply to Greg Kroah-HartmanFrom: Sai Teja Aluvala <[email protected]>
commit bde63e9effd3a6ba384707c62abe46c32d22f665 upstream.
This fixes the return value of qca_wakeup(), since .wakeup work inversely with original .prevent_wake.
--- drivers/bluetooth/hci_qca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/hci_qca.c +1 -1
@@ -1588,7 +1588,7 @@ static bool qca_wakeup(struct hci_dev *h wakeup =device_may_wakeup (hu->serdev->ctrl->dev.parent);bt_dev_dbg (hu->hdev,"wakeup status : %d" , wakeup); -return !wakeup; +return wakeup; }static int qca_regulator_init (struct hci_uart *hu)
Greg Kroah-Hartman
maintainerPATCH 10/21 Bluetooth: hci_bcm: Add BCM4349B1 variant
In reply to Greg Kroah-HartmanFrom: Ahmad Fatoum <[email protected]>
commit 4f17c2b6694d0c4098f33b07ee3a696976940aa5 upstream.
The BCM4349B1, aka CYW/BCM89359, is a WiFi+BT chip and its Bluetooth portion can be controlled over serial.
Two subversions are added for the chip, because ROM firmware reports 002.002.013 (at least for the chips I have here), while depending on patchram firmware revision, either 002.002.013 or 002.002.014 is reported.
--- drivers/bluetooth/btbcm.c | 2 ++ drivers/bluetooth/hci_bcm.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/btbcm.c +2 -0
@@ -454,6 +454,8 @@ static const struct bcm_subver_table bcm { 0x6606, "BCM4345C5" }, /* 003.006.006 */ { 0x230f, "BCM4356A2" }, /* 001.003.015 */ { 0x220e, "BCM20702A1" }, /* 001.002.014 */ + { 0x420d, "BCM4349B1" }, /* 002.002.013 */ + { 0x420e, "BCM4349B1" }, /* 002.002.014 */ { 0x4217, "BCM4329B1" }, /* 002.002.023 */ { 0x6106, "BCM4359C0" }, /* 003.001.006 */ { 0x4106, "BCM4335A0" }, /* 002.001.006 */
drivers/bluetooth/hci_bcm.c +1 -0
@@ -1544,6 +1544,7 @@ static const struct of_device_id bcm_blu { .compatible = "brcm,bcm43430a0-bt" }, { .compatible = "brcm,bcm43430a1-bt" }, { .compatible = "brcm,bcm43438-bt", .data = &bcm43438_device_data }, + { .compatible = "brcm,bcm4349-bt", .data = &bcm43438_device_data }, { .compatible = "brcm,bcm43540-bt", .data = &bcm4354_device_data }, { .compatible = "brcm,bcm4335a0" }, { },
Greg Kroah-Hartman
maintainerPATCH 11/21 Bluetooth: hci_bcm: Add DT compatible for CYW55572
In reply to Greg Kroah-HartmanFrom: Hakan Jansson <[email protected]>
commit f8cad62002a7699fd05a23b558b980b5a77defe0 upstream.
CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon.
--- drivers/bluetooth/hci_bcm.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/hci_bcm.c +1 -0
@@ -1547,6 +1547,7 @@ static const struct of_device_id bcm_blu { .compatible = "brcm,bcm4349-bt", .data = &bcm43438_device_data }, { .compatible = "brcm,bcm43540-bt", .data = &bcm4354_device_data }, { .compatible = "brcm,bcm4335a0" }, + { .compatible = "infineon,cyw55572-bt" }, { }, };MODULE_DEVICE_TABLE (of, bcm_bluetooth_of_match);
Greg Kroah-Hartman
maintainerPATCH 12/21 dt-bindings: bluetooth: broadcom: Add BCM4349B1 DT binding
In reply to Greg Kroah-HartmanFrom: Ahmad Fatoum <[email protected]>
commit 88b65887aa1b76cd8649a97824fb9904c1d79254 upstream.
The BCM4349B1, aka CYW/BCM89359, is a WiFi+BT chip and its Bluetooth portion can be controlled over serial.
Extend the binding with its DT compatible.
--- Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +1 -0
@@ -23,6 +23,7 @@ properties: - brcm,bcm4345c5 - brcm,bcm43540-bt - brcm,bcm4335a0 + - brcm,bcm4349-bt shutdown-gpios: maxItems: 1
Greg Kroah-Hartman
maintainerPATCH 13/21 Bluetooth: btusb: Add support of IMC Networks PID 0x3568
In reply to Greg Kroah-HartmanFrom: Aaron Ma <[email protected]>
commit c69ecb0ea4c96b8b191cbaa0b420222a37867655 upstream.
It is 13d3:3568 for MediaTek MT7922 USB Bluetooth chip.
T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=13d3 ProdID=3568 Rev=01.00 S: Manufacturer=MediaTek Inc. S: Product=Wireless_Device S: SerialNumber=... C: #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=125us E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none) E: Ad=0a(O) Atr=03(Int.) MxPS= 64 Ivl=125us E: Ad=8a(I) Atr=03(Int.) MxPS= 64 Ivl=125us
--- drivers/bluetooth/btusb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/btusb.c +3 -0
@@ -477,6 +477,9 @@ static const struct usb_device_id blackl { USB_DEVICE(0x0489, 0xe0d9), .driver_info = BTUSB_MEDIATEK |BTUSB_WIDEBAND_SPEECH | BTUSB_VALID_LE_STATES }, + { USB_DEVICE(0x13d3, 0x3568), .driver_info = BTUSB_MEDIATEK | +BTUSB_WIDEBAND_SPEECH | + BTUSB_VALID_LE_STATES }, /* Additional Realtek 8723AE Bluetooth devices */ { USB_DEVICE(0x0930, 0x021d), .driver_info = BTUSB_REALTEK },
Greg Kroah-Hartman
maintainerPATCH 14/21 Bluetooth: btusb: Add Realtek RTL8852C support ID 0x04CA:0x4007
In reply to Greg Kroah-HartmanFrom: Hilda Wu <[email protected]>
commit c379c96cc221767af9688a5d4758a78eea30883a upstream.
Add the support ID(0x04CA, 0x4007) to usb_device_id table for Realtek RTL8852C.
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=04ca ProdID=4007 Rev= 0.00 S: Manufacturer=Realtek S: Product=Bluetooth Radio S: SerialNumber=00e04c000001 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/bluetooth/btusb.c +4 -0
@@ -427,6 +427,10 @@ static const struct usb_device_id blackl { USB_DEVICE(0x04ca, 0x4006), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + /* Realtek 8852CE Bluetooth devices */ + { USB_DEVICE(0x04ca, 0x4007), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + /* Realtek Bluetooth devices */ { USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01), .driver_info = BTUSB_REALTEK },
Greg Kroah-Hartman
maintainerPATCH 15/21 Bluetooth: btusb: Add Realtek RTL8852C support ID 0x04C5:0x1675
In reply to Greg Kroah-HartmanFrom: Hilda Wu <[email protected]>
commit 893fa8bc9952a36fb682ee12f0a994b5817a36d2 upstream.
Add the support ID(0x04c5, 0x1675) to usb_device_id table for Realtek RTL8852C.
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=04c5 ProdID=1675 Rev= 0.00 S: Manufacturer=Realtek S: Product=Bluetooth Radio S: SerialNumber=00e04c000001 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -430,6 +430,8 @@ static const struct usb_device_id blackl/* Realtek 8852CE Bluetooth devices */ { USB_DEVICE(0x04ca, 0x4007), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x04c5, 0x1675), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH },/* Realtek Bluetooth devices */ { USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01),
Greg Kroah-Hartman
maintainerPATCH 16/21 Bluetooth: btusb: Add Realtek RTL8852C support ID 0x0CB8:0xC558
In reply to Greg Kroah-HartmanFrom: Hilda Wu <[email protected]>
commit 5b75ee37ebb73f58468d4cca172434324af203f1 upstream.
Add the support ID(0x0CB8, 0xC558) to usb_device_id table for Realtek RTL8852C.
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0cb8 ProdID=c558 Rev= 0.00 S: Manufacturer=Realtek S: Product=Bluetooth Radio S: SerialNumber=00e04c000001 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -432,6 +432,8 @@ static const struct usb_device_id blackl BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x04c5, 0x1675), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0cb8, 0xc558), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH },/* Realtek Bluetooth devices */ { USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01),
Greg Kroah-Hartman
maintainerPATCH 17/21 Bluetooth: btusb: Add Realtek RTL8852C support ID 0x13D3:0x3587
In reply to Greg Kroah-HartmanFrom: Hilda Wu <[email protected]>
commit 8f0054dd29373cd877db87751c143610561d549d upstream.
Add the support ID(0x13D3, 0x3587) to usb_device_id table for Realtek RTL8852C.
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=13d3 ProdID=3587 Rev= 0.00 S: Manufacturer=Realtek S: Product=Bluetooth Radio S: SerialNumber=00e04c000001 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -434,6 +434,8 @@ static const struct usb_device_id blackl BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0cb8, 0xc558), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3587), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH },/* Realtek Bluetooth devices */ { USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01),
Greg Kroah-Hartman
maintainerPATCH 18/21 Bluetooth: btusb: Add Realtek RTL8852C support ID 0x13D3:0x3586
In reply to Greg Kroah-HartmanFrom: Hilda Wu <[email protected]>
commit 6ad353dfc8ee3230a5e123c21da50f1b64cc4b39 upstream.
Add the support ID(0x13D3, 0x3586) to usb_device_id table for Realtek RTL8852C.
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=13d3 ProdID=3586 Rev= 0.00 S: Manufacturer=Realtek S: Product=Bluetooth Radio S: SerialNumber=00e04c000001 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -436,6 +436,8 @@ static const struct usb_device_id blackl BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3587), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3586), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH },/* Realtek Bluetooth devices */ { USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01),
Greg Kroah-Hartman
maintainerPATCH 19/21 macintosh/adb: fix oob read in do_adb_query() function
In reply to Greg Kroah-HartmanFrom: Ning Qiang <[email protected]>
commit fd97e4ad6d3b0c9fce3bca8ea8e6969d9ce7423b upstream.
In do_adb_query() function of drivers/macintosh/adb.c, req->data is copied form userland. The parameter "req->data[2]" is missing check, the array size of adb_handler[] is 16, so adb_handler[req->data[2]].original_address and adb_handler[req->data[2]].handler_id will lead to oob read.
--- drivers/macintosh/adb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/adb.c +1 -1
@@ -647,7 +647,7 @@ do_adb_query(struct adb_request *req)switch (req->data[1 ]) {case ADB_QUERY_GETDEVINFO : -if (req->nbytes <3 ) +if (req->nbytes <3 || req->data[2 ] >=16 )break ;mutex_lock (&adb_handler_mutex); req->reply[0 ] = adb_handler[req->data[2 ]].original_address;
Greg Kroah-Hartman
maintainerPATCH 20/21 x86/speculation: Add RSB VM Exit protections
In reply to Greg Kroah-HartmanFrom: Daniel Sneddon <[email protected]>
commit 2b1299322016731d56807aa49254a5ea3080b6b3 upstream.
tl;dr: The Enhanced IBRS mitigation for Spectre v2 does not work as documented for RET instructions after VM exits. Mitigate it with a new one-entry RSB stuffing mechanism and a new LFENCE.
== Background ==
Indirect Branch Restricted Speculation (IBRS) was designed to help mitigate Branch Target Injection and Speculative Store Bypass, i.e. Spectre, attacks. IBRS prevents software run in less privileged modes from affecting branch prediction in more privileged modes. IBRS requires the MSR to be written on every privilege level change.
To overcome some of the performance issues of IBRS, Enhanced IBRS was introduced. eIBRS is an "always on" IBRS, in other words, just turn it on once instead of writing the MSR on every privilege level change. When eIBRS is enabled, more privileged modes should be protected from less privileged modes, including protecting VMMs from guests.
== Problem ==
Here's a simplification of how guests are run on Linux' KVM:
void run_kvm_guest(void)
{
// Prepare to run guest
VMRESUME();
// Clean up after guest runs
}The execution flow for that would look something like this to the processor:
1. Host-side: call run_kvm_guest()
2. Host-side: VMRESUME
3. Guest runs, does "CALL guest_function"
4. VM exit, host runs again
5. Host might make some "cleanup" function calls
6. Host-side: RET from run_kvm_guest()
Now, when back on the host, there are a couple of possible scenarios of post-guest activity the host needs to do before executing host code:
* on pre-eIBRS hardware (legacy IBRS, or nothing at all), the RSB is not touched and Linux has to do a 32-entry stuffing.
* on eIBRS hardware, VM exit with IBRS enabled, or restoring the host IBRS=1 shortly after VM exit, has a documented side effect of flushing the RSB except in this PBRSB situation where the software needs to stuff the last RSB entry "by hand".
IOW, with eIBRS supported, host RET instructions should no longer be influenced by guest behavior after the host retires a single CALL instruction.
However, if the RET instructions are "unbalanced" with CALLs after a VM exit as is the RET in #6, it might speculatively use the address for the instruction after the CALL in #3 as an RSB prediction. This is a problem since the (untrusted) guest controls this address.
Balanced CALL/RET instruction pairs such as in step #5 are not affected.
== Solution ==
The PBRSB issue affects a wide variety of Intel processors which support eIBRS. But not all of them need mitigation. Today, X86_FEATURE_RSB_VMEXIT triggers an RSB filling sequence that mitigates PBRSB. Systems setting RSB_VMEXIT need no further mitigation - i.e., eIBRS systems which enable legacy IBRS explicitly.
However, such systems (X86_FEATURE_IBRS_ENHANCED) do not set RSB_VMEXIT and most of them need a new mitigation.
Therefore, introduce a new feature flag X86_FEATURE_RSB_VMEXIT_LITE which triggers a lighter-weight PBRSB mitigation versus RSB_VMEXIT.
The lighter-weight mitigation performs a CALL instruction which is immediately followed by a speculative execution barrier (INT3). This steers speculative execution to the barrier -- just like a retpoline -- which ensures that speculation can never reach an unbalanced RET. Then, ensure this CALL is retired before continuing execution with an LFENCE.
In other words, the window of exposure is opened at VM exit where RET behavior is troublesome. While the window is open, force RSB predictions sampling for RET targets to a dead end at the INT3. Close the window with the LFENCE.
There is a subset of eIBRS systems which are not vulnerable to PBRSB. Add these systems to the cpu_vuln_whitelist[] as NO_EIBRS_PBRSB. Future systems that aren't vulnerable will set ARCH_CAP_PBRSB_NO.
[ bp: Massage, incorporate review comments from Andy Cooper. ]
--- Documentation/admin-guide/hw-vuln/spectre.rst | 8 ++ arch/x86/include/asm/cpufeatures.h | 2 arch/x86/include/asm/msr-index.h | 4 + arch/x86/include/asm/nospec-branch.h | 17 ++++- arch/x86/kernel/cpu/bugs.c | 86 +++++++++++++++++++------- arch/x86/kernel/cpu/common.c | 12 +++ arch/x86/kvm/vmx/vmenter.S | 8 +- tools/arch/x86/include/asm/cpufeatures.h | 1 tools/arch/x86/include/asm/msr-index.h | 4 + 9 files changed, 113 insertions(+), 29 deletions(-)
Documentation/admin-guide/hw-vuln/spectre.rst +8 -0
@@ -422,6 +422,14 @@ The possible values in this file are: 'RSB filling' Protection of RSB on context switch enabled ============= =========================================== + - EIBRS Post-barrier Return Stack Buffer (PBRSB) protection status: + + =========================== ======================================================= + 'PBRSB-eIBRS: SW sequence' CPU is affected and protection of RSB on VMEXIT enabled + 'PBRSB-eIBRS: Vulnerable' CPU is vulnerable + 'PBRSB-eIBRS: Not affected' CPU is not affected by PBRSB + =========================== ======================================================= + Full mitigation might require a microcode update from the CPU vendor. When the necessary microcode is not available, the kernel will report vulnerability.
arch/x86/include/asm/cpufeatures.h +2 -0
@@ -303,6 +303,7 @@#define X86_FEATURE_RETHUNK (11*32+14)/* "" Use REturn THUNK */ #define X86_FEATURE_UNRET (11*32+15)/* "" AMD BTB untrain return */ #define X86_FEATURE_USE_IBPB_FW (11*32+16)/* "" Use IBPB during runtime firmware calls */ +#define X86_FEATURE_RSB_VMEXIT_LITE (11*32+17)/* "" Fill RSB on VM exit when EIBRS is enabled */ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX_VNNI (12*32+ 4)/* AVX VNNI instructions */
@@ -456,5 +457,6 @@#define X86_BUG_SRBDS X86_BUG(24)/* CPU may leak RNG bits if not mitigated */ #define X86_BUG_MMIO_STALE_DATA X86_BUG(25)/* CPU is affected by Processor MMIO Stale Data vulnerabilities */ #define X86_BUG_RETBLEED X86_BUG(26)/* CPU is affected by RETBleed */ +#define X86_BUG_EIBRS_PBRSB X86_BUG(27)/* EIBRS is vulnerable to Post Barrier RSB Predictions */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/msr-index.h +4 -0
@@ -150,6 +150,10 @@* are restricted to targets in * kernel. */ +#define ARCH_CAP_PBRSB_NO BIT(24)/* +* Not susceptible to Post-Barrier +* Return Stack Buffer Predictions. +*/ #define MSR_IA32_FLUSH_CMD 0x0000010b#define L1D_FLUSH BIT(0)/*
arch/x86/include/asm/nospec-branch.h +16 -1
@@ -118,13 +118,28 @@#endif .endm +.macro ISSUE_UNBALANCED_RET_GUARD + ANNOTATE_INTRA_FUNCTION_CALL + call .Lunbalanced_ret_guard_\@ + int3 +.Lunbalanced_ret_guard_\@: + add $(BITS_PER_LONG/8), %_ASM_SP + lfence +.endm + /* * A simpler FILL_RETURN_BUFFER macro. Don't make people use the CPP * monstrosity above, manually. */ -.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req +.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req ftr2 +.ifb \ftr2 ALTERNATIVE "jmp .Lskip_rsb_\@", "", \ftr +.else + ALTERNATIVE_2 "jmp .Lskip_rsb_\@", "", \ftr, "jmp .Lunbalanced_\@", \ftr2 +.endif __FILL_RETURN_BUFFER(\reg,\nr,%_ASM_SP) +.Lunbalanced_\@: +ISSUE_UNBALANCED_RET_GUARD .Lskip_rsb_\@: .endm
arch/x86/kernel/cpu/bugs.c +63 -23
115 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +10 -2
@@ -1135,6 +1135,7 @@ static void identify_cpu_without_cpuid(s#define NO_SWAPGS BIT(6)#define NO_ITLB_MULTIHIT BIT(7)#define NO_SPECTRE_V2 BIT(8) +#define NO_EIBRS_PBRSB BIT(9)#define VULNWL (vendor, family, model, whitelist) \ X86_MATCH_VENDOR_FAM_MODEL(vendor, family, model, whitelist)
@@ -1177,7 +1178,7 @@ static const __initconst struct x86_cpu_VULNWL_INTEL (ATOM_GOLDMONT ,NO_MDS |NO_L1TF |NO_SWAPGS |NO_ITLB_MULTIHIT ),VULNWL_INTEL (ATOM_GOLDMONT_D ,NO_MDS |NO_L1TF |NO_SWAPGS |NO_ITLB_MULTIHIT ), - VULNWL_INTEL(ATOM_GOLDMONT_PLUS, NO_MDS | NO_L1TF | NO_SWAPGS | NO_ITLB_MULTIHIT), + VULNWL_INTEL(ATOM_GOLDMONT_PLUS, NO_MDS | NO_L1TF | NO_SWAPGS | NO_ITLB_MULTIHIT | NO_EIBRS_PBRSB),/* * Technically, swapgs isn't serializing on AMD (despite it previously
@@ -1187,7 +1188,9 @@ static const __initconst struct x86_cpu_* good enough for our purposes. */ -VULNWL_INTEL (ATOM_TREMONT_D ,NO_ITLB_MULTIHIT ), +VULNWL_INTEL (ATOM_TREMONT ,NO_EIBRS_PBRSB ), +VULNWL_INTEL (ATOM_TREMONT_L ,NO_EIBRS_PBRSB ), +VULNWL_INTEL (ATOM_TREMONT_D ,NO_ITLB_MULTIHIT |NO_EIBRS_PBRSB ),/* AMD Family 0xf - 0x12 */ VULNWL_AMD(0x0f, NO_MELTDOWN | NO_SSB | NO_L1TF | NO_MDS | NO_SWAPGS | NO_ITLB_MULTIHIT),
@@ -1365,6 +1368,11 @@ static void __init cpu_set_bug_bits(strusetup_force_cpu_bug (X86_BUG_RETBLEED ); } +if (cpu_has (c,X86_FEATURE_IBRS_ENHANCED ) && + !cpu_matches (cpu_vuln_whitelist,NO_EIBRS_PBRSB ) && + !(ia32_cap &ARCH_CAP_PBRSB_NO )) +setup_force_cpu_bug (X86_BUG_EIBRS_PBRSB ); +if (cpu_matches (cpu_vuln_whitelist,NO_MELTDOWN ))return ;
arch/x86/kvm/vmx/vmenter.S +5 -3
@@ -227,11 +227,13 @@ SYM_INNER_LABEL(vmx_vmexit, SYM_L_GLOBAL * entries and (in some cases) RSB underflow. * * eIBRS has its own protection against poisoned RSB, so it doesn't - * need the RSB filling sequence. But it does need to be enabled - * before the first unbalanced RET. + * need the RSB filling sequence. But it does need to be enabled, and a + * single call to retire, before the first unbalanced RET. */ - FILL_RETURN_BUFFER %_ASM_CX, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_VMEXIT + FILL_RETURN_BUFFER %_ASM_CX, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_VMEXIT,\ + X86_FEATURE_RSB_VMEXIT_LITE + pop %_ASM_ARG2 /* @flags */ pop %_ASM_ARG1 /* @vmx */
tools/arch/x86/include/asm/cpufeatures.h +1 -0
@@ -303,6 +303,7 @@#define X86_FEATURE_RETHUNK (11*32+14)/* "" Use REturn THUNK */ #define X86_FEATURE_UNRET (11*32+15)/* "" AMD BTB untrain return */ #define X86_FEATURE_USE_IBPB_FW (11*32+16)/* "" Use IBPB during runtime firmware calls */ +#define X86_FEATURE_RSB_VMEXIT_LITE (11*32+17)/* "" Fill RSB on VM-Exit when EIBRS is enabled */ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX_VNNI (12*32+ 4)/* AVX VNNI instructions */
tools/arch/x86/include/asm/msr-index.h +4 -0
@@ -150,6 +150,10 @@* are restricted to targets in * kernel. */ +#define ARCH_CAP_PBRSB_NO BIT(24)/* +* Not susceptible to Post-Barrier +* Return Stack Buffer Predictions. +*/ #define MSR_IA32_FLUSH_CMD 0x0000010b#define L1D_FLUSH BIT(0)/*
Peter Zijlstra
maintainerPATCH 1/1 x86/nospec: Unwreck the RSB stuffing
Replying here, because obviously there's no actual posting of this patch... :/
Quoted 21 lines
arch/x86/include/asm/nospec-branch.h +10
-1@@ -118,13 +118,28 @@#endif .endm +.macro ISSUE_UNBALANCED_RET_GUARD +ANNOTATE_INTRA_FUNCTION_CALL + call .Lunbalanced_ret_guard_\@ + int3 +.Lunbalanced_ret_guard_\@: + add $(BITS_PER_LONG/8), %_ASM_SP + lfence +.endm + /* * A simpler FILL_RETURN_BUFFER macro. Don't make people use the CPP * monstrosity above, manually. */ -.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req +.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req ftr2
arch/x86/include/asm/nospec-branch.h line 144
Quoted 10 lines
arch/x86/include/asm/nospec-branch.h +6
-0+.ifb \ftr2 ALTERNATIVE "jmp .Lskip_rsb_\@", "", \ftr +.else + ALTERNATIVE_2 "jmp .Lskip_rsb_\@", "", \ftr, "jmp .Lunbalanced_\@", \ftr2 +.endif __FILL_RETURN_BUFFER(\reg,\nr,%_ASM_SP) +.Lunbalanced_\@: +ISSUE_UNBALANCED_RET_GUARD .Lskip_rsb_\@: .endm
(/me deletes all the swear words and starts over)
This must absolutely be the most horrible patch you could come up with, no? I suppose that's the price of me taking PTO :-(
Could you please test this; I've only compiled it.
---
Subject: x86/nospec: Unwreck the RSB stuffing
Commit 2b1299322016 ("x86/speculation: Add RSB VM Exit protections") made a right mess of the RSB stuffing, rewrite the whole thing to not suck.
Thanks to Andrew for the enlightening comment about Post-Barrier RSB things so we can make this code less magical.
--- cpufeatures.h | 2 + nospec-branch.h | 80 +++++++++++++++++++++++++++----------------------------- 2 files changed, 41 insertions(+), 41 deletions(-)
arch/x86/include/asm/cpufeatures.h +2 -0
@@ -420,6 +420,8 @@#define X86_FEATURE_V_TSC_AUX (19*32+ 9)/* "" Virtual TSC_AUX */ #define X86_FEATURE_SME_COHERENT (19*32+10)/* "" AMD hardware-enforced cache coherency */ +#define X86_FEATURE_NEVER (-1)/* "" Logical complement of ALWAYS */ +/* * BUG word(s) */
arch/x86/include/asm/nospec-branch.h +39 -41
100 lines not on this page · raw message
Greg Kroah-Hartman
maintainerRe: [PATCH] x86/nospec: Unwreck the RSB stuffing
Quoted 3 lines · Peter Zijlstra
Replying here, because obviously there's no actual posting of this patch... :/
{sigh} True :(
Quoted 43 lines
Quoted 22 lines
arch/x86/include/asm/nospec-branch.h +10
-1@@ -118,13 +118,28 @@#endif .endm +.macro ISSUE_UNBALANCED_RET_GUARD +ANNOTATE_INTRA_FUNCTION_CALL + call .Lunbalanced_ret_guard_\@ + int3 +.Lunbalanced_ret_guard_\@: + add $(BITS_PER_LONG/8), %_ASM_SP + lfence +.endm + /* * A simpler FILL_RETURN_BUFFER macro. Don't make people use the CPP * monstrosity above, manually. */ -.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req +.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req ftr2arch/x86/include/asm/nospec-branch.h line 144
Quoted 10 lines
arch/x86/include/asm/nospec-branch.h +6
-0+.ifb \ftr2 ALTERNATIVE "jmp .Lskip_rsb_\@", "", \ftr +.else + ALTERNATIVE_2 "jmp .Lskip_rsb_\@", "", \ftr, "jmp .Lunbalanced_\@", \ftr2 +.endif __FILL_RETURN_BUFFER(\reg,\nr,%_ASM_SP) +.Lunbalanced_\@: +ISSUE_UNBALANCED_RET_GUARD .Lskip_rsb_\@: .endm(/me deletes all the swear words and starts over)
This must absolutely be the most horrible patch you could come up with, no? I suppose that's the price of me taking PTO :-(
Could you please test this; I've only compiled it.
---
Subject: x86/nospec: Unwreck the RSB stuffing
Quoted 8 lines
Commit
2b1299322016("x86/speculation: Add RSB VM Exit protections") made a right mess of the RSB stuffing, rewrite the whole thing to not suck.Thanks to Andrew for the enlightening comment about Post-Barrier RSB things so we can make this code less magical.
Signed-off-by Peter Zijlstra (Intel) <[email protected]>
I need an Intel person to test this as I have no idea how to do so as this is an issue in Linus's tree.
thanks,
greg k-h
Borislav Petkov
maintainerRe: [PATCH] x86/nospec: Unwreck the RSB stuffing
Quoted 1 line · Greg Kroah-Hartman
I need an Intel person
Daniel?
Quoted 2 lines
to test this as I have no idea how to do so as his is an issue in tLinus's tree.
If this passes - and I have my both fingers crossed - this will be an amazing simplification.
Might wanna take it into stable too, when ready.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteGreg Kroah-Hartman
maintainerRe: [PATCH] x86/nospec: Unwreck the RSB stuffing
Quoted 5 lines · Borislav Petkov
Quoted 1 line · Greg Kroah-Hartman
I need an Intel person
Daniel?
Quoted 7 lines
Quoted 2 lines
to test this as I have no idea how to do so as his is an issue in tLinus's tree.
If this passes - and I have my both fingers crossed - this will be an amazing simplification.
Might wanna take it into stable too, when ready.
I'd be glad to :)
Re: [PATCH] x86/nospec: Unwreck the RSB stuffing
In reply to Borislav PetkovQuoted 4 lines · Borislav Petkov
Quoted 1 line · Greg Kroah-Hartman
I need an Intel person
Daniel?
I'll test this.
Quoted 11 lines
Quoted 3 lines
to test this as I have no idea how to do so as his is an issue in tLinus's tree.
If this passes - and I have my both fingers crossed - this will be an amazing simplification.
Might wanna take it into stable too, when ready.
Thx.
Re: [PATCH] x86/nospec: Unwreck the RSB stuffing
In reply to Peter ZijlstraQuoted 8 lines · Peter Zijlstra
arch/x86/include/asm/nospec-branch.h +0
-0@@ -35,33 +35,44 @@#define RSB_CLEAR_LOOPS 32/* To forcibly overwrite all entries */ /*
arch/x86/include/asm/nospec-branch.h line 47
Quoted 10 lines
arch/x86/include/asm/nospec-branch.h +10
-0+* Common helper for __FILL_RETURN_BUFFER and __FILL_ONE_RETURN. +*/ +#define __FILL_RETURN_SLOT \ + ANNOTATE_INTRA_FUNCTION_CALL; \ + call 772f; \ + int3; \ +772: + +/* +* Stuff the entire RSB.
One minor point. Stuff 32 slots.
There are Intel parts out in the world with RSBs larger than 32 entries, and this loop does not fill the entire RSB on those.
This is why the 32-entry stuffing loop is explicitly not supported on eIBRS hardware as a general mechanism.
~Andrew
Borislav Petkov
maintainerRe: [PATCH] x86/nospec: Unwreck the RSB stuffing
Quoted 7 lines · Andrew Cooper
One minor point. Stuff 32 slots.
There are Intel parts out in the world with RSBs larger than 32 entries, and this loop does not fill the entire RSB on those.
This is why the 32-entry stuffing loop is explicitly not supported on eIBRS hardware as a general mechanism.
I'm guessing there will be an Intel patch forthcoming, making that RSB_CLEAR_LOOPS more dynamic, based on the current model.
:-)
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquettePawan Gupta
reviewerRe: [PATCH] x86/nospec: Unwreck the RSB stuffing
Quoted 11 lines · Borislav Petkov
Quoted 7 lines · Andrew Cooper
One minor point. Stuff 32 slots.
There are Intel parts out in the world with RSBs larger than 32 entries, and this loop does not fill the entire RSB on those.
This is why the 32-entry stuffing loop is explicitly not supported on eIBRS hardware as a general mechanism.
I'm guessing there will be an Intel patch forthcoming, making that
RSB_CLEAR_LOOPSmore dynamic, based on the current model.
This is being discussed internally, but likely Enhanced IBRS parts don't need RSB stuffing (except for the single entry stuffing for mitigating PBRSB).
Re: [PATCH] x86/nospec: Unwreck the RSB stuffing
In reply to Peter ZijlstraQuoted 3 lines · Peter Zijlstra
Could you please test this; I've only compiled it.
When booting I get the following BUG:
------------[ cut here ]------------ kernel BUG at arch/x86/kernel/alternative.c:290! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.0.0-rc1-00001-gb72b03c96999 #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:apply_alternatives+0x287/0x2d0 Code: 4c 29 f6 03 74 24 13 89 74 24 13 45 85 c0 0f 85 d2 41 e9 00 41 0f b6 02 83 e0 fd 3c e9 0f 84 46 ff ff ff e9 5e fe ff ff 0f 0b <0f> 0b f7 c6 00 ff ff ff 0f 84 68 ff ff ff 8d 71 fb c6 44 24 12 e9 RSP: 0000:ffffffff82c03d68 EFLAGS: 00010206 RAX: 0000000000000000 RBX: ffffffff83728c24 RCX: 0000000000007fff RDX: 00000000ffffffea RSI: 0000000000000000 RDI: 000000000000ffff RBP: ffffffff82c03d7a R08: e800000010c4c749 R09: 0001e8cc00000001 R10: 10c48348cc000000 R11: e8ae0feb75ccff49 R12: ffffffff8372fcf8 R13: 0000000000000000 R14: ffffffff81001a68 R15: 000000000000001f FS: 0000000000000000(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff88813ffff000 CR3: 0000000002c0c001 CR4: 0000000000770ef0 PKRU: 55555554 Call Trace: <TASK> ? insn_get_opcode+0xef/0x1c0 ? ct_nmi_enter+0xb3/0x180 ? ct_nmi_exit+0xbe/0x1d0 ? irqentry_exit+0x2d/0x40 ? asm_common_interrupt+0x22/0x40 alternative_instructions+0x5b/0xf5 check_bugs+0xdaf/0xdef start_kernel+0x66a/0x6a2 secondary_startup_64_no_verify+0xe0/0xeb </TASK> Modules linked in: Dumping ftrace buffer: (ftrace buffer empty) ---[ end trace 0000000000000000 ]--- RIP: 0010:apply_alternatives+0x287/0x2d0 Code: 4c 29 f6 03 74 24 13 89 74 24 13 45 85 c0 0f 85 d2 41 e9 00 41 0f b6 02 83 e0 fd 3c e9 0f 84 46 ff ff ff e9 5e fe ff ff 0f 0b <0f> 0b f7 c6 00 ff ff ff 0f 84 68 ff ff ff 8d 71 fb c6 44 24 12 e9 RSP: 0000:ffffffff82c03d68 EFLAGS: 00010206 RAX: 0000000000000000 RBX: ffffffff83728c24 RCX: 0000000000007fff RDX: 00000000ffffffea RSI: 0000000000000000 RDI: 000000000000ffff RBP: ffffffff82c03d7a R08: e800000010c4c749 R09: 0001e8cc00000001 R10: 10c48348cc000000 R11: e8ae0feb75ccff49 R12: ffffffff8372fcf8 R13: 0000000000000000 R14: ffffffff81001a68 R15: 000000000000001f FS: 0000000000000000(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff88813ffff000 CR3: 0000000002c0c001 CR4: 0000000000770ef0 PKRU: 55555554 Kernel panic - not syncing: Attempted to kill the idle task! Dumping ftrace buffer: (ftrace buffer empty) ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---
Re: [PATCH] x86/nospec: Unwreck the RSB stuffing
Quoted 53 lines · Daniel Sneddon
Quoted 3 lines · Peter Zijlstra
Could you please test this; I've only compiled it.
When booting I get the following BUG:
------------[ cut here ]------------ kernel BUG at arch/x86/kernel/alternative.c:290! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.0.0-rc1-00001-gb72b03c96999 #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:apply_alternatives+0x287/0x2d0 Code: 4c 29 f6 03 74 24 13 89 74 24 13 45 85 c0 0f 85 d2 41 e9 00 41 0f b6 02 83 e0 fd 3c e9 0f 84 46 ff ff ff e9 5e fe ff ff 0f 0b <0f> 0b f7 c6 00 ff ff ff 0f 84 68 ff ff ff 8d 71 fb c6 44 24 12 e9 RSP: 0000:ffffffff82c03d68 EFLAGS: 00010206 RAX: 0000000000000000 RBX: ffffffff83728c24 RCX: 0000000000007fff RDX: 00000000ffffffea RSI: 0000000000000000 RDI: 000000000000ffff RBP: ffffffff82c03d7a R08: e800000010c4c749 R09: 0001e8cc00000001 R10: 10c48348cc000000 R11: e8ae0feb75ccff49 R12: ffffffff8372fcf8 R13: 0000000000000000 R14: ffffffff81001a68 R15: 000000000000001f FS: 0000000000000000(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff88813ffff000 CR3: 0000000002c0c001 CR4: 0000000000770ef0 PKRU: 55555554 Call Trace: <TASK> ? insn_get_opcode+0xef/0x1c0 ? ct_nmi_enter+0xb3/0x180 ? ct_nmi_exit+0xbe/0x1d0 ? irqentry_exit+0x2d/0x40 ? asm_common_interrupt+0x22/0x40 alternative_instructions+0x5b/0xf5 check_bugs+0xdaf/0xdef start_kernel+0x66a/0x6a2 secondary_startup_64_no_verify+0xe0/0xeb </TASK> Modules linked in: Dumping ftrace buffer: (ftrace buffer empty) ---[ end trace 0000000000000000 ]--- RIP: 0010:apply_alternatives+0x287/0x2d0 Code: 4c 29 f6 03 74 24 13 89 74 24 13 45 85 c0 0f 85 d2 41 e9 00 41 0f b6 02 83 e0 fd 3c e9 0f 84 46 ff ff ff e9 5e fe ff ff 0f 0b <0f> 0b f7 c6 00 ff ff ff 0f 84 68 ff ff ff 8d 71 fb c6 44 24 12 e9 RSP: 0000:ffffffff82c03d68 EFLAGS: 00010206 RAX: 0000000000000000 RBX: ffffffff83728c24 RCX: 0000000000007fff RDX: 00000000ffffffea RSI: 0000000000000000 RDI: 000000000000ffff RBP: ffffffff82c03d7a R08: e800000010c4c749 R09: 0001e8cc00000001 R10: 10c48348cc000000 R11: e8ae0feb75ccff49 R12: ffffffff8372fcf8 R13: 0000000000000000 R14: ffffffff81001a68 R15: 000000000000001f
Quoted 11 lines
FS: 0000000000000000(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff88813ffff000 CR3: 0000000002c0c001 CR4: 0000000000770ef0 PKRU: 55555554 Kernel panic - not syncing: Attempted to kill the idle task! Dumping ftrace buffer: (ftrace buffer empty) ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---
I can get it to work with the below changes. I had to change the -1 to 0x7FFF because bit 15 is masked out in apply_alternatives(). Not sure if that's the right way to fix it, but it boots and has the correct assembly code in vmx_vmexit, so the alternative does get applied correctly there.
---
arch/x86/include/asm/cpufeatures.h +0 -0
@@ -420,7 +420,7 @@#define X86_FEATURE_V_TSC_AUX (19*32+ 9)/* "" Virtual TSC_AUX */ #define X86_FEATURE_SME_COHERENT (19*32+10)/* "" AMD hardware-enforced
cache coherency */
-#define X86_FEATURE_NEVER (-1) /* "" Logical complement of ALWAYS */
+#define X86_FEATURE_NEVER (0x7FFF) /* "" Logical complement of
ALWAYS */
/*
* BUG word(s)
arch/x86/kernel/alternative.c +0 -0
@@ -284,6 +284,9 @@ void __init_or_module noinline apply_alternatives(struct
alt_instr *start,
/* Mask away "NOT" flag bit for feature to test. */
u16 feature = a->cpuid & ~ALTINSTR_FLAG_INV;+ if (feature == X86_FEATURE_NEVER)
+ goto next;
+
instr = (u8 *)&a->instr_offset + a->instr_offset;
replacement = (u8 *)&a->repl_offset + a->repl_offset;
BUG_ON(a->instrlen > sizeof(insn_buff));Boris Petkov
maintainerRe: [PATCH] x86/nospec: Unwreck the RSB stuffing
arch/x86/kernel/alternative.c void __init_or_module noinline apply_alternatives(struct · line 286
Quoted 8 lines · Daniel Sneddon
arch/x86/kernel/alternative.c +0
-0@@ -284,6 +284,9 @@ void __init_or_module noinline apply_alternatives(structalt_instr *start,/* Mask away "NOT" flag bit for feature to test. */ u16 feature = a->cpuid & ~ALTINSTR_FLAG_INV;
I guess it is time for struct altinstr.flags. I never liked this INV mask bit...
Quoted 8 lines
arch/x86/kernel/alternative.c +3
-0+if (feature ==X86_FEATURE_NEVER ) + goto next; + instr = (u8 *)&a->instr_offset + a->instr_offset; replacement = (u8 *)&a->repl_offset + a->repl_offset;BUG_ON (a->instrlen >sizeof (insn_buff));
Signature · 1 line
Sent from a small device: formatting sux and brevity is inevitable.
Peter Zijlstra
maintainerRe: [PATCH] x86/nospec: Unwreck the RSB stuffing
In reply to Daniel SneddonQuoted 11 lines · Daniel Sneddon
arch/x86/include/asm/cpufeatures.h +0
-0@@ -420,7 +420,7 @@#define X86_FEATURE_V_TSC_AUX (19*32+ 9)/* "" Virtual TSC_AUX */ #define X86_FEATURE_SME_COHERENT (19*32+10)/* "" AMD hardware-enforced cache coherency */
arch/x86/include/asm/cpufeatures.h +1
-1-#define X86_FEATURE_NEVER (-1)/* "" Logical complement of ALWAYS */ +#define X86_FEATURE_NEVER (0x7FFF)/* "" Logical complement of
Quoted 1 line
ALWAYS */
Bah, I initially spelled that: ALT_NOT(X86_FEATURE_ALWAYS), but Boris made me do the -1 thing there. Oh well, Boris can fix that :-)
Peter Zijlstra
maintainerRe: [PATCH] x86/nospec: Unwreck the RSB stuffing
Quoted 10 lines · Peter Zijlstra
Quoted 9 lines · Daniel Sneddon
arch/x86/include/asm/cpufeatures.h +0
-0@@ -420,7 +420,7 @@#define X86_FEATURE_V_TSC_AUX (19*32+ 9)/* "" Virtual TSC_AUX */ #define X86_FEATURE_SME_COHERENT (19*32+10)/* "" AMD hardware-enforced cache coherency */
Quoted 7 lines
Quoted 3 lines
arch/x86/include/asm/cpufeatures.h +1
-1-#define X86_FEATURE_NEVER (-1)/* "" Logical complement of ALWAYS */ +#define X86_FEATURE_NEVER (0x7FFF)/* "" Logical complement of ALWAYS */
Bah, I initially spelled that:
ALT_NOT(X86_FEATURE_ALWAYS), but Boris made me do the -1 thing there. Oh well, Boris can fix that :-)
Boris, how's this then? Will you cram it into x86/urgent ?
---
Subject: x86/nospec: Unwreck the RSB stuffing
From: Peter Zijlstra <[email protected]>
Date: Tue, 16 Aug 2022 14:28:36 +0200
Commit 2b1299322016 ("x86/speculation: Add RSB VM Exit protections") made a right mess of the RSB stuffing, rewrite the whole thing to not suck.
Thanks to Andrew for the enlightening comment about Post-Barrier RSB things so we can make this code less magical.
--- arch/x86/include/asm/nospec-branch.h | 80 +++++++++++++++++------------------ 1 file changed, 39 insertions(+), 41 deletions(-)
arch/x86/include/asm/nospec-branch.h +39 -41
@@ -35,33 +35,44 @@#define RSB_CLEAR_LOOPS 32/* To forcibly overwrite all entries */ /* +* Common helper for __FILL_RETURN_BUFFER and __FILL_ONE_RETURN. +*/ +#define __FILL_RETURN_SLOT \ + ANNOTATE_INTRA_FUNCTION_CALL; \ + call 772f; \ + int3; \ +772: + +/* +* Stuff the entire RSB. +* * Google experimented with loop-unrolling and this turned out to be * the optimal version - two calls, each with their own speculation * trap should their return address end up getting used, in a loop. */ -#define __FILL_RETURN_BUFFER (reg, nr, sp) \ - mov $(nr/2), reg; \ -771: \ - ANNOTATE_INTRA_FUNCTION_CALL; \ - call 772f; \ -773:/* speculation trap */ \ -UNWIND_HINT_EMPTY ; \ - pause; \ - lfence; \ - jmp 773b; \ -772: \ -ANNOTATE_INTRA_FUNCTION_CALL ; \ - call 774f; \ -775: /* speculation trap */ \ -UNWIND_HINT_EMPTY ; \ - pause; \ - lfence; \ - jmp 775b; \ -774: \ - add $(BITS_PER_LONG/8) * 2, sp; \ -dec reg; \ - jnz 771b; \ -/* barrier for jnz misprediction */ \ +#define __FILL_RETURN_BUFFER (reg, nr) \ + mov $(nr/2), reg; \ +771: \ + __FILL_RETURN_SLOT \ + __FILL_RETURN_SLOT \ + add $(BITS_PER_LONG/8) * 2, %_ASM_SP; \ + dec reg; \ + jnz 771b; \ +/* barrier for jnz misprediction */ \ + lfence; + +/* +* Stuff a single RSB slot. +* +* To mitigate Post-Barrier RSB speculation, one CALL instruction must be +* forced to retire before letting a RET instruction execute. +* +* On PBRSB-vulnerable CPUs, it is not safe for a RET to be executed +* before this point. +*/ +#define __FILL_ONE_RETURN \ + __FILL_RETURN_SLOT \ + add $(BITS_PER_LONG/8), %_ASM_SP; \ lfence;#ifdef __ASSEMBLY__
@@ -132,28 +143,15 @@#endif .endm -.macro ISSUE_UNBALANCED_RET_GUARD - ANNOTATE_INTRA_FUNCTION_CALL - call .Lunbalanced_ret_guard_\@ - int3 -.Lunbalanced_ret_guard_\@: - add $(BITS_PER_LONG/8), %_ASM_SP - lfence -.endm - /* * A simpler FILL_RETURN_BUFFER macro. Don't make people use the CPP * monstrosity above, manually. */ -.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req ftr2 -.ifb \ftr2 - ALTERNATIVE "jmp .Lskip_rsb_\@", "", \ftr -.else - ALTERNATIVE_2 "jmp .Lskip_rsb_\@", "", \ftr, "jmp .Lunbalanced_\@", \ftr2 -.endif - __FILL_RETURN_BUFFER(\reg,\nr,%_ASM_SP) -.Lunbalanced_\@: -ISSUE_UNBALANCED_RET_GUARD +.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req ftr2=ALT_NOT(X86_FEATURE_ALWAYS) +ALTERNATIVE_2 "jmp .Lskip_rsb_\@" , \ + __stringify(__FILL_RETURN_BUFFER(\reg,\nr)), \ftr, \ + __stringify(__FILL_ONE_RETURN), \ftr2 + .Lskip_rsb_\@: .endm
[tip: x86/urgent] x86/nospec: Unwreck the RSB stuffing
In reply to Peter ZijlstraThe following commit has been merged into the x86/urgent branch of tip:
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 4e3aa9238277597c6c7624f302d81a7b568b6f2d Gitweb: https://git.kernel.org/tip/4e3aa9238277597c6c7624f302d81a7b568b6f2d Author: Peter Zijlstra <[email protected]> AuthorDate: Tue, 16 Aug 2022 14:28:36 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 19 Aug 2022 13:24:32 +02:00
x86/nospec: Unwreck the RSB stuffing
Commit 2b1299322016 ("x86/speculation: Add RSB VM Exit protections") made a right mess of the RSB stuffing, rewrite the whole thing to not suck.
Thanks to Andrew for the enlightening comment about Post-Barrier RSB things so we can make this code less magical.
--- arch/x86/include/asm/nospec-branch.h | 80 +++++++++++++-------------- 1 file changed, 39 insertions(+), 41 deletions(-)
arch/x86/include/asm/nospec-branch.h +39 -41
@@ -35,33 +35,44 @@#define RSB_CLEAR_LOOPS 32/* To forcibly overwrite all entries */ /* +* Common helper for __FILL_RETURN_BUFFER and __FILL_ONE_RETURN. +*/ +#define __FILL_RETURN_SLOT \ + ANNOTATE_INTRA_FUNCTION_CALL; \ + call 772f; \ + int3; \ +772: + +/* +* Stuff the entire RSB. +* * Google experimented with loop-unrolling and this turned out to be * the optimal version - two calls, each with their own speculation * trap should their return address end up getting used, in a loop. */ -#define __FILL_RETURN_BUFFER (reg, nr, sp) \ - mov $(nr/2), reg; \ -771: \ - ANNOTATE_INTRA_FUNCTION_CALL; \ - call 772f; \ -773:/* speculation trap */ \ -UNWIND_HINT_EMPTY ; \ - pause; \ - lfence; \ - jmp 773b; \ -772: \ -ANNOTATE_INTRA_FUNCTION_CALL ; \ - call 774f; \ -775: /* speculation trap */ \ -UNWIND_HINT_EMPTY ; \ - pause; \ - lfence; \ - jmp 775b; \ -774: \ - add $(BITS_PER_LONG/8) * 2, sp; \ -dec reg; \ - jnz 771b; \ -/* barrier for jnz misprediction */ \ +#define __FILL_RETURN_BUFFER (reg, nr) \ + mov $(nr/2), reg; \ +771: \ + __FILL_RETURN_SLOT \ + __FILL_RETURN_SLOT \ + add $(BITS_PER_LONG/8) * 2, %_ASM_SP; \ + dec reg; \ + jnz 771b; \ +/* barrier for jnz misprediction */ \ + lfence; + +/* +* Stuff a single RSB slot. +* +* To mitigate Post-Barrier RSB speculation, one CALL instruction must be +* forced to retire before letting a RET instruction execute. +* +* On PBRSB-vulnerable CPUs, it is not safe for a RET to be executed +* before this point. +*/ +#define __FILL_ONE_RETURN \ + __FILL_RETURN_SLOT \ + add $(BITS_PER_LONG/8), %_ASM_SP; \ lfence;#ifdef __ASSEMBLY__
@@ -132,28 +143,15 @@#endif .endm -.macro ISSUE_UNBALANCED_RET_GUARD - ANNOTATE_INTRA_FUNCTION_CALL - call .Lunbalanced_ret_guard_\@ - int3 -.Lunbalanced_ret_guard_\@: - add $(BITS_PER_LONG/8), %_ASM_SP - lfence -.endm - /* * A simpler FILL_RETURN_BUFFER macro. Don't make people use the CPP * monstrosity above, manually. */ -.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req ftr2 -.ifb \ftr2 - ALTERNATIVE "jmp .Lskip_rsb_\@", "", \ftr -.else - ALTERNATIVE_2 "jmp .Lskip_rsb_\@", "", \ftr, "jmp .Lunbalanced_\@", \ftr2 -.endif - __FILL_RETURN_BUFFER(\reg,\nr,%_ASM_SP) -.Lunbalanced_\@: -ISSUE_UNBALANCED_RET_GUARD +.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req ftr2=ALT_NOT(X86_FEATURE_ALWAYS) +ALTERNATIVE_2 "jmp .Lskip_rsb_\@" , \ + __stringify(__FILL_RETURN_BUFFER(\reg,\nr)), \ftr, \ + __stringify(__FILL_ONE_RETURN), \ftr2 + .Lskip_rsb_\@: .endm
Greg Kroah-Hartman
maintainerPATCH 21/21 x86/speculation: Add LFENCE to RSB fill sequence
In reply to Greg Kroah-HartmanFrom: Pawan Gupta <[email protected]>
commit ba6e31af2be96c4d0536f2152ed6f7b6c11bca47 upstream.
RSB fill sequence does not have any protection for miss-prediction of conditional branch at the end of the sequence. CPU can speculatively execute code immediately after the sequence, while RSB filling hasn't completed yet.
#define __FILL_RETURN_BUFFER(reg, nr, sp) \
mov $(nr/2), reg; \
771: \
ANNOTATE_INTRA_FUNCTION_CALL; \
call 772f; \
773: /* speculation trap */ \
UNWIND_HINT_EMPTY; \
pause; \
lfence; \
jmp 773b; \
772: \
ANNOTATE_INTRA_FUNCTION_CALL; \
call 774f; \
775: /* speculation trap */ \
UNWIND_HINT_EMPTY; \
pause; \
lfence; \
jmp 775b; \
774: \
add $(BITS_PER_LONG/8) * 2, sp; \
dec reg; \jnz 771b; <----- CPU can miss-predict here.
Before RSB is filled, RETs that come in program order after this macro can be executed speculatively, making them vulnerable to RSB-based attacks.
Mitigate it by adding an LFENCE after the conditional branch to prevent speculation while RSB is being filled.
--- arch/x86/include/asm/nospec-branch.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/include/asm/nospec-branch.h +3 -1
@@ -60,7 +60,9 @@ 774: \ add $(BITS_PER_LONG/8) * 2, sp; \ dec reg; \ - jnz 771b; + jnz 771b; \ +/* barrier for jnz misprediction */ \ + lfence;#ifdef __ASSEMBLY__
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 11 Aug 2022 17:55:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels and build tested with BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 11 Aug 2022 17:55:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Hi Greg,
Compiled and booted on my test system Lenovo P50s: Intel Core i7 No emergency and critical messages in the dmesg
./perf bench sched all
# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 0.865 [sec]
# Running sched/pipe benchmark...
# Executed 1000000 pipe operations between two processes
Total time: 10.206 [sec]
10.206371 usecs/op
97978 ops/secThanks
-Zan
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 11 Aug 2022 17:55:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 11 Aug 2022 17:55:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 11 Aug 2022 17:55:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro's test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.19.1-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.19.y
* git commit: 8054ca35012635b5d3f63311bd312e7149d80b38
* git describe: v5.19-22-g8054ca350126
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.19.y/build/v5.19-22-g8054ca350126/
## No test regressions (compared to v5.19.0)
## No metric regressions (compared to v5.19.0)
## No test fixes (compared to v5.19.0)
## No metric fixes (compared to v5.19.0)
## Test result summary
total: 134782, pass: 120620, fail: 1758, skip: 12404, xfail: 0
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 301 total, 301 passed, 0 failed
* arm64: 62 total, 60 passed, 2 failed
* i386: 52 total, 50 passed, 2 failed
* mips: 45 total, 45 passed, 0 failed
* parisc: 12 total, 12 passed, 0 failed
* powerpc: 60 total, 54 passed, 6 failed
* riscv: 27 total, 22 passed, 5 failed
* s390: 18 total, 18 passed, 0 failed
* sh: 24 total, 24 passed, 0 failed
* sparc: 12 total, 12 passed, 0 failed
* x86_64: 55 total, 53 passed, 2 failed
## Test suites summary
* fwts
* igt-gpu-tools
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-open-posix-tests
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* packetdrill
* rcutorture
* ssuite
* v4l2-compliance
* vdso
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Successfully cross-compiled for arm64 (bcm2711_defconfig, GCC 10.2.0) and powerpc (ps3_defconfig, GCC 12.1.0).
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Hey Greg,
Ran tests and boot tested on my system, no regression found
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 11 Aug 2022 17:55:02 +0000. Anything received after that time might be too late.
Build results:
total: 150 pass: 150 fail: 0 Qemu test results: total: 480 pass: 480 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 11 Aug 2022 17:55:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, armv7, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.1 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 11 Aug 2022 17:55:02 +0000. Anything received after that time might be too late.
Hi Greg,
5.19.1-rc1 tested.
Run tested on:
- Allwinner H6 (Tanix TX6)
- Intel Tiger Lake x86_64 (nuc11 i7-1165G7)
In addition - build tested for:
- Allwinner A64
- Allwinner H3
- Allwinner H5
- NXP iMX6
- NXP iMX8
- Qualcomm Dragonboard
- Rockchip RK3288
- Rockchip RK3328
- Rockchip RK3399pro
- Samsung Exynos
--
Rudi