NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "zohar@linux.ibm.com" <zohar@linux.ibm.com>,
	"paul@paul-moore.com" <paul@paul-moore.com>,
	"jarkko@kernel.org" <jarkko@kernel.org>,
	"dhowells@redhat.com" <dhowells@redhat.com>,
	"yaelt@google.com" <yaelt@google.com>,
	"serge@hallyn.com" <serge@hallyn.com>,
	"nichen@iscas.ac.cn" <nichen@iscas.ac.cn>,
	"sumit.garg@linaro.org" <sumit.garg@linaro.org>,
	"jmorris@namei.org" <jmorris@namei.org>
Cc: "Jiang, Dave" <dave.jiang@intel.com>,
	"linux-integrity@vger.kernel.org"
	<linux-integrity@vger.kernel.org>,
	"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	"keyrings@vger.kernel.org" <keyrings@vger.kernel.org>,
	"linux-security-module@vger.kernel.org"
	<linux-security-module@vger.kernel.org>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>
Subject: Re: [PATCH] KEYS: encrypted: Add check for strsep
Date: Wed, 24 Jan 2024 18:21:18 +0000	[thread overview]
Message-ID: <4d3465b48b9c5a87deb385b15bf5125fc1704019.camel@intel.com> (raw)
In-Reply-To: <20231108073627.1063464-1-nichen@iscas.ac.cn>

On Wed, 2023-11-08 at 07:36 +0000, Chen Ni wrote:
> Add check for strsep() in order to transfer the error.
> 
> Fixes: cd3bc044af48 ("KEYS: encrypted: Instantiate key with user-
> provided decrypted data")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>  security/keys/encrypted-keys/encrypted.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/security/keys/encrypted-keys/encrypted.c
> b/security/keys/encrypted-keys/encrypted.c
> index 8af2136069d2..76f55dd13cb8 100644
> --- a/security/keys/encrypted-keys/encrypted.c
> +++ b/security/keys/encrypted-keys/encrypted.c
> @@ -237,6 +237,10 @@ static int datablob_parse(char *datablob, const
> char **format,
>  			break;
>  		}
>  		*decrypted_data = strsep(&datablob, " \t");
> +		if (!*decrypted_data) {
> +			pr_info("encrypted_key: decrypted_data is
> missing\n");
> +			break;
> +		}

Hello,

This patch seems to break keyring usage in CXL and NVDIMM, with the
"decrypted_data is missing" error path being hit. Reverting this commit
fixes the tests. I'm not sure if there are valid scenarios where this is
expected to be empty?

Here's an strace snippet of where the error occurs:

   keyctl(KEYCTL_SEARCH, KEY_SPEC_USER_KEYRING, "user", "nvdimm-master", 0) = 76300785
   openat(AT_FDCWD, "/sys/devices/platform/cxl_acpi.0/root0/nvdimm-bridge0/ndbus0/nmem0/state", O_RDONLY|O_CLOEXEC) = 3
   read(3, "idle\n", 1024)                 = 5
   close(3)                                = 0
   keyctl(KEYCTL_SEARCH, KEY_SPEC_USER_KEYRING, "encrypted", "nvdimm:0", 0) = -1 ENOKEY (Required key not available)
   uname({sysname="Linux", nodename="fedora", ...}) = 0
   newfstatat(AT_FDCWD, "/etc/ndctl/keys/nvdimm_0_fedora.blob", 0x7fff23fbc210, 0) = -1 ENOENT (No such file or directory)
   add_key("encrypted", "nvdimm:0", "new enc32 user:nvdimm-master 32", 31, KEY_SPEC_USER_KEYRING) = -1 EINVAL (Invalid argument)
   

       reply	other threads:[~2024-01-24 18:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20231108073627.1063464-1-nichen@iscas.ac.cn>
2024-01-24 18:21 ` Verma, Vishal L [this message]
2024-01-24 19:15   ` [PATCH] KEYS: encrypted: Add check for strsep Mimi Zohar
2024-01-24 20:10     ` Verma, Vishal L
2024-01-24 20:40       ` Mimi Zohar
2024-01-24 21:10         ` Verma, Vishal L
2024-01-30 17:22           ` Jarkko Sakkinen
2024-01-30 17:30             ` Jarkko Sakkinen
2024-01-30 18:25               ` Dan Williams
2024-02-01 21:43                 ` Jarkko Sakkinen
2024-02-02  0:05                   ` Mimi Zohar
2024-02-12  5:11                     ` Jarkko Sakkinen
2024-01-30 17:19   ` Jarkko Sakkinen
2024-01-30 17:20     ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d3465b48b9c5a87deb385b15bf5125fc1704019.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dhowells@redhat.com \
    --cc=jarkko@kernel.org \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=nichen@iscas.ac.cn \
    --cc=nvdimm@lists.linux.dev \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.com \
    --cc=sumit.garg@linaro.org \
    --cc=yaelt@google.com \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).