From patchwork Fri Jul 7 15:59:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Torvalds X-Patchwork-Id: 9830677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 09732602BD for ; Fri, 7 Jul 2017 15:59:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECC9226B41 for ; Fri, 7 Jul 2017 15:59:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0BCE2844B; Fri, 7 Jul 2017 15:59:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44CBA26B41 for ; Fri, 7 Jul 2017 15:59:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752047AbdGGP7r (ORCPT ); Fri, 7 Jul 2017 11:59:47 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:35960 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752044AbdGGP7q (ORCPT ); Fri, 7 Jul 2017 11:59:46 -0400 Received: by mail-oi0-f65.google.com with SMTP id n2so4373936oig.3; Fri, 07 Jul 2017 08:59:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qwmZJg70FPA8XAh0GWuosAJS7BTBBoq6yNyDak1poCg=; b=H/BYqi0yER2GBwiIw/rvGlGyeIIQjxfbP1oPiY5ZncWn1vLZW+SNrJyGH4Kxx9++8O FpWRkPgsMItYM3VPWy8BpD8UkEG/lblqd6VGqJlaaM3gLDOaGpAlbxu6qtV/C6SCToFM cbTSFiazyrh0eQfUw53ohRX+QomHTLA26J9dlWCjNXdNqEPxOJ5M4WNgBC6HGMxw6lnW AITloBbGC3j5KBdtADVAcLNcDsuKKaV7RLm4mOyi9paOVK57BgHztny/dNIrU4YeQeoU O+HHSUbiy5AR7uPgXSfMRj1YPzjA1skIy81CR5CpIeQFzn0MH/89JvqO5H9zNDno3wjS Xrqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=qwmZJg70FPA8XAh0GWuosAJS7BTBBoq6yNyDak1poCg=; b=M26WhGQivhOtastcSNCxfkM7fNzDSj2LdHSqonvn+WsmHCTDjlNS3UxU0hoQY3GDKs xyiwENTqrjnfO+kXX4Uuc8t+DRtlej83/LiGFB1gacbXthkzoKIjVqluPnJt/j1nZhiv aw5rqZIA8KPTGHpIzeciWgSOlLbxLYJ/f7ulvGlxKKTaPwIIt8GoHxrsVC752sp0MtHr fru8+WuI0mPY1Nv8Oykbn6svXObM/SNX+TLRM6jfpRCWefQarZne3CsGXxxJxXe3e3q8 r0ohTDfxPA8Vn24S+u32vFk/T1JbCH7E5knbktJOQTuPK/wTjFNnnvLgWjGJuco6/UFa g2jg== X-Gm-Message-State: AIVw1113s7G1S/CPiG8P6L+ZTaql13msZhItz9MsvHjr4D1Zoomj0Dhf Kdv7hvdZs0E8Bym4iloWvfVTa1p2NpuUOh8= X-Received: by 10.202.241.10 with SMTP id p10mr1246427oih.56.1499443180864; Fri, 07 Jul 2017 08:59:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.162.10 with HTTP; Fri, 7 Jul 2017 08:59:40 -0700 (PDT) In-Reply-To: <87eftsv2hj.fsf@concordia.ellerman.id.au> References: <20170705071423.GY10672@ZenIV.linux.org.uk> <87eftsv2hj.fsf@concordia.ellerman.id.au> From: Linus Torvalds Date: Fri, 7 Jul 2017 08:59:40 -0700 X-Google-Sender-Auth: 8x9sOakOv6uylt7fgEX8gpGD6fo Message-ID: Subject: Re: [git pull] vfs.git part 1 To: Michael Ellerman Cc: Al Viro , Linux Kernel Mailing List , linux-fsdevel , "linuxppc-dev@lists.ozlabs.org" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jul 7, 2017 at 5:46 AM, Michael Ellerman wrote: > Al Viro writes: > >> >> Switch flock copyin/copyout primitives to copy_{from,to}_user() (2017-06-26 23:52:44 -0400) > > This commit seems to have broken networking on a bunch of my PPC > machines (64-bit kernel, 32-bit userspace). Bah. I think that commit is entirely broken, due to having the arguments to the "copy_flock_fields()" in the wrong order. The copy_flock_fields() macro has the arguments in order , but all the users seem to do it the other way around. I think it would have been more obvious if the put_compat_flock*() source argument had been "const". > Patch coming. I'm not seeing a patch, so I did my own. But it's _entirely_ untested. Does the attached fix things for you? Linus fs/fcntl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/fcntl.c b/fs/fcntl.c index b6bd89628025..eeb19e22fd08 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -527,43 +527,43 @@ SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd, (to).l_len = (from).l_len; \ (to).l_pid = (from).l_pid; -static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl) +static int get_compat_flock(struct flock *kfl, const struct compat_flock __user *ufl) { struct compat_flock fl; if (copy_from_user(&fl, ufl, sizeof(struct compat_flock))) return -EFAULT; - copy_flock_fields(*kfl, fl); + copy_flock_fields(fl, *kfl); return 0; } -static int get_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl) +static int get_compat_flock64(struct flock *kfl, const struct compat_flock64 __user *ufl) { struct compat_flock64 fl; if (copy_from_user(&fl, ufl, sizeof(struct compat_flock64))) return -EFAULT; - copy_flock_fields(*kfl, fl); + copy_flock_fields(fl, *kfl); return 0; } -static int put_compat_flock(struct flock *kfl, struct compat_flock __user *ufl) +static int put_compat_flock(const struct flock *kfl, struct compat_flock __user *ufl) { struct compat_flock fl; memset(&fl, 0, sizeof(struct compat_flock)); - copy_flock_fields(fl, *kfl); + copy_flock_fields(*kfl, fl); if (copy_to_user(ufl, &fl, sizeof(struct compat_flock))) return -EFAULT; return 0; } -static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl) +static int put_compat_flock64(const struct flock *kfl, struct compat_flock64 __user *ufl) { struct compat_flock64 fl; memset(&fl, 0, sizeof(struct compat_flock64)); - copy_flock_fields(fl, *kfl); + copy_flock_fields(*kfl, fl); if (copy_to_user(ufl, &fl, sizeof(struct compat_flock64))) return -EFAULT; return 0;