10000 CDO: Introduce log_error() by liu-song-6 · Pull Request #1456 · dynup/kpatch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

CDO: Introduce log_error() #1456

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions kpatch-build/create-diff-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1700,8 +1700,8 @@ static void kpatch_check_func_profiling_calls(struct kpatch_elf *kelf)
(sym->parent && sym->parent->status == CHANGED))
continue;
if (!sym->twin->has_func_profiling) {
log_normal("function %s has no fentry/mcount call, unable to patch\n",
sym->name);
log_error("function %s has no fentry/mcount call, unable to patch\n",
sym->name);
errs++;
}
}
Expand All @@ -1717,19 +1717,19 @@ static void kpatch_verify_patchability(struct kpatch_elf *kelf)

list_for_each_entry(sec, &kelf->sections, list) {
if (sec->status == CHANGED && !sec->include) {
log_normal("changed section %s not selected for inclusion\n",
sec->name);
log_error("changed section %s not selected for inclusion\n",
sec->name);
errs++;
}

if (sec->status != SAME && sec->grouped) {
log_normal("changed section %s is part of a section group\n",
sec->name);
log_error("changed section %s is part of a section group\n",
sec->name);
errs++;
}

if (sec->sh.sh_type == SHT_GROUP && sec->status == NEW) {
log_normal("new/changed group sections are not supported\n");
log_error("new/changed group sections are not supported\n");
errs++;
}

Expand All @@ -1742,8 +1742,7 @@ static void kpatch_verify_patchability(struct kpatch_elf *kelf)
(!strncmp(sec->name, ".data", 5) || !strncmp(sec->name, ".bss", 4)) &&
(strcmp(sec->name, ".data.unlikely") && strcmp(sec->name, ".data.once") &&
strcmp(sec->name, ".data..once"))) {
log_normal("data section %s selected for inclusion\n",
sec->name);
log_error("data section %s selected for inclusion\n", sec->name);
errs++;
}
}
Expand Down Expand Up @@ -2308,8 +2307,8 @@ static bool jump_table_group_filter(struct lookup_table *lookup,
* This will be upgraded to an error after all jump labels have
* been reported.
*/
log_normal("Found a jump label at %s()+0x%lx, using key %s. Jump labels aren't supported with this kernel. Use static_key_enabled() instead.\n",
code->sym->name, code->addend, key->sym->name);
log_error("Found a jump label at %s()+0x%lx, using key %s. Jump labels aren't supported with this kernel. Use static_key_enabled() instead.\n",
code->sym->name, code->addend, key->sym->name);
jump_label_errors++;
return false;
}
Expand Down Expand Up @@ -2338,8 +2337,8 @@ static bool jump_table_group_filter(struct lookup_table *lookup,
* This will be upgraded to an error after all jump label
* errors have been reported.
*/
log_normal("Found a jump label at %s()+0x%lx, using key %s, which is defined in a module. Use static_key_enabled() instead.\n",
code->sym->name, code->addend, key->sym->name);
log_error("Found a jump label at %s()+0x%lx, using key %s, which is defined in a module. Use static_key_enabled() instead.\n",
code->sym->name, code->addend, key->sym->name);
jump_label_errors++;
return false;
}
Expand Down Expand Up @@ -2409,7 +2408,7 @@ static bool static_call_sites_group_filter(struct lookup_table *lookup,
* This will be upgraded to an error after all static call
* errors have been reported.
*/
log_normal("Found a static call at %s()+0x%lx, using key %s, which is defined in a module. Use KPATCH_STATIC_CALL() instead.\n",
log_error("Found a static call at %s()+0x%lx, using key %s, which is defined in a module. Use KPATCH_STATIC_CALL() instead.\n",
code->sym->name, code->addend, key->sym->name);
static_call_errors++;
return false;
Expand Down Expand Up @@ -4020,8 +4019,8 @@ static void kpatch_no_sibling_calls_ppc64le(struct kpatch_elf *kelf)
if (!find_rela_by_offset(sym->sec->rela, offset))
continue;

log_normal("Found an unsupported sibling call at %s()+0x%lx. Add __attribute__((optimize(\"-fno-optimize-sibling-calls\"))) to %s() definition.\n",
sym->name, sym->sym.st_value + offset, sym->name);
log_error("Found an unsupported sibling call at %s()+0x%lx. Add __attribute__((optimize(\"-fno-optimize-sibling-calls\"))) to %s() definition.\n",
sym->name, sym->sym.st_value + offset, sym->name);
sibling_call_errors++;
}
}
Expand Down
5 changes: 5 additions & 0 deletions kpatch-build/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ extern char *childobj;
printf(format, ##__VA_ARGS__); \
})

#define log_error(format, ...) \
({ \
fprintf(stderr, "ERROR: " format, ##__VA_ARGS__); \
})

enum loglevel {
DEBUG,
NORMAL
Expand Down
0