Skip to content

Commit

Permalink
ARC: dw2 unwind: Catch Dwarf SNAFUs early
Browse files Browse the repository at this point in the history
Instead of seeing empty stack traces, let kernel fail early so dwarf
issues can be fixed sooner

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
  • Loading branch information
Vineet Gupta committed Dec 21, 2015
1 parent 6d0d506 commit 6b538db
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions arch/arc/kernel/unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ static void init_unwind_hdr(struct unwind_table *table,
if (cie == &not_fde)
continue;
if (cie == NULL || cie == &bad_cie)
return;
goto ret_err;
ptrType = fde_pointer_type(cie);
if (ptrType < 0)
return;
goto ret_err;

ptr = (const u8 *)(fde + 2);
if (!read_pointer(&ptr, (const u8 *)(fde + 1) + *fde,
Expand All @@ -315,14 +315,14 @@ static void init_unwind_hdr(struct unwind_table *table,
}

if (tableSize || !n)
return;
goto ret_err;

hdrSize = 4 + sizeof(unsigned long) + sizeof(unsigned int)
+ 2 * n * sizeof(unsigned long);

header = alloc(hdrSize);
if (!header)
return;
goto ret_err;

header->version = 1;
header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native;
Expand Down Expand Up @@ -361,6 +361,10 @@ static void init_unwind_hdr(struct unwind_table *table,
table->hdrsz = hdrSize;
smp_wmb();
table->header = (const void *)header;
return;

ret_err:
panic("Attention !!! Dwarf FDE parsing errors\n");;
}

#ifdef CONFIG_MODULES
Expand Down

0 comments on commit 6b538db

Please sign in to comment.