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 626756 - test_dbm fails on ppc64 & s390x
Summary: test_dbm fails on ppc64 & s390x
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Dave Malcolm
QA Contact: Petr Šplíchal
URL:
Whiteboard:
Depends On: 624821 627266 629274
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-24 10:37 UTC by Petr Šplíchal
Modified: 2016-06-01 01:47 UTC (History)
1 user (show)

Fixed In Version: python-2.6.6-2.el6
Doc Type: Bug Fix
Doc Text:
Previously, the "in" operator for dbm mappings erroneously returned False for all keys on big-endian 64-bit builds of Python (ppc64 and s390x). This update fixes this issue.
Clone Of:
Environment:
Last Closed: 2011-05-19 11:36:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0554 0 normal SHIPPED_LIVE Moderate: python security, bug fix, and enhancement update 2011-05-19 11:35:29 UTC

Description Petr Šplíchal 2010-08-24 10:37:53 UTC
Description of problem:

Running the unit test test_dbm fails on ppc64 & s390x archs.

Version-Release number of selected component (if applicable):
python-2.6.5-3.el6.s390x

Steps to Reproduce:
# ./regrtest.py test_dbm.py

test_dbm
test test_dbm failed -- Traceback (most recent call last):
  File "/usr/lib64/python2.6/test/test_dbm.py", line 24, in test_keys
    self.assert_(k in self.d)
AssertionError

1 test failed:
    test_dbm
[psss@auto-s390-002 test]$ ./regrtest.py test_dbm.py
test_dbm
test test_dbm failed -- Traceback (most recent call last):
  File "/usr/lib64/python2.6/test/test_dbm.py", line 24, in test_keys
    self.assert_(k in self.d)
AssertionError

1 test failed:
    test_dbm

Comment 3 Dave Malcolm 2010-08-25 19:29:26 UTC
All of the various headers in gdbm-devel-1.8.0-36.el6.ppc64 define datum as:
      typedef struct {
        char *dptr;
        int   dsize;
      } datum;

Note the use of "int" for dsize.

This fragment of code in python's Modules/dbmmodule.c:dbm_contains:
          if (PyString_AsStringAndSize(v, (char **)&key.dptr,
                                       (Py_ssize_t *)&key.dsize)) {
                  return -1;
          }
assumes that
  sizeof(datum.dsize) == sizeof(Py_ssize_t)
which is not correct on these architectures; on ppc64:
(gdb) p sizeof(key.dsize)
$25 = 4
(gdb) p sizeof(Py_ssize_t)
$26 = 8

On ppc64, when PyString_AsStringAndSize writes the 0x00000000000000001 value for the ob_size of "a" to &key.dsize, I believe the 0x00000000 part is written to &key.size, and the 0x00000001 part is written to the 4 bytes following it, due to the incorrect cast from (int*) to (Py_ssize_t*)

Thankfully
(gdb) p sizeof(key)
$28 = 16
so I believe it writes this value to padding within the "datum key", rather than corrupting the stack.

The dbm_fetch() is thus invoked with a 0 dsize, and doesn't find the key, hence the test fails.

The various other uses with that source file appear correct:
(i) there are various PyArg_Parse* calls using s#, with int, which is correct, given the absence of the PY_SSIZE_T_CLEAN macro.
(ii) there are various calls of PyString_FromStringAndSize(, datum.dsize), which I believe is correct: I believe the compiler will coerce this int to the wider Py_ssize_t type.

Comment 4 Dave Malcolm 2010-08-25 20:06:53 UTC
Filed upstream as http://bugs.python.org/issue9687, with a patch

Comment 8 Laura Bailey 2011-05-10 00:36:58 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Previously, the "in" operator for dbm mappings erroneously returned False for all keys on big-endian 64-bit builds of Python (ppc64 and s390x). This update fixes this issue.

Comment 9 errata-xmlrpc 2011-05-19 11:36:52 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 therefore 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/RHSA-2011-0554.html

Comment 10 errata-xmlrpc 2011-05-19 13:07:33 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 therefore 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/RHSA-2011-0554.html


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