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 2D9A733B6F9 for ; Thu, 21 May 2026 16:22:02 +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=1779380524; cv=none; b=UwVhiytbsilAR92xDfwrxg1Y0weOxiMaq2y6deUmUvtbNqh6pVdvgG4H9RmNLVJ4n5axieVeIDAfevZG0umm2VKbHinJUJRRhQrg3WEjaDH68l+dNFrRPNJt0pYMk/x5PLOVp6pCp/OBFU5mmlGjbGOnbEeBHiYQfR0wboFTbsA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779380524; c=relaxed/simple; bh=tJv+oaeYAUikTKfHfVpGUaeug3bNNl2LvVhAm+5mjIE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ItojYAtxGwxvPUnw07hlKMRJFL3LdbDlAZxryK1oU92GCDX/9YKAQA1yzsDuKcagxfX3YLRCAaqdP3zufaiN0k2Aa9Ha9sR1xp0dQ3x135b136w9NxB7WD3eLMfjnVMfmMVtNcLqJZ1WKgncvgq9xd5IoVb1azotCsSNYklGRv4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W53i71Ip; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W53i71Ip" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 558D81F000E9; Thu, 21 May 2026 16:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779380522; bh=nyXx/nFz2WVL3Mg+IX9KGNpEsXsUOSkqwecVU0tFer0=; h=From:To:Cc:Subject:Date; b=W53i71IptRQPUfkwTH/FfIa6gOqjMQzF4UIYgofFtpGTEAoQYTbQ58J6ZDVwocULa vJp+n+EQKGr/16kh2LBbI95jFoAJj2RkR/iRfijb30D4vSV8XPh53fM3IM17CSUZiZ SG8BuilUUAwCTwwzLE6w75DHWXhqeovGXtNMaEUdrUTS19xFTDsjSeWVWmCK0NtTt+ S1zsFVVhFbwauIx9argLcCvN6SPbiFVeVkwL6xKFrnOU6dglEQgqgVeZLer8jITHJp 9WraL8tOiY6s76aI/oILFHBAai2VRPd3f3WkOIXlk7baPyB+2GxWcVzL0JbbhsCkn8 gRLVRxzbEIXtQ== From: Lorenzo Stoakes To: Andrew Morton Cc: Arnd Bergmann , Greg Kroah-Hartman , David Hildenbrand , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 0/3] remove mmap_action success, error hooks Date: Thu, 21 May 2026 17:21:51 +0100 Message-ID: X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The mmap_action->success_hook was a strange beast added to enable code which appeared to absolutely require access to a VMA pointer to work correctly. Primarily this was for hugetlb, however a different approach will be taken there, as clearly more work is required to figure out a sensible way of converting hugetlb to use mmap_prepare. The other user was the memory char driver, specifically /dev/zero which has the unusual property of explicitly setting file-backed VMAs anonymous. Providing the success hook was always foolish, as it allowed drivers a way to workaround the restriction that they should not access a pointer to a not-yet-correctly-initialised VMA - which defeats the purpose of the mmap_prepare work. We can achieve the same thing in memory char driver without needing the success hook, so this series removes that, then removes the success hook altogether. The error hook is also unnecessary - the motivation for this was for functions which need to filter the error code when performing an mmap action in order to avoid breaking userspace. We can achieve this by just providing a field for the error code. Doing this means we don't have to worry about the hook doing anything odd. We also add a check to ensure the error code is in fact valid. Again the memory char driver is the only current user of this, so this series updates it to use that. After this change mmap_action has no custom hooks at all, which seems rather more cromulent than before. Lorenzo Stoakes (3): drivers/char/mem: eliminate unnecessary use of success_hook mm/vma: remove mmap_action->success_hook mm/vma: eliminate mmap_action->error_hook, introduce error_filter drivers/char/mem.c | 25 ++++++------------------- include/linux/mm.h | 5 +++++ include/linux/mm_types.h | 19 +++---------------- mm/util.c | 31 +++++++++++++++++++++---------- mm/vma.c | 2 ++ tools/testing/vma/include/dup.h | 19 +++---------------- 6 files changed, 40 insertions(+), 61 deletions(-) -- 2.54.0