lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241124181908.GV3387508@ZenIV>
Date: Sun, 24 Nov 2024 18:19:08 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Christian Brauner <brauner@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
	Amir Goldstein <amir73il@...il.com>,
	Miklos Szeredi <miklos@...redi.hu>, linux-kernel@...r.kernel.org,
	linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 08/26] sev-dev: avoid pointless cred reference count bump

On Sun, Nov 24, 2024 at 02:43:54PM +0100, Christian Brauner wrote:

>  drivers/crypto/ccp/sev-dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index 187c34b02442dd50640f88713bc5f6f88a1990f4..2e87ca0e292a1c1706a8e878285159b481b68a6f 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -244,7 +244,7 @@ static struct file *open_file_as_root(const char *filename, int flags, umode_t m
>  	if (!cred)
>  		return ERR_PTR(-ENOMEM);
>  	cred->fsuid = GLOBAL_ROOT_UID;
> -	old_cred = override_creds(get_new_cred(cred));
> +	old_cred = override_creds(cred);
>  
>  	fp = file_open_root(&root, filename, flags, mode);
>  	path_put(&root);

Looks sane, but the use of file reads/writes in there does not.

At the very least, this
        nwrite = kernel_write(fp, sev_init_ex_buffer, NV_LENGTH, &offset);
        vfs_fsync(fp, 0);
        filp_close(fp, NULL);

        if (nwrite != NV_LENGTH) {
                dev_err(sev->dev,
                        "SEV: failed to write %u bytes to non volatile memory area, ret %ld\n",
                        NV_LENGTH, nwrite);
                return -EIO;
        }
is either too much or too little - if it's serious about reporting errors,
it would better check what fsync and close return...

Oh, well - unrelated to your patchset, obviously

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ