Bug 1548536

Summary: hivex: Partial injection of Fedora build flags
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: hivexAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: jen, rjones
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hivex-1.3.15-3.fc29 hivex-1.3.15-3.fc28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 22:54:51 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: 1539083    

Description Florian Weimer 2018-02-23 19:26:36 UTC
/usr/lib64/ocaml/stublibs/dllmlhivex.so in ocaml-hivex-1.3.14-14.fc28.x86_64 has not been linked with the standard Fedora linker flags (LDFLAGS) from redhat-rpm-config:

libtool: link: gcc -shared  -fPIC -DPIC  .libs/libhivex_la-handle.o .libs/libhivex_la-node.o .libs/libhivex_la-offset-list.o .libs/libhivex_la-utf16.o .libs/libhivex_la-util.o .libs/libhivex_la-value.o .libs/libhivex_la-visit.o .libs/libhivex_la-write.o  -Wl,--whole-archive ../gnulib/lib/.libs/libgnu.a -Wl,--no-whole-archive  -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -O2 -g -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -Wl,--version-script=./hivex.syms -Wl,-z -Wl,relro   -Wl,-soname -Wl,libhivex.so.0 -o .libs/libhivex.so.0.0.0

It seems that -specs=/usr/lib/rpm/redhat/redhat-hardened-ld has gone missing.

See https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/buildflags.md for information on RPM macros and environment variables provided by the build environment.

Comment 1 Richard W.M. Jones 2018-02-26 12:22:18 UTC
/usr/lib64/ocaml/stublibs/dllmlhivex.so are the C part of the OCaml
bindings for hivex.  They are automatically generated and just shuffle
parameters from the OCaml side to the C side and back.  It's not likely
that there's any real need to use hardening here as OCaml isn't subject
to the usual problems that afflict C code.  Anyway I'll see if there's
some way to inject the flags into the ocamlmklib command which
generates this file.

Comment 2 Richard W.M. Jones 2018-02-26 12:44:21 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2018-February/msg00158.html

Comment 3 Richard W.M. Jones 2018-03-19 12:25:31 UTC
Fixed in hivex-1.3.15-3.fc29

Comment 4 Richard W.M. Jones 2018-03-19 12:33:08 UTC
Or it would be fixed, but the fix breaks strip:

+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
/usr/bin/strip:/home/rjones/rpmbuild/BUILDROOT/hivex-1.3.15-3.fc29.x86_64/usr/lib64/ocaml/hivex/libmlhivex.a(hivex_c.o)[.gnu.build.attributes]: corrupt GNU build attribute note: bad description size: Bad value
/usr/bin/strip:/home/rjones/rpmbuild/BUILDROOT/hivex-1.3.15-3.fc29.x86_64/usr/lib64/libhivex.a(libhivex_la-handle.o)[.gnu.build.attributes]: corrupt GNU build attribute note: bad description size: Bad value

Comment 5 Richard W.M. Jones 2018-03-19 12:55:51 UTC
Turns out whatever the problem is with strip it doesn't
affect Rawhide.

Comment 6 Florian Weimer 2018-03-19 17:47:14 UTC
Would you please bring this change into Fedora 28 as well?  Thanks.

Comment 7 Fedora Update System 2018-03-19 18:20:06 UTC
hivex-1.3.15-3.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-64a05f528d

Comment 8 Fedora Update System 2018-03-20 14:52:22 UTC
hivex-1.3.15-3.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-64a05f528d

Comment 9 Fedora Update System 2018-04-10 22:54:51 UTC
hivex-1.3.15-3.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.