From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH v7 07/14] x86/cet/ibt: Add arch_prctl functions for IBT Date: Fri, 7 Jun 2019 10:07:06 +0200 Message-ID: <20190607080706.GS3419@hirez.programming.kicks-ass.net> References: <20190606200926.4029-1-yu-cheng.yu@intel.com> <20190606200926.4029-8-yu-cheng.yu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190606200926.4029-8-yu-cheng.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org 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 , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit List-Id: linux-api@vger.kernel.org On Thu, Jun 06, 2019 at 01:09:19PM -0700, Yu-cheng Yu wrote: > +static int handle_bitmap(unsigned long arg2) > +{ > + unsigned long addr, size; > + > + if (get_user(addr, (unsigned long __user *)arg2) || > + get_user(size, (unsigned long __user *)arg2 + 1)) > + return -EFAULT; > + > + return cet_setup_ibt_bitmap(addr, size); > +} > + /* > + * Allocate legacy bitmap and return address & size to user. > + */ > + case ARCH_X86_CET_SET_LEGACY_BITMAP: > + return handle_bitmap(arg2); AFAICT it does exactly the opposite of that comment; it gets the address and size from userspace and doesn't allocate anything at all. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:60444 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726725AbfFGIHT (ORCPT ); Fri, 7 Jun 2019 04:07:19 -0400 Date: Fri, 7 Jun 2019 10:07:06 +0200 From: Peter Zijlstra Subject: Re: [PATCH v7 07/14] x86/cet/ibt: Add arch_prctl functions for IBT Message-ID: <20190607080706.GS3419@hirez.programming.kicks-ass.net> References: <20190606200926.4029-1-yu-cheng.yu@intel.com> <20190606200926.4029-8-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190606200926.4029-8-yu-cheng.yu@intel.com> Sender: linux-arch-owner@vger.kernel.org List-ID: 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 , Borislav Petkov , 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 , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin Message-ID: <20190607080706.0QfCZH7Ia7a9iYgZVUbwcrUVa-2tgWqMhIwBFSVcZ90@z> On Thu, Jun 06, 2019 at 01:09:19PM -0700, Yu-cheng Yu wrote: > +static int handle_bitmap(unsigned long arg2) > +{ > + unsigned long addr, size; > + > + if (get_user(addr, (unsigned long __user *)arg2) || > + get_user(size, (unsigned long __user *)arg2 + 1)) > + return -EFAULT; > + > + return cet_setup_ibt_bitmap(addr, size); > +} > + /* > + * Allocate legacy bitmap and return address & size to user. > + */ > + case ARCH_X86_CET_SET_LEGACY_BITMAP: > + return handle_bitmap(arg2); AFAICT it does exactly the opposite of that comment; it gets the address and size from userspace and doesn't allocate anything at all.