-
Notifications
You must be signed in to change notification settings - Fork 52
Bug fixes from incremental depmod PR #257
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
Conversation
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.
The changes look great IMHO. Would be amazing to have a test or two but it's a non-blocking request.
dc352d2
to
486771d
Compare
I've added tests now that trigger the failures that I saw on #253. I'm not sure how you deal with failures like this. I chose to add the test with I also added one more patch ("always use a step size of 4"), as the logic for determining the step size seems strange (I wouldn't have encountered the out-of-bounds memory access problem if the step size wasn't 1 with |
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.
You are a star, thank you for the tests - loving the expected_fail
approach. The extra patch also looks good.
Seems like I cannot approve for CI, so it'll be up-to @lucasdemarchi
rebased onto current master |
d7e3d0f
to
bd374ed
Compare
@evelikov no idea why CI is not running on this PR. |
Codecov ReportAttention: Patch coverage is
|
Fixes: c36ddb6 ("depmod: Add option to override MODULE_DIRECTORY") Signed-off-by: Martin Wilck <martin_wilck@gmx.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: kmod-project#257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Assume bucket->used is 1, and element 0 is deleted. We shouldn't access any memory above (entry + 1) in this case. Likewise, if bucked->used is 2, only one element should be shifted, etc. Fixes: 7db0865 ("Add simple hash implementation") Signed-off-by: Martin Wilck <martin_wilck@gmx.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: kmod-project#257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
...using n_buckets = 32, which will cause a step size of 1. Before commit d658ec7 ("libkmod: hash_del: fix out-of-bounds memory access") this test would fail. Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: kmod-project#257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
It can happen that bucket->entries is NULL, but bsearch is annotated such that it's second argument must be non-NULL. Fixes: 7db0865 ("Add simple hash implementation") Signed-off-by: Martin Wilck <martin_wilck@gmx.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: kmod-project#257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
This test would fail before commit 520ac55 ("libkmod: hash_del: handle deleting a non-existing element gracefully"). Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: kmod-project#257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
If buf->bytes, buf->used, and len are all 0, buf_grow() will do nothing, and memcpy() willbe called with a NULL first argument. This will cause an error because the function is annotated with __nonnull(1, 2). Fixes: e62d8c7 ("strbuf: make strbuf_pushchars() a little less dumb") Signed-off-by: Martin Wilck <martin_wilck@gmx.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: kmod-project#257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
This test would fail before commit bbd8598 ("libkmod: strbuf_pushchars: handle pushing empty string gracefully"). Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: kmod-project#257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
The current algorithm would choose a step size of 4 for n_buckets == 31, but 1 for n_buckets == 32, which seems wrong. Fix it. Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: kmod-project#257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
bd374ed
to
2a2bbcd
Compare
Fixes: c36ddb6 ("depmod: Add option to override MODULE_DIRECTORY") Signed-off-by: Martin Wilck <martin_wilck@gmx.de>
...using n_buckets = 32, which will cause a step size of 1. This test fails, and will be fixed by the next commit. Signed-off-by: Martin Wilck <mwilck@suse.com>
Assume bucket->used is 1, and element 0 is deleted. We shouldn't access any memory above (entry + 1) in this case. Likewise, if bucked->used is 2, only one element should be shifted, etc. Fixes: 7db0865 ("Add simple hash implementation") Signed-off-by: Martin Wilck <martin_wilck@gmx.de>
This test fails and will be fixed by the next commit. Signed-off-by: Martin Wilck <mwilck@suse.com>
It can happen that bucket->entries is NULL, but bsearch is annotated such that it's second argument must be non-NULL. Fixes: 7db0865 ("Add simple hash implementation") Signed-off-by: Martin Wilck <martin_wilck@gmx.de>
This test fails, and will be fixed by the next commit. Signed-off-by: Martin Wilck <mwilck@suse.com>
If buf->bytes, buf->used, and len are all 0, buf_grow() will do nothing, and memcpy() willbe called with a NULL first argument. This will cause an error because the function is annotated with __nonnull(1, 2). Fixes: e62d8c7 ("strbuf: make strbuf_pushchars() a little less dumb") Signed-off-by: Martin Wilck <martin_wilck@gmx.de>
The current algorithm would choose a step size of 4 for n_buckets == 31, but 1 for n_buckets == 32, which seems wrong. Fix it. Signed-off-by: Martin Wilck <mwilck@suse.com>
2a2bbcd
to
eb15490
Compare
...using n_buckets = 32, which will cause a step size of 1. This test fails, and will be fixed by the next commit. Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: #257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Assume bucket->used is 1, and element 0 is deleted. We shouldn't access any memory above (entry + 1) in this case. Likewise, if bucked->used is 2, only one element should be shifted, etc. Fixes: 7db0865 ("Add simple hash implementation") Signed-off-by: Martin Wilck <martin_wilck@gmx.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: #257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
This test fails and will be fixed by the next commit. Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: #257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
It can happen that bucket->entries is NULL, but bsearch is annotated such that it's second argument must be non-NULL. Fixes: 7db0865 ("Add simple hash implementation") Signed-off-by: Martin Wilck <martin_wilck@gmx.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: #257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
This test fails, and will be fixed by the next commit. Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: #257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
If buf->bytes, buf->used, and len are all 0, buf_grow() will do nothing, and memcpy() willbe called with a NULL first argument. This will cause an error because the function is annotated with __nonnull(1, 2). Fixes: e62d8c7 ("strbuf: make strbuf_pushchars() a little less dumb") Signed-off-by: Martin Wilck <martin_wilck@gmx.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: #257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
The current algorithm would choose a step size of 4 for n_buckets == 31, but 1 for n_buckets == 32, which seems wrong. Fix it. Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: #257 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Thanks a lot for the fixes and additional tests. I was going to swap the order of commits and avoid using the xfail... but changed my mind - it looks good in this order. I fixed the coding style issue and applied. |
@lucasdemarchi some point last year, GitHub changed so that first PR from new people need to be approved by maintainers - their blog post has the details. I suspect that adding me as reviewer might also do the trick. |
@evelikov the problem is that the PR itself was not showing it the approval as needed. I had to go to each individual worfklow and approve them individually. I saw the request when the PR was opened, but it wasn't available anymore after it had been reviewed. |
it doesn't seem that there is such a role in Github. There is "triage" and "write". Anyway I created a "Reviewer" team with write access and invited both you and @stoeckmann. Note that PRs shouldn't be merged though - I manually apply the PRs pushing to both kernel.org and github. |
Thank you, duly noted. |
This PR splits off the bug fixes from #253, as requested by @evelikov.
I found these issues while making the kmod CI tests work with the "incremental depmod" patch set.