Commit 092f6239 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'xtensa-20230110' of https://github.com/jcmvbkbc/linux-xtensa

Pull xtensa fixes from Max Filippov:

 - fix xtensa allmodconfig build broken by the kcsan test

 - drop unused members of struct thread_struct

* tag 'xtensa-20230110' of https://github.com/jcmvbkbc/linux-xtensa:
  xtensa: drop unused members of struct thread_struct
  kcsan: test: don't put the expect array on the stack
parents 40c18f36 4414c1f5
...@@ -154,11 +154,6 @@ struct thread_struct { ...@@ -154,11 +154,6 @@ struct thread_struct {
unsigned long ra; /* kernel's a0: return address and window call size */ unsigned long ra; /* kernel's a0: return address and window call size */
unsigned long sp; /* kernel's a1: stack pointer */ unsigned long sp; /* kernel's a1: stack pointer */
/* struct xtensa_cpuinfo info; */
unsigned long bad_vaddr; /* last user fault */
unsigned long bad_uaddr; /* last kernel fault accessing user space */
unsigned long error_code;
#ifdef CONFIG_HAVE_HW_BREAKPOINT #ifdef CONFIG_HAVE_HW_BREAKPOINT
struct perf_event *ptrace_bp[XCHAL_NUM_IBREAK]; struct perf_event *ptrace_bp[XCHAL_NUM_IBREAK];
struct perf_event *ptrace_wp[XCHAL_NUM_DBREAK]; struct perf_event *ptrace_wp[XCHAL_NUM_DBREAK];
...@@ -176,10 +171,6 @@ struct thread_struct { ...@@ -176,10 +171,6 @@ struct thread_struct {
{ \ { \
ra: 0, \ ra: 0, \
sp: sizeof(init_stack) + (long) &init_stack, \ sp: sizeof(init_stack) + (long) &init_stack, \
/*info: {0}, */ \
bad_vaddr: 0, \
bad_uaddr: 0, \
error_code: 0, \
} }
......
...@@ -362,8 +362,6 @@ static void do_unaligned_user(struct pt_regs *regs) ...@@ -362,8 +362,6 @@ static void do_unaligned_user(struct pt_regs *regs)
__die_if_kernel("Unhandled unaligned exception in kernel", __die_if_kernel("Unhandled unaligned exception in kernel",
regs, SIGKILL); regs, SIGKILL);
current->thread.bad_vaddr = regs->excvaddr;
current->thread.error_code = -3;
pr_info_ratelimited("Unaligned memory access to %08lx in '%s' " pr_info_ratelimited("Unaligned memory access to %08lx in '%s' "
"(pid = %d, pc = %#010lx)\n", "(pid = %d, pc = %#010lx)\n",
regs->excvaddr, current->comm, regs->excvaddr, current->comm,
......
...@@ -206,8 +206,6 @@ void do_page_fault(struct pt_regs *regs) ...@@ -206,8 +206,6 @@ void do_page_fault(struct pt_regs *regs)
bad_area: bad_area:
mmap_read_unlock(mm); mmap_read_unlock(mm);
if (user_mode(regs)) { if (user_mode(regs)) {
current->thread.bad_vaddr = address;
current->thread.error_code = is_write;
force_sig_fault(SIGSEGV, code, (void *) address); force_sig_fault(SIGSEGV, code, (void *) address);
return; return;
} }
...@@ -232,7 +230,6 @@ void do_page_fault(struct pt_regs *regs) ...@@ -232,7 +230,6 @@ void do_page_fault(struct pt_regs *regs)
/* Send a sigbus, regardless of whether we were in kernel /* Send a sigbus, regardless of whether we were in kernel
* or user mode. * or user mode.
*/ */
current->thread.bad_vaddr = address;
force_sig_fault(SIGBUS, BUS_ADRERR, (void *) address); force_sig_fault(SIGBUS, BUS_ADRERR, (void *) address);
/* Kernel mode? Handle exceptions or die */ /* Kernel mode? Handle exceptions or die */
...@@ -252,7 +249,6 @@ bad_page_fault(struct pt_regs *regs, unsigned long address, int sig) ...@@ -252,7 +249,6 @@ bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
if ((entry = search_exception_tables(regs->pc)) != NULL) { if ((entry = search_exception_tables(regs->pc)) != NULL) {
pr_debug("%s: Exception at pc=%#010lx (%lx)\n", pr_debug("%s: Exception at pc=%#010lx (%lx)\n",
current->comm, regs->pc, entry->fixup); current->comm, regs->pc, entry->fixup);
current->thread.bad_uaddr = address;
regs->pc = entry->fixup; regs->pc = entry->fixup;
return; return;
} }
......
...@@ -159,7 +159,7 @@ static bool __report_matches(const struct expect_report *r) ...@@ -159,7 +159,7 @@ static bool __report_matches(const struct expect_report *r)
const bool is_assert = (r->access[0].type | r->access[1].type) & KCSAN_ACCESS_ASSERT; const bool is_assert = (r->access[0].type | r->access[1].type) & KCSAN_ACCESS_ASSERT;
bool ret = false; bool ret = false;
unsigned long flags; unsigned long flags;
typeof(observed.lines) expect; typeof(*observed.lines) *expect;
const char *end; const char *end;
char *cur; char *cur;
int i; int i;
...@@ -168,6 +168,10 @@ static bool __report_matches(const struct expect_report *r) ...@@ -168,6 +168,10 @@ static bool __report_matches(const struct expect_report *r)
if (!report_available()) if (!report_available())
return false; return false;
expect = kmalloc(sizeof(observed.lines), GFP_KERNEL);
if (WARN_ON(!expect))
return false;
/* Generate expected report contents. */ /* Generate expected report contents. */
/* Title */ /* Title */
...@@ -253,6 +257,7 @@ static bool __report_matches(const struct expect_report *r) ...@@ -253,6 +257,7 @@ static bool __report_matches(const struct expect_report *r)
strstr(observed.lines[2], expect[1]))); strstr(observed.lines[2], expect[1])));
out: out:
spin_unlock_irqrestore(&observed.lock, flags); spin_unlock_irqrestore(&observed.lock, flags);
kfree(expect);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment