From: Tarun Sahu <tarunsahu@google.com>
To: Pasha Tatashin <pasha.tatashin@soleen.com>,
Pratyush Yadav <pratyush@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Mike Rapoport <rppt@kernel.org>,
Alexander Graf <graf@amazon.com>,
skhawaja@google.com
Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
Tarun Sahu <tarunsahu@google.com>
Subject: [PATCH v6 2/3] kho: add KHOSER_COPY_PTR to allow phys copy of serialized ptr
Date: Sun, 28 Jun 2026 00:11:13 +0000 [thread overview]
Message-ID: <20260628001114.1869564-3-tarunsahu@google.com> (raw)
In-Reply-To: <20260628001114.1869564-1-tarunsahu@google.com>
Adding KHOSER_COPY_PTR to copy one serializeable pointer to
another. It basically allows copy of phys val of the
serializeable pointer.
It ignores the typecheck if any of the argument is of void *
Signed-off-by: Tarun Sahu <tarunsahu@google.com>
Reviewed-by: Pratyush Yadav (Google) <pratyush@kernel.org>
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
---
include/linux/kho/abi/kexec_handover.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/kho/abi/kexec_handover.h b/include/linux/kho/abi/kexec_handover.h
index 5e2eb8519bda..a5a518e881fd 100644
--- a/include/linux/kho/abi/kexec_handover.h
+++ b/include/linux/kho/abi/kexec_handover.h
@@ -139,6 +139,17 @@
(typeof((s).ptr))((s).phys ? phys_to_virt((s).phys) : NULL); \
})
+#define KHOSER_COPY_PTR(dest, src) \
+ ({ \
+ static_assert( \
+ __builtin_types_compatible_p(typeof(dest.ptr), typeof(src.ptr)) ||\
+ __builtin_types_compatible_p(typeof(dest.ptr), void *) || \
+ __builtin_types_compatible_p(typeof(src.ptr), void *), \
+ "pointer type mismatch in KHOSER_COPY_PTR" \
+ ); \
+ (dest).phys = (src).phys; \
+ })
+
/*
* This header is embedded at the beginning of each `kho_vmalloc_chunk`
* and contains a pointer to the next chunk in the linked list,
--
2.55.0.rc0.799.gd6f94ed593-goog
next prev parent reply other threads:[~2026-06-28 0:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 0:11 [PATCH v6 0/3] luo: convert serialized ptr to KHOSER_PTR Tarun Sahu
2026-06-28 0:11 ` [PATCH v6 1/3] mm/memfd_luo: validate serialized_data before conversion Tarun Sahu
2026-06-28 0:11 ` Tarun Sahu [this message]
2026-06-28 0:11 ` [PATCH v6 3/3] luo: Update serialized data to use KHOSER_PTR Tarun Sahu
2026-06-29 7:01 ` Pasha Tatashin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260628001114.1869564-3-tarunsahu@google.com \
--to=tarunsahu@google.com \
--cc=akpm@linux-foundation.org \
--cc=graf@amazon.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=skhawaja@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox