Commit 48a60bdb authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'core_entry_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull thread_info flag accessor helper updates from Borislav Petkov:
 "Add a set of thread_info.flags accessors which snapshot it before
  accesing it in order to prevent any potential data races, and convert
  all users to those new accessors"

* tag 'core_entry_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  powerpc: Snapshot thread flags
  powerpc: Avoid discarding flags in system_call_exception()
  openrisc: Snapshot thread flags
  microblaze: Snapshot thread flags
  arm64: Snapshot thread flags
  ARM: Snapshot thread flags
  alpha: Snapshot thread flags
  sched: Snapshot thread flags
  entry: Snapshot thread flags
  x86: Snapshot thread flags
  thread_info: Add helpers to snapshot thread flags
parents 5ba13c1c 985faa78
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -535,6 +535,6 @@ do_work_pending(struct pt_regs *regs, unsigned long thread_flags,
			}
		}
		local_irq_disable();
		thread_flags = current_thread_info()->flags;
		thread_flags = read_thread_flags();
	} while (thread_flags & _TIF_WORK_MASK);
}
+1 −1
Original line number Diff line number Diff line
@@ -631,7 +631,7 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
			}
		}
		local_irq_disable();
		thread_flags = current_thread_info()->flags;
		thread_flags = read_thread_flags();
	} while (thread_flags & _TIF_WORK_MASK);
	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -990,7 +990,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
		 * there is no work pending for this thread.
		 */
		raw_local_irq_disable();
		if (!(current_thread_info()->flags & _TIF_WORK_MASK))
		if (!(read_thread_flags() & _TIF_WORK_MASK))
			set_cr(cr_no_alignment);
	}

+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ static __always_inline void prepare_exit_to_user_mode(struct pt_regs *regs)

	local_daif_mask();

	flags = READ_ONCE(current_thread_info()->flags);
	flags = read_thread_flags();
	if (unlikely(flags & _TIF_WORK_MASK))
		do_notify_resume(regs, flags);
}
+2 −2
Original line number Diff line number Diff line
@@ -1839,7 +1839,7 @@ static void tracehook_report_syscall(struct pt_regs *regs,

int syscall_trace_enter(struct pt_regs *regs)
{
	unsigned long flags = READ_ONCE(current_thread_info()->flags);
	unsigned long flags = read_thread_flags();

	if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
		tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
@@ -1862,7 +1862,7 @@ int syscall_trace_enter(struct pt_regs *regs)

void syscall_trace_exit(struct pt_regs *regs)
{
	unsigned long flags = READ_ONCE(current_thread_info()->flags);
	unsigned long flags = read_thread_flags();

	audit_syscall_exit(regs);

Loading