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: <20250612162151-1fc97a6c-a1c9-4656-997e-fd02f5f9418b@linutronix.de>
Date: Thu, 12 Jun 2025 16:27:41 +0200
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Jason Gunthorpe <jgg@...dia.com>, Nicolin Chen <nicolinc@...dia.com>
Cc: Shuah Khan <shuah@...nel.org>, Shuah Khan <skhan@...uxfoundation.org>, 
	Willy Tarreau <w@....eu>, Thomas Weißschuh <linux@...ssschuh.net>, 
	Kees Cook <kees@...nel.org>, Andy Lutomirski <luto@...capital.net>, 
	Will Drewry <wad@...omium.org>, Mark Brown <broonie@...nel.org>, 
	Muhammad Usama Anjum <usama.anjum@...labora.com>, linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v4 09/14] selftests: harness: Move teardown conditional
 into test metadata

On Thu, Jun 12, 2025 at 10:58:02AM -0300, Jason Gunthorpe wrote:
> On Wed, Jun 11, 2025 at 11:59:00PM -0700, Nicolin Chen wrote:
> 
> > We can see the 64MB was rounded up to 512MB by ksys_mmap_pgoff()
> > when being passed in to hugetlb_file_setup() at:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/mmap.c?h=v6.16-rc1#n594
> > "		len = ALIGN(len, huge_page_size(hs));  "
> > 
> > By looking at the comments here..:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/hugetlbfs/inode.c#n1521
> > "
> > /*
> >  * Note that size should be aligned to proper hugepage size in caller side,
> >  * otherwise hugetlb_reserve_pages reserves one less hugepages than intended.
> >  */
> > struct file *hugetlb_file_setup(const char *name, size_t size,
> > "
> > 
> > ..I guess this function was supposed to fail the not-a-multiple
> > case as you remarked? But it certainly can't do that, when that
> > size passed in is already hugepage-aligned..
> > 
> > It feels like a kernel bug as you suspect :-/
> 
> Certainly is
>  
> > And I just found one more weird thing...
> > 
> > In iommufd.c selftest code, we have:
> > "static __attribute__((constructor)) void setup_sizes(void)"
> > where it does another pair of posix_memalign/mmap, although this
> > one doesn't flag MAP_HUGETLB and shouldn't impact what is coming
> > to the next...
> 
> This could all just be more weirdness from the above, it doesn't
> really make alot of sense.
> 
> I think change things so the MAP_HUGETLB test all skip if
> HUGEPAGE_SIZE < buffer_size and move on..
> 
> Can't run those tests on ARM64 64k which is unfortunate.. I thought
> there were patches to give that config a 2M huge page size option
> based on the new contiguous page support though? Maybe it was only THPS..

If the assumption is that this is most likely a kernel bug,
shouldn't it be fixed properly rather than worked around?
After all the job of a selftest is to detect bugs to be fixed.

But I wasn't able to follow all of your discussions,
so I may be missing something.

If the test is broken on ARM64 64k in general then I am also wondering how
it didn't fail before my change to the selftest harness.


Thomas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ