What happens when a mov instruction causes a page fault with interrupts disabled on x86?

前端 未结 2 2114
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 03:29

I recently encountered an issue in a custom Linux kernel (2.6.31.5, x86) driver where copy_to_user would periodically not copy any bytes to user space. It would return the coun

2条回答
  •  醉酒成梦
    2021-02-13 03:40

    Page faults are not mask-able interrupts. In fact, they are not technically interrupts at all - but rather exceptions, although I agree the difference is more semantic.

    The reason your copy_to_user failed when you called it in atomic context with interrupts disabled is because the code has an explicit check for this.

    See http://lxr.free-electrons.com/source/arch/x86/lib/usercopy_32.c#L575

提交回复
热议问题