Skip to content

[pull] master from torvalds:master #1874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b53e523
io_uring: always arm linked timeouts prior to issue
axboe May 4, 2025
eb16b37
riscv: misaligned: Add handling for ZCB instructions
nylon7 Apr 11, 2025
f5c84ef
loop: Add sanity check for read/write_iter
Apr 28, 2025
db492e2
block: only update request sector if needed
morbidrsa May 6, 2025
650415f
nvme: unblock ctrl state transition for firmware update
igaw May 2, 2025
687b2ba
io_uring: ensure deferred completions are flushed for multishot
axboe May 7, 2025
a6aeb73
module: ensure that kobject_put() is safe for module type kobjects
dmantipov May 7, 2025
fd94de9
riscv: misaligned: factorize trap handling
clementleger Apr 22, 2025
453805f
riscv: misaligned: enable IRQs while handling misaligned accesses
clementleger Apr 22, 2025
897e8ae
riscv: misaligned: use get_user() instead of __get_user()
clementleger Apr 22, 2025
ae08d55
riscv: Fix kernel crash due to PR_SET_TAGGED_ADDR_CTRL
covanam May 4, 2025
e9d86b8
scripts: Do not strip .rela.dyn section
Apr 8, 2025
7f1c3de
riscv: Disallow PR_GET_TAGGED_ADDR_CTRL without Supm
SiFiveHolland May 7, 2025
c0d0a9f
block: remove test of incorrect io priority level
aaronlu May 8, 2025
dd90905
Merge tag 'nvme-6.15-2025-05-08' of git://git.infradead.org/nvme into…
axboe May 8, 2025
01534f3
Merge tag 'riscv-fixes-6.15-rc6' of ssh://gitolite.kernel.org/pub/scm…
palmer-dabbelt May 8, 2025
92835ce
io_uring/sqpoll: Increase task_work submission batch size
krisman May 8, 2025
fea4e31
x86/mm: Eliminate window where TLB flushes may be inadvertently skipped
hansendc May 8, 2025
29fe5d5
Merge tag 'modules-6.15-rc6' of git://git.kernel.org/pub/scm/linux/ke…
torvalds May 9, 2025
7380c60
Merge tag 'io_uring-6.15-20250509' of git://git.kernel.dk/linux
torvalds May 9, 2025
cc9f062
Merge tag 'block-6.15-20250509' of git://git.kernel.dk/linux
torvalds May 9, 2025
3013c33
Merge tag 'riscv-for-linus-6.15-rc6' of git://git.kernel.org/pub/scm/…
torvalds May 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions arch/riscv/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ long set_tagged_addr_ctrl(struct task_struct *task, unsigned long arg)
unsigned long pmm;
u8 pmlen;

if (!riscv_has_extension_unlikely(RISCV_ISA_EXT_SUPM))
return -EINVAL;

if (is_compat_thread(ti))
return -EINVAL;

Expand Down Expand Up @@ -330,6 +333,9 @@ long get_tagged_addr_ctrl(struct task_struct *task)
struct thread_info *ti = task_thread_info(task);
long ret = 0;

if (!riscv_has_extension_unlikely(RISCV_ISA_EXT_SUPM))
return -EINVAL;

if (is_compat_thread(ti))
return -EINVAL;

Expand Down
64 changes: 37 additions & 27 deletions arch/riscv/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,47 +198,57 @@ asmlinkage __visible __trap_section void do_trap_insn_illegal(struct pt_regs *re
DO_ERROR_INFO(do_trap_load_fault,
SIGSEGV, SEGV_ACCERR, "load access fault");

asmlinkage __visible __trap_section void do_trap_load_misaligned(struct pt_regs *regs)
enum misaligned_access_type {
MISALIGNED_STORE,
MISALIGNED_LOAD,
};
static const struct {
const char *type_str;
int (*handler)(struct pt_regs *regs);
} misaligned_handler[] = {
[MISALIGNED_STORE] = {
.type_str = "Oops - store (or AMO) address misaligned",
.handler = handle_misaligned_store,
},
[MISALIGNED_LOAD] = {
.type_str = "Oops - load address misaligned",
.handler = handle_misaligned_load,
},
};

static void do_trap_misaligned(struct pt_regs *regs, enum misaligned_access_type type)
{
irqentry_state_t state;

if (user_mode(regs)) {
irqentry_enter_from_user_mode(regs);
local_irq_enable();
} else {
state = irqentry_nmi_enter(regs);
}

if (handle_misaligned_load(regs))
do_trap_error(regs, SIGBUS, BUS_ADRALN, regs->epc,
"Oops - load address misaligned");
if (misaligned_handler[type].handler(regs))
do_trap_error(regs, SIGBUS, BUS_ADRALN, regs->epc,
misaligned_handler[type].type_str);

if (user_mode(regs)) {
local_irq_disable();
irqentry_exit_to_user_mode(regs);
} else {
irqentry_state_t state = irqentry_nmi_enter(regs);

if (handle_misaligned_load(regs))
do_trap_error(regs, SIGBUS, BUS_ADRALN, regs->epc,
"Oops - load address misaligned");

irqentry_nmi_exit(regs, state);
}
}

asmlinkage __visible __trap_section void do_trap_store_misaligned(struct pt_regs *regs)
asmlinkage __visible __trap_section void do_trap_load_misaligned(struct pt_regs *regs)
{
if (user_mode(regs)) {
irqentry_enter_from_user_mode(regs);

if (handle_misaligned_store(regs))
do_trap_error(regs, SIGBUS, BUS_ADRALN, regs->epc,
"Oops - store (or AMO) address misaligned");

irqentry_exit_to_user_mode(regs);
} else {
irqentry_state_t state = irqentry_nmi_enter(regs);

if (handle_misaligned_store(regs))
do_trap_error(regs, SIGBUS, BUS_ADRALN, regs->epc,
"Oops - store (or AMO) address misaligned");
do_trap_misaligned(regs, MISALIGNED_LOAD);
}

irqentry_nmi_exit(regs, state);
}
asmlinkage __visible __trap_section void do_trap_store_misaligned(struct pt_regs *regs)
{
do_trap_misaligned(regs, MISALIGNED_STORE);
}

DO_ERROR_INFO(do_trap_store_fault,
SIGSEGV, SEGV_ACCERR, "store (or AMO) access fault");
DO_ERROR_INFO(do_trap_ecall_s,
Expand Down
19 changes: 18 additions & 1 deletion arch/riscv/kernel/traps_misaligned.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@
#define INSN_MATCH_C_FSWSP 0xe002
#define INSN_MASK_C_FSWSP 0xe003

#define INSN_MATCH_C_LHU 0x8400
#define INSN_MASK_C_LHU 0xfc43
#define INSN_MATCH_C_LH 0x8440
#define INSN_MASK_C_LH 0xfc43
#define INSN_MATCH_C_SH 0x8c00
#define INSN_MASK_C_SH 0xfc43

#define INSN_LEN(insn) ((((insn) & 0x3) < 0x3) ? 2 : 4)

#if defined(CONFIG_64BIT)
Expand Down Expand Up @@ -268,7 +275,7 @@ static unsigned long get_f32_rs(unsigned long insn, u8 fp_reg_offset,
int __ret; \
\
if (user_mode(regs)) { \
__ret = __get_user(insn, (type __user *) insn_addr); \
__ret = get_user(insn, (type __user *) insn_addr); \
} else { \
insn = *(type *)insn_addr; \
__ret = 0; \
Expand Down Expand Up @@ -431,6 +438,13 @@ static int handle_scalar_misaligned_load(struct pt_regs *regs)
fp = 1;
len = 4;
#endif
} else if ((insn & INSN_MASK_C_LHU) == INSN_MATCH_C_LHU) {
len = 2;
insn = RVC_RS2S(insn) << SH_RD;
} else if ((insn & INSN_MASK_C_LH) == INSN_MATCH_C_LH) {
len = 2;
shift = 8 * (sizeof(ulong) - len);
insn = RVC_RS2S(insn) << SH_RD;
} else {
regs->epc = epc;
return -1;
Expand Down Expand Up @@ -530,6 +544,9 @@ static int handle_scalar_misaligned_store(struct pt_regs *regs)
len = 4;
val.data_ulong = GET_F32_RS2C(insn, regs);
#endif
} else if ((insn & INSN_MASK_C_SH) == INSN_MATCH_C_SH) {
len = 2;
val.data_ulong = GET_RS2S(insn, regs);
} else {
regs->epc = epc;
return -1;
Expand Down
22 changes: 19 additions & 3 deletions arch/x86/mm/tlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,9 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next,
cond_mitigation(tsk);

/*
* Let nmi_uaccess_okay() and finish_asid_transition()
* know that CR3 is changing.
* Indicate that CR3 is about to change. nmi_uaccess_okay()
* and others are sensitive to the window where mm_cpumask(),
* CR3 and cpu_tlbstate.loaded_mm are not all in sync.
*/
this_cpu_write(cpu_tlbstate.loaded_mm, LOADED_MM_SWITCHING);
barrier();
Expand Down Expand Up @@ -1204,8 +1205,16 @@ static void flush_tlb_func(void *info)

static bool should_flush_tlb(int cpu, void *data)
{
struct mm_struct *loaded_mm = per_cpu(cpu_tlbstate.loaded_mm, cpu);
struct flush_tlb_info *info = data;

/*
* Order the 'loaded_mm' and 'is_lazy' against their
* write ordering in switch_mm_irqs_off(). Ensure
* 'is_lazy' is at least as new as 'loaded_mm'.
*/
smp_rmb();

/* Lazy TLB will get flushed at the next context switch. */
if (per_cpu(cpu_tlbstate_shared.is_lazy, cpu))
return false;
Expand All @@ -1214,8 +1223,15 @@ static bool should_flush_tlb(int cpu, void *data)
if (!info->mm)
return true;

/*
* While switching, the remote CPU could have state from
* either the prev or next mm. Assume the worst and flush.
*/
if (loaded_mm == LOADED_MM_SWITCHING)
return true;

/* The target mm is loaded, and the CPU is not lazy. */
if (per_cpu(cpu_tlbstate.loaded_mm, cpu) == info->mm)
if (loaded_mm == info->mm)
return true;

/* In cpumask, but not the loaded mm? Periodically remove by flushing. */
Expand Down
3 changes: 2 additions & 1 deletion block/blk.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ static inline void blk_zone_update_request_bio(struct request *rq,
* the original BIO sector so that blk_zone_write_plug_bio_endio() can
* lookup the zone write plug.
*/
if (req_op(rq) == REQ_OP_ZONE_APPEND || bio_zone_write_plugging(bio))
if (req_op(rq) == REQ_OP_ZONE_APPEND ||
bio_flagged(bio, BIO_EMULATES_ZONE_APPEND))
bio->bi_iter.bi_sector = rq->__sector;
}
void blk_zone_write_plug_bio_endio(struct bio *bio);
Expand Down
6 changes: 1 addition & 5 deletions block/ioprio.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ int ioprio_check_cap(int ioprio)
*/
if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_NICE))
return -EPERM;
fallthrough;
/* rt has prio field too */
case IOPRIO_CLASS_BE:
if (level >= IOPRIO_NR_LEVELS)
return -EINVAL;
break;
case IOPRIO_CLASS_BE:
case IOPRIO_CLASS_IDLE:
break;
case IOPRIO_CLASS_NONE:
Expand Down
23 changes: 23 additions & 0 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,17 @@ static void loop_assign_backing_file(struct loop_device *lo, struct file *file)
lo->lo_min_dio_size = loop_query_min_dio_size(lo);
}

static int loop_check_backing_file(struct file *file)
{
if (!file->f_op->read_iter)
return -EINVAL;

if ((file->f_mode & FMODE_WRITE) && !file->f_op->write_iter)
return -EINVAL;

return 0;
}

/*
* loop_change_fd switched the backing store of a loopback device to
* a new file. This is useful for operating system installers to free up
Expand All @@ -526,6 +537,10 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
if (!file)
return -EBADF;

error = loop_check_backing_file(file);
if (error)
return error;

/* suppress uevents while reconfiguring the device */
dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 1);

Expand Down Expand Up @@ -963,6 +978,14 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,

if (!file)
return -EBADF;

if ((mode & BLK_OPEN_WRITE) && !file->f_op->write_iter)
return -EINVAL;

error = loop_check_backing_file(file);
if (error)
return error;

is_loop = is_loop_device(file);

/* This is safe, since we have a reference from open(). */
Expand Down
3 changes: 2 additions & 1 deletion drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4493,7 +4493,8 @@ static void nvme_fw_act_work(struct work_struct *work)
msleep(100);
}

if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE))
if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING) ||
!nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE))
return;

nvme_unquiesce_io_queues(ctrl);
Expand Down
Loading