From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu-cheng Yu Subject: Re: [RFC PATCH v2 25/27] x86/cet: Add PTRACE interface for CET Date: Fri, 13 Jul 2018 09:07:59 -0700 Message-ID: <1531498079.8494.16.camel@intel.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org 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 List-Id: linux-api@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