Bug 2203752 - autogen rebuild fails with gcc 13 due stress test failing with "*** buffer overflow detected ***: terminated"
Summary: autogen rebuild fails with gcc 13 due stress test failing with "*** buffer ov...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: autogen
Version: 38
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tomas Korbar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-05-15 07:31 UTC by Jan Zizka
Modified: 2023-05-28 01:03 UTC (History)
2 users (show)

Fixed In Version: autogen-5.18.16-16.fc38
Clone Of:
Environment:
Last Closed: 2023-05-28 01:03:20 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jan Zizka 2023-05-15 07:31:15 UTC
When trying to rebuild autogen-5.18.16-12.fc38 package the rebuild fails with:

<clip>
FAIL: stress.test                                                                                                                                                                [29/1997]
PASS: string.test                                                                            
PASS: strtable.test                                                                                                                                                                       
PASS: strxform.test                                                                                                                                                                       
PASS: time.test                                                                                                                                                                           
PASS: str2m.test                                                                                                                                                                          
============================================================================                                                                                                              
Testsuite summary for GNU AutoGen 5.18.16                                                                                                                                                 
============================================================================                                                                                                              
# TOTAL: 43                                                                                                                                                                               
# PASS:  42                                                                                                                                                                               
# SKIP:  0                                                                                                                                                                                
# XFAIL: 0                                                                                   
# FAIL:  1                                                                                   
# XPASS: 0                                                                                                                                                                                
# ERROR: 0                                                                                                                                                                                
============================================================================                                                                                                              
See agen5/test/test-suite.log                                                                                                                                                             
Please report to autogen-users.net                                                                                                                                      
============================================================================                                                                                                              
make[4]: *** [Makefile:606: test-suite.log] Error 1                                                                                                                                       
make[4]: Leaving directory '/root/rpmbuild/BUILD/autogen-5.18.16/agen5/test'                                                                                                              
make[3]: *** [Makefile:714: check-TESTS] Error 2                                                                                                                                          
make[3]: Leaving directory '/root/rpmbuild/BUILD/autogen-5.18.16/agen5/test'                                                                                                              
make[2]: *** [Makefile:779: check-am] Error 2                                                                                                                                             
make[2]: Leaving directory '/root/rpmbuild/BUILD/autogen-5.18.16/agen5/test'                                                                                                              
make[1]: *** [Makefile:742: check-recursive] Error 1                                                                                                                                      
make[1]: Leaving directory '/root/rpmbuild/BUILD/autogen-5.18.16/agen5'                                                                                                                   
make: *** [Makefile:550: check-recursive] Error 1                                            
error: Bad exit status from /var/tmp/rpm-tmp.z1fQC0 (%check)                                                                                                                              
                                              
RPM build warnings:                                                                          
    %patchN is deprecated (3 usages found), use %patch N (or %patch -P N)                                                                                                                 

RPM build errors:                                                                            
    Bad exit status from /var/tmp/rpm-tmp.z1fQC0 (%check)
<clip>

This is result of problem reported in upstream https://sourceforge.net/p/autogen/bugs/212/ and is result of a problem in gcc reported with https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105217.

I have ported proposed patch and that seems to avoid the problem:

$ cat autogen-workaround-gcc13-realloc-fortify-tracking-detection-error.patch
diff --git a/agen5/defLoad.c b/agen5/defLoad.c
index 0215857..c12fd17 100644
--- a/agen5/defLoad.c
+++ b/agen5/defLoad.c
@@ -535,16 +535,13 @@ read_defs(void)
                          "expand f buf");
 
             /*
-             *  The buffer may have moved.  Set the data pointer at an
-             *  offset within the new buffer and make sure our base pointer
-             *  has been corrected as well.
+             *  Set the data pointer at an offset within the new buffer and
+             *  make sure our base pointer has been corrected as well.
              */
-            if (p != base_ctx) {
-                p->scx_scan = \
-                    p->scx_data = (char *)(p + 1);
-                data = p->scx_data + dataOff;
-                base_ctx = p;
-            }
+            p->scx_scan = \
+                p->scx_data = (char *)(p + 1);
+            data = p->scx_data + dataOff;
+            base_ctx = p;
         }
     }
 
Also seems that following could be used as workaround:

%global _fortify_level 2

The reason why this was not caught is that in f38 the autogen build was done still with gcc 12. Seems package was not rebuilt after gcc 13 upgrade.

Reproducible: Always

Steps to Reproduce:
1. Run Fedora 38 instance (for example docker container)
2. dnf install -y dnf-plugins-core rpm-build make createrepo vi rpmdevtools which
3. Rebuild autogen package
   export PACKAGE=autogen
   export SPECFILE="$HOME/rpmbuild/SPECS/$PACKAGE.spec"
   dnf download --source $PACKAGE
   dnf builddep -y $SPECFILE
   rpmbuild -bb $SPECFILE
Actual Results:  
FAIL: stress.test                                                                                                                                                                [80/1848]
PASS: string.test                                                                            
PASS: strtable.test                                                                                                                                                                       
PASS: strxform.test                                                                                                                                                                       
PASS: time.test                                                                                                                                                                           
PASS: str2m.test                                                                                                                                                                          
============================================================================                                                                                                              
Testsuite summary for GNU AutoGen 5.18.16                                                                                                                                                 
============================================================================                                                                                                              
# TOTAL: 43                                                                                                                                                                               
# PASS:  42                                                                                                                                                                               
# SKIP:  0                                                                                                                                                                                
# XFAIL: 0                                                                                                                                                                                
# FAIL:  1                                                                                   
# XPASS: 0                                                                                                                                                                                
# ERROR: 0                                                                                                                                                                                
============================================================================                                                                                                              
See agen5/test/test-suite.log                                                                                                                                                             
Please report to autogen-users.net                                                                                                                                      
============================================================================                                                                                                              
make[4]: *** [Makefile:606: test-suite.log] Error 1                                                                                                                                       
make[4]: Leaving directory '/root/rpmbuild/BUILD/autogen-5.18.16/agen5/test'                                                                                                              
make[3]: *** [Makefile:714: check-TESTS] Error 2                                                                                                                                          
make[3]: Leaving directory '/root/rpmbuild/BUILD/autogen-5.18.16/agen5/test'                                                                                                              
make[2]: *** [Makefile:779: check-am] Error 2                                                                                                                                             
make[2]: Leaving directory '/root/rpmbuild/BUILD/autogen-5.18.16/agen5/test'                                                                                                              
make[1]: *** [Makefile:742: check-recursive] Error 1                                                                                                                                      
make[1]: Leaving directory '/root/rpmbuild/BUILD/autogen-5.18.16/agen5'                                                                                                                   
make: *** [Makefile:550: check-recursive] Error 1                                            
error: Bad exit status from /var/tmp/rpm-tmp.z1fQC0 (%check)                                                                                                                              
                                              
RPM build warnings:                                                                          
    %patchN is deprecated (3 usages found), use %patch N (or %patch -P N)                                                                                                                 
                                              
RPM build errors:                                                                            
    Bad exit status from /var/tmp/rpm-tmp.z1fQC0 (%check)

Expected Results:  
Rebuild passes

Comment 1 Jan Zizka 2023-05-15 07:33:26 UTC
Forgot to add that in the stress.log there is following:

>stress-run_ag> /root/rpmbuild/BUILD/autogen-5.18.16/agen5/autogen -L/root/rpmbuild/BUILD/autogen-5.18.16/autoopts/tpl -b stress -
*** buffer overflow detected ***: terminated
./defs: line 175: 52695 Aborted                 ${AGexe} ${opts} "$@"
>stress-> test 134 -eq 0
>stress-> failure autogen failed

Comment 2 Fedora Update System 2023-05-19 13:04:47 UTC
FEDORA-2023-cb9b5cf0e2 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-cb9b5cf0e2

Comment 3 Tomas Korbar 2023-05-19 13:06:47 UTC
I fixed this in rawhide, but forgot i have to do so in f38 too.
Update will fix it.

Comment 4 Fedora Update System 2023-05-20 09:20:32 UTC
FEDORA-2023-cb9b5cf0e2 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-cb9b5cf0e2`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-cb9b5cf0e2

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2023-05-28 01:03:20 UTC
FEDORA-2023-cb9b5cf0e2 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.


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