History

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

Linus Torvalds committed 4 years ago

Commit 48a60bd2 parents 5ba13c1 985faa719 files · +46 −34Browse files

Showing the changes to kernel (3 of 19 files). Show all

Unified · Split

3 files
  1. kernel/entry/common.c +2 −2
  2. kernel/entry/kvm.c +2 −2
  3. kernel/sched/core.c +1 −1
kernel/entry/common.c+2−2
@@ -187,7 +187,7 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs, · 186 unmodified lines
187187 /* Check if any of the above work has queued a deferred wakeup */
188188 tick_nohz_user_enter_prepare();
189189
190− ti_work = READ_ONCE(current_thread_info()->flags);
190+ ti_work = read_thread_flags();
191191 }
192192
193193 /* Return the latest work state for arch_exit_to_user_mode() */
@@ -196,7 +196,7 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs, · 2 unmodified lines
196196
197197 static void exit_to_user_mode_prepare(struct pt_regs *regs)
198198 {
199− unsigned long ti_work = READ_ONCE(current_thread_info()->flags);
199+ unsigned long ti_work = read_thread_flags();
200200
201201 lockdep_assert_irqs_disabled();
202202
kernel/entry/kvm.c+2−2
@@ -26,7 +26,7 @@ static int xfer_to_guest_mode_work(struct kvm_vcpu *vcpu, unsigned long ti_work) · 25 unmodified lines
2626 if (ret)
2727 return ret;
2828
29− ti_work = READ_ONCE(current_thread_info()->flags);
29+ ti_work = read_thread_flags();
3030 } while (ti_work & XFER_TO_GUEST_MODE_WORK || need_resched());
3131 return 0;
3232 }
@@ -43,7 +43,7 @@ int xfer_to_guest_mode_handle_work(struct kvm_vcpu *vcpu) · 10 unmodified lines
4343 * disabled in the inner loop before going into guest mode. No need
4444 * to disable interrupts here.
4545 */
46− ti_work = READ_ONCE(current_thread_info()->flags);
46+ ti_work = read_thread_flags();
4747 if (!(ti_work & XFER_TO_GUEST_MODE_WORK))
4848 return 0;
4949
kernel/sched/core.c+1−1
@@ -8520,7 +8520,7 @@ void sched_show_task(struct task_struct *p) · 8519 unmodified lines
85208520 rcu_read_unlock();
85218521 pr_cont(" stack:%5lu pid:%5d ppid:%6d flags:0x%08lx\n",
85228522 free, task_pid_nr(p), ppid,
8523− (unsigned long)task_thread_info(p)->flags);
8523+ read_task_thread_flags(p));
85248524
85258525 print_worker_info(KERN_INFO, p);
85268526 print_stop_info(KERN_INFO, p);