Merged
Conversation
…e to bool Make kpatch_line_macro_change_only()'s usage more clear by changing its return type to bool. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
sm00th
approved these changes
Aug 11, 2021
Contributor
sm00th
left a comment
There was a problem hiding this comment.
Approving given this PR contains a commit updating unit-test objectfiles submodule pointer.
CONFIG_PRINTK_INDEX creates a static local struct variable named `_entry` for every call site to printk(). The initializer for that struct assigns the `__LINE__` macro to one of its fields. Similarly to the WARN macro's usage [1] of `__LINE__`, it causes problems because it results in the line number getting directly embedded in the struct. If a line is added or removed higher up in the source file, the `_entry` struct changes accordingly due to a change in the printk() call site line number. `_entry` is similar to other "special" static locals, in that we don't need to correlate the patched version with the original version. We can instead just ignore any changes to it. Any substantial (non-line-number) change to the `_entry` struct would be a second-order (dependent) effect of a first-order code change, which would be detected using other means. In that case the patched version of `_entry` will be included, due to being referenced by the changed function. Fixes: dynup#1206 [1] See kpatch_line_macro_change_only() Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
For each printk() call site, CONFIG_PRINTK_INDEX makes a static local struct named `_entry`, and then adds a pointer to it in the `.printk_index` section. When regenerating the `.printk_index` section for the patch module, we only need to include those entries which are referenced by included functions. Luckily this is a common pattern already used by several other "special" sections. Add `.printk_index` to the special section handling logic. Fixes: dynup#1206 Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
8bf5ec2 to
56471ff
Compare
Member
Author
|
v2: add unit test reference |
Contributor
|
It works great in my tests. Thanks! |
liu-song-6
approved these changes
Aug 14, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As described in #1206. See the commit messages for more info. Will post unit tests momentarily.