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

Configure Feed

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

aio: fix spectre gadget in lookup_ioctx

Matthew pointed out that the ioctx_table is susceptible to spectre v1,
because the index can be controlled by an attacker. The below patch
should mitigate the attack for all of the aio system calls.

Cc: stable@vger.kernel.org
Reported-by: Matthew Wilcox <willy@infradead.org>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Jeff Moyer and committed by
Jens Axboe
a538e3ff f55adad6

+2
+2
fs/aio.c
··· 45 46 #include <asm/kmap_types.h> 47 #include <linux/uaccess.h> 48 49 #include "internal.h" 50 ··· 1039 if (!table || id >= table->nr) 1040 goto out; 1041 1042 ctx = rcu_dereference(table->table[id]); 1043 if (ctx && ctx->user_id == ctx_id) { 1044 if (percpu_ref_tryget_live(&ctx->users))
··· 45 46 #include <asm/kmap_types.h> 47 #include <linux/uaccess.h> 48 + #include <linux/nospec.h> 49 50 #include "internal.h" 51 ··· 1038 if (!table || id >= table->nr) 1039 goto out; 1040 1041 + id = array_index_nospec(id, table->nr); 1042 ctx = rcu_dereference(table->table[id]); 1043 if (ctx && ctx->user_id == ctx_id) { 1044 if (percpu_ref_tryget_live(&ctx->users))