mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem update from James Morris: "Just some minor updates across the subsystem" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: ima: eliminate passing d_name.name to process_measurement() TPM: Retry SaveState command in suspend path tpm/tpm_i2c_infineon: Add small comment about return value of __i2c_transfer tpm/tpm_i2c_infineon.c: Add OF attributes type and name to the of_device_id table entries tpm_i2c_stm_st33: Remove duplicate inclusion of header files tpm: Add support for new Infineon I2C TPM (SLB 9645 TT 1.2 I2C) char/tpm: Convert struct i2c_msg initialization to C99 format drivers/char/tpm/tpm_ppi: use strlcpy instead of strncpy tpm/tpm_i2c_stm_st33: formatting and white space changes Smack: include magic.h in smackfs.c selinux: make security_sb_clone_mnt_opts return an error on context mismatch seccomp: allow BPF_XOR based ALU instructions. Fix NULL pointer dereference in smack_inode_unlink() and smack_inode_rmdir() Smack: add support for modification of existing rules smack: SMACK_MAGIC to include/uapi/linux/magic.h Smack: add missing support for transmute bit in smack_str_from_perm() Smack: prevent revoke-subject from failing when unseen label is written to it tomoyo: use DEFINE_SRCU() to define tomoyo_ss tomoyo: use DEFINE_SRCU() to define tomoyo_ss
This commit is contained in:
commit
2e1deaad1e
20 changed files with 450 additions and 201 deletions
|
|
@ -751,7 +751,37 @@ out_double_mount:
|
|||
goto out;
|
||||
}
|
||||
|
||||
static void selinux_sb_clone_mnt_opts(const struct super_block *oldsb,
|
||||
static int selinux_cmp_sb_context(const struct super_block *oldsb,
|
||||
const struct super_block *newsb)
|
||||
{
|
||||
struct superblock_security_struct *old = oldsb->s_security;
|
||||
struct superblock_security_struct *new = newsb->s_security;
|
||||
char oldflags = old->flags & SE_MNTMASK;
|
||||
char newflags = new->flags & SE_MNTMASK;
|
||||
|
||||
if (oldflags != newflags)
|
||||
goto mismatch;
|
||||
if ((oldflags & FSCONTEXT_MNT) && old->sid != new->sid)
|
||||
goto mismatch;
|
||||
if ((oldflags & CONTEXT_MNT) && old->mntpoint_sid != new->mntpoint_sid)
|
||||
goto mismatch;
|
||||
if ((oldflags & DEFCONTEXT_MNT) && old->def_sid != new->def_sid)
|
||||
goto mismatch;
|
||||
if (oldflags & ROOTCONTEXT_MNT) {
|
||||
struct inode_security_struct *oldroot = oldsb->s_root->d_inode->i_security;
|
||||
struct inode_security_struct *newroot = newsb->s_root->d_inode->i_security;
|
||||
if (oldroot->sid != newroot->sid)
|
||||
goto mismatch;
|
||||
}
|
||||
return 0;
|
||||
mismatch:
|
||||
printk(KERN_WARNING "SELinux: mount invalid. Same superblock, "
|
||||
"different security settings for (dev %s, "
|
||||
"type %s)\n", newsb->s_id, newsb->s_type->name);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
static int selinux_sb_clone_mnt_opts(const struct super_block *oldsb,
|
||||
struct super_block *newsb)
|
||||
{
|
||||
const struct superblock_security_struct *oldsbsec = oldsb->s_security;
|
||||
|
|
@ -766,14 +796,14 @@ static void selinux_sb_clone_mnt_opts(const struct super_block *oldsb,
|
|||
* mount options. thus we can safely deal with this superblock later
|
||||
*/
|
||||
if (!ss_initialized)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
/* how can we clone if the old one wasn't set up?? */
|
||||
BUG_ON(!(oldsbsec->flags & SE_SBINITIALIZED));
|
||||
|
||||
/* if fs is reusing a sb, just let its options stand... */
|
||||
/* if fs is reusing a sb, make sure that the contexts match */
|
||||
if (newsbsec->flags & SE_SBINITIALIZED)
|
||||
return;
|
||||
return selinux_cmp_sb_context(oldsb, newsb);
|
||||
|
||||
mutex_lock(&newsbsec->lock);
|
||||
|
||||
|
|
@ -806,6 +836,7 @@ static void selinux_sb_clone_mnt_opts(const struct super_block *oldsb,
|
|||
|
||||
sb_finish_set_opts(newsb);
|
||||
mutex_unlock(&newsbsec->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int selinux_parse_opts_str(char *options,
|
||||
|
|
|
|||
Loading…
Reference in a new issue