linux-stable/include
Tejun Heo 0b1c102e9d cgroup: Use css_tryget() instead of css_tryget_online() in task_get_css()
commit 18fa84a2db upstream.

A PF_EXITING task can stay associated with an offline css.  If such
task calls task_get_css(), it can get stuck indefinitely.  This can be
triggered by BSD process accounting which writes to a file with
PF_EXITING set when racing against memcg disable as in the backtrace
at the end.

After this change, task_get_css() may return a css which was already
offline when the function was called.  None of the existing users are
affected by this change.

  INFO: rcu_sched self-detected stall on CPU
  INFO: rcu_sched detected stalls on CPUs/tasks:
  ...
  NMI backtrace for cpu 0
  ...
  Call Trace:
   <IRQ>
   dump_stack+0x46/0x68
   nmi_cpu_backtrace.cold.2+0x13/0x57
   nmi_trigger_cpumask_backtrace+0xba/0xca
   rcu_dump_cpu_stacks+0x9e/0xce
   rcu_check_callbacks.cold.74+0x2af/0x433
   update_process_times+0x28/0x60
   tick_sched_timer+0x34/0x70
   __hrtimer_run_queues+0xee/0x250
   hrtimer_interrupt+0xf4/0x210
   smp_apic_timer_interrupt+0x56/0x110
   apic_timer_interrupt+0xf/0x20
   </IRQ>
  RIP: 0010:balance_dirty_pages_ratelimited+0x28f/0x3d0
  ...
   btrfs_file_write_iter+0x31b/0x563
   __vfs_write+0xfa/0x140
   __kernel_write+0x4f/0x100
   do_acct_process+0x495/0x580
   acct_process+0xb9/0xdb
   do_exit+0x748/0xa00
   do_group_exit+0x3a/0xa0
   get_signal+0x254/0x560
   do_signal+0x23/0x5c0
   exit_to_usermode_loop+0x5d/0xa0
   prepare_exit_to_usermode+0x53/0x80
   retint_user+0x8/0x8

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org # v4.2+
Fixes: ec438699a9 ("cgroup, block: implement task_get_css() and use it in bio_associate_current()")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-19 08:20:55 +02:00
..
acpi ACPICA: Reference Counts: increase max to 0x4000 for large servers 2019-03-19 13:13:21 +01:00
asm-generic mm: introduce mm_[p4d|pud|pmd]_folded 2019-05-16 19:42:28 +02:00
clocksource
crypto crypto: vmac - separate tfm and request context 2018-08-17 21:01:10 +02:00
drm drm: don't block fb changes for async plane updates 2019-06-15 11:55:00 +02:00
dt-bindings dt-bindings: clock: mediatek: add binding for fixed-factor clock axisel_d4 2018-04-24 09:36:34 +02:00
keys keys: Fix dependency loop between construction record and auth key 2019-03-23 14:35:14 +01:00
kvm arm/arm64: KVM: Add PSCI version selection API 2018-05-01 12:58:27 -07:00
linux cgroup: Use css_tryget() instead of css_tryget_online() in task_get_css() 2019-06-19 08:20:55 +02:00
math-emu
media media: cec: make cec_get_edid_spa_location() an inline function 2019-05-16 19:42:26 +02:00
memory
misc
net tcp: add tcp_min_snd_mss sysctl 2019-06-17 19:52:44 +02:00
pcmcia
ras
rdma IB/rxe: Revise the ib_wr_opcode enum 2019-05-16 19:42:25 +02:00
scsi scsi: fcoe: make use of fip_mode enum complete 2019-04-05 22:31:31 +02:00
soc memory: tegra: Apply interrupts mask per SoC 2018-08-03 07:50:38 +02:00
sound ALSA: compress: Fix stop handling on compressed capture streams 2019-02-12 19:46:11 +01:00
target
trace sched, trace: Fix prev_state output in sched_switch tracepoint 2019-02-20 10:20:55 +01:00
uapi tcp: tcp_fragment() should apply sane memory limits 2019-06-17 19:52:44 +02:00
video udlfb: set optimal write delay 2018-09-09 19:56:01 +02:00
xen x86/xen/time: setup vcpu 0 time info page 2019-01-31 08:13:47 +01:00