From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 894EC402BAB for ; Tue, 24 Mar 2026 15:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774364614; cv=none; b=a8nIUFxNM+eHozZuKneEBgcWIo+p3FTPVwdw3CFseRW0efgycu33/2Tht0RFSbVrRJHCKiBZHasptEAchsFLTosk3lvmKGMlm8yhvDMAMOwoxjom0npoubwTfs9muFgX/aRE0IngFqnX59/G5HEYZSwLya6GPTY0AbKQ87McUrw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774364614; c=relaxed/simple; bh=PVhMX2Rg7CX8FnNgNldvL46RnzeKcmhT4v7UEj+cDSw=; h=Date:To:From:Subject:Message-Id; b=HXmRJ4dyaLM/3QDYlum6UxlnnLbqHiWL/91QnPUb2V44zBoc3KE/no9FInJiGU9R0ZbyQcGjxFBVCZHdR5ObJeljKVit+BZsobGE43a5AWLBT4+M8DIc4QVe34/Z5W51oipimP6MKhytIc8NxEhYWT0+mtRD58prlStHxHAfmeg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=msFYXT4Z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="msFYXT4Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7FDBC2BC87; Tue, 24 Mar 2026 15:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1774364614; bh=PVhMX2Rg7CX8FnNgNldvL46RnzeKcmhT4v7UEj+cDSw=; h=Date:To:From:Subject:From; b=msFYXT4ZmOkHq2mYJUHHo24JICNy2SllSs9Uptd9ovtXmgTTk9IEAQg4PLvv43xtX tLaPuK3i9R6s24aAQUocrXXnTj+jMXOQd4zMnSwIhf4OGncr+Jnq5ZBkz1KhuPIFmh 38DbzjSWspgUh1lPZqQX+F/WqI3WxHDnzA9tL0B0= Date: Tue, 24 Mar 2026 08:03:33 -0700 To: mm-commits@vger.kernel.org,skhawaja@google.com,shuah@kernel.org,rppt@kernel.org,pratyush@kernel.org,dmatlack@google.com,pasha.tatashin@soleen.com,akpm@linux-foundation.org From: Andrew Morton Subject: + selftests-liveupdate-add-test-for-double-preservation.patch added to mm-new branch Message-Id: <20260324150333.E7FDBC2BC87@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: selftests: liveupdate: add test for double preservation has been added to the -mm mm-new branch. Its filename is selftests-liveupdate-add-test-for-double-preservation.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-liveupdate-add-test-for-double-preservation.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Pasha Tatashin Subject: selftests: liveupdate: add test for double preservation Date: Mon, 23 Mar 2026 20:31:45 +0000 Verify that a file can only be preserved once across all active sessions. Attempting to preserve it a second time, whether in the same or a different session, should fail with EBUSY. Link: https://lkml.kernel.org/r/20260323203145.148057-3-pasha.tatashin@soleen.com Signed-off-by: Pasha Tatashin Reviewed-by: Samiullah Khawaja Cc: David Matlack Cc: Mike Rapoport Cc: Pratyush Yadav Cc: Shuah Khan Signed-off-by: Andrew Morton --- tools/testing/selftests/liveupdate/liveupdate.c | 41 ++++++++++++++ 1 file changed, 41 insertions(+) --- a/tools/testing/selftests/liveupdate/liveupdate.c~selftests-liveupdate-add-test-for-double-preservation +++ a/tools/testing/selftests/liveupdate/liveupdate.c @@ -345,4 +345,45 @@ TEST_F(liveupdate_device, preserve_unsup ASSERT_EQ(close(session_fd), 0); } +/* + * Test Case: Prevent Double Preservation + * + * Verifies that a file (memfd) can only be preserved once across all active + * sessions. Attempting to preserve it a second time, whether in the same or + * a different session, should fail with EBUSY. + */ +TEST_F(liveupdate_device, prevent_double_preservation) +{ + int session_fd1, session_fd2, mem_fd; + int ret; + + self->fd1 = open(LIVEUPDATE_DEV, O_RDWR); + if (self->fd1 < 0 && errno == ENOENT) + SKIP(return, "%s does not exist", LIVEUPDATE_DEV); + ASSERT_GE(self->fd1, 0); + + session_fd1 = create_session(self->fd1, "double-preserve-session-1"); + ASSERT_GE(session_fd1, 0); + session_fd2 = create_session(self->fd1, "double-preserve-session-2"); + ASSERT_GE(session_fd2, 0); + + mem_fd = memfd_create("test-memfd", 0); + ASSERT_GE(mem_fd, 0); + + /* First preservation should succeed */ + ASSERT_EQ(preserve_fd(session_fd1, mem_fd, 0x1111), 0); + + /* Second preservation in a different session should fail with EBUSY */ + ret = preserve_fd(session_fd2, mem_fd, 0x2222); + EXPECT_EQ(ret, -EBUSY); + + /* Second preservation in the same session (different token) should fail with EBUSY */ + ret = preserve_fd(session_fd1, mem_fd, 0x3333); + EXPECT_EQ(ret, -EBUSY); + + ASSERT_EQ(close(mem_fd), 0); + ASSERT_EQ(close(session_fd1), 0); + ASSERT_EQ(close(session_fd2), 0); +} + TEST_HARNESS_MAIN _ Patches currently in -mm which might be from pasha.tatashin@soleen.com are mm-vmalloc-export-clear_vm_uninitialized_flag.patch kho-fix-kasan-support-for-restored-vmalloc-regions.patch liveupdate-protect-file-handler-list-with-rwsem.patch liveupdate-protect-flb-lists-with-rwsem.patch liveupdate-remove-file-handler-module-refcounting.patch liveupdate-defer-flb-module-refcounting-to-active-sessions.patch liveupdate-remove-luo_session_quiesce.patch liveupdate-auto-unregister-flbs-on-file-handler-unregistration.patch liveupdate-remove-liveupdate_test_unregister.patch liveupdate-make-unregister-functions-return-void.patch liveupdate-prevent-double-management-of-files.patch selftests-liveupdate-add-test-for-double-preservation.patch