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

Merge tag 'x86-urgent-2025-06-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
"A small set of x86 fixes:

- Cure IO bitmap inconsistencies

A failed fork cleans up all resources of the newly created thread
via exit_thread(). exit_thread() invokes io_bitmap_exit() which
does the IO bitmap cleanups, which unfortunately assume that the
cleanup is related to the current task, which is obviously bogus.

Make it work correctly

- A lockdep fix in the resctrl code removed the clearing of the
command buffer in two places, which keeps stale error messages
around. Bring them back.

- Remove unused trace events"

* tag 'x86-urgent-2025-06-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
fs/resctrl: Restore the rdt_last_cmd_clear() calls after acquiring rdtgroup_mutex
x86/iopl: Cure TIF_IO_BITMAP inconsistencies
x86/fpu: Remove unused trace events

+19 -19
-15
arch/x86/include/asm/trace/fpu.h
··· 44 44 TP_ARGS(fpu) 45 45 ); 46 46 47 - DEFINE_EVENT(x86_fpu, x86_fpu_before_restore, 48 - TP_PROTO(struct fpu *fpu), 49 - TP_ARGS(fpu) 50 - ); 51 - 52 - DEFINE_EVENT(x86_fpu, x86_fpu_after_restore, 53 - TP_PROTO(struct fpu *fpu), 54 - TP_ARGS(fpu) 55 - ); 56 - 57 47 DEFINE_EVENT(x86_fpu, x86_fpu_regs_activated, 58 48 TP_PROTO(struct fpu *fpu), 59 49 TP_ARGS(fpu) 60 50 ); 61 51 62 52 DEFINE_EVENT(x86_fpu, x86_fpu_regs_deactivated, 63 - TP_PROTO(struct fpu *fpu), 64 - TP_ARGS(fpu) 65 - ); 66 - 67 - DEFINE_EVENT(x86_fpu, x86_fpu_init_state, 68 53 TP_PROTO(struct fpu *fpu), 69 54 TP_ARGS(fpu) 70 55 );
+9 -4
arch/x86/kernel/ioport.c
··· 33 33 set_tsk_thread_flag(tsk, TIF_IO_BITMAP); 34 34 } 35 35 36 - static void task_update_io_bitmap(struct task_struct *tsk) 36 + static void task_update_io_bitmap(void) 37 37 { 38 + struct task_struct *tsk = current; 38 39 struct thread_struct *t = &tsk->thread; 39 40 40 41 if (t->iopl_emul == 3 || t->io_bitmap) { ··· 55 54 struct io_bitmap *iobm = tsk->thread.io_bitmap; 56 55 57 56 tsk->thread.io_bitmap = NULL; 58 - task_update_io_bitmap(tsk); 57 + /* 58 + * Don't touch the TSS when invoked on a failed fork(). TSS 59 + * reflects the state of @current and not the state of @tsk. 60 + */ 61 + if (tsk == current) 62 + task_update_io_bitmap(); 59 63 if (iobm && refcount_dec_and_test(&iobm->refcnt)) 60 64 kfree(iobm); 61 65 } ··· 198 192 } 199 193 200 194 t->iopl_emul = level; 201 - task_update_io_bitmap(current); 202 - 195 + task_update_io_bitmap(); 203 196 return 0; 204 197 } 205 198
+6
arch/x86/kernel/process.c
··· 176 176 frame->ret_addr = (unsigned long) ret_from_fork_asm; 177 177 p->thread.sp = (unsigned long) fork_frame; 178 178 p->thread.io_bitmap = NULL; 179 + clear_tsk_thread_flag(p, TIF_IO_BITMAP); 179 180 p->thread.iopl_warn = 0; 180 181 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps)); 181 182 ··· 464 463 *base = IO_BITMAP_OFFSET_VALID_ALL; 465 464 } else { 466 465 struct io_bitmap *iobm = t->io_bitmap; 466 + 467 + if (WARN_ON_ONCE(!iobm)) { 468 + clear_thread_flag(TIF_IO_BITMAP); 469 + native_tss_invalidate_io_bitmap(); 470 + } 467 471 468 472 /* 469 473 * Only copy bitmap data when the sequence number differs. The
+4
fs/resctrl/rdtgroup.c
··· 536 536 goto unlock; 537 537 } 538 538 539 + rdt_last_cmd_clear(); 540 + 539 541 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED || 540 542 rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { 541 543 ret = -EINVAL; ··· 3473 3471 ret = -ENODEV; 3474 3472 goto out_unlock; 3475 3473 } 3474 + 3475 + rdt_last_cmd_clear(); 3476 3476 3477 3477 /* 3478 3478 * Check that the parent directory for a monitor group is a "mon_groups"