[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 2/3] plat/kvm: 4k-granularity page table for the first 2MB
The main effect is that trying to read or write from the null pointer or very low addresses (that are almost invariably errors) now leads to a page fault instead of silently writing to addresses. Basically, the behavior C programmers expect when writing userspace applications. The only holes we punch in the first MB are for where multiboot puts its information, and for the VGA buffer. Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx> Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx> --- plat/kvm/x86/pagetable.S | 280 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 278 insertions(+), 2 deletions(-) diff --git a/plat/kvm/x86/pagetable.S b/plat/kvm/x86/pagetable.S index f7fd822e..6911dd2c 100644 --- a/plat/kvm/x86/pagetable.S +++ b/plat/kvm/x86/pagetable.S @@ -8,7 +8,7 @@ * * Copyright (c) 2015-2017 IBM * Copyright (c) 2016-2017 Docker, Inc. - * Copyright (c) 2017 NEC Europe Ltd., NEC Corporation + * Copyright (c) 2017-2019 NEC Europe Ltd., NEC Corporation * * Permission to use, copy, modify, and/or distribute this software * for any purpose with or without fee is hereby granted, provided @@ -31,12 +31,288 @@ * bigger than that, feel free to fix. */ +#define PAGETABLE_RO 0x1 #define PAGETABLE_RW 0x3 #define PAGETABLE_LARGEPAGE 0x80 +.align 0x1000 +cpu_zeropt: + /* the first 1M is inaccessible, except for: + 0x09000 - 0x09fff -> multiboot info @ 0x09500 (read-only) + 0xb8000 - 0xbffff -> VGA buffer (read+write) + */ + .fill 0x9, 0x8, 0x0 + .quad 0x0000000000009000 + PAGETABLE_RO + .fill 0xae, 0x8, 0x0 + .quad 0x00000000000b8000 + PAGETABLE_RW + .quad 0x00000000000b9000 + PAGETABLE_RW + .quad 0x00000000000ba000 + PAGETABLE_RW + .quad 0x00000000000bb000 + PAGETABLE_RW + .quad 0x00000000000bc000 + PAGETABLE_RW + .quad 0x00000000000bd000 + PAGETABLE_RW + .quad 0x00000000000be000 + PAGETABLE_RW + .quad 0x00000000000bf000 + PAGETABLE_RW + .fill 0x40, 0x8, 0x0 + .quad 0x00000000000100000 + PAGETABLE_RW + .quad 0x00000000000101000 + PAGETABLE_RW + .quad 0x00000000000102000 + PAGETABLE_RW + .quad 0x00000000000103000 + PAGETABLE_RW + .quad 0x00000000000104000 + PAGETABLE_RW + .quad 0x00000000000105000 + PAGETABLE_RW + .quad 0x00000000000106000 + PAGETABLE_RW + .quad 0x00000000000107000 + PAGETABLE_RW + .quad 0x00000000000108000 + PAGETABLE_RW + .quad 0x00000000000109000 + PAGETABLE_RW + .quad 0x0000000000010a000 + PAGETABLE_RW + .quad 0x0000000000010b000 + PAGETABLE_RW + .quad 0x0000000000010c000 + PAGETABLE_RW + .quad 0x0000000000010d000 + PAGETABLE_RW + .quad 0x0000000000010e000 + PAGETABLE_RW + .quad 0x0000000000010f000 + PAGETABLE_RW + .quad 0x00000000000110000 + PAGETABLE_RW + .quad 0x00000000000111000 + PAGETABLE_RW + .quad 0x00000000000112000 + PAGETABLE_RW + .quad 0x00000000000113000 + PAGETABLE_RW + .quad 0x00000000000114000 + PAGETABLE_RW + .quad 0x00000000000115000 + PAGETABLE_RW + .quad 0x00000000000116000 + PAGETABLE_RW + .quad 0x00000000000117000 + PAGETABLE_RW + .quad 0x00000000000118000 + PAGETABLE_RW + .quad 0x00000000000119000 + PAGETABLE_RW + .quad 0x0000000000011a000 + PAGETABLE_RW + .quad 0x0000000000011b000 + PAGETABLE_RW + .quad 0x0000000000011c000 + PAGETABLE_RW + .quad 0x0000000000011d000 + PAGETABLE_RW + .quad 0x0000000000011e000 + PAGETABLE_RW + .quad 0x0000000000011f000 + PAGETABLE_RW + .quad 0x00000000000120000 + PAGETABLE_RW + .quad 0x00000000000121000 + PAGETABLE_RW + .quad 0x00000000000122000 + PAGETABLE_RW + .quad 0x00000000000123000 + PAGETABLE_RW + .quad 0x00000000000124000 + PAGETABLE_RW + .quad 0x00000000000125000 + PAGETABLE_RW + .quad 0x00000000000126000 + PAGETABLE_RW + .quad 0x00000000000127000 + PAGETABLE_RW + .quad 0x00000000000128000 + PAGETABLE_RW + .quad 0x00000000000129000 + PAGETABLE_RW + .quad 0x0000000000012a000 + PAGETABLE_RW + .quad 0x0000000000012b000 + PAGETABLE_RW + .quad 0x0000000000012c000 + PAGETABLE_RW + .quad 0x0000000000012d000 + PAGETABLE_RW + .quad 0x0000000000012e000 + PAGETABLE_RW + .quad 0x0000000000012f000 + PAGETABLE_RW + .quad 0x00000000000130000 + PAGETABLE_RW + .quad 0x00000000000131000 + PAGETABLE_RW + .quad 0x00000000000132000 + PAGETABLE_RW + .quad 0x00000000000133000 + PAGETABLE_RW + .quad 0x00000000000134000 + PAGETABLE_RW + .quad 0x00000000000135000 + PAGETABLE_RW + .quad 0x00000000000136000 + PAGETABLE_RW + .quad 0x00000000000137000 + PAGETABLE_RW + .quad 0x00000000000138000 + PAGETABLE_RW + .quad 0x00000000000139000 + PAGETABLE_RW + .quad 0x0000000000013a000 + PAGETABLE_RW + .quad 0x0000000000013b000 + PAGETABLE_RW + .quad 0x0000000000013c000 + PAGETABLE_RW + .quad 0x0000000000013d000 + PAGETABLE_RW + .quad 0x0000000000013e000 + PAGETABLE_RW + .quad 0x0000000000013f000 + PAGETABLE_RW + .quad 0x00000000000140000 + PAGETABLE_RW + .quad 0x00000000000141000 + PAGETABLE_RW + .quad 0x00000000000142000 + PAGETABLE_RW + .quad 0x00000000000143000 + PAGETABLE_RW + .quad 0x00000000000144000 + PAGETABLE_RW + .quad 0x00000000000145000 + PAGETABLE_RW + .quad 0x00000000000146000 + PAGETABLE_RW + .quad 0x00000000000147000 + PAGETABLE_RW + .quad 0x00000000000148000 + PAGETABLE_RW + .quad 0x00000000000149000 + PAGETABLE_RW + .quad 0x0000000000014a000 + PAGETABLE_RW + .quad 0x0000000000014b000 + PAGETABLE_RW + .quad 0x0000000000014c000 + PAGETABLE_RW + .quad 0x0000000000014d000 + PAGETABLE_RW + .quad 0x0000000000014e000 + PAGETABLE_RW + .quad 0x0000000000014f000 + PAGETABLE_RW + .quad 0x00000000000150000 + PAGETABLE_RW + .quad 0x00000000000151000 + PAGETABLE_RW + .quad 0x00000000000152000 + PAGETABLE_RW + .quad 0x00000000000153000 + PAGETABLE_RW + .quad 0x00000000000154000 + PAGETABLE_RW + .quad 0x00000000000155000 + PAGETABLE_RW + .quad 0x00000000000156000 + PAGETABLE_RW + .quad 0x00000000000157000 + PAGETABLE_RW + .quad 0x00000000000158000 + PAGETABLE_RW + .quad 0x00000000000159000 + PAGETABLE_RW + .quad 0x0000000000015a000 + PAGETABLE_RW + .quad 0x0000000000015b000 + PAGETABLE_RW + .quad 0x0000000000015c000 + PAGETABLE_RW + .quad 0x0000000000015d000 + PAGETABLE_RW + .quad 0x0000000000015e000 + PAGETABLE_RW + .quad 0x0000000000015f000 + PAGETABLE_RW + .quad 0x00000000000160000 + PAGETABLE_RW + .quad 0x00000000000161000 + PAGETABLE_RW + .quad 0x00000000000162000 + PAGETABLE_RW + .quad 0x00000000000163000 + PAGETABLE_RW + .quad 0x00000000000164000 + PAGETABLE_RW + .quad 0x00000000000165000 + PAGETABLE_RW + .quad 0x00000000000166000 + PAGETABLE_RW + .quad 0x00000000000167000 + PAGETABLE_RW + .quad 0x00000000000168000 + PAGETABLE_RW + .quad 0x00000000000169000 + PAGETABLE_RW + .quad 0x0000000000016a000 + PAGETABLE_RW + .quad 0x0000000000016b000 + PAGETABLE_RW + .quad 0x0000000000016c000 + PAGETABLE_RW + .quad 0x0000000000016d000 + PAGETABLE_RW + .quad 0x0000000000016e000 + PAGETABLE_RW + .quad 0x0000000000016f000 + PAGETABLE_RW + .quad 0x00000000000170000 + PAGETABLE_RW + .quad 0x00000000000171000 + PAGETABLE_RW + .quad 0x00000000000172000 + PAGETABLE_RW + .quad 0x00000000000173000 + PAGETABLE_RW + .quad 0x00000000000174000 + PAGETABLE_RW + .quad 0x00000000000175000 + PAGETABLE_RW + .quad 0x00000000000176000 + PAGETABLE_RW + .quad 0x00000000000177000 + PAGETABLE_RW + .quad 0x00000000000178000 + PAGETABLE_RW + .quad 0x00000000000179000 + PAGETABLE_RW + .quad 0x0000000000017a000 + PAGETABLE_RW + .quad 0x0000000000017b000 + PAGETABLE_RW + .quad 0x0000000000017c000 + PAGETABLE_RW + .quad 0x0000000000017d000 + PAGETABLE_RW + .quad 0x0000000000017e000 + PAGETABLE_RW + .quad 0x0000000000017f000 + PAGETABLE_RW + .quad 0x00000000000180000 + PAGETABLE_RW + .quad 0x00000000000181000 + PAGETABLE_RW + .quad 0x00000000000182000 + PAGETABLE_RW + .quad 0x00000000000183000 + PAGETABLE_RW + .quad 0x00000000000184000 + PAGETABLE_RW + .quad 0x00000000000185000 + PAGETABLE_RW + .quad 0x00000000000186000 + PAGETABLE_RW + .quad 0x00000000000187000 + PAGETABLE_RW + .quad 0x00000000000188000 + PAGETABLE_RW + .quad 0x00000000000189000 + PAGETABLE_RW + .quad 0x0000000000018a000 + PAGETABLE_RW + .quad 0x0000000000018b000 + PAGETABLE_RW + .quad 0x0000000000018c000 + PAGETABLE_RW + .quad 0x0000000000018d000 + PAGETABLE_RW + .quad 0x0000000000018e000 + PAGETABLE_RW + .quad 0x0000000000018f000 + PAGETABLE_RW + .quad 0x00000000000190000 + PAGETABLE_RW + .quad 0x00000000000191000 + PAGETABLE_RW + .quad 0x00000000000192000 + PAGETABLE_RW + .quad 0x00000000000193000 + PAGETABLE_RW + .quad 0x00000000000194000 + PAGETABLE_RW + .quad 0x00000000000195000 + PAGETABLE_RW + .quad 0x00000000000196000 + PAGETABLE_RW + .quad 0x00000000000197000 + PAGETABLE_RW + .quad 0x00000000000198000 + PAGETABLE_RW + .quad 0x00000000000199000 + PAGETABLE_RW + .quad 0x0000000000019a000 + PAGETABLE_RW + .quad 0x0000000000019b000 + PAGETABLE_RW + .quad 0x0000000000019c000 + PAGETABLE_RW + .quad 0x0000000000019d000 + PAGETABLE_RW + .quad 0x0000000000019e000 + PAGETABLE_RW + .quad 0x0000000000019f000 + PAGETABLE_RW + .quad 0x000000000001a0000 + PAGETABLE_RW + .quad 0x000000000001a1000 + PAGETABLE_RW + .quad 0x000000000001a2000 + PAGETABLE_RW + .quad 0x000000000001a3000 + PAGETABLE_RW + .quad 0x000000000001a4000 + PAGETABLE_RW + .quad 0x000000000001a5000 + PAGETABLE_RW + .quad 0x000000000001a6000 + PAGETABLE_RW + .quad 0x000000000001a7000 + PAGETABLE_RW + .quad 0x000000000001a8000 + PAGETABLE_RW + .quad 0x000000000001a9000 + PAGETABLE_RW + .quad 0x000000000001aa000 + PAGETABLE_RW + .quad 0x000000000001ab000 + PAGETABLE_RW + .quad 0x000000000001ac000 + PAGETABLE_RW + .quad 0x000000000001ad000 + PAGETABLE_RW + .quad 0x000000000001ae000 + PAGETABLE_RW + .quad 0x000000000001af000 + PAGETABLE_RW + .quad 0x000000000001b0000 + PAGETABLE_RW + .quad 0x000000000001b1000 + PAGETABLE_RW + .quad 0x000000000001b2000 + PAGETABLE_RW + .quad 0x000000000001b3000 + PAGETABLE_RW + .quad 0x000000000001b4000 + PAGETABLE_RW + .quad 0x000000000001b5000 + PAGETABLE_RW + .quad 0x000000000001b6000 + PAGETABLE_RW + .quad 0x000000000001b7000 + PAGETABLE_RW + .quad 0x000000000001b8000 + PAGETABLE_RW + .quad 0x000000000001b9000 + PAGETABLE_RW + .quad 0x000000000001ba000 + PAGETABLE_RW + .quad 0x000000000001bb000 + PAGETABLE_RW + .quad 0x000000000001bc000 + PAGETABLE_RW + .quad 0x000000000001bd000 + PAGETABLE_RW + .quad 0x000000000001be000 + PAGETABLE_RW + .quad 0x000000000001bf000 + PAGETABLE_RW + .quad 0x000000000001c0000 + PAGETABLE_RW + .quad 0x000000000001c1000 + PAGETABLE_RW + .quad 0x000000000001c2000 + PAGETABLE_RW + .quad 0x000000000001c3000 + PAGETABLE_RW + .quad 0x000000000001c4000 + PAGETABLE_RW + .quad 0x000000000001c5000 + PAGETABLE_RW + .quad 0x000000000001c6000 + PAGETABLE_RW + .quad 0x000000000001c7000 + PAGETABLE_RW + .quad 0x000000000001c8000 + PAGETABLE_RW + .quad 0x000000000001c9000 + PAGETABLE_RW + .quad 0x000000000001ca000 + PAGETABLE_RW + .quad 0x000000000001cb000 + PAGETABLE_RW + .quad 0x000000000001cc000 + PAGETABLE_RW + .quad 0x000000000001cd000 + PAGETABLE_RW + .quad 0x000000000001ce000 + PAGETABLE_RW + .quad 0x000000000001cf000 + PAGETABLE_RW + .quad 0x000000000001d0000 + PAGETABLE_RW + .quad 0x000000000001d1000 + PAGETABLE_RW + .quad 0x000000000001d2000 + PAGETABLE_RW + .quad 0x000000000001d3000 + PAGETABLE_RW + .quad 0x000000000001d4000 + PAGETABLE_RW + .quad 0x000000000001d5000 + PAGETABLE_RW + .quad 0x000000000001d6000 + PAGETABLE_RW + .quad 0x000000000001d7000 + PAGETABLE_RW + .quad 0x000000000001d8000 + PAGETABLE_RW + .quad 0x000000000001d9000 + PAGETABLE_RW + .quad 0x000000000001da000 + PAGETABLE_RW + .quad 0x000000000001db000 + PAGETABLE_RW + .quad 0x000000000001dc000 + PAGETABLE_RW + .quad 0x000000000001dd000 + PAGETABLE_RW + .quad 0x000000000001de000 + PAGETABLE_RW + .quad 0x000000000001df000 + PAGETABLE_RW + .quad 0x000000000001e0000 + PAGETABLE_RW + .quad 0x000000000001e1000 + PAGETABLE_RW + .quad 0x000000000001e2000 + PAGETABLE_RW + .quad 0x000000000001e3000 + PAGETABLE_RW + .quad 0x000000000001e4000 + PAGETABLE_RW + .quad 0x000000000001e5000 + PAGETABLE_RW + .quad 0x000000000001e6000 + PAGETABLE_RW + .quad 0x000000000001e7000 + PAGETABLE_RW + .quad 0x000000000001e8000 + PAGETABLE_RW + .quad 0x000000000001e9000 + PAGETABLE_RW + .quad 0x000000000001ea000 + PAGETABLE_RW + .quad 0x000000000001eb000 + PAGETABLE_RW + .quad 0x000000000001ec000 + PAGETABLE_RW + .quad 0x000000000001ed000 + PAGETABLE_RW + .quad 0x000000000001ee000 + PAGETABLE_RW + .quad 0x000000000001ef000 + PAGETABLE_RW + .quad 0x000000000001f0000 + PAGETABLE_RW + .quad 0x000000000001f1000 + PAGETABLE_RW + .quad 0x000000000001f2000 + PAGETABLE_RW + .quad 0x000000000001f3000 + PAGETABLE_RW + .quad 0x000000000001f4000 + PAGETABLE_RW + .quad 0x000000000001f5000 + PAGETABLE_RW + .quad 0x000000000001f6000 + PAGETABLE_RW + .quad 0x000000000001f7000 + PAGETABLE_RW + .quad 0x000000000001f8000 + PAGETABLE_RW + .quad 0x000000000001f9000 + PAGETABLE_RW + .quad 0x000000000001fa000 + PAGETABLE_RW + .quad 0x000000000001fb000 + PAGETABLE_RW + .quad 0x000000000001fc000 + PAGETABLE_RW + .quad 0x000000000001fd000 + PAGETABLE_RW + .quad 0x000000000001fe000 + PAGETABLE_RW + .quad 0x000000000001ff000 + PAGETABLE_RW + .align 0x1000 cpu_pd: - .quad 0x0000000000000000 + PAGETABLE_RW + PAGETABLE_LARGEPAGE + .quad cpu_zeropt + PAGETABLE_RW .quad 0x0000000000200000 + PAGETABLE_RW + PAGETABLE_LARGEPAGE .quad 0x0000000000400000 + PAGETABLE_RW + PAGETABLE_LARGEPAGE .quad 0x0000000000600000 + PAGETABLE_RW + PAGETABLE_LARGEPAGE -- 2.21.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |