Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2045608yba; Thu, 25 Apr 2019 09:44:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIjR4wC5qZbXqzznicPOSK/EdDVkMw8yW+nqRSihU8lFV5NYx4DGpvj/VFidewBSqemqei X-Received: by 2002:a17:902:29e9:: with SMTP id h96mr21614400plb.258.1556210683151; Thu, 25 Apr 2019 09:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556210683; cv=none; d=google.com; s=arc-20160816; b=lwmq8gyHcaybdFzox2QriM84Sl14HW4ZBQ5KfrU8mtKDHTw7LFPtzQawUOl9VyBBhP //WwJnkZz+xS/V3l87s7tb9lPQjy7CCwWZOXzL1eRdnJqK7GJPqVOBYTL6wxJZKXOz/3 6lPSFRbs4u5KDrPZuxPHwjvkKduQdp1w+oYWhCsuujs/itRVuK9v/ufFx89gd7PL0lMa 77dpM+dVEEsnetU6bOBZCcy0S9/aMEFSxVGZ3KWDq9Q3oyld5innAkSxGsQ6aVqRsn5c bygZCPpggxFxwoIM/tqVBNXO9ObyI+z7OH40BSOybMMC316hXKXmoYyN8MUYzc9bZoYG /Rww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=G0UdUTWJKNk2oUuACHbQvd/uj+P8yJrV1GFvCiNh5ZU=; b=y3C9HGo51HetrAI8feW76XLeN9d8wvaKhU5JaYD0ei7wOAERyCgkoki7nx22G7Y1AM WF9uW009U/362dPbFqA7HfPyN1aU6SggzWdfsD5Y6VZjjLsWb/y2vOQ5xEaV7dKHiQ7l RwSHrLwNI8Ut5cp2j25CSrBajzXXV9IGyTP7npD76XqMb7OM5+A8a0ksUp1bZ50FayKH OhqMkix8ErqOL7SC2dTobIS0peBIyX6j8tXyz3gSV85ga8Pi2cKJJwaZhaIQ4utZKdGj oN0y8+6l8hwJE2r4JJ8hqP7Axq2h30KgUOHyA1B519bEriBd2Dh/QaDGJAoJI5aepFF7 iXUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si7476542pgl.294.2019.04.25.09.44.29; Thu, 25 Apr 2019 09:44:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729701AbfDYQmt (ORCPT + 99 others); Thu, 25 Apr 2019 12:42:49 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:48282 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726116AbfDYQmq (ORCPT ); Thu, 25 Apr 2019 12:42:46 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hJhSF-0003K2-7F; Thu, 25 Apr 2019 16:42:35 +0000 Date: Thu, 25 Apr 2019 17:42:35 +0100 From: Al Viro To: Arnd Bergmann Cc: Mauro Carvalho Chehab , Linux FS-devel Mailing List , y2038 Mailman List , Linux Kernel Mailing List , Jason Gunthorpe , Daniel Vetter , Greg Kroah-Hartman , David Sterba , Darren Hart , Jonathan Cameron , Bjorn Andersson , driverdevel , qat-linux@intel.com, "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Linux Media Mailing List , dri-devel , linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org, "open list:HID CORE LAYER" , linux-iio@vger.kernel.org, linux-rdma , linux-nvdimm@lists.01.org, linux-nvme@lists.infradead.org, linux-pci , Platform Driver , linux-remoteproc@vger.kernel.org, sparclinux , linux-scsi , USB list , linux-btrfs , ceph-devel , linux-wireless , Networking , Sean Young Subject: Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl Message-ID: <20190425164235.GT2217@ZenIV.linux.org.uk> References: <20190416202013.4034148-1-arnd@arndb.de> <20190416202701.127745-1-arnd@arndb.de> <20190425122153.450fc094@coco.lan> <20190425153534.GS2217@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Thu, Apr 25, 2019 at 05:55:23PM +0200, Arnd Bergmann wrote: > On Thu, Apr 25, 2019 at 5:35 PM Al Viro wrote: > > > > On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > > > > > If I understand your patch description well, using compat_ptr_ioctl > > > only works if the driver is not for s390, right? > > > > No; s390 is where "oh, just set ->compat_ioctl same as ->unlocked_ioctl > > and be done with that; compat_ptr() is a no-op anyway" breaks. IOW, > > s390 is the reason for having compat_ptr_ioctl() in the first place; > > that thing works on all biarch architectures, as long as all stuff > > handled by ->ioctl() takes pointer to arch-independent object as > > argument. IOW, > > argument ignored => OK > > any arithmetical type => no go, compat_ptr() would bugger it > > pointer to int => OK > > pointer to string => OK > > pointer to u64 => OK > > pointer to struct {u64 addr; char s[11];} => OK > > To be extra pedantic, the 'struct {u64 addr; char s[11];} ' > case is also broken on x86, because sizeof (obj) is smaller > on i386, even though the location of the members are > the same. i.e. you can copy_from_user() this, but not > copy_to_user(), which overwrites 4 bytes after the end of > the 20-byte user structure. D'oh! FWIW, it might be worth putting into Documentation/ somewhere; basically, what is and what isn't biarch-neutral. Or arch-neutral, for that matter - it's very close. The only real exception, IIRC, is an extra twist on m68k, where int behaves like x86 long long - its alignment is only half its size, so sizeof(struct {char c; int x;}) is 6, not 8 as everywhere else. Irrelevant for biarch, thankfully (until somebody gets insane enough to implement 64bit coldfire, kernel port for it *and* biarch support for m68k binaries on that thing, that is)...