Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1998640yba; Thu, 25 Apr 2019 09:02:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQ9PLZLvS2CnwslmU/jnWEqM299cqPfaf+d/VgAyNz/Qnyok8IWSD065W0d+Dk6dZ61MXX X-Received: by 2002:a63:550d:: with SMTP id j13mr38342549pgb.18.1556208151973; Thu, 25 Apr 2019 09:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556208151; cv=none; d=google.com; s=arc-20160816; b=dowuOzhS2gRO846RdSRhFZ50Q+uE0YU0xg8q8QEnbapmC7BzUNFz7xnLrAN4EkxTTZ QnBubCnWBNX4xqJMXwBodbV4P78eiiEgppv0z6kwDCWQ/QfpzJxrrTez3tANXCf93UlF xYji5dxmrryv0HFfu5ifC8Toj/HRbUYeDiDPJ3ci1BOTCsFWJNyrgkGbGp4U83BUjBH9 RE+Ma8vO6p5rL5dMxaxb/+MZp3+rYin8opkdSRbs0LEQgDtZn/SWE0f9bYjM0D2nRF4G yRY8vWOnES6mr64wrbyFZ7DyNwAqu6Au+PasP0jFLbCL5ZGYZgbi3FJhSZ1v54X+wGWe DG6Q== 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; bh=zkwopJCM5aWIxk1QBblXCx0FKSBr5++vETUbB1hTeEs=; b=PJLUsJZsv9u0HC/nAacRJ449boTIfGyv8vQdbJCmmTZ1l2hJGyt3bz0oiVwoB91fsX Snxwr/66ut2xS5YAV2loH2C4dbYO6VVFY9+w8XlWnhh4cdu6L2f6bs+oWdbMPwr9BXu+ 3551Z/6ECg4eb1BV1l9mJgT+qIOlaxgfMUAu0pD6+fj/UZgPV5ywg6iQiCe5VpNVetb6 cwGpU5OWgdxOTsNri93kWXAgq3e8FXbzffHdaDIubjYtJrSp+2GRjQm+LCu60f08CQZq wLtSt5m69zjiYxA9RAzNPZGSzvtyDo3wWrdFokwvTu15Dk4Ac2BMQ6rD53rm9aRCxp8G 4P3A== 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 j16si21794924pgl.335.2019.04.25.09.02.16; Thu, 25 Apr 2019 09:02:31 -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 S1729329AbfDYPzo (ORCPT + 99 others); Thu, 25 Apr 2019 11:55:44 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:43713 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbfDYPzn (ORCPT ); Thu, 25 Apr 2019 11:55:43 -0400 Received: by mail-qt1-f195.google.com with SMTP id g4so604936qtq.10; Thu, 25 Apr 2019 08:55:41 -0700 (PDT) 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=zkwopJCM5aWIxk1QBblXCx0FKSBr5++vETUbB1hTeEs=; b=NlFeIDqca1cphh1upv/cDvlCmoF3HGt9HAeTxX4mddA/iM+S/tVwkvKF/kGj0UjUS6 NrEz4HIfUbW0toeWqqgP6WykwBwrZXLqbB6Gf6WXQRQex61VKLGV4z7FqIf5z6epxlDA Zv6YT0xVBX4JXNVzfiLQkRVgx7ZxCgZCcx6YGw7ZiQNKvWVoE2MZjdk29nY9hWl10OxW yAE81CZ2r95sOz6SCvFgjobX+lYYBFMn6RP5xtON6VBegCcJl0BWI//Epf0VQR/m3M1i fO+vLQD6vYsIVNmtqkDsRUoT1LVLB77F/7RpXaY1QsscJYaj8m55g74xVtdoLQi4J+CB +Qlg== X-Gm-Message-State: APjAAAUUJhjzP/nzNWGRi13/QF447CE8eBjeq7u2Iw7AolrPIWsq/zVY yehVaa+rTyWhqJhrPiIN5UwhzSnp3AGTpY3tt3w= X-Received: by 2002:a0c:d2fa:: with SMTP id x55mr32105048qvh.161.1556207741117; Thu, 25 Apr 2019 08:55:41 -0700 (PDT) MIME-Version: 1.0 References: <20190416202013.4034148-1-arnd@arndb.de> <20190416202701.127745-1-arnd@arndb.de> <20190425122153.450fc094@coco.lan> <20190425153534.GS2217@ZenIV.linux.org.uk> In-Reply-To: <20190425153534.GS2217@ZenIV.linux.org.uk> From: Arnd Bergmann Date: Thu, 25 Apr 2019 17:55:23 +0200 Message-ID: Subject: Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl To: 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 Content-Type: text/plain; charset="UTF-8" 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 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. Arnd