Re: [PATCH] mm/hugetlb: change ENOSPC to ENOMEM in alloc_hugetlb_folio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 30, 2024 at 06:51:21PM -0800, Andrew Morton wrote:

Hi Andrew,
...
> > -	return ERR_PTR(-ENOSPC);
> > +	return ERR_PTR(-ENOMEM);
...
> err, yes.  ENOSPC is for disk drives!  I'll slap a cc:stable on this
> fix for a decade old bug.

This fix invalidates the comment in hugetlb_no_page():

	/*
	 * Returning error will result in faulting task being
	 * sent SIGBUS.  The hugetlb fault mutex prevents two
	   ...
	 */

The problem is an attempt to write to a MAP_NORESERVE huge page (as per [1])
causes an infinite page fault cycle instead of SIGBUS, at least on s390:

	q = mmap(NULL, hpage_size,
		PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NORESERVE, fd2, 0);
	...
	test_write(q);

1. https://github.com/libhugetlbfs/libhugetlbfs/blob/master/tests/noresv-preserve-resv-page.c

Thanks!




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux