Merge third patchbomb from Andrew Morton: - various misc things - a couple of lib/ optimisations - provide DIV_ROUND_CLOSEST_ULL() - checkpatch updates - rtc tree - befs, nilfs2, hfs, hfsplus, fatfs, adfs, affs, bfs - ptrace fixes - fork() fixes - seccomp cleanups - more mmap_sem hold time reductions from Davidlohr * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (138 commits) proc: show locks in /proc/pid/fdinfo/X docs: add missing and new /proc/PID/status file entries, fix typos drivers/rtc/rtc-at91rm9200.c: make IO endian agnostic Documentation/spi/spidev_test.c: fix warning drivers/rtc/rtc-s5m.c: allow usage on device type different than main MFD type .gitignore: ignore *.tar MAINTAINERS: add Mediatek SoC mailing list tomoyo: reduce mmap_sem hold for mm->exe_file powerpc/oprofile: reduce mmap_sem hold for exe_file oprofile: reduce mmap_sem hold for mm->exe_file mips: ip32: add platform data hooks to use DS1685 driver lib/Kconfig: fix up HAVE_ARCH_BITREVERSE help text x86: switch to using asm-generic for seccomp.h sparc: switch to using asm-generic for seccomp.h powerpc: switch to using asm-generic for seccomp.h parisc: switch to using asm-generic for seccomp.h mips: switch to using asm-generic for seccomp.h microblaze: use asm-generic for seccomp.h arm: use asm-generic for seccomp.h seccomp: allow COMPAT sigreturn overrides ...
Showing the changes to include (11 of 158 files). Show all
Unified · Split
| @@ -17,7 +17,9 @@ · 16 unmodified lines | |||
| 17 | #define __NR_seccomp_read_32 __NR_read | 17 | #define __NR_seccomp_read_32 __NR_read |
| 18 | #define __NR_seccomp_write_32 __NR_write | 18 | #define __NR_seccomp_write_32 __NR_write |
| 19 | #define __NR_seccomp_exit_32 __NR_exit | 19 | #define __NR_seccomp_exit_32 __NR_exit |
| 20 | #ifndef __NR_seccomp_sigreturn_32 | ||
| 20 | #define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn | 21 | #define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn |
| 22 | #endif | ||
| 21 | #endif /* CONFIG_COMPAT && ! already defined */ | 23 | #endif /* CONFIG_COMPAT && ! already defined */ |
| 22 | 24 | ||
| 23 | #define __NR_seccomp_read __NR_read | 25 | #define __NR_seccomp_read __NR_read |
| @@ -283,16 +283,16 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits) · 282 unmodified lines | |||
| 283 | { | 283 | { |
| 284 | if (small_const_nbits(nbits)) | 284 | if (small_const_nbits(nbits)) |
| 285 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); | 285 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); |
| 286 | else | 286 | |
| 287 | return __bitmap_empty(src, nbits); | 287 | return find_first_bit(src, nbits) == nbits; |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | static inline int bitmap_full(const unsigned long *src, unsigned int nbits) | 290 | static inline int bitmap_full(const unsigned long *src, unsigned int nbits) |
| 291 | { | 291 | { |
| 292 | if (small_const_nbits(nbits)) | 292 | if (small_const_nbits(nbits)) |
| 293 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); | 293 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); |
| 294 | else | 294 | |
| 295 | return __bitmap_full(src, nbits); | 295 | return find_first_zero_bit(src, nbits) == nbits; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) | 298 | static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) |
| @@ -218,9 +218,9 @@ static inline unsigned long __ffs64(u64 word) · 217 unmodified lines | |||
| 218 | /** | 218 | /** |
| 219 | * find_last_bit - find the last set bit in a memory region | 219 | * find_last_bit - find the last set bit in a memory region |
| 220 | * @addr: The address to start the search at | 220 | * @addr: The address to start the search at |
| 221 | * @size: The maximum size to search | 221 | * @size: The number of bits to search |
| 222 | * | 222 | * |
| 223 | * Returns the bit number of the first set bit, or size. | 223 | * Returns the bit number of the last set bit, or size. |
| 224 | */ | 224 | */ |
| 225 | extern unsigned long find_last_bit(const unsigned long *addr, | 225 | extern unsigned long find_last_bit(const unsigned long *addr, |
| 226 | unsigned long size); | 226 | unsigned long size); |
| @@ -875,6 +875,7 @@ static inline struct file *get_file(struct file *f) · 874 unmodified lines | |||
| 875 | atomic_long_inc(&f->f_count); | 875 | atomic_long_inc(&f->f_count); |
| 876 | return f; | 876 | return f; |
| 877 | } | 877 | } |
| 878 | #define get_file_rcu(x) atomic_long_inc_not_zero(&(x)->f_count) | ||
| 878 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 879 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
| 879 | #define file_count(x) atomic_long_read(&(x)->f_count) | 880 | #define file_count(x) atomic_long_read(&(x)->f_count) |
| 880 | 881 | ||
| @@ -1046,6 +1047,9 @@ extern void lease_get_mtime(struct inode *, struct timespec *time); · 165 unmodified lines | |||
| 1046 | extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); | 1047 | extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); |
| 1047 | extern int vfs_setlease(struct file *, long, struct file_lock **, void **); | 1048 | extern int vfs_setlease(struct file *, long, struct file_lock **, void **); |
| 1048 | extern int lease_modify(struct file_lock *, int, struct list_head *); | 1049 | extern int lease_modify(struct file_lock *, int, struct list_head *); |
| 1050 | struct files_struct; | ||
| 1051 | extern void show_fd_locks(struct seq_file *f, | ||
| 1052 | struct file *filp, struct files_struct *files); | ||
| 1049 | #else /* !CONFIG_FILE_LOCKING */ | 1053 | #else /* !CONFIG_FILE_LOCKING */ |
| 1050 | static inline int fcntl_getlk(struct file *file, unsigned int cmd, | 1054 | static inline int fcntl_getlk(struct file *file, unsigned int cmd, |
| 1051 | struct flock __user *user) | 1055 | struct flock __user *user) |
| @@ -1182,6 +1186,10 @@ static inline int lease_modify(struct file_lock *fl, int arg, · 130 unmodified lines | |||
| 1182 | { | 1186 | { |
| 1183 | return -EINVAL; | 1187 | return -EINVAL; |
| 1184 | } | 1188 | } |
| 1189 | |||
| 1190 | struct files_struct; | ||
| 1191 | static inline void show_fd_locks(struct seq_file *f, | ||
| 1192 | struct file *filp, struct files_struct *files) {} | ||
| 1185 | #endif /* !CONFIG_FILE_LOCKING */ | 1193 | #endif /* !CONFIG_FILE_LOCKING */ |
| 1186 | 1194 | ||
| 1187 | 1195 | ||
| @@ -22,14 +22,6 @@ · 21 unmodified lines | |||
| 22 | #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) | 22 | #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) |
| 23 | #define ___config_enabled(__ignored, val, ...) val | 23 | #define ___config_enabled(__ignored, val, ...) val |
| 24 | 24 | ||
| 25 | /* | ||
| 26 | * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', | ||
| 27 | * 0 otherwise. | ||
| 28 | * | ||
| 29 | */ | ||
| 30 | #define IS_ENABLED(option) \ | ||
| 31 | (config_enabled(option) || config_enabled(option##_MODULE)) | ||
| 32 | |||
| 33 | /* | 25 | /* |
| 34 | * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 | 26 | * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 |
| 35 | * otherwise. For boolean options, this is equivalent to | 27 | * otherwise. For boolean options, this is equivalent to |
| @@ -43,4 +35,11 @@ · 7 unmodified lines | |||
| 43 | */ | 35 | */ |
| 44 | #define IS_MODULE(option) config_enabled(option##_MODULE) | 36 | #define IS_MODULE(option) config_enabled(option##_MODULE) |
| 45 | 37 | ||
| 38 | /* | ||
| 39 | * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', | ||
| 40 | * 0 otherwise. | ||
| 41 | */ | ||
| 42 | #define IS_ENABLED(option) \ | ||
| 43 | (IS_BUILTIN(option) || IS_MODULE(option)) | ||
| 44 | |||
| 46 | #endif /* __LINUX_KCONFIG_H */ | 45 | #endif /* __LINUX_KCONFIG_H */ |
| @@ -103,6 +103,18 @@ · 102 unmodified lines | |||
| 103 | (((__x) - ((__d) / 2)) / (__d)); \ | 103 | (((__x) - ((__d) / 2)) / (__d)); \ |
| 104 | } \ | 104 | } \ |
| 105 | ) | 105 | ) |
| 106 | /* | ||
| 107 | * Same as above but for u64 dividends. divisor must be a 32-bit | ||
| 108 | * number. | ||
| 109 | */ | ||
| 110 | #define DIV_ROUND_CLOSEST_ULL(x, divisor)( \ | ||
| 111 | { \ | ||
| 112 | typeof(divisor) __d = divisor; \ | ||
| 113 | unsigned long long _tmp = (x) + (__d) / 2; \ | ||
| 114 | do_div(_tmp, __d); \ | ||
| 115 | _tmp; \ | ||
| 116 | } \ | ||
| 117 | ) | ||
| 106 | 118 | ||
| 107 | /* | 119 | /* |
| 108 | * Multiplies an integer by a fraction, while avoiding unnecessary | 120 | * Multiplies an integer by a fraction, while avoiding unnecessary |
| @@ -105,6 +105,8 @@ enum s2mps_rtc_reg { · 104 unmodified lines | |||
| 105 | #define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT) | 105 | #define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT) |
| 106 | #define S2MPS_RTC_WUDR_SHIFT 4 | 106 | #define S2MPS_RTC_WUDR_SHIFT 4 |
| 107 | #define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) | 107 | #define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) |
| 108 | #define S2MPS13_RTC_AUDR_SHIFT 1 | ||
| 109 | #define S2MPS13_RTC_AUDR_MASK (1 << S2MPS13_RTC_AUDR_SHIFT) | ||
| 108 | #define S2MPS_RTC_RUDR_SHIFT 0 | 110 | #define S2MPS_RTC_RUDR_SHIFT 0 |
| 109 | #define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) | 111 | #define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) |
| 110 | #define RTC_TCON_SHIFT 1 | 112 | #define RTC_TCON_SHIFT 1 |
| @@ -429,7 +429,7 @@ struct mm_struct { · 428 unmodified lines | |||
| 429 | #endif | 429 | #endif |
| 430 | 430 | ||
| 431 | /* store ref to file /proc/<pid>/exe symlink points to */ | 431 | /* store ref to file /proc/<pid>/exe symlink points to */ |
| 432 | struct file *exe_file; | 432 | struct file __rcu *exe_file; |
| 433 | #ifdef CONFIG_MMU_NOTIFIER | 433 | #ifdef CONFIG_MMU_NOTIFIER |
| 434 | struct mmu_notifier_mm *mmu_notifier_mm; | 434 | struct mmu_notifier_mm *mmu_notifier_mm; |
| 435 | #endif | 435 | #endif |
| @@ -212,4 +212,7 @@ static inline void setup_sysctl_set(struct ctl_table_set *p, · 211 unmodified lines | |||
| 212 | 212 | ||
| 213 | #endif /* CONFIG_SYSCTL */ | 213 | #endif /* CONFIG_SYSCTL */ |
| 214 | 214 | ||
| 215 | int sysctl_max_threads(struct ctl_table *table, int write, | ||
| 216 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
| 217 | |||
| 215 | #endif /* _LINUX_SYSCTL_H */ | 218 | #endif /* _LINUX_SYSCTL_H */ |
| @@ -0,0 +1,40 @@ | |||
| 1 | #ifndef _LINUX_HELPER_MACROS_H_ | ||
| 2 | #define _LINUX_HELPER_MACROS_H_ | ||
| 3 | |||
| 4 | #define __find_closest(x, a, as, op) \ | ||
| 5 | ({ \ | ||
| 6 | typeof(as) __fc_i, __fc_as = (as) - 1; \ | ||
| 7 | typeof(x) __fc_x = (x); \ | ||
| 8 | typeof(*a) *__fc_a = (a); \ | ||
| 9 | for (__fc_i = 0; __fc_i < __fc_as; __fc_i++) { \ | ||
| 10 | if (__fc_x op DIV_ROUND_CLOSEST(__fc_a[__fc_i] + \ | ||
| 11 | __fc_a[__fc_i + 1], 2)) \ | ||
| 12 | break; \ | ||
| 13 | } \ | ||
| 14 | (__fc_i); \ | ||
| 15 | }) | ||
| 16 | |||
| 17 | /** | ||
| 18 | * find_closest - locate the closest element in a sorted array | ||
| 19 | * @x: The reference value. | ||
| 20 | * @a: The array in which to look for the closest element. Must be sorted | ||
| 21 | * in ascending order. | ||
| 22 | * @as: Size of 'a'. | ||
| 23 | * | ||
| 24 | * Returns the index of the element closest to 'x'. | ||
| 25 | */ | ||
| 26 | #define find_closest(x, a, as) __find_closest(x, a, as, <=) | ||
| 27 | |||
| 28 | /** | ||
| 29 | * find_closest_descending - locate the closest element in a sorted array | ||
| 30 | * @x: The reference value. | ||
| 31 | * @a: The array in which to look for the closest element. Must be sorted | ||
| 32 | * in descending order. | ||
| 33 | * @as: Size of 'a'. | ||
| 34 | * | ||
| 35 | * Similar to find_closest() but 'a' is expected to be sorted in descending | ||
| 36 | * order. | ||
| 37 | */ | ||
| 38 | #define find_closest_descending(x, a, as) __find_closest(x, a, as, >=) | ||
| 39 | |||
| 40 | #endif | ||
| @@ -6,7 +6,16 @@ · 5 unmodified lines | |||
| 6 | #define EDEADLK 35 /* Resource deadlock would occur */ | 6 | #define EDEADLK 35 /* Resource deadlock would occur */ |
| 7 | #define ENAMETOOLONG 36 /* File name too long */ | 7 | #define ENAMETOOLONG 36 /* File name too long */ |
| 8 | #define ENOLCK 37 /* No record locks available */ | 8 | #define ENOLCK 37 /* No record locks available */ |
| 9 | #define ENOSYS 38 /* Function not implemented */ | 9 | |
| 10 | /* | ||
| 11 | * This error code is special: arch syscall entry code will return | ||
| 12 | * -ENOSYS if users try to call a syscall that doesn't exist. To keep | ||
| 13 | * failures of syscalls that really do exist distinguishable from | ||
| 14 | * failures due to attempts to use a nonexistent syscall, syscall | ||
| 15 | * implementations should refrain from returning -ENOSYS. | ||
| 16 | */ | ||
| 17 | #define ENOSYS 38 /* Invalid system call number */ | ||
| 18 | |||
| 10 | #define ENOTEMPTY 39 /* Directory not empty */ | 19 | #define ENOTEMPTY 39 /* Directory not empty */ |
| 11 | #define ELOOP 40 /* Too many symbolic links encountered */ | 20 | #define ELOOP 40 /* Too many symbolic links encountered */ |
| 12 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | 21 | #define EWOULDBLOCK EAGAIN /* Operation would block */ |