diff options
author | Andrey Markovytch <andreym@codeaurora.org> | 2015-06-08 11:29:36 +0300 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:24:03 -0700 |
commit | ecc052ba4efd2ee81fac2a35047bbd34a0344aca (patch) | |
tree | 8bf695f7e58b2bf44d03e82600a2b7bf31cb49d5 /include/linux | |
parent | a56866b4eb9939e5e82d56eef4f172c069768712 (diff) |
platform: msm: add Per-File-Tagger (PFT) driver
Integrated from msm-3.14. Additional fixes were made to compile with the
new kernel and various new warnings and checkpatch issues were fixed
Change-Id: I073db1041e41eac9066e37ee099f1da9e4eed6c0
Signed-off-by: Andrey Markovytch <andreym@codeaurora.org>
[gbroner@codeaurora.org: fixed merge conflict and adapted the LSM
security hooks]
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/blk_types.h | 7 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | include/linux/lsm_hooks.h | 7 | ||||
-rw-r--r-- | include/linux/pft.h | 96 | ||||
-rw-r--r-- | include/linux/security.h | 21 |
5 files changed, 133 insertions, 0 deletions
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index d32400f5402b..e897f4d3810c 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -88,6 +88,13 @@ struct bio { unsigned short bi_vcnt; /* how many bio_vec's */ /* + * When using dircet-io (O_DIRECT), we can't get the inode from a bio + * by walking bio->bi_io_vec->bv_page->mapping->host + * since the page is anon. + */ + struct inode *bi_dio_inode; + + /* * Everything starting with bi_max_vecs will be preserved by bio_reset() */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 605454ccaa0e..522b582e61c7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2734,6 +2734,8 @@ static inline void inode_dio_end(struct inode *inode) wake_up_bit(&inode->i_state, __I_DIO_WAKEUP); } +struct inode *dio_bio_get_inode(struct bio *bio); + extern void inode_set_flags(struct inode *inode, unsigned int flags, unsigned int mask); diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index ec3a6bab29de..1919b06f28f4 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -1384,6 +1384,8 @@ union security_list_options { size_t *len); int (*inode_create)(struct inode *dir, struct dentry *dentry, umode_t mode); + int (*inode_post_create)(struct inode *dir, struct dentry *dentry, + umode_t mode); int (*inode_link)(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry); int (*inode_unlink)(struct inode *dir, struct dentry *dentry); @@ -1440,6 +1442,8 @@ union security_list_options { struct fown_struct *fown, int sig); int (*file_receive)(struct file *file); int (*file_open)(struct file *file, const struct cred *cred); + int (*file_close)(struct file *file); + bool (*allow_merge_bio)(struct bio *bio1, struct bio *bio2); int (*task_create)(unsigned long clone_flags); void (*task_free)(struct task_struct *task); @@ -1666,6 +1670,7 @@ struct security_hook_heads { struct list_head inode_free_security; struct list_head inode_init_security; struct list_head inode_create; + struct list_head inode_post_create; struct list_head inode_link; struct list_head inode_unlink; struct list_head inode_symlink; @@ -1702,6 +1707,8 @@ struct security_hook_heads { struct list_head file_send_sigiotask; struct list_head file_receive; struct list_head file_open; + struct list_head file_close; + struct list_head allow_merge_bio; struct list_head task_create; struct list_head task_free; struct list_head cred_alloc_blank; diff --git a/include/linux/pft.h b/include/linux/pft.h new file mode 100644 index 000000000000..f2173b89a2a0 --- /dev/null +++ b/include/linux/pft.h @@ -0,0 +1,96 @@ +/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef PFT_H_ +#define PFT_H_ + +#include <linux/types.h> +#include <linux/fs.h> +#include <linux/bio.h> + +#ifdef CONFIG_PFT + +/* dm-req-crypt API */ +int pft_get_key_index(struct bio *bio, u32 *key_index, + bool *is_encrypted, bool *is_inplace); + +/* block layer API */ +bool pft_allow_merge_bio(struct bio *bio1, struct bio *bio2); + +/* --- security hooks , called from selinux --- */ +int pft_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode); + +int pft_inode_post_create(struct inode *dir, struct dentry *dentry, + umode_t mode); + +int pft_file_open(struct file *filp, const struct cred *cred); + +int pft_file_permission(struct file *file, int mask); + +int pft_file_close(struct file *filp); + +int pft_inode_unlink(struct inode *dir, struct dentry *dentry); + +int pft_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, + dev_t dev); + +int pft_inode_rename(struct inode *inode, struct dentry *dentry, + struct inode *new_inode, struct dentry *new_dentry); + +int pft_inode_set_xattr(struct dentry *dentry, const char *name, + const void *value, size_t size, int flags); + + +#else +static inline int pft_get_key_index(struct bio *bio, u32 *key_index, + bool *is_encrypted, bool *is_inplace) +{ return -ENODEV; } + +static inline bool pft_allow_merge_bio(struct bio *bio1, struct bio *bio2) +{ return true; } + +static inline int pft_file_permission(struct file *file, int mask) +{ return 0; } + +static inline int pft_inode_create( + struct inode *dir, struct dentry *dentry, umode_t mode) +{ return 0; } + +static inline int pft_inode_post_create( + struct inode *dir, struct dentry *dentry, umode_t mode) +{ return 0; } + +static inline int pft_file_open(struct file *filp, const struct cred *cred) +{ return 0; } + +static inline int pft_file_close(struct file *filp) +{ return 0; } + +static inline int pft_inode_unlink(struct inode *dir, struct dentry *dentry) +{ return 0; } + +static inline int pft_inode_mknod(struct inode *dir, struct dentry *dentry, + umode_t mode, dev_t dev) +{ return 0; } + +static inline int pft_inode_rename(struct inode *inode, struct dentry *dentry, + struct inode *new_inode, struct dentry *new_dentry) +{ return 0; } + +static inline int pft_inode_set_xattr(struct dentry *dentry, const char *name, + const void *value, size_t size, + int flags) +{ return 0; } + +#endif /* CONFIG_PFT */ + +#endif /* PFT_H */ diff --git a/include/linux/security.h b/include/linux/security.h index 2f4c1f7aa7db..3de0302aecf2 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -28,6 +28,7 @@ #include <linux/err.h> #include <linux/string.h> #include <linux/mm.h> +#include <linux/bio.h> struct linux_binprm; struct cred; @@ -244,6 +245,7 @@ int security_old_inode_init_security(struct inode *inode, struct inode *dir, const struct qstr *qstr, const char **name, void **value, size_t *len); int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode); +int security_inode_post_create(struct inode *dir, struct dentry *dentry, umode_t mode); int security_inode_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry); int security_inode_unlink(struct inode *dir, struct dentry *dentry); @@ -290,6 +292,8 @@ int security_file_send_sigiotask(struct task_struct *tsk, struct fown_struct *fown, int sig); int security_file_receive(struct file *file); int security_file_open(struct file *file, const struct cred *cred); +int security_file_close(struct file *file); +bool security_allow_merge_bio(struct bio *bio1, struct bio *bio2); int security_task_create(unsigned long clone_flags); void security_task_free(struct task_struct *task); int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); @@ -605,6 +609,13 @@ static inline int security_inode_create(struct inode *dir, return 0; } +static inline int security_inode_post_create(struct inode *dir, + struct dentry *dentry, + umode_t mode) +{ + return 0; +} + static inline int security_inode_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry) @@ -810,6 +821,16 @@ static inline int security_file_open(struct file *file, return 0; } +static inline int security_file_close(struct file *file) +{ + return 0; +} + +static inline int security_allow_merge_bio(struct bio *bio1, struct bio *bio2) +{ + return true; +} + static inline int security_task_create(unsigned long clone_flags) { return 0; |