linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the apparmor tree with Linus' tree
@ 2019-04-11  2:24 Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2019-04-11  2:24 UTC (permalink / raw)
  To: John Johansen
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Kees Cook,
	Chris Coulson

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

Hi all,

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

  security/apparmor/lsm.c

between commit:

  e33c1b992377 ("apparmor: Restore Y/N in /sys for apparmor's "enabled"")

from Linus' tree and commit:

  876dd866c084 ("apparmor: Initial implementation of raw policy blob compression")

from the apparmor 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 security/apparmor/lsm.c
index 87500bde5a92,e1e9c3c01cd3..000000000000
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@@ -25,8 -25,8 +25,9 @@@
  #include <linux/user_namespace.h>
  #include <linux/netfilter_ipv4.h>
  #include <linux/netfilter_ipv6.h>
+ #include <linux/zlib.h>
  #include <net/sock.h>
 +#include <uapi/linux/mount.h>
  
  #include "include/apparmor.h"
  #include "include/apparmorfs.h"
@@@ -1420,46 -1424,37 +1436,77 @@@ static int param_get_aauint(char *buffe
  	return param_get_uint(buffer, kp);
  }
  
 +/* Can only be set before AppArmor is initialized (i.e. on boot cmdline). */
 +static int param_set_aaintbool(const char *val, const struct kernel_param *kp)
 +{
 +	struct kernel_param kp_local;
 +	bool value;
 +	int error;
 +
 +	if (apparmor_initialized)
 +		return -EPERM;
 +
 +	/* Create local copy, with arg pointing to bool type. */
 +	value = !!*((int *)kp->arg);
 +	memcpy(&kp_local, kp, sizeof(kp_local));
 +	kp_local.arg = &value;
 +
 +	error = param_set_bool(val, &kp_local);
 +	if (!error)
 +		*((int *)kp->arg) = *((bool *)kp_local.arg);
 +	return error;
 +}
 +
 +/*
 + * To avoid changing /sys/module/apparmor/parameters/enabled from Y/N to
 + * 1/0, this converts the "int that is actually bool" back to bool for
 + * display in the /sys filesystem, while keeping it "int" for the LSM
 + * infrastructure.
 + */
 +static int param_get_aaintbool(char *buffer, const struct kernel_param *kp)
 +{
 +	struct kernel_param kp_local;
 +	bool value;
 +
 +	/* Create local copy, with arg pointing to bool type. */
 +	value = !!*((int *)kp->arg);
 +	memcpy(&kp_local, kp, sizeof(kp_local));
 +	kp_local.arg = &value;
 +
 +	return param_get_bool(buffer, &kp_local);
 +}
 +
+ static int param_set_aacompressionlevel(const char *val,
+ 					const struct kernel_param *kp)
+ {
+ 	int error;
+ 
+ 	if (!apparmor_enabled)
+ 		return -EINVAL;
+ 	if (apparmor_initialized)
+ 		return -EPERM;
+ 
+ 	error = param_set_int(val, kp);
+ 
+ 	aa_g_rawdata_compression_level = clamp(aa_g_rawdata_compression_level,
+ 					       Z_NO_COMPRESSION,
+ 					       Z_BEST_COMPRESSION);
+ 	pr_info("AppArmor: policy rawdata compression level set to %u\n",
+ 		aa_g_rawdata_compression_level);
+ 
+ 	return error;
+ }
+ 
+ static int param_get_aacompressionlevel(char *buffer,
+ 					const struct kernel_param *kp)
+ {
+ 	if (!apparmor_enabled)
+ 		return -EINVAL;
+ 	if (apparmor_initialized && !policy_view_capable(NULL))
+ 		return -EPERM;
+ 	return param_get_int(buffer, kp);
+ }
+ 
  static int param_get_audit(char *buffer, const struct kernel_param *kp)
  {
  	if (!apparmor_enabled)

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

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

* linux-next: manual merge of the apparmor tree with Linus' tree
@ 2019-06-20  3:40 Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2019-06-20  3:40 UTC (permalink / raw)
  To: John Johansen; +Cc: Linux Next Mailing List, Linux Kernel Mailing List

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

Hi all,

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

  security/apparmor/include/policy.h

between commit:

  23375b13f98c ("apparmor: fix PROFILE_MEDIATES for untrusted input")

from Linus' tree and commit:

  06c13f554a71 ("apparmor: re-introduce a variant of PROFILE_MEDIATES_SAFE")

from the apparmor 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 security/apparmor/include/policy.h
index b5b4b8190e65,9af2114e1bf0..000000000000
--- a/security/apparmor/include/policy.h
+++ b/security/apparmor/include/policy.h
@@@ -213,14 -217,13 +213,22 @@@ static inline struct aa_profile *aa_get
  	return labels_profile(aa_get_newest_label(&p->label));
  }
  
 -#define PROFILE_MEDIATES(P, T)  ((P)->policy.start[(unsigned char) (T)])
 +static inline unsigned int PROFILE_MEDIATES(struct aa_profile *profile,
 +					    unsigned char class)
 +{
 +	if (class <= AA_CLASS_LAST)
 +		return profile->policy.start[class];
 +	else
 +		return aa_dfa_match_len(profile->policy.dfa,
 +					profile->policy.start[0], &class, 1);
++}
++
+ /* safe version of POLICY_MEDIATES for full range input */
+ static inline unsigned int PROFILE_MEDIATES_SAFE(struct aa_profile *profile,
+ 						 unsigned char class)
+ {
+ 	return aa_dfa_match_len(profile->policy.dfa,
+ 				profile->policy.start[0], &class, 1);
  }
  
  static inline unsigned int PROFILE_MEDIATES_AF(struct aa_profile *profile,

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

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

end of thread, other threads:[~2019-06-20  3:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11  2:24 linux-next: manual merge of the apparmor tree with Linus' tree Stephen Rothwell
2019-06-20  3:40 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).