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: <20191216155332.GA29065@bogon.m.sigxcpu.org>
Date:   Mon, 16 Dec 2019 16:53:32 +0100
From:   Guido Günther <agx@...xcpu.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Dominik Brodowski <linux@...inikbrodowski.net>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Ingo Molnar <mingo@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] init: use do_mount() instead of ksys_mount()

Hi,
On Sun, Dec 15, 2019 at 07:50:23PM -0800, Linus Torvalds wrote:
> On Sun, Dec 15, 2019 at 5:35 PM Ondřej Jirman <megi@....cz> wrote:
> >
> > Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> 
> Duh. So much for the trivial obvious conversion.
> 
> It didn't take "data might be NULL" into account.
> 
> A patch like this, perhaps? Untested..
> 
>                Linus

>  init/do_mounts.c | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/init/do_mounts.c b/init/do_mounts.c
> index f55cbd9cb818..d204f605dbce 100644
> --- a/init/do_mounts.c
> +++ b/init/do_mounts.c
> @@ -391,17 +391,19 @@ static int __init do_mount_root(const char *name, const char *fs,
>  				 const int flags, const void *data)
>  {
>  	struct super_block *s;
> -	char *data_page;
> -	struct page *p;
> +	struct page *p = NULL;
> +	char *data_page = NULL;
n>  	int ret;
>  
> -	/* do_mount() requires a full page as fifth argument */
> -	p = alloc_page(GFP_KERNEL);
> -	if (!p)
> -		return -ENOMEM;
> -
> -	data_page = page_address(p);
> -	strncpy(data_page, data, PAGE_SIZE - 1);
> +	if (data) {
> +		/* do_mount() requires a full page as fifth argument */
> +		p = alloc_page(GFP_KERNEL);
> +		if (!p)
> +			return -ENOMEM;
> +		data_page = page_address(p);
> +		strncpy(data_page, data, PAGE_SIZE - 1);
> +		data_page[PAGE_SIZE - 1] = '\0';
> +	}
>  
>  	ret = do_mount(name, "/root", fs, flags, data_page);
>  	if (ret)
> @@ -417,7 +419,8 @@ static int __init do_mount_root(const char *name, const char *fs,
>  	       MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
>  
>  out:
> -	put_page(p);
> +	if (p)
> +		put_page(p);
>  	return ret;
>  }
>  

This unbroke tftpboot on arm64 on next-20191216 for me as well:

Tested-by: Guido Günther <agx@...xcpu.org>

Cheers,
 -- Guido

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ