Discussion:
Implict declaration issue with asan options.
William Brown via samba-technical
2018-04-18 09:00:57 UTC
Permalink
Hi,

I noticed that my fresh checkout on f27 stopped working with:

commit fc473cd28261478cc9c3232b43fc725f0468f8a9 (HEAD -> master,
origin/master, origin/HEAD)

./configure.developer --address-sanitizer --enable-developer --enable-
debug --enable-auto-reconfigure
make
...

[1624/4154] Compiling lib/ldb-samba/ldb_wrap.c
../lib/ldb-samba/ldb_wrap.c: In function ‘ldb_wrap_find’:
../lib/ldb-samba/ldb_wrap.c:191:14: error: implicit declaration of
function ‘getpid’; did you mean ‘getpt’? [-Werror=implicit-function-
declaration]
pid_t pid = getpid();
^~~~~~
getpt
cc1: some warnings being treated as errors
Waf: Leaving directory `/home/william/development/samba/bin'
Build failed: -> task failed (err #1):
{task: cc ldb_wrap.c -> ldb_wrap_5.o}
make: *** [Makefile:8: all] Error 1

I then dumped the preprocessor output (attached), I notice that
unistd.h is missing. It's avaliable in source3/.../includes.h, but not
in source4.

I created a patch adding unistd.h to ldb_wrap.c, then continued and
noticed:

[3106/4154] Compiling source3/libgpo/gpext/security.c
../source3/libgpo/gpext/security.c: In function
‘security_process_group_policy’:
../source3/libgpo/gpext/security.c:202:5: error: ‘status.v’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
if (!NT_STATUS_IS_OK(status)) {
^
cc1: some warnings being treated as errors
Waf: Leaving directory `/home/william/development/samba/bin'
Build failed: -> task failed (err #1):
{task: cc security.c -> security_5.o}


At this point I was quite suspicious - I have eventually worked out the
root cause is '--address-sanitizer'. Addition of this option will cause
compilation to fail, however I don't understand why.

I have done a make clean, reconfigure, build with and without, and the
cause is always --address-sanitizer

Any advice on what could be going on here would be great, as I'm not
yet very familiar with waf.

Thank you!

William
William Brown via samba-technical
2018-04-18 09:21:33 UTC
Permalink
On Wed, 2018-04-18 at 19:00 +1000, William Brown via samba-technical
Post by William Brown via samba-technical
Hi,
...
Post by William Brown via samba-technical
At this point I was quite suspicious - I have eventually worked out the
root cause is '--address-sanitizer'. Addition of this option will cause
compilation to fail, however I don't understand why.
I have done a make clean, reconfigure, build with and without, and the
cause is always --address-sanitizer
Any advice on what could be going on here would be great, as I'm not
yet very familiar with waf.
The attached trivial patch does resolve the issue.
Post by William Brown via samba-technical
Thank you!
William
Simo via samba-technical
2018-04-18 16:22:06 UTC
Permalink
On Wed, 2018-04-18 at 19:21 +1000, William Brown via samba-technical
Post by William Brown via samba-technical
On Wed, 2018-04-18 at 19:00 +1000, William Brown via samba-technical
Post by William Brown via samba-technical
Hi,
...
Post by William Brown via samba-technical
At this point I was quite suspicious - I have eventually worked out the
root cause is '--address-sanitizer'. Addition of this option will cause
compilation to fail, however I don't understand why.
I have done a make clean, reconfigure, build with and without, and the
cause is always --address-sanitizer
Any advice on what could be going on here would be great, as I'm not
yet very familiar with waf.
The attached trivial patch does resolve the issue.
RB+
Alexander Bokovoy via samba-technical
2018-04-18 16:30:50 UTC
Permalink
Post by William Brown via samba-technical
On Wed, 2018-04-18 at 19:00 +1000, William Brown via samba-technical
Post by William Brown via samba-technical
Hi,
...
Post by William Brown via samba-technical
At this point I was quite suspicious - I have eventually worked out the
root cause is '--address-sanitizer'. Addition of this option will cause
compilation to fail, however I don't understand why.
I have done a make clean, reconfigure, build with and without, and the
cause is always --address-sanitizer
Any advice on what could be going on here would be great, as I'm not
yet very familiar with waf.
The attached trivial patch does resolve the issue.
Could you please split the changes into two commits? They are unrelated
to each other.

Otherwise RB+
Post by William Brown via samba-technical
Post by William Brown via samba-technical
Thank you!
William
From 99237883621b7a7954d0fe4e3364fb8b5d270051 Mon Sep 17 00:00:00 2001
Date: Wed, 18 Apr 2018 19:18:23 +1000
Subject: [PATCH] ldb_wrap.c missing header, s3/security.c undefined value
ldb_wrap.c was missing unistd.h causing implicit symbol declaration and error
during compilation.
s3/security.c had an NTSTATUS status that was undefined and with the configure
option --address-sanitizer this caused uninitialised value error.
---
lib/ldb-samba/ldb_wrap.c | 1 +
source3/libgpo/gpext/security.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/ldb-samba/ldb_wrap.c b/lib/ldb-samba/ldb_wrap.c
index 143e128d5d7..3d3eb8b0cef 100644
--- a/lib/ldb-samba/ldb_wrap.c
+++ b/lib/ldb-samba/ldb_wrap.c
@@ -37,6 +37,7 @@
#include "../lib/util/dlinklist.h"
#include "lib/util/util_paths.h"
#include <tdb.h>
+#include <unistd.h>
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_LDB
diff --git a/source3/libgpo/gpext/security.c b/source3/libgpo/gpext/security.c
index 29e7bb7c31e..b6b7ca08e62 100644
--- a/source3/libgpo/gpext/security.c
+++ b/source3/libgpo/gpext/security.c
@@ -150,7 +150,7 @@ static NTSTATUS security_process_group_policy(TALLOC_CTX *mem_ctx,
const struct GROUP_POLICY_OBJECT *deleted_gpo_list,
const struct GROUP_POLICY_OBJECT *changed_gpo_list)
{
- NTSTATUS status;
+ NTSTATUS status = NT_STATUS_OK;
char *unix_path = NULL;
struct gp_inifile_context *ini_ctx = NULL;
const struct GROUP_POLICY_OBJECT *gpo;
--
2.14.3
--
/ Alexander Bokovoy
William Brown via samba-technical
2018-04-18 23:40:26 UTC
Permalink
Post by Alexander Bokovoy via samba-technical
Post by William Brown via samba-technical
Post by William Brown via samba-technical
Any advice on what could be going on here would be great, as I'm not
yet very familiar with waf.
The attached trivial patch does resolve the issue.
Could you please split the changes into two commits? They are
unrelated
to each other.
Otherwise RB+
Thank you both! I have split this into two patches, and attached,
Alexander Bokovoy via samba-technical
2018-04-20 11:05:06 UTC
Permalink
Post by William Brown via samba-technical
Post by Alexander Bokovoy via samba-technical
Post by William Brown via samba-technical
Post by William Brown via samba-technical
Any advice on what could be going on here would be great, as I'm not
yet very familiar with waf.
The attached trivial patch does resolve the issue.
Could you please split the changes into two commits? They are unrelated
to each other.
Otherwise RB+
Thank you both! I have split this into two patches, and attached,
Thanks. Pushed to autobuild.
--
/ Alexander Bokovoy
Loading...