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


Groups > linux.kernel > #1291193

Re: [PATCH v2 1/3] keys, trusted: fix: *do not* allow duplicate key options

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Mimi Zohar <zohar@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/3] keys, trusted: fix: *do not* allow duplicate key options
Date Mon, 14 Dec 2015 14:50:02 +0100
Message-ID <qFBFM-6PR-1@gated-at.bofh.it> (permalink)
References <qFh4l-1L3-3@gated-at.bofh.it> <qFh4l-1L3-11@gated-at.bofh.it>
X-Original-To Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
X-Ibm-Helo d23dlp03.au.ibm.com
X-Ibm-Mailfrom zohar@linux.vnet.ibm.com
X-Ibm-Rcptto keyrings@vger.kernel.org;linux-kernel@vger.kernel.org;linux-security-module@vger.kernel.org
Content-Type text/plain; charset="UTF-8"
X-Mailer Evolution 3.12.11 (3.12.11-1.fc21)
MIME-Version 1.0
Content-Transfer-Encoding 7bit
X-Tm-As-Mml disable
X-Content-Scanned Fidelis XPS MAILER
X-Cbid 15121413-0025-0000-0000-00000295F685
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 48
Organization linux.* mail to news gateway
X-Original-Cc Peter Huewe <peterhuewe@gmx.de>, Marcel Selhorst <tpmdd@selhorst.net>, David Howells <dhowells@redhat.com>, Jonathan Corbet <corbet@lwn.net>, David Safford <safford@us.ibm.com>, James Morris <james.l.morris@oracle.com>, "Serge E. Hallyn" <serge@hallyn.com>, "open list:KEYS-TRUSTED" <linux-security-module@vger.kernel.org>, "open list:KEYS-TRUSTED" <keyrings@vger.kernel.org>, open list <linux-kernel@vger.kernel.org>
X-Original-Date Mon, 14 Dec 2015 08:46:33 -0500
X-Original-Message-ID <1450100793.2702.42.camel@linux.vnet.ibm.com>
X-Original-References <1450021353-8775-1-git-send-email-jarkko.sakkinen@linux.intel.com> <1450021353-8775-2-git-send-email-jarkko.sakkinen@linux.intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1291193

Show key headers only | View raw


On Sun, 2015-12-13 at 17:42 +0200, Jarkko Sakkinen wrote:
> The trusted keys option parsing allows specifying the same option
> multiple times. The last option value specified is used.
> 
> This can be seen as a regression because:
> 
> * No gain.
> * Could be problematic if there is be options dependent on other
>   options.

Thanks, Jarkko.   Although it should be obvious that patch limits the
number of times an option can be specified, you should explicitly
mention it in the patch description.

Mimi

> Reported-by: James Morris James Morris <jmorris@namei.org>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
>  security/keys/trusted.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/security/keys/trusted.c b/security/keys/trusted.c
> index 903dace..7c183c7 100644
> --- a/security/keys/trusted.c
> +++ b/security/keys/trusted.c
> @@ -736,11 +736,14 @@ static int getoptions(char *c, struct trusted_key_payload *pay,
>  	int res;
>  	unsigned long handle;
>  	unsigned long lock;
> +	unsigned long token_mask = 0;
> 
>  	while ((p = strsep(&c, " \t"))) {
>  		if (*p == '\0' || *p == ' ' || *p == '\t')
>  			continue;
>  		token = match_token(p, key_tokens, args);
> +		if (test_and_set_bit(token, &token_mask))
> +			return -EINVAL;
> 
>  		switch (token) {
>  		case Opt_pcrinfo:


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH v2 0/3] TPM 2.0 trusted key features for v4.5 Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-12-13 16:50 +0100
  [PATCH v2 1/3] keys, trusted: fix: *do not* allow duplicate key options Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-12-13 16:50 +0100
    Re: [PATCH v2 1/3] keys, trusted: fix: *do not* allow duplicate key  options Mimi Zohar <zohar@linux.vnet.ibm.com> - 2015-12-14 14:50 +0100
      Re: [PATCH v2 1/3] keys, trusted: fix: *do not* allow duplicate key  options Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-12-14 16:00 +0100

csiph-web