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: <20250506164004.e80e635a28dabb89b7257820@linux-foundation.org>
Date: Tue, 6 May 2025 16:40:04 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Ignacio.MorenoGonzalez@...a.com
Cc: Ignacio Moreno Gonzalez via B4 Relay
 <devnull+Ignacio.MorenoGonzalez.kuka.com@...nel.org>,
 lorenzo.stoakes@...cle.com, Liam.Howlett@...cle.com,
 yang@...amperecomputing.com, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v2 2/2] mm: madvise: no-op for MADV_NOHUGEPAGE if THP is
 disabled

On Tue, 06 May 2025 15:44:33 +0200 Ignacio Moreno Gonzalez via B4 Relay <devnull+Ignacio.MorenoGonzalez.kuka.com@...nel.org> wrote:

> From: Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@...a.com>
> 
> VM_NOHUGEPAGE is a no-op in a kernel without THP. So it makes no sense
> to return an error when calling madvise() with MADV_NOHUGEPAGE.

The patch looks rather odd.

> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -7,6 +7,10 @@
>  #include <linux/fs.h> /* only for vma_is_dax() */
>  #include <linux/kobject.h>
>  
> +#ifndef CONFIG_TRANSPARENT_HUGEPAGE
> +#include <uapi/asm-generic/mman-common.h>
> +#endif

Why is the #ifndef here?

This is the only file under include/linux which directly includes
something from uapi/asm-generic.  Indicates that we're doing something
wrong.

If this hunk is truly the correct approach then I think we need a
comment here fully explaining what is going on.   Because it looks odd!

>  vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf);
>  int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
>  		  pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
> @@ -598,6 +602,8 @@ static inline bool unmap_huge_pmd_locked(struct vm_area_struct *vma,
>  static inline int hugepage_madvise(struct vm_area_struct *vma,
>  				   unsigned long *vm_flags, int advice)
>  {
> +	if (advice == MADV_NOHUGEPAGE)
> +		return 0;

Also a comment here which explains why we're doing this?

>  	return -EINVAL;
>  }
>  
> 
> -- 
> 2.39.5
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ