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 1600346

Summary: Glib assertions when libsoup is built with -O2
Product: Red Hat Enterprise Linux 6 Reporter: Matt Tyson 🤬 <mtyson>
Component: gccAssignee: Marek Polacek <mpolacek>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Michael Petlan <mpetlan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.9CC: dcallagh, jakub, ohudlick
Target Milestone: rc   
Target Release: ---   
Hardware: s390x   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-24 06:10:10 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:
Attachments:
Description Flags
reproducer
none
reproducer none

Description Matt Tyson 🤬 2018-07-12 03:55:08 UTC
Created attachment 1458255 [details]
reproducer

Our test harness for Beaker, Restraint will spew out glib assertions and crash when running on RHEL 6.9, IBM s390x, gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC). No other OS/Arch/Compiler has this problem. (Bug 1599550)

I suspect its a compiler bug.  When libsoup is compiled with -O2 the behaviour manifests.  When compiled with -O0 or -O1 the code behaves as expected.

Attached to this bug is a reproducer.
You will need python2.7.  A prebuilt RPM is available here: http://file.bne.redhat.com/~mtyson/s390/python27-2.7.14-1.el6.s390x.rpm

yum install -y libsqlite-devel libz-devel 

then run build.sh

An executable named 'test' will be created.

If libsoup is built with -O2, you will see this output.

> (process:18579): GLib-GObject-CRITICAL **: 23:44:31.333: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
> (process:18579): GLib-GObject-CRITICAL **: 23:44:31.340: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

If libsoup is built with -O1 or -O0, you will see no output.


run gdb on the test stub and break on soup_server_listen_local()

In soup_server_listen_local() two GInetAddress objects are created.  At the end of the function they are freed with calls to g_clear_object().

If libsoup is built with optimisations, g_clear_object() will be passed a NULL pointer.

> (gdb) s
> g_object_unref (_object=0x0) at gobject.c:3233

If libsoup is built with -O0 or -O1 g_clear_object() will be passed a valid pointer.

> (gdb) s
> g_object_unref (_object=0xb8ad55e0) at gobject.c:3233

Comment 2 Marek Polacek 2018-07-20 14:13:57 UTC
Unfortunately I haven't had luck reproducing this problem, running ./build:

configure: error: Package requirements (sqlite3) were not met:

No package 'sqlite3' found

But I don't know where to get that package.  Running
yum install -y libsqlite-devel libz-devel 
doesn't work, either.

It would be very interesting to check if the problem goes away with "-fwrapv".

Comment 3 Matt Tyson 🤬 2018-08-20 23:58:29 UTC
Created attachment 1477381 [details]
reproducer

Sorry about that.  I've updated the build script to compile libz and sqlite from source.  If you spin up a fresh s390x RHEL 6.9 machine, install the python RPM in comment 0 and run build.sh it should work this time.

I've tried building with -02 -fwrapv and there is no difference, the program still crashes.

See line 87 of build.sh for the CFLAG settings to tweak.

Comment 4 Matt Tyson 🤬 2018-09-03 00:26:31 UTC
Hi,

Just to update this.  I've done some more digging and traced the crash to this commit in glib2.

https://gitlab.gnome.org/GNOME/glib/commit/b1dd594a22e3499caafdeccd7fa223a032b9e177

If the patch is backed out and the old code restored, the crash goes away.

I don't know if this is a compiler bug or glib is doing something it shouldn't.

Also, I was wrong when I said RHEL6.9 only.  It turns out its all of RHEL6 S/390.

Comment 5 Dan Callaghan 2018-09-24 06:10:10 UTC
It seems likely this is just undefined behaviour or some other kind of bug in libsoup which is being revealed by that glib change, and it only happens to manifest in a crash on RHEL6 S/390. There's no evidence that this is a miscompilation or any kind of regression in gcc, so I think we can close this.