简体   繁体   English

用户态应用程序中使用的 mincore 系统调用是什么?

[英]What is the mincore syscall used for in userland applications?

What is Linux' mincore(2) useful for in userland applications? Linux 的mincore(2)在用户态应用程序中有什么用? Why is it exposed to non-privileged users?为什么它会暴露给非特权用户?

I can imagine some databases taking advantage of knowing which pages are cached but what are some other examples?我可以想象一些数据库利用知道缓存了哪些页面,但还有哪些其他示例?

What is Linux mincore(2) useful for in userland applications? Linux mincore(2)在用户态应用程序中有什么用?

I'd say that's most probably opinion based.我会说这很可能是基于意见的。 Profiling, statistics, performance evaluation and stuff like that comes to mind.分析、统计、性能评估和类似的东西浮现在脑海中。 Other than that, I cannot think of other realistic legitimate use cases.除此之外,我想不出其他现实的合法用例。

Here are some examples of programs I found that use mincore (as you can see, all profiling/statistics related):以下是我发现的一些使用mincore的程序示例(如您所见,所有分析/统计相关):

Why is it exposed to non-privileged users?为什么它会暴露给非特权用户?

This would have actually been a good question around one year ago , when the syscall's semantics weren't clearly defined, and the existence of such a syscall was rather questionable.这实际上是大约一年前的一个好问题,当时系统调用的语义没有明确定义,而且这样一个系统调用的存在是相当值得怀疑的。 Prior to kernel version 4.14.2 mincore could in fact have been abused to leak uninitialized kernel memory from user space (see CVE-2017-16994 and the relative Project Zero bug report ).在内核版本 4.14.2 之前, mincore实际上可能被滥用以从用户空间泄漏未初始化的内核内存(请参阅CVE-2017-16994和相关的 零项目错误报告)。

Since then the syscall has been patched and its semantics updated.从那时起,系统调用已被修补并更新了其语义。 The only thing that a process can do by invoking it is to query information about its virtual memory map.进程通过调用它可以做的唯一事情就是查询有关其虚拟内存映射的信息。 Nothing harmful really, just self-inspection, hence the availability to unprivileged processes.没有什么真正有害的,只是自我检查,因此可以用于非特权进程。 There's no real reason to make it a privileged syscall, which if done could be also considered an API breakage.没有真正的理由让它成为特权系统调用,如果这样做也可以被视为 API 破坏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM