linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the security tree with the vfs tree
@ 2014-12-10  2:47 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2014-12-10  2:47 UTC (permalink / raw)
  To: James Morris, Al Viro
  Cc: linux-next, linux-kernel, Dmitry Kasatkin, Mimi Zohar

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

Hi James,

Today's linux-next merge of the security tree got a conflict in
init/main.c between commit 87fb64a6c1f7 ("take the targets
of /proc/*/ns/* symlinks to separate fs") from the vfs tree and commit
c9cd2ce2bc63 ("integrity: provide a hook to load keys when rootfs is
ready") from the security tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc init/main.c
index 40240c8e31e8,9fc795fe4b3b..000000000000
--- a/init/main.c
+++ b/init/main.c
@@@ -78,7 -78,7 +78,8 @@@
  #include <linux/context_tracking.h>
  #include <linux/random.h>
  #include <linux/list.h>
 +#include <linux/proc_ns.h>
+ #include <linux/integrity.h>
  
  #include <asm/io.h>
  #include <asm/bugs.h>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread
* linux-next: manual merge of the security tree with the vfs tree
@ 2015-05-13  4:26 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2015-05-13  4:26 UTC (permalink / raw)
  To: James Morris, Al Viro
  Cc: linux-next, linux-kernel, NeilBrown, Casey Schaufler

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

Hi James,

Today's linux-next merge of the security tree got a conflict in
security/capability.c between commits 37882db0546c ("SECURITY: remove
nameidata arg from inode_follow_link") and bda0be7ad994 ("security:
make inode_follow_link RCU-walk aware") from the vfs tree and commit
1ddd3b4e07a4 ("LSM: Remove unused capability.c") from the security tree.

I fixed it up (the latter removed the file, so I did that) and can
carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread
* linux-next: manual merge of the security tree with the vfs tree
@ 2015-05-13  4:39 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2015-05-13  4:39 UTC (permalink / raw)
  To: James Morris, Al Viro
  Cc: linux-next, linux-kernel, NeilBrown, Casey Schaufler

[-- Attachment #1: Type: text/plain, Size: 3107 bytes --]

Hi James,

Today's linux-next merge of the security tree got a conflict in
include/linux/security.h and security/security.c between commits
37882db0546c ("SECURITY: remove nameidata arg from inode_follow_link")
and bda0be7ad994 ("security: make inode_follow_link RCU-walk aware")
from the vfs tree and commits 3c4ed7bdf599 ("LSM: Split security.h")
and 346033a28fb1 ("LSM: Remove a comment from security.h") from the
security tree.

I fixed it up (see below, plus I added the following merge fix patch)
and can carry the fix as necessary (no action is required).

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 13 May 2015 14:29:17 +1000
Subject: [PATCH] LSM: merge fix for follow_link API changes

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/linux/lsm_hooks.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index f014f2596e22..9429f054c323 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -315,7 +315,8 @@
  * @inode_follow_link:
  *	Check permission to follow a symbolic link when looking up a pathname.
  *	@dentry contains the dentry structure for the link.
- *	@nd contains the nameidata structure for the parent directory.
+ *	@inode contains the inode, which itself is not stable in RCU-walk
+ *	@rcu indicates whether we are in RCU-walk mode.
  *	Return 0 if permission is granted.
  * @inode_permission:
  *	Check permission before accessing an inode.  This hook is called by the
@@ -1397,7 +1398,8 @@ union security_list_options {
 				struct inode *new_dir,
 				struct dentry *new_dentry);
 	int (*inode_readlink)(struct dentry *dentry);
-	int (*inode_follow_link)(struct dentry *dentry, struct nameidata *nd);
+	int (*inode_follow_link)(struct dentry *dentry, struct inode *inode,
+				 bool rcu);
 	int (*inode_permission)(struct inode *inode, int mask);
 	int (*inode_setattr)(struct dentry *dentry, struct iattr *attr);
 	int (*inode_getattr)(const struct path *path);
-- 
2.1.4

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc security/security.c
index 04c8feca081a,bd4c5f6a5b78..000000000000
--- a/security/security.c
+++ b/security/security.c
@@@ -578,15 -586,14 +586,15 @@@ int security_inode_readlink(struct dent
  {
  	if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
  		return 0;
- 	return security_ops->inode_readlink(dentry);
+ 	return call_int_hook(inode_readlink, 0, dentry);
  }
  
 -int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
 +int security_inode_follow_link(struct dentry *dentry, struct inode *inode,
 +			       bool rcu)
  {
 -	if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
 +	if (unlikely(IS_PRIVATE(inode)))
  		return 0;
- 	return security_ops->inode_follow_link(dentry, inode, rcu);
 -	return call_int_hook(inode_follow_link, 0, dentry, nd);
++	return call_int_hook(inode_follow_link, 0, dentry, inode, rcu);
  }
  
  int security_inode_permission(struct inode *inode, int mask)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply related	[flat|nested] 11+ messages in thread
* linux-next: manual merge of the security tree with the vfs tree
@ 2015-12-31  4:24 Stephen Rothwell
  2015-12-31  4:30 ` Al Viro
  2016-01-04  1:37 ` Mimi Zohar
  0 siblings, 2 replies; 11+ messages in thread
From: Stephen Rothwell @ 2015-12-31  4:24 UTC (permalink / raw)
  To: James Morris, Al Viro; +Cc: linux-next, linux-kernel, Petko Manolov, Mimi Zohar

Hi James,

Today's linux-next merge of the security tree got a conflict in:

  security/integrity/ima/ima_fs.c

between commit:

  3bc8f29b149e ("new helper: memdup_user_nul()")

from the vfs tree and commit:

  38d859f991f3 ("IMA: policy can now be updated multiple times")

from the security tree.

I fixed it up (hopefully, see below) and can carry the fix as necessary
(no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc security/integrity/ima/ima_fs.c
index 71aa60b8d257,3caed6de610c..000000000000
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@@ -259,21 -261,35 +261,30 @@@ static const struct file_operations ima
  static ssize_t ima_write_policy(struct file *file, const char __user *buf,
  				size_t datalen, loff_t *ppos)
  {
 -	char *data = NULL;
  	ssize_t result;
- 	char *data;
++	char *data = NULL;
+ 	int res;
+ 
+ 	res = mutex_lock_interruptible(&ima_write_mutex);
+ 	if (res)
+ 		return res;
  
  	if (datalen >= PAGE_SIZE)
  		datalen = PAGE_SIZE - 1;
  
  	/* No partial writes. */
+ 	result = -EINVAL;
  	if (*ppos != 0)
- 		return -EINVAL;
+ 		goto out;
  
 -	result = -ENOMEM;
 -	data = kmalloc(datalen + 1, GFP_KERNEL);
 -	if (!data)
 -		goto out;
 -
 -	*(data + datalen) = '\0';
 -
 -	result = -EFAULT;
 -	if (copy_from_user(data, buf, datalen))
 +	data = memdup_user_nul(buf, datalen);
- 	if (IS_ERR(data))
- 		return PTR_ERR(data);
++	if (IS_ERR(data)) {
++		result = PTR_ERR(data);
+ 		goto out;
++	}
  
  	result = ima_parse_add_rule(data);
+ out:
  	if (result < 0)
  		valid_policy = 0;
  	kfree(data);

^ permalink raw reply	[flat|nested] 11+ messages in thread
* linux-next: manual merge of the security tree with the vfs tree
@ 2019-08-12  4:44 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2019-08-12  4:44 UTC (permalink / raw)
  To: James Morris, Al Viro
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Matthew Garrett, David Howells

[-- Attachment #1: Type: text/plain, Size: 2188 bytes --]

Hi all,

Today's linux-next merge of the security tree got a conflict in:

  fs/tracefs/inode.c

between commit:

  67782f8ae148 ("vfs: Convert tracefs to use the new mount API")

from the vfs tree and commit:

  757ff7244358 ("tracefs: Restrict tracefs when the kernel is locked down")

from the security tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/tracefs/inode.c
index 1387bcd96a79,34da48036e08..000000000000
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@@ -19,8 -17,10 +19,9 @@@
  #include <linux/tracefs.h>
  #include <linux/fsnotify.h>
  #include <linux/seq_file.h>
 -#include <linux/parser.h>
  #include <linux/magic.h>
  #include <linux/slab.h>
+ #include <linux/security.h>
  
  #define TRACEFS_DEFAULT_MODE	0700
  
@@@ -210,12 -239,26 +228,18 @@@ static int tracefs_apply_options(struc
  	return 0;
  }
  
+ static void tracefs_destroy_inode(struct inode *inode)
+ {
+ 	if (S_ISREG(inode->i_mode))
+ 		kfree(inode->i_fop);
+ }
+ 
 -static int tracefs_remount(struct super_block *sb, int *flags, char *data)
 +static int tracefs_reconfigure(struct fs_context *fc)
  {
 -	int err;
 -	struct tracefs_fs_info *fsi = sb->s_fs_info;
 +	struct super_block *sb = fc->root->d_sb;
  
  	sync_filesystem(sb);
 -	err = tracefs_parse_options(data, &fsi->mount_opts);
 -	if (err)
 -		goto fail;
 -
 -	tracefs_apply_options(sb);
 -
 -fail:
 -	return err;
 +	return tracefs_apply_options(sb);
  }
  
  static int tracefs_show_options(struct seq_file *m, struct dentry *root)
@@@ -236,6 -280,8 +260,7 @@@
  
  static const struct super_operations tracefs_super_operations = {
  	.statfs		= simple_statfs,
 -	.remount_fs	= tracefs_remount,
+ 	.destroy_inode  = tracefs_destroy_inode,
  	.show_options	= tracefs_show_options,
  };
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-08-12  4:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10  2:47 linux-next: manual merge of the security tree with the vfs tree Stephen Rothwell
2015-05-13  4:26 Stephen Rothwell
2015-05-13  4:39 Stephen Rothwell
2015-12-31  4:24 Stephen Rothwell
2015-12-31  4:30 ` Al Viro
2015-12-31 10:45   ` Petko Manolov
2016-01-01  4:34     ` Al Viro
2016-01-01 17:29       ` Petko Manolov
2016-01-04  1:37 ` Mimi Zohar
2016-01-04  1:55   ` Stephen Rothwell
2019-08-12  4:44 Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).