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: <20231009021644.GC800259@ZenIV>
Date:   Mon, 9 Oct 2023 03:16:44 +0100
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        seanjc@...gle.com
Subject: Re: [PATCH gmem FIXUP] kvm: guestmem: do not use a file system

On Thu, Sep 28, 2023 at 02:06:51PM -0400, Paolo Bonzini wrote:
> Use a run-of-the-mill anonymous inode, there is nothing useful
> being provided by kvm_gmem_fs.

> -	inode = alloc_anon_inode(mnt->mnt_sb);
> -	if (IS_ERR(inode))
> -		return PTR_ERR(inode);
> +	fd = get_unused_fd_flags(0);
> +	if (fd < 0)
> +		return fd;
>  
> -	err = security_inode_init_security_anon(inode, &qname, NULL);
> -	if (err)
> -		goto err_inode;
> +	gmem = kzalloc(sizeof(*gmem), GFP_KERNEL);
> +	if (!gmem) {
> +		err = -ENOMEM;
> +		goto err_fd;
> +	}
> +
> +	file = anon_inode_getfile(anon_name, &kvm_gmem_fops, gmem,
> +				  O_RDWR);

> +	inode = file->f_inode;
> +	WARN_ON(file->f_mapping != inode->i_mapping);
>  
>  	inode->i_private = (void *)(unsigned long)flags;
>  	inode->i_op = &kvm_gmem_iops;

That's very badly broken.  The whole point of anon_inode_getfile() is
that *ALL* resulting files share the same inode.  You are not allowed
to modify the damn thing.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ