Bug 511573

Summary: FTBFS gnupg-1.4.9-5.fc11
Product: [Fedora] Fedora Reporter: FTBFS <ftbfs>
Component: gnupgAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: jakub, nalin, rdieter
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://linux.dell.com/files/fedora/FixBuildRequires/mock-results/
Whiteboard:
Fixed In Version: gcc-4.4.0-15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-22 21:30:50 UTC Type: ---
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: 511348    
Attachments:
Description Flags
root.log
none
build.log
none
mock.log
none
root.log
none
build.log
none
mock.log
none
cut-down reproducer
none
repro.i none

Description FTBFS 2009-07-15 03:25:25 UTC
gnupg-1.4.9-5.fc11.src.rpm Failed To Build From Source against the rawhide tree.  See http://fedoraproject.org/wiki/FTBFS for more information.

Comment 1 FTBFS 2009-07-15 03:25:28 UTC
Setting to ASSIGNED per Fedora Bug Triage workflow.  https://fedoraproject.org/wiki/BugZappers/BugStatusWorkFlow

Comment 2 FTBFS 2009-07-15 03:25:31 UTC
Created attachment 352540 [details]
root.log

root.log for i386

Comment 3 FTBFS 2009-07-15 03:25:32 UTC
Created attachment 352541 [details]
build.log

build.log for i386

Comment 4 FTBFS 2009-07-15 03:25:34 UTC
Created attachment 352542 [details]
mock.log

mock.log for i386

Comment 5 FTBFS 2009-07-15 03:25:35 UTC
Created attachment 352543 [details]
root.log

root.log for x86_64

Comment 6 FTBFS 2009-07-15 03:25:36 UTC
Created attachment 352544 [details]
build.log

build.log for x86_64

Comment 7 FTBFS 2009-07-15 03:25:38 UTC
Created attachment 352545 [details]
mock.log

mock.log for x86_64

Comment 8 Nalin Dahyabhai 2009-07-16 17:31:04 UTC
Hmm, __builtin_object_size() doesn't seem to allow for how gnupg allocates and uses "struct para_data_s" in g10/keygen.c.  Changing the way the structure is
laid out will work as a temporary fix, but we should probably ask the toolchain folks about it, too.

Comment 9 Nalin Dahyabhai 2009-07-16 17:32:49 UTC
Created attachment 354021 [details]
cut-down reproducer

Comment 10 Nalin Dahyabhai 2009-07-16 18:21:41 UTC
Created attachment 354030 [details]
repro.i

preprocessed version of repro.c (attachment #354021 [details])

Comment 11 Nalin Dahyabhai 2009-07-16 18:30:03 UTC
Jakub, I boiled down the code in gnupg that crashes during the test suite down to attachment #354030 [details].  Building it with -O2 using gcc-4.4.0-12 triggers __fortify_fail on my x86_64 system.

Do you know if this is something that gcc needs to be allowing for, or should I be looking at reworking the structure definition in gnupg?  I'd appreciate any advice you have.  Thanks!

Comment 12 Jakub Jelinek 2009-07-16 18:54:39 UTC
Yes, this is considered invalid for str*/stp* functions with -D_FORTIFY_SOURCE=2 (valid for -D_FORTIFY_SOURCE=1 and -U_FORTIFY_SOURCE).
Either use memcpy instead of strcpy (memcpy accross field boundaries is valid even with -D_FORTIFY_SOURCE=2, memcpy (l->u.value, "DSA", sizeof "DSA")), or rework the data structures.  Say:
struct list_item {
 struct list_item *next;
 int blah;
};
union list_item_union {
 struct list_item header;
 struct list_item_foo { struct list_item header; foo *foo; } foo;
 struct list_item_bar { struct list_item header; bar *bar; } bar;
 struct list_item_baz { struct list_item header; uint32_t baz; } baz;
 struct list_item_value { struct list_item header; char value[1]; } value;
};
should work (or obviously you can have union for the stuff you don't abuse as wannabe flexible array member).

Comment 13 Nalin Dahyabhai 2009-07-16 21:28:21 UTC
Is there a reference for what's valid and what isn't?  I've found mention of some things that aren't valid in assorted bug reports and mailing list archives, but haven't found a full list to check against.  I'd like to avoid proposing a change upstream that happens to be accepted now but later turns out to be problematic.

Comment 14 Jakub Jelinek 2009-07-20 14:49:22 UTC
Actually, now that I got another similar report (#512689), after some discussions on upstream IRC I'm considering allowing this:
http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01136.html

Comment 15 Nalin Dahyabhai 2009-07-22 21:30:50 UTC
Thanks, Jakub!  The scratch build now succeeds with 4.4.0-15, so I'll mark this as fixed in Raw Hide.