Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1440725

Summary: crash: KASLR: gdb cannot find text block for address: ring_buffer_read when extending trace.so
Product: Red Hat Enterprise Linux 7 Reporter: Emma Wu <xiawu>
Component: crashAssignee: Dave Anderson <anderson>
Status: CLOSED ERRATA QA Contact: Emma Wu <xiawu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: feij.fnst, ksanagi, qzhao, tumeya, yishimat
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: crash-7.1.9-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 22:04:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 2 Dave Anderson 2017-04-10 14:48:56 UTC
Data point -- it works OK with kernel-3.10.0-514.16.1.el7:

$ crash

crash 7.1.8-2.el7
Copyright (C) 2002-2016  Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation
Copyright (C) 1999-2006  Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012  Fujitsu Limited
Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011  NEC Corporation
Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions.  Enter "help copying" to see the conditions.
This program has absolutely no warranty.  Enter "help warranty" for details.
 
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...

      KERNEL: /usr/lib/debug/lib/modules/3.10.0-514.16.1.el7.x86_64/vmlinux
    DUMPFILE: /dev/crash
        CPUS: 8
        DATE: Mon Apr 10 10:46:48 2017
      UPTIME: 00:43:32
LOAD AVERAGE: 0.87, 0.33, 0.18
       TASKS: 222
    NODENAME: hp-xw6400-02.khw.lab.eng.bos.redhat.com
     RELEASE: 3.10.0-514.16.1.el7.x86_64
     VERSION: #1 SMP Fri Mar 10 13:12:32 EST 2017
     MACHINE: x86_64  (1595 Mhz)
      MEMORY: 2 GB
         PID: 23536
     COMMAND: "crash"
        TASK: ffff8800367a9f60  [THREAD_INFO: ffff880029050000]
         CPU: 2
       STATE: TASK_RUNNING (ACTIVE)

crash> extend trace.so
/usr/lib64/crash/extensions/trace.so: shared object loaded
crash>

Comment 3 Dave Anderson 2017-04-10 15:30:26 UTC
With kernel-3.10.0-632.el7:

crash> extend extensions/trace.so
extend: gdb cannot find text block for address: ring_buffer_read
./extensions/trace.so: shared object loaded
crash> sym ring_buffer_read
ffffffff8f145360 (T) ring_buffer_read /usr/src/debug/kernel-3.10.0-632.el7/linux-3.10.0-632.el7.x86_64/kernel/trace/ring_buffer.c: 4081
crash> 

May be KASLR-related?

Comment 4 Dave Anderson 2017-04-10 16:08:42 UTC
(In reply to Dave Anderson from comment #3)
> With kernel-3.10.0-632.el7:
> 
> crash> extend extensions/trace.so
> extend: gdb cannot find text block for address: ring_buffer_read
> ./extensions/trace.so: shared object loaded
> crash> sym ring_buffer_read
> ffffffff8f145360 (T) ring_buffer_read
> /usr/src/debug/kernel-3.10.0-632.el7/linux-3.10.0-632.el7.x86_64/kernel/
> trace/ring_buffer.c: 4081
> crash> 
> 
> May be KASLR-related?

Ok, so this is actually a crash issue, associated with KASLR.

The crash-trace-command needs to set the gdb text "scope" to that
of the ring_buffer_read() text function, or else it utilizes the 
address of an incorrect, duplicate, "ring_buffer" kernel symbol:

BZ #1265553 - crash-trace-command: failed to init the offset, struct:ftrace_event_call, member:list
https://bugzilla.redhat.com/show_bug.cgi?id=1265553

Any, the crash-trace-command module utilizes the crash utility function
gdb_set_crash_scope(), which is what is generating this error message:

extend: gdb cannot find text block for address: ring_buffer_read

The embedded gdb maintains "text blocks" based upon the contents of
the "vmlinux" file, which has kernel virtual addresses that have
been subsequently modified by KASLR when the kernel is loaded.

The fix is in the crash utility, which must revert the KASLR address
of the ring_buffer_read symbol back to the value seen in the vmlinux
file.  (It does the same thing for generating text line numbers.)

Comment 5 Dave Anderson 2017-04-10 16:25:11 UTC
Note to QE: 

It is not necessary to utilize the crash-trace-command "trace.so" extension
module to see/test this problem.

On a recent KASLR-enabled kernel, and any text symbol will fail:

$ crash

crash 7.1.8-2.el7
Copyright (C) 2002-2016  Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation
Copyright (C) 1999-2006  Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012  Fujitsu Limited
Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011  NEC Corporation
Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions.  Enter "help copying" to see the conditions.
This program has absolutely no warranty.  Enter "help warranty" for details.
 
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...

WARNING: kernel relocated [224MB]: patching 77374 gdb minimal_symbol values

      KERNEL: /usr/lib/debug/lib/modules/3.10.0-632.el7.x86_64/vmlinux 
    DUMPFILE: /dev/crash
        CPUS: 8
        DATE: Mon Apr 10 12:22:09 2017
      UPTIME: 01:02:57
LOAD AVERAGE: 0.43, 0.14, 0.09
       TASKS: 199
    NODENAME: hp-xw6400-02.khw.lab.eng.bos.redhat.com
     RELEASE: 3.10.0-632.el7.x86_64
     VERSION: #1 SMP Mon Mar 27 22:53:17 EDT 2017
     MACHINE: x86_64  (1595 Mhz)
      MEMORY: 2 GB
         PID: 14099
     COMMAND: "crash"
        TASK: ffff8800780fde20  [THREAD_INFO: ffff88006aa98000]
         CPU: 5
       STATE: TASK_RUNNING (ACTIVE)

crash> set scope sys_read
set: gdb cannot find text block for address: sys_read
crash>

Comment 6 Dave Anderson 2017-04-10 18:06:36 UTC
Fix posted to the upstream git repository:

https://github.com/crash-utility/crash/commit/270d8b40a4a0fb72e952e4db523420f83dc85d32

  Fix for the "set scope" option if the kernel was configured with
  CONFIG_RANDOMIZE_BASE.  Without the patch, the command fails with
  the message "set: gdb cannot find text block for address: <symbol>".
  This also affects extension modules that call gdb_set_crash_scope()
  when running with KASLR kernels.
  (anderson)

With the patch applied:

  crash> sys | grep RELEASE  
       RELEASE: 3.10.0-644.el7.x86_64  
  crash> set scope sys_read
    scope: ffffffff8cdfefc0 (sys_read)
  crash> extend trace.so
  ./extensions/trace.so: shared object loaded
  crash>

Comment 11 errata-xmlrpc 2017-08-01 22:04:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2019