Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2047811pxb; Fri, 5 Feb 2021 07:52:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJySO5jgQ4BNGUClyzUUqRAHb2tCoACeqmIbCJxOJrKrAnqP5dlI39rSdb6ShWu/Vt4a9JhT X-Received: by 2002:a17:906:1a11:: with SMTP id i17mr4741024ejf.278.1612540353937; Fri, 05 Feb 2021 07:52:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612540353; cv=none; d=google.com; s=arc-20160816; b=0VRiZX/ScQzWOatDOu5RVFPGQjbm1mQD9cSQp7qBeK0tC6WBKiGK7P1T7jOrVIss9S SIHYvwk4+NS/EFJeDkoPLCNGut9eXth4sQJd+tZJdlgAWwC3OgODt9otLXpioLVgfxVG +YLMk+YcZ/L2vDKmcyUyKIZQMmJlej4gVfim1Ib46iZC1ezTa/BkMlQRL3ZBmZ2pwkpn 7Tu+ybCpYB8VQQ5w8s/qa2Da9HNKxL7pKmwfw0LI3OvStNSv8RPc8rQiFygz3FWKlVOE tqRUaQXJDO7X7pVtngRJhWCJe/HTXnGzPQMN6SZfnvcScq17DtB2yHQgER/i6G8Nn8+N LzOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fejHEgISzAriaXk58/yJbjLx87IH2APQ6UHwJdugJkM=; b=SxG/ZYrWFhPwdZQ6KqWpDygAM371gypjXMZD0lxgxVrIXASy+zzG+TE+B/jfk4qrdv uJScYE9ZuDsHTg0otRcuY2A14+FdYmHy1vqEcCmtEY04LS7A6I9GGIZJsp7XtfxlGPkd CiH2BXGBc3q9OaxflJZt60MFlvTyrrwijQFPx2Fj0XZMj+KBCjI5ozhk2qCVuWVsXE1f koOJbJKFfaUwOHRlGxpQsA23/5EdgGlQtDttBHgcbMTEnxDjrilIXJZNW4pfZS0pnvRy l0IYSIgmXAnH8xI5a2MPzuuuIM4qK9GRCzxrgUWzIiB6LcO9+nG8RVaR+gHiNmHSSh/M CntQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="MBU/kzai"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e14si5188433ejk.542.2021.02.05.07.51.46; Fri, 05 Feb 2021 07:52:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="MBU/kzai"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231321AbhBEOKl (ORCPT + 99 others); Fri, 5 Feb 2021 09:10:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbhBEOAQ (ORCPT ); Fri, 5 Feb 2021 09:00:16 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E97AC06178A; Fri, 5 Feb 2021 05:59:34 -0800 (PST) Received: from zn.tnic (p200300ec2f0bad00265302c9d3d9d03f.dip0.t-ipconnect.de [IPv6:2003:ec:2f0b:ad00:2653:2c9:d3d9:d03f]) (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 8E2061EC046E; Fri, 5 Feb 2021 14:59:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1612533572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=fejHEgISzAriaXk58/yJbjLx87IH2APQ6UHwJdugJkM=; b=MBU/kzais+IBkRkPz4TnWRG+A8fD6KoCqQ6ftWcnyATMdURu4VClIpP1aTBHJT2ew63u9h qrHbFq4H3uWvu++s5O3o23kF4tHNf7UN9W2qMtI0Z+ErEh7EMxLUZ9qSQ5pCStCG03ZpIi fe0oEtaQDEIUKaLlv6mshLw/6lwGVek= Date: Fri, 5 Feb 2021 14:59:27 +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 , Dave Martin , Weijiang Yang , Pengfei Xu , Michael Kerrisk Subject: Re: [PATCH v19 06/25] x86/cet: Add control-protection fault handler Message-ID: <20210205135927.GH17488@zn.tnic> References: <20210203225547.32221-1-yu-cheng.yu@intel.com> <20210203225547.32221-7-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210203225547.32221-7-yu-cheng.yu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 03, 2021 at 02:55:28PM -0800, Yu-cheng Yu wrote: > +DEFINE_IDTENTRY_ERRORCODE(exc_control_protection) > +{ > + static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, > + DEFAULT_RATELIMIT_BURST); > + struct task_struct *tsk; > + > + if (!user_mode(regs)) { > + pr_emerg("PANIC: unexpected kernel control protection fault\n"); > + die("kernel control protection fault", regs, error_code); > + panic("Machine halted."); > + } > + > + cond_local_irq_enable(regs); > + > + if (!boot_cpu_has(X86_FEATURE_CET)) > + WARN_ONCE(1, "Control protection fault with CET support disabled\n"); > + > + tsk = current; > + tsk->thread.error_code = error_code; > + tsk->thread.trap_nr = X86_TRAP_CP; > + > + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && > + __ratelimit(&rs)) { I can't find it written down anywhere why the ratelimiting is needed at all? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette