错误:modpost “memset_s” [xxx/xxx/xxx.ko] 未定义

huangapple go评论149阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月29日 22:14:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76581905.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定