- 11 Feb, 2021 40 commits
-
-
Asynchronous KASAN mode doesn't guarantee that a tag fault will be detected immediately and causes tests to fail. Forbid running them in asynchronous mode. Signed-off-by:
Andrey Konovalov <andreyknvl@google.com> Signed-off-by:
Vincenzo Frascino <vincenzo.frascino@arm.com>
-
Vincenzo Frascino authored
When MTE async mode is enabled TFSR_EL1 contains the accumulative asynchronous tag check faults for EL1 and EL0. During the suspend/resume operations the firmware might perform some operations that could change the state of the register resulting in a spurious tag check fault report. Report asynchronous tag faults before suspend and clear the TFSR_EL1 register after resume to prevent this to happen. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by:
Vincenzo Frascino <vincenzo.frascino@arm.com>
-
Vincenzo Frascino authored
MTE provides a mode that asynchronously updates the TFSR_EL1 register when a tag check exception is detected. To take advantage of this mode the kernel has to verify the status of the register at: 1. Context switching 2. Return to user/EL0 (Not required in entry from EL0 since the kernel did not run) 3. Kernel entry from EL1 4. Kernel exit to EL1 If the register is non-zero a trace is reported. Add the required features for EL1 detection and reporting. Note: ITFSB bit is set in the SCTLR_EL1 register hence it guaranties that the indirect writes to TFSR_EL1 are synchronized at exception entry to EL1. On the context switch path the synchronization is guarantied by the dsb() in __switch_to(). The dsb(nsh) in mte_check_tfsr_exit() is provisional pending confirmation by the architects. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Reviewed-by:
Catalin Marinas <catalin.marinas@arm.com> Acked-by:
Andrey Konovalov <andreyknvl@google.com> Signed-off-by:
Vincenzo Frascino <vincenzo.frascino@arm.com>
-
Vincenzo Frascino authored
load_unaligned_zeropad() and __get/put_kernel_nofault() functions can read passed some buffer limits which may include some MTE granule with a different tag. When MTE async mode is enable, the load operation crosses the boundaries and the next granule has a different tag the PE sets the TFSR_EL1.TF1 bit as if an asynchronous tag fault is happened. Enable Tag Check Override (TCO) in these functions before the load and disable it afterwards to prevent this to happen. Note: The same condition can be hit in MTE sync mode but we deal with it through the exception handling. In the current implementation, mte_async_mode flag is set only at boot time but in future kasan might acquire some runtime features that that change the mode dynamically, hence we disable it when sync mode is selected for future proof. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Reported-by:
Branislav Rankov <Branislav.Rankov@arm.com> Tested-by:
Branislav Rankov <Branislav.Rankov@arm.com> Signed-off-by:
Vincenzo Frascino <vincenzo.frascino@arm.com>
-
Vincenzo Frascino authored
KASAN provides an asynchronous mode of execution. Add reporting functionality for this mode. Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Konovalov <andreyknvl@google.com> Reviewed-by:
Andrey Konovalov <andreyknvl@google.com> Signed-off-by:
Vincenzo Frascino <vincenzo.frascino@arm.com> Signed-off-by:
Andrey Konovalov <andreyknvl@google.com>
-
Vincenzo Frascino authored
Architectures supported by KASAN_HW_TAGS can provide a sync or async mode of execution. On an MTE enabled arm64 hw for example this can be identified with the synchronous or asynchronous tagging mode of execution. In synchronous mode, an exception is triggered if a tag check fault occurs. In asynchronous mode, if a tag check fault occurs, the TFSR_EL1 register is updated asynchronously. The kernel checks the corresponding bits periodically. KASAN requires a specific kernel command line parameter to make use of this hw features. Add KASAN HW execution mode kernel command line parameter. Note: This patch adds the kasan.mode kernel parameter and the sync/async kernel command line options to enable the described features. Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Konovalov <andreyknvl@google.com> Reviewed-by:
Andrey Konovalov <andreyknvl@google.com> Signed-off-by:
Vincenzo Frascino <vincenzo.frascino@arm.com> [ Add a new var instead of exposing kasan_arg_mode to be consistent with flags for other command line arguments. ] Signed-off-by:
Andrey Konovalov <andreyknvl@google.com>
-
Vincenzo Frascino authored
MTE provides an asynchronous mode for detecting tag exceptions. In particular instead of triggering a fault the arm64 core updates a register which is checked by the kernel after the asynchronous tag check fault has occurred. Add support for MTE asynchronous mode. The exception handling mechanism will be added with a future patch. Note: KASAN HW activates async mode via kasan.mode kernel parameter. The default mode is set to synchronous. The code that verifies the status of TFSR_EL1 will be added with a future patch. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Reviewed-by:
Catalin Marinas <catalin.marinas@arm.com> Reviewed-by:
Andrey Konovalov <andreyknvl@google.com> Signed-off-by:
Vincenzo Frascino <vincenzo.frascino@arm.com>
-
Vincenzo Frascino authored
The simplification of mte_get_random_tag() caused the introduction of the warning below: In file included from arch/arm64/include/asm/kasan.h:9, from include/linux/kasan.h:16, from mm/kasan/common.c:14: mm/kasan/common.c: In function ‘mte_get_random_tag’: arch/arm64/include/asm/mte-kasan.h:45:9: warning: ‘addr’ is used uninitialized [-Wuninitialized] 45 | asm(__MTE_PREAMBLE "irg %0, %0" | Fix the warning using "=r" for the address in the asm inline. Fixes: c8f8de4c ("arm64: kasan: simplify and inline MTE functions") Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Andrey Konovalov <andreyknvl@google.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Vincenzo Frascino <vincenzo.frascino@arm.com>
-
Huang Pei authored
MIPS page fault path(except huge page) takes 3 exceptions (1 TLB Miss + 2 TLB Invalid), butthe second TLB Invalid exception is just triggered by __update_tlb from do_page_fault writing tlb without _PAGE_VALID set. With this patch, user space mapping prot is made young by default (with both _PAGE_VALID and _PAGE_YOUNG set), and it only take 1 TLB Miss + 1 TLB Invalid exception Remove pte_sw_mkyoung without polluting MM code and make page fault delay of MIPS on par with other architecture Link: https://lkml.kernel.org/r/20210204013942.8398-1-huangpei@loongson.cn Signed-off-by:
Huang Pei <huangpei@loongson.cn> Reviewed-by:
Nicholas Piggin <npiggin@gmail.com> Acked-by: <huangpei@loongson.cn> Acked-by:
Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: <ambrosehua@gmail.com> Cc: Bibo Mao <maobibo@loongson.cn> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Paul Burton <paulburton@kernel.org> Cc: Li Xuefeng <lixuefeng@loongson.cn> Cc: Yang Tiezhu <yangtiezhu@loongson.cn> Cc: Gao Juxin <gaojuxin@loongson.cn> Cc: Fuxin Zhang <zhangfx@lemote.com> Cc: Huacai Chen <chenhc@lemote.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Stephen Rothwell <sfr@canb.auug.org.au>
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
# Conflicts: # drivers/nvmem/Kconfig
-
Stephen Rothwell authored
-
Stephen Rothwell authored
# Conflicts: # include/asm-generic/vmlinux.lds.h
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Stephen Rothwell authored
-
Wei Liu authored
Just like MSI/MSI-X, IO-APIC interrupts are remapped by Microsoft Hypervisor when Linux runs as the root partition. Implement an IRQ domain to handle mapping and unmapping of IO-APIC interrupts. Signed-off-by:
Wei Liu <wei.liu@kernel.org> Acked-by:
Joerg Roedel <joro@8bytes.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-17-wei.liu@kernel.org
-
Wei Liu authored
When Linux runs as the root partition on Microsoft Hypervisor, its interrupts are remapped. Linux will need to explicitly map and unmap interrupts for hardware. Implement an MSI domain to issue the correct hypercalls. And initialize this irq domain as the default MSI irq domain. Signed-off-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Co-Developed-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-16-wei.liu@kernel.org
-
Wei Liu authored
Signed-off-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Co-Developed-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-15-wei.liu@kernel.org
-
Wei Liu authored
We will need to identify the device we want Microsoft Hypervisor to manipulate. Introduce the data structures for that purpose. They will be used in a later patch. Signed-off-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Co-Developed-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-14-wei.liu@kernel.org
-
Wei Liu authored
We will soon use the same structure to handle IO-APIC interrupts as well. Introduce an enum to identify the source and a data structure for IO-APIC RTE. While at it, update pci-hyperv.c to use the enum. No functional change. Signed-off-by:
Wei Liu <wei.liu@kernel.org> Acked-by:
Rob Herring <robh@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-13-wei.liu@kernel.org
-
Wei Liu authored
We will soon need to access fields inside the MSI address and MSI data fields. Introduce hv_msi_address_register and hv_msi_data_register. Fix up one user of hv_msi_entry in mshyperv.h. No functional change expected. Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-12-wei.liu@kernel.org
-
Wei Liu authored
Microsoft Hypervisor requires the root partition to make a few hypercalls to setup application processors before they can be used. Signed-off-by:
Lillian Grassin-Drake <ligrassi@microsoft.com> Signed-off-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Co-Developed-by:
Lillian Grassin-Drake <ligrassi@microsoft.com> Co-Developed-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-11-wei.liu@kernel.org
-
Wei Liu authored
They are used to deposit pages into Microsoft Hypervisor and bring up logical and virtual processors. Signed-off-by:
Lillian Grassin-Drake <ligrassi@microsoft.com> Signed-off-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Signed-off-by:
Nuno Das Neves <nunodasneves@linux.microsoft.com> Co-Developed-by:
Lillian Grassin-Drake <ligrassi@microsoft.com> Co-Developed-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Co-Developed-by:
Nuno Das Neves <nunodasneves@linux.microsoft.com> Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-10-wei.liu@kernel.org
-
Wei Liu authored
There is already a stub function for pxm_to_node but conversion to the other direction is missing. It will be used by Microsoft Hypervisor code later. Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Acked-by:
"Rafael J. Wysocki" <rafael@kernel.org> Link: https://lore.kernel.org/r/20210203150435.27941-9-wei.liu@kernel.org
-
Wei Liu authored
When Linux is running as the root partition, the hypercall page will have already been setup by Hyper-V. Copy the content over to the allocated page. Add checks to hv_suspend & co to bail early because they are not supported in this setup yet. Signed-off-by:
Lillian Grassin-Drake <ligrassi@microsoft.com> Signed-off-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Signed-off-by:
Nuno Das Neves <nunodasneves@linux.microsoft.com> Co-Developed-by:
Lillian Grassin-Drake <ligrassi@microsoft.com> Co-Developed-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Co-Developed-by:
Nuno Das Neves <nunodasneves@linux.microsoft.com> Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-8-wei.liu@kernel.org
-
Wei Liu authored
We will need the partition ID for executing some hypercalls later. Signed-off-by:
Lillian Grassin-Drake <ligrassi@microsoft.com> Co-Developed-by:
Sunil Muthuswamy <sunilmut@microsoft.com> Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-7-wei.liu@kernel.org
-
Wei Liu authored
When Linux runs as the root partition, it will need to make hypercalls which return data from the hypervisor. Allocate pages for storing results when Linux runs as the root partition. Signed-off-by:
Lillian Grassin-Drake <ligrassi@microsoft.com> Co-Developed-by:
Lillian Grassin-Drake <ligrassi@microsoft.com> Signed-off-by:
Wei Liu <wei.liu@kernel.org> Reviewed-by:
Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-6-wei.liu@kernel.org
-