Bug 2098169

Summary: invalid use of flexible array member
Product: Red Hat Enterprise Linux 9 Reporter: Ondrej Moriš <omoris>
Component: auditAssignee: Sergio Correia <scorreia>
Status: CLOSED MIGRATED QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 9.0CC: rsroka, sgrubb
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2116867 (view as bug list) Environment:
Last Closed: 2023-09-19 17:39:19 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: 2116867    

Description Ondrej Moriš 2022-06-17 13:33:38 UTC
Description of problem:

BZ#2035124 introduced kernel change that is now causing failed build of audit:

# rpmbuild --define '_topdir /tmp/tmp.QnGog2P0nh' -bc /tmp/tmp.QnGog2P0nh/SPECS/audit.spec
...
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../.. -I. -I../../.. -I../../../lib -I/usr/include/python3.9 -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c audit_wrap.c  -fPIC -DPIC -o .libs/_audit_la-audit_wrap.o
audit_wrap.c: In function '_wrap_audit_rule_data_buf_set':
audit_wrap.c:4701:17: error: cast specifies array type
 4701 |     arg1->buf = (char [])(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size));
      |                 ^
audit_wrap.c:4701:15: error: invalid use of flexible array member
 4701 |     arg1->buf = (char [])(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size));
      |               ^
audit_wrap.c:4703:15: error: invalid use of flexible array member
 4703 |     arg1->buf = 0;
      |               ^
make[5]: *** [Makefile:517: _audit_la-audit_wrap.lo] Error 1
make[5]: Leaving directory '/tmp/tmp.QnGog2P0nh/BUILD/audit-3.0.7/bindings/swig/python3'
make[4]: *** [Makefile:416: all-recursive] Error 1
make[4]: Leaving directory '/tmp/tmp.QnGog2P0nh/BUILD/audit-3.0.7/bindings/swig'
make[3]: *** [Makefile:413: all-recursive] Error 1
make[3]: Leaving directory '/tmp/tmp.QnGog2P0nh/BUILD/audit-3.0.7/bindings'
make[2]: *** [Makefile:469: all-recursive] Error 1
make[2]: Leaving directory '/tmp/tmp.QnGog2P0nh/BUILD/audit-3.0.7'
make[1]: *** [Makefile:401: all] Error 2
make[1]: Leaving directory '/tmp/tmp.QnGog2P0nh/BUILD/audit-3.0.7'
error: Bad exit status from /var/tmp/rpm-tmp.EcEGvp (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.EcEGvp (%build)


Version-Release number of selected component (if applicable):

kernel-5.14.0-96.el9
audit-3.0.7-102.el9
gcc-11.3.1-2.el9

How reproducible:

100%

Steps to Reproduce:

1. Download audit source rpm, install it and all its build dependencies.
2. Build the rpm.

Actual results:

See above.

Expected results:

Package can be built.

Additional info:

It is very likely that the same issue will affect RHEL-8.7 because of BZ#2035123.

Comment 2 RHEL Program Management 2023-09-19 17:37:26 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 3 RHEL Program Management 2023-09-19 17:39:19 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.