lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 10 Feb 2020 16:24:59 +0100
From:   Lukas Czerner <>
Subject: [PATCH v2] tst_libext2fs: Avoid multiple definition of global variables

gcc version 10 changed the default from -fcommon to -fno-common and as a
result e2fsprogs make check tests fail because tst_libext2fs.c end up
with a build error.

This is because it defines two global variables debug_prog_name and
extra_cmds that are already defined in debugfs/debugfs.c. With -fcommon
linker was able to resolve those into the same object, however with
-fno-common it's no longer able to do it and we end up with multiple
definition errors.

Fix the problem by using SKIP_GLOBDEFS macro to skip the variables
definition in debugfs.c. Note that debug_prog_name is also defined in
lib/ext2fs/extent.c when DEBUG macro is used, but this does not work even
with older gcc versions and is never used regardless so I am not going to
bother with it.

Signed-off-by: Lukas Czerner <>
v2: Previous fix wasn't really working properly

 debugfs/debugfs.c      | 6 ++++++
 debugfs/debugfs.h      | 2 ++
 lib/ext2fs/ | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 9b701455..5e8f8bdd 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -48,8 +48,14 @@ extern char *optarg;
 int journal_enable_debug = -1;
+ * There must be only one definition if we're hooking in extra commands or
+ * chaging default prompt. Use -DSKIP_GLOBDEF for that.
+ */
 ss_request_table *extra_cmds;
 const char *debug_prog_name;
 int ss_sci_idx;
 ext2_filsys	current_fs;
diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h
index 477d9bbb..956517bc 100644
--- a/debugfs/debugfs.h
+++ b/debugfs/debugfs.h
@@ -123,6 +123,8 @@ extern void do_set_block_group_descriptor(int argc, char **, int sci_idx, void *
 extern void do_dump_unused(int argc, char **argv, int sci_idx, void *infop);
 /* debugfs.c */
+extern ss_request_table *extra_cmds;
+extern const char *debug_prog_name;
 extern void internal_dump_inode(FILE *, const char *, ext2_ino_t,
 				struct ext2_inode *, int);
diff --git a/lib/ext2fs/ b/lib/ext2fs/
index c2163bf5..f754b952 100644
--- a/lib/ext2fs/
+++ b/lib/ext2fs/
@@ -377,7 +377,7 @@ extent_cmds.c extent_cmds.h: $(top_srcdir)/debugfs/extent_cmds.ct
 debugfs.o: $(top_srcdir)/debugfs/debugfs.c
 	$(E) "	CC $<"
-	$(Q) $(CC) $(DEBUGFS_CFLAGS) -c $< -o $@
+	$(Q) $(CC) $(DEBUGFS_CFLAGS) -DSKIP_GLOBDEFS -c $< -o $@
 extent_inode.o: $(top_srcdir)/debugfs/extent_inode.c
 	$(E) "	CC $<"

Powered by blists - more mailing lists