Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-5190

invalid use of flexible array member

    • audit-3.1.2-2.el9
    • None
    • None
    • rhel-sst-security-special-projects
    • ssg_security
    • 14
    • None
    • QE ack, Dev ack
    • False
    • Hide

      None

      Show
      None
    • No
    • None
    • If docs needed, set a value
    • None

      Description of problem:

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

      1. 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.

              scorreia@redhat.com Sergio Correia
              omoris Ondrej Moris
              Sergio Correia Sergio Correia
              SSG Security QE SSG Security QE
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: