Re: [PATCH 5/9] x86/mm: Introduce _PAGE_DIRTY_SW

From: kbuild test robot
Date: Fri Jun 08 2018 - 01:16:17 EST


Hi Yu-cheng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on asm-generic/master]
[also build test WARNING on v4.17 next-20180607]
[cannot apply to tip/x86/core mmotm/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Yu-cheng-Yu/Control-Flow-Enforcement-Part-2/20180608-111152
base: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
config: i386-randconfig-x003-201822 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

In file included from arch/x86/include/asm/current.h:5:0,
from include/linux/sched.h:12,
from include/linux/context_tracking.h:5,
from arch/x86/kernel/traps.c:15:
arch/x86/kernel/traps.c: In function 'do_control_protection':
arch/x86/kernel/traps.c:605:27: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'?
if (!cpu_feature_enabled(X86_FEATURE_SHSTK) &&
^
include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> arch/x86/kernel/traps.c:605:2: note: in expansion of macro 'if'
if (!cpu_feature_enabled(X86_FEATURE_SHSTK) &&
^~
>> arch/x86/kernel/traps.c:605:7: note: in expansion of macro 'cpu_feature_enabled'
if (!cpu_feature_enabled(X86_FEATURE_SHSTK) &&
^~~~~~~~~~~~~~~~~~~
arch/x86/kernel/traps.c:605:27: note: each undeclared identifier is reported only once for each function it appears in
if (!cpu_feature_enabled(X86_FEATURE_SHSTK) &&
^
include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> arch/x86/kernel/traps.c:605:2: note: in expansion of macro 'if'
if (!cpu_feature_enabled(X86_FEATURE_SHSTK) &&
^~
>> arch/x86/kernel/traps.c:605:7: note: in expansion of macro 'cpu_feature_enabled'
if (!cpu_feature_enabled(X86_FEATURE_SHSTK) &&
^~~~~~~~~~~~~~~~~~~
arch/x86/kernel/traps.c:606:27: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'?
!cpu_feature_enabled(X86_FEATURE_IBT)) {
^
include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> arch/x86/kernel/traps.c:605:2: note: in expansion of macro 'if'
if (!cpu_feature_enabled(X86_FEATURE_SHSTK) &&
^~
arch/x86/kernel/traps.c:606:7: note: in expansion of macro 'cpu_feature_enabled'
!cpu_feature_enabled(X86_FEATURE_IBT)) {
^~~~~~~~~~~~~~~~~~~

vim +/if +605 arch/x86/kernel/traps.c

a74a6de2 Yu-cheng Yu 2018-06-07 589
a74a6de2 Yu-cheng Yu 2018-06-07 590 /*
a74a6de2 Yu-cheng Yu 2018-06-07 591 * When a control protection exception occurs, send a signal
a74a6de2 Yu-cheng Yu 2018-06-07 592 * to the responsible application. Currently, control
a74a6de2 Yu-cheng Yu 2018-06-07 593 * protection is only enabled for the user mode. This
a74a6de2 Yu-cheng Yu 2018-06-07 594 * exception should not come from the kernel mode.
a74a6de2 Yu-cheng Yu 2018-06-07 595 */
a74a6de2 Yu-cheng Yu 2018-06-07 596 dotraplinkage void
a74a6de2 Yu-cheng Yu 2018-06-07 597 do_control_protection(struct pt_regs *regs, long error_code)
a74a6de2 Yu-cheng Yu 2018-06-07 598 {
a74a6de2 Yu-cheng Yu 2018-06-07 599 struct task_struct *tsk;
a74a6de2 Yu-cheng Yu 2018-06-07 600
a74a6de2 Yu-cheng Yu 2018-06-07 601 RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
a74a6de2 Yu-cheng Yu 2018-06-07 602 cond_local_irq_enable(regs);
a74a6de2 Yu-cheng Yu 2018-06-07 603
a74a6de2 Yu-cheng Yu 2018-06-07 604 tsk = current;
a74a6de2 Yu-cheng Yu 2018-06-07 @605 if (!cpu_feature_enabled(X86_FEATURE_SHSTK) &&
a74a6de2 Yu-cheng Yu 2018-06-07 606 !cpu_feature_enabled(X86_FEATURE_IBT)) {
a74a6de2 Yu-cheng Yu 2018-06-07 607 goto exit;
a74a6de2 Yu-cheng Yu 2018-06-07 608 }
a74a6de2 Yu-cheng Yu 2018-06-07 609
a74a6de2 Yu-cheng Yu 2018-06-07 610 if (!user_mode(regs)) {
a74a6de2 Yu-cheng Yu 2018-06-07 611 tsk->thread.error_code = error_code;
a74a6de2 Yu-cheng Yu 2018-06-07 612 tsk->thread.trap_nr = X86_TRAP_CP;
a74a6de2 Yu-cheng Yu 2018-06-07 613 if (notify_die(DIE_TRAP, "control protection fault", regs,
a74a6de2 Yu-cheng Yu 2018-06-07 614 error_code, X86_TRAP_CP, SIGSEGV) != NOTIFY_STOP)
a74a6de2 Yu-cheng Yu 2018-06-07 615 die("control protection fault", regs, error_code);
a74a6de2 Yu-cheng Yu 2018-06-07 616 return;
a74a6de2 Yu-cheng Yu 2018-06-07 617 }
a74a6de2 Yu-cheng Yu 2018-06-07 618
a74a6de2 Yu-cheng Yu 2018-06-07 619 tsk->thread.error_code = error_code;
a74a6de2 Yu-cheng Yu 2018-06-07 620 tsk->thread.trap_nr = X86_TRAP_CP;
a74a6de2 Yu-cheng Yu 2018-06-07 621
a74a6de2 Yu-cheng Yu 2018-06-07 622 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
a74a6de2 Yu-cheng Yu 2018-06-07 623 printk_ratelimit()) {
a74a6de2 Yu-cheng Yu 2018-06-07 624 unsigned int max_idx, err_idx;
a74a6de2 Yu-cheng Yu 2018-06-07 625
a74a6de2 Yu-cheng Yu 2018-06-07 626 max_idx = ARRAY_SIZE(control_protection_err) - 1;
a74a6de2 Yu-cheng Yu 2018-06-07 627 err_idx = min((unsigned int)error_code - 1, max_idx);
a74a6de2 Yu-cheng Yu 2018-06-07 628 pr_info("%s[%d] control protection ip:%lx sp:%lx error:%lx(%s)",
a74a6de2 Yu-cheng Yu 2018-06-07 629 tsk->comm, task_pid_nr(tsk),
a74a6de2 Yu-cheng Yu 2018-06-07 630 regs->ip, regs->sp, error_code,
a74a6de2 Yu-cheng Yu 2018-06-07 631 control_protection_err[err_idx]);
a74a6de2 Yu-cheng Yu 2018-06-07 632 print_vma_addr(" in ", regs->ip);
a74a6de2 Yu-cheng Yu 2018-06-07 633 pr_cont("\n");
a74a6de2 Yu-cheng Yu 2018-06-07 634 }
a74a6de2 Yu-cheng Yu 2018-06-07 635
a74a6de2 Yu-cheng Yu 2018-06-07 636 exit:
a74a6de2 Yu-cheng Yu 2018-06-07 637 force_sig_info(SIGSEGV, SEND_SIG_PRIV, tsk);
a74a6de2 Yu-cheng Yu 2018-06-07 638 }
a74a6de2 Yu-cheng Yu 2018-06-07 639 NOKPROBE_SYMBOL(do_control_protection);
a74a6de2 Yu-cheng Yu 2018-06-07 640

:::::: The code at line 605 was first introduced by commit
:::::: a74a6de2a3290257798598ae1f816eddb04f63f2 x86/cet: Control protection exception handler

:::::: TO: Yu-cheng Yu <yu-cheng.yu@xxxxxxxxx>
:::::: CC: 0day robot <lkp@xxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip