Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7042558imu; Wed, 14 Nov 2018 10:46:35 -0800 (PST) X-Google-Smtp-Source: AJdET5fkc4jeKX2PtYOCO9gewIC+WKpxcqzg5fVFZMOny1+Dyb9HYN7Wn83gAN/gtBiGdiRfgmoN X-Received: by 2002:a17:902:bd0b:: with SMTP id p11-v6mr3043086pls.35.1542221195443; Wed, 14 Nov 2018 10:46:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542221195; cv=none; d=google.com; s=arc-20160816; b=lI47+0c4mY3LWgOIY029x5xn49ihq+UN1k2I8TyxZ7i/aUynYxJr3YOlAsWI+gpoOW GOUQfbTuO2MdGt6VwcqjOH9n4NuacwBW2pyH75NWq2AAVsWYls3CoMMftETMaKj1VO1j tU1jPPsuDC8Iz4Ea+rZcFMO7AQWfE3zGOc2OHb7URzmLviImy2gwK3MuvcZm/7zzuxxx Zfk1zrtak9W3cQDlLQeHFoB5eCWoEU79I7OERHDszf7n1cWmvGanct0lKDunbVnXWx/n c4qdpx/O5i5OztKdWWplyA4svF7Fk9JrC+Q9GY6yiCoi6vFNQjAPg/nYTAOsnBDEsQ9t TNmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=a+auDlc4UcuJ4PuCDIklYznLCAOCUJjisCmfSic/xvc=; b=QSDYMYZieQgSahIG5yLC8fYS2zQjjqNUhCgpMI2u11mqQTEIciCmIqPyLiDU0spbi7 KGAdWXwXVxz2CxI1eWWrVE9a3WWY+M+Fl/sqscR/pCBx6+VFW2X6OmQH7KhThVYnr29w QUQtMQjyATFjTyNRBefVZ2FvlXE4P+71TFToe3Q/Btdoud/vXBR3fWB8wbV4uuuMxhya 3NP7MhPudtDAUj/9UvVyO4W9Cq+c25kQpufQ7CDMsRa/sj3nUK7JpllBwUzueqVOVtcB 3CpqW8M/MQwQ1Z8nFHH1qqKhlknJb5dEtSo8EamDvJenKycx/lM+z5re+aaiCSb3Tn6m EWBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10-v6si23762851pgg.389.2018.11.14.10.46.20; Wed, 14 Nov 2018 10:46:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728351AbeKOEtD (ORCPT + 99 others); Wed, 14 Nov 2018 23:49:03 -0500 Received: from mail.skyhub.de ([5.9.137.197]:44134 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726823AbeKOEtD (ORCPT ); Wed, 14 Nov 2018 23:49:03 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id SUeoZ2faX-f6; Wed, 14 Nov 2018 19:44:40 +0100 (CET) Received: from zn.tnic (p200300EC2BD0D200D5714500C00E26FD.dip0.t-ipconnect.de [IPv6:2003:ec:2bd0:d200:d571:4500:c00e:26fd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 033B81EC03C8; Wed, 14 Nov 2018 19:44:40 +0100 (CET) Date: Wed, 14 Nov 2018 19:44:36 +0100 From: Borislav Petkov To: Yu-cheng Yu Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue Subject: Re: [PATCH v5 06/27] x86/cet: Control protection exception handler Message-ID: <20181114184436.GK13926@zn.tnic> References: <20181011151523.27101-1-yu-cheng.yu@intel.com> <20181011151523.27101-7-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181011151523.27101-7-yu-cheng.yu@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org That subject needs a verb: Subject: [PATCH v5 06/27] x86/cet: Add control protection exception handler On Thu, Oct 11, 2018 at 08:15:02AM -0700, Yu-cheng Yu wrote: > A control protection exception is triggered when a control flow transfer > attempt violated shadow stack or indirect branch tracking constraints. > For example, the return address for a RET instruction differs from the > safe copy on the shadow stack; or a JMP instruction arrives at a non- > ENDBR instruction. > > The control protection exception handler works in a similar way as the > general protection fault handler. > > Signed-off-by: Yu-cheng Yu > --- > arch/x86/entry/entry_64.S | 2 +- > arch/x86/include/asm/traps.h | 3 ++ > arch/x86/kernel/idt.c | 4 ++ > arch/x86/kernel/signal_compat.c | 2 +- > arch/x86/kernel/traps.c | 64 ++++++++++++++++++++++++++++++ > include/uapi/asm-generic/siginfo.h | 3 +- > 6 files changed, 75 insertions(+), 3 deletions(-) A *lot* of style problems here. Please use checkpatch and then common sense to check your patches before sending. All those below are valid, AFAICT: WARNING: function definition argument 'struct pt_regs *' should also have an identifier name #76: FILE: arch/x86/include/asm/traps.h:81: +dotraplinkage void do_control_protection(struct pt_regs *, long); WARNING: function definition argument 'long' should also have an identifier name #76: FILE: arch/x86/include/asm/traps.h:81: +dotraplinkage void do_control_protection(struct pt_regs *, long); WARNING: static const char * array should probably be static const char * const #124: FILE: arch/x86/kernel/traps.c:581: +static const char *control_protection_err[] = ERROR: that open brace { should be on the previous line #125: FILE: arch/x86/kernel/traps.c:582: +static const char *control_protection_err[] = +{ WARNING: quoted string split across lines #158: FILE: arch/x86/kernel/traps.c:615: + WARN_ONCE(1, "CET is disabled but got control " + "protection fault\n"); WARNING: Prefer printk_ratelimited or pr__ratelimited to printk_ratelimit #165: FILE: arch/x86/kernel/traps.c:622: + printk_ratelimit()) { WARNING: Avoid logging continuation uses where feasible #176: FILE: arch/x86/kernel/traps.c:633: + pr_cont("\n"); ERROR: "(foo*)" should be "(foo *)" #183: FILE: arch/x86/kernel/traps.c:640: + info.si_addr = (void __user*)uprobe_get_trap_addr(regs); And now that patch doesn't even build anymore because of the siginfo changes which came in during the merge window. I guess I'll wait for your v6 patchset. --- arch/x86/kernel/traps.c: In function ‘do_control_protection’: arch/x86/kernel/traps.c:627:16: error: passing argument 1 of ‘clear_siginfo’ from incompatible pointer type [-Werror=incompatible-pointer-types] clear_siginfo(&info); ^~~~~ In file included from ./include/linux/sched/signal.h:6, from ./include/linux/ptrace.h:7, from ./include/linux/ftrace.h:14, from ./include/linux/kprobes.h:42, from arch/x86/kernel/traps.c:19: ./include/linux/signal.h:20:52: note: expected ‘kernel_siginfo_t *’ {aka ‘struct kernel_siginfo *’} but argument is of type ‘siginfo_t *’ {aka ‘struct siginfo *’} static inline void clear_siginfo(kernel_siginfo_t *info) ~~~~~~~~~~~~~~~~~~^~~~ arch/x86/kernel/traps.c:632:26: error: passing argument 2 of ‘force_sig_info’ from incompatible pointer type [-Werror=incompatible-pointer-types] force_sig_info(SIGSEGV, &info, tsk); ^~~~~ In file included from ./include/linux/ptrace.h:7, from ./include/linux/ftrace.h:14, from ./include/linux/kprobes.h:42, from arch/x86/kernel/traps.c:19: ./include/linux/sched/signal.h:327:32: note: expected ‘struct kernel_siginfo *’ but argument is of type ‘siginfo_t *’ {aka ‘struct siginfo *’} extern int force_sig_info(int, struct kernel_siginfo *, struct task_struct *); ^~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:291: arch/x86/kernel/traps.o] Error 1 make[1]: *** [scripts/Makefile.build:516: arch/x86/kernel] Error 2 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:1060: arch/x86] Error 2 make: *** Waiting for unfinished jobs.... -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.