diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-19 10:55:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-19 10:55:08 -0500 |
commit | 7a684c452e2589f3ddd7e2d466b4f747d3715ad9 (patch) | |
tree | fed803e7450770993575b37807ba2195eafd5b0e /include/linux | |
parent | 7f2de8171ddf28fdb2ca7f9a683ee1207849f718 (diff) | |
parent | e10e1774efbdaec54698454200619a03a01e1d64 (diff) |
Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull module update from Rusty Russell:
"Nothing all that exciting; a new module-from-fd syscall for those who
want to verify the source of the module (ChromeOS) and/or use standard
IMA on it or other security hooks."
* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
MODSIGN: Fix kbuild output when using default extra_certificates
MODSIGN: Avoid using .incbin in C source
modules: don't hand 0 to vmalloc.
module: Remove a extra null character at the top of module->strtab.
ASN.1: Use the ASN1_LONG_TAG and ASN1_INDEFINITE_LENGTH constants
ASN.1: Define indefinite length marker constant
moduleparam: use __UNIQUE_ID()
__UNIQUE_ID()
MODSIGN: Add modules_sign make target
powerpc: add finit_module syscall.
ima: support new kernel module syscall
add finit_module syscall to asm-generic
ARM: add finit_module syscall to ARM
security: introduce kernel_module_from_file hook
module: add flags arg to sys_finit_module()
module: add syscall to load module from fd
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/asn1.h | 2 | ||||
-rw-r--r-- | include/linux/compiler-gcc4.h | 2 | ||||
-rw-r--r-- | include/linux/compiler.h | 9 | ||||
-rw-r--r-- | include/linux/ima.h | 6 | ||||
-rw-r--r-- | include/linux/moduleparam.h | 6 | ||||
-rw-r--r-- | include/linux/security.h | 13 | ||||
-rw-r--r-- | include/linux/syscalls.h | 1 |
7 files changed, 35 insertions, 4 deletions
diff --git a/include/linux/asn1.h b/include/linux/asn1.h index 5c3f4e4b9a23..eed6982860ba 100644 --- a/include/linux/asn1.h +++ b/include/linux/asn1.h | |||
@@ -64,4 +64,6 @@ enum asn1_tag { | |||
64 | ASN1_LONG_TAG = 31 /* Long form tag */ | 64 | ASN1_LONG_TAG = 31 /* Long form tag */ |
65 | }; | 65 | }; |
66 | 66 | ||
67 | #define ASN1_INDEFINITE_LENGTH 0x80 | ||
68 | |||
67 | #endif /* _LINUX_ASN1_H */ | 69 | #endif /* _LINUX_ASN1_H */ |
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index dc16a858e77c..662fd1b4c42a 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h | |||
@@ -31,6 +31,8 @@ | |||
31 | 31 | ||
32 | #define __linktime_error(message) __attribute__((__error__(message))) | 32 | #define __linktime_error(message) __attribute__((__error__(message))) |
33 | 33 | ||
34 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) | ||
35 | |||
34 | #if __GNUC_MINOR__ >= 5 | 36 | #if __GNUC_MINOR__ >= 5 |
35 | /* | 37 | /* |
36 | * Mark a position in code as unreachable. This can be used to | 38 | * Mark a position in code as unreachable. This can be used to |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index b121554f1fe2..dd852b73b286 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -44,6 +44,10 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
44 | # define __rcu | 44 | # define __rcu |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ | ||
48 | #define ___PASTE(a,b) a##b | ||
49 | #define __PASTE(a,b) ___PASTE(a,b) | ||
50 | |||
47 | #ifdef __KERNEL__ | 51 | #ifdef __KERNEL__ |
48 | 52 | ||
49 | #ifdef __GNUC__ | 53 | #ifdef __GNUC__ |
@@ -166,6 +170,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
166 | (typeof(ptr)) (__ptr + (off)); }) | 170 | (typeof(ptr)) (__ptr + (off)); }) |
167 | #endif | 171 | #endif |
168 | 172 | ||
173 | /* Not-quite-unique ID. */ | ||
174 | #ifndef __UNIQUE_ID | ||
175 | # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) | ||
176 | #endif | ||
177 | |||
169 | #endif /* __KERNEL__ */ | 178 | #endif /* __KERNEL__ */ |
170 | 179 | ||
171 | #endif /* __ASSEMBLY__ */ | 180 | #endif /* __ASSEMBLY__ */ |
diff --git a/include/linux/ima.h b/include/linux/ima.h index 2c7223d7e73b..86c361e947b9 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h | |||
@@ -18,6 +18,7 @@ extern int ima_bprm_check(struct linux_binprm *bprm); | |||
18 | extern int ima_file_check(struct file *file, int mask); | 18 | extern int ima_file_check(struct file *file, int mask); |
19 | extern void ima_file_free(struct file *file); | 19 | extern void ima_file_free(struct file *file); |
20 | extern int ima_file_mmap(struct file *file, unsigned long prot); | 20 | extern int ima_file_mmap(struct file *file, unsigned long prot); |
21 | extern int ima_module_check(struct file *file); | ||
21 | 22 | ||
22 | #else | 23 | #else |
23 | static inline int ima_bprm_check(struct linux_binprm *bprm) | 24 | static inline int ima_bprm_check(struct linux_binprm *bprm) |
@@ -40,6 +41,11 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot) | |||
40 | return 0; | 41 | return 0; |
41 | } | 42 | } |
42 | 43 | ||
44 | static inline int ima_module_check(struct file *file) | ||
45 | { | ||
46 | return 0; | ||
47 | } | ||
48 | |||
43 | #endif /* CONFIG_IMA_H */ | 49 | #endif /* CONFIG_IMA_H */ |
44 | 50 | ||
45 | #ifdef CONFIG_IMA_APPRAISE | 51 | #ifdef CONFIG_IMA_APPRAISE |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index d6a58065c09c..137b4198fc03 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -16,17 +16,15 @@ | |||
16 | /* Chosen so that structs with an unsigned long line up. */ | 16 | /* Chosen so that structs with an unsigned long line up. */ |
17 | #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) | 17 | #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) |
18 | 18 | ||
19 | #define ___module_cat(a,b) __mod_ ## a ## b | ||
20 | #define __module_cat(a,b) ___module_cat(a,b) | ||
21 | #ifdef MODULE | 19 | #ifdef MODULE |
22 | #define __MODULE_INFO(tag, name, info) \ | 20 | #define __MODULE_INFO(tag, name, info) \ |
23 | static const char __module_cat(name,__LINE__)[] \ | 21 | static const char __UNIQUE_ID(name)[] \ |
24 | __used __attribute__((section(".modinfo"), unused, aligned(1))) \ | 22 | __used __attribute__((section(".modinfo"), unused, aligned(1))) \ |
25 | = __stringify(tag) "=" info | 23 | = __stringify(tag) "=" info |
26 | #else /* !MODULE */ | 24 | #else /* !MODULE */ |
27 | /* This struct is here for syntactic coherency, it is not used */ | 25 | /* This struct is here for syntactic coherency, it is not used */ |
28 | #define __MODULE_INFO(tag, name, info) \ | 26 | #define __MODULE_INFO(tag, name, info) \ |
29 | struct __module_cat(name,__LINE__) {} | 27 | struct __UNIQUE_ID(name) {} |
30 | #endif | 28 | #endif |
31 | #define __MODULE_PARM_TYPE(name, _type) \ | 29 | #define __MODULE_PARM_TYPE(name, _type) \ |
32 | __MODULE_INFO(parmtype, name##type, #name ":" _type) | 30 | __MODULE_INFO(parmtype, name##type, #name ":" _type) |
diff --git a/include/linux/security.h b/include/linux/security.h index 05e88bdcf7d9..0f6afc657f77 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -694,6 +694,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
694 | * userspace to load a kernel module with the given name. | 694 | * userspace to load a kernel module with the given name. |
695 | * @kmod_name name of the module requested by the kernel | 695 | * @kmod_name name of the module requested by the kernel |
696 | * Return 0 if successful. | 696 | * Return 0 if successful. |
697 | * @kernel_module_from_file: | ||
698 | * Load a kernel module from userspace. | ||
699 | * @file contains the file structure pointing to the file containing | ||
700 | * the kernel module to load. If the module is being loaded from a blob, | ||
701 | * this argument will be NULL. | ||
702 | * Return 0 if permission is granted. | ||
697 | * @task_fix_setuid: | 703 | * @task_fix_setuid: |
698 | * Update the module's state after setting one or more of the user | 704 | * Update the module's state after setting one or more of the user |
699 | * identity attributes of the current process. The @flags parameter | 705 | * identity attributes of the current process. The @flags parameter |
@@ -1508,6 +1514,7 @@ struct security_operations { | |||
1508 | int (*kernel_act_as)(struct cred *new, u32 secid); | 1514 | int (*kernel_act_as)(struct cred *new, u32 secid); |
1509 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); | 1515 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); |
1510 | int (*kernel_module_request)(char *kmod_name); | 1516 | int (*kernel_module_request)(char *kmod_name); |
1517 | int (*kernel_module_from_file)(struct file *file); | ||
1511 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, | 1518 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, |
1512 | int flags); | 1519 | int flags); |
1513 | int (*task_setpgid) (struct task_struct *p, pid_t pgid); | 1520 | int (*task_setpgid) (struct task_struct *p, pid_t pgid); |
@@ -1765,6 +1772,7 @@ void security_transfer_creds(struct cred *new, const struct cred *old); | |||
1765 | int security_kernel_act_as(struct cred *new, u32 secid); | 1772 | int security_kernel_act_as(struct cred *new, u32 secid); |
1766 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); | 1773 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); |
1767 | int security_kernel_module_request(char *kmod_name); | 1774 | int security_kernel_module_request(char *kmod_name); |
1775 | int security_kernel_module_from_file(struct file *file); | ||
1768 | int security_task_fix_setuid(struct cred *new, const struct cred *old, | 1776 | int security_task_fix_setuid(struct cred *new, const struct cred *old, |
1769 | int flags); | 1777 | int flags); |
1770 | int security_task_setpgid(struct task_struct *p, pid_t pgid); | 1778 | int security_task_setpgid(struct task_struct *p, pid_t pgid); |
@@ -2278,6 +2286,11 @@ static inline int security_kernel_module_request(char *kmod_name) | |||
2278 | return 0; | 2286 | return 0; |
2279 | } | 2287 | } |
2280 | 2288 | ||
2289 | static inline int security_kernel_module_from_file(struct file *file) | ||
2290 | { | ||
2291 | return 0; | ||
2292 | } | ||
2293 | |||
2281 | static inline int security_task_fix_setuid(struct cred *new, | 2294 | static inline int security_task_fix_setuid(struct cred *new, |
2282 | const struct cred *old, | 2295 | const struct cred *old, |
2283 | int flags) | 2296 | int flags) |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 36c3b07c5119..6caee34bf8a2 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -880,4 +880,5 @@ asmlinkage long sys_process_vm_writev(pid_t pid, | |||
880 | 880 | ||
881 | asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, | 881 | asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, |
882 | unsigned long idx1, unsigned long idx2); | 882 | unsigned long idx1, unsigned long idx2); |
883 | asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags); | ||
883 | #endif | 884 | #endif |