/linux/tools/testing/selftests/bpf/progs/ |
H A D | test_global_func_ctx_args.c | 11 static long stack[256]; variable 19 return bpf_get_stack(ctx, &stack, sizeof(stack), 0); in kprobe_typedef_ctx_subprog() 50 return bpf_get_stack((void *)ctx, &stack, sizeof(stack), 0); in kprobe_struct_ctx_subprog() 67 return bpf_get_stack(ctx, &stack, sizeof(stack), 0); in kprobe_workaround_ctx_subprog() 83 return bpf_get_stack(ctx, &stack, sizeof(stack), 0); in raw_tp_ctx_subprog() 99 return bpf_get_stack(ctx, &stack, sizeo in raw_tp_writable_ctx_subprog() [all...] |
/linux/lib/ |
H A D | stackdepot.c | 3 * Stack depot - a stack trace storage that avoids duplication. 5 * Internally, stack depot maintains a hash table of unique stacktraces. The 6 * stack traces themselves are stored contiguously one after another in a set 57 /* Hash table of stored stack records. */ 64 /* Array of memory regions that store stack records. */ 72 /* Freelist of stack records within stack_pools. */ 171 * stack traces being stored in stack depot. in stack_depot_early_init() 213 pr_info("allocating space for %u stack pools via memblock\n", in stack_depot_early_init() 218 pr_err("stack pool in stack_depot_early_init() 361 struct stack_record *stack; depot_pop_free_pool() local 395 struct stack_record *stack; depot_pop_free() local 432 struct stack_record *stack = NULL; depot_alloc_stack() local 495 struct stack_record *stack; depot_fetch_stack() local 517 depot_free_stack(struct stack_record * stack) depot_free_stack() argument 588 struct stack_record *stack, *ret = NULL; find_stack() local 755 struct stack_record *stack; stack_depot_fetch() local 782 struct stack_record *stack; stack_depot_put() local 800 stack_depot_print(depot_stack_handle_t stack) stack_depot_print() argument [all...] |
/linux/arch/x86/kernel/ |
H A D | dumpstack_32.c | 38 static bool in_hardirq_stack(unsigned long *stack, struct stack_info *info) in in_hardirq_stack() argument 44 * This is a software stack, so 'end' can be a valid stack pointer. in in_hardirq_stack() 45 * It just means the stack is empty. in in_hardirq_stack() 47 if (stack < begin || stack > end) in in_hardirq_stack() 55 * See irq_32.c -- the next stack pointer is stored at the beginning of in in_hardirq_stack() 56 * the stack. in in_hardirq_stack() 63 static bool in_softirq_stack(unsigned long *stack, struct stack_info *info) in in_softirq_stack() argument 69 * This is a software stack, s in in_softirq_stack() 88 in_doublefault_stack(unsigned long * stack,struct stack_info * info) in_doublefault_stack() argument 108 get_stack_info(unsigned long * stack,struct task_struct * task,struct stack_info * info,unsigned long * visit_mask) get_stack_info() argument [all...] |
H A D | dumpstack.c | 30 bool noinstr in_task_stack(unsigned long *stack, struct task_struct *task, in in_task_stack() argument 36 if (stack < begin || stack >= end) in in_task_stack() 48 bool noinstr in_entry_stack(unsigned long *stack, struct stack_info *info) in in_entry_stack() argument 55 if ((void *)stack < begin || (void *)stack >= end) in in_entry_stack() 126 /* No access to the user space stack of other tasks. Ignore. */ in show_opcodes() 158 * ordering reasons: if the registers are on the next stack, we don't in show_regs_if_on_stack() 160 * the wrong stack. Later, when show_trace_log_lvl() switches to the in show_regs_if_on_stack() 161 * next stack, thi in show_regs_if_on_stack() 185 show_trace_log_lvl(struct task_struct * task,struct pt_regs * regs,unsigned long * stack,const char * log_lvl) show_trace_log_lvl() argument [all...] |
H A D | dumpstack_64.c | 46 * On 64-bit, we have a generic entry stack that we in stack_type_name() 61 * @offs: Offset from the start of the exception stack area 62 * @size: Size of the exception stack 79 * Array of exception stack page descriptors. If the stack is larger than 80 * PAGE_SIZE, all pages covering a particular stack will have the same 81 * info. The guard pages including the not mapped DB2 stack are zeroed 94 static __always_inline bool in_exception_stack(unsigned long *stack, struct stack_info *info) in in_exception_stack() argument 96 unsigned long begin, end, stk = (unsigned long)stack; in in_exception_stack() 105 * Handle the case where stack trac in in_exception_stack() 135 in_irq_stack(unsigned long * stack,struct stack_info * info) in_irq_stack() argument 170 get_stack_info_noinstr(unsigned long * stack,struct task_struct * task,struct stack_info * info) get_stack_info_noinstr() argument 191 get_stack_info(unsigned long * stack,struct task_struct * task,struct stack_info * info,unsigned long * visit_mask) get_stack_info() argument [all...] |
/linux/tools/testing/selftests/bpf/prog_tests/ |
H A D | build_id.c | 10 static void print_stack(struct bpf_stack_build_id *stack, int frame_cnt) in print_stack() argument 16 switch (stack[i].status) { in print_stack() 23 printf("%02hhx", (unsigned)stack[i].build_id[j]); in print_stack() 24 printf(" OFFSET = %llx", (unsigned long long)stack[i].offset); in print_stack() 27 printf("IP = %llx", (unsigned long long)stack[i].ip); in print_stack() 30 printf("UNEXPECTED STATUS %d ", stack[i].status); in print_stack() 40 struct bpf_stack_build_id *stack; in subtest_nofault() local 59 stack = skel->bss->stack_nofault; in subtest_nofault() 62 print_stack(stack, frame_cnt); in subtest_nofault() 65 ASSERT_EQ(stack[ in subtest_nofault() 78 struct bpf_stack_build_id *stack; subtest_sleepable() local [all...] |
/linux/Documentation/arch/x86/ |
H A D | shstk.rst | 14 CET introduces shadow stack and indirect branch tracking (IBT). A shadow stack 15 is a secondary stack allocated from memory which cannot be directly modified by 17 return address to both the normal stack and the shadow stack. Upon 18 function return, the processor pops the shadow stack copy and compares it 19 to the normal stack copy. If the two differ, the processor raises a 23 shadow stack and kernel IBT are supported. 28 To use userspace shadow stack you need HW that supports it, a kernel 34 To build a user shadow stack enable [all...] |
H A D | kernel-stacks.rst | 14 Like all other architectures, x86_64 has a kernel stack for every 17 zombie. While the thread is in user space the kernel stack is empty 25 * Interrupt stack. IRQ_STACK_SIZE 29 kernel switches from the current task to the interrupt stack. Like 32 of every per thread stack. 34 The interrupt stack is also used when processing a softirq. 36 Switching to the kernel interrupt stack is done by software based on a 41 to automatically switch to a new stack for designated events such as 46 point to dedicated stacks; each stack can be a different size. 50 loads such a descriptor, the hardware automatically sets the new stack [all...] |
/linux/tools/testing/selftests/arm64/gcs/ |
H A D | libc-gcs.c | 154 * In child, make sure there's something on the stack and in TEST() 303 unsigned long *stack; in FIXTURE() local 434 self->stack = (void *)syscall(__NR_map_shadow_stack, 0, in FIXTURE_SETUP() 437 ASSERT_FALSE(self->stack == MAP_FAILED); in FIXTURE_SETUP() 438 ksft_print_msg("Allocated stack from %p-%p\n", self->stack, in FIXTURE_SETUP() 439 self->stack + variant->stack_size); in FIXTURE_SETUP() 446 if (self->stack != MAP_FAILED) { in FIXTURE_TEARDOWN() 447 ret = munmap(self->stack, variant->stack_size); in FIXTURE_TEARDOWN() 452 /* The stack ha 455 unsigned long *stack = self->stack; TEST_F() local 479 unsigned long *stack = self->stack; TEST_F() local 633 void *stack; TEST_F() local 644 unsigned long *stack; FIXTURE() local [all...] |
/linux/Documentation/mm/ |
H A D | vmalloced-kernel-stacks.rst | 21 Kernel stack overflows are often hard to debug and make the kernel 25 Virtually mapped kernel stacks with guard pages cause kernel stack 31 causes reliable faults when the stack overflows. The usability of 32 the stack trace after overflow and response to the overflow itself 49 needs to work while the stack points to a virtual address with 51 most likely) needs to ensure that the stack's page table entries 52 are populated before running on a possibly unpopulated stack. 53 - If the stack overflows into a guard page, something reasonable 64 with guard pages. This causes kernel stack overflows to be caught 75 VMAP_STACK is enabled, it is not possible to run DMA on stack [all...] |
/linux/arch/nios2/kernel/ |
H A D | traps.c | 60 void show_stack(struct task_struct *task, unsigned long *stack, in show_stack() argument 66 if (!stack) { in show_stack() 68 stack = (unsigned long *)task->thread.ksp; in show_stack() 70 stack = (unsigned long *)&stack; in show_stack() 73 addr = (unsigned long) stack; in show_stack() 76 printk("%sStack from %08lx:", loglvl, (unsigned long)stack); in show_stack() 78 if (stack + 1 > endstack) in show_stack() 82 printk("%s %08lx", loglvl, *stack++); in show_stack() 87 while (stack in show_stack() [all...] |
/linux/arch/openrisc/kernel/ |
H A D | unwinder.c | 28 * the frame pointer should point to a location in the stack after the 40 * Create a stack trace doing scanning which is frame pointer aware. We can 41 * get reliable stack traces by matching the previously found frame 42 * pointer with the top of the stack address every time we find a valid 45 * Ideally the stack parameter will be passed as FP, but it can not be 49 * The OpenRISC stack frame looks something like the following. The 53 * SP -> (top of stack) 58 * FP -> (previous top of stack) / 60 void unwind_stack(void *data, unsigned long *stack, in unwind_stack() argument 67 while (!kstack_end(stack)) { in unwind_stack() 93 unwind_stack(void * data,unsigned long * stack,void (* trace)(void * data,unsigned long addr,int reliable)) unwind_stack() argument [all...] |
/linux/mm/kmsan/ |
H A D | init.c | 149 static void smallstack_push(struct smallstack *stack, struct page *pages) in smallstack_push() argument 151 KMSAN_WARN_ON(stack->index == MAX_BLOCKS); in smallstack_push() 152 stack->items[stack->index] = pages; in smallstack_push() 153 stack->index++; in smallstack_push() 157 static struct page *smallstack_pop(struct smallstack *stack) in smallstack_pop() argument 161 KMSAN_WARN_ON(stack->index == 0); in smallstack_pop() 162 stack->index--; in smallstack_pop() 163 ret = stack->items[stack in smallstack_pop() [all...] |
/linux/arch/um/kernel/ |
H A D | sysrq.c | 29 void show_stack(struct task_struct *task, unsigned long *stack, in show_stack() argument 35 if (!stack) in show_stack() 36 stack = get_stack_pointer(task, segv_regs); in show_stack() 40 if (kstack_end(stack)) in show_stack() 44 pr_cont(" %08lx", READ_ONCE_NOCHECK(*stack)); in show_stack() 45 stack++; in show_stack()
|
/linux/include/linux/sched/ |
H A D | task_stack.h | 6 * task->stack (kernel stack) handling interfaces: 17 * When accessing the stack of a non-current task that might exit, use 23 return task->stack; in task_stack_page() 31 return (unsigned long *)((unsigned long)task->stack + THREAD_SIZE) - 1; in end_of_stack() 33 return task->stack; in end_of_stack() 39 #define task_stack_page(task) ((void *)(task)->stack) 48 * Return the address of the last usable long on the stack. 50 * When the stack grows down, this is just above the thread 53 * When the stack grow 91 void *stack = task_stack_page(current); object_is_on_stack() local [all...] |
/linux/arch/um/kernel/skas/ |
H A D | mmu.c | 29 unsigned long stack = 0; in init_new_context() local 32 stack = __get_free_pages(GFP_KERNEL | __GFP_ZERO, ilog2(STUB_DATA_PAGES)); in init_new_context() 33 if (stack == 0) in init_new_context() 36 new_id->stack = stack; in init_new_context() 53 free_pages(new_id->stack, ilog2(STUB_DATA_PAGES)); in init_new_context() 84 free_pages(mmu->id.stack, ilog2(STUB_DATA_PAGES)); in destroy_context() 117 stub_data = (void *)mm_context->id.stack; in mm_sigchld_irq()
|
/linux/tools/perf/scripts/python/ |
H A D | stackcollapse.py | 1 # stackcollapse.py - format perf samples with one line per distinct call stack 5 # separated stack including the program name (from the "comm" field) and the 6 # function names from the call stack. The second is a count: 39 # formatting options for the bottom entry of the stack 42 help="include thread id in stack"), 45 help="include process id in stack"), 97 stack = list() 103 stack.append(tidy_function_name(entry['sym']['name'], 108 stack.append(tidy_function_name(param_dict['symbol'], 119 stack [all...] |
/linux/arch/x86/include/asm/ |
H A D | stacktrace.h | 31 bool in_task_stack(unsigned long *stack, struct task_struct *task, 34 bool in_entry_stack(unsigned long *stack, struct stack_info *info); 36 int get_stack_info(unsigned long *stack, struct task_struct *task, 38 bool get_stack_info_noinstr(unsigned long *stack, struct task_struct *task, 42 bool get_stack_guard_info(unsigned long *stack, struct stack_info *info) in get_stack_guard_info() argument 44 /* make sure it's not in the stack proper */ in get_stack_guard_info() 45 if (get_stack_info_noinstr(stack, current, info)) in get_stack_guard_info() 48 return get_stack_info_noinstr((void *)stack + PAGE_SIZE, current, info); in get_stack_guard_info() 101 /* The form of the top of the frame on the stack */
|
/linux/tools/testing/selftests/mm/ |
H A D | pkey_sighandler_tests.c | 6 * using an alternate signal stack, with the default pkey (pkey 0) disabled. 80 static inline long clone_raw(unsigned long flags, void *stack, in clone_raw() argument 84 long a2 = (long)stack; in clone_raw() 173 /* After we disable MPK 0, we can't access the stack to return */ in thread_segv_pkuerr_stack() 179 stack_t *stack = ptr; in thread_segv_maperr_ptr() local 183 * Setup alternate signal stack, which should be pkey_mprotect()ed by in thread_segv_maperr_ptr() 184 * MPK 0. The thread's stack cannot be used for signals because it is in thread_segv_maperr_ptr() 187 syscall_raw(SYS_sigaltstack, (long)stack, 0, 0, 0, 0, 0); in thread_segv_maperr_ptr() 202 * Note that the new thread stack and the alternate signal stack i 286 void *stack; test_sigsegv_handler_with_different_pkey_for_stack() local 405 stack_t *stack = ptr; thread_sigusr2_self() local 442 void *stack; test_pkru_sigreturn() local [all...] |
/linux/arch/um/os-Linux/ |
H A D | helper.c | 47 unsigned long stack, sp; in run_helper() local 50 stack = alloc_stack(0, __uml_cant_sleep()); in run_helper() 51 if (stack == 0) in run_helper() 69 sp = stack + UM_KERN_PAGE_SIZE; in run_helper() 115 free_stack(stack, 0); in run_helper() 122 unsigned long stack, sp; in run_helper_thread() local 129 stack = alloc_stack(0, __uml_cant_sleep()); in run_helper_thread() 130 if (stack == 0) in run_helper_thread() 133 sp = stack + UM_KERN_PAGE_SIZE; in run_helper_thread() 152 free_stack(stack, in run_helper_thread() [all...] |
/linux/arch/powerpc/kernel/ |
H A D | stacktrace.c | 44 unsigned long *stack = (unsigned long *) sp; in arch_stack_walk() local 50 newsp = stack[0]; in arch_stack_walk() 51 ip = stack[STACK_FRAME_LR_SAVE]; in arch_stack_walk() 62 * stack. Otherwise it guarantees that the stack trace is reliable. 96 unsigned long *stack = (unsigned long *) sp; in arch_stack_walk_reliable() local 103 newsp = stack[0]; in arch_stack_walk_reliable() 123 stack[STACK_INT_FRAME_MARKER_LONGS] == STACK_FRAME_REGS_MARKER) { in arch_stack_walk_reliable() 128 ip = stack[STACK_FRAME_LR_SAVE]; in arch_stack_walk_reliable() 136 ip = ftrace_graph_ret_addr(task, &graph_idx, ip, stack); in arch_stack_walk_reliable() [all...] |
/linux/arch/um/os-Linux/skas/ |
H A D | mem.c | 27 struct stub_data *proc_data = (void *)mm_idp->stack; in syscall_stub_dump_error() 59 unsigned long *stack) in check_init_stack() argument 61 if (stack == NULL) { in check_init_stack() 62 stack = (unsigned long *) mm_idp->stack + 2; in check_init_stack() 63 *stack = 0; in check_init_stack() 65 return stack; in check_init_stack() 89 struct stub_data *proc_data = (void *)mm_idp->stack; in do_syscall_stub() 160 struct stub_data *proc_data = (struct stub_data *) mm_idp->stack; in syscall_stub_alloc() 183 struct stub_data *proc_data = (void *) mm_idp->stack; in syscall_stub_get_previous() [all...] |
/linux/Documentation/ABI/testing/ |
H A D | sysfs-ocfs2 | 38 * 'o2cb' - The classic o2cb cluster stack that ocfs2 has 62 the cluster stack in use. The contents may change 63 when all filesystems are unmounted and the cluster stack 71 of current ocfs2 cluster stack. This value is set by 72 userspace tools when bringing the cluster stack online. 74 Cluster stack names are 4 characters in length. 76 When the 'o2cb' cluster stack is used, the 'o2cb' cluster 81 cluster stack on a single line. 83 Writing a new stack name to this file changes the current 84 cluster stack unles [all...] |
/linux/arch/loongarch/ |
H A D | Kconfig.debug | 5 This determines which method will be used for unwinding kernel stack 6 traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack, 12 This option enables the "guess" unwinder for unwinding kernel stack 13 traces. It scans the stack and reports every kernel text address it 23 This option enables the "prologue" unwinder for unwinding kernel stack 24 traces. It unwind the stack frame based on prologue code analyze. Symbol 35 unwinding kernel stack traces. It uses a custom data format which is
|
/linux/fs/jfs/ |
H A D | jfs_btree.h | 93 * btree traversal stack 98 struct btframe { /* stack frame */ 108 struct btframe stack[MAXTREEHEIGHT]; member 112 (btstack)->top = (btstack)->stack 115 ( (btstack)->top == &((btstack)->stack[MAXTREEHEIGHT-1])) 126 ( (btstack)->top == (btstack)->stack ? NULL : --(btstack)->top ) 129 ( (btstack)->top == (btstack)->stack ? NULL : (btstack)->top ) 137 (long long)btstack->stack[i].bn, in BT_STACK_DUMP() 138 btstack->stack[i].index); in BT_STACK_DUMP()
|