create-diff-object: Support CONFIG_PRINTK_INDEX, part 1

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: #1206

[1] See kpatch_line_macro_change_only()

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
Josh Poimboeuf 2021-08-10 14:14:22 -07:00
parent ea0470baa7
commit 6cf50a6fca
2 changed files with 2 additions and 1 deletions

View File

@ -321,6 +321,7 @@ static bool is_special_static(struct symbol *sym)
"__FUNCTION__",
"_rs",
"CSWTCH",
"_entry",
NULL,
};
char **var_name;

@ -1 +1 @@
Subproject commit 7e8b18d1b7dfef2394fb97668a4c568078c30c30
Subproject commit 375794c2e5c6898643fea44f7ce354dc6404a4cc