From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=113.46.200.222 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796006136; b=sXJHRLUR9p0uWoRJjC500csKeNYfb9qYTRB7JgUkupttAMM54gBDRMzQwnrhT2uk6Dlo 67BkRqT5Sg0jacYqu7i/jftK0Jww2PcSh+nWmfxoX/3DdrO/R1LLJ8ZslKRwRXX1ilnyC ksO+xTH2XExzMyQ2FHDBE145ium+QiZM9ZVT5Vm4wCip/n8W9KXM59IlIysimuBtgJ0U7 7VLG3IBVPJQwPjQ8gq3ZmnGrj2lFkRwDHFc2ffxl7iml5weg5awH5KxkyE51+zzxSZH4D zFXcXHITeZk4PHirH3hdUcIHT+4sBkxNj9c029NS04BBNXkDQ1Ro3g2yN3CaOJWGyXQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796006136; h=DMARC-Filter:dkim-signature:Received:Received:Received:From:To:CC: Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy; bh=HfX87cOhGvsqvEnIstzaVWk5OiSkJrdgoa88vCCqKy4=; b=0rEL4MT9LCGJOeF0pt97ymPwM0hM6Nir5A4wyCjVWlZIPqP/O+wsJoVdJX8TgON+fQmP FZKd202lDQ+38t3d3jc56ooYGuot9xEhVxebyLyc66nHilwxB22b3J3eAvg9svL0MQ0jh WlsXVdVIEIvvbR2UFZctITrMZ4q33KGuUy9JyebkURpY1IwFrn4JIqsKujV3sp+UHcZOf L/6x9gLtu/ujdrkq6/mtmmTFxr4NYUz8nGjHq0lgOGpsNSQVTgR5j3Ed4VUceIlG7dw/L m/atMMWl+bBk/NEuVPGiukbEfDff1NskV7blYuZXcfcsO9zBA8Wu5/zwTPWa1IkSSzA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=oBtFjVJa; arc=none smtp.remote-ip=113.46.200.222 Received: from canpmsgout07.his.huawei.com (canpmsgout07.his.huawei.com [113.46.200.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A018606A32E; Mon, 30 Nov 2026 02:35:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1A018606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=oBtFjVJa dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=HfX87cOhGvsqvEnIstzaVWk5OiSkJrdgoa88vCCqKy4=; b=oBtFjVJaIXS8KGF3LKpGcGZLEtxBtn33GEllGZwbP2KY/XW7e/PgOJfHbP2Twbzuls5i+J5bq rPKeLuuuDYwHD57tE7asxy10aMi5b9MS+dN8mAIdiCqI2yolbNeI8KzUKpmIC6LVsv2TocRm0W5 zBlNncSdg5JTOR0o1XDLV5o= Received: from mail.maildlp.com (unknown [172.19.163.163]) by canpmsgout07.his.huawei.com (SkyGuard) with ESMTPS id 4jd7Qr3KBFzLlVc; Mon, 30 Nov 2026 10:35:00 +0800 (CST) Received: from kwepemo200009.china.huawei.com (unknown [7.202.195.26]) by mail.maildlp.com (Postfix) with ESMTPS id 48BB540563; Mon, 30 Nov 2026 10:35:27 +0800 (CST) Received: from localhost.localdomain (10.50.159.234) by kwepemo200009.china.huawei.com (7.202.195.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Mon, 30 Nov 2026 10:35:26 +0800 From: Long Wei To: , , CC: , , , , , , , Long Wei Subject: [PATCH v2 0/2] mm: memfd_luo: pick up seals added after preserve at freeze Date: Mon, 30 Nov 2026 10:32:45 +0800 Message-ID: <20261130023247.2728481-1-longwei27@huawei.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: kwepems200002.china.huawei.com (7.221.188.68) To kwepemo200009.china.huawei.com (7.202.195.26) A seal added to a memfd after the memfd was preserved with a liveupdate session is accepted without any error, but the seal is silently gone once the kexec handover is over: the retrieved memfd no longer has it. memfd_luo_preserve() snapshots the file seals, but userspace may keep operating on the memfd until the handover, so the preserve-time snapshot is naturally incomplete. memfd_luo_freeze() never re-read the seals and memfd_luo_retrieve() replays the stale snapshot, so seals added in the window between preserve() and kexec were dropped without any notice. Patch 1 re-reads the seals at freeze time, mirroring the file position handling: freeze is the last snapshot point before kexec and the only place where the final value can still be sampled and, when it diverged from the preserve-time snapshot, validated while the live update can still be aborted. Patch 2 adds a kexec round-trip selftest that adds F_SEAL_GROW after preserve and asserts that the seal survives the handover. Tested on arm64 and x86_64 with two consecutive kexec handovers each: with the fix the seal survives and dmesg stays free of new warnings. This series applies on the current next branch of liveupdate.git, where the file is still named memfd_luo.c. I am aware of the pending "mm: Rename memfd_luo to shmem_luo" series. If that series lands first, a trivial s/memfd_luo/shmem_luo/ rebase will be needed, which I am happy to provide. Changes in v2: - Add an __NR_fcntl64 fallback to LUO_FCNTL_NR in the selftest so it also builds on 32-bit architectures using the generic syscall table (riscv32, csky, nios2), where __NR_fcntl does not exist. Long Wei (2): mm: memfd_luo: pick up seals added after preserve at freeze selftests/liveupdate: add seal-after-preserve kexec test mm/memfd_luo.c | 27 ++- tools/testing/selftests/liveupdate/Makefile | 1 + .../liveupdate/luo_seal_after_preserve.c | 170 ++++++++++++++++++ .../selftests/liveupdate/run-vmtests.sh | 1 + 4 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/liveupdate/luo_seal_after_preserve.c -- 2.43.0