aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-14 12:22:35 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-14 12:22:35 -0500
commit83e047c104aa95a8a683d6bd421df1551c17dbd2 (patch)
tree494aef444659ebe5bcbd0e423f91e3eff33100c4 /include/linux
parent18320f2a6871aaf2522f793fee4a67eccf5e131a (diff)
parenta3b30e7210c870d79d3c3cedb80f8cfaab0f4e2e (diff)
Merge branch 'akpm' (patches from Andrew)
Merge fourth set of updates from Andrew Morton: - the rest of lib/ - checkpatch updates - a few misc things - kasan: kernel address sanitizer - the rtc tree * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (108 commits) ARM: mvebu: enable Armada 38x RTC driver in mvebu_v7_defconfig ARM: mvebu: add Device Tree description of RTC on Armada 38x MAINTAINERS: add the RTC driver for the Armada38x drivers/rtc/rtc-armada38x: add a new RTC driver for recent mvebu SoCs rtc: armada38x: add the device tree binding documentation rtc: rtc-ab-b5ze-s3: add sub-minute alarm support rtc: add support for Abracon AB-RTCMC-32.768kHz-B5ZE-S3 I2C RTC chip of: add vendor prefix for Abracon Corporation drivers/rtc/rtc-rk808.c: fix rtc time reading issue drivers/rtc/rtc-isl12057.c: constify struct regmap_config drivers/rtc/rtc-at91sam9.c: constify struct regmap_config drivers/rtc/rtc-imxdi.c: add more known register bits drivers/rtc/rtc-imxdi.c: trivial clean up code ARM: mvebu: ISL12057 rtc chip can now wake up RN102, RN102 and RN2120 rtc: rtc-isl12057: add isil,irq2-can-wakeup-machine property for in-tree users drivers/rtc/rtc-isl12057.c: add alarm support to Intersil ISL12057 RTC driver drivers/rtc/rtc-pcf2123.c: add support for devicetree kprobes: makes kprobes/enabled works correctly for optimized kprobes. kprobes: set kprobes_all_disarmed earlier to enable re-optimization. init: remove CONFIG_INIT_FALLBACK ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bitmap.h37
-rw-r--r--include/linux/compiler-gcc.h1
-rw-r--r--include/linux/compiler-gcc4.h4
-rw-r--r--include/linux/compiler-gcc5.h2
-rw-r--r--include/linux/cpumask.h49
-rw-r--r--include/linux/init_task.h8
-rw-r--r--include/linux/kasan.h89
-rw-r--r--include/linux/kernfs.h7
-rw-r--r--include/linux/module.h2
-rw-r--r--include/linux/nodemask.h41
-rw-r--r--include/linux/sched.h3
-rw-r--r--include/linux/seq_buf.h3
-rw-r--r--include/linux/seq_file.h25
-rw-r--r--include/linux/slab.h11
-rw-r--r--include/linux/slub_def.h19
-rw-r--r--include/linux/string.h3
-rw-r--r--include/linux/vmalloc.h13
17 files changed, 196 insertions, 121 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 5f5c00de39f0..dbfbf4990005 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -52,16 +52,13 @@
52 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) 52 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit)
53 * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap 53 * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap
54 * bitmap_fold(dst, orig, sz, nbits) dst bits = orig bits mod sz 54 * bitmap_fold(dst, orig, sz, nbits) dst bits = orig bits mod sz
55 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf
56 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf 55 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf
57 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf 56 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
58 * bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf
59 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from kernel buf 57 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from kernel buf
60 * bitmap_parselist_user(buf, dst, nbits) Parse bitmap dst from user buf 58 * bitmap_parselist_user(buf, dst, nbits) Parse bitmap dst from user buf
61 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region 59 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
62 * bitmap_release_region(bitmap, pos, order) Free specified bit region 60 * bitmap_release_region(bitmap, pos, order) Free specified bit region
63 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region 61 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
64 * bitmap_print_to_pagebuf(list, buf, mask, nbits) Print bitmap src as list/hex
65 */ 62 */
66 63
67/* 64/*
@@ -96,10 +93,10 @@ extern int __bitmap_equal(const unsigned long *bitmap1,
96 const unsigned long *bitmap2, unsigned int nbits); 93 const unsigned long *bitmap2, unsigned int nbits);
97extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, 94extern void __bitmap_complement(unsigned long *dst, const unsigned long *src,
98 unsigned int nbits); 95 unsigned int nbits);
99extern void __bitmap_shift_right(unsigned long *dst, 96extern void __bitmap_shift_right(unsigned long *dst, const unsigned long *src,
100 const unsigned long *src, int shift, int bits); 97 unsigned int shift, unsigned int nbits);
101extern void __bitmap_shift_left(unsigned long *dst, 98extern void __bitmap_shift_left(unsigned long *dst, const unsigned long *src,
102 const unsigned long *src, int shift, int bits); 99 unsigned int shift, unsigned int nbits);
103extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 100extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
104 const unsigned long *bitmap2, unsigned int nbits); 101 const unsigned long *bitmap2, unsigned int nbits);
105extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 102extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
@@ -147,14 +144,10 @@ bitmap_find_next_zero_area(unsigned long *map,
147 align_mask, 0); 144 align_mask, 0);
148} 145}
149 146
150extern int bitmap_scnprintf(char *buf, unsigned int len,
151 const unsigned long *src, int nbits);
152extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, 147extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
153 unsigned long *dst, int nbits); 148 unsigned long *dst, int nbits);
154extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, 149extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen,
155 unsigned long *dst, int nbits); 150 unsigned long *dst, int nbits);
156extern int bitmap_scnlistprintf(char *buf, unsigned int len,
157 const unsigned long *src, int nbits);
158extern int bitmap_parselist(const char *buf, unsigned long *maskp, 151extern int bitmap_parselist(const char *buf, unsigned long *maskp,
159 int nmaskbits); 152 int nmaskbits);
160extern int bitmap_parselist_user(const char __user *ubuf, unsigned int ulen, 153extern int bitmap_parselist_user(const char __user *ubuf, unsigned int ulen,
@@ -170,7 +163,11 @@ extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
170extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order); 163extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
171extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order); 164extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
172extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order); 165extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
173extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); 166#ifdef __BIG_ENDIAN
167extern void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits);
168#else
169#define bitmap_copy_le bitmap_copy
170#endif
174extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int ord, unsigned int nbits); 171extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int ord, unsigned int nbits);
175extern int bitmap_print_to_pagebuf(bool list, char *buf, 172extern int bitmap_print_to_pagebuf(bool list, char *buf,
176 const unsigned long *maskp, int nmaskbits); 173 const unsigned long *maskp, int nmaskbits);
@@ -309,22 +306,22 @@ static inline int bitmap_weight(const unsigned long *src, unsigned int nbits)
309 return __bitmap_weight(src, nbits); 306 return __bitmap_weight(src, nbits);
310} 307}
311 308
312static inline void bitmap_shift_right(unsigned long *dst, 309static inline void bitmap_shift_right(unsigned long *dst, const unsigned long *src,
313 const unsigned long *src, int n, int nbits) 310 unsigned int shift, int nbits)
314{ 311{
315 if (small_const_nbits(nbits)) 312 if (small_const_nbits(nbits))
316 *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> n; 313 *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> shift;
317 else 314 else
318 __bitmap_shift_right(dst, src, n, nbits); 315 __bitmap_shift_right(dst, src, shift, nbits);
319} 316}
320 317
321static inline void bitmap_shift_left(unsigned long *dst, 318static inline void bitmap_shift_left(unsigned long *dst, const unsigned long *src,
322 const unsigned long *src, int n, int nbits) 319 unsigned int shift, unsigned int nbits)
323{ 320{
324 if (small_const_nbits(nbits)) 321 if (small_const_nbits(nbits))
325 *dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits); 322 *dst = (*src << shift) & BITMAP_LAST_WORD_MASK(nbits);
326 else 323 else
327 __bitmap_shift_left(dst, src, n, nbits); 324 __bitmap_shift_left(dst, src, shift, nbits);
328} 325}
329 326
330static inline int bitmap_parse(const char *buf, unsigned int buflen, 327static inline int bitmap_parse(const char *buf, unsigned int buflen,
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 02ae99e8e6d3..cdf13ca7cac3 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -66,6 +66,7 @@
66#define __deprecated __attribute__((deprecated)) 66#define __deprecated __attribute__((deprecated))
67#define __packed __attribute__((packed)) 67#define __packed __attribute__((packed))
68#define __weak __attribute__((weak)) 68#define __weak __attribute__((weak))
69#define __alias(symbol) __attribute__((alias(#symbol)))
69 70
70/* 71/*
71 * it doesn't make sense on ARM (currently the only user of __naked) to trace 72 * it doesn't make sense on ARM (currently the only user of __naked) to trace
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index d1a558239b1a..769e19864632 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -85,3 +85,7 @@
85#define __HAVE_BUILTIN_BSWAP16__ 85#define __HAVE_BUILTIN_BSWAP16__
86#endif 86#endif
87#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ 87#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
88
89#if GCC_VERSION >= 40902
90#define KASAN_ABI_VERSION 3
91#endif
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
index c8c565952548..efee493714eb 100644
--- a/include/linux/compiler-gcc5.h
+++ b/include/linux/compiler-gcc5.h
@@ -63,3 +63,5 @@
63#define __HAVE_BUILTIN_BSWAP64__ 63#define __HAVE_BUILTIN_BSWAP64__
64#define __HAVE_BUILTIN_BSWAP16__ 64#define __HAVE_BUILTIN_BSWAP16__
65#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ 65#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
66
67#define KASAN_ABI_VERSION 4
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index ff9044286d88..086549a665e2 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -22,6 +22,14 @@ typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
22 */ 22 */
23#define cpumask_bits(maskp) ((maskp)->bits) 23#define cpumask_bits(maskp) ((maskp)->bits)
24 24
25/**
26 * cpumask_pr_args - printf args to output a cpumask
27 * @maskp: cpumask to be printed
28 *
29 * Can be used to provide arguments for '%*pb[l]' when printing a cpumask.
30 */
31#define cpumask_pr_args(maskp) nr_cpu_ids, cpumask_bits(maskp)
32
25#if NR_CPUS == 1 33#if NR_CPUS == 1
26#define nr_cpu_ids 1 34#define nr_cpu_ids 1
27#else 35#else
@@ -539,21 +547,6 @@ static inline void cpumask_copy(struct cpumask *dstp,
539#define cpumask_of(cpu) (get_cpu_mask(cpu)) 547#define cpumask_of(cpu) (get_cpu_mask(cpu))
540 548
541/** 549/**
542 * cpumask_scnprintf - print a cpumask into a string as comma-separated hex
543 * @buf: the buffer to sprintf into
544 * @len: the length of the buffer
545 * @srcp: the cpumask to print
546 *
547 * If len is zero, returns zero. Otherwise returns the length of the
548 * (nul-terminated) @buf string.
549 */
550static inline int cpumask_scnprintf(char *buf, int len,
551 const struct cpumask *srcp)
552{
553 return bitmap_scnprintf(buf, len, cpumask_bits(srcp), nr_cpumask_bits);
554}
555
556/**
557 * cpumask_parse_user - extract a cpumask from a user string 550 * cpumask_parse_user - extract a cpumask from a user string
558 * @buf: the buffer to extract from 551 * @buf: the buffer to extract from
559 * @len: the length of the buffer 552 * @len: the length of the buffer
@@ -564,7 +557,7 @@ static inline int cpumask_scnprintf(char *buf, int len,
564static inline int cpumask_parse_user(const char __user *buf, int len, 557static inline int cpumask_parse_user(const char __user *buf, int len,
565 struct cpumask *dstp) 558 struct cpumask *dstp)
566{ 559{
567 return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits); 560 return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpu_ids);
568} 561}
569 562
570/** 563/**
@@ -579,23 +572,7 @@ static inline int cpumask_parselist_user(const char __user *buf, int len,
579 struct cpumask *dstp) 572 struct cpumask *dstp)
580{ 573{
581 return bitmap_parselist_user(buf, len, cpumask_bits(dstp), 574 return bitmap_parselist_user(buf, len, cpumask_bits(dstp),
582 nr_cpumask_bits); 575 nr_cpu_ids);
583}
584
585/**
586 * cpulist_scnprintf - print a cpumask into a string as comma-separated list
587 * @buf: the buffer to sprintf into
588 * @len: the length of the buffer
589 * @srcp: the cpumask to print
590 *
591 * If len is zero, returns zero. Otherwise returns the length of the
592 * (nul-terminated) @buf string.
593 */
594static inline int cpulist_scnprintf(char *buf, int len,
595 const struct cpumask *srcp)
596{
597 return bitmap_scnlistprintf(buf, len, cpumask_bits(srcp),
598 nr_cpumask_bits);
599} 576}
600 577
601/** 578/**
@@ -610,7 +587,7 @@ static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
610 char *nl = strchr(buf, '\n'); 587 char *nl = strchr(buf, '\n');
611 unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf); 588 unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf);
612 589
613 return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits); 590 return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpu_ids);
614} 591}
615 592
616/** 593/**
@@ -622,7 +599,7 @@ static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
622 */ 599 */
623static inline int cpulist_parse(const char *buf, struct cpumask *dstp) 600static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
624{ 601{
625 return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits); 602 return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpu_ids);
626} 603}
627 604
628/** 605/**
@@ -817,7 +794,7 @@ static inline ssize_t
817cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask) 794cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask)
818{ 795{
819 return bitmap_print_to_pagebuf(list, buf, cpumask_bits(mask), 796 return bitmap_print_to_pagebuf(list, buf, cpumask_bits(mask),
820 nr_cpumask_bits); 797 nr_cpu_ids);
821} 798}
822 799
823/* 800/*
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index d3d43ecf148c..696d22312b31 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -175,6 +175,13 @@ extern struct task_group root_task_group;
175# define INIT_NUMA_BALANCING(tsk) 175# define INIT_NUMA_BALANCING(tsk)
176#endif 176#endif
177 177
178#ifdef CONFIG_KASAN
179# define INIT_KASAN(tsk) \
180 .kasan_depth = 1,
181#else
182# define INIT_KASAN(tsk)
183#endif
184
178/* 185/*
179 * INIT_TASK is used to set up the first task table, touch at 186 * INIT_TASK is used to set up the first task table, touch at
180 * your own risk!. Base=0, limit=0x1fffff (=2MB) 187 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -250,6 +257,7 @@ extern struct task_group root_task_group;
250 INIT_RT_MUTEXES(tsk) \ 257 INIT_RT_MUTEXES(tsk) \
251 INIT_VTIME(tsk) \ 258 INIT_VTIME(tsk) \
252 INIT_NUMA_BALANCING(tsk) \ 259 INIT_NUMA_BALANCING(tsk) \
260 INIT_KASAN(tsk) \
253} 261}
254 262
255 263
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
new file mode 100644
index 000000000000..72ba725ddf9c
--- /dev/null
+++ b/include/linux/kasan.h
@@ -0,0 +1,89 @@
1#ifndef _LINUX_KASAN_H
2#define _LINUX_KASAN_H
3
4#include <linux/types.h>
5
6struct kmem_cache;
7struct page;
8
9#ifdef CONFIG_KASAN
10
11#define KASAN_SHADOW_SCALE_SHIFT 3
12#define KASAN_SHADOW_OFFSET _AC(CONFIG_KASAN_SHADOW_OFFSET, UL)
13
14#include <asm/kasan.h>
15#include <linux/sched.h>
16
17static inline void *kasan_mem_to_shadow(const void *addr)
18{
19 return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
20 + KASAN_SHADOW_OFFSET;
21}
22
23/* Enable reporting bugs after kasan_disable_current() */
24static inline void kasan_enable_current(void)
25{
26 current->kasan_depth++;
27}
28
29/* Disable reporting bugs for current task */
30static inline void kasan_disable_current(void)
31{
32 current->kasan_depth--;
33}
34
35void kasan_unpoison_shadow(const void *address, size_t size);
36
37void kasan_alloc_pages(struct page *page, unsigned int order);
38void kasan_free_pages(struct page *page, unsigned int order);
39
40void kasan_poison_slab(struct page *page);
41void kasan_unpoison_object_data(struct kmem_cache *cache, void *object);
42void kasan_poison_object_data(struct kmem_cache *cache, void *object);
43
44void kasan_kmalloc_large(const void *ptr, size_t size);
45void kasan_kfree_large(const void *ptr);
46void kasan_kmalloc(struct kmem_cache *s, const void *object, size_t size);
47void kasan_krealloc(const void *object, size_t new_size);
48
49void kasan_slab_alloc(struct kmem_cache *s, void *object);
50void kasan_slab_free(struct kmem_cache *s, void *object);
51
52#define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
53
54int kasan_module_alloc(void *addr, size_t size);
55void kasan_module_free(void *addr);
56
57#else /* CONFIG_KASAN */
58
59#define MODULE_ALIGN 1
60
61static inline void kasan_unpoison_shadow(const void *address, size_t size) {}
62
63static inline void kasan_enable_current(void) {}
64static inline void kasan_disable_current(void) {}
65
66static inline void kasan_alloc_pages(struct page *page, unsigned int order) {}
67static inline void kasan_free_pages(struct page *page, unsigned int order) {}
68
69static inline void kasan_poison_slab(struct page *page) {}
70static inline void kasan_unpoison_object_data(struct kmem_cache *cache,
71 void *object) {}
72static inline void kasan_poison_object_data(struct kmem_cache *cache,
73 void *object) {}
74
75static inline void kasan_kmalloc_large(void *ptr, size_t size) {}
76static inline void kasan_kfree_large(const void *ptr) {}
77static inline void kasan_kmalloc(struct kmem_cache *s, const void *object,
78 size_t size) {}
79static inline void kasan_krealloc(const void *object, size_t new_size) {}
80
81static inline void kasan_slab_alloc(struct kmem_cache *s, void *object) {}
82static inline void kasan_slab_free(struct kmem_cache *s, void *object) {}
83
84static inline int kasan_module_alloc(void *addr, size_t size) { return 0; }
85static inline void kasan_module_free(void *addr) {}
86
87#endif /* CONFIG_KASAN */
88
89#endif /* LINUX_KASAN_H */
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index d4e01b358341..71ecdab1671b 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -43,7 +43,6 @@ enum kernfs_node_flag {
43 KERNFS_HAS_SEQ_SHOW = 0x0040, 43 KERNFS_HAS_SEQ_SHOW = 0x0040,
44 KERNFS_HAS_MMAP = 0x0080, 44 KERNFS_HAS_MMAP = 0x0080,
45 KERNFS_LOCKDEP = 0x0100, 45 KERNFS_LOCKDEP = 0x0100,
46 KERNFS_STATIC_NAME = 0x0200,
47 KERNFS_SUICIDAL = 0x0400, 46 KERNFS_SUICIDAL = 0x0400,
48 KERNFS_SUICIDED = 0x0800, 47 KERNFS_SUICIDED = 0x0800,
49}; 48};
@@ -291,7 +290,6 @@ struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent,
291 umode_t mode, loff_t size, 290 umode_t mode, loff_t size,
292 const struct kernfs_ops *ops, 291 const struct kernfs_ops *ops,
293 void *priv, const void *ns, 292 void *priv, const void *ns,
294 bool name_is_static,
295 struct lock_class_key *key); 293 struct lock_class_key *key);
296struct kernfs_node *kernfs_create_link(struct kernfs_node *parent, 294struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
297 const char *name, 295 const char *name,
@@ -369,8 +367,7 @@ kernfs_create_dir_ns(struct kernfs_node *parent, const char *name,
369static inline struct kernfs_node * 367static inline struct kernfs_node *
370__kernfs_create_file(struct kernfs_node *parent, const char *name, 368__kernfs_create_file(struct kernfs_node *parent, const char *name,
371 umode_t mode, loff_t size, const struct kernfs_ops *ops, 369 umode_t mode, loff_t size, const struct kernfs_ops *ops,
372 void *priv, const void *ns, bool name_is_static, 370 void *priv, const void *ns, struct lock_class_key *key)
373 struct lock_class_key *key)
374{ return ERR_PTR(-ENOSYS); } 371{ return ERR_PTR(-ENOSYS); }
375 372
376static inline struct kernfs_node * 373static inline struct kernfs_node *
@@ -439,7 +436,7 @@ kernfs_create_file_ns(struct kernfs_node *parent, const char *name,
439 key = (struct lock_class_key *)&ops->lockdep_key; 436 key = (struct lock_class_key *)&ops->lockdep_key;
440#endif 437#endif
441 return __kernfs_create_file(parent, name, mode, size, ops, priv, ns, 438 return __kernfs_create_file(parent, name, mode, size, ops, priv, ns,
442 false, key); 439 key);
443} 440}
444 441
445static inline struct kernfs_node * 442static inline struct kernfs_node *
diff --git a/include/linux/module.h b/include/linux/module.h
index b653d7c0a05a..42999fe2dbd0 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -135,7 +135,7 @@ void trim_init_extable(struct module *m);
135#ifdef MODULE 135#ifdef MODULE
136/* Creates an alias so file2alias.c can find device table. */ 136/* Creates an alias so file2alias.c can find device table. */
137#define MODULE_DEVICE_TABLE(type, name) \ 137#define MODULE_DEVICE_TABLE(type, name) \
138 extern const struct type##_device_id __mod_##type##__##name##_device_table \ 138extern const typeof(name) __mod_##type##__##name##_device_table \
139 __attribute__ ((unused, alias(__stringify(name)))) 139 __attribute__ ((unused, alias(__stringify(name))))
140#else /* !MODULE */ 140#else /* !MODULE */
141#define MODULE_DEVICE_TABLE(type, name) 141#define MODULE_DEVICE_TABLE(type, name)
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 21cef483dc1b..6e85889cf9ab 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -8,14 +8,13 @@
8 * See detailed comments in the file linux/bitmap.h describing the 8 * See detailed comments in the file linux/bitmap.h describing the
9 * data type on which these nodemasks are based. 9 * data type on which these nodemasks are based.
10 * 10 *
11 * For details of nodemask_scnprintf() and nodemask_parse_user(), 11 * For details of nodemask_parse_user(), see bitmap_parse_user() in
12 * see bitmap_scnprintf() and bitmap_parse_user() in lib/bitmap.c. 12 * lib/bitmap.c. For details of nodelist_parse(), see bitmap_parselist(),
13 * For details of nodelist_scnprintf() and nodelist_parse(), see 13 * also in bitmap.c. For details of node_remap(), see bitmap_bitremap in
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. 14 * lib/bitmap.c. For details of nodes_remap(), see bitmap_remap in
15 * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c. 15 * lib/bitmap.c. For details of nodes_onto(), see bitmap_onto in
16 * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c. 16 * lib/bitmap.c. For details of nodes_fold(), see bitmap_fold in
17 * For details of nodes_onto(), see bitmap_onto in lib/bitmap.c. 17 * lib/bitmap.c.
18 * For details of nodes_fold(), see bitmap_fold in lib/bitmap.c.
19 * 18 *
20 * The available nodemask operations are: 19 * The available nodemask operations are:
21 * 20 *
@@ -52,9 +51,7 @@
52 * NODE_MASK_NONE Initializer - no bits set 51 * NODE_MASK_NONE Initializer - no bits set
53 * unsigned long *nodes_addr(mask) Array of unsigned long's in mask 52 * unsigned long *nodes_addr(mask) Array of unsigned long's in mask
54 * 53 *
55 * int nodemask_scnprintf(buf, len, mask) Format nodemask for printing
56 * int nodemask_parse_user(ubuf, ulen, mask) Parse ascii string as nodemask 54 * int nodemask_parse_user(ubuf, ulen, mask) Parse ascii string as nodemask
57 * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing
58 * int nodelist_parse(buf, map) Parse ascii string as nodelist 55 * int nodelist_parse(buf, map) Parse ascii string as nodelist
59 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) 56 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
60 * void nodes_remap(dst, src, old, new) *dst = map(old, new)(src) 57 * void nodes_remap(dst, src, old, new) *dst = map(old, new)(src)
@@ -98,6 +95,14 @@
98typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; 95typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
99extern nodemask_t _unused_nodemask_arg_; 96extern nodemask_t _unused_nodemask_arg_;
100 97
98/**
99 * nodemask_pr_args - printf args to output a nodemask
100 * @maskp: nodemask to be printed
101 *
102 * Can be used to provide arguments for '%*pb[l]' when printing a nodemask.
103 */
104#define nodemask_pr_args(maskp) MAX_NUMNODES, (maskp)->bits
105
101/* 106/*
102 * The inline keyword gives the compiler room to decide to inline, or 107 * The inline keyword gives the compiler room to decide to inline, or
103 * not inline a function as it sees best. However, as these functions 108 * not inline a function as it sees best. However, as these functions
@@ -304,14 +309,6 @@ static inline int __first_unset_node(const nodemask_t *maskp)
304 309
305#define nodes_addr(src) ((src).bits) 310#define nodes_addr(src) ((src).bits)
306 311
307#define nodemask_scnprintf(buf, len, src) \
308 __nodemask_scnprintf((buf), (len), &(src), MAX_NUMNODES)
309static inline int __nodemask_scnprintf(char *buf, int len,
310 const nodemask_t *srcp, int nbits)
311{
312 return bitmap_scnprintf(buf, len, srcp->bits, nbits);
313}
314
315#define nodemask_parse_user(ubuf, ulen, dst) \ 312#define nodemask_parse_user(ubuf, ulen, dst) \
316 __nodemask_parse_user((ubuf), (ulen), &(dst), MAX_NUMNODES) 313 __nodemask_parse_user((ubuf), (ulen), &(dst), MAX_NUMNODES)
317static inline int __nodemask_parse_user(const char __user *buf, int len, 314static inline int __nodemask_parse_user(const char __user *buf, int len,
@@ -320,14 +317,6 @@ static inline int __nodemask_parse_user(const char __user *buf, int len,
320 return bitmap_parse_user(buf, len, dstp->bits, nbits); 317 return bitmap_parse_user(buf, len, dstp->bits, nbits);
321} 318}
322 319
323#define nodelist_scnprintf(buf, len, src) \
324 __nodelist_scnprintf((buf), (len), &(src), MAX_NUMNODES)
325static inline int __nodelist_scnprintf(char *buf, int len,
326 const nodemask_t *srcp, int nbits)
327{
328 return bitmap_scnlistprintf(buf, len, srcp->bits, nbits);
329}
330
331#define nodelist_parse(buf, dst) __nodelist_parse((buf), &(dst), MAX_NUMNODES) 320#define nodelist_parse(buf, dst) __nodelist_parse((buf), &(dst), MAX_NUMNODES)
332static inline int __nodelist_parse(const char *buf, nodemask_t *dstp, int nbits) 321static inline int __nodelist_parse(const char *buf, nodemask_t *dstp, int nbits)
333{ 322{
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 048b91b983ed..41c60e5302d7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1664,6 +1664,9 @@ struct task_struct {
1664 unsigned long timer_slack_ns; 1664 unsigned long timer_slack_ns;
1665 unsigned long default_timer_slack_ns; 1665 unsigned long default_timer_slack_ns;
1666 1666
1667#ifdef CONFIG_KASAN
1668 unsigned int kasan_depth;
1669#endif
1667#ifdef CONFIG_FUNCTION_GRAPH_TRACER 1670#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1668 /* Index of current stored address in ret_stack */ 1671 /* Index of current stored address in ret_stack */
1669 int curr_ret_stack; 1672 int curr_ret_stack;
diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h
index 9aafe0e24c68..fb7eb9ccb1cd 100644
--- a/include/linux/seq_buf.h
+++ b/include/linux/seq_buf.h
@@ -125,9 +125,6 @@ extern int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
125 unsigned int len); 125 unsigned int len);
126extern int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc); 126extern int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc);
127 127
128extern int seq_buf_bitmask(struct seq_buf *s, const unsigned long *maskp,
129 int nmaskbits);
130
131#ifdef CONFIG_BINARY_PRINTF 128#ifdef CONFIG_BINARY_PRINTF
132extern int 129extern int
133seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary); 130seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary);
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index cf6a9daaaf6d..afbb1fd77c77 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -126,31 +126,6 @@ int seq_path(struct seq_file *, const struct path *, const char *);
126int seq_dentry(struct seq_file *, struct dentry *, const char *); 126int seq_dentry(struct seq_file *, struct dentry *, const char *);
127int seq_path_root(struct seq_file *m, const struct path *path, 127int seq_path_root(struct seq_file *m, const struct path *path,
128 const struct path *root, const char *esc); 128 const struct path *root, const char *esc);
129int seq_bitmap(struct seq_file *m, const unsigned long *bits,
130 unsigned int nr_bits);
131static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask)
132{
133 return seq_bitmap(m, cpumask_bits(mask), nr_cpu_ids);
134}
135
136static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
137{
138 return seq_bitmap(m, mask->bits, MAX_NUMNODES);
139}
140
141int seq_bitmap_list(struct seq_file *m, const unsigned long *bits,
142 unsigned int nr_bits);
143
144static inline int seq_cpumask_list(struct seq_file *m,
145 const struct cpumask *mask)
146{
147 return seq_bitmap_list(m, cpumask_bits(mask), nr_cpu_ids);
148}
149
150static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask)
151{
152 return seq_bitmap_list(m, mask->bits, MAX_NUMNODES);
153}
154 129
155int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 130int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
156int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t); 131int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index ed2ffaab59ea..76f1feeabd38 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -104,6 +104,7 @@
104 (unsigned long)ZERO_SIZE_PTR) 104 (unsigned long)ZERO_SIZE_PTR)
105 105
106#include <linux/kmemleak.h> 106#include <linux/kmemleak.h>
107#include <linux/kasan.h>
107 108
108struct mem_cgroup; 109struct mem_cgroup;
109/* 110/*
@@ -325,7 +326,10 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s,
325static __always_inline void *kmem_cache_alloc_trace(struct kmem_cache *s, 326static __always_inline void *kmem_cache_alloc_trace(struct kmem_cache *s,
326 gfp_t flags, size_t size) 327 gfp_t flags, size_t size)
327{ 328{
328 return kmem_cache_alloc(s, flags); 329 void *ret = kmem_cache_alloc(s, flags);
330
331 kasan_kmalloc(s, ret, size);
332 return ret;
329} 333}
330 334
331static __always_inline void * 335static __always_inline void *
@@ -333,7 +337,10 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s,
333 gfp_t gfpflags, 337 gfp_t gfpflags,
334 int node, size_t size) 338 int node, size_t size)
335{ 339{
336 return kmem_cache_alloc_node(s, gfpflags, node); 340 void *ret = kmem_cache_alloc_node(s, gfpflags, node);
341
342 kasan_kmalloc(s, ret, size);
343 return ret;
337} 344}
338#endif /* CONFIG_TRACING */ 345#endif /* CONFIG_TRACING */
339 346
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 9abf04ed0999..33885118523c 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -110,4 +110,23 @@ static inline void sysfs_slab_remove(struct kmem_cache *s)
110} 110}
111#endif 111#endif
112 112
113
114/**
115 * virt_to_obj - returns address of the beginning of object.
116 * @s: object's kmem_cache
117 * @slab_page: address of slab page
118 * @x: address within object memory range
119 *
120 * Returns address of the beginning of object
121 */
122static inline void *virt_to_obj(struct kmem_cache *s,
123 const void *slab_page,
124 const void *x)
125{
126 return (void *)x - ((x - slab_page) % s->size);
127}
128
129void object_err(struct kmem_cache *s, struct page *page,
130 u8 *object, char *reason);
131
113#endif /* _LINUX_SLUB_DEF_H */ 132#endif /* _LINUX_SLUB_DEF_H */
diff --git a/include/linux/string.h b/include/linux/string.h
index b9bc9a5d9e21..e40099e585c9 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -112,7 +112,10 @@ extern void * memchr(const void *,int,__kernel_size_t);
112#endif 112#endif
113void *memchr_inv(const void *s, int c, size_t n); 113void *memchr_inv(const void *s, int c, size_t n);
114 114
115extern void kfree_const(const void *x);
116
115extern char *kstrdup(const char *s, gfp_t gfp); 117extern char *kstrdup(const char *s, gfp_t gfp);
118extern const char *kstrdup_const(const char *s, gfp_t gfp);
116extern char *kstrndup(const char *s, size_t len, gfp_t gfp); 119extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
117extern void *kmemdup(const void *src, size_t len, gfp_t gfp); 120extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
118 121
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index b87696fdf06a..7d7acb35603d 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -16,6 +16,7 @@ struct vm_area_struct; /* vma defining user mapping in mm_types.h */
16#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 16#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ 17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
18#define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */ 18#define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */
19#define VM_NO_GUARD 0x00000040 /* don't add guard page */
19/* bits [20..32] reserved for arch specific ioremap internals */ 20/* bits [20..32] reserved for arch specific ioremap internals */
20 21
21/* 22/*
@@ -75,7 +76,9 @@ extern void *vmalloc_32_user(unsigned long size);
75extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); 76extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
76extern void *__vmalloc_node_range(unsigned long size, unsigned long align, 77extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
77 unsigned long start, unsigned long end, gfp_t gfp_mask, 78 unsigned long start, unsigned long end, gfp_t gfp_mask,
78 pgprot_t prot, int node, const void *caller); 79 pgprot_t prot, unsigned long vm_flags, int node,
80 const void *caller);
81
79extern void vfree(const void *addr); 82extern void vfree(const void *addr);
80 83
81extern void *vmap(struct page **pages, unsigned int count, 84extern void *vmap(struct page **pages, unsigned int count,
@@ -96,8 +99,12 @@ void vmalloc_sync_all(void);
96 99
97static inline size_t get_vm_area_size(const struct vm_struct *area) 100static inline size_t get_vm_area_size(const struct vm_struct *area)
98{ 101{
99 /* return actual size without guard page */ 102 if (!(area->flags & VM_NO_GUARD))
100 return area->size - PAGE_SIZE; 103 /* return actual size without guard page */
104 return area->size - PAGE_SIZE;
105 else
106 return area->size;
107
101} 108}
102 109
103extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); 110extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);