Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp108305imm; Wed, 12 Sep 2018 19:08:21 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbO7hO6+THVEyQFJsD1EuoCvKHYTMfMj0K9bA9L/Cwrq3+PKhgC5PYjGYE5A5adW8PlbWuZ X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr5166555pfa.238.1536804501254; Wed, 12 Sep 2018 19:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536804501; cv=none; d=google.com; s=arc-20160816; b=f6ZnLIe/r4ZCur3XvxiWbU1gUJFybTNaRTnCErZ6hS+n7bl0hSWbHcfrz/++r70X3F /+MNfflSIa4JRiDc7tb5w5AFjfWiFKTHxyja/10+3HwI/BoB7sOhYWl4mk0LV9Xtw4CN +18C4WBjgQGbC7vVet2lkZTvPxkTQLva2xk38ZHO8dHEwgfuJz6Xo/QQxygiUE81krTH 1LnORPWzKhi8GmGJVuVKUWCgivaGxkQ80p/zCGNFGDSG0Mf0NTLCekY8uOh4np85Ltgk k76DUdG4k71ynPgDcr+4znqGgFYk7RYp90eouA1Lci6Pew79Fz0hqfAKolhoNaR0USsP cgzQ== 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=4ZCW0wMHdY6LNwmh/zlDZqPW1bLAL9ZP1wrN9S7HjYo=; b=AV8zDKuglFwlyA4ZvOh2whr9nlDesqMom8HqnFM79X4Cdd0qjvyHmW7F1mbp2AT1St pzQqjMUNoPS9I15INK+Y61dkHS+K5GLNMFXcZoL8m0gppUAP4EqVhM7m/0jCVsnzp5vM dNAAzKxHhtHPJtVKC4VCseCXNrKFMtT2iW0LLRr/6QJNicMx0i8EWW602meelKyHtOfQ A0JXh1Sq8eiP/Ve8IsHu2AC644rXYuHMe5KBV78HNpIhhP3SIRnDCDAV5AIwuu6RHhYT 1lVYWdXchDemS2oYB/B57MzABnW4ONd6DeadCuBc5eGY4crtCq+y2OTWJ23BX3iyOcIT rKxg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d22-v6si2918703pgb.180.2018.09.12.19.08.06; Wed, 12 Sep 2018 19:08:21 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726724AbeIMHPO (ORCPT + 99 others); Thu, 13 Sep 2018 03:15:14 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:42980 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbeIMHPO (ORCPT ); Thu, 13 Sep 2018 03:15:14 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1g0H2z-0005Wy-CZ; Thu, 13 Sep 2018 02:07:57 +0000 Date: Thu, 13 Sep 2018 03:07:57 +0100 From: Al Viro To: Arnd Bergmann Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 01/17] compat_ioctl: add generic_compat_ioctl_ptrarg() Message-ID: <20180913020757.GP19965@ZenIV.linux.org.uk> References: <20180912150142.157913-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180912150142.157913-1-arnd@arndb.de> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 12, 2018 at 05:01:02PM +0200, Arnd Bergmann wrote: > Many drivers have ioctl() handlers that are completely compatible > between 32-bit and 64-bit architectures, except for the argument > that is passed down from user space and may have to be passed > through compat_ptr() in order to become a valid 64-bit pointer. > > Using ".compat_ptr=generic_compat_ioctl_ptrarg" in file operations > should let us simplify a lot of those drivers to avoid #ifdef > checks, and convert additional drivers that don't have proper > compat handling yet. Just keep in mind that this should *only* be used when all ioctls implemented in a given instance do take pointers. Because otherwise you are asking for trouble - e.g. if one of them takes an u32 used as a bitmap, this will run into trouble as soon as somebody uses bit 31. With no visible warnings. IOW, it shouldn't be used blindly and it should come with big fat warning.