Bug 436772

Summary: xentop segmentation fault [regression]
Product: Red Hat Enterprise Linux 5 Reporter: Adam Stokes <astokes>
Component: xenAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 5.2CC: jplans, tyamamot, xen-maint
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0305 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-21 15:21:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Fix physinfo compat crash none

Description Adam Stokes 2008-03-10 12:11:18 UTC
Description of problem:
On IA64, xentop does not work, it causes segmentation fault.

Version-Release number of selected component (if applicable):
xen-3.0.3-55.el5.ia64.rpm
Also, this issue occured even with 3.0.3-44.el5.

How reproducible:
100%

Steps to Reproduce:
1. run xentop on ia64
2.
3.
  
Actual results:
reproduced on ia64 box. It seems this segfault doesn't occur with x86 box.

# gdb /usr/sbin/xentop core.3840
GNU gdb Red Hat Linux (6.5-25.el5_1.1rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB 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.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "ia64-redhat-linux-gnu"...Using host libthread_db
library "/lib/libthread_db.so.1".


warning: Can't read pathname for load map: Input/output error.
Reading symbols from /usr/lib/libxenstore.so.3.0...Reading symbols from
/usr/lib/debug/usr/lib/libxenstore.so.3.0.0.debug...done.
done.
Loaded symbols for /usr/lib/libxenstore.so.3.0
Reading symbols from /usr/lib/libxenctrl.so.3.0...Reading symbols from
/usr/lib/debug/usr/lib/libxenctrl.so.3.0.0.debug...done.
done.
Loaded symbols for /usr/lib/libxenctrl.so.3.0
Reading symbols from /usr/lib/libncurses.so.5...done.
Loaded symbols for /usr/lib/libncurses.so.5
Reading symbols from /lib/libc.so.6.1...done.
Loaded symbols for /lib/libc.so.6.1
Reading symbols from /lib/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/ld-linux-ia64.so.2...done.
Loaded symbols for /lib/ld-linux-ia64.so.2
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Core was generated by `xentop'.
Program terminated with signal 11, Segmentation fault.
#0  0x2000000000079940 in xc_physinfo (xc_handle=3, put_info=0x60000fffff9e3558)
at xc_misc.c:87
87                  cpu_to_node[0] = NUMA_NO_NODE;
(gdb) bt
#0  0x2000000000079940 in xc_physinfo (xc_handle=3, put_info=0x60000fffff9e3558)
at xc_misc.c:87
#1  0x40000000000086f0 in xenstat_get_node (handle=0x6000000000010010, flags=15)
at src/xenstat.c:152
#2  0x4000000000004860 in top () at xentop.c:947
#3  0x4000000000006f70 in main (argc=<value optimized out>,
argv=0x60000fffff9e3a38) at xentop.c:1073
#4  0x20000000001636f0 in __libc_start_main () from /lib/libc.so.6.1
#5  0x4000000000002600 in _start ()

Expected results:
xentop works

Additional info:
tools/libxc/xc_misc.c
--------------------------------------
int xc_physinfo(int xc_handle,
               xc_physinfo_t *put_info)
{
   int ret;
   DECLARE_SYSCTL;

   sysctl.cmd = XEN_SYSCTL_physinfo;

   memcpy(&sysctl.u.physinfo, put_info, sizeof(*put_info));

   /*
    * RHEL5 ABI compat.
    * Try new physinfo sysctl first in case HV supports
    * NUMA info, else fallback to original ABI
    */
   if ( (ret = do_sysctl_version(xc_handle, &sysctl,
XEN_SYSCTL_INTERFACE_VERSION+1)) != 0) {
       /* EACCESS indicates old HV version */
       if (errno == EACCES) {
           uint32_t *cpu_to_node;

           if ( (ret = do_sysctl(xc_handle, &sysctl)) != 0 )
               return ret;

           /*
            * Fill in blank NUMA mapping info which old HV can't provide. Only need
            * to set first element since we set max_cpu_id = 0
            */
           memcpy(put_info, &sysctl.u.physinfo, sizeof(*put_info));
           put_info->max_cpu_id = 0;
           get_xen_guest_handle(cpu_to_node, put_info->cpu_to_node);
           cpu_to_node[0] = NUMA_NO_NODE;
           ... snip ...
-----------------------------------------------

(gdb) print put_info->cpu_to_node
$1 = {p = 0x0}

tools/libxc/xen/arch-ia64.h
-----------------------------------------------
#define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
-----------------------------------------------

So, because cpu_to_node is 0, "cpu_to_node[0] = NUMA_NO_NODE" failed.

Comment 4 RHEL Program Management 2008-03-11 11:20:01 UTC
This bugzilla has Keywords: Regression.  

Since no regressions are allowed between releases, 
it is also being proposed as a blocker for this release.  

Please resolve ASAP.

Comment 5 Daniel Berrangé 2008-03-12 20:27:58 UTC
FYI, this is not  ia64-specific - I have reproduced on x86_64 too


Comment 6 Bill Burns 2008-03-12 20:38:34 UTC
Set devel ack for Dan.


Comment 7 Daniel Berrangé 2008-03-14 14:21:31 UTC
Created attachment 298052 [details]
Fix physinfo compat crash

Comment 11 Masahiro Matsuya 2008-03-19 01:52:36 UTC
Can Dan see the private comment on this bugzilla?

Comment 12 Daniel Berrangé 2008-03-19 16:04:19 UTC
Fix built into 3.0.3-58.el5


Comment 14 Daniel Berrangé 2008-03-21 01:58:49 UTC
It will be included in Beta Snapshot 3 next week.

Comment 18 errata-xmlrpc 2008-05-21 15:21:43 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0305.html