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: <ZUNPy/sMRxdo+o2w@gpd>
Date:   Thu, 2 Nov 2023 08:29:15 +0100
From:   Andrea Righi <andrea.righi@...onical.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Luis Chamberlain <mcgrof@...nel.org>,
        linux-modules@...r.kernel.org, patches@...ts.linux.dev,
        linux-kernel@...r.kernel.org, keescook@...omium.org,
        zhumao001@...suo.com, yangtiezhu@...ngson.cn, ojeda@...nel.org
Subject: Re: [GIT PULL] Modules changes for v6.7-rc1

On Wed, Nov 01, 2023 at 09:21:09PM -1000, Linus Torvalds wrote:
> On Wed, 1 Nov 2023 at 21:02, Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
> >
> > kmalloc() isn't just about "use physically contiguous allocations".
> > It's also more memory-efficient, and a *lot* faster than vmalloc(),
> > which has to play VM tricks.
> 
> I've pulled this, but I think you should do something like the
> attached (UNTESTED!) patch.
> 
>                 Linus

Looks good to me, I'll give it a try ASAP.

-Andrea


>  kernel/module/decompress.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/module/decompress.c b/kernel/module/decompress.c
> index 4156d59be440..474e68f0f063 100644
> --- a/kernel/module/decompress.c
> +++ b/kernel/module/decompress.c
> @@ -100,7 +100,7 @@ static ssize_t module_gzip_decompress(struct load_info *info,
>  	s.next_in = buf + gzip_hdr_len;
>  	s.avail_in = size - gzip_hdr_len;
>  
> -	s.workspace = vmalloc(zlib_inflate_workspacesize());
> +	s.workspace = kvmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
>  	if (!s.workspace)
>  		return -ENOMEM;
>  
> @@ -138,7 +138,7 @@ static ssize_t module_gzip_decompress(struct load_info *info,
>  out_inflate_end:
>  	zlib_inflateEnd(&s);
>  out:
> -	vfree(s.workspace);
> +	kvfree(s.workspace);
>  	return retval;
>  }
>  #elif defined(CONFIG_MODULE_COMPRESS_XZ)
> @@ -241,7 +241,7 @@ static ssize_t module_zstd_decompress(struct load_info *info,
>  	}
>  
>  	wksp_size = zstd_dstream_workspace_bound(header.windowSize);
> -	wksp = vmalloc(wksp_size);
> +	wksp = kvmalloc(wksp_size, GFP_KERNEL);
>  	if (!wksp) {
>  		retval = -ENOMEM;
>  		goto out;
> @@ -284,7 +284,7 @@ static ssize_t module_zstd_decompress(struct load_info *info,
>  	retval = new_size;
>  
>   out:
> -	vfree(wksp);
> +	kvfree(wksp);
>  	return retval;
>  }
>  #else

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ