Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1513254

Re: [PATCH v6 1/3] LSM: Add /sys/kernel/security/lsm

From Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Newsgroups linux.kernel
Subject Re: [PATCH v6 1/3] LSM: Add /sys/kernel/security/lsm
Date 2016-11-01 14:00 +0100
Message-ID <syGPv-nk-9@gated-at.bofh.it> (permalink)
References <swGqC-2Cg-21@gated-at.bofh.it> <swGqC-2Cg-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Casey Schaufler wrote:
> diff --git a/security/security.c b/security/security.c
> index f825304..f0a802ee 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -32,6 +32,7 @@
>  /* Maximum number of letters for an LSM name string */
>  #define SECURITY_NAME_MAX	10
>  
> +char *lsm_names;
>  /* Boot-time LSM user choice */
>  static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] =
>  	CONFIG_DEFAULT_SECURITY;
> @@ -78,6 +79,22 @@ static int __init choose_lsm(char *str)
>  }
>  __setup("security=", choose_lsm);
>  
> +static int lsm_append(char *new, char **result)
> +{
> +	char *cp;
> +
> +	if (*result == NULL) {
> +		*result = kstrdup(new, GFP_KERNEL);
> +	} else {
> +		cp = kasprintf(GFP_KERNEL, "%s,%s", *result, new);
> +		if (cp == NULL)
> +			return -ENOMEM;
> +		kfree(*result);
> +		*result = cp;
> +	}
> +	return 0;
> +}
> +

I didn't check past discussion, but how do you handle security_delete_hooks()
case (I mean, "selinux" will remain there when reading /sys/kernel/security/lsm
even after it is disabled at runtime)? I think holding module name as one of
"union security_list_options" members will avoid memory allocation handling
and simplify things.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH v6 1/3] LSM: Add /sys/kernel/security/lsm Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-11-01 14:00 +0100
  Re: [PATCH v6 1/3] LSM: Add /sys/kernel/security/lsm Casey Schaufler <casey@schaufler-ca.com> - 2016-11-01 18:30 +0100
    Re: [PATCH v6 1/3] LSM: Add /sys/kernel/security/lsm Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-11-04 15:20 +0100

csiph-web