Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1006415ybf; Fri, 28 Feb 2020 11:57:52 -0800 (PST) X-Google-Smtp-Source: APXvYqzkeRBfbhvGKnSuML7ee52T2SW7nZPA3zVxsO3y70zd7RcJOeI65WmwV/A4pzJvycNV48Ag X-Received: by 2002:a05:6808:7dd:: with SMTP id f29mr4418309oij.67.1582919872089; Fri, 28 Feb 2020 11:57:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582919872; cv=none; d=google.com; s=arc-20160816; b=Oyth9OrCSfOj97nr2PBpp11YQM6jpiZg2gE/W9zSgcxeU0GijyKbU8aZjc5BWJ1Ejy LSFIXTdStiytLYAQDFdKgyj9FmbZJBw9ufk73PgZuMOAnYP6f10NtT4r5BlLnalKeFg+ y/PbcLsKNq6WYQLZYkqfk+8ICjK8p9IuNyn080Sj/XHGeprTHD6neNWfIO/YR84VM2b3 nbL/BCGVqjJKj7Hp8Hwy9DJI9Ch/TKozfoYT45VGGh56QpYW0AhU0696Omzgo6UTwlyQ yTH0nx6dwlHmDBmBdP4WqOS7Q/8Nsj98cktIiq95BuLdXepA78i/V0WamNd6LlJBC+WG bBLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=JgCIie4drkANtWai9mcgLOk3bexsmo1iuE+8Ui86s3g=; b=Kx2dYos0ruAN1zGfQJQAmjgIhP35otwp9BqqepPDvv4OyWygtxUwi3c4OCIoB2JIHm sM5ii0K9dZPOvtSdU2DjEFDJuJjJ9y0d+jWy/jRgBkpHr5vQTFWwwzS60wY9C20PkBfX Usp00eX8GQVUHDfi75ZC88LMuCx8yFiYP4BlntopVb68AAIwfGMlXrxhuModLWSbx4Wd 66zA7MsiXaW2AwkaAcsSxPtayV+0Uayv9boiyG6DwmiB/07nlyfXcpvy/68BD1DfC2bh L3HPdoGKfrfEJDlQe9pZ7QTYQlNfHoBBJb0BBEZ4rkPpSuddxe9pDLJM/o6lLX+cCRcG 3oOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AMqw5Svf; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si2500399oif.14.2020.02.28.11.57.40; Fri, 28 Feb 2020 11:57:52 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AMqw5Svf; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726880AbgB1T4a (ORCPT + 99 others); Fri, 28 Feb 2020 14:56:30 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:45286 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbgB1T4a (ORCPT ); Fri, 28 Feb 2020 14:56:30 -0500 Received: by mail-io1-f68.google.com with SMTP id w9so4728924iob.12 for ; Fri, 28 Feb 2020 11:56:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JgCIie4drkANtWai9mcgLOk3bexsmo1iuE+8Ui86s3g=; b=AMqw5SvfNAW3vkAcLHa2yE9iK6Xsx9B5zvr6fjdAllvxtNz0HyX1vbD/D7fZk0n/Dc R2/RxWXko3mnxIPuz/rRjVoQ6Jm9ZoArQxAFiNvQuV5pRKZUEswHQz6NJGCJ4I35AZBs TPhGT9DqQ790AsRPLXHbzuAqNR4t59ffYPbWeQDNiFEtMd7lt/gYtcoi7OVgyQyuDzqY jHFvtvvrqLRyZH+HQScPk4SgyQmsrpEsVhX3aD3cCKnhobGWxTKEGNqcdU0UwoUn8IFh UeC3fbXga7Ref+zKSY/HjFUlPk9q4oP+hpV+SAzhpTIOlaZCwfyCwr6pDEjVndo98noY qMPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JgCIie4drkANtWai9mcgLOk3bexsmo1iuE+8Ui86s3g=; b=b7L+gd9pn68QpnoaH9EI/BdoOVDUYgZqfzUD1lH8VKoiDl/Af4Ofeb3JTA3TAK0Yy1 kfNCGW+FexIp9yxnJ2u4dHn+oDMgEVlfMbhKNwdy0TMvzKnrt/JcwcV0xQ3DlGpgLBI+ E1WNS+66JoxpgCR96hvkxdNv40FZoWj4EINYu4c36VHRRCffnmOoFfhSgCU1A0QAqRmm cog86BSULkom7mUGj4CUwroCmN1lYz74DSGfR+RVVvUNnvA4dPFuu1o5hijan169+X4I TKuGcSyez6SQVOnhnCvs/EKh4F4BiobNBPPLWhGYH+CQe+Y6dop7Jp2EEuMdFOAGjkZ7 w3Lg== X-Gm-Message-State: APjAAAVmsI4W0y5YHhn8mACzXz1YgQd53goZ19D++d5UaChiNuUXjQaR sUtmKPY43rxLDE7IAimM/jfSd8TEk2tol3bbRx8x0+4= X-Received: by 2002:a02:7fd0:: with SMTP id r199mr4806587jac.126.1582919788059; Fri, 28 Feb 2020 11:56:28 -0800 (PST) MIME-Version: 1.0 References: <20200227132826.195669-1-brgerst@gmail.com> <20200227132826.195669-6-brgerst@gmail.com> In-Reply-To: From: Brian Gerst Date: Fri, 28 Feb 2020 14:56:17 -0500 Message-ID: Subject: Re: [PATCH v3 5/8] x86: Move 32-bit compat syscalls to common location To: Andy Lutomirski Cc: LKML , X86 ML , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Dominik Brodowski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 28, 2020 at 1:47 PM Andy Lutomirski wrote: > > On Thu, Feb 27, 2020 at 5:28 AM Brian Gerst wrote: > > > > Move the 32-bit wrappers for syscalls that take 64-bit arguments (loff_t) > > to a common location so that native 32-bit can use them in preparation for > > enabling pt_regs-based syscalls. > > Can you clarify the purpose? Even having read the series up to this > point, I have no idea what this has to do with pt_regs. > > I think some renaming is in order. Consider: > > > > > -COMPAT_SYSCALL_DEFINE3(x86_ftruncate64, unsigned int, fd, > > - unsigned long, offset_low, unsigned long, offset_high) > > It used to be at least a little bit clear what was going on. There's > this compat-only mess that changes arguments for ftruncate64. But > now: > > > +SYSCALL_DEFINE3(x86_ftruncate64, unsigned int, fd, > > + unsigned long, offset_low, unsigned long, offset_high) > > { > > return ksys_ftruncate(fd, ((loff_t) offset_high << 32) | offset_low); > > } > > What is this "x86" ftruncate64 thing? > > Maybe call it ia32_ftructate? Or at least do something to indicate > that this is for a specific ABI. Previously, these syscalls relied on the fact that the 64-bit loff_t was passed in through two consecutive stack slots. This doesn't work when switching to using pt_regs, where we need to reassemble the 64-bit arg from two 32-bit args. These wrapper functions were already in use for the compat versions of these syscalls, because the 64-bit kernel does use pt_regs for the 32-bit compat syscalls. In order to enable pt_regs syscalls for 32-bit native the same wrappers are needed. These wrappers exists for other architectures as well. It would be nice to combine them into a more generic version. > > > diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c > > index 9649b5ad2ca2..d5520e92f89d 100644 > > --- a/arch/x86/um/sys_call_table_32.c > > +++ b/arch/x86/um/sys_call_table_32.c > > @@ -26,6 +26,16 @@ > > > > #define old_mmap sys_old_mmap > > > > +#define sys_x86_pread sys_pread64 > > +#define sys_x86_pwrite sys_pwrite64 > > +#define sys_x86_truncate64 sys_truncate64 > > +#define sys_x86_ftruncate64 sys_ftruncate64 > > +#define sys_x86_readahead sys_readahead > > +#define sys_x86_fadvise64 sys_fadvise64 > > +#define sys_x86_fadvise64_64 sys_fadvise64_64 > > +#define sys_x86_sync_file_range sys_sync_file_range > > +#define sys_x86_fallocate sys_fallocate > > Can this not be killed by changing the table itself instead of adding > a bunch of defines? Ultimately I want to get UML using pt_regs syscalls too, and this would go away along with the hacks in syscalltbl.sh. -- Brian Gerst