Skip to content

Commit 0023224

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "14 patches. Subsystems affected by this patch series: mm (hugetlb, kasan, gup, selftests, z3fold, kfence, memblock, and highmem), squashfs, ia64, gcov, and mailmap" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: mailmap: update Andrey Konovalov's email address mm/highmem: fix CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP mm: memblock: fix section mismatch warning again kfence: make compatible with kmemleak gcov: fix clang-11+ support ia64: fix format strings for err_inject ia64: mca: allocate early mca with GFP_ATOMIC squashfs: fix xattr id and id lookup sanity checks squashfs: fix inode lookup sanity checks z3fold: prevent reclaim/free race for headless pages selftests/vm: fix out-of-tree build mm/mmu_notifiers: ensure range_end() is paired with range_start() kasan: fix per-page tags for non-page_alloc pages hugetlb_cgroup: fix imbalanced css_get and css_put pair for shared mappings
2 parents 2ba9bea + d3e2ff2 commit 0023224

File tree

20 files changed

+230
-42
lines changed

20 files changed

+230
-42
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Andrew Morton <akpm@linux-foundation.org>
3636
Andrew Murray <amurray@thegoodpenguin.co.uk> <amurray@embedded-bits.co.uk>
3737
Andrew Murray <amurray@thegoodpenguin.co.uk> <andrew.murray@arm.com>
3838
Andrew Vasquez <andrew.vasquez@qlogic.com>
39+
Andrey Konovalov <andreyknvl@gmail.com> <andreyknvl@google.com>
3940
Andrey Ryabinin <ryabinin.a.a@gmail.com> <a.ryabinin@samsung.com>
4041
Andrey Ryabinin <ryabinin.a.a@gmail.com> <aryabinin@virtuozzo.com>
4142
Andy Adamson <andros@citi.umich.edu>

arch/ia64/kernel/err_inject.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ show_##name(struct device *dev, struct device_attribute *attr, \
5959
char *buf) \
6060
{ \
6161
u32 cpu=dev->id; \
62-
return sprintf(buf, "%lx\n", name[cpu]); \
62+
return sprintf(buf, "%llx\n", name[cpu]); \
6363
}
6464

6565
#define store(name) \
@@ -86,9 +86,9 @@ store_call_start(struct device *dev, struct device_attribute *attr,
8686

8787
#ifdef ERR_INJ_DEBUG
8888
printk(KERN_DEBUG "pal_mc_err_inject for cpu%d:\n", cpu);
89-
printk(KERN_DEBUG "err_type_info=%lx,\n", err_type_info[cpu]);
90-
printk(KERN_DEBUG "err_struct_info=%lx,\n", err_struct_info[cpu]);
91-
printk(KERN_DEBUG "err_data_buffer=%lx, %lx, %lx.\n",
89+
printk(KERN_DEBUG "err_type_info=%llx,\n", err_type_info[cpu]);
90+
printk(KERN_DEBUG "err_struct_info=%llx,\n", err_struct_info[cpu]);
91+
printk(KERN_DEBUG "err_data_buffer=%llx, %llx, %llx.\n",
9292
err_data_buffer[cpu].data1,
9393
err_data_buffer[cpu].data2,
9494
err_data_buffer[cpu].data3);
@@ -117,8 +117,8 @@ store_call_start(struct device *dev, struct device_attribute *attr,
117117

118118
#ifdef ERR_INJ_DEBUG
119119
printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]);
120-
printk(KERN_DEBUG "capabilities=%lx,\n", capabilities[cpu]);
121-
printk(KERN_DEBUG "resources=%lx\n", resources[cpu]);
120+
printk(KERN_DEBUG "capabilities=%llx,\n", capabilities[cpu]);
121+
printk(KERN_DEBUG "resources=%llx\n", resources[cpu]);
122122
#endif
123123
return size;
124124
}
@@ -131,7 +131,7 @@ show_virtual_to_phys(struct device *dev, struct device_attribute *attr,
131131
char *buf)
132132
{
133133
unsigned int cpu=dev->id;
134-
return sprintf(buf, "%lx\n", phys_addr[cpu]);
134+
return sprintf(buf, "%llx\n", phys_addr[cpu]);
135135
}
136136

137137
static ssize_t
@@ -145,7 +145,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
145145
ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
146146
if (ret<=0) {
147147
#ifdef ERR_INJ_DEBUG
148-
printk("Virtual address %lx is not existing.\n",virt_addr);
148+
printk("Virtual address %llx is not existing.\n", virt_addr);
149149
#endif
150150
return -EINVAL;
151151
}
@@ -163,7 +163,7 @@ show_err_data_buffer(struct device *dev,
163163
{
164164
unsigned int cpu=dev->id;
165165

166-
return sprintf(buf, "%lx, %lx, %lx\n",
166+
return sprintf(buf, "%llx, %llx, %llx\n",
167167
err_data_buffer[cpu].data1,
168168
err_data_buffer[cpu].data2,
169169
err_data_buffer[cpu].data3);
@@ -178,13 +178,13 @@ store_err_data_buffer(struct device *dev,
178178
int ret;
179179

180180
#ifdef ERR_INJ_DEBUG
181-
printk("write err_data_buffer=[%lx,%lx,%lx] on cpu%d\n",
181+
printk("write err_data_buffer=[%llx,%llx,%llx] on cpu%d\n",
182182
err_data_buffer[cpu].data1,
183183
err_data_buffer[cpu].data2,
184184
err_data_buffer[cpu].data3,
185185
cpu);
186186
#endif
187-
ret=sscanf(buf, "%lx, %lx, %lx",
187+
ret = sscanf(buf, "%llx, %llx, %llx",
188188
&err_data_buffer[cpu].data1,
189189
&err_data_buffer[cpu].data2,
190190
&err_data_buffer[cpu].data3);

arch/ia64/kernel/mca.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ ia64_mca_cpu_init(void *cpu_data)
18241824
data = mca_bootmem();
18251825
first_time = 0;
18261826
} else
1827-
data = (void *)__get_free_pages(GFP_KERNEL,
1827+
data = (void *)__get_free_pages(GFP_ATOMIC,
18281828
get_order(sz));
18291829
if (!data)
18301830
panic("Could not allocate MCA memory for cpu %d\n",

fs/squashfs/export.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,18 @@ __le64 *squashfs_read_inode_lookup_table(struct super_block *sb,
152152
start = le64_to_cpu(table[n]);
153153
end = le64_to_cpu(table[n + 1]);
154154

155-
if (start >= end || (end - start) > SQUASHFS_METADATA_SIZE) {
155+
if (start >= end
156+
|| (end - start) >
157+
(SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
156158
kfree(table);
157159
return ERR_PTR(-EINVAL);
158160
}
159161
}
160162

161163
start = le64_to_cpu(table[indexes - 1]);
162-
if (start >= lookup_table_start || (lookup_table_start - start) > SQUASHFS_METADATA_SIZE) {
164+
if (start >= lookup_table_start ||
165+
(lookup_table_start - start) >
166+
(SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
163167
kfree(table);
164168
return ERR_PTR(-EINVAL);
165169
}

fs/squashfs/id.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,16 @@ __le64 *squashfs_read_id_index_table(struct super_block *sb,
9797
start = le64_to_cpu(table[n]);
9898
end = le64_to_cpu(table[n + 1]);
9999

100-
if (start >= end || (end - start) > SQUASHFS_METADATA_SIZE) {
100+
if (start >= end || (end - start) >
101+
(SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
101102
kfree(table);
102103
return ERR_PTR(-EINVAL);
103104
}
104105
}
105106

106107
start = le64_to_cpu(table[indexes - 1]);
107-
if (start >= id_table_start || (id_table_start - start) > SQUASHFS_METADATA_SIZE) {
108+
if (start >= id_table_start || (id_table_start - start) >
109+
(SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
108110
kfree(table);
109111
return ERR_PTR(-EINVAL);
110112
}

fs/squashfs/squashfs_fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
/* size of metadata (inode and directory) blocks */
1919
#define SQUASHFS_METADATA_SIZE 8192
20+
#define SQUASHFS_BLOCK_OFFSET 2
2021

2122
/* default size of block device I/O */
2223
#ifdef CONFIG_SQUASHFS_4K_DEVBLK_SIZE

fs/squashfs/xattr_id.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,16 @@ __le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 table_start,
109109
start = le64_to_cpu(table[n]);
110110
end = le64_to_cpu(table[n + 1]);
111111

112-
if (start >= end || (end - start) > SQUASHFS_METADATA_SIZE) {
112+
if (start >= end || (end - start) >
113+
(SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
113114
kfree(table);
114115
return ERR_PTR(-EINVAL);
115116
}
116117
}
117118

118119
start = le64_to_cpu(table[indexes - 1]);
119-
if (start >= table_start || (table_start - start) > SQUASHFS_METADATA_SIZE) {
120+
if (start >= table_start || (table_start - start) >
121+
(SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
120122
kfree(table);
121123
return ERR_PTR(-EINVAL);
122124
}

include/linux/hugetlb_cgroup.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ static inline bool hugetlb_cgroup_disabled(void)
113113
return !cgroup_subsys_enabled(hugetlb_cgrp_subsys);
114114
}
115115

116+
static inline void hugetlb_cgroup_put_rsvd_cgroup(struct hugetlb_cgroup *h_cg)
117+
{
118+
css_put(&h_cg->css);
119+
}
120+
116121
extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
117122
struct hugetlb_cgroup **ptr);
118123
extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages,
@@ -138,7 +143,8 @@ extern void hugetlb_cgroup_uncharge_counter(struct resv_map *resv,
138143

139144
extern void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
140145
struct file_region *rg,
141-
unsigned long nr_pages);
146+
unsigned long nr_pages,
147+
bool region_del);
142148

143149
extern void hugetlb_cgroup_file_init(void) __init;
144150
extern void hugetlb_cgroup_migrate(struct page *oldhpage,
@@ -147,7 +153,8 @@ extern void hugetlb_cgroup_migrate(struct page *oldhpage,
147153
#else
148154
static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
149155
struct file_region *rg,
150-
unsigned long nr_pages)
156+
unsigned long nr_pages,
157+
bool region_del)
151158
{
152159
}
153160

@@ -185,6 +192,10 @@ static inline bool hugetlb_cgroup_disabled(void)
185192
return true;
186193
}
187194

195+
static inline void hugetlb_cgroup_put_rsvd_cgroup(struct hugetlb_cgroup *h_cg)
196+
{
197+
}
198+
188199
static inline int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
189200
struct hugetlb_cgroup **ptr)
190201
{

include/linux/memblock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static inline void memblock_free_late(phys_addr_t base, phys_addr_t size)
460460
/*
461461
* Set the allocation direction to bottom-up or top-down.
462462
*/
463-
static inline __init void memblock_set_bottom_up(bool enable)
463+
static inline __init_memblock void memblock_set_bottom_up(bool enable)
464464
{
465465
memblock.bottom_up = enable;
466466
}
@@ -470,7 +470,7 @@ static inline __init void memblock_set_bottom_up(bool enable)
470470
* if this is true, that said, memblock will allocate memory
471471
* in bottom-up direction.
472472
*/
473-
static inline __init bool memblock_bottom_up(void)
473+
static inline __init_memblock bool memblock_bottom_up(void)
474474
{
475475
return memblock.bottom_up;
476476
}

include/linux/mm.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,16 +1461,28 @@ static inline bool cpupid_match_pid(struct task_struct *task, int cpupid)
14611461

14621462
#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
14631463

1464+
/*
1465+
* KASAN per-page tags are stored xor'ed with 0xff. This allows to avoid
1466+
* setting tags for all pages to native kernel tag value 0xff, as the default
1467+
* value 0x00 maps to 0xff.
1468+
*/
1469+
14641470
static inline u8 page_kasan_tag(const struct page *page)
14651471
{
1466-
if (kasan_enabled())
1467-
return (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK;
1468-
return 0xff;
1472+
u8 tag = 0xff;
1473+
1474+
if (kasan_enabled()) {
1475+
tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK;
1476+
tag ^= 0xff;
1477+
}
1478+
1479+
return tag;
14691480
}
14701481

14711482
static inline void page_kasan_tag_set(struct page *page, u8 tag)
14721483
{
14731484
if (kasan_enabled()) {
1485+
tag ^= 0xff;
14741486
page->flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT);
14751487
page->flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT;
14761488
}

0 commit comments

Comments
 (0)