lkml.org 
[lkml]   [2018]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/9] x86/cet: Control protection exception handler
    Hi Yu-cheng,

    Thank you for the patch! Yet something to improve:

    [auto build test ERROR on asm-generic/master]
    [also build test ERROR 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-a0-201822 (attached as .config)
    compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
    reproduce:
    # save the attached .config to linux build tree
    make ARCH=i386

    All errors (new ones prefixed by >>):

    In file included from arch/x86/include/asm/thread_info.h:53:0,
    from include/linux/thread_info.h:38,
    from arch/x86/include/asm/preempt.h:7,
    from include/linux/preempt.h:81,
    from include/linux/rcupdate.h:40,
    from include/linux/rculist.h:11,
    from include/linux/pid.h:5,
    from include/linux/sched.h:14,
    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)
    if (!cpu_feature_enabled(X86_FEATURE_SHSTK) &&
    ^
    arch/x86/include/asm/cpufeature.h:127:24: note: in definition of macro 'cpu_feature_enabled'
    (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : static_cpu_has(bit))
    ^
    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) &&
    ^
    arch/x86/include/asm/cpufeature.h:127:24: note: in definition of macro 'cpu_feature_enabled'
    (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : static_cpu_has(bit))
    ^
    >> arch/x86/kernel/traps.c:606:27: error: 'X86_FEATURE_IBT' undeclared (first use in this function)
    !cpu_feature_enabled(X86_FEATURE_IBT)) {
    ^
    arch/x86/include/asm/cpufeature.h:127:24: note: in definition of macro 'cpu_feature_enabled'
    (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : static_cpu_has(bit))
    ^

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

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

    ---
    0-DAY kernel test infrastructure Open Source Technology Center
    https://lists.01.org/pipermail/kbuild-all Intel Corporation
    [unhandled content-type:application/gzip]
    \
     
     \ /
      Last update: 2018-06-08 06:18    [W:4.529 / U:0.272 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site