如果通过近呼叫输入函数,它可以在不破坏退货地址预测的情况下进行远距离调用吗?
考虑此代码:
.globl _non_tail, _tail
.text
.code32
_non_tail:
lcall $0x33, $_non_tail.heavensgate
ret
.code64
_non_tail.heavensgate:
# do stuff. there's 12 bytes on the stack before the first argument
lret
.code32
_tail:
pushl (%esp)
movw %cs, 4(%esp)
ljmp $0x33, $_tail.heavensgate
.code64
_tail.heavensgate:
# do stuff. there's 8 bytes on the stack before the first argument
lret
_tail
会导致返回堆栈缓冲区错误地预测未来返回吗?一方面,它将近来的呼叫与遥远的回报配对,但另一方面,它仍然返回到通常相同的位置。
Consider this code:
.globl _non_tail, _tail
.text
.code32
_non_tail:
lcall $0x33, $_non_tail.heavensgate
ret
.code64
_non_tail.heavensgate:
# do stuff. there's 12 bytes on the stack before the first argument
lret
.code32
_tail:
pushl (%esp)
movw %cs, 4(%esp)
ljmp $0x33, $_tail.heavensgate
.code64
_tail.heavensgate:
# do stuff. there's 8 bytes on the stack before the first argument
lret
Will _tail
cause the return stack buffer to mispredict future returns? On the one hand, it's pairing a near call with a far return, but on the other hand, it's still returning to the exact same place that it would have normally.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论