[Crash-utility] [PATCH 1/3] arm64: relax symbol filters

Andrew Jones drjones at redhat.com
Thu Nov 19 18:41:19 UTC 2015


On Thu, Nov 19, 2015 at 11:33:34AM -0500, Andrew Jones wrote:
> On Thu, Nov 19, 2015 at 11:18:45AM -0500, Dave Anderson wrote:
> > 
> > 
> > ----- Original Message -----
> > > We need to pass some absolute symbols through, but the highest bit test
> > > is filtering all of them out. Remove that, and filter more specifically.
> > > ---
> > >  arm64.c | 4 ++--
> > >  defs.h  | 3 +++
> > >  2 files changed, 5 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/arm64.c b/arm64.c
> > > index 5f8e2f6852434..8cfb863d1bfe2 100644
> > > --- a/arm64.c
> > > +++ b/arm64.c
> > > @@ -305,7 +305,7 @@ arm64_verify_symbol(const char *name, ulong value, char
> > > type)
> > >  	if (!name || !strlen(name))
> > >  		return FALSE;
> > >  
> > > -	if (((type == 'A') || (type == 'a')) && (highest_bit_long(value) != 63))
> > > +	if ((type == 'A') && (HAS_SUFFIX(name, ".c") || HAS_SUFFIX(name, ".o")))
> > >  		return FALSE;
> > >  
> > >  	if ((value == 0) &&
> > > @@ -315,7 +315,7 @@ arm64_verify_symbol(const char *name, ulong value, char
> > > type)
> > >  	if (STREQ(name, "$d") || STREQ(name, "$x"))
> > >  		return FALSE;
> > >  	
> > > -	if ((type == 'A') && STRNEQ(name, "__crc_"))
> > > +	if ((type == 'A') && (STRNEQ(name, "__crc_") || STRNEQ(name,
> > > "__reg_num_")))
> > >  		return FALSE;
> > >  
> > >  	if (!(machdep->flags & KSYMS_START) && STREQ(name, "idmap_pg_dir"))
> > > diff --git a/defs.h b/defs.h
> > > index 7004619017e41..1bcd1b3b177db 100644
> > > --- a/defs.h
> > > +++ b/defs.h
> > > @@ -155,6 +155,9 @@ static inline int string_exists(char *s) { return (s ?
> > > TRUE : FALSE); }
> > >  	(strcmp((char *)(A), (char *)(B)) == 0))
> > >  #define STRNEQ(A, B)     (string_exists((char *)A) && string_exists((char
> > >  *)B) && \
> > >          (strncmp((char *)(A), (char *)(B), strlen((char *)(B))) == 0))
> > > +#define HAS_SUFFIX(s, suffix) (string_exists((char *)s) &&
> > > string_exists((char *)suffix) && \
> > > +        strlen((char *)s) > strlen((char *)suffix) && \
> > > +        (strcmp((char *)(s) + strlen((char *)s) - strlen((char *)suffix),
> > > (char *)suffix) == 0))
> > >  #define BZERO(S, N)      (memset(S, NULLCHAR, N))
> > >  #define BCOPY(S, D, C)   (memcpy(D, S, C))
> > >  #define BNEG(S, N)       (memset(S, 0xff, N))
> > > --
> > > 2.4.3
> > 
> > 
> > Hi Andrew,
> > 
> > Hey, I appreciate the arm/arm64 interest!  
> > 
> > Let's start with this patch first...
> > 
> > The "upper-level" symbol table kept by the crash-specific source 
> > code is only concerned with symbols that are kernel virtual addresses.
> > Accordingly, the absolute symbols are stripped, and the ARM64 symbol
> > table normally starts like this:
> > 
> >   crash> sym -l
> >   fffffe0000080000 (t) .head.text
> >   fffffe0000080000 (T) _text
> >   fffffe0000080000 (t) efi_head
> >   fffffe0000080040 (t) pe_header
> >   fffffe0000080044 (t) coff_header
> >   fffffe0000080058 (t) optional_header
> >   fffffe0000080070 (t) extra_header_fields
> >   fffffe00000800f8 (t) section_table
> >   fffffe0000081000 (T) stext
> >   fffffe0000081024 (t) preserve_boot_args
> >   ...
> >   
> > With your patch 1/3 applied, it starts like this:
> >   
> >   crash> syms -l
> >   0 (A) _kernel_flags_le
> >   1 (a) __reg_num_x1
> >   1 (a) __reg_num_x1
> >   1 (a) __reg_num_x1
> >   1 (a) __reg_num_x1
> >   1 (a) __reg_num_x1
> >   1 (a) __reg_num_x1
> >   1 (a) __reg_num_x1
> >   2 (a) __reg_num_x2
> >   2 (a) __reg_num_x2
> >   2 (a) __reg_num_x2
> >   2 (a) __reg_num_x2
> >   2 (a) __reg_num_x2
> >   2 (a) __reg_num_x2
> >   2 (a) __reg_num_x2
> >   3 (a) __reg_num_x3
> >   3 (a) __reg_num_x3
> >   3 (a) __reg_num_x3
> >   3 (a) __reg_num_x3
> >   3 (a) __reg_num_x3
> >   3 (a) __reg_num_x3
> >   3 (a) __reg_num_x3
> >   4 (a) __reg_num_x4
> >   4 (a) __reg_num_x4
> >   4 (a) __reg_num_x4
> >   4 (a) __reg_num_x4
> >   4 (a) __reg_num_x4
> >   4 (a) __reg_num_x4
> >   4 (a) __reg_num_x4
> >   5 (a) __reg_num_x5
> >   5 (a) __reg_num_x5
> >   5 (a) __reg_num_x5
> >   5 (a) __reg_num_x5
> >   5 (a) __reg_num_x5
> >   5 (a) __reg_num_x5
> >   5 (a) __reg_num_x5
> >   6 (a) __reg_num_x6
> >   6 (a) __reg_num_x6
> >   6 (a) __reg_num_x6
> >   6 (a) __reg_num_x6
> >   6 (a) __reg_num_x6
> >   6 (a) __reg_num_x6
> >   6 (a) __reg_num_x6
> >   7 (a) __reg_num_x7
> >   7 (a) __reg_num_x7
> >   7 (a) __reg_num_x7
> >   7 (a) __reg_num_x7
> >   7 (a) __reg_num_x7
> >   7 (a) __reg_num_x7
> >   7 (a) __reg_num_x7
> >   8 (a) __reg_num_x8
> >   8 (a) __reg_num_x8
> >   8 (a) __reg_num_x8
> >   8 (a) __reg_num_x8
> >   8 (a) __reg_num_x8
> >   8 (a) __reg_num_x8
> >   8 (a) __reg_num_x8
> >   9 (a) __reg_num_x9
> >   9 (a) __reg_num_x9
> >   9 (a) __reg_num_x9
> >   9 (a) __reg_num_x9
> >   9 (a) __reg_num_x9
> >   9 (a) __reg_num_x9
> >   9 (a) __reg_num_x9
> >   a (a) __reg_num_x10
> >   a (a) __reg_num_x10
> >   a (a) __reg_num_x10
> >   a (a) __reg_num_x10
> >   a (a) __reg_num_x10
> >   a (a) __reg_num_x10
> >   a (a) __reg_num_x10
> >   b (a) __reg_num_x11
> >   b (a) __reg_num_x11
> >   b (a) __reg_num_x11
> >   b (a) __reg_num_x11
> >   b (a) __reg_num_x11
> >   b (a) __reg_num_x11
> >   b (a) __reg_num_x11
> >   c (a) __reg_num_x12
> >   c (a) __reg_num_x12
> >   c (a) __reg_num_x12
> >   c (a) __reg_num_x12
> >   c (a) __reg_num_x12
> >   c (a) __reg_num_x12
> >   c (a) __reg_num_x12
> >   d (a) __reg_num_x13
> >   d (a) __reg_num_x13
> >   d (a) __reg_num_x13
> >   d (a) __reg_num_x13
> >   d (a) __reg_num_x13
> >   d (a) __reg_num_x13
> >   d (a) __reg_num_x13
> >   e (a) __reg_num_x14
> >   e (a) __reg_num_x14
> >   e (a) __reg_num_x14
> >   e (a) __reg_num_x14
> >   e (a) __reg_num_x14
> >   e (a) __reg_num_x14
> >   e (a) __reg_num_x14
> >   f (a) __reg_num_x15
> >   f (a) __reg_num_x15
> >   f (a) __reg_num_x15
> >   f (a) __reg_num_x15
> >   f (a) __reg_num_x15
> >   f (a) __reg_num_x15
> >   f (a) __reg_num_x15
> >   10 (a) __reg_num_x16
> >   10 (a) __reg_num_x16
> >   10 (a) __reg_num_x16
> >   10 (a) __reg_num_x16
> >   10 (a) __reg_num_x16
> >   10 (a) __reg_num_x16
> >   10 (a) __reg_num_x16
> >   11 (a) __reg_num_x17
> >   11 (a) __reg_num_x17
> >   11 (a) __reg_num_x17
> >   11 (a) __reg_num_x17
> >   11 (a) __reg_num_x17
> >   11 (a) __reg_num_x17
> >   11 (a) __reg_num_x17
> >   12 (a) __reg_num_x18
> >   12 (a) __reg_num_x18
> >   12 (a) __reg_num_x18
> >   12 (a) __reg_num_x18
> >   12 (a) __reg_num_x18
> >   12 (a) __reg_num_x18
> >   12 (a) __reg_num_x18
> >   13 (a) __reg_num_x19
> >   13 (a) __reg_num_x19
> >   13 (a) __reg_num_x19
> >   13 (a) __reg_num_x19
> >   13 (a) __reg_num_x19
> >   13 (a) __reg_num_x19
> >   13 (a) __reg_num_x19
> >   14 (a) __reg_num_x20
> >   14 (a) __reg_num_x20
> >   14 (a) __reg_num_x20
> >   14 (a) __reg_num_x20
> >   14 (a) __reg_num_x20
> >   14 (a) __reg_num_x20
> >   14 (a) __reg_num_x20
> >   15 (a) __reg_num_x21
> >   15 (a) __reg_num_x21
> >   15 (a) __reg_num_x21
> >   15 (a) __reg_num_x21
> >   15 (a) __reg_num_x21
> >   15 (a) __reg_num_x21
> >   15 (a) __reg_num_x21
> >   16 (a) __reg_num_x22
> >   16 (a) __reg_num_x22
> >   16 (a) __reg_num_x22
> >   16 (a) __reg_num_x22
> >   16 (a) __reg_num_x22
> >   16 (a) __reg_num_x22
> >   16 (a) __reg_num_x22
> >   17 (a) __reg_num_x23
> >   17 (a) __reg_num_x23
> >   17 (a) __reg_num_x23
> >   17 (a) __reg_num_x23
> >   17 (a) __reg_num_x23
> >   17 (a) __reg_num_x23
> >   17 (a) __reg_num_x23
> >   18 (a) __reg_num_x24
> >   18 (a) __reg_num_x24
> >   18 (a) __reg_num_x24
> >   18 (a) __reg_num_x24
> >   18 (a) __reg_num_x24
> >   18 (a) __reg_num_x24
> >   18 (a) __reg_num_x24
> >   19 (a) __reg_num_x25
> >   19 (a) __reg_num_x25
> >   19 (a) __reg_num_x25
> >   19 (a) __reg_num_x25
> >   19 (a) __reg_num_x25
> >   19 (a) __reg_num_x25
> >   19 (a) __reg_num_x25
> >   1a (a) __reg_num_x26
> >   1a (a) __reg_num_x26
> >   1a (a) __reg_num_x26
> >   1a (a) __reg_num_x26
> >   1a (a) __reg_num_x26
> >   1a (a) __reg_num_x26
> >   1a (a) __reg_num_x26
> >   1b (a) __reg_num_x27
> >   1b (a) __reg_num_x27
> >   1b (a) __reg_num_x27
> >   1b (a) __reg_num_x27
> >   1b (a) __reg_num_x27
> >   1b (a) __reg_num_x27
> >   1b (a) __reg_num_x27
> >   1c (a) __reg_num_x28
> >   1c (a) __reg_num_x28
> >   1c (a) __reg_num_x28
> >   1c (a) __reg_num_x28
> >   1c (a) __reg_num_x28
> >   1c (a) __reg_num_x28
> >   1c (a) __reg_num_x28
> >   1d (a) __reg_num_x29
> >   1d (a) __reg_num_x29
> >   1d (a) __reg_num_x29
> >   1d (a) __reg_num_x29
> >   1d (a) __reg_num_x29
> >   1d (a) __reg_num_x29
> >   1d (a) __reg_num_x29
> >   1e (a) __reg_num_x30
> >   1e (a) __reg_num_x30
> >   1e (a) __reg_num_x30
> >   1e (a) __reg_num_x30
> >   1e (a) __reg_num_x30
> >   1e (a) __reg_num_x30
> >   1e (a) __reg_num_x30
> >   1f (a) __reg_num_xzr
> >   1f (a) __reg_num_xzr
> >   1f (a) __reg_num_xzr
> >   1f (a) __reg_num_xzr
> >   1f (a) __reg_num_xzr
> >   1f (a) __reg_num_xzr
> >   1f (a) __reg_num_xzr
> 
> Oops, I should have checked for type == 'a' when filtering these
> __reg_num_* symbols instead of type == 'A' (or both?).
> 
> >   200 (A) PECOFF_FILE_ALIGNMENT
> >   1000 (A) stext_offset
> >   80000 (A) _kernel_offset_le
> >   1460000 (A) _kernel_size_le
> >   fffffe0000080000 (t) .head.text
> >   fffffe0000080000 (T) _text
> >   fffffe0000080000 (t) efi_head
> >   fffffe0000080040 (t) pe_header
> >   ...
> > 
> > But keeping any absolute symbols below ".head.text" screws things up.
> > Say for example, here's a normal "rd -S" call:
> >   
> >   crash> rd -S fffffe035a2f6580 100
> >   fffffe035a2f6580:  0000000000000000 [kmalloc-16384]  
> >   fffffe035a2f6590:  0040410000000002 0000000000000000 
> >   fffffe035a2f65a0:  0000000000000000 0000000000000001 
> >   fffffe035a2f65b0:  [task_struct]    0000000000000002 
> >   fffffe035a2f65c0:  000000010c4ac06a 0000000100000000 
> >   fffffe035a2f65d0:  0000007800000078 0000000000000078 
> >   fffffe035a2f65e0:  fair_sched_class 0000000000000400 
> >   fffffe035a2f65f0:  0000000000400000 0000000000000001 
> >   fffffe035a2f6600:  0000000000000000 0000000000000000 
> >   fffffe035a2f6610:  fffffe03ffec5878 [task_struct]    
> >   fffffe035a2f6620:  0000000000000001 000754096e1781d0 
> >   fffffe035a2f6630:  0000000157d0df88 000000004c7c03e4 
> >   fffffe035a2f6640:  0000000157cffbf4 0000000000000013 
> >   fffffe035a2f6650:  0000000000000001 [kmalloc-192]    
> >   fffffe035a2f6660:  [kmalloc-512]    0000000000000000 
> >   fffffe035a2f6670:  000754096e169e3c 0000000000000000 
> >   fffffe035a2f6680:  0000000000000000 0000000000000000 
> >   fffffe035a2f6690:  0000b9f100000026 0000000000000026 
> >   fffffe035a2f66a0:  [task_struct]    [task_struct]    
> >   fffffe035a2f66b0:  0000000000000000 0000000000000000 
> >   fffffe035a2f66c0:  000000000000000a 0000000000000000 
> >   fffffe035a2f66d0:  0000000000000000 fffffe03ffec5050 
> >   fffffe035a2f66e0:  0000000000000000 [kmalloc-1024]   
> >   fffffe035a2f66f0:  [task_struct]    0000000000000000 
> >   fffffe035a2f6700:  0000000000000000 0000000000000000 
> >   fffffe035a2f6710:  0000000000000000 0000000000000000 
> >   fffffe035a2f6720:  0000000000000000 0000000000000000 
> >   fffffe035a2f6730:  0000000000000000 0000000000000000 
> >   fffffe035a2f6740:  0000000000000001 0000000000000000 
> >   fffffe035a2f6750:  [task_struct]    0000000000000000 
> >   fffffe035a2f6760:  0000000000000000 0000000000000000
> >   crash>
> >   
> > With your patch applied, it looks like this:
> >   
> >   crash> rd -S fffffe035a2f6580 100
> >   fffffe035a2f6580:  __reg_num_x1     [kmalloc-16384]  
> >   fffffe035a2f6590:  _kernel_size_le+18085866743922690 _kernel_flags_le 
> >   fffffe035a2f65a0:  _kernel_flags_le _kernel_flags_le 
> >   fffffe035a2f65b0:  [task_struct]    __reg_num_x3     
> >   fffffe035a2f65c0:  _kernel_size_le+4479828301 __reg_num_x1     
> >   fffffe035a2f65d0:  _kernel_size_le+515374710904 __reg_num_xzr+89 
> >   fffffe035a2f65e0:  fair_sched_class PECOFF_FILE_ALIGNMENT+512 
> >   fffffe035a2f65f0:  _kernel_offset_le+3670016 __reg_num_x1     
> >   fffffe035a2f6600:  _kernel_flags_le _kernel_flags_le 
> >   fffffe035a2f6610:  [task_struct]    [task_struct]    
> >   fffffe035a2f6620:  _kernel_flags_le _kernel_size_le+2062727142285104 
> >   fffffe035a2f6630:  _kernel_size_le+5760795604 _kernel_size_le+1409972385 
> >   fffffe035a2f6640:  _kernel_size_le+5760749924 __reg_num_x20    
> >   fffffe035a2f6650:  __reg_num_x1     [kmalloc-192]    
> >   fffffe035a2f6660:  [kmalloc-512]    _kernel_flags_le 
> >   fffffe035a2f6670:  _kernel_size_le+2062727142285104 _kernel_size_le+1945805182 
> >   fffffe035a2f6680:  _kernel_flags_le _kernel_flags_le 
> >   fffffe035a2f6690:  _kernel_size_le+204101119508525 __reg_num_xzr+14 
> >   fffffe035a2f66a0:  [task_struct]    [task_struct]    
> >   fffffe035a2f66b0:  _kernel_flags_le _kernel_flags_le 
> >   fffffe035a2f66c0:  __reg_num_x10    _kernel_flags_le 
> >   fffffe035a2f66d0:  _kernel_flags_le fffffe03ffee5050 
> >   fffffe035a2f66e0:  _kernel_flags_le [kmalloc-1024]   
> >   fffffe035a2f66f0:  [task_struct]    _kernel_flags_le 
> >   fffffe035a2f6700:  _kernel_flags_le _kernel_flags_le 
> >   fffffe035a2f6710:  _kernel_flags_le _kernel_flags_le 
> >   fffffe035a2f6720:  _kernel_flags_le _kernel_flags_le 
> >   fffffe035a2f6730:  _kernel_flags_le _kernel_flags_le 
> >   fffffe035a2f6740:  __reg_num_x1     _kernel_flags_le 
> >   fffffe035a2f6750:  [task_struct]    _kernel_flags_le 
> >   fffffe035a2f6760:  _kernel_flags_le _kernel_flags_le 
> >   crash> 
> 
> Ah, I see. I missed that we'd end up uglifying things with automatic
> symbol+offset name outputting.
> 
> >   
> > As I understand it, you're only interested in the "_kernel_flags_le"
> > value, so let's just key on that particular absolute symbol in 
> > arm64_verify_symbol(), and stash it aside for later use.
> 
> Sounds good to me. Or, is there a way to flag symbols that we don't
> want to use automatically for the nearby addresses? We could then filter
> the absolutes we know that we don't want, e.g. __crc_* and __reg_num_*,
> but then have a final
> 
> if (type == 'A' || type == 'a')
>    flag_dont_use_symbol_for_nearest_addresses(symbol);
> 
> type of thing?
>

Below is a (hardly tested, pretty messy, incomplete - needs to address
other architectures verify_symbol() prototypes) patch that illustrates
this idea. I'm OK with special casing _kernel_flags_le, but generally
prefer to look for general solutions. Let me know if you like anything
in the patch below, if so, then I can clean it up and send it properly.
The patch takes care of the two cases pointed above, i.e. 'sym -l' and
'rd -S'.

Thanks,
drew

Author: Andrew Jones <drjones at redhat.com>
Date:   Thu Nov 19 19:31:28 2015 +0100

    symbols: keep absolutes, but handle specially

diff --git a/arm64.c b/arm64.c
index 91b35787e6942..534d301c39afd 100644
--- a/arm64.c
+++ b/arm64.c
@@ -24,7 +24,7 @@
 #define NOT_IMPLEMENTED(X) error((X), "%s: function not implemented\n", __func__)
 
 static struct machine_specific arm64_machine_specific = { 0 };
-static int arm64_verify_symbol(const char *, ulong, char);
+static int arm64_verify_symbol(const char *, ulong, char, unsigned char *);
 static void arm64_parse_cmdline_args(void);
 static void arm64_calc_phys_offset(void);
 static void arm64_calc_virtual_memory_ranges(void);
@@ -330,7 +330,7 @@ arm64_init(int when)
  * Accept or reject a symbol from the kernel namelist.
  */
 static int
-arm64_verify_symbol(const char *name, ulong value, char type)
+arm64_verify_symbol(const char *name, ulong value, char type, unsigned char *flags)
 {
 	if (!name || !strlen(name))
 		return FALSE;
@@ -345,9 +345,13 @@ arm64_verify_symbol(const char *name, ulong value, char type)
 	if (STREQ(name, "$d") || STREQ(name, "$x"))
 		return FALSE;
 	
-	if ((type == 'A') && (STRNEQ(name, "__crc_") || STRNEQ(name, "__reg_num_")))
+	if ((type == 'A' || type == 'a') &&
+            (STRNEQ(name, "__crc_") || STRNEQ(name, "__reg_num_")))
 		return FALSE;
 
+	if ((type == 'A' || type == 'a') && flags)
+		*flags |= SYMBOL_NO_OFFSET;
+
 	if (!(machdep->flags & KSYMS_START) && STREQ(name, "idmap_pg_dir"))
 		machdep->flags |= KSYMS_START;
 
diff --git a/defs.h b/defs.h
index 981b030cc6688..3b6fd15496063 100644
--- a/defs.h
+++ b/defs.h
@@ -969,7 +969,7 @@ struct machdep_table {
 	uint64_t (*memory_size)(void);
 	ulong (*vmalloc_start)(void);
         int (*is_task_addr)(ulong);
-	int (*verify_symbol)(const char *, ulong, char);
+	int (*verify_symbol)(const char *, ulong, char, unsigned char *);
 	int (*dis_filter)(ulong, char *, unsigned int);
 	int (*get_smp_cpus)(void);
         int (*is_kvaddr)(ulong);
@@ -2412,6 +2412,7 @@ struct rb_root
 
 #define SYMBOL_NAME_USED (0x1)
 #define MODULE_SYMBOL    (0x2)
+#define SYMBOL_NO_OFFSET (0x4)
 #define IS_MODULE_SYMBOL(SYM)  ((SYM)->flags & MODULE_SYMBOL)
 
 struct syment {
diff --git a/symbols.c b/symbols.c
index 5a2aa7ccb5713..bcd2e4e1947fb 100644
--- a/symbols.c
+++ b/symbols.c
@@ -716,6 +716,8 @@ store_symbols(bfd *abfd, int dynamic, void *minisyms, long symcount,
 
   	for (; from < fromend; from += size)
     	{
+		unsigned char flags = 0;
+
       		if ((sym = bfd_minisymbol_to_symbol(abfd, dynamic, from, store))
       		    == NULL)
 			error(FATAL, "bfd_minisymbol_to_symbol() failed\n");
@@ -724,13 +726,14 @@ store_symbols(bfd *abfd, int dynamic, void *minisyms, long symcount,
 		name = strip_symbol_end(syminfo.name, buf);
 
 		if (machdep->verify_symbol(name, syminfo.value, 
-		    syminfo.type)) {
+		    syminfo.type, &flags)) {
 			if (kt->flags & (RELOC_SET|RELOC_FORCE))
 				sp->value = relocate(syminfo.value,
 					(char *)syminfo.name, !(first++));
 			else
 				sp->value = syminfo.value;
 			sp->type = syminfo.type;
+			sp->flags = flags;
 			namespace_ctl(NAMESPACE_INSTALL, &st->kernel_namespace,
 				sp, name); 
 			sp++;
@@ -789,6 +792,9 @@ store_sysmap_symbols(void)
 	rewind(map);
 
 	while (fgets(buf, BUFSIZE, map)) {
+
+		unsigned char flags = 0;
+
 		if ((c = parse_line(buf, mapitems)) != 3)
 			continue;
 
@@ -800,13 +806,14 @@ store_sysmap_symbols(void)
 		strip_symbol_end(name, NULL);
 
                 if (machdep->verify_symbol(name, syment.value, 
-		    syment.type)) {
+		    syment.type, &flags)) {
 			if (kt->flags & RELOC_SET)
 				sp->value = relocate(syment.value,
 					syment.name, !(first++));
 			else
 				sp->value = syment.value;
                         sp->type = syment.type;
+			sp->flags = flags;
                         namespace_ctl(NAMESPACE_INSTALL, &st->kernel_namespace,
                                 sp, name);
                         sp++;
@@ -2243,7 +2250,7 @@ store_module_kallsyms_v2(struct load_module *lm, int start, int curr,
 		 * Make sure that these don't end up into our symbol list.
 		 */
 		if (machine_type("ARM") &&
-		    !machdep->verify_symbol(nameptr, ec->st_value, ec->st_info))
+		    !machdep->verify_symbol(nameptr, ec->st_value, ec->st_info, NULL))
 			continue;
 
 		if (CRASHDEBUG(7))
@@ -3908,7 +3915,12 @@ show_symbol(struct syment *sp, ulong offset, ulong show_flags)
                 fprintf(fp, (radix == 16) ?
 			"%lx (%c) %s+0x%lx" : "%lx (%c) %s+%ld", 
 			sp->value+offset, sp->type, sp->name, offset);
-        else
+        else if (highest_bit_long(sp->value) != highest_bit_long(ULONG_MAX))
+		if (highest_bit_long(ULONG_MAX) > 31)
+                	fprintf(fp, "%016lx (%c) %s", sp->value, sp->type, sp->name);
+		else
+                	fprintf(fp, "%08lx (%c) %s", sp->value, sp->type, sp->name);
+	else
                 fprintf(fp, "%lx (%c) %s", sp->value, sp->type, sp->name);
 
 	if (lm)
@@ -4692,7 +4704,7 @@ value_to_symstr(ulong value, char *buf, ulong radix)
 	if ((radix != 10) && (radix != 16))
 		radix = 16;
 
-        if ((sp = value_search(value, &offset))) {
+        if ((sp = value_search(value, &offset)) && !(sp->flags & SYMBOL_NO_OFFSET)) {
                 if (offset)
                         sprintf(buf, radix == 16 ? "%s+0x%lx" : "%s+%ld",
 				sp->name, offset);
@@ -11446,14 +11458,15 @@ store_load_module_symbols(bfd *bfd, int dynamic, void *minisyms,
                 }
 
                 if (found) {
+			unsigned char flags = 0;
                         strcpy(name, syminfo.name);
                         strip_module_symbol_end(name);
 			strip_symbol_end(name, NULL);
                         if (machdep->verify_symbol(name, syminfo.value,
-                            syminfo.type)) {
+                            syminfo.type, &flags)) {
                                 sp->value = syminfo.value;
                                 sp->type = syminfo.type;
-				sp->flags |= MODULE_SYMBOL;
+				sp->flags |= (MODULE_SYMBOL | flags);
                                 namespace_ctl(NAMESPACE_INSTALL,
                                         &lm->mod_load_namespace, sp, name);
 




More information about the Crash-utility mailing list