Repository navigation
Commit d69b78b
ioprio: grab rcu_read_lock in sys_ioprio_{set,get}()
Using:
- CONFIG_LOCKUP_DETECTOR=y
- CONFIG_PREEMPT=y
- CONFIG_LOCKDEP=y
- CONFIG_PROVE_LOCKING=y
- CONFIG_PROVE_RCU=y
found a missing rcu lock during boot on a 512 MiB x86_64 ubuntu vm:
===================================================
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
kernel/pid.c:419 invoked rcu_dereference_check() without protection!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
1 lock held by ureadahead/1355:
#0: (tasklist_lock){.+.+..}, at: [<ffffffff8115bc09>] sys_ioprio_set+0x7f/0x29e
stack backtrace:
Pid: 1355, comm: ureadahead Not tainted 2.6.37-dbg-DEV raspberrypi#1
Call Trace:
[<ffffffff8109c10c>] lockdep_rcu_dereference+0xaa/0xb3
[<ffffffff81088cbf>] find_task_by_pid_ns+0x44/0x5d
[<ffffffff81088cfa>] find_task_by_vpid+0x22/0x24
[<ffffffff8115bc3e>] sys_ioprio_set+0xb4/0x29e
[<ffffffff8147cf21>] ? trace_hardirqs_off_thunk+0x3a/0x3c
[<ffffffff8105c409>] sysenter_dispatch+0x7/0x2c
[<ffffffff8147cee2>] ? trace_hardirqs_on_thunk+0x3a/0x3f
The fix is to:
a) grab rcu lock in sys_ioprio_{set,get}() and
b) avoid grabbing tasklist_lock.
Discussion in: http://marc.info/?l=linux-kernel&m=128951324702889
Signed-off-by: Greg Thelen <gthelen@google.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Modified by Jens to remove the now redundant inner rcu lock and
unlock since they are now protected by the outer lock.
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>1 parent 1ff5125 commit d69b78b
1 file changed
Lines changed: 6 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 106 | + | |
112 | 107 | | |
113 | 108 | | |
114 | | - | |
115 | 109 | | |
116 | 110 | | |
117 | 111 | | |
118 | 112 | | |
119 | 113 | | |
120 | 114 | | |
121 | | - | |
122 | 115 | | |
123 | 116 | | |
124 | 117 | | |
| |||
141 | 134 | | |
142 | 135 | | |
143 | 136 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 137 | + | |
150 | 138 | | |
151 | 139 | | |
152 | 140 | | |
| |||
160 | 148 | | |
161 | 149 | | |
162 | 150 | | |
163 | | - | |
| 151 | + | |
164 | 152 | | |
165 | 153 | | |
166 | 154 | | |
| |||
204 | 192 | | |
205 | 193 | | |
206 | 194 | | |
207 | | - | |
| 195 | + | |
208 | 196 | | |
209 | 197 | | |
210 | | - | |
211 | 198 | | |
212 | 199 | | |
213 | 200 | | |
214 | 201 | | |
215 | 202 | | |
216 | 203 | | |
217 | | - | |
218 | 204 | | |
219 | 205 | | |
220 | 206 | | |
| |||
241 | 227 | | |
242 | 228 | | |
243 | 229 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 230 | + | |
250 | 231 | | |
251 | 232 | | |
252 | 233 | | |
| |||
264 | 245 | | |
265 | 246 | | |
266 | 247 | | |
267 | | - | |
| 248 | + | |
268 | 249 | | |
269 | 250 | | |
0 commit comments