From 4d6cf71f67ddd77d9f20e4d9244fc00b309e6ce9 Mon Sep 17 00:00:00 2001 From: Alexander Kuleshov Date: Sun, 31 Jul 2022 16:13:01 +0600 Subject: [PATCH] theory: fix userspace bits related issue: #695 Thank you @m4p1e Signed-off-by: Alexander Kuleshov --- Theory/linux-theory-1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Theory/linux-theory-1.md b/Theory/linux-theory-1.md index f544da7..9a09a37 100644 --- a/Theory/linux-theory-1.md +++ b/Theory/linux-theory-1.md @@ -171,7 +171,7 @@ This solution is `sign extension`. Here we can see that the lower 48 bits of a v * Kernel space * Userspace -Userspace occupies the lower part of the virtual address space, from `0x000000000000000` to `0x00007fffffffffff` and kernel space occupies the highest part from `0xffff8000000000` to `0xffffffffffffffff`. Note that bits `63:48` is 0 for userspace and 1 for kernel space. All addresses which are in kernel space and in userspace or in other words which higher `63:48` bits are zeroes or ones are called `canonical` addresses. There is a `non-canonical` area between these memory regions. Together these two memory regions (kernel space and user space) are exactly `2^48` bits wide. We can find the virtual memory map with 4 level page tables in the [Documentation/x86/x86_64/mm.txt](https://github.com/torvalds/linux/blob/16f73eb02d7e1765ccab3d2018e0bd98eb93d973/Documentation/x86/x86_64/mm.txt): +Userspace occupies the lower part of the virtual address space, from `0x000000000000000` to `0x00007fffffffffff` and kernel space occupies the highest part from `0xffff8000000000` to `0xffffffffffffffff`. Note that bits `63:47` is 0 for userspace and 1 for kernel space. All addresses which are in kernel space and in userspace or in other words which higher `63:48` bits are zeroes or ones are called `canonical` addresses. There is a `non-canonical` area between these memory regions. Together these two memory regions (kernel space and user space) are exactly `2^48` bits wide. We can find the virtual memory map with 4 level page tables in the [Documentation/x86/x86_64/mm.txt](https://github.com/torvalds/linux/blob/16f73eb02d7e1765ccab3d2018e0bd98eb93d973/Documentation/x86/x86_64/mm.txt): ``` 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm