Qais Yousef
cd65f53a58
ANDROID: sched/uclamp: Don't enable uclamp_is_used static key by in-kernel requests
We do have now in-kernel users of uclamp to implement inheritance. The
static_branch_enable() path unconditionally holds the cpus_read_lock()
which might_sleep(). The path in binder that implements inheritance
happens from in_atomic() context which leads to a splat like this one:
[ 147.529960] BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:56
[ 147.530196] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2586, name: RenderThread
[ 147.530410] INFO: lockdep is turned off.
[ 147.530518] Preemption disabled at:
[ 147.530521] [<ffffffc008ca2cec>] binder_proc_transaction+0x78/0x41c
[ 147.530793] CPU: 8 PID: 2586 Comm: RenderThread Tainted: G S W O 5.15.76-android14-5-00086-gc01afe5d262f #1
[ 147.531214] Call trace:
[ 147.531288] dump_backtrace+0xe8/0x134
[ 147.531444] show_stack+0x1c/0x4c
[ 147.531598] dump_stack_lvl+0x74/0x94
[ 147.531766] dump_stack+0x14/0x3c
[ 147.531920] ___might_sleep+0x210/0x230
[ 147.532094] __might_sleep+0x54/0x84
[ 147.532259] cpus_read_lock+0x2c/0x160
[ 147.532429] static_key_enable+0x1c/0x34
[ 147.532608] __sched_setscheduler+0x2a8/0x99c
[ 147.532802] sched_setattr_nocheck+0x1c/0x24
[ 147.532994] binder_do_set_priority+0x31c/0x4a4
[ 147.533195] binder_transaction_priority+0x200/0x3f4
[ 147.533413] binder_proc_transaction+0x220/0x41c
[ 147.533618] binder_transaction+0x1df0/0x234c
[ 147.533812] binder_thread_write+0xd84/0x2398
[ 147.534007] binder_ioctl_write_read+0x19c/0xb28
[ 147.534212] binder_ioctl+0x344/0x1a3c
[ 147.534382] __arm64_sys_ioctl+0x94/0xc8
[ 147.534561] invoke_syscall+0x44/0xf8
[ 147.534729] el0_svc_common+0xc8/0x10c
[ 147.534900] do_el0_svc+0x20/0x28
[ 147.535053] el0_svc+0x58/0xe0
[ 147.535198] el0t_64_sync_handler+0x7c/0xe4
[ 147.535386] el0t_64_sync+0x188/0x18c
Prevent enabling the lock for !user initiated sched_setattr()
operations. Generally we don't expect in-kernel uclamp users.
Bug: 259145692
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: Iac5be139b5ffd39f5e1c0431ce253133d81b98cf
2022-12-05 20:29:35 +00:00
..
2022-11-28 16:08:50 +00:00
2022-11-30 00:28:11 +00:00
2022-05-25 09:57:37 +02:00
2022-10-05 11:59:55 +02:00
2022-09-20 12:39:42 +02:00
2022-11-28 16:08:50 +00:00
2022-12-02 17:41:09 +01:00
2022-12-04 12:02:10 +00:00
2021-09-02 13:00:15 -07:00
2022-10-26 12:34:30 +02:00
2022-09-24 14:14:08 +02:00
2022-11-15 12:48:44 +00:00
2022-07-13 11:40:42 +02:00
2022-11-02 08:51:19 +01:00
2022-12-05 20:29:35 +00:00
2022-09-21 17:30:12 +02:00
2022-11-28 16:08:50 +00:00
2022-04-27 15:34:29 +00:00
2021-09-08 11:50:26 -07:00
2022-02-23 12:03:07 +01:00
2022-08-31 17:16:33 +02:00
2021-08-24 18:52:36 -04:00
2022-02-08 18:34:03 +01:00
2022-04-08 14:23:06 +02:00
2022-04-08 14:23:06 +02:00
2022-11-30 00:28:11 +00:00
2022-11-14 22:32:51 +00:00
2021-09-08 15:32:35 -07:00
2021-08-16 18:55:32 +02:00
2022-06-14 11:49:05 +02:00
2021-12-29 12:28:49 +01:00
2022-02-23 12:30:26 +01:00
2022-11-30 00:28:11 +00:00
2022-11-30 00:28:11 +00:00
2022-02-10 09:29:57 +00:00
2021-09-16 09:51:19 +02:00
2022-07-14 22:20:19 +00:00
2022-12-01 00:22:47 +00:00
2022-02-10 09:29:34 +00:00
2021-08-17 17:50:51 +02:00
2021-08-30 16:36:10 +02:00
2022-07-21 21:24:29 +02:00
2021-09-08 15:32:34 -07:00
2022-11-26 09:24:50 +01:00
2022-11-14 22:32:51 +00:00
2022-09-30 17:41:39 +00:00
2022-09-30 17:41:39 +00:00
2021-08-16 18:55:32 +02:00
2021-09-03 09:58:12 -07:00
2021-08-27 16:30:18 +08:00
2021-08-30 16:36:10 +02:00
2021-09-03 09:58:12 -07:00
2021-09-02 09:42:36 +02:00
2022-08-17 14:24:04 +02:00
2022-06-09 10:22:29 +02:00
2021-09-28 08:49:54 -07:00
2022-04-08 14:23:43 +02:00
2022-04-08 14:23:10 +02:00
2022-06-09 10:22:46 +02:00
2022-03-21 15:31:19 +00:00
2022-02-16 12:56:38 +01:00
2022-07-22 17:43:50 +02:00
2022-08-17 14:24:24 +02:00
2021-11-11 18:55:19 +00:00
2022-02-23 12:03:07 +01:00
2022-04-24 16:57:32 +02:00
2022-04-13 20:59:28 +02:00
2022-04-13 20:59:28 +02:00
2021-11-09 00:42:10 +00:00
2022-08-31 17:16:33 +02:00
2022-08-10 08:58:11 +01:00
2022-08-02 08:37:15 +02:00
2021-09-14 16:16:54 +02:00
2022-01-27 11:05:35 +01:00
2022-02-23 12:03:20 +01:00
2022-07-19 03:54:51 +00:00
2022-03-08 19:12:42 +01:00
2021-09-08 11:50:27 -07:00
2022-08-03 12:03:43 +02:00
2022-09-24 10:01:09 +02:00
2021-08-17 07:49:10 -10:00
2022-09-28 13:32:32 +02:00