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 1562125 - "setarch ppc<*>" fails with "Unrecognized architecture"
Summary: "setarch ppc<*>" fails with "Unrecognized architecture"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: util-linux
Version: 7.4
Hardware: ppc64le
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Karel Zak
QA Contact: Radka Brychtova
URL:
Whiteboard:
Depends On:
Blocks: 1546552
TreeView+ depends on / blocked
 
Reported: 2018-03-29 15:01 UTC by Renaud Métrich
Modified: 2021-06-10 15:35 UTC (History)
4 users (show)

Fixed In Version: util-linux-2.23.2-57.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 10:52:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3178 0 None None None 2018-10-30 10:53:27 UTC

Description Renaud Métrich 2018-03-29 15:01:17 UTC
Description of problem:

On a ppc64le system, trying to change the personality using "setarch ppc<*>" fails with "Unrecognized architecture", e.g.:

# uname -m
ppc64le
# setarch ppc32 uname -m
setarch: ppc32: Unrecognized architecture

Using "linux32" works:

# setarch linux32 uname -m
ppcle


Version-Release number of selected component (if applicable):

util-linux-2.23.2-43.el7_4.2.ppc64le


How reproducible:

Always


Additional info:

Running under gdb, we can see the code is working as expected, until "uname(&un)" is reached (line 218), then some "rollback" occurs (error printed on line 212).

# gdb --args /usr/bin/setarch ppc32 uname -m
(gdb) break set_arch
Breakpoint 1 at 0x10001ae8: file sys-utils/setarch.c, line 140.
(gdb) run
Starting program: /usr/bin/setarch ppc32 uname -m

Breakpoint 1, 0x0000000010001ae8 in set_arch (pers=0x3ffffffff3ca "ppc32", options=0, list=0)
    at sys-utils/setarch.c:140
140	{
(gdb) next
148	  } transitions[] = {
(gdb) 
140	{
(gdb) 
148	  } transitions[] = {
(gdb) 
140	{
(gdb) 
148	  } transitions[] = {
(gdb) 
140	{
(gdb) 
148	  } transitions[] = {
(gdb) 
201	  if (list) {
(gdb) 
207	  for(i = 0; transitions[i].perval >= 0; i++)
(gdb) 
208	      if(!strcmp(pers, transitions[i].target_arch))
(gdb) 
207	  for(i = 0; transitions[i].perval >= 0; i++)
(gdb) 
208	      if(!strcmp(pers, transitions[i].target_arch))
(gdb) 
207	  for(i = 0; transitions[i].perval >= 0; i++)
(gdb) 
208	      if(!strcmp(pers, transitions[i].target_arch))
(gdb) 
215	  if (set_pers(pers_value) == -EINVAL)
(gdb) 
218	  uname(&un);
(gdb) 
219	  if(transitions[i].result_arch &&
(gdb) p un
$1 = {sysname = "Linux", '\000' <repeats 59 times>, 
  nodename = "ibm-p8-02-lp1.rhts.eng.bos.redhat.com", '\000' <repeats 27 times>, 
  release = "3.10.0-693.21.1.el7.ppc64le", '\000' <repeats 37 times>, 
  version = "#1 SMP Fri Feb 23 14:02:56 EST 2018", '\000' <repeats 29 times>, 
  machine = "ppcle", '\000' <repeats 59 times>, domainname = "(none)", '\000' <repeats 58 times>}
(gdb) next
220		strcmp(un.machine, transitions[i].result_arch))
(gdb) 
219	  if(transitions[i].result_arch &&
(gdb) 
222	    if(strcmp(transitions[i].result_arch, "i386")
(gdb) 
212	    errx(EXIT_FAILURE, _("%s: Unrecognized architecture"), pers);
(gdb) 
setarch: ppc32: Unrecognized architecture
[Inferior 1 (process 10531) exited with code 01]

Comment 2 Renaud Métrich 2018-03-29 15:13:46 UTC
Got it.

After changing personality (line 215), there is a comparison made between "un.machine" and "transitions[i].result_arch", with following values:

- un.machine == "ppcle"
- transitions[i].result_arch == "ppc"

This makes the code fail on line 227 which has been optimized (so showing as line 212).

Comment 3 Karel Zak 2018-04-03 08:52:53 UTC
Probably already fixed in upstream (and Fedora) tree:

commit 95bf26fd68ec7f0b2dde1f022dc79d04d1a6e620

Comment 9 errata-xmlrpc 2018-10-30 10:52:39 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-2018:3178


Note You need to log in before you can comment on or make changes to this bug.