History

Merge tag 'locking_urgent_for_v6.17_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fixes from Borislav Petkov: - Make sure sanity checks down in the mutex lock path happen on the correct type of task so that they don't trigger falsely - Use the write unsafe user access pairs when writing a futex value to prevent an error on PowerPC which does user read and write accesses differently * tag 'locking_urgent_for_v6.17_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking: Fix __clear_task_blocked_on() warning from __ww_mutex_wound() path futex: Use user_write_access_begin/_end() in futex_put_value()

Linus Torvalds committed 1 year ago

Commit 0a9ee9c2 parents 99bade3 21924af3 files · +25 −16Browse files

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

Unified · Split

2 files
  1. kernel/futex/futex.h +3 −3
  2. kernel/locking/ww_mutex.h +5 −1
kernel/futex/futex.h+3−3
@@ -319,13 +319,13 @@ static __always_inline int futex_put_value(u32 val, u32 __user *to) · 318 unmodified lines
319319 {
320320 if (can_do_masked_user_access())
321321 to = masked_user_access_begin(to);
322− else if (!user_read_access_begin(to, sizeof(*to)))
322+ else if (!user_write_access_begin(to, sizeof(*to)))
323323 return -EFAULT;
324324 unsafe_put_user(val, to, Efault);
325− user_read_access_end();
325+ user_write_access_end();
326326 return 0;
327327 Efault:
328− user_read_access_end();
328+ user_write_access_end();
329329 return -EFAULT;
330330 }
331331
kernel/locking/ww_mutex.h+5−1
@@ -342,8 +342,12 @@ static bool __ww_mutex_wound(struct MUTEX *lock, · 341 unmodified lines
342342 * When waking up the task to wound, be sure to clear the
343343 * blocked_on pointer. Otherwise we can see circular
344344 * blocked_on relationships that can't resolve.
345+ *
346+ * NOTE: We pass NULL here instead of lock, because we
347+ * are waking the mutex owner, who may be currently
348+ * blocked on a different mutex.
345349 */
346− __clear_task_blocked_on(owner, lock);
350+ __clear_task_blocked_on(owner, NULL);
347351 wake_q_add(wake_q, owner);
348352 }
349353 return true;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t