From: Steve Grubb <sgrubb@redhat.com>
To: linux-audit@redhat.com
Subject: Re: audit user space build problems
Date: Mon, 28 Feb 2022 10:37:43 -0500 [thread overview]
Message-ID: <4724899.31r3eYUQgx@x2> (raw)
In-Reply-To: <2126549.NgBsaNRSFp@x2>
Hello,
On Monday, February 21, 2022 4:50:22 PM EST Steve Grubb wrote:
> Recently, distributions moved to building against gcc-12 for their latest
> OS composes. It's been found in at least 2 distributions that the user
> space package is failing to build. It's natural to think this is related
> to gcc-12 since it's the obvious change.
>
> However, the problem is a combination of 2 things:
>
> 1) SWIG is making buggy code
> 2) The kernel changed to using flexible array members
>
> The issue specifically is with struct audit_rules_data. At the bottom, it
> was using buf[0]; But on 5.17, it uses buf[]; It turns out that gcc-12
> is just a coincidence and anything using gcc-12 also has the newest
> kernel.
>
> The options are:
> 1) Report this as a SWIG bug and wait
> 2) Rewrite the libaudit python bindings to not use SWIG
> 3) Ask for buf[0]; to be reinstated in the kernel.
>
> Of these, I think option 2 is the only viable long term option. It will
> take some time to write new python bindings that preserve the SWIG api.
>
> A short term fix might be for distros to copy the kernel header into the
> lib directory and patch it to restore buf[0];, then change libaudit.c to
> include "audit.h" instead of <linux/audit.h>. There may be other
> approaches.
An update on this topic...I have worked around this on rawhide. The temporary
fix is kind of ugly and I also have no idea how long this temporary fix will be
needed. Rewriting the python bindings will be a big task. Anyways...the first
patch can be found here:
https://src.fedoraproject.org/rpms/audit/blob/rawhide/f/audit-3.0.8-flex-array-workaround.patch
Prior to applying the patch, I do this is the %prep part of the spec file:
cp /usr/include/linux/audit.h lib/
then the patch applies cleanly. The only problem is that if you leave it this
way, then you wind up with other packages not building because they can't find
audit.h. (See bz 2057735 for example) The fix for this is after the audit
scripts do the install to the buildroot, you need to undo the change in
libaudit.h. That patch can be found here:
https://src.fedoraproject.org/rpms/audit/blob/rawhide/f/audit-3.0.8-undo-flex-array.patch
After that, rpm grabs all the files and everything works as intended. As I
said before, this is an ugly fix...but it works for now.
Hope this helps with packaging...
-Steve
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
prev parent reply other threads:[~2022-02-28 15:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 21:50 audit user space build problems Steve Grubb
2022-02-24 3:39 ` Steve Grubb
2022-02-28 15:37 ` Steve Grubb [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4724899.31r3eYUQgx@x2 \
--to=sgrubb@redhat.com \
--cc=linux-audit@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).