Bug 1555397

Summary: backport s390 -mpic-data-is-text-relative feature
Product: Red Hat Enterprise Linux 7 Reporter: Joe Lawrence <joe.lawrence>
Component: gccAssignee: Marek Polacek <mpolacek>
Status: CLOSED ERRATA QA Contact: Michael Petlan <mpetlan>
Severity: unspecified Docs Contact: Vladimír Slávik <vslavik>
Priority: unspecified    
Version: 7.6CC: bgollahe, jakub, jpoimboe, mcermak, mnewsome, ohudlick, vslavik
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-4.8.5-31.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 07:27:17 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: 1505884    

Description Joe Lawrence 2018-03-14 15:40:45 UTC
In order to support kpatch on s390x architecture, we'd like to have the -mpic-data-is-text-relative feature backported to RHEL7.

Quick background of how kpatch works: kpatch patches code on a per-function basis and relies on ftrace for function redirection from old to new funcs.  The patched binary code containing the new functions is placed in a kernel module, and kpatch manually applies relocations to the new code at module load time.

On s390x, things become interesting when we stick patched code for vmlinux in a kernel module. One obstacle we've run into is when the compiled code uses R_390_PC32DBL relocations, which utilize 32-bit relative displacements.  However, kernel modules are placed at the tail end of the kernel address space, rendering these relocations non-functional, since the displacement to vmlinux symbols on the other end of the address space is larger than what can fit in a 32-bit field.

To work around this issue, we worked upstream with Martin Schwidefsky and Andreas Krebbel to add 9852c8ae7856 ("S/390: New option -mpic-data-is-text-relative").  That option ensures that data references are not relative, but rather via GOT.  The change seems pretty small and hopefully easy to backport to RHEL7's gcc.

Comment 7 Michael Petlan 2018-07-17 11:11:36 UTC
Related tests passed with gcc-4.8.5-36.el7.s390x.
VERIFIED.

Comment 9 errata-xmlrpc 2018-10-30 07:27:17 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:3016