Wed, 04 Jun 2025 23:47:08 -0500
Remove the retro protocol plugins
This removes gadu-gadu, novell, sametime, silc, silc10, and zephyr as they are
all being migrated to retro-prpl.
Testing Done:
Ran `make distcheck` and built the windows installer and verified that both worked as expected and that the uninstaller didn't remove the files. I did have to clean my `win32-install-dir` as that had contained previous builds of the now deleted protocols.
Bugs closed: PIDGIN-18098
Reviewed at https://reviews.imfreedom.org/r/4019/
| 40974 | 1 | # Introduction and setup |
| 2 | ||
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
3 | Pidgin has fuzzing support for libpurple via |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
4 | [Libfuzzer](https://llvm.org/docs/LibFuzzer.html). If you're new to fuzzing with |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
5 | libfuzzer, there is a fantastic tutorial available |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
6 | [here](https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md). |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
7 | |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
8 | The fuzzers reside in libpurples/fuzzers. To build them, you'll need to specify |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
9 | `clang` as your C compiler as well as pass `--enable-fuzzing` to `./configure`. |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
10 | Once this is done you can `cd libpurple/fuzzers` and run `make check` to build |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
11 | the fuzzers. |
| 40974 | 12 | |
| 13 | Example: | |
| 14 | ```bash | |
|
43264
50facee54d1d
Remove the retro protocol plugins
Gary Kramlich <grim@reaperworld.com>
parents:
41049
diff
changeset
|
15 | $ CC=clang ./configure --enable-fuzzing --disable-cyrus-sasl --disable-gtkui --disable-gstreamer --disable-vv --disable-idn --disable-avahi --disable-dbus --disable-libsecret --disable-gnome-keyring --disable-kwallet --disable-plugins |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
16 | ``` |
| 40974 | 17 | |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
18 | Now that the build system has been configured, you need to build everything, |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
19 | including the fuzzers. You can do this with the following command. Note that the |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
20 | `-j $(nproc)` tells make to build with all available cores and is recommended |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
21 | but optional. |
| 40974 | 22 | |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
23 | ```bash |
|
41049
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
24 | $ make -j $(nproc) check |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
25 | ``` |
| 40974 | 26 | |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
27 | Now that the fuzzers are built, you can run them directly. There is also an |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
28 | optional `-dict` parameter that can be used to specify a dictionary to be used |
|
41049
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
29 | during the process. Also all fuzzers must have a basic corpus to help the |
|
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
30 | fuzzer find values and should be located in the fuzzers/corpus/<fuzzer-name> |
|
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
31 | directory. |
| 40974 | 32 | |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
33 | ```bash |
|
41049
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
34 | $ ./fuzz_xmlnode -dict=dictionaries/xml.dict corpus/xmlnode |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
35 | ``` |
| 40974 | 36 | |
| 37 | # Useful options | |
| 38 | ||
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
39 | Because Libfuzzer is a sophisticated program, here are some handy options that |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
40 | are available in all fuzzers. |
| 40974 | 41 | |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
42 | * **-help=1** Print help. |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
43 | * **-jobs=1** Number of jobs to run. If jobs >= 1 this will spawn that many jobs in separate worker processes with stdout/stderr redirected to fuzz-JOB.log. |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
44 | * **-workers=0** Number of simultaneous worker processes to run the jobs. If zero, `min(jobs,NumberOfCpuCores()/2)` is used. |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
45 | * **-max_len=0** Maximum length of the test input. If 0, libFuzzer tries to guess a good value based on the corpus and reports it. |
| 40974 | 46 | |
| 47 | # Adding more fuzzers | |
| 48 | ||
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
49 | Of course, having more fuzzers and covering more areas of the code base is |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
50 | always a good thing. It's simple to incorporate a fuzzer into the current build |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
51 | system! If you open the `Makefile.am` file in `libpurple/fuzzers` you'll see a |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
52 | `check_PROGRAMS` variable, you have to add the name to your new fuzzing harness |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
53 | in there. |
| 40974 | 54 | |
| 55 | Example: | |
| 56 | ||
| 57 | ``` | |
| 58 | fuzz_programs=\ | |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
59 | fuzz_html_to_xhtml \ |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
60 | fuzz_jabber_caps \ |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
61 | fuzz_jabber_id_new \ |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
62 | fuzz_markup_strip_html \ |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
63 | fuzz_mime \ |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
64 | fuzz_xmlnode \ |
| 40974 | 65 | fuzz_newfuzzer # This is the newly added fuzzer |
| 66 | ``` | |
| 67 | ||
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
68 | You'll also need to define the sources, which we can do by copying and changing |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
69 | the lines from an existing fuzzer. |
| 40974 | 70 | |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
71 | For example we have a `fuzz_xmlnode.c` fuzzer, these are the lines that define |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
72 | the sources and the flags: |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
73 | |
| 40974 | 74 | ``` |
| 75 | fuzz_xmlnode_SOURCES=fuzz_xmlnode.c | |
| 76 | fuzz_xmlnode_LDADD=$(check_libpurple_LDADD) | |
| 77 | fuzz_xmlnode_CFLAGS=-fsanitize=fuzzer,address $(check_libpurple_CFLAGS) | |
| 78 | ``` | |
| 79 | ||
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
80 | You'll need to change the names of these to match the name of our new fuzzer and |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
81 | add any necessary flags: |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
82 | |
| 40974 | 83 | ``` |
| 84 | fuzz_new_SOURCES=fuzz_new.c | |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
85 | fuzz_new_LDADD=$(common_LDADD) |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
86 | fuzz_new_CFLAGS=-fsanitize=fuzzer,address $(common_CFLAGS) |
| 40974 | 87 | ``` |
| 88 | ||
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
89 | Now you must include your harness in `fuzz_new.c`, an example of a new harness |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
90 | could be as follows: |
|
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
91 | |
| 40974 | 92 | ```C |
| 93 | #include <glib.h> | |
| 94 | #include <string.h> | |
|
41049
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
95 | |
| 40974 | 96 | #include <purple.h> |
| 97 | ||
|
41049
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
98 | gint LLVMFuzzerTestOneInput(const guint8 *data, size_t size); |
| 40974 | 99 | |
|
41049
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
100 | gint |
|
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
101 | LLVMFuzzerTestOneInput(const guint8 *data, size_t size) { |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
102 | gchar *malicious_input = g_new0(gchar, size + 1); |
| 40974 | 103 | |
| 104 | memcpy(malicious_input, data, size); | |
| 105 | malicious_input[size] = '\0'; | |
| 106 | ||
| 107 | function_you_want_to_fuzz(malicious_input); | |
| 108 | ||
| 109 | g_free(malicious_input); | |
| 110 | ||
| 111 | return 0; | |
| 112 | } | |
| 113 | ``` | |
| 114 | ||
|
41049
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
115 | Make sure to include the relevant headers and then run `make check`. This will |
|
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
116 | force an update of the build system and build everything that needs to be |
|
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
117 | rebuilt. If there were no issues, you should now be able to run your new fuzzer |
|
4b6b116a586d
Clean up all of the fuzzers and add a corpus for all of them
Gary Kramlich <grim@reaperworld.com>
parents:
40980
diff
changeset
|
118 | from the `libpurple/fuzzers` directory. |
|
40980
aabad5c7d76c
Move the fuzzers from libpurples/tests to libpurple/fuzzers and cleanup a bunch of little things
Gary Kramlich <grim@reaperworld.com>
parents:
40974
diff
changeset
|
119 |