首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >__latent_entropy在C中是用来做什么的?

__latent_entropy在C中是用来做什么的?
EN

Stack Overflow用户
提问于 2021-08-29 18:13:00
回答 1查看 439关注 0票数 1

请理解在哪种情况下,我们在C函数签名中使用关键字__latent_entropy。我看到一些谷歌的结果谈到GCC插件,但我仍然不明白它的影响是什么。谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-08-29 19:14:24

您可以查看其描述latent_entropy GCC插件的功能(它还提到了它在Linux性能中的影响):

代码语言:javascript
运行
复制
config GCC_PLUGIN_LATENT_ENTROPY
    bool "Generate some entropy during boot and runtime"
    help
      By saying Y here the kernel will instrument some kernel code to
      extract some entropy from both original and artificially created
      program state.  This will help especially embedded systems where
      there is little 'natural' source of entropy normally.  The cost
      is some slowdown of the boot process (about 0.5%) and fork and
      irq processing.

      Note that entropy extracted this way is not cryptographically
      secure!

      This plugin was ported from grsecurity/PaX. More information at:
       * https://grsecurity.net/
       * https://pax.grsecurity.net/

这里你会发现一个更详细的描述latent_entropy GCC插件。摘自链接的一些内容:

代码语言:javascript
运行
复制
...

this is where the new gcc plugin comes in: we can instrument the kernel's
boot code to do some hash-like computation and extract some entropy from
whatever program state we decide to mix into that computation. a similar
idea has in fact been implemented by Larry Highsmith of Subreption fame
in http://www.phrack.org/issues.html?issue=66&id=15 where he (manually)
instrumented the kernel's boot code to extract entropy from a few kernel
variables such as time (jiffies) and context switch counts.

the latent entropy plugin takes this extraction to a whole new level. first,
we define a new global variable that we mix into the kernel's entropy pools
on each initcall. second, each initcall function (and all other boot-only
functions they call) gets instrumented to compute a 'random' number that
gets mixed into this global variable at the end of the function (you can
think of it as an artificially created return value that each instrumented
function computes for our purposes). the computation is a mix of add/xor/rol
(the happy recovery Halvar mix :) with compile-time chosen random constants
and the sequence of these operations follows the instrumented functions's
control flow graph. for the rest of the gory details see the source code ;).

...
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68975713

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档