Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'locking_urgent_for_v6.16_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fixes from Borislav Petkov:

- Make sure the switch to the global hash is requested always under a
lock so that two threads requesting that simultaneously cannot get to
inconsistent state

- Reject negative NUMA nodes earlier in the futex NUMA interface
handling code

- Selftests fixes

* tag 'locking_urgent_for_v6.16_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
futex: Verify under the lock if hash can be replaced
futex: Handle invalid node numbers supplied by user
selftests/futex: Set the home_node in futex_numa_mpol
selftests/futex: getopt() requires int as return value.

+20 -6
+12 -2
kernel/futex/core.c
··· 583 583 if (futex_get_value(&node, naddr)) 584 584 return -EFAULT; 585 585 586 - if (node != FUTEX_NO_NODE && 587 - (node >= MAX_NUMNODES || !node_possible(node))) 586 + if ((node != FUTEX_NO_NODE) && 587 + ((unsigned int)node >= MAX_NUMNODES || !node_possible(node))) 588 588 return -EINVAL; 589 589 } 590 590 ··· 1629 1629 mm->futex_phash_new = NULL; 1630 1630 1631 1631 if (fph) { 1632 + if (cur && (!cur->hash_mask || cur->immutable)) { 1633 + /* 1634 + * If two threads simultaneously request the global 1635 + * hash then the first one performs the switch, 1636 + * the second one returns here. 1637 + */ 1638 + free = fph; 1639 + mm->futex_phash_new = new; 1640 + return -EBUSY; 1641 + } 1632 1642 if (cur && !new) { 1633 1643 /* 1634 1644 * If we have an existing hash, but do not yet have
+7 -3
tools/testing/selftests/futex/functional/futex_numa_mpol.c
··· 144 144 struct futex32_numa *futex_numa; 145 145 int mem_size, i; 146 146 void *futex_ptr; 147 - char c; 147 + int c; 148 148 149 149 while ((c = getopt(argc, argv, "chv:")) != -1) { 150 150 switch (c) { ··· 210 210 ret = mbind(futex_ptr, mem_size, MPOL_BIND, &nodemask, 211 211 sizeof(nodemask) * 8, 0); 212 212 if (ret == 0) { 213 + ret = numa_set_mempolicy_home_node(futex_ptr, mem_size, i, 0); 214 + if (ret != 0) 215 + ksft_exit_fail_msg("Failed to set home node: %m, %d\n", errno); 216 + 213 217 ksft_print_msg("Node %d test\n", i); 214 218 futex_numa->futex = 0; 215 219 futex_numa->numa = FUTEX_NO_NODE; ··· 224 220 if (0) 225 221 test_futex_mpol(futex_numa, 0); 226 222 if (futex_numa->numa != i) { 227 - ksft_test_result_fail("Returned NUMA node is %d expected %d\n", 228 - futex_numa->numa, i); 223 + ksft_exit_fail_msg("Returned NUMA node is %d expected %d\n", 224 + futex_numa->numa, i); 229 225 } 230 226 } 231 227 }
+1 -1
tools/testing/selftests/futex/functional/futex_priv_hash.c
··· 130 130 pthread_mutexattr_t mutex_attr_pi; 131 131 int use_global_hash = 0; 132 132 int ret; 133 - char c; 133 + int c; 134 134 135 135 while ((c = getopt(argc, argv, "cghv:")) != -1) { 136 136 switch (c) {