aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 14:33:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 14:33:45 -0400
commitbb7aeae3d680c2c777f54274b0270ced0599f33d (patch)
tree4801a103c2b157b5019cf38a19dc67d54bf38453 /include/linux
parent70477371dc350746d10431d74f0f213a8d59924c (diff)
parent88a1b564a20e371e6be41b39b85673e9c1959491 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security layer updates from James Morris: "There are a bunch of fixes to the TPM, IMA, and Keys code, with minor fixes scattered across the subsystem. IMA now requires signed policy, and that policy is also now measured and appraised" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (67 commits) X.509: Make algo identifiers text instead of enum akcipher: Move the RSA DER encoding check to the crypto layer crypto: Add hash param to pkcs1pad sign-file: fix build with CMS support disabled MAINTAINERS: update tpmdd urls MODSIGN: linux/string.h should be #included to get memcpy() certs: Fix misaligned data in extra certificate list X.509: Handle midnight alternative notation in GeneralizedTime X.509: Support leap seconds Handle ISO 8601 leap seconds and encodings of midnight in mktime64() X.509: Fix leap year handling again PKCS#7: fix unitialized boolean 'want' firmware: change kernel read fail to dev_dbg() KEYS: Use the symbol value for list size, updated by scripts/insert-sys-cert KEYS: Reserve an extra certificate symbol for inserting without recompiling modsign: hide openssl output in silent builds tpm_tis: fix build warning with tpm_tis_resume ima: require signed IMA policy ima: measure and appraise the IMA policy itself ima: load policy using path ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fs.h15
-rw-r--r--include/linux/ima.h10
-rw-r--r--include/linux/key.h1
-rw-r--r--include/linux/lsm_hooks.h35
-rw-r--r--include/linux/security.h16
5 files changed, 51 insertions, 26 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index ae681002100a..e514f76db04f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2576,7 +2576,22 @@ static inline void i_readcount_inc(struct inode *inode)
2576#endif 2576#endif
2577extern int do_pipe_flags(int *, int); 2577extern int do_pipe_flags(int *, int);
2578 2578
2579enum kernel_read_file_id {
2580 READING_FIRMWARE = 1,
2581 READING_MODULE,
2582 READING_KEXEC_IMAGE,
2583 READING_KEXEC_INITRAMFS,
2584 READING_POLICY,
2585 READING_MAX_ID
2586};
2587
2579extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2588extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2589extern int kernel_read_file(struct file *, void **, loff_t *, loff_t,
2590 enum kernel_read_file_id);
2591extern int kernel_read_file_from_path(char *, void **, loff_t *, loff_t,
2592 enum kernel_read_file_id);
2593extern int kernel_read_file_from_fd(int, void **, loff_t *, loff_t,
2594 enum kernel_read_file_id);
2580extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t); 2595extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t);
2581extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *); 2596extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
2582extern struct file * open_exec(const char *); 2597extern struct file * open_exec(const char *);
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 120ccc53fcb7..e6516cbbe9bf 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -18,8 +18,9 @@ extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_file_check(struct file *file, int mask, int opened); 18extern int ima_file_check(struct file *file, int mask, int opened);
19extern void ima_file_free(struct file *file); 19extern void ima_file_free(struct file *file);
20extern int ima_file_mmap(struct file *file, unsigned long prot); 20extern int ima_file_mmap(struct file *file, unsigned long prot);
21extern int ima_module_check(struct file *file); 21extern int ima_read_file(struct file *file, enum kernel_read_file_id id);
22extern int ima_fw_from_file(struct file *file, char *buf, size_t size); 22extern int ima_post_read_file(struct file *file, void *buf, loff_t size,
23 enum kernel_read_file_id id);
23 24
24#else 25#else
25static inline int ima_bprm_check(struct linux_binprm *bprm) 26static inline int ima_bprm_check(struct linux_binprm *bprm)
@@ -42,12 +43,13 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
42 return 0; 43 return 0;
43} 44}
44 45
45static inline int ima_module_check(struct file *file) 46static inline int ima_read_file(struct file *file, enum kernel_read_file_id id)
46{ 47{
47 return 0; 48 return 0;
48} 49}
49 50
50static inline int ima_fw_from_file(struct file *file, char *buf, size_t size) 51static inline int ima_post_read_file(struct file *file, void *buf, loff_t size,
52 enum kernel_read_file_id id)
51{ 53{
52 return 0; 54 return 0;
53} 55}
diff --git a/include/linux/key.h b/include/linux/key.h
index 7321ab8ef949..5f5b1129dc92 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -219,6 +219,7 @@ extern struct key *key_alloc(struct key_type *type,
219#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */ 219#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */
220#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */ 220#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
221#define KEY_ALLOC_TRUSTED 0x0004 /* Key should be flagged as trusted */ 221#define KEY_ALLOC_TRUSTED 0x0004 /* Key should be flagged as trusted */
222#define KEY_ALLOC_BUILT_IN 0x0008 /* Key is built into kernel */
222 223
223extern void key_revoke(struct key *key); 224extern void key_revoke(struct key *key);
224extern void key_invalidate(struct key *key); 225extern void key_invalidate(struct key *key);
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 71969de4058c..cdee11cbcdf1 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -541,25 +541,24 @@
541 * @inode points to the inode to use as a reference. 541 * @inode points to the inode to use as a reference.
542 * The current task must be the one that nominated @inode. 542 * The current task must be the one that nominated @inode.
543 * Return 0 if successful. 543 * Return 0 if successful.
544 * @kernel_fw_from_file:
545 * Load firmware from userspace (not called for built-in firmware).
546 * @file contains the file structure pointing to the file containing
547 * the firmware to load. This argument will be NULL if the firmware
548 * was loaded via the uevent-triggered blob-based interface exposed
549 * by CONFIG_FW_LOADER_USER_HELPER.
550 * @buf pointer to buffer containing firmware contents.
551 * @size length of the firmware contents.
552 * Return 0 if permission is granted.
553 * @kernel_module_request: 544 * @kernel_module_request:
554 * Ability to trigger the kernel to automatically upcall to userspace for 545 * Ability to trigger the kernel to automatically upcall to userspace for
555 * userspace to load a kernel module with the given name. 546 * userspace to load a kernel module with the given name.
556 * @kmod_name name of the module requested by the kernel 547 * @kmod_name name of the module requested by the kernel
557 * Return 0 if successful. 548 * Return 0 if successful.
558 * @kernel_module_from_file: 549 * @kernel_read_file:
559 * Load a kernel module from userspace. 550 * Read a file specified by userspace.
560 * @file contains the file structure pointing to the file containing 551 * @file contains the file structure pointing to the file being read
561 * the kernel module to load. If the module is being loaded from a blob, 552 * by the kernel.
562 * this argument will be NULL. 553 * @id kernel read file identifier
554 * Return 0 if permission is granted.
555 * @kernel_post_read_file:
556 * Read a file specified by userspace.
557 * @file contains the file structure pointing to the file being read
558 * by the kernel.
559 * @buf pointer to buffer containing the file contents.
560 * @size length of the file contents.
561 * @id kernel read file identifier
563 * Return 0 if permission is granted. 562 * Return 0 if permission is granted.
564 * @task_fix_setuid: 563 * @task_fix_setuid:
565 * Update the module's state after setting one or more of the user 564 * Update the module's state after setting one or more of the user
@@ -1454,9 +1453,11 @@ union security_list_options {
1454 void (*cred_transfer)(struct cred *new, const struct cred *old); 1453 void (*cred_transfer)(struct cred *new, const struct cred *old);
1455 int (*kernel_act_as)(struct cred *new, u32 secid); 1454 int (*kernel_act_as)(struct cred *new, u32 secid);
1456 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1455 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1457 int (*kernel_fw_from_file)(struct file *file, char *buf, size_t size);
1458 int (*kernel_module_request)(char *kmod_name); 1456 int (*kernel_module_request)(char *kmod_name);
1459 int (*kernel_module_from_file)(struct file *file); 1457 int (*kernel_module_from_file)(struct file *file);
1458 int (*kernel_read_file)(struct file *file, enum kernel_read_file_id id);
1459 int (*kernel_post_read_file)(struct file *file, char *buf, loff_t size,
1460 enum kernel_read_file_id id);
1460 int (*task_fix_setuid)(struct cred *new, const struct cred *old, 1461 int (*task_fix_setuid)(struct cred *new, const struct cred *old,
1461 int flags); 1462 int flags);
1462 int (*task_setpgid)(struct task_struct *p, pid_t pgid); 1463 int (*task_setpgid)(struct task_struct *p, pid_t pgid);
@@ -1715,9 +1716,9 @@ struct security_hook_heads {
1715 struct list_head cred_transfer; 1716 struct list_head cred_transfer;
1716 struct list_head kernel_act_as; 1717 struct list_head kernel_act_as;
1717 struct list_head kernel_create_files_as; 1718 struct list_head kernel_create_files_as;
1718 struct list_head kernel_fw_from_file; 1719 struct list_head kernel_read_file;
1720 struct list_head kernel_post_read_file;
1719 struct list_head kernel_module_request; 1721 struct list_head kernel_module_request;
1720 struct list_head kernel_module_from_file;
1721 struct list_head task_fix_setuid; 1722 struct list_head task_fix_setuid;
1722 struct list_head task_setpgid; 1723 struct list_head task_setpgid;
1723 struct list_head task_getpgid; 1724 struct list_head task_getpgid;
diff --git a/include/linux/security.h b/include/linux/security.h
index 4824a4ccaf1c..157f0cb1e4d2 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -24,10 +24,12 @@
24 24
25#include <linux/key.h> 25#include <linux/key.h>
26#include <linux/capability.h> 26#include <linux/capability.h>
27#include <linux/fs.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28#include <linux/err.h> 29#include <linux/err.h>
29#include <linux/string.h> 30#include <linux/string.h>
30#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/fs.h>
31 33
32struct linux_binprm; 34struct linux_binprm;
33struct cred; 35struct cred;
@@ -298,9 +300,11 @@ int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
298void security_transfer_creds(struct cred *new, const struct cred *old); 300void security_transfer_creds(struct cred *new, const struct cred *old);
299int security_kernel_act_as(struct cred *new, u32 secid); 301int security_kernel_act_as(struct cred *new, u32 secid);
300int security_kernel_create_files_as(struct cred *new, struct inode *inode); 302int security_kernel_create_files_as(struct cred *new, struct inode *inode);
301int security_kernel_fw_from_file(struct file *file, char *buf, size_t size);
302int security_kernel_module_request(char *kmod_name); 303int security_kernel_module_request(char *kmod_name);
303int security_kernel_module_from_file(struct file *file); 304int security_kernel_module_from_file(struct file *file);
305int security_kernel_read_file(struct file *file, enum kernel_read_file_id id);
306int security_kernel_post_read_file(struct file *file, char *buf, loff_t size,
307 enum kernel_read_file_id id);
304int security_task_fix_setuid(struct cred *new, const struct cred *old, 308int security_task_fix_setuid(struct cred *new, const struct cred *old,
305 int flags); 309 int flags);
306int security_task_setpgid(struct task_struct *p, pid_t pgid); 310int security_task_setpgid(struct task_struct *p, pid_t pgid);
@@ -850,18 +854,20 @@ static inline int security_kernel_create_files_as(struct cred *cred,
850 return 0; 854 return 0;
851} 855}
852 856
853static inline int security_kernel_fw_from_file(struct file *file, 857static inline int security_kernel_module_request(char *kmod_name)
854 char *buf, size_t size)
855{ 858{
856 return 0; 859 return 0;
857} 860}
858 861
859static inline int security_kernel_module_request(char *kmod_name) 862static inline int security_kernel_read_file(struct file *file,
863 enum kernel_read_file_id id)
860{ 864{
861 return 0; 865 return 0;
862} 866}
863 867
864static inline int security_kernel_module_from_file(struct file *file) 868static inline int security_kernel_post_read_file(struct file *file,
869 char *buf, loff_t size,
870 enum kernel_read_file_id id)
865{ 871{
866 return 0; 872 return 0;
867} 873}