aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/bug.h6
-rw-r--r--include/asm-generic/cacheflush.h74
-rw-r--r--include/linux/bits.h17
-rw-r--r--include/linux/coda.h3
-rw-r--r--include/linux/coda_psdev.h72
-rw-r--r--include/linux/compat.h3
-rw-r--r--include/linux/io.h1
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/kprobes.h19
-rw-r--r--include/linux/lz4.h18
-rw-r--r--include/linux/memory_hotplug.h8
-rw-r--r--include/linux/mm.h45
-rw-r--r--include/linux/pfn_t.h4
-rw-r--r--include/linux/pid.h5
-rw-r--r--include/linux/poison.h2
-rw-r--r--include/linux/rbtree.h70
-rw-r--r--include/linux/rbtree_augmented.h27
-rw-r--r--include/linux/sched/signal.h16
-rw-r--r--include/linux/signal.h4
-rw-r--r--include/linux/swapops.h5
-rw-r--r--include/linux/tracehook.h9
-rw-r--r--include/uapi/asm-generic/mman-common.h15
-rw-r--r--include/uapi/asm-generic/mman.h10
-rw-r--r--include/uapi/linux/coda.h56
-rw-r--r--include/uapi/linux/coda_psdev.h28
-rw-r--r--include/uapi/linux/ptrace.h35
26 files changed, 303 insertions, 251 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 0e9bd9c83870..aa6c093d9ce9 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -104,8 +104,10 @@ extern void warn_slowpath_null(const char *file, const int line);
104 warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg) 104 warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)
105#else 105#else
106extern __printf(1, 2) void __warn_printk(const char *fmt, ...); 106extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
107#define __WARN() __WARN_TAINT(TAINT_WARN) 107#define __WARN() do { \
108#define __WARN_printf(arg...) do { __warn_printk(arg); __WARN(); } while (0) 108 printk(KERN_WARNING CUT_HERE); __WARN_TAINT(TAINT_WARN); \
109} while (0)
110#define __WARN_printf(arg...) __WARN_printf_taint(TAINT_WARN, arg)
109#define __WARN_printf_taint(taint, arg...) \ 111#define __WARN_printf_taint(taint, arg...) \
110 do { __warn_printk(arg); __WARN_TAINT(taint); } while (0) 112 do { __warn_printk(arg); __WARN_TAINT(taint); } while (0)
111#endif 113#endif
diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h
index 0dd47a6db2cf..a950a22c4890 100644
--- a/include/asm-generic/cacheflush.h
+++ b/include/asm-generic/cacheflush.h
@@ -5,24 +5,70 @@
5/* Keep includes the same across arches. */ 5/* Keep includes the same across arches. */
6#include <linux/mm.h> 6#include <linux/mm.h>
7 7
8#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
9
8/* 10/*
9 * The cache doesn't need to be flushed when TLB entries change when 11 * The cache doesn't need to be flushed when TLB entries change when
10 * the cache is mapped to physical memory, not virtual memory 12 * the cache is mapped to physical memory, not virtual memory
11 */ 13 */
12#define flush_cache_all() do { } while (0) 14static inline void flush_cache_all(void)
13#define flush_cache_mm(mm) do { } while (0) 15{
14#define flush_cache_dup_mm(mm) do { } while (0) 16}
15#define flush_cache_range(vma, start, end) do { } while (0) 17
16#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 18static inline void flush_cache_mm(struct mm_struct *mm)
17#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 19{
18#define flush_dcache_page(page) do { } while (0) 20}
19#define flush_dcache_mmap_lock(mapping) do { } while (0) 21
20#define flush_dcache_mmap_unlock(mapping) do { } while (0) 22static inline void flush_cache_dup_mm(struct mm_struct *mm)
21#define flush_icache_range(start, end) do { } while (0) 23{
22#define flush_icache_page(vma,pg) do { } while (0) 24}
23#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) 25
24#define flush_cache_vmap(start, end) do { } while (0) 26static inline void flush_cache_range(struct vm_area_struct *vma,
25#define flush_cache_vunmap(start, end) do { } while (0) 27 unsigned long start,
28 unsigned long end)
29{
30}
31
32static inline void flush_cache_page(struct vm_area_struct *vma,
33 unsigned long vmaddr,
34 unsigned long pfn)
35{
36}
37
38static inline void flush_dcache_page(struct page *page)
39{
40}
41
42static inline void flush_dcache_mmap_lock(struct address_space *mapping)
43{
44}
45
46static inline void flush_dcache_mmap_unlock(struct address_space *mapping)
47{
48}
49
50static inline void flush_icache_range(unsigned long start, unsigned long end)
51{
52}
53
54static inline void flush_icache_page(struct vm_area_struct *vma,
55 struct page *page)
56{
57}
58
59static inline void flush_icache_user_range(struct vm_area_struct *vma,
60 struct page *page,
61 unsigned long addr, int len)
62{
63}
64
65static inline void flush_cache_vmap(unsigned long start, unsigned long end)
66{
67}
68
69static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
70{
71}
26 72
27#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 73#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
28 do { \ 74 do { \
diff --git a/include/linux/bits.h b/include/linux/bits.h
index 2b7b532c1d51..669d69441a62 100644
--- a/include/linux/bits.h
+++ b/include/linux/bits.h
@@ -1,13 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_BITS_H 2#ifndef __LINUX_BITS_H
3#define __LINUX_BITS_H 3#define __LINUX_BITS_H
4
5#include <linux/const.h>
4#include <asm/bitsperlong.h> 6#include <asm/bitsperlong.h>
5 7
6#define BIT(nr) (1UL << (nr)) 8#define BIT(nr) (UL(1) << (nr))
7#define BIT_ULL(nr) (1ULL << (nr)) 9#define BIT_ULL(nr) (ULL(1) << (nr))
8#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) 10#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
9#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) 11#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
10#define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) 12#define BIT_ULL_MASK(nr) (ULL(1) << ((nr) % BITS_PER_LONG_LONG))
11#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) 13#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG)
12#define BITS_PER_BYTE 8 14#define BITS_PER_BYTE 8
13 15
@@ -17,10 +19,11 @@
17 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. 19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
18 */ 20 */
19#define GENMASK(h, l) \ 21#define GENMASK(h, l) \
20 (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) 22 (((~UL(0)) - (UL(1) << (l)) + 1) & \
23 (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
21 24
22#define GENMASK_ULL(h, l) \ 25#define GENMASK_ULL(h, l) \
23 (((~0ULL) - (1ULL << (l)) + 1) & \ 26 (((~ULL(0)) - (ULL(1) << (l)) + 1) & \
24 (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) 27 (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
25 28
26#endif /* __LINUX_BITS_H */ 29#endif /* __LINUX_BITS_H */
diff --git a/include/linux/coda.h b/include/linux/coda.h
index d30209b9cef8..0ca0c83fdb1c 100644
--- a/include/linux/coda.h
+++ b/include/linux/coda.h
@@ -58,8 +58,7 @@ Mellon the rights to redistribute these changes without encumbrance.
58#ifndef _CODA_HEADER_ 58#ifndef _CODA_HEADER_
59#define _CODA_HEADER_ 59#define _CODA_HEADER_
60 60
61#if defined(__linux__)
62typedef unsigned long long u_quad_t; 61typedef unsigned long long u_quad_t;
63#endif 62
64#include <uapi/linux/coda.h> 63#include <uapi/linux/coda.h>
65#endif 64#endif
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
deleted file mode 100644
index 15170954aa2b..000000000000
--- a/include/linux/coda_psdev.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __CODA_PSDEV_H
3#define __CODA_PSDEV_H
4
5#include <linux/backing-dev.h>
6#include <linux/mutex.h>
7#include <uapi/linux/coda_psdev.h>
8
9struct kstatfs;
10
11/* communication pending/processing queues */
12struct venus_comm {
13 u_long vc_seq;
14 wait_queue_head_t vc_waitq; /* Venus wait queue */
15 struct list_head vc_pending;
16 struct list_head vc_processing;
17 int vc_inuse;
18 struct super_block *vc_sb;
19 struct mutex vc_mutex;
20};
21
22
23static inline struct venus_comm *coda_vcp(struct super_block *sb)
24{
25 return (struct venus_comm *)((sb)->s_fs_info);
26}
27
28/* upcalls */
29int venus_rootfid(struct super_block *sb, struct CodaFid *fidp);
30int venus_getattr(struct super_block *sb, struct CodaFid *fid,
31 struct coda_vattr *attr);
32int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *);
33int venus_lookup(struct super_block *sb, struct CodaFid *fid,
34 const char *name, int length, int *type,
35 struct CodaFid *resfid);
36int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
37 kuid_t uid);
38int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
39 struct file **f);
40int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
41 const char *name, int length,
42 struct CodaFid *newfid, struct coda_vattr *attrs);
43int venus_create(struct super_block *sb, struct CodaFid *dirfid,
44 const char *name, int length, int excl, int mode,
45 struct CodaFid *newfid, struct coda_vattr *attrs) ;
46int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid,
47 const char *name, int length);
48int venus_remove(struct super_block *sb, struct CodaFid *dirfid,
49 const char *name, int length);
50int venus_readlink(struct super_block *sb, struct CodaFid *fid,
51 char *buffer, int *length);
52int venus_rename(struct super_block *, struct CodaFid *new_fid,
53 struct CodaFid *old_fid, size_t old_length,
54 size_t new_length, const char *old_name,
55 const char *new_name);
56int venus_link(struct super_block *sb, struct CodaFid *fid,
57 struct CodaFid *dirfid, const char *name, int len );
58int venus_symlink(struct super_block *sb, struct CodaFid *fid,
59 const char *name, int len, const char *symname, int symlen);
60int venus_access(struct super_block *sb, struct CodaFid *fid, int mask);
61int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
62 unsigned int cmd, struct PioctlData *data);
63int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out);
64int venus_fsync(struct super_block *sb, struct CodaFid *fid);
65int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
66
67/*
68 * Statistics
69 */
70
71extern struct venus_comm coda_comms[];
72#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index ebddcb6cfcf8..16dafd9f4b86 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -138,8 +138,7 @@ typedef struct {
138 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 138 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
139} compat_sigset_t; 139} compat_sigset_t;
140 140
141int set_compat_user_sigmask(const compat_sigset_t __user *usigmask, 141int set_compat_user_sigmask(const compat_sigset_t __user *umask,
142 sigset_t *set, sigset_t *oldset,
143 size_t sigsetsize); 142 size_t sigsetsize);
144 143
145struct compat_sigaction { 144struct compat_sigaction {
diff --git a/include/linux/io.h b/include/linux/io.h
index 9876e5801a9d..accac822336a 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -33,6 +33,7 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end,
33 33
34#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP 34#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
35void __init ioremap_huge_init(void); 35void __init ioremap_huge_init(void);
36int arch_ioremap_p4d_supported(void);
36int arch_ioremap_pud_supported(void); 37int arch_ioremap_pud_supported(void);
37int arch_ioremap_pmd_supported(void); 38int arch_ioremap_pmd_supported(void);
38#else 39#else
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 0c9bc231107f..4fa360a13c1e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -88,6 +88,8 @@
88 */ 88 */
89#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 89#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
90 90
91#define typeof_member(T, m) typeof(((T*)0)->m)
92
91#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP 93#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
92 94
93#define DIV_ROUND_DOWN_ULL(ll, d) \ 95#define DIV_ROUND_DOWN_ULL(ll, d) \
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 443d9800ca3f..04bdaf01112c 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -458,4 +458,23 @@ static inline bool is_kprobe_optinsn_slot(unsigned long addr)
458} 458}
459#endif 459#endif
460 460
461/* Returns true if kprobes handled the fault */
462static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs,
463 unsigned int trap)
464{
465 if (!kprobes_built_in())
466 return false;
467 if (user_mode(regs))
468 return false;
469 /*
470 * To be potentially processing a kprobe fault and to be allowed
471 * to call kprobe_running(), we have to be non-preemptible.
472 */
473 if (preemptible())
474 return false;
475 if (!kprobe_running())
476 return false;
477 return kprobe_fault_handler(regs, trap);
478}
479
461#endif /* _LINUX_KPROBES_H */ 480#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/lz4.h b/include/linux/lz4.h
index 394e3d9213b8..b16e15b9587a 100644
--- a/include/linux/lz4.h
+++ b/include/linux/lz4.h
@@ -278,7 +278,7 @@ int LZ4_decompress_fast(const char *source, char *dest, int originalSize);
278 * @compressedSize: is the precise full size of the compressed block 278 * @compressedSize: is the precise full size of the compressed block
279 * @maxDecompressedSize: is the size of 'dest' buffer 279 * @maxDecompressedSize: is the size of 'dest' buffer
280 * 280 *
281 * Decompresses data fom 'source' into 'dest'. 281 * Decompresses data from 'source' into 'dest'.
282 * If the source stream is detected malformed, the function will 282 * If the source stream is detected malformed, the function will
283 * stop decoding and return a negative result. 283 * stop decoding and return a negative result.
284 * This function is protected against buffer overflow exploits, 284 * This function is protected against buffer overflow exploits,
@@ -522,7 +522,7 @@ int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode,
522 const char *dictionary, int dictSize); 522 const char *dictionary, int dictSize);
523 523
524/** 524/**
525 * LZ4_decompress_fast_continue() - Decompress blocks in streaming mode 525 * LZ4_decompress_safe_continue() - Decompress blocks in streaming mode
526 * @LZ4_streamDecode: the 'LZ4_streamDecode_t' structure 526 * @LZ4_streamDecode: the 'LZ4_streamDecode_t' structure
527 * @source: source address of the compressed data 527 * @source: source address of the compressed data
528 * @dest: output buffer address of the uncompressed data 528 * @dest: output buffer address of the uncompressed data
@@ -530,7 +530,7 @@ int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode,
530 * @compressedSize: is the precise full size of the compressed block 530 * @compressedSize: is the precise full size of the compressed block
531 * @maxDecompressedSize: is the size of 'dest' buffer 531 * @maxDecompressedSize: is the size of 'dest' buffer
532 * 532 *
533 * These decoding function allows decompression of multiple blocks 533 * This decoding function allows decompression of multiple blocks
534 * in "streaming" mode. 534 * in "streaming" mode.
535 * Previously decoded blocks *must* remain available at the memory position 535 * Previously decoded blocks *must* remain available at the memory position
536 * where they were decoded (up to 64 KB) 536 * where they were decoded (up to 64 KB)
@@ -569,7 +569,7 @@ int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode,
569 * which must be already allocated with 'originalSize' bytes 569 * which must be already allocated with 'originalSize' bytes
570 * @originalSize: is the original and therefore uncompressed size 570 * @originalSize: is the original and therefore uncompressed size
571 * 571 *
572 * These decoding function allows decompression of multiple blocks 572 * This decoding function allows decompression of multiple blocks
573 * in "streaming" mode. 573 * in "streaming" mode.
574 * Previously decoded blocks *must* remain available at the memory position 574 * Previously decoded blocks *must* remain available at the memory position
575 * where they were decoded (up to 64 KB) 575 * where they were decoded (up to 64 KB)
@@ -610,10 +610,10 @@ int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode,
610 * @dictStart: pointer to the start of the dictionary in memory 610 * @dictStart: pointer to the start of the dictionary in memory
611 * @dictSize: size of dictionary 611 * @dictSize: size of dictionary
612 * 612 *
613 * These decoding function works the same as 613 * This decoding function works the same as
614 * a combination of LZ4_setStreamDecode() followed by 614 * a combination of LZ4_setStreamDecode() followed by
615 * LZ4_decompress_safe_continue() 615 * LZ4_decompress_safe_continue()
616 * It is stand-alone, and don'tn eed a LZ4_streamDecode_t structure. 616 * It is stand-alone, and doesn't need an LZ4_streamDecode_t structure.
617 * 617 *
618 * Return: number of bytes decompressed into destination buffer 618 * Return: number of bytes decompressed into destination buffer
619 * (necessarily <= maxDecompressedSize) 619 * (necessarily <= maxDecompressedSize)
@@ -633,10 +633,10 @@ int LZ4_decompress_safe_usingDict(const char *source, char *dest,
633 * @dictStart: pointer to the start of the dictionary in memory 633 * @dictStart: pointer to the start of the dictionary in memory
634 * @dictSize: size of dictionary 634 * @dictSize: size of dictionary
635 * 635 *
636 * These decoding function works the same as 636 * This decoding function works the same as
637 * a combination of LZ4_setStreamDecode() followed by 637 * a combination of LZ4_setStreamDecode() followed by
638 * LZ4_decompress_safe_continue() 638 * LZ4_decompress_fast_continue()
639 * It is stand-alone, and don'tn eed a LZ4_streamDecode_t structure. 639 * It is stand-alone, and doesn't need an LZ4_streamDecode_t structure.
640 * 640 *
641 * Return: number of bytes decompressed into destination buffer 641 * Return: number of bytes decompressed into destination buffer
642 * (necessarily <= maxDecompressedSize) 642 * (necessarily <= maxDecompressedSize)
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index ae892eef8b82..988fde33cd7f 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -324,7 +324,7 @@ static inline void pgdat_resize_init(struct pglist_data *pgdat) {}
324extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 324extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
325extern void try_offline_node(int nid); 325extern void try_offline_node(int nid);
326extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 326extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
327extern void remove_memory(int nid, u64 start, u64 size); 327extern int remove_memory(int nid, u64 start, u64 size);
328extern void __remove_memory(int nid, u64 start, u64 size); 328extern void __remove_memory(int nid, u64 start, u64 size);
329 329
330#else 330#else
@@ -341,7 +341,11 @@ static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
341 return -EINVAL; 341 return -EINVAL;
342} 342}
343 343
344static inline void remove_memory(int nid, u64 start, u64 size) {} 344static inline int remove_memory(int nid, u64 start, u64 size)
345{
346 return -EBUSY;
347}
348
345static inline void __remove_memory(int nid, u64 start, u64 size) {} 349static inline void __remove_memory(int nid, u64 start, u64 size) {}
346#endif /* CONFIG_MEMORY_HOTREMOVE */ 350#endif /* CONFIG_MEMORY_HOTREMOVE */
347 351
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 0389c34ac529..bd6512559bed 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -547,7 +547,7 @@ static inline void vma_set_anonymous(struct vm_area_struct *vma)
547struct mmu_gather; 547struct mmu_gather;
548struct inode; 548struct inode;
549 549
550#if !defined(__HAVE_ARCH_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE) 550#if !defined(CONFIG_ARCH_HAS_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE)
551static inline int pmd_devmap(pmd_t pmd) 551static inline int pmd_devmap(pmd_t pmd)
552{ 552{
553 return 0; 553 return 0;
@@ -956,41 +956,28 @@ static inline bool put_devmap_managed_page(struct page *page)
956 return false; 956 return false;
957} 957}
958 958
959static inline bool is_device_private_page(const struct page *page)
960{
961 return is_zone_device_page(page) &&
962 page->pgmap->type == MEMORY_DEVICE_PRIVATE;
963}
964
965#ifdef CONFIG_PCI_P2PDMA
966static inline bool is_pci_p2pdma_page(const struct page *page)
967{
968 return is_zone_device_page(page) &&
969 page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
970}
971#else /* CONFIG_PCI_P2PDMA */
972static inline bool is_pci_p2pdma_page(const struct page *page)
973{
974 return false;
975}
976#endif /* CONFIG_PCI_P2PDMA */
977
978#else /* CONFIG_DEV_PAGEMAP_OPS */ 959#else /* CONFIG_DEV_PAGEMAP_OPS */
979static inline bool put_devmap_managed_page(struct page *page) 960static inline bool put_devmap_managed_page(struct page *page)
980{ 961{
981 return false; 962 return false;
982} 963}
964#endif /* CONFIG_DEV_PAGEMAP_OPS */
983 965
984static inline bool is_device_private_page(const struct page *page) 966static inline bool is_device_private_page(const struct page *page)
985{ 967{
986 return false; 968 return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
969 IS_ENABLED(CONFIG_DEVICE_PRIVATE) &&
970 is_zone_device_page(page) &&
971 page->pgmap->type == MEMORY_DEVICE_PRIVATE;
987} 972}
988 973
989static inline bool is_pci_p2pdma_page(const struct page *page) 974static inline bool is_pci_p2pdma_page(const struct page *page)
990{ 975{
991 return false; 976 return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
977 IS_ENABLED(CONFIG_PCI_P2PDMA) &&
978 is_zone_device_page(page) &&
979 page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
992} 980}
993#endif /* CONFIG_DEV_PAGEMAP_OPS */
994 981
995/* 127: arbitrary random number, small enough to assemble well */ 982/* 127: arbitrary random number, small enough to assemble well */
996#define page_ref_zero_or_close_to_overflow(page) \ 983#define page_ref_zero_or_close_to_overflow(page) \
@@ -1556,6 +1543,10 @@ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
1556int get_user_pages_fast(unsigned long start, int nr_pages, 1543int get_user_pages_fast(unsigned long start, int nr_pages,
1557 unsigned int gup_flags, struct page **pages); 1544 unsigned int gup_flags, struct page **pages);
1558 1545
1546int account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc);
1547int __account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc,
1548 struct task_struct *task, bool bypass_rlim);
1549
1559/* Container for pinned pfns / pages */ 1550/* Container for pinned pfns / pages */
1560struct frame_vector { 1551struct frame_vector {
1561 unsigned int nr_allocated; /* Number of frames we have space for */ 1552 unsigned int nr_allocated; /* Number of frames we have space for */
@@ -1763,7 +1754,7 @@ static inline void sync_mm_rss(struct mm_struct *mm)
1763} 1754}
1764#endif 1755#endif
1765 1756
1766#ifndef __HAVE_ARCH_PTE_DEVMAP 1757#ifndef CONFIG_ARCH_HAS_PTE_DEVMAP
1767static inline int pte_devmap(pte_t pte) 1758static inline int pte_devmap(pte_t pte)
1768{ 1759{
1769 return 0; 1760 return 0;
@@ -2767,7 +2758,13 @@ extern int randomize_va_space;
2767#endif 2758#endif
2768 2759
2769const char * arch_vma_name(struct vm_area_struct *vma); 2760const char * arch_vma_name(struct vm_area_struct *vma);
2761#ifdef CONFIG_MMU
2770void print_vma_addr(char *prefix, unsigned long rip); 2762void print_vma_addr(char *prefix, unsigned long rip);
2763#else
2764static inline void print_vma_addr(char *prefix, unsigned long rip)
2765{
2766}
2767#endif
2771 2768
2772void *sparse_buffer_alloc(unsigned long size); 2769void *sparse_buffer_alloc(unsigned long size);
2773struct page *sparse_mem_map_populate(unsigned long pnum, int nid, 2770struct page *sparse_mem_map_populate(unsigned long pnum, int nid,
diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h
index 01e8037023f7..2d9148221e9a 100644
--- a/include/linux/pfn_t.h
+++ b/include/linux/pfn_t.h
@@ -97,7 +97,7 @@ static inline pud_t pfn_t_pud(pfn_t pfn, pgprot_t pgprot)
97#endif 97#endif
98#endif 98#endif
99 99
100#ifdef __HAVE_ARCH_PTE_DEVMAP 100#ifdef CONFIG_ARCH_HAS_PTE_DEVMAP
101static inline bool pfn_t_devmap(pfn_t pfn) 101static inline bool pfn_t_devmap(pfn_t pfn)
102{ 102{
103 const u64 flags = PFN_DEV|PFN_MAP; 103 const u64 flags = PFN_DEV|PFN_MAP;
@@ -115,7 +115,7 @@ pmd_t pmd_mkdevmap(pmd_t pmd);
115 defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) 115 defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
116pud_t pud_mkdevmap(pud_t pud); 116pud_t pud_mkdevmap(pud_t pud);
117#endif 117#endif
118#endif /* __HAVE_ARCH_PTE_DEVMAP */ 118#endif /* CONFIG_ARCH_HAS_PTE_DEVMAP */
119 119
120#ifdef CONFIG_ARCH_HAS_PTE_SPECIAL 120#ifdef CONFIG_ARCH_HAS_PTE_SPECIAL
121static inline bool pfn_t_special(pfn_t pfn) 121static inline bool pfn_t_special(pfn_t pfn)
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 1484db6ca8d1..2a83e434db9d 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -4,6 +4,7 @@
4 4
5#include <linux/rculist.h> 5#include <linux/rculist.h>
6#include <linux/wait.h> 6#include <linux/wait.h>
7#include <linux/refcount.h>
7 8
8enum pid_type 9enum pid_type
9{ 10{
@@ -57,7 +58,7 @@ struct upid {
57 58
58struct pid 59struct pid
59{ 60{
60 atomic_t count; 61 refcount_t count;
61 unsigned int level; 62 unsigned int level;
62 /* lists of tasks that use this pid */ 63 /* lists of tasks that use this pid */
63 struct hlist_head tasks[PIDTYPE_MAX]; 64 struct hlist_head tasks[PIDTYPE_MAX];
@@ -74,7 +75,7 @@ extern const struct file_operations pidfd_fops;
74static inline struct pid *get_pid(struct pid *pid) 75static inline struct pid *get_pid(struct pid *pid)
75{ 76{
76 if (pid) 77 if (pid)
77 atomic_inc(&pid->count); 78 refcount_inc(&pid->count);
78 return pid; 79 return pid;
79} 80}
80 81
diff --git a/include/linux/poison.h b/include/linux/poison.h
index d6d980a681c7..df34330b4e34 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -21,7 +21,7 @@
21 * non-initialized list entries. 21 * non-initialized list entries.
22 */ 22 */
23#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA) 23#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA)
24#define LIST_POISON2 ((void *) 0x200 + POISON_POINTER_DELTA) 24#define LIST_POISON2 ((void *) 0x122 + POISON_POINTER_DELTA)
25 25
26/********** include/linux/timer.h **********/ 26/********** include/linux/timer.h **********/
27/* 27/*
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index e6337fce08f2..1fd61a9af45c 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -32,25 +32,9 @@ struct rb_root {
32 struct rb_node *rb_node; 32 struct rb_node *rb_node;
33}; 33};
34 34
35/*
36 * Leftmost-cached rbtrees.
37 *
38 * We do not cache the rightmost node based on footprint
39 * size vs number of potential users that could benefit
40 * from O(1) rb_last(). Just not worth it, users that want
41 * this feature can always implement the logic explicitly.
42 * Furthermore, users that want to cache both pointers may
43 * find it a bit asymmetric, but that's ok.
44 */
45struct rb_root_cached {
46 struct rb_root rb_root;
47 struct rb_node *rb_leftmost;
48};
49
50#define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3)) 35#define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3))
51 36
52#define RB_ROOT (struct rb_root) { NULL, } 37#define RB_ROOT (struct rb_root) { NULL, }
53#define RB_ROOT_CACHED (struct rb_root_cached) { {NULL, }, NULL }
54#define rb_entry(ptr, type, member) container_of(ptr, type, member) 38#define rb_entry(ptr, type, member) container_of(ptr, type, member)
55 39
56#define RB_EMPTY_ROOT(root) (READ_ONCE((root)->rb_node) == NULL) 40#define RB_EMPTY_ROOT(root) (READ_ONCE((root)->rb_node) == NULL)
@@ -72,12 +56,6 @@ extern struct rb_node *rb_prev(const struct rb_node *);
72extern struct rb_node *rb_first(const struct rb_root *); 56extern struct rb_node *rb_first(const struct rb_root *);
73extern struct rb_node *rb_last(const struct rb_root *); 57extern struct rb_node *rb_last(const struct rb_root *);
74 58
75extern void rb_insert_color_cached(struct rb_node *,
76 struct rb_root_cached *, bool);
77extern void rb_erase_cached(struct rb_node *node, struct rb_root_cached *);
78/* Same as rb_first(), but O(1) */
79#define rb_first_cached(root) (root)->rb_leftmost
80
81/* Postorder iteration - always visit the parent after its children */ 59/* Postorder iteration - always visit the parent after its children */
82extern struct rb_node *rb_first_postorder(const struct rb_root *); 60extern struct rb_node *rb_first_postorder(const struct rb_root *);
83extern struct rb_node *rb_next_postorder(const struct rb_node *); 61extern struct rb_node *rb_next_postorder(const struct rb_node *);
@@ -87,8 +65,6 @@ extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
87 struct rb_root *root); 65 struct rb_root *root);
88extern void rb_replace_node_rcu(struct rb_node *victim, struct rb_node *new, 66extern void rb_replace_node_rcu(struct rb_node *victim, struct rb_node *new,
89 struct rb_root *root); 67 struct rb_root *root);
90extern void rb_replace_node_cached(struct rb_node *victim, struct rb_node *new,
91 struct rb_root_cached *root);
92 68
93static inline void rb_link_node(struct rb_node *node, struct rb_node *parent, 69static inline void rb_link_node(struct rb_node *node, struct rb_node *parent,
94 struct rb_node **rb_link) 70 struct rb_node **rb_link)
@@ -136,4 +112,50 @@ static inline void rb_link_node_rcu(struct rb_node *node, struct rb_node *parent
136 typeof(*pos), field); 1; }); \ 112 typeof(*pos), field); 1; }); \
137 pos = n) 113 pos = n)
138 114
115/*
116 * Leftmost-cached rbtrees.
117 *
118 * We do not cache the rightmost node based on footprint
119 * size vs number of potential users that could benefit
120 * from O(1) rb_last(). Just not worth it, users that want
121 * this feature can always implement the logic explicitly.
122 * Furthermore, users that want to cache both pointers may
123 * find it a bit asymmetric, but that's ok.
124 */
125struct rb_root_cached {
126 struct rb_root rb_root;
127 struct rb_node *rb_leftmost;
128};
129
130#define RB_ROOT_CACHED (struct rb_root_cached) { {NULL, }, NULL }
131
132/* Same as rb_first(), but O(1) */
133#define rb_first_cached(root) (root)->rb_leftmost
134
135static inline void rb_insert_color_cached(struct rb_node *node,
136 struct rb_root_cached *root,
137 bool leftmost)
138{
139 if (leftmost)
140 root->rb_leftmost = node;
141 rb_insert_color(node, &root->rb_root);
142}
143
144static inline void rb_erase_cached(struct rb_node *node,
145 struct rb_root_cached *root)
146{
147 if (root->rb_leftmost == node)
148 root->rb_leftmost = rb_next(node);
149 rb_erase(node, &root->rb_root);
150}
151
152static inline void rb_replace_node_cached(struct rb_node *victim,
153 struct rb_node *new,
154 struct rb_root_cached *root)
155{
156 if (root->rb_leftmost == victim)
157 root->rb_leftmost = new;
158 rb_replace_node(victim, new, &root->rb_root);
159}
160
139#endif /* _LINUX_RBTREE_H */ 161#endif /* _LINUX_RBTREE_H */
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
index 0f902ccb48b0..179faab29f52 100644
--- a/include/linux/rbtree_augmented.h
+++ b/include/linux/rbtree_augmented.h
@@ -30,10 +30,9 @@ struct rb_augment_callbacks {
30 void (*rotate)(struct rb_node *old, struct rb_node *new); 30 void (*rotate)(struct rb_node *old, struct rb_node *new);
31}; 31};
32 32
33extern void __rb_insert_augmented(struct rb_node *node, 33extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root,
34 struct rb_root *root,
35 bool newleft, struct rb_node **leftmost,
36 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); 34 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
35
37/* 36/*
38 * Fixup the rbtree and update the augmented information when rebalancing. 37 * Fixup the rbtree and update the augmented information when rebalancing.
39 * 38 *
@@ -48,7 +47,7 @@ static inline void
48rb_insert_augmented(struct rb_node *node, struct rb_root *root, 47rb_insert_augmented(struct rb_node *node, struct rb_root *root,
49 const struct rb_augment_callbacks *augment) 48 const struct rb_augment_callbacks *augment)
50{ 49{
51 __rb_insert_augmented(node, root, false, NULL, augment->rotate); 50 __rb_insert_augmented(node, root, augment->rotate);
52} 51}
53 52
54static inline void 53static inline void
@@ -56,8 +55,9 @@ rb_insert_augmented_cached(struct rb_node *node,
56 struct rb_root_cached *root, bool newleft, 55 struct rb_root_cached *root, bool newleft,
57 const struct rb_augment_callbacks *augment) 56 const struct rb_augment_callbacks *augment)
58{ 57{
59 __rb_insert_augmented(node, &root->rb_root, 58 if (newleft)
60 newleft, &root->rb_leftmost, augment->rotate); 59 root->rb_leftmost = node;
60 rb_insert_augmented(node, &root->rb_root, augment);
61} 61}
62 62
63#define RB_DECLARE_CALLBACKS(rbstatic, rbname, rbstruct, rbfield, \ 63#define RB_DECLARE_CALLBACKS(rbstatic, rbname, rbstruct, rbfield, \
@@ -150,7 +150,6 @@ extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root,
150 150
151static __always_inline struct rb_node * 151static __always_inline struct rb_node *
152__rb_erase_augmented(struct rb_node *node, struct rb_root *root, 152__rb_erase_augmented(struct rb_node *node, struct rb_root *root,
153 struct rb_node **leftmost,
154 const struct rb_augment_callbacks *augment) 153 const struct rb_augment_callbacks *augment)
155{ 154{
156 struct rb_node *child = node->rb_right; 155 struct rb_node *child = node->rb_right;
@@ -158,9 +157,6 @@ __rb_erase_augmented(struct rb_node *node, struct rb_root *root,
158 struct rb_node *parent, *rebalance; 157 struct rb_node *parent, *rebalance;
159 unsigned long pc; 158 unsigned long pc;
160 159
161 if (leftmost && node == *leftmost)
162 *leftmost = rb_next(node);
163
164 if (!tmp) { 160 if (!tmp) {
165 /* 161 /*
166 * Case 1: node to erase has no more than 1 child (easy!) 162 * Case 1: node to erase has no more than 1 child (easy!)
@@ -260,8 +256,7 @@ static __always_inline void
260rb_erase_augmented(struct rb_node *node, struct rb_root *root, 256rb_erase_augmented(struct rb_node *node, struct rb_root *root,
261 const struct rb_augment_callbacks *augment) 257 const struct rb_augment_callbacks *augment)
262{ 258{
263 struct rb_node *rebalance = __rb_erase_augmented(node, root, 259 struct rb_node *rebalance = __rb_erase_augmented(node, root, augment);
264 NULL, augment);
265 if (rebalance) 260 if (rebalance)
266 __rb_erase_color(rebalance, root, augment->rotate); 261 __rb_erase_color(rebalance, root, augment->rotate);
267} 262}
@@ -270,11 +265,9 @@ static __always_inline void
270rb_erase_augmented_cached(struct rb_node *node, struct rb_root_cached *root, 265rb_erase_augmented_cached(struct rb_node *node, struct rb_root_cached *root,
271 const struct rb_augment_callbacks *augment) 266 const struct rb_augment_callbacks *augment)
272{ 267{
273 struct rb_node *rebalance = __rb_erase_augmented(node, &root->rb_root, 268 if (root->rb_leftmost == node)
274 &root->rb_leftmost, 269 root->rb_leftmost = rb_next(node);
275 augment); 270 rb_erase_augmented(node, &root->rb_root, augment);
276 if (rebalance)
277 __rb_erase_color(rebalance, &root->rb_root, augment->rotate);
278} 271}
279 272
280#endif /* _LINUX_RBTREE_AUGMENTED_H */ 273#endif /* _LINUX_RBTREE_AUGMENTED_H */
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 532458698bde..efd8ce7675ed 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -15,10 +15,10 @@
15 */ 15 */
16 16
17struct sighand_struct { 17struct sighand_struct {
18 refcount_t count;
19 struct k_sigaction action[_NSIG];
20 spinlock_t siglock; 18 spinlock_t siglock;
19 refcount_t count;
21 wait_queue_head_t signalfd_wqh; 20 wait_queue_head_t signalfd_wqh;
21 struct k_sigaction action[_NSIG];
22}; 22};
23 23
24/* 24/*
@@ -420,7 +420,6 @@ void task_join_group_stop(struct task_struct *task);
420static inline void set_restore_sigmask(void) 420static inline void set_restore_sigmask(void)
421{ 421{
422 set_thread_flag(TIF_RESTORE_SIGMASK); 422 set_thread_flag(TIF_RESTORE_SIGMASK);
423 WARN_ON(!test_thread_flag(TIF_SIGPENDING));
424} 423}
425 424
426static inline void clear_tsk_restore_sigmask(struct task_struct *task) 425static inline void clear_tsk_restore_sigmask(struct task_struct *task)
@@ -451,7 +450,6 @@ static inline bool test_and_clear_restore_sigmask(void)
451static inline void set_restore_sigmask(void) 450static inline void set_restore_sigmask(void)
452{ 451{
453 current->restore_sigmask = true; 452 current->restore_sigmask = true;
454 WARN_ON(!test_thread_flag(TIF_SIGPENDING));
455} 453}
456static inline void clear_tsk_restore_sigmask(struct task_struct *task) 454static inline void clear_tsk_restore_sigmask(struct task_struct *task)
457{ 455{
@@ -484,6 +482,16 @@ static inline void restore_saved_sigmask(void)
484 __set_current_blocked(&current->saved_sigmask); 482 __set_current_blocked(&current->saved_sigmask);
485} 483}
486 484
485extern int set_user_sigmask(const sigset_t __user *umask, size_t sigsetsize);
486
487static inline void restore_saved_sigmask_unless(bool interrupted)
488{
489 if (interrupted)
490 WARN_ON(!test_thread_flag(TIF_SIGPENDING));
491 else
492 restore_saved_sigmask();
493}
494
487static inline sigset_t *sigmask_to_save(void) 495static inline sigset_t *sigmask_to_save(void)
488{ 496{
489 sigset_t *res = &current->blocked; 497 sigset_t *res = &current->blocked;
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 78c2bb376954..b5d99482d3fe 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -273,10 +273,6 @@ extern int group_send_sig_info(int sig, struct kernel_siginfo *info,
273 struct task_struct *p, enum pid_type type); 273 struct task_struct *p, enum pid_type type);
274extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *); 274extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *);
275extern int sigprocmask(int, sigset_t *, sigset_t *); 275extern int sigprocmask(int, sigset_t *, sigset_t *);
276extern int set_user_sigmask(const sigset_t __user *usigmask, sigset_t *set,
277 sigset_t *oldset, size_t sigsetsize);
278extern void restore_user_sigmask(const void __user *usigmask,
279 sigset_t *sigsaved, bool interrupted);
280extern void set_current_blocked(sigset_t *); 276extern void set_current_blocked(sigset_t *);
281extern void __set_current_blocked(const sigset_t *); 277extern void __set_current_blocked(const sigset_t *);
282extern int show_unhandled_signals; 278extern int show_unhandled_signals;
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 15bdb6fe71e5..877fd239b6ff 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -6,6 +6,8 @@
6#include <linux/bug.h> 6#include <linux/bug.h>
7#include <linux/mm_types.h> 7#include <linux/mm_types.h>
8 8
9#ifdef CONFIG_MMU
10
9/* 11/*
10 * swapcache pages are stored in the swapper_space radix tree. We want to 12 * swapcache pages are stored in the swapper_space radix tree. We want to
11 * get good packing density in that tree, so the index should be dense in 13 * get good packing density in that tree, so the index should be dense in
@@ -50,13 +52,11 @@ static inline pgoff_t swp_offset(swp_entry_t entry)
50 return entry.val & SWP_OFFSET_MASK; 52 return entry.val & SWP_OFFSET_MASK;
51} 53}
52 54
53#ifdef CONFIG_MMU
54/* check whether a pte points to a swap entry */ 55/* check whether a pte points to a swap entry */
55static inline int is_swap_pte(pte_t pte) 56static inline int is_swap_pte(pte_t pte)
56{ 57{
57 return !pte_none(pte) && !pte_present(pte); 58 return !pte_none(pte) && !pte_present(pte);
58} 59}
59#endif
60 60
61/* 61/*
62 * Convert the arch-dependent pte representation of a swp_entry_t into an 62 * Convert the arch-dependent pte representation of a swp_entry_t into an
@@ -360,4 +360,5 @@ static inline int non_swap_entry(swp_entry_t entry)
360} 360}
361#endif 361#endif
362 362
363#endif /* CONFIG_MMU */
363#endif /* _LINUX_SWAPOPS_H */ 364#endif /* _LINUX_SWAPOPS_H */
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 8446573cc682..36fb3bbed6b2 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -54,13 +54,15 @@ struct linux_binprm;
54/* 54/*
55 * ptrace report for syscall entry and exit looks identical. 55 * ptrace report for syscall entry and exit looks identical.
56 */ 56 */
57static inline int ptrace_report_syscall(struct pt_regs *regs) 57static inline int ptrace_report_syscall(struct pt_regs *regs,
58 unsigned long message)
58{ 59{
59 int ptrace = current->ptrace; 60 int ptrace = current->ptrace;
60 61
61 if (!(ptrace & PT_PTRACED)) 62 if (!(ptrace & PT_PTRACED))
62 return 0; 63 return 0;
63 64
65 current->ptrace_message = message;
64 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); 66 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
65 67
66 /* 68 /*
@@ -73,6 +75,7 @@ static inline int ptrace_report_syscall(struct pt_regs *regs)
73 current->exit_code = 0; 75 current->exit_code = 0;
74 } 76 }
75 77
78 current->ptrace_message = 0;
76 return fatal_signal_pending(current); 79 return fatal_signal_pending(current);
77} 80}
78 81
@@ -98,7 +101,7 @@ static inline int ptrace_report_syscall(struct pt_regs *regs)
98static inline __must_check int tracehook_report_syscall_entry( 101static inline __must_check int tracehook_report_syscall_entry(
99 struct pt_regs *regs) 102 struct pt_regs *regs)
100{ 103{
101 return ptrace_report_syscall(regs); 104 return ptrace_report_syscall(regs, PTRACE_EVENTMSG_SYSCALL_ENTRY);
102} 105}
103 106
104/** 107/**
@@ -123,7 +126,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
123 if (step) 126 if (step)
124 user_single_step_report(regs); 127 user_single_step_report(regs);
125 else 128 else
126 ptrace_report_syscall(regs); 129 ptrace_report_syscall(regs, PTRACE_EVENTMSG_SYSCALL_EXIT);
127} 130}
128 131
129/** 132/**
diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
index abd238d0f7a4..63b1f506ea67 100644
--- a/include/uapi/asm-generic/mman-common.h
+++ b/include/uapi/asm-generic/mman-common.h
@@ -19,15 +19,18 @@
19#define MAP_TYPE 0x0f /* Mask for type of mapping */ 19#define MAP_TYPE 0x0f /* Mask for type of mapping */
20#define MAP_FIXED 0x10 /* Interpret addr exactly */ 20#define MAP_FIXED 0x10 /* Interpret addr exactly */
21#define MAP_ANONYMOUS 0x20 /* don't use a file */ 21#define MAP_ANONYMOUS 0x20 /* don't use a file */
22#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
23# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */
24#else
25# define MAP_UNINITIALIZED 0x0 /* Don't support this flag */
26#endif
27 22
28/* 0x0100 - 0x80000 flags are defined in asm-generic/mman.h */ 23/* 0x0100 - 0x4000 flags are defined in asm-generic/mman.h */
24#define MAP_POPULATE 0x008000 /* populate (prefault) pagetables */
25#define MAP_NONBLOCK 0x010000 /* do not block on IO */
26#define MAP_STACK 0x020000 /* give out an address that is best suited for process/thread stacks */
27#define MAP_HUGETLB 0x040000 /* create a huge page mapping */
28#define MAP_SYNC 0x080000 /* perform synchronous page faults for the mapping */
29#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ 29#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */
30 30
31#define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be
32 * uninitialized */
33
31/* 34/*
32 * Flags for mlock 35 * Flags for mlock
33 */ 36 */
diff --git a/include/uapi/asm-generic/mman.h b/include/uapi/asm-generic/mman.h
index 653687d9771b..57e8195d0b53 100644
--- a/include/uapi/asm-generic/mman.h
+++ b/include/uapi/asm-generic/mman.h
@@ -9,13 +9,11 @@
9#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 9#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
10#define MAP_LOCKED 0x2000 /* pages are locked */ 10#define MAP_LOCKED 0x2000 /* pages are locked */
11#define MAP_NORESERVE 0x4000 /* don't check for reservations */ 11#define MAP_NORESERVE 0x4000 /* don't check for reservations */
12#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
13#define MAP_NONBLOCK 0x10000 /* do not block on IO */
14#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
15#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
16#define MAP_SYNC 0x80000 /* perform synchronous page faults for the mapping */
17 12
18/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */ 13/*
14 * Bits [26:31] are reserved, see asm-generic/hugetlb_encode.h
15 * for MAP_HUGETLB usage
16 */
19 17
20#define MCL_CURRENT 1 /* lock all current mappings */ 18#define MCL_CURRENT 1 /* lock all current mappings */
21#define MCL_FUTURE 2 /* lock all future mappings */ 19#define MCL_FUTURE 2 /* lock all future mappings */
diff --git a/include/uapi/linux/coda.h b/include/uapi/linux/coda.h
index 695fade33c64..aa34c2dcae8d 100644
--- a/include/uapi/linux/coda.h
+++ b/include/uapi/linux/coda.h
@@ -86,10 +86,6 @@ typedef unsigned long long u_quad_t;
86 86
87#define inline 87#define inline
88 88
89struct timespec {
90 long ts_sec;
91 long ts_nsec;
92};
93#else /* DJGPP but not KERNEL */ 89#else /* DJGPP but not KERNEL */
94#include <sys/time.h> 90#include <sys/time.h>
95typedef unsigned long long u_quad_t; 91typedef unsigned long long u_quad_t;
@@ -110,13 +106,6 @@ typedef unsigned long long u_quad_t;
110#define cdev_t dev_t 106#define cdev_t dev_t
111#endif 107#endif
112 108
113#ifdef __CYGWIN32__
114struct timespec {
115 time_t tv_sec; /* seconds */
116 long tv_nsec; /* nanoseconds */
117};
118#endif
119
120#ifndef __BIT_TYPES_DEFINED__ 109#ifndef __BIT_TYPES_DEFINED__
121#define __BIT_TYPES_DEFINED__ 110#define __BIT_TYPES_DEFINED__
122typedef signed char int8_t; 111typedef signed char int8_t;
@@ -211,6 +200,11 @@ struct CodaFid {
211 */ 200 */
212enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; 201enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
213 202
203struct coda_timespec {
204 int64_t tv_sec; /* seconds */
205 long tv_nsec; /* nanoseconds */
206};
207
214struct coda_vattr { 208struct coda_vattr {
215 long va_type; /* vnode type (for create) */ 209 long va_type; /* vnode type (for create) */
216 u_short va_mode; /* files access mode and type */ 210 u_short va_mode; /* files access mode and type */
@@ -220,9 +214,9 @@ struct coda_vattr {
220 long va_fileid; /* file id */ 214 long va_fileid; /* file id */
221 u_quad_t va_size; /* file size in bytes */ 215 u_quad_t va_size; /* file size in bytes */
222 long va_blocksize; /* blocksize preferred for i/o */ 216 long va_blocksize; /* blocksize preferred for i/o */
223 struct timespec va_atime; /* time of last access */ 217 struct coda_timespec va_atime; /* time of last access */
224 struct timespec va_mtime; /* time of last modification */ 218 struct coda_timespec va_mtime; /* time of last modification */
225 struct timespec va_ctime; /* time file changed */ 219 struct coda_timespec va_ctime; /* time file changed */
226 u_long va_gen; /* generation number of file */ 220 u_long va_gen; /* generation number of file */
227 u_long va_flags; /* flags defined for file */ 221 u_long va_flags; /* flags defined for file */
228 cdev_t va_rdev; /* device special file represents */ 222 cdev_t va_rdev; /* device special file represents */
@@ -277,7 +271,8 @@ struct coda_statfs {
277#define CODA_STATFS 34 271#define CODA_STATFS 34
278#define CODA_STORE 35 272#define CODA_STORE 35
279#define CODA_RELEASE 36 273#define CODA_RELEASE 36
280#define CODA_NCALLS 37 274#define CODA_ACCESS_INTENT 37
275#define CODA_NCALLS 38
281 276
282#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) 277#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
283 278
@@ -287,7 +282,12 @@ struct coda_statfs {
287 282
288#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) 283#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
289 284
290#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */ 285// CODA_KERNEL_VERSION 0 /* don't care about kernel version number */
286// CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */
287// CODA_KERNEL_VERSION 2 /* venus_lookup gets an extra parameter */
288// CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
289// CODA_KERNEL_VERSION 4 /* 64-bit timespec */
290#define CODA_KERNEL_VERSION 5 /* access intent support */
291 291
292/* 292/*
293 * Venus <-> Coda RPC arguments 293 * Venus <-> Coda RPC arguments
@@ -295,8 +295,8 @@ struct coda_statfs {
295struct coda_in_hdr { 295struct coda_in_hdr {
296 u_int32_t opcode; 296 u_int32_t opcode;
297 u_int32_t unique; /* Keep multiple outstanding msgs distinct */ 297 u_int32_t unique; /* Keep multiple outstanding msgs distinct */
298 pid_t pid; 298 __kernel_pid_t pid;
299 pid_t pgid; 299 __kernel_pid_t pgid;
300 vuid_t uid; 300 vuid_t uid;
301}; 301};
302 302
@@ -642,6 +642,25 @@ struct coda_statfs_out {
642 struct coda_statfs stat; 642 struct coda_statfs stat;
643}; 643};
644 644
645#define CODA_ACCESS_TYPE_READ 1
646#define CODA_ACCESS_TYPE_WRITE 2
647#define CODA_ACCESS_TYPE_MMAP 3
648#define CODA_ACCESS_TYPE_READ_FINISH 4
649#define CODA_ACCESS_TYPE_WRITE_FINISH 5
650
651/* coda_access_intent: NO_OUT */
652struct coda_access_intent_in {
653 struct coda_in_hdr ih;
654 struct CodaFid VFid;
655 int count;
656 int pos;
657 int type;
658};
659
660struct coda_access_intent_out {
661 struct coda_out_hdr out;
662};
663
645/* 664/*
646 * Occasionally, we don't cache the fid returned by CODA_LOOKUP. 665 * Occasionally, we don't cache the fid returned by CODA_LOOKUP.
647 * For instance, if the fid is inconsistent. 666 * For instance, if the fid is inconsistent.
@@ -673,6 +692,7 @@ union inputArgs {
673 struct coda_open_by_fd_in coda_open_by_fd; 692 struct coda_open_by_fd_in coda_open_by_fd;
674 struct coda_open_by_path_in coda_open_by_path; 693 struct coda_open_by_path_in coda_open_by_path;
675 struct coda_statfs_in coda_statfs; 694 struct coda_statfs_in coda_statfs;
695 struct coda_access_intent_in coda_access_intent;
676}; 696};
677 697
678union outputArgs { 698union outputArgs {
diff --git a/include/uapi/linux/coda_psdev.h b/include/uapi/linux/coda_psdev.h
deleted file mode 100644
index aa6623efd2dd..000000000000
--- a/include/uapi/linux/coda_psdev.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _UAPI__CODA_PSDEV_H
3#define _UAPI__CODA_PSDEV_H
4
5#include <linux/magic.h>
6
7#define CODA_PSDEV_MAJOR 67
8#define MAX_CODADEVS 5 /* how many do we allow */
9
10
11/* messages between coda filesystem in kernel and Venus */
12struct upc_req {
13 struct list_head uc_chain;
14 caddr_t uc_data;
15 u_short uc_flags;
16 u_short uc_inSize; /* Size is at most 5000 bytes */
17 u_short uc_outSize;
18 u_short uc_opcode; /* copied from data to save lookup */
19 int uc_unique;
20 wait_queue_head_t uc_sleep; /* process' wait queue */
21};
22
23#define CODA_REQ_ASYNC 0x1
24#define CODA_REQ_READ 0x2
25#define CODA_REQ_WRITE 0x4
26#define CODA_REQ_ABORT 0x8
27
28#endif /* _UAPI__CODA_PSDEV_H */
diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h
index d5a1b8a492b9..a71b6e3b03eb 100644
--- a/include/uapi/linux/ptrace.h
+++ b/include/uapi/linux/ptrace.h
@@ -73,6 +73,41 @@ struct seccomp_metadata {
73 __u64 flags; /* Output: filter's flags */ 73 __u64 flags; /* Output: filter's flags */
74}; 74};
75 75
76#define PTRACE_GET_SYSCALL_INFO 0x420e
77#define PTRACE_SYSCALL_INFO_NONE 0
78#define PTRACE_SYSCALL_INFO_ENTRY 1
79#define PTRACE_SYSCALL_INFO_EXIT 2
80#define PTRACE_SYSCALL_INFO_SECCOMP 3
81
82struct ptrace_syscall_info {
83 __u8 op; /* PTRACE_SYSCALL_INFO_* */
84 __u32 arch __attribute__((__aligned__(sizeof(__u32))));
85 __u64 instruction_pointer;
86 __u64 stack_pointer;
87 union {
88 struct {
89 __u64 nr;
90 __u64 args[6];
91 } entry;
92 struct {
93 __s64 rval;
94 __u8 is_error;
95 } exit;
96 struct {
97 __u64 nr;
98 __u64 args[6];
99 __u32 ret_data;
100 } seccomp;
101 };
102};
103
104/*
105 * These values are stored in task->ptrace_message
106 * by tracehook_report_syscall_* to describe the current syscall-stop.
107 */
108#define PTRACE_EVENTMSG_SYSCALL_ENTRY 1
109#define PTRACE_EVENTMSG_SYSCALL_EXIT 2
110
76/* Read signals from a shared (process wide) queue */ 111/* Read signals from a shared (process wide) queue */
77#define PTRACE_PEEKSIGINFO_SHARED (1 << 0) 112#define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
78 113