-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code cleanup & rest of the "systemd-dfuzzer" patches #24
Conversation
This pull request introduces 1 alert when merging 6972454 into e54710a - view on LGTM.com new alerts:
|
@mrc0mmand thanks! Could you include https://github.com/matusmarhefka/dfuzzer/pull/22 just to make sure that the package is more or less intact. Another option would be to merge that PR and rebase this PR on top of the master branch. I'll take a closer look a bit later today. |
I think it would make sense to keep it only if https://github.com/matusmarhefka/dfuzzer/issues/21 was resolved somehow because it should probably make it easier to report bugs like https://github.com/matusmarhefka/dfuzzer/issues/20. In that particular case it looked like
Having said that as far as I can remember it failed under Valgrind and didn't add trailing square brackets so it needs polishing anyway. |
FWIW
but I think it has nothing to do with this PR. |
Thinking about it a bit more I think it should be removed because I'm not sure it can cover "edge" cases (or less popular distributions). Also I agree with LGTM that running commands based on the contents of |
// Initializes the type system. | ||
g_type_init(); | ||
rses = df_process_bus(G_BUS_TYPE_SESSION); | ||
rsys = df_process_bus(G_BUS_TYPE_SYSTEM); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's neat! I think in terms of testing systemd
it would be even better if it was possible to connect to just one bus so as not to poke PID1 twice in systemd/systemd#22547 but I think that can wait because without void methods dfuzzer
is relatively fast anyway.
d562780
to
088b787
Compare
Definitely agree! I backported the patch as well and dropped the "debug only" stuff which shouldn't be necessary thanks to that.
Whoops, that one slipped past me (as well as a couple of other warnings caused by |
This pull request fixes 1 alert when merging 088b787 into e54710a - view on LGTM.com fixed alerts:
|
It's kind of complicated I think. With dfuzzer.c:22:10: fatal error: 'gio/gio.h' file not found
#include <gio/gio.h>
^~~~~~~~~~~
1 error generated.
fuzz.c:21:10: fatal error: 'gio/gio.h' file not found
#include <gio/gio.h>
^~~~~~~~~~~
1 error generated.
introspection.c:20:10: fatal error: 'gio/gio.h' file not found
#include <gio/gio.h>
^~~~~~~~~~~
1 error generated.
rand.c:20:10: fatal error: 'gio/gio.h' file not found
#include <gio/gio.h>
^~~~~~~~~~~
1 error generated. because clang-13: error: -lgio-2.0: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-13: error: -lgobject-2.0: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-13: error: -lglib-2.0: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-13: error: -lffi: 'linker' input unused [-Werror,-Wunused-command-line-argument] Ideally the |
@evverx I think the last commit should fix your Packit woes, since, as I found out just now, |
This comment was marked as resolved.
This comment was marked as resolved.
Currently the specfile assumes that it can override CFLAGS as far as I can see so that patch should certainly be tested with Packit. I think Packit failed because dfuzzer failed to compile on i386 which I fixed with --- a/src/fuzz.c
+++ b/src/fuzz.c
@@ -344,15 +344,15 @@ static int df_fuzz_write_log(void)
;
gint64 tmp6;
g_variant_get(s->var, s->sig, &tmp6);
- df_fail("-- '%ld'\n", tmp6);
- FULL_LOG("%ld;", tmp6);
+ df_fail("-- '%" G_GINT64_FORMAT "'\n", tmp6);
+ FULL_LOG("%" G_GINT64_FORMAT, tmp6);
break;
case 't':
;
guint64 tmp7;
g_variant_get(s->var, s->sig, &tmp7);
- df_fail("-- '%lu'\n", tmp7);
- FULL_LOG("%lu;", tmp7);
+ df_fail("-- '%" G_GUINT64_FORMAT "'\n", tmp7);
+ FULL_LOG("%" G_GUINT64_FORMAT, tmp7);
break; and I also added |
@mrc0mmand could you force-push the PR to trigger Packit? |
to make Valgrind happy. Fixes: dbus-fuzzer#8
This pull request fixes 1 alert when merging eb2abb3 into 6a23217 - view on LGTM.com fixed alerts:
|
Looks like it didn't break the package but it seems most arguments are passed twice. I think at some point the package should stop passing |
Yeah, the Makefile and related stuff really needs some love, but also a thorough testing to not break anything. |
Looks like the exit code changed somehow. With this patch applied
and without this patch it returns
Given that there is a bug in avahi I think 2 should be the right exit code (judging by the comments there) |
Wow, thank you, I managed to miss |
This pull request fixes 1 alert when merging de6bc9a into 6a23217 - view on LGTM.com fixed alerts:
|
Thanks! I'll take a look a bit later. FWIW |
@@ -88,7 +88,10 @@ guint64 df_rand_guint64(void); | |||
* @return Generated pseudo-random double precision floating point number | |||
* from interval <0, 1> | |||
*/ | |||
inline double drand(void); | |||
inline double drand(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be static inline
. Without static
it fails to compile with -O0
with
cc -Wall -Wno-unused-parameter -O0 -fstack-protector --param=ssp-buffer-size=4 `pkg-config --cflags --libs gio-2.0 libffi` -g -c -o fuzz.o fuzz.c
cc -Wall -Wno-unused-parameter -O0 -fstack-protector --param=ssp-buffer-size=4 `pkg-config --cflags --libs gio-2.0 libffi` -g -c -o rand.o rand.c
cc dfuzzer.o introspection.o fuzz.o rand.o util.o -Wall -Wno-unused-parameter -O0 -fstack-protector --param=ssp-buffer-size=4 `pkg-config --cflags --libs gio-2.0 libffi` -g -o dfuzzer
/usr/bin/ld: rand.o: in function `df_rand_gdouble':
/home/vagrant/dfuzzer/src/rand.c:357: undefined reference to `drand'
collect2: error: ld returned 1 exit status
make: *** [Makefile:18: dfuzzer] Error 1
I discovered it with meson.build
:
project('dfuzzer', 'c',
version : '1.4',
default_options: [
'c_std=gnu11',
],
)
libgio = dependency('gio-2.0', required : true)
libffi = dependency('libffi', required : true)
dfuzzer_sources = files(
'dfuzzer.c',
'dfuzzer.h',
'introspection.c',
'introspection.h',
'fuzz.c',
'fuzz.h',
'rand.c',
'rand.h',
'util.c',
'util.h',
)
executable(
'dfuzzer',
dfuzzer_sources,
dependencies : [libgio, libffi],
install : true
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has nothing to do with this patch though. I'll fix it in https://github.com/matusmarhefka/dfuzzer/pull/26
inspired by https://github.com/matusmarhefka/dfuzzer/pull/24#issuecomment-1107522921 With this patch applied dfuzzer can be built with clang with ``` CC=clang meson build ninja -C ./build -v ```
inspired by https://github.com/matusmarhefka/dfuzzer/pull/24#issuecomment-1107522921 With this patch applied dfuzzer can be built with clang with ``` CC=clang meson build ninja -C ./build -v ```
inspired by https://github.com/matusmarhefka/dfuzzer/pull/24#issuecomment-1107522921 With this patch applied dfuzzer can be built with clang with ``` CC=clang meson build ninja -C ./build -v ```
mkdir dfuzzer-logs | ||
dfuzzer --log-dir dfuzzer-logs -v -n org.freedesktop.systemd1 | ||
# Test a non-existent bus | ||
if sudo dfuzzer --log-dir "" --bus this.should.not.exist; then false; fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I'm not sure --log-dir
should accept empty strings. When dfuzzer
is run as root
it seems to pollute the root directory for no apparent reason. It has always worked this way though as far as I understand so it can be addressed later.
I'll go ahead and merge the PR. Once it lands I'll send dfuzzer to coverity. Controversial patches can always be reverted/revisited I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once it lands I'll send dfuzzer to coverity
I've just opened https://github.com/matusmarhefka/dfuzzer/issues/27
inspired by https://github.com/matusmarhefka/dfuzzer/pull/24#issuecomment-1107522921 With this patch applied dfuzzer can be built with clang with ``` CC=clang meson build ninja -C ./build -v ```
inspired by https://github.com/matusmarhefka/dfuzzer/pull/24#issuecomment-1107522921 With this patch applied dfuzzer can be built with clang with ``` CC=clang meson build ninja -C ./build -v ```
This PR collects all the remaining patches from systemd-dfuzzer (mainly this open PR: systemd/systemd-dfuzzer#10) and also addresses the
-Werror
issue found by @evverx in https://github.com/matusmarhefka/dfuzzer/pull/16#discussion_r850082248, where all warnings were suppressed by the-w
option.One commit I left out is systemd/systemd-dfuzzer@58ae664, since I'm not sure how relevant the package-info parsing stuff is, hence the last "debug only" commit, since this function is still emitting a compile-time warning.