From 6cf50a6fca8414a2414bcb1e87ec8fd81be806eb Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Tue, 10 Aug 2021 14:14:22 -0700 Subject: [PATCH] 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 --- kpatch-build/create-diff-object.c | 1 + test/unit/objs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 6c3d956..92fb8e8 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -321,6 +321,7 @@ static bool is_special_static(struct symbol *sym) "__FUNCTION__", "_rs", "CSWTCH", + "_entry", NULL, }; char **var_name; diff --git a/test/unit/objs b/test/unit/objs index 7e8b18d..375794c 160000 --- a/test/unit/objs +++ b/test/unit/objs @@ -1 +1 @@ -Subproject commit 7e8b18d1b7dfef2394fb97668a4c568078c30c30 +Subproject commit 375794c2e5c6898643fea44f7ce354dc6404a4cc