Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4465321pxf; Tue, 16 Mar 2021 14:21:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxV7v1pbW3aryvO3nszMcVDV2vklfNh6qin+RnlIw9xgL8Hu9LofbcZHLcVFIJZSsfUzGe3 X-Received: by 2002:a05:6402:50ce:: with SMTP id h14mr38522032edb.279.1615929694569; Tue, 16 Mar 2021 14:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615929694; cv=none; d=google.com; s=arc-20160816; b=xI+1ibo0HckdFh8wDMzUir+GHFuGC34N9lyPyXyF3TomoF3bXAMAfPVEyxBiYOpB/m j/92twt3GKWgOsb+euanmbzOWf6gQHaQUMdRWDPVm8JBL7lDhjN6ty9JmtCjHZStxEaP lWBDXZS/NF6c48yubIYAPM9oy9qmTw4KMwJ6EYkt/6NSi7ZWmzyXfJou4nluyIOQzkiP KlfNaONFNx97vVJpW1CnX82bmSWH6I9xZrRw9EGUioY/SD/PGKTFD1BSNY7nrVE0cUEE Vz6OMW17YyX/c4GnVuug1GJFcDrVQexe0sFvQAftRSIU9bzBug6gO6/DKsq75kzL3HGo e30Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ijS+9RiYT6SIQOrLbzyPoV+ymaj7LiB8DaD6yY2eAQM=; b=Z1lLdiZkARlpYO6LxWbjr5Tooz8U0nyT1hf5vYdaUNv8MqMPRP8+JObv24lwDsGxjg ZKoOA+NZFvi3lsUarExjRlFmbgP8Nzajd30kHFzlSyKvocaIgZKU+yIuhawo1SQESRCk LGZb5FfySZJ15GvBQqQhnwAiRyIB7XmWp7rtRLR6iD5FaQ64AQ8+asF7fM+jzsgv5vU1 cEFNpPku2GVi3KCXVVf5xm1yAWklaOHVNrQPn1NPF7JVz7U1GGkiQvzWLP4iAiUTiKq4 W6OhrpjS8/ayMHsH6L5yQ27n+8vwdrpb4Z7atUph1f+L6xSRvSvmWRgGmNLwlUEGHOvb Bjdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oQQg9sAJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si15999124edx.282.2021.03.16.14.21.10; Tue, 16 Mar 2021 14:21:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oQQg9sAJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240203AbhCPSx6 (ORCPT + 99 others); Tue, 16 Mar 2021 14:53:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:46434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240200AbhCPSxY (ORCPT ); Tue, 16 Mar 2021 14:53:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9D0856514B; Tue, 16 Mar 2021 18:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615920803; bh=SdgPXfd1GX0HxBpnuqAYxYxIA045/B5izyywjEHSB2I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oQQg9sAJMRzTz/mGOagHrIUD2U+4+dxDyV0stlTFPVZ80RKnA9wo0nRo3Ny1i51RP QDbpQjA+VIC1dshlU4TbV2j79GqWGc7OaQasxwizX844yHrJ2QIUYgZqxouNFTkHTg cR+YtKMvCfcJ1BKxZIGysOuWZfIo6Cna5Mr3NbHMSrXgD4xNDf2V+DdS8WUodh1LuP 4ueef99fiueVcFJzmH4BwV3ASixsQwE43K8HMRO2MWJoZ7RVe7hJgxg2fG0AbNU3ou 3wNAMAGwah7FmqdP8zzDQmB3rtHplYjXCFziVhODWnY4GF8z3XOSkcPLqpwFVoY0GD hFwsiAUOPCsyQ== Received: by mail-oo1-f42.google.com with SMTP id n12-20020a4ad12c0000b02901b63e7bc1b4so4406565oor.5; Tue, 16 Mar 2021 11:53:23 -0700 (PDT) X-Gm-Message-State: AOAM533O3ojaF195i8dK8TPCURqtQXn7wzvAUSl8diSAPF+Kars+e++c jkPbJqJlvZ5DkHtL4jtRYV51Ty9u6uTPWRpKu8M= X-Received: by 2002:a4a:8ed2:: with SMTP id c18mr197825ool.66.1615920802789; Tue, 16 Mar 2021 11:53:22 -0700 (PDT) MIME-Version: 1.0 References: <20210125153057.3623715-1-balsini@android.com> <20210125153057.3623715-3-balsini@android.com> In-Reply-To: <20210125153057.3623715-3-balsini@android.com> From: Arnd Bergmann Date: Tue, 16 Mar 2021 19:53:06 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RESEND V12 2/8] fuse: 32-bit user space ioctl compat for fuse device To: Alessio Balsini Cc: Miklos Szeredi , Akilesh Kailash , Amir Goldstein , Antonio SJ Musumeci , David Anderson , Giuseppe Scrivano , Jann Horn , Jens Axboe , Martijn Coenen , Palmer Dabbelt , Paul Lawrence , Peng Tao , Stefano Duo , Zimuzo Ezeozue , wuyan , fuse-devel@lists.sourceforge.net, Android Kernel Team , Linux FS-devel Mailing List , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2021 at 4:48 PM Alessio Balsini wrote: > > With a 64-bit kernel build the FUSE device cannot handle ioctl requests > coming from 32-bit user space. > This is due to the ioctl command translation that generates different > command identifiers that thus cannot be used for direct comparisons > without proper manipulation. > > Explicitly extract type and number from the ioctl command to enable > 32-bit user space compatibility on 64-bit kernel builds. > > Signed-off-by: Alessio Balsini I saw this commit go into the mainline kernel, and I'm worried that this doesn't do what the description says. Since the argument is a 'uint32_t', it is the same on both 32-bit and 64-bit user space, and the patch won't make any difference for compat mode, as long as that is using the normal uapi headers. If there is any user space that has a different definition of FUSE_DEV_IOC_CLONE, that may now successfully call this ioctl command, but the kernel will now also accept any other command code that has the same type and number, but an arbitrary direction or size argument. I think this should be changed back to specifically allow the command code(s) that are actually used and nothing else. Arnd