From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933193AbcINVfm (ORCPT ); Wed, 14 Sep 2016 17:35:42 -0400 Received: from mail-yb0-f193.google.com ([209.85.213.193]:33002 "EHLO mail-yb0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753427AbcINVfk (ORCPT ); Wed, 14 Sep 2016 17:35:40 -0400 MIME-Version: 1.0 In-Reply-To: <57D9C139.1000601@linux.intel.com> References: <1473886902-17902-1-git-send-email-khuey@kylehuey.com> <1473886902-17902-2-git-send-email-khuey@kylehuey.com> <57D9C139.1000601@linux.intel.com> From: Kyle Huey Date: Wed, 14 Sep 2016 14:35:38 -0700 Message-ID: Subject: Re: [PATCH v2 1/3] syscalls,x86 Expose arch_prctl on x86-32. To: Dave Hansen Cc: "Robert O'Callahan" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Al Viro , Anna Schumaker , David Howells , "Dmitry V. Levin" , Eric B Munson , Andy Lutomirski , Peter Zijlstra , "Michael S. Tsirkin" , Jiri Slaby , Andrey Ryabinin , Paul Gortmaker , Borislav Petkov , Dmitry Vyukov , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 14, 2016 at 2:29 PM, Dave Hansen wrote: > On 09/14/2016 02:01 PM, Kyle Huey wrote: >> Signed-off-by: Kyle Huey >> --- >> arch/x86/entry/syscalls/syscall_32.tbl | 1 + >> arch/x86/kernel/process.c | 80 ++++++++++++++++++++++++++++++++++ >> arch/x86/kernel/process_64.c | 66 ---------------------------- >> 3 files changed, 81 insertions(+), 66 deletions(-) > > Could you explain a bit about what is going on here? Is it just a plain > old code move, _why_ you had to do it this way, etc...? Sure. In the subsequent patches in this series I add an arch_prctl that is available for both 64 and 32 bit programs/kernels. Since process_64.c is only built for 64 bit kernels, this syscall can't stay there anymore. It's not quite a plain move. To leave the existing arch_prctls only accessible to 64 bit callers, I added the is_32 bit and the four early returns for each existing ARCH_BLAH. These cases are now conditionally compiled out in a 32 bit kernel, so we only have to handle the 32 bit process on a 64 bit kernel case at runtime. I considered doing this instead with a compat wrapper for the syscall on 32 bit systems that would filter these arch_prctls before getting to do_arch_prctl. I didn't see any prior art for it, so decided not to proceed that way. - Kyle