Lines Matching +full:precondition +full:- +full:timeout
1 // SPDX-License-Identifier: GPL-2.0
71 static struct other_info other_infos[CONFIG_KCSAN_NUM_WATCHPOINTS + NUM_SLOTS-1];
95 * Therefore, we use a fixed-size array, which at most will occupy a page. This
109 * it could make sense to have a finer-grained locking story for @other_infos,
116 * been reported since (now - KCSAN_REPORT_ONCE_IN_MS).
130 invalid_before = jiffies - msecs_to_jiffies(CONFIG_KCSAN_REPORT_ONCE_IN_MS);
142 if (time_before(rt->time, use_entry->time))
149 if (rt->time == 0)
153 if (time_before(rt->time, invalid_before))
157 if ((rt->frame1 == frame1 && rt->frame2 == frame2) ||
158 (rt->frame1 == frame2 && rt->frame2 == frame1))
162 use_entry->time = jiffies;
163 use_entry->frame1 = frame1;
164 use_entry->frame2 = frame2;
189 * Cases 1-4 are intuitive and expected; case 5 ensures we do not report
199 * We opt-out of this filter for certain functions at request of
240 return "read-write";
242 return "read-write (marked)";
252 return "read-write (reordered)";
254 return "read-write (marked, reordered)";
262 return (type & KCSAN_ACCESS_ASSERT) != 0 ? "assert: race" : "data-race";
268 if (task_id != -1) {
277 /* Helper to skip KCSAN-related functions in stack-trace. */
301 * No match for runtime functions -- @skip entries to skip to
324 target_func = ip - offset;
333 func -= offset;
374 pr_err(" |\n +-> reordered to: %pS\n", (void *)reordered_to);
400 int skipnr = sanitize_stack_entries(stack_entries, num_stack_entries, ai->ip, &reordered_to);
413 other_skipnr = sanitize_stack_entries(other_info->stack_entries,
414 other_info->num_stack_entries,
415 other_info->ai.ip, &other_reordered_to);
416 other_frame = other_info->stack_entries[other_skipnr];
437 get_bug_type(ai->access_type | other_info->ai.access_type),
441 pr_err("BUG: KCSAN: %s in %pS\n", get_bug_type(ai->access_type),
450 get_access_type(other_info->ai.access_type), other_info->ai.ptr,
451 other_info->ai.size, get_thread_desc(other_info->ai.task_pid),
452 other_info->ai.cpu_id);
455 print_stack_trace(other_info->stack_entries + other_skipnr,
456 other_info->num_stack_entries - other_skipnr,
459 print_verbose_info(other_info->task);
463 get_access_type(ai->access_type), ai->ptr, ai->size,
464 get_thread_desc(ai->task_pid), ai->cpu_id);
467 get_access_type(ai->access_type), ai->ptr, ai->size,
468 get_thread_desc(ai->task_pid), ai->cpu_id);
471 print_stack_trace(stack_entries + skipnr, num_stack_entries - skipnr, reordered_to);
476 if (ai->size <= 8) {
477 int hex_len = ai->size * 2;
484 pr_err("value changed: 0x%0*llx -> 0x%0*llx\n",
507 * 0-sized accesses.
509 other_info->ai.size = 0;
514 * Sets @other_info->task and awaits consumption of @other_info.
522 * We may be instrumenting a code-path where current->state is already
529 * timeout to ensure this works in all contexts.
534 int timeout = max(kcsan_udelay_task, kcsan_udelay_interrupt);
536 other_info->task = current;
549 * determine if sleeping here is permitted -- see in_atomic().
554 if (timeout-- < 0) {
556 * Abort. Reset @other_info->task to NULL, since it
561 other_info->task = NULL;
568 } while (other_info->ai.size && other_info->ai.ptr == ai->ptr &&
569 other_info->task == current);
584 * there is a one-to-one mapping to watchpoint slots (@watchpoints in
591 * To check this property holds, size should never be non-zero here,
595 WARN_ON(other_info->ai.size);
597 other_info->ai = *ai;
598 other_info->num_stack_entries = stack_trace_save(other_info->stack_entries, NUM_STACK_ENTRIES, 2);
614 while (!other_info->ai.size) { /* Await valid @other_info. */
621 if (WARN_ON(!matching_access((unsigned long)other_info->ai.ptr & WATCHPOINT_ADDR_MASK, other_info->ai.size,
622 (unsigned long)ai->ptr & WATCHPOINT_ADDR_MASK, ai->size)))
625 if (!matching_access((unsigned long)other_info->ai.ptr, other_info->ai.size,
626 (unsigned long)ai->ptr, ai->size)) {
649 .task_pid = in_task() ? task_pid_nr(current) : -1,
683 * called in print_report() is scheduler-safe, accept the risk, and just