kmod-project / kmod

kmod - Linux kernel module handling
GNU Lesser General Public License v2.1
50 stars 38 forks source link

Add tests for the security inspired changes #107

Open evelikov opened 2 months ago

evelikov commented 2 months ago

Recently stoeckmann has been doing great job fixing issues in kmod. Alas there has been no tests to ensure the issues don't resurface in a few months/years.

Most of the PRs do include reproducers which we can adapt. See the tests-needed tagged PRs and drop the label once the respective tests have been merged.

evelikov commented 1 week ago

@lucasdemarchi can we get a new label "tests-needed" so we can tag things appropriately? I am starting to look at extending our test suite and the repeated search through the (landed) MRs is becoming a pain.

lucasdemarchi commented 1 week ago

Just did

evelikov commented 1 week ago

@stoeckmann some of the PRs snippets/reproducers include a binary module of sorts. Is it safe to assume that a) it's created by hand aka there is no respective source code and b) the snippets as a whole are are LGPL-2.1-or-later licensed. See https://github.com/kmod-project/kmod/issues/155 for some context.

Thanks o/

stoeckmann commented 1 week ago

Feel free to use them. I didn't use tools except a hex editor to create them (would be nice to have a tool for this).

If you open the decoded and sometimes uncompressed files, you will see weird looking contents, like "111122223333" and so on. I think we should create less cryptic and potentially malicious looking ones for shipped releases.

To explain what these mean: I have marked the ELF fields by filling them up with numbers starting from 0 to F just to have a better way of orientating myself in such a file within a hex editor and elf.h opened next to it. So yes ... Definitely manually made and in whatever license that fits. ;)

stoeckmann commented 1 week ago

The files are also 64 bit, MSB (easier to modify without flipping bytes around). Since we have these possible combinations to support:

I can adjust proof of concept files after we decided which ones we want to add to test suite, so we have a larger coverage of libkmod-elf.c.