diff options
author | Matt Fleming <matt@console-pimps.org> | 2009-08-20 14:42:34 -0400 |
---|---|---|
committer | Matt Fleming <matt@console-pimps.org> | 2009-08-21 08:04:10 -0400 |
commit | 5480675dc60c7dda7146e506981b2b40a775cc1e (patch) | |
tree | 71f0f32d67e7d13d484ff1f3cd9af85259d288ac /arch/sh/kernel/dwarf.c | |
parent | fe98dd31eb9fe055703e0171134b4d074558d4e9 (diff) |
sh: Fix bug calculating the end of the FDE instructions
The 'end' member of struct dwarf_fde denotes one byte past the end of
the CFA instruction stream for an FDE. The value of 'end' was being
calcualted incorrectly, it was being set too high. This resulted in
dwarf_cfa_execute_insns() interpreting data past the end of valid
instructions, thus causing all sorts of weird crashes.
Signed-off-by: Matt Fleming <matt@console-pimps.org>
Diffstat (limited to 'arch/sh/kernel/dwarf.c')
-rw-r--r-- | arch/sh/kernel/dwarf.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c index 606ece37eb42..e6f427cff5ba 100644 --- a/arch/sh/kernel/dwarf.c +++ b/arch/sh/kernel/dwarf.c | |||
@@ -751,7 +751,8 @@ static int dwarf_parse_cie(void *entry, void *p, unsigned long len, | |||
751 | } | 751 | } |
752 | 752 | ||
753 | static int dwarf_parse_fde(void *entry, u32 entry_type, | 753 | static int dwarf_parse_fde(void *entry, u32 entry_type, |
754 | void *start, unsigned long len) | 754 | void *start, unsigned long len, |
755 | unsigned char *end) | ||
755 | { | 756 | { |
756 | struct dwarf_fde *fde; | 757 | struct dwarf_fde *fde; |
757 | struct dwarf_cie *cie; | 758 | struct dwarf_cie *cie; |
@@ -798,7 +799,7 @@ static int dwarf_parse_fde(void *entry, u32 entry_type, | |||
798 | 799 | ||
799 | /* Call frame instructions. */ | 800 | /* Call frame instructions. */ |
800 | fde->instructions = p; | 801 | fde->instructions = p; |
801 | fde->end = start + len; | 802 | fde->end = end; |
802 | 803 | ||
803 | /* Add to list. */ | 804 | /* Add to list. */ |
804 | spin_lock_irqsave(&dwarf_fde_lock, flags); | 805 | spin_lock_irqsave(&dwarf_fde_lock, flags); |
@@ -932,7 +933,7 @@ static int __init dwarf_unwinder_init(void) | |||
932 | else | 933 | else |
933 | c_entries++; | 934 | c_entries++; |
934 | } else { | 935 | } else { |
935 | err = dwarf_parse_fde(entry, entry_type, p, len); | 936 | err = dwarf_parse_fde(entry, entry_type, p, len, end); |
936 | if (err < 0) | 937 | if (err < 0) |
937 | goto out; | 938 | goto out; |
938 | else | 939 | else |