* [PATCH 1/3] lib/gen_tables.c: define EHWPOISON when not available
2016-07-06 19:08 [PATCH 0/3] Misc build fixes Thomas Petazzoni
@ 2016-07-06 19:08 ` Thomas Petazzoni
2016-07-06 19:08 ` [PATCH 2/3] Fix usage of audit_status.feature_bitmap Thomas Petazzoni
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2016-07-06 19:08 UTC (permalink / raw)
To: linux-audit
When building on some old system with old kernel headers, the
gen_tables.c program (built natively) doesn't build due to missing
EHWPOISON. This commit defines EHWPOISON to the value found in
asm-generic kernel headers, which is correct for most (but not all
architectures).
Anyway, the whole concept of building a program on the host to generate
a table with errno values, then built into a target program is
inherently broken, so our fix is not more broken than the rest of the
mechanism used by audit.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
lib/gen_tables.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/gen_tables.c b/lib/gen_tables.c
index 98f576c..d0bb7f5 100644
--- a/lib/gen_tables.c
+++ b/lib/gen_tables.c
@@ -55,6 +55,15 @@
#define SHMGET 23
#define SHMCTL 24
+/*
+ * Values from asm-generic, might be different on other architectures,
+ * but anyway the concept of building a program on the host to
+ * generate errno related tables used on another architecture is
+ * broken.
+ */
+#ifndef EHWPOISON
+#define EHWPOISON 133
+#endif
/* The ratio of table size to number of non-empty elements allowed for a
"direct" s2i table; if the ratio would be bigger, bsearch tables are used
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/3] Fix usage of audit_status.feature_bitmap
2016-07-06 19:08 [PATCH 0/3] Misc build fixes Thomas Petazzoni
2016-07-06 19:08 ` [PATCH 1/3] lib/gen_tables.c: define EHWPOISON when not available Thomas Petazzoni
@ 2016-07-06 19:08 ` Thomas Petazzoni
2016-07-06 19:08 ` [PATCH 3/3] configure.ac: add subdir-objects Thomas Petazzoni
2016-07-06 22:45 ` [PATCH 0/3] Misc build fixes Steve Grubb
3 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2016-07-06 19:08 UTC (permalink / raw)
To: linux-audit
The feature_bitmap field of "struct audit_status" only appeared in
kernel headers >= 3.19. However, the code using it in libaudit.c is only
conditional on the existence of AUDIT_FEATURE_VERSION, which has been
added in Linux 3.13.
This means that building audit with kernel headers >= 3.13 but < 3.19
currently fails:
libaudit.c: In function 'load_feature_bitmap':
libaudit.c:609:33: error: 'struct audit_status' has no member named 'feature_bitmap'
features_bitmap = rep.status->feature_bitmap;
^
libaudit.c: In function 'audit_rule_fieldpair_data':
libaudit.c:1424:9: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
4294967295;
This commit fixes that by testing the availability of the feature_bitmap
field.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Note: it would be worth checking this commit in details. I assumed that
the function load_feature_bitmap() would simply return with
features_bitmap set to AUDIT_FEATURES_UNSUPPORTED, just as if
HAVE_DECL_AUDIT_FEATURE_VERSION was not defined. I am not sure if it is
the appropriate behavior.
---
configure.ac | 1 +
lib/libaudit.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 219720b..00788c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,7 @@ AC_CHECK_SIZEOF([unsigned int])
AC_CHECK_SIZEOF([unsigned long])
AM_PROG_CC_C_O
AC_CHECK_DECLS([AUDIT_FEATURE_VERSION], [], [], [[#include <linux/audit.h>]])
+AC_CHECK_MEMBERS([struct audit_status.feature_bitmap], [], [], [[#include <linux/audit.h>]])
AC_CHECK_DECLS([AUDIT_VERSION_BACKLOG_WAIT_TIME], [], [], [[#include <linux/audit.h>]])
AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
dnl; posix_fallocate is used in audisp-remote
diff --git a/lib/libaudit.c b/lib/libaudit.c
index 2c96f29..510d841 100644
--- a/lib/libaudit.c
+++ b/lib/libaudit.c
@@ -579,7 +579,7 @@ static void load_feature_bitmap(void)
return;
}
-#if HAVE_DECL_AUDIT_FEATURE_VERSION
+#if defined(HAVE_DECL_AUDIT_FEATURE_VERSION) && defined(HAVE_STRUCT_AUDIT_STATUS_FEATURE_BITMAP)
if ((rc = audit_request_status(fd)) > 0) {
struct audit_reply rep;
int i;
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/3] configure.ac: add subdir-objects
2016-07-06 19:08 [PATCH 0/3] Misc build fixes Thomas Petazzoni
2016-07-06 19:08 ` [PATCH 1/3] lib/gen_tables.c: define EHWPOISON when not available Thomas Petazzoni
2016-07-06 19:08 ` [PATCH 2/3] Fix usage of audit_status.feature_bitmap Thomas Petazzoni
@ 2016-07-06 19:08 ` Thomas Petazzoni
2016-07-06 22:47 ` Steve Grubb
2016-07-06 22:45 ` [PATCH 0/3] Misc build fixes Steve Grubb
3 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2016-07-06 19:08 UTC (permalink / raw)
To: linux-audit
This allows to avoid the following warning when re-generating the
configure script:
auparse/Makefile.am:95: warning: source file '../lib/gen_tables.c' is in a subdirectory,
auparse/Makefile.am:95: but option 'subdir-objects' is disabled
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 00788c4..e9f7cb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@ echo Configuring auditd $VERSION
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_TARGET
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([subdir-objects])
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
OLDLIBS="$LIBS"
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] configure.ac: add subdir-objects
2016-07-06 19:08 ` [PATCH 3/3] configure.ac: add subdir-objects Thomas Petazzoni
@ 2016-07-06 22:47 ` Steve Grubb
2016-07-11 14:52 ` Thomas Petazzoni
0 siblings, 1 reply; 10+ messages in thread
From: Steve Grubb @ 2016-07-06 22:47 UTC (permalink / raw)
To: linux-audit
On Wednesday, July 6, 2016 9:08:19 PM EDT Thomas Petazzoni wrote:
> This allows to avoid the following warning when re-generating the
> configure script:
>
> auparse/Makefile.am:95: warning: source file '../lib/gen_tables.c' is in a
> subdirectory, auparse/Makefile.am:95: but option 'subdir-objects' is
> disabled
I saw these in the last couple weeks. However...
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> configure.ac | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 00788c4..e9f7cb9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -37,7 +37,7 @@ echo Configuring auditd $VERSION
>
> AC_CONFIG_MACRO_DIR([m4])
> AC_CANONICAL_TARGET
> -AM_INIT_AUTOMAKE
> +AM_INIT_AUTOMAKE([subdir-objects])
> AM_PROG_LIBTOOL
> AC_SUBST(LIBTOOL_DEPS)
> OLDLIBS="$LIBS"
Applying this breaks the build
am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)
make[4]: Entering directory '/home/sgrubb/working/BUILD/audit/bindings/python/
python2'
Makefile:485: ../../../bindings/python/.deps/auparse_la-auparse_python.Plo: No
such file or directory
make[4]: *** No rule to make target '../../../bindings/python/.deps/
auparse_la-auparse_python.Plo'. Stop.
-Steve
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 3/3] configure.ac: add subdir-objects
2016-07-06 22:47 ` Steve Grubb
@ 2016-07-11 14:52 ` Thomas Petazzoni
2016-07-11 14:55 ` Steve Grubb
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2016-07-11 14:52 UTC (permalink / raw)
To: Steve Grubb; +Cc: linux-audit
Hello,
On Wed, 06 Jul 2016 18:47:47 -0400, Steve Grubb wrote:
> Applying this breaks the build
>
> am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)
> make[4]: Entering directory '/home/sgrubb/working/BUILD/audit/bindings/python/
> python2'
> Makefile:485: ../../../bindings/python/.deps/auparse_la-auparse_python.Plo: No
> such file or directory
> make[4]: *** No rule to make target '../../../bindings/python/.deps/
> auparse_la-auparse_python.Plo'. Stop.
Ah, right, that's due to a bug in automake < 1.16 when a variable is
used in _SOURCES. I've fixed that in v2 by using a simpler relative
path in the Python bindings Makefile.am. Patch coming shortly.
Thanks for spotting the issue,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] configure.ac: add subdir-objects
2016-07-11 14:52 ` Thomas Petazzoni
@ 2016-07-11 14:55 ` Steve Grubb
2016-07-11 15:10 ` Thomas Petazzoni
0 siblings, 1 reply; 10+ messages in thread
From: Steve Grubb @ 2016-07-11 14:55 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: linux-audit
On Monday, July 11, 2016 4:52:05 PM EDT Thomas Petazzoni wrote:
> Hello,
>
> On Wed, 06 Jul 2016 18:47:47 -0400, Steve Grubb wrote:
> > Applying this breaks the build
> >
> > am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=:
> > distdir)
> >
> > make[4]: Entering directory
> > '/home/sgrubb/working/BUILD/audit/bindings/python/ python2'
> > Makefile:485:
> > ../../../bindings/python/.deps/auparse_la-auparse_python.Plo: No such
> > file or directory
> > make[4]: *** No rule to make target '../../../bindings/python/.deps/
> > auparse_la-auparse_python.Plo'. Stop.
>
> Ah, right, that's due to a bug in automake < 1.16 when a variable is
> used in _SOURCES. I've fixed that in v2 by using a simpler relative
> path in the Python bindings Makefile.am. Patch coming shortly.
>
> Thanks for spotting the issue,
I always run "make distcheck" when doing a release. If v2 passes this, then
all is good.
Thanks,
-Steve
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] configure.ac: add subdir-objects
2016-07-11 14:55 ` Steve Grubb
@ 2016-07-11 15:10 ` Thomas Petazzoni
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2016-07-11 15:10 UTC (permalink / raw)
To: Steve Grubb; +Cc: linux-audit
Hello,
On Mon, 11 Jul 2016 10:55:08 -0400, Steve Grubb wrote:
> > Ah, right, that's due to a bug in automake < 1.16 when a variable is
> > used in _SOURCES. I've fixed that in v2 by using a simpler relative
> > path in the Python bindings Makefile.am. Patch coming shortly.
> >
> > Thanks for spotting the issue,
>
> I always run "make distcheck" when doing a release. If v2 passes this, then
> all is good.
Well, this raises another issue:
/bin/bash: ../../../../src/.dirstamp: Permission denied
So seems like my v2 is not good to go :-/
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] Misc build fixes
2016-07-06 19:08 [PATCH 0/3] Misc build fixes Thomas Petazzoni
` (2 preceding siblings ...)
2016-07-06 19:08 ` [PATCH 3/3] configure.ac: add subdir-objects Thomas Petazzoni
@ 2016-07-06 22:45 ` Steve Grubb
2016-07-07 7:06 ` Thomas Petazzoni
3 siblings, 1 reply; 10+ messages in thread
From: Steve Grubb @ 2016-07-06 22:45 UTC (permalink / raw)
To: linux-audit
On Wednesday, July 6, 2016 9:08:16 PM EDT Thomas Petazzoni wrote:
> The first two patches in this series fix misc build issues of audit
> with old kernel headers.
I applied both. The second patch was not complete. You might want to pull
what's in svn and make sure everything works for your target OS.
> The last patch fixes warnings encountered when running autoreconf on
> audit's configure.ac.
>
> As a side note, are there any plans to switch the audit development to
> a Git repository? Having to switch back to Subversion is really
> painful, which is why the patches in this series are Git-formatted.
Eventually. I'm using it for a couple other projects and when I feel
comfortable I'll switch this over. This is a much more important project than
the other two.
-Steve
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 0/3] Misc build fixes
2016-07-06 22:45 ` [PATCH 0/3] Misc build fixes Steve Grubb
@ 2016-07-07 7:06 ` Thomas Petazzoni
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2016-07-07 7:06 UTC (permalink / raw)
To: Steve Grubb; +Cc: linux-audit
Hello,
On Wed, 06 Jul 2016 18:45:28 -0400, Steve Grubb wrote:
> On Wednesday, July 6, 2016 9:08:16 PM EDT Thomas Petazzoni wrote:
> > The first two patches in this series fix misc build issues of audit
> > with old kernel headers.
>
> I applied both. The second patch was not complete. You might want to pull
> what's in svn and make sure everything works for your target OS.
ACK, thanks!
> > The last patch fixes warnings encountered when running autoreconf on
> > audit's configure.ac.
> >
> > As a side note, are there any plans to switch the audit development to
> > a Git repository? Having to switch back to Subversion is really
> > painful, which is why the patches in this series are Git-formatted.
>
> Eventually. I'm using it for a couple other projects and when I feel
> comfortable I'll switch this over. This is a much more important project than
> the other two.
Sure. So I guess there's no need to convince you of all the advantages
of Git :)
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 10+ messages in thread