From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23D603D8127; Thu, 16 Jul 2026 13:54:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784210063; cv=none; b=O8vH2ESrIk+cHQC3Cdqg/FkSFxj4W56Y4BpFk1Rp7LCGN7O8ZqXfyCNkH0VwFw/LKeOjMacn6y46O+oG/iDn6ve264eVuJsacunJj+bv332121nDV4iNCG+XXf8nE8QnDjKiAcvtrVDGZx9lWEX5ViWAMFpBIhm1soUYCDXVY4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784210063; c=relaxed/simple; bh=buWkvpgAu3p7PSsCHi3sLsGjYshTEg77Xahw49HunWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DZtRRR9cQsD68EFKBv8HS5nwoUKlGpGF5CSmkYfxFzP/D8+6v89mMTfPUyfSR3/1VEsgFCZA4lHyl6qSZEwobrkGoedhD0ly1XX/50ZxXYPlQoBAmy6ynlwweGYUWYWeU5wnZj60BVcnKzhQS9dFslyoVKnCKvM46RF+DvYW4CE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CDByuEth; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CDByuEth" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68CDE1F000E9; Thu, 16 Jul 2026 13:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784210062; bh=6zx8ipJf98nvdHfhdkkvh46bDgwsqRV3Xlt6Cr6fp0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CDByuEthsEH7fPhFYaMe1wI7E6kMEHyzbUBzIX8NZ2SiYl9flQSaGK4m0tSDmybIz uehsA4b4cnmvrjzoC/AfAkeomEiv0VN5p37LWbiWv4YONJoLrEPtPzPBusgBpaN2i2 3P6jnY66/RATmQPQbyYS+i9sdg4YScbuo0vttiL0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Anthony Yznaga , "David Hildenbrand (Arm)" , "Vlastimil Babka (SUSE)" , Mark Brown , Pedro Falcato , "Lorenzo Stoakes (Oracle)" , Jann Horn , "Jason A. Donenfeld" , Liam Howlett , Michal Hocko , Mike Rapoport , Shuah Khan , Suren Baghdasaryan , Andrew Morton Subject: [PATCH 7.1 423/518] mm: fix mmap errno value when MAP_DROPPABLE is not supported Date: Thu, 16 Jul 2026 15:31:31 +0200 Message-ID: <20260716133057.094497666@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133047.772246337@linuxfoundation.org> References: <20260716133047.772246337@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anthony Yznaga commit d86c9e971af2315119a78c564a802fafcebf1b6b upstream. Patch series "fix MAP_DROPPABLE not supported errno", v4. Mark Brown reported seeing a regression in -next on 32 bit arm with the mlock selftests. Before exiting and marking the tests failed, the following message was logged after an attempt to create a MAP_DROPPABLE mapping: Bail out! mmap error: Unknown error 524 It turns out error 524 is ENOTSUPP which is an error that userspace is not supposed to see, but it indicates in this instance that MAP_DROPPABLE is not supported. The first patch changes the errno returned to EOPNOTSUPP. The second patch is a second version of a prior patch to introduce selftests to verify locking behavior with droppable mappings with the additional change to skip the tests when MAP_DROPPABLE is not supported. The third patch fixes the MAP_DROPPABLE selftest so that it is run by the framework and skips if MAP_DROPPABLE is not supported. This patch (of 3): On configs where MAP_DROPPABLE is not supported (currently any 32-bit config except for PPC32), mmap fails with errno set to ENOTSUPP. However, ENOTSUPP is not a standard error value that userspace knows about. The acceptable userspace-visible errno to use is EOPNOTSUPP. checkpatch.pl has a warning to this effect. Link: https://lore.kernel.org/20260416033939.49981-1-anthony.yznaga@oracle.com Link: https://lore.kernel.org/20260416033939.49981-2-anthony.yznaga@oracle.com Fixes: 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings") Signed-off-by: Anthony Yznaga Acked-by: David Hildenbrand (Arm) Acked-by: Vlastimil Babka (SUSE) Reported-by: Mark Brown Reviewed-by: Pedro Falcato Reviewed-by: Lorenzo Stoakes (Oracle) Cc: Jann Horn Cc: Jason A. Donenfeld Cc: Liam Howlett Cc: Michal Hocko Cc: Mike Rapoport Cc: Shuah Khan Cc: Suren Baghdasaryan Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/mmap.c +++ b/mm/mmap.c @@ -504,7 +504,7 @@ unsigned long do_mmap(struct file *file, break; case MAP_DROPPABLE: if (VM_DROPPABLE == VM_NONE) - return -ENOTSUPP; + return -EOPNOTSUPP; /* * A locked or stack area makes no sense to be droppable. *