Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp967334imm; Fri, 13 Jul 2018 09:13:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcEhsGrzUfyrAiUHd30fr/W8TnchfGritgLIYklVqOGMVTjXJidBdQlJ6CzqDgG/TGSoMVa X-Received: by 2002:a63:d518:: with SMTP id c24-v6mr6721202pgg.357.1531498389706; Fri, 13 Jul 2018 09:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531498389; cv=none; d=google.com; s=arc-20160816; b=UdT48kZTBSsvnOTWbJdXpL/dSLo2jJNiRY7fRXFL0Bmp2yd+CUcRV0OFWys2gnfYdP fp+jg9bDKywSeNXiuezzTa8Qc/Vn5k+6O74GsNP8zoBoPNcC+DrERFrHMv9rQ92rrh4c pW882pR93JMZUo7jNyyigYQlV4PEYdI+eq9zoVm1PIh9AKVO+WK6Hine4eOTcpGfyEUU tA+fgkqxBkl8xVtPuU8H5lSSXL8f6NpD+xzQNJoB9qWlOkz8lugvh1Tks2fqAuDUTFv7 oZEmSIM0fNfqpFThcfU0rAJlBqDedUDxyTVXwsEFWv3ym17BkktDUIE3g/Q8YBnAN+VK KUrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=Mg3WKEkcyMk75fs4ZpqL9H14Z4ahFQmDcS1IZCaWVUk=; b=0aBqBGYzJPtidK5ffK9ya7C5vi/FxSW4MXUrRZhzzakI1U1JMa+JUOPVCCErmJF4Ru MVxl1DzLANDffzLJBnz9lxzvXxO7qeTacXvgynXGZMeYORCIu9oW7gwUAD6uNNNU8qsX iPnTbbwWL9idYeyYvLtn9tzGxnEaJuiG4UnFbTcfz2fRJyoclL/495B8OZecLIdL4Jfd LoP3RDCOLaqobsj1I2wzhEi93wN7czxEhk0sI994Etxxn8v21n7m5HjEJxsyUELVnX6u pGirNXjrmc39KNME+QeowNYRurq6Wzc6TFnA/Iq3eYtq+Tv2jCAGjViZy6oH+QYimTXi /acQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ce9-v6si25389380plb.364.2018.07.13.09.12.55; Fri, 13 Jul 2018 09:13:09 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730730AbeGMQ05 (ORCPT + 99 others); Fri, 13 Jul 2018 12:26:57 -0400 Received: from mga09.intel.com ([134.134.136.24]:50420 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729736AbeGMQ05 (ORCPT ); Fri, 13 Jul 2018 12:26:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jul 2018 09:11:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,348,1526367600"; d="scan'208";a="71159019" Received: from 2b52.sc.intel.com ([143.183.136.52]) by fmsmga004.fm.intel.com with ESMTP; 13 Jul 2018 09:11:40 -0700 Message-ID: <1531498079.8494.16.camel@intel.com> Subject: Re: [RFC PATCH v2 25/27] x86/cet: Add PTRACE interface for CET From: Yu-cheng Yu To: Thomas Gleixner Cc: Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , 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 , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , "Ravi V. Shankar" , Vedvyas Shanbhogue Date: Fri, 13 Jul 2018 09:07:59 -0700 In-Reply-To: References: <20180710222639.8241-1-yu-cheng.yu@intel.com> <20180710222639.8241-26-yu-cheng.yu@intel.com> <20180711102035.GB8574@gmail.com> <1531323638.13297.24.camel@intel.com> <20180712140327.GA7810@gmail.com> <1531435034.2965.15.camel@intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-07-13 at 01:08 +0200, Thomas Gleixner wrote: > On Thu, 12 Jul 2018, Yu-cheng Yu wrote: > > > > On Thu, 2018-07-12 at 16:03 +0200, Ingo Molnar wrote: > > > > > > * Yu-cheng Yu wrote: > > > > > > > > > > > > > > > > > > > > > diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c > > > > > > index e2ee403865eb..ac2bc3a18427 100644 > > > > > > --- a/arch/x86/kernel/ptrace.c > > > > > > +++ b/arch/x86/kernel/ptrace.c > > > > > > @@ -49,7 +49,9 @@ enum x86_regset { > > > > > >   REGSET_IOPERM64 = REGSET_XFP, > > > > > >   REGSET_XSTATE, > > > > > >   REGSET_TLS, > > > > > > + REGSET_CET64 = REGSET_TLS, > > > > > >   REGSET_IOPERM32, > > > > > > + REGSET_CET32, > > > > > >  }; > > > > > Why does REGSET_CET64 alias on REGSET_TLS? > > > > In x86_64_regsets[], there is no [REGSET_TLS].  The core dump code > > > > cannot handle holes in the array. > > > Is there a fundamental (ABI) reason for that? > > What I did was, ran Linux with 'slub_debug', and forced a core dump > > (kill -abrt ), then there was a red zone warning in the dmesg. > > My feeling is there could be issues in the core dump code.  These > Kernel development is not about feelings. I got that :-) > > Either you can track down the root cause or you cannot. There is no place > for feelings and no place in between. And if you cannot track down the root > cause and explain it proper then the resulting patch is just papering over > the symptoms and will come back to hunt you (or others) sooner than later. > > No if, no could, no feelings. Facts is what matters. Really. In kernel/ptrace.c, find_regset(const struct user_regset_view *view, unsigned int type) { const struct user_regset *regset; int n; for (n = 0; n < view->n; ++n) { regset = view->regsets + n; if (regset->core_note_type == type) return regset; } return NULL; } If there is a hole in the regset array, the empty slot's regset->core_note_type is not defined. We can add some comments near those enum's. Yu-cheng