Skip to content

Commit 699aee7

Browse files
committed
Merge tag 'mm-hotfixes-stable-2022-12-22-14-34' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull hotfixes from Andrew Morton: "Eight fixes, all cc:stable. One is for gcov and the remainder are MM" * tag 'mm-hotfixes-stable-2022-12-22-14-34' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: gcov: add support for checksum field test_maple_tree: add test for mas_spanning_rebalance() on insufficient data maple_tree: fix mas_spanning_rebalance() on insufficient data hugetlb: really allocate vma lock for all sharable vmas kmsan: export kmsan_handle_urb kmsan: include linux/vmalloc.h mm/mempolicy: fix memory leak in set_mempolicy_home_node system call mm, mremap: fix mremap() expanding vma with addr inside vma
2 parents 8395ae0 + e96b95c commit 699aee7

File tree

8 files changed

+184
-187
lines changed

8 files changed

+184
-187
lines changed

kernel/gcov/gcc_4_7.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ struct gcov_fn_info {
8282
* @version: gcov version magic indicating the gcc version used for compilation
8383
* @next: list head for a singly-linked list
8484
* @stamp: uniquifying time stamp
85+
* @checksum: unique object checksum
8586
* @filename: name of the associated gcov data file
8687
* @merge: merge functions (null for unused counter type)
8788
* @n_functions: number of instrumented functions
@@ -94,6 +95,10 @@ struct gcov_info {
9495
unsigned int version;
9596
struct gcov_info *next;
9697
unsigned int stamp;
98+
/* Since GCC 12.1 a checksum field is added. */
99+
#if (__GNUC__ >= 12)
100+
unsigned int checksum;
101+
#endif
97102
const char *filename;
98103
void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int);
99104
unsigned int n_functions;

lib/maple_tree.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,9 @@ static int mas_spanning_rebalance(struct ma_state *mas,
29942994
mast->free = &free;
29952995
mast->destroy = &destroy;
29962996
l_mas.node = r_mas.node = m_mas.node = MAS_NONE;
2997-
if (!(mast->orig_l->min && mast->orig_r->max == ULONG_MAX) &&
2997+
2998+
/* Check if this is not root and has sufficient data. */
2999+
if (((mast->orig_l->min != 0) || (mast->orig_r->max != ULONG_MAX)) &&
29983000
unlikely(mast->bn->b_end <= mt_min_slots[mast->bn->type]))
29993001
mast_spanning_rebalance(mast);
30003002

lib/test_maple_tree.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,6 +2498,25 @@ static noinline void check_dup(struct maple_tree *mt)
24982498
}
24992499
}
25002500

2501+
static noinline void check_bnode_min_spanning(struct maple_tree *mt)
2502+
{
2503+
int i = 50;
2504+
MA_STATE(mas, mt, 0, 0);
2505+
2506+
mt_set_non_kernel(9999);
2507+
mas_lock(&mas);
2508+
do {
2509+
mas_set_range(&mas, i*10, i*10+9);
2510+
mas_store(&mas, check_bnode_min_spanning);
2511+
} while (i--);
2512+
2513+
mas_set_range(&mas, 240, 509);
2514+
mas_store(&mas, NULL);
2515+
mas_unlock(&mas);
2516+
mas_destroy(&mas);
2517+
mt_set_non_kernel(0);
2518+
}
2519+
25012520
static DEFINE_MTREE(tree);
25022521
static int maple_tree_seed(void)
25032522
{
@@ -2742,6 +2761,10 @@ static int maple_tree_seed(void)
27422761
check_dup(&tree);
27432762
mtree_destroy(&tree);
27442763

2764+
mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE);
2765+
check_bnode_min_spanning(&tree);
2766+
mtree_destroy(&tree);
2767+
27452768
#if defined(BENCH)
27462769
skip:
27472770
#endif

0 commit comments

Comments
 (0)