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 837621

Summary: sa -u cause Segmentation fault
Product: Red Hat Enterprise Linux 6 Reporter: Branislav Náter <bnater>
Component: psacctAssignee: Jaromír Cápík <jcapik>
Status: CLOSED CURRENTRELEASE QA Contact: Branislav Náter <bnater>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: jpallich, ovasik
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-14 10:41:11 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:
Bug Depends On:    
Bug Blocks: 838998    

Description Branislav Náter 2012-07-04 12:09:56 UTC
Description of problem:
Running sa -u (print also user id) command cause Segmentation fault on i386 and s390x archs and produce incorect output on x86_64.

Version-Release number of selected component (if applicable):
psacct-6.3.2-63.el6_3.2

How reproducible:
always

Steps to Reproduce:
1. run "sa -u"
  
Actual results on different archs:
ppc64:  root       0.00 cpu       62k mem accton
x86_64: 13179672   0.00 cpu      979k mem accton
i386:   Segmentation fault
s390x:  Segmentation fault

Expected results:
root       0.00 cpu       62k mem accton

Additional info:
Output seems to be correct only on ppc64 architecture.

Traceback from i386:
(gdb) t a a bt

Thread 1 (process 14151):
#0  0x0804a3f4 in parse_acct_entries () at sa.c:1254
#1  0x0804abea in main (argc=2, argv=0xbffff364) at sa.c:585

Traceback from s390x:
(gdb) t a a bt

Thread 1 (process 8385):
#0  0x0000000080002b96 in parse_acct_entries () at sa.c:1254
#1  0x0000000080003312 in main (argc=<value optimized out>, argv=<value optimized out>) at sa.c:585

Comment 1 Jaromír Cápík 2012-07-10 14:00:21 UTC
rec->ac_uid is invalid for some reason ... needs a deeper analysis.

Comment 2 Jaromír Cápík 2012-07-10 14:19:56 UTC
Some parts of the code are really very strange ...

----------------------------------------------------

#if __BYTE_ORDER == __BIG_ENDIAN
# define ACCT_BYTEORDER 0x80        /* Accounting file is big endian.  */
#else
# define ACCT_BYTEORDER 0x00        /* Accounting file is little endian.  */
#endif

...
...

if ((version % ACCT_BYTEORDER) != 3) {

----------------------------------------------------

Anything modulo 0 must throw SIGFPE ... 

Fortunately the structure seems to be BIG ENDIAN even on LITTLE_ENDIAN architectures ... this has been redesigned in the new upstream version.

Comment 3 Jaromír Cápík 2012-07-10 14:30:49 UTC
It seems I've found the issue. The ac_uid field needs to be read from the rec_v3 variable in case of acct_v3 structures. The acct structure version detection is a bit nonsense, but it doesn't cause the trouble. It was a human factor ... a cut'n'paste issue. Gonna test that on other architectures.