Commit 6b538db7 authored by Vineet Gupta's avatar Vineet Gupta

ARC: dw2 unwind: Catch Dwarf SNAFUs early

Instead of seeing empty stack traces, let kernel fail early so dwarf
issues can be fixed sooner
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent 6d0d5060
...@@ -296,10 +296,10 @@ static void init_unwind_hdr(struct unwind_table *table, ...@@ -296,10 +296,10 @@ static void init_unwind_hdr(struct unwind_table *table,
if (cie == &not_fde) if (cie == &not_fde)
continue; continue;
if (cie == NULL || cie == &bad_cie) if (cie == NULL || cie == &bad_cie)
return; goto ret_err;
ptrType = fde_pointer_type(cie); ptrType = fde_pointer_type(cie);
if (ptrType < 0) if (ptrType < 0)
return; goto ret_err;
ptr = (const u8 *)(fde + 2); ptr = (const u8 *)(fde + 2);
if (!read_pointer(&ptr, (const u8 *)(fde + 1) + *fde, if (!read_pointer(&ptr, (const u8 *)(fde + 1) + *fde,
...@@ -315,14 +315,14 @@ static void init_unwind_hdr(struct unwind_table *table, ...@@ -315,14 +315,14 @@ static void init_unwind_hdr(struct unwind_table *table,
} }
if (tableSize || !n) if (tableSize || !n)
return; goto ret_err;
hdrSize = 4 + sizeof(unsigned long) + sizeof(unsigned int) hdrSize = 4 + sizeof(unsigned long) + sizeof(unsigned int)
+ 2 * n * sizeof(unsigned long); + 2 * n * sizeof(unsigned long);
header = alloc(hdrSize); header = alloc(hdrSize);
if (!header) if (!header)
return; goto ret_err;
header->version = 1; header->version = 1;
header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native; header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native;
...@@ -361,6 +361,10 @@ static void init_unwind_hdr(struct unwind_table *table, ...@@ -361,6 +361,10 @@ static void init_unwind_hdr(struct unwind_table *table,
table->hdrsz = hdrSize; table->hdrsz = hdrSize;
smp_wmb(); smp_wmb();
table->header = (const void *)header; table->header = (const void *)header;
return;
ret_err:
panic("Attention !!! Dwarf FDE parsing errors\n");;
} }
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
......
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