Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2376465yba; Thu, 25 Apr 2019 15:35:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyk+pWmKtav1M+cwd9l/HFPkg+AriqiH4h91sCnyz8dDL/Qz/46sRXnYuuN5zQNEaCRtG02 X-Received: by 2002:a63:d908:: with SMTP id r8mr6782483pgg.268.1556231706740; Thu, 25 Apr 2019 15:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556231706; cv=none; d=google.com; s=arc-20160816; b=f1ryEVm44aXGLKVgYku2GgEXoq+zgsEQsRpxRco863psiHcd1ovmBc7/do/8gvq8U5 22/6klRZhWD9XuqdgybPmy2gte1YY7ICWtAmK0smP/jvH2MRIpNmi22toH2gjSF4xpi8 jPu/8Zl0qwglalhcjhLqHnpyo1t6vFPdrwIP7R1ntJUbRCTpC35ToUKfovOY7ObCTIn1 pBQLMVXjrMU0qPoiG+u4JfpeeYWPRnqdUvKtNaNLVpGXpNuTq5LS7JQ/cAL3kT+vpvyF YoCLhPag938pP85HPMDU/4auwIVZbQDfMl8t4FtxJ6oKLXMUwBFw2ZmvBlt4Vpfj6qu5 gDEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=j9yhmH6mgWEYvlkETTwswgp/iWfr0qb8hP353fCCyew=; b=bNQcrFwxFUhqR0B9uRL36DY6W49cKznvjUulZuNA9qTyyPhiNdWIvEhV/eLzryBSgz K3ARyUGofG+oFkeP36lZhk+GPPpUPHcG4jPGqCxAer5La2X08R2+dg5kyuXzVvkKmlq3 K+8oAlPAQ2Rm/2YRJBr0ZGKE4G/PY9EcvGrQ6LNJzhQx3vTP3z2F0Y/YFlfFujuMYHF2 wL3pqIQ6R7rzxXsDk2WhKYKMieeZJ11e4RD4pNXwY2JjXE19iJAbe058pksktMpATtC6 O6p5lMcj69Qplicn+ZnT0lj+93iCZ3qCtE2JEsEUSRwp3Wx5TcGXZ/RpHCTAj0D2AUNe 21Pg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 e15si23934045pfn.31.2019.04.25.15.34.46; Thu, 25 Apr 2019 15:35:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726628AbfDYV1O (ORCPT + 99 others); Thu, 25 Apr 2019 17:27:14 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:40516 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbfDYV1N (ORCPT ); Thu, 25 Apr 2019 17:27:13 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hJlsJ-0000g8-4C; Thu, 25 Apr 2019 23:25:47 +0200 Message-ID: <5511420228cb38d08a67c0f6a614b7671d7d23d4.camel@sipsolutions.net> Subject: Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl From: Johannes Berg To: Arnd Bergmann , Al Viro 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 Date: Thu, 25 Apr 2019 23:25:43 +0200 In-Reply-To: (sfid-20190425_175600_668610_93FA972E) References: <20190416202013.4034148-1-arnd@arndb.de> <20190416202701.127745-1-arnd@arndb.de> <20190425122153.450fc094@coco.lan> <20190425153534.GS2217@ZenIV.linux.org.uk> (sfid-20190425_175600_668610_93FA972E) Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-2.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, 2019-04-25 at 17:55 +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 Actually, you can't even do that because the struct might sit at the end of a page and then you'd erroneously fault in this case. We had this a while ago with struct ifreq, see commit 98406133dd and its parents. johannes