powerpc: Export set_memory_encrypted and set_memory_decrypted
Subsystems (3)
PATCH 1/1 powerpc: Export set_memory_encrypted and set_memory_decrypted
After commit fd55edff8a0a ("dma-buf: heaps: system: Turn the heap into a module") the system dma-buf heaps can be built as a module. The system_cc_shared heap uses set_memory_encrypted and set_memory_decrypted but those functions are not exported on powerpc. This can result in a build error like:
Quoted 2 lines
Quoted 2 lines
ERROR: modpost: "
set_memory_decrypted" [drivers/dma-buf/heaps/system_heap.ko] undefined!
ERROR: modpost: "set_memory_encrypted" [drivers/dma-buf/heaps/system_heap.ko] undefined!
Export the functions so system_heap.ko can be built.
--- arch/powerpc/platforms/pseries/svm.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/platforms/pseries/svm.c +3 -0
@@ -50,6 +50,7 @@ int set_memory_encrypted(unsigned long addr, int numpages)return 0 ; } +EXPORT_SYMBOL_GPL (set_memory_encrypted);int set_memory_decrypted (unsigned long addr,int numpages) {
@@ -63,6 +64,8 @@ int set_memory_decrypted(unsigned long addr, int numpages)return 0 ; } +EXPORT_SYMBOL_GPL (set_memory_decrypted); +/* There's one dispatch log per CPU. */ #define NR_DTL_PAGE (DISPATCH_LOG_BYTES * CONFIG_NR_CPUS / PAGE_SIZE)
Signature · 1 line
2.54.0.746.g67dd491aae-goog
Quoted 5 lines · T.J. Mercier
After commit
fd55edff8a0a("dma-buf: heaps: system: Turn the heap into a module") the system dma-buf heaps can be built as a module. Thesystem_cc_sharedheap usesset_memory_encryptedandset_memory_decryptedbut those functions are not exported on powerpc. This can result in a build error like:
I'd much rather revert the above commit. Yes, x86 has exported these since 2017, but that's a really bad idea, and we should fix it instead of spreading the export.
Setting memory decrypted is a dangerous operations and should only be available to core code. We should have various allocators for decrypted code, but not export the functionality to random code.
Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · T.J. Mercier
After commit
fd55edff8a0a("dma-buf: heaps: system: Turn the heap into a module") the system dma-buf heaps can be built as a module. Thesystem_cc_sharedheap usesset_memory_encryptedandset_memory_decryptedbut those functions are not exported on powerpc. This can result in a build error like:
Quoted 7 lines
I'd much rather revert the above commit. Yes, x86 has exported these since 2017, but that's a really bad idea, and we should fix it instead of spreading the export.
Setting memory decrypted is a dangerous operations and should only be available to core code. We should have various allocators for decrypted code, but not export the functionality to random code.
At the very least an EXPORT_SYMBOL_NS.
Looks like there are about 3 modules using it already..
Jason
Quoted 7 lines · Jason Gunthorpe
Quoted 3 lines
Setting memory decrypted is a dangerous operations and should only be available to core code. We should have various allocators for decrypted code, but not export the functionality to random code.
At the very least an
EXPORT_SYMBOL_NS.Looks like there are about 3 modules using it already..
Looks like more to me...
In any case, we exported them back then for some framebuffer things:
95cf9264d5f3 ("x86, drm, fbdev: Do not specify encrypted memory for video mappings")
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 7 lines · Borislav Petkov
Quoted 6 lines · Jason Gunthorpe
Quoted 3 lines
Setting memory decrypted is a dangerous operations and should only be available to core code. We should have various allocators for decrypted code, but not export the functionality to random code.
At the very least an
EXPORT_SYMBOL_NS.
Quoted 7 lines
Quoted 1 line
Looks like there are about 3 modules using it already..
Looks like more to me...
In any case, we exported them back then for some framebuffer things:
95cf9264d5f3("x86, drm, fbdev: Do not specify encrypted memory for video mappings")
Which is exactly one of these things that should not happen - mapping random I/O memory without the proper helpers..
Quoted 12 lines · Jason Gunthorpe
Quoted 11 lines · Christoph Hellwig
Quoted 5 lines · T.J. Mercier
After commit
fd55edff8a0a("dma-buf: heaps: system: Turn the heap into a module") the system dma-buf heaps can be built as a module. Thesystem_cc_sharedheap usesset_memory_encryptedandset_memory_decryptedbut those functions are not exported on powerpc. This can result in a build error like:I'd much rather revert the above commit. Yes, x86 has exported these since 2017, but that's a really bad idea, and we should fix it instead of spreading the export.
Quoted 7 lines
Quoted 3 lines
Setting memory decrypted is a dangerous operations and should only be available to core code. We should have various allocators for decrypted code, but not export the functionality to random code.
At the very least an
EXPORT_SYMBOL_NS.Looks like there are about 3 modules using it already..
So, I'm not really sure how to fix this now. Should we revert the patch making the system heap a module, or should we export the symbols for all archs?
Maxime
Hi All,
Quoted 18 lines · Maxime Ripard
Quoted 16 lines · Jason Gunthorpe
Quoted 14 lines · Christoph Hellwig
Quoted 5 lines · T.J. Mercier
After commit
fd55edff8a0a("dma-buf: heaps: system: Turn the heap into a module") the system dma-buf heaps can be built as a module. Thesystem_cc_sharedheap usesset_memory_encryptedandset_memory_decryptedbut those functions are not exported on powerpc. This can result in a build error like:I'd much rather revert the above commit. Yes, x86 has exported these since 2017, but that's a really bad idea, and we should fix it instead of spreading the export.
Setting memory decrypted is a dangerous operations and should only be available to core code. We should have various allocators for decrypted code, but not export the functionality to random code.
Quoted 7 lines
Quoted 3 lines
At the very least an
EXPORT_SYMBOL_NS.Looks like there are about 3 modules using it already..
So, I'm not really sure how to fix this now. Should we revert the patch making the system heap a module, or should we export the symbols for all archs?
Given that Christoph's objection is not really about the modules part, but that the set_memory_{encrypted,decrypted} should not be used here, one option is to revert 78b30c50a7ac until that issue is sorted out?
Jiri, any thoughts from you?
Quoted 2 lines
Maxime
Best,
Sumit.
Quoted 30 lines · Sumit Semwal
Hi All,
Quoted 18 lines · Maxime Ripard
Quoted 16 lines · Jason Gunthorpe
Quoted 14 lines · Christoph Hellwig
Quoted 5 lines · T.J. Mercier
After commit
fd55edff8a0a("dma-buf: heaps: system: Turn the heap into a module") the system dma-buf heaps can be built as a module. Thesystem_cc_sharedheap usesset_memory_encryptedandset_memory_decryptedbut those functions are not exported on powerpc. This can result in a build error like:I'd much rather revert the above commit. Yes, x86 has exported these since 2017, but that's a really bad idea, and we should fix it instead of spreading the export.
Setting memory decrypted is a dangerous operations and should only be available to core code. We should have various allocators for decrypted code, but not export the functionality to random code.
Quoted 7 lines
Quoted 3 lines
At the very least an
EXPORT_SYMBOL_NS.Looks like there are about 3 modules using it already..
So, I'm not really sure how to fix this now. Should we revert the patch making the system heap a module, or should we export the symbols for all archs?
Quoted 5 lines
Given that Christoph's objection is not really about the modules part, but that the set_memory_{encrypted,decrypted} should not be used here, one option is to revert
78b30c50a7acuntil that issue is sorted out?Jiri, any thoughts from you?
Argh, I'm sorry I missed that some modules are already using it. I apologise!
Christoph, is there a way we could accept the symbols export for other archs if the arch maintainers are ok? Heiko seemed ok for S390, so this needs agreement for powerpc.
Quoted 5 lines
Quoted 2 lines
Maxime
Best,
Sumit.
Best,
Sumit
Quoted 3 lines · Sumit Semwal
Given that Christoph's objection is not really about the modules part, but that the set_memory_{encrypted,decrypted} should not be used here, one option is to revert
78b30c50a7acuntil that issue is sorted out?
Please no, we have stuff already using this so it would be a functional regression. Revert making heaps into a module since that doesn't have a functional regression.
Jason
Hi Jason,
Quoted 10 lines · Jason Gunthorpe
Quoted 3 lines · Sumit Semwal
Given that Christoph's objection is not really about the modules part, but that the set_memory_{encrypted,decrypted} should not be used here, one option is to revert
78b30c50a7acuntil that issue is sorted out?Please no, we have stuff already using this so it would be a functional regression. Revert making heaps into a module since that doesn't have a functional regression.
Thanks for your comments.
To me, it looks like while system and system_cc_shared heaps share a lot of code, their user bases have different needs. It's apparent that system_cc_heap users don't care about it being a module while system heap users would very much like so.
I also discussed this with Arnd, and he suggested we could rearrange the code so that system_heap_cc_shared_priv depends on a new Kconfig symbol like
config DMABUF_HEAPS_CC_SYSTEM
bool "DMA-BUF System Heap for memory encryption" depends on ARCH_HAS_MEM_ENCRYPT && DMABUF_HEAPS_SYSTEM=y
This allows building both into the kernel or leave encryption choice up to the consumers of the system heap.
If this is agreeable to everyone, I can post Arnd's patch.
Quoted 2 lines
Jason
Best,
Sumit.
Quoted 25 lines · Sumit Semwal
Hi Jason,
Quoted 10 lines · Jason Gunthorpe
Quoted 3 lines · Sumit Semwal
Given that Christoph's objection is not really about the modules part, but that the set_memory_{encrypted,decrypted} should not be used here, one option is to revert
78b30c50a7acuntil that issue is sorted out?Please no, we have stuff already using this so it would be a functional regression. Revert making heaps into a module since that doesn't have a functional regression.
Thanks for your comments.
To me, it looks like while system and
system_cc_sharedheaps share a lot of code, their user bases have different needs. It's apparent thatsystem_cc_heapusers don't care about it being a module while system heap users would very much like so.I also discussed this with Arnd, and he suggested we could rearrange the code so that
system_heap_cc_shared_privdepends on a newKconfigsymbol like
Quoted 8 lines
config
DMABUF_HEAPS_CC_SYSTEM
bool "DMA-BUF System Heap for memory encryption" depends onARCH_HAS_MEM_ENCRYPT&& DMABUF_HEAPS_SYSTEM=yThis allows building both into the kernel or leave encryption choice up to the consumers of the system heap.
If this is agreeable to everyone, I can post Arnd's patch.
Yeah, that's fine for me for now
Jason
Quoted 31 lines · Jason Gunthorpe
Quoted 29 lines · Sumit Semwal
Hi Jason,
Quoted 10 lines · Jason Gunthorpe
Quoted 3 lines · Sumit Semwal
Given that Christoph's objection is not really about the modules part, but that the set_memory_{encrypted,decrypted} should not be used here, one option is to revert
78b30c50a7acuntil that issue is sorted out?Please no, we have stuff already using this so it would be a functional regression. Revert making heaps into a module since that doesn't have a functional regression.
Thanks for your comments.
To me, it looks like while system and
system_cc_sharedheaps share a lot of code, their user bases have different needs. It's apparent thatsystem_cc_heapusers don't care about it being a module while system heap users would very much like so.I also discussed this with Arnd, and he suggested we could rearrange the code so that
system_heap_cc_shared_privdepends on a newKconfigsymbol likeconfig
DMABUF_HEAPS_CC_SYSTEM
bool "DMA-BUF System Heap for memory encryption" depends onARCH_HAS_MEM_ENCRYPT&& DMABUF_HEAPS_SYSTEM=y
Quoted 8 lines
Quoted 4 lines
This allows building both into the kernel or leave encryption choice up to the consumers of the system heap.
If this is agreeable to everyone, I can post Arnd's patch.
Yeah, that's fine for me for now
Jason
+1 SGTM
Thanks,
T.J.
Quoted 25 lines · Mon, Jun 08, 2026 at 05:17:15PM +0200, [email protected] wrote:
Hi Jason,
Quoted 10 lines · Jason Gunthorpe
Quoted 3 lines · Sumit Semwal
Given that Christoph's objection is not really about the modules part, but that the set_memory_{encrypted,decrypted} should not be used here, one option is to revert
78b30c50a7acuntil that issue is sorted out?Please no, we have stuff already using this so it would be a functional regression. Revert making heaps into a module since that doesn't have a functional regression.
Thanks for your comments.
To me, it looks like while system and
system_cc_sharedheaps share a lot of code, their user bases have different needs. It's apparent thatsystem_cc_heapusers don't care about it being a module while system heap users would very much like so.I also discussed this with Arnd, and he suggested we could rearrange the code so that
system_heap_cc_shared_privdepends on a newKconfigsymbol like
Quoted 8 lines
config
DMABUF_HEAPS_CC_SYSTEM
bool "DMA-BUF System Heap for memory encryption" depends onARCH_HAS_MEM_ENCRYPT&& DMABUF_HEAPS_SYSTEM=yThis allows building both into the kernel or leave encryption choice up to the consumers of the system heap.
If this is agreeable to everyone, I can post Arnd's patch.
Sounds good to me. Thanks!
Quoted 25 lines · Sumit Semwal
Hi Jason,
Quoted 10 lines · Jason Gunthorpe
Quoted 3 lines · Sumit Semwal
Given that Christoph's objection is not really about the modules part, but that the set_memory_{encrypted,decrypted} should not be used here, one option is to revert
78b30c50a7acuntil that issue is sorted out?Please no, we have stuff already using this so it would be a functional regression. Revert making heaps into a module since that doesn't have a functional regression.
Thanks for your comments.
To me, it looks like while system and
system_cc_sharedheaps share a lot of code, their user bases have different needs. It's apparent thatsystem_cc_heapusers don't care about it being a module while system heap users would very much like so.I also discussed this with Arnd, and he suggested we could rearrange the code so that
system_heap_cc_shared_privdepends on a newKconfigsymbol like
Quoted 8 lines
config
DMABUF_HEAPS_CC_SYSTEM
bool "DMA-BUF System Heap for memory encryption" depends onARCH_HAS_MEM_ENCRYPT&& DMABUF_HEAPS_SYSTEM=yThis allows building both into the kernel or leave encryption choice up to the consumers of the system heap.
If this is agreeable to everyone, I can post Arnd's patch.
It would be the perfect compromise, thanks!
Maxime