drgc9632 2018-09-25 02:33
浏览 88
已采纳

为什么Go中的堆是可执行的?

I recently read this article http://codearcana.com/posts/2012/05/06/securing-and-exploiting-go-binaries.html which claims in Go that the heap is executable. This raises a few different questions for me about the interaction between the runtime and the operating system.

In C, when a program needs space on the heap, it makes a call to malloc, which in turn calls sbrk which gives it memory. As far as I know in C the heap is read-write only.

Why is the heap in Go executable? What is different about the application - OS interaction in Go then in C?

Thanks

  • 写回答

2条回答 默认 最新

  • doutan5844 2018-09-25 04:38
    关注

    The heap is no longer executable.

    Code was generated at runtime for function literals prior to Go 1.1, thus requiring an executable heap. Function calls were revamped in Go 1.1 to eliminate the need for an executable heap and to provide other benefits.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭