| /linux/kernel/livepatch/ |
| H A D | shadow.c | 3 * shadow.c - Shadow Variables 11 * DOC: Shadow variable API concurrency notes: 13 * The shadow variable API provides a simple relationship between an 15 * caller to provide any mutual exclusion required of the shadow data. 17 * Once a shadow variable is attached to its parent object via the 19 * call to klp_shadow_get() may then return the shadow variable's data 20 * pointer. Callers of klp_shadow_*alloc() should prepare shadow data 23 * The klp_shadow_*alloc() API calls may allocate memory for new shadow 42 * the shadow variables it references. 47 * struct klp_shadow - shadow variable structure [all …]
|
| /linux/Documentation/livepatch/ |
| H A D | shadow-vars.rst | 2 Shadow Variables 5 Shadow variables are a simple way for livepatch modules to associate 6 additional "shadow" data with existing data structures. Shadow data is 8 unmodified. The shadow variable API described in this document is used 9 to allocate/add and remove/free shadow variables to/from their parents. 13 shadow data. The numeric identifier is a simple enumeration that may be 14 used to describe shadow variable version, class or type, etc. More 16 numeric id subsequently filters hashtable queries. Multiple shadow 24 (See the full API usage docbook notes in livepatch/shadow.c.) 26 A hashtable references all shadow variables. These references are [all …]
|
| /linux/drivers/gpu/drm/xe/ |
| H A D | xe_mem_pool.c | 29 * a shadow BO that can be used for atomic updates to the primary BO's contents. 33 * primary and shadow BOs as needed. 40 /** @shadow: Shadow BO for atomic command updates. */ 41 struct xe_bo *shadow; member 42 /** @swap_guard: Timeline guard updating @bo and @shadow */ 74 struct xe_bo *shadow; in pool_shadow_init() local 77 xe_assert(xe, !pool->shadow); in pool_shadow_init() 88 shadow = xe_managed_bo_create_pin_map(xe, tile, in pool_shadow_init() 94 if (IS_ERR(shadow)) in pool_shadow_init() 95 return PTR_ERR(shadow); in pool_shadow_init() [all …]
|
| /linux/arch/riscv/kernel/ |
| H A D | usercfi.c | 112 * The shadow stack only stores the return address and not any variables 125 * Writes on shadow stack can either be `sspush` or `ssamoswap`. `sspush` can happen 126 * implicitly on current shadow stack pointed to by CSR_SSP. `ssamoswap` takes pointer to 127 * shadow stack. To keep it simple, we plan to use `ssamoswap` to perform writes on shadow 133 * Never expect -1 on shadow stack. Expect return addresses and zero in amo_user_shstk() 156 * Create a restore token on the shadow stack. A token is always XLEN wide 180 * Save user shadow stack pointer on the shadow stack itself and return a pointer to saved location. 204 * Restores the user shadow stack pointer from the token on the shadow stack for task 'tsk'. 265 * which perform writes to CSR_SSP properly, shadow stack pivoting is not possible. Since in SYSCALL_DEFINE3() 266 * CSR_SSP is writable by user mode, it itself can setup a shadow stack token subsequent in SYSCALL_DEFINE3() [all …]
|
| H A D | signal.c | 155 * Save a pointer to the shadow stack itself on shadow stack as a form of token. in save_cfiss_state() 156 * A token on the shadow stack gives the following properties: in save_cfiss_state() 157 * - Safe save and restore for shadow stack switching. Any save of a shadow stack in save_cfiss_state() 158 * must have saved a token on the shadow stack. Similarly any restore of shadow in save_cfiss_state() 159 * stack must check the token before restore. Since writing to the shadow stack with in save_cfiss_state() 160 * address of the shadow stack itself is not easily allowed, a restore without a save in save_cfiss_state() 162 * - A natural break. A token in shadow stack provides a natural break in shadow stack in save_cfiss_state() 163 * So a single linear range can be bucketed into different shadow stack segments. Any in save_cfiss_state() 181 * Restore shadow stack as a form of token stored on the shadow stack itself as a safe in __restore_cfiss_state() 183 * A token on the shadow stack gives the following properties: in __restore_cfiss_state() [all …]
|
| /linux/drivers/scsi/ |
| H A D | xen-scsifront.c | 121 struct vscsifrnt_shadow *shadow[VSCSIIF_MAX_REQS]; member 163 info->shadow[id] = NULL; in _scsifront_put_rqid() 182 struct vscsifrnt_shadow *shadow) in scsifront_do_request() argument 186 struct scsi_cmnd *sc = shadow->sc; in scsifront_do_request() 197 info->shadow[id] = shadow; in scsifront_do_request() 198 shadow->rqid = id; in scsifront_do_request() 204 ring_req->act = shadow->act; in scsifront_do_request() 205 ring_req->ref_rqid = shadow->ref_rqid; in scsifront_do_request() 206 ring_req->nr_segments = shadow->nr_segments; in scsifront_do_request() 220 for (i = 0; i < (shadow->nr_segments & ~VSCSIIF_SG_GRANT); i++) in scsifront_do_request() [all …]
|
| /linux/drivers/irqchip/ |
| H A D | irq-econet-en751221.c | 9 * this driver, these are called "shadow interrupts". The assignment of shadow 14 * allocates another IRQ number (say 29) to be its shadow. The device tree 15 * reflects this by adding the pair <30 29> to the "econet,shadow-interrupts" 46 * - NOT_PERCPU: This interrupt is not per-cpu, so it has no shadow 47 * - IS_SHADOW: This interrupt is a shadow of another per-cpu interrupt 48 * - else: This is a per-cpu interrupt whose shadow is the value 74 u8 shadow; in econet_chmask() local 77 * If the IRQ is a shadow, it should never be manipulated directly. in econet_chmask() 80 * If it is per-cpu (has a shadow), and we're on VPE#1, the shadow is what we mask. in econet_chmask() 83 shadow = econet_intc.interrupt_shadows[hwirq]; in econet_chmask() [all …]
|
| /linux/mm/kmsan/ |
| H A D | init.c | 69 * Initialize the shadow for existing mappings during kernel initialization. 85 /* Allocate shadow for .data */ in kmsan_init_shadow() 99 struct page *shadow, *origin; member 108 * time with a certain order, it is reserved as a shadow block, for the second 110 * shadow and origin ranges from the previously saved shadow and origin blocks, 118 struct page *shadow, *origin; in kmsan_memblock_free_pages() local 120 if (!held_back[order].shadow) { in kmsan_memblock_free_pages() 121 held_back[order].shadow = page; in kmsan_memblock_free_pages() 128 shadow = held_back[order].shadow; in kmsan_memblock_free_pages() 130 kmsan_setup_meta(page, shadow, origin, order); in kmsan_memblock_free_pages() [all …]
|
| H A D | shadow.c | 3 * KMSAN shadow implementation. 85 void *shadow; in kmsan_get_shadow_origin_ptr() local 97 shadow = kmsan_get_metadata(address, KMSAN_META_SHADOW); in kmsan_get_shadow_origin_ptr() 98 if (!shadow) in kmsan_get_shadow_origin_ptr() 101 ret.shadow = shadow; in kmsan_get_shadow_origin_ptr() 108 ret.shadow = dummy_store_page; in kmsan_get_shadow_origin_ptr() 112 ret.shadow = dummy_load_page; in kmsan_get_shadow_origin_ptr() 119 * Obtain the shadow or origin pointer for the given address, or NULL if there's 173 struct page *shadow, *origin; in kmsan_alloc_page() local 180 shadow = shadow_page_for(page); in kmsan_alloc_page() [all …]
|
| H A D | instrumentation.c | 49 /* Get shadow and origin pointers for a memory load with non-standard size. */ 59 /* Get shadow and origin pointers for a memory store with non-standard size. */ 70 * Declare functions that obtain shadow/origin pointers for loads and stores 135 * get_param0_metadata() and set_retval_metadata() to store the shadow/origin 139 static inline void get_param0_metadata(u64 *shadow, in get_param0_metadata() argument 144 *shadow = *(u64 *)(ctx->cstate.param_tls); in get_param0_metadata() 148 static inline void set_retval_metadata(u64 shadow, depot_stack_handle_t origin) in set_retval_metadata() argument 152 *(u64 *)(ctx->cstate.retval_tls) = shadow; in set_retval_metadata() 162 u64 shadow; in __msan_memmove() local 164 get_param0_metadata(&shadow, &origin); in __msan_memmove() [all …]
|
| /linux/include/drm/ |
| H A D | drm_gem_atomic_helper.h | 21 * Helpers for planes with shadow buffers 25 * DRM_SHADOW_PLANE_MAX_WIDTH - Maximum width of a plane's shadow buffer in pixels 27 * For drivers with shadow planes, the maximum width of the framebuffer is 34 * DRM_SHADOW_PLANE_MAX_HEIGHT - Maximum height of a plane's shadow buffer in scanlines 36 * For drivers with shadow planes, the maximum height of the framebuffer is 43 * struct drm_shadow_plane_state - plane state for planes with shadow buffers 45 * For planes that use a shadow buffer, struct drm_shadow_plane_state 46 * provides the regular plane state plus mappings of the shadow buffer 57 * Flags for copying shadow buffers into backend storage. Also holds 104 * Initializes struct drm_plane_funcs for shadow-buffered planes [all …]
|
| /linux/Documentation/virt/kvm/x86/ |
| H A D | mmu.rst | 4 The x86 kvm shadow mmu 55 spte shadow pte (referring to pfns) 87 direct mode; otherwise it operates in shadow mode (see below). 118 Shadow pages 121 The principal data structure is the shadow page, 'struct kvm_mmu_page'. A 122 shadow page contains 512 sptes, which can be either leaf or nonleaf sptes. A 123 shadow page may contain a mix of leaf and nonleaf sptes. 126 is not related to a translation directly. It points to other shadow pages. 150 Shadow pages contain the following information: 152 The level in the shadow paging hierarchy that this shadow page belongs to. [all …]
|
| /linux/arch/arm/mm/ |
| H A D | kasan_init.c | 61 panic("%s failed to allocate shadow page for address 0x%lx\n", in kasan_pte_populate() 70 * The early shadow memory is mapping all KASan in kasan_pte_populate() 74 * proper KASan shadow memory. in kasan_pte_populate() 80 * Early shadow mappings are PMD_SIZE aligned, so if the in kasan_pte_populate() 102 * We attempt to allocate a shadow block for the PMDs in kasan_pmd_populate() 110 panic("%s failed to allocate shadow block for address 0x%lx\n", in kasan_pmd_populate() 135 * Allocate and populate the shadow block of p4d folded into in kasan_pgd_populate() 142 panic("%s failed to allocate shadow block for address 0x%lx\n", in kasan_pgd_populate() 182 * We walk the page table and set all of the shadow memory to point in kasan_early_init() 202 pr_info("Mapping kernel virtual memory block: %px-%px at shadow: %px-%px\n", in create_mapping() [all …]
|
| /linux/arch/arm/include/asm/ |
| H A D | kasan_def.h | 19 * space to use as shadow memory for KASan as follows: 31 * | | |-> The shadow area of kernel virtual address. 34 * | |\ shadow address of MODULES_VADDR 47 * This value begins with the MODULE_VADDR's shadow address. It is the 49 * to cover also that area with shadow memory so we can find memory 53 * This value is the 0x100000000's shadow address: the mapping that would 55 * kernel address sanitizer shadow area. It is also the start of the 59 * This value is used to map an address to the corresponding shadow 65 * byte in the shadow memory covers 8 bytes of kernel memory, so one 66 * bit shadow memory per byte of kernel memory is used. [all …]
|
| /linux/samples/livepatch/ |
| H A D | livepatch-shadow-fix1.c | 7 * livepatch-shadow-fix1.c - Shadow variables, livepatch demo 12 * Fixes the memory leak introduced in livepatch-shadow-mod through the 13 * use of a shadow variable. This fix demonstrates the "extending" of 22 * section of livepatch-shadow-mod.c. 32 /* Shadow variable enums */ 49 * In this example, it would be safe to assign the pointer also to the shadow 78 * Patch: save the extra memory location into a SV_LEAK shadow in livepatch_fix1_dummy_alloc() 89 pr_err("%s: failed to allocate shadow variable for the leaking pointer: dummy @ %p, leak @ %p\n", in livepatch_fix1_dummy_alloc() 121 * Patch: fetch the saved SV_LEAK shadow variable, detach and in livepatch_fix1_dummy_free() 122 * free it. Note: handle cases where this shadow variable does in livepatch_fix1_dummy_free() [all …]
|
| H A D | livepatch-shadow-fix2.c | 7 * livepatch-shadow-fix2.c - Shadow variables, livepatch demo 12 * Adds functionality to livepatch-shadow-mod's in-flight data 13 * structures through a shadow variable. The livepatch patches a 22 * section of livepatch-shadow-mod.c. 32 /* Shadow variable enums */ 47 * already have a SV_COUNTER shadow variable, then attach a in livepatch_fix2_dummy_check() 82 * Patch: fetch the SV_COUNTER shadow variable and display in livepatch_fix2_dummy_free() 83 * the final count. Detach the shadow variable. in livepatch_fix2_dummy_free() 125 /* Cleanup any existing SV_COUNTER shadow variables */ in livepatch_shadow_fix2_exit() 131 MODULE_DESCRIPTION("Live patching demo for shadow variables");
|
| /linux/arch/powerpc/include/asm/ |
| H A D | kasan.h | 37 * The shadow ends before the highest accessible address 38 * because we don't need a shadow for the shadow. Instead: 46 * The shadow ends before the highest accessible address 47 * because we don't need a shadow for the shadow. 48 * But it doesn't hurt to have a shadow for the shadow, 49 * keep shadow end aligned eases things.
|
| /linux/drivers/gpio/ |
| H A D | gpio-janz-ttl.c | 60 u8 *shadow; in ttl_get_value() local 64 shadow = &mod->porta_shadow; in ttl_get_value() 66 shadow = &mod->portb_shadow; in ttl_get_value() 69 shadow = &mod->portc_shadow; in ttl_get_value() 74 ret = *shadow & BIT(offset); in ttl_get_value() 83 u8 *shadow; in ttl_set_value() local 87 shadow = &mod->porta_shadow; in ttl_set_value() 90 shadow = &mod->portb_shadow; in ttl_set_value() 94 shadow = &mod->portc_shadow; in ttl_set_value() 100 *shadow |= BIT(offset); in ttl_set_value() [all …]
|
| /linux/include/linux/ |
| H A D | scx200_gpio.h | 13 #define __SCx200_GPIO_SHADOW unsigned long *shadow = scx200_gpio_shadow+bank 16 #define __SCx200_GPIO_OUT __asm__ __volatile__("outsl":"=mS" (shadow):"d" (ioaddr), "0" (shadow)) 46 set_bit(index, shadow); /* __set_bit()? */ in scx200_gpio_set_high() 57 clear_bit(index, shadow); /* __clear_bit()? */ in scx200_gpio_set_low() 69 set_bit(index, shadow); in scx200_gpio_set() 71 clear_bit(index, shadow); in scx200_gpio_set() 81 change_bit(index, shadow); in scx200_gpio_change()
|
| /linux/drivers/block/ |
| H A D | xen-blkfront.c | 190 struct blk_shadow shadow[]; member 291 rinfo->shadow_free = rinfo->shadow[free].req.u.rw.id; in get_id_from_freelist() 292 rinfo->shadow[free].req.u.rw.id = 0x0fffffee; /* debug */ in get_id_from_freelist() 299 if (rinfo->shadow[id].req.u.rw.id != id) in add_id_to_freelist() 301 if (rinfo->shadow[id].request == NULL) in add_id_to_freelist() 303 rinfo->shadow[id].req.u.rw.id = rinfo->shadow_free; in add_id_to_freelist() 304 rinfo->shadow[id].request = NULL; in add_id_to_freelist() 543 rinfo->shadow[id].request = req; in blkif_ring_get_request() 544 rinfo->shadow[id].status = REQ_PROCESSING; in blkif_ring_get_request() 545 rinfo->shadow[id].associated_id = NO_ASSOCIATED_ID; in blkif_ring_get_request() [all …]
|
| /linux/arch/x86/kernel/ |
| H A D | shstk.c | 3 * shstk.c - Intel shadow stack support 47 * Create a restore token on the shadow stack. A token is always 8-byte 79 * The shadow stack pointer(SSP) is moved by CALL, RET, and INCSSPQ. The 80 * INCSSP instruction can increment the shadow stack pointer. It is the 81 * shadow stack analog of an instruction like: 91 * ssp += nr_to_pop * 8; // move the shadow stack 137 * case it is ok to leak a shadow stack, so just exit out. in unmap_shadow_stack() 193 * If shadow stack is not enabled on the new thread, skip any in shstk_alloc_thread_stack() 194 * switch to a new shadow stack. in shstk_alloc_thread_stack() 200 * For CLONE_VFORK the child will share the parents shadow stack. in shstk_alloc_thread_stack() [all …]
|
| /linux/mm/kasan/ |
| H A D | shadow.c | 3 * This file contains KASAN runtime code that manages shadow memory for 132 * Perform shadow offset calculation based on untagged address, as in kasan_poison() 157 u8 *shadow = (u8 *)kasan_mem_to_shadow(addr + size); in kasan_poison_last_granule() local 158 *shadow = size & KASAN_GRANULE_MASK; in kasan_poison_last_granule() 168 * Perform shadow offset calculation based on untagged address, as in kasan_unpoison() 235 * If shadow is mapped already than it must have been mapped in kasan_mem_notifier() 260 * In the latter case we can use vfree() to free shadow. in kasan_mem_notifier() 264 * Currently it's not possible to free shadow mapped in kasan_mem_notifier() 410 * User Mode Linux maps enough shadow memory for all of virtual memory in __kasan_populate_vmalloc() 444 * STORE shadow(a), unpoison_val in __kasan_populate_vmalloc() [all …]
|
| /linux/arch/powerpc/kvm/ |
| H A D | e500.c | 58 /* This variable keeps last used shadow ID on local core. 59 * The valid range of shadow ID is [1..255] */ 63 * Allocate a free shadow id and setup a valid sid mapping in given entry. 67 * it has finished with the returned shadow id (either written into the 96 * Check if given entry contain a valid shadow id mapping. 101 * it has finished with the returned shadow id (either written into the 132 /* Map guest pid to shadow. 133 * We use PID to keep shadow of current guest non-zero PID, 134 * and use PID1 to keep shadow of guest zero PID. 154 /* Update shadow pid when mappings are changed */ in kvmppc_e500_id_table_reset_all() [all …]
|
| /linux/tools/testing/selftests/x86/ |
| H A D | test_shadow_stack.c | 3 * This program test's basic kernel shadow stack support. It enables shadow 5 * Makefile doesn't compile with shadow stack support, so it doesn't rely on 7 * special glibc shadow stack support (longjmp(), swapcontext(), etc). Just 86 * For use in inline enablement of shadow stack. 88 * The program can't return from the point where shadow stack gets enabled 89 * because there will be no address on the shadow stack. So it can't use 147 /* Switch back to original shadow stack */ in try_shstk() 158 printf("[FAIL]\tError creating shadow stack: %d\n", errno); in test_shstk_pivot() 172 /* Read shadow stack, test if it's zero to not get read optimized out */ in test_shstk_faults() 205 /* Corrupt shadow stack */ in violate_ss() [all …]
|
| /linux/Documentation/devicetree/bindings/interrupt-controller/ |
| H A D | econet,en751221-intc.yaml | 17 lack of a better term we call these "shadow interrupts". The assignment of 18 shadow interrupts is defined by the SoC integrator when wiring the interrupt 40 econet,shadow-interrupts: 43 An array of interrupt number pairs where each pair represents a shadow 45 and the second is its shadow IRQ used for VPE#1 control. For example, 53 - description: shadow IRQ number 76 econet,shadow-interrupts = <7 2>, <8 3>, <13 12>, <30 29>;
|