英文:
ERROR: modpost "memset_s" [xxx/xxx/xxx.ko] undefined
问题
My Linux kernel version changed from 4.18 to 5.14 recently. When I compile one of my .ko files, I encountered some errors in the Makefile, perhaps. It informed me that ERROR: modpost "memset_s" [xxx/xxx/xxx.ko] undefined!
.
If I can add EXPORT_SYMBOL() in the source file, how can I solve this problem?
If I can't add EXPORT_SYMBOL() in the source code, how can I solve this problem?
英文:
My Linux kernal version change from 4.18 to 5.14 recently. When I compile one of my ko, I got some errors in Makefile maybe. It told me that ERROR: modpost "memset_s" [xxx/xxx/xxx.ko] undefined!
.
If I can add EXPORT_SYMBOL() in the source file, how can I solve this problem
If I can't add EXPORT_SYMBOL() in the source code, how can I solve this problem
答案1
得分: 2
对于大多数实际目的,memset_s()
和其他 _s
"安全" 函数只由 Microsoft 在 Windows 上实现。因此,memset_s()
几乎肯定不会在 Linux 内核中工作。(话虽如此,令人好奇的是它曾经工作过。)
对于在 Microsoft 以外实现这些函数存在相当多的抵抗。然而,C23 添加了函数 memset_explicit()
,它应该保证内存被设置 - 编译器不应该优化它。这对于清除内存中的密码等操作非常有价值。这个特性也是 memset_s()
规范要求的一部分。
另请参阅 Do you use the TR-24731 'safe' functions? 以获取有关 Annex K 函数的详细信息。
英文:
For most practical purposes, memset_s()
and the other _s
"safe" functions are only implemented by Microsoft on Windows. Therefore, memset_s()
almost certainly won't work in the Linux kernel. (Having said that, it is intriguing that it used to work.)
There is considerable resistance to implementing the functions outside of Microsoft. However, C23 adds the function memset_explicit()
, which is supposed to guarantee that the memory is set — the compiler is not supposed to optimize it out. That is valuable for zapping passwords in memory, for example. This property was also required by the specification of memset_s()
.
See also Do you use the TR-24731 'safe' functions? for considerable information about the Annex K functions.
答案2
得分: 0
memset_s
和相关函数可以通过safec库来使用。请注意,在该页面的中间部分有关于在Linux内核模块中使用它的特殊说明。
英文:
memset_s
and friends are available through the safec library. Note that there are special instructions halfway down this page on using this with Linux kernel modules.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论