Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30173631rwd; Thu, 6 Jul 2023 01:52:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlHc9M60x1nbipDobEOuV5YY//DLw6oMLoB7XyyrYlxRcxrTnfSae5smRiYqxDEvnCy/HI7M X-Received: by 2002:a05:6358:e49f:b0:128:b20b:925a with SMTP id by31-20020a056358e49f00b00128b20b925amr1814358rwb.9.1688633540465; Thu, 06 Jul 2023 01:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688633540; cv=none; d=google.com; s=arc-20160816; b=roCZh/0+BqZHdXRZUrtxO+lPNyAIirwCI5Vud6NmAGItQkEImpSexaNjZxXtVuyftg 7MAMb9/EeZaz1fA3lkiSPQA0hsI2EHbm9O6jpfboYB3fykn358aK6VlwS1QpATDxmhVd m0/8+iuERbYxnLtG1izlOnglwyssRnZGfdcy61lKEzLhZjFyrca7+/sGbfoDPFm6cM+F zq5eEGHOEK+Gez1aAsfbaJ0ypA5Q4D6/K6D0FESe573Y+Q3fTZiRIX7VksKWPWojBaE9 TL33f7lio5Vve8TBYkA28JB/T2Z1xG2dVkq6o8YW9fvCQP5aDjNLLzQkC+kHHMC11w/Q KMdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gve1725JbH+OCL2j9Qf/pjOFZqhTvb9cfg9ojt7eM0g=; fh=vyWyxp6cJhZKwOEBhtz3ff4gRn6zFdWqxX572sAeFTM=; b=XIcN8rNSDduv40+Ss0QxeoSMWYNR9HxyF8RN8L3sklz/148pROPoFs5vPzr6lRPpSn 08BLMN9dQKKZQHgeELvE5/E5lRs1EgUs/lu7mXv6O7YIYkpex0g+WXImo3guGgAESYdD IXW8XFa/yyX80wpf8RBF++jWX+ypy7LvLbzyb/eqSpWI1F35dRFEA4IAAN3kGqmOITLu vACEl6kt77CY/sj7fKhps7VayLRQhwf5WbEUs4xtUe4H0Gjf1r5bEODUrZJjhDoC7tdD KKzdD8b/6uHmeGnLYZkK2foHx2i9E/FcgIJc1GXlGtCT/GIORPTgsZh8SoCWFodgOMEp 63aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V0rkyP83; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t25-20020a632259000000b0055ae24a7f9esi1008343pgm.786.2023.07.06.01.52.07; Thu, 06 Jul 2023 01:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V0rkyP83; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231269AbjGFIaV (ORCPT + 99 others); Thu, 6 Jul 2023 04:30:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231315AbjGFIaT (ORCPT ); Thu, 6 Jul 2023 04:30:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06BD91BC2; Thu, 6 Jul 2023 01:30:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9558C618C7; Thu, 6 Jul 2023 08:30:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 432EFC433C8; Thu, 6 Jul 2023 08:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688632216; bh=WHBpAo0uBocGZWMTcYEiDtdYOSVrcOFnyDnjE2bMwqc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V0rkyP831wal4VV/DWPMEigKMDYuZrCYZCe5ub55EnkQ44OZDoyXx3rhl5E4yEUEm 8mGPprr69u74dsxCcFhQUizflSw7z/vzT8BZ81bVbsw2+aQpjr4BngigvvJqT4JwIo AdczluF5r7asS7onOTQbuLx12bcWj65xZdicl5VW3dXHqa6NvtDKl9B/ZwM7aJkbhg 29xGTThQ1QuQPOdQmkIgAOcxs5wmI7XaFFi2Soz86sLTpYUatwWjTY1xqEsn8BoaJ6 Im8HLdR04g6xj1PicLOt+5p18vYCDutsJOrIOmyW5BU7NcYQ3hzxK32lotrNHcdX6x aha53qRM8Ls/A== Date: Thu, 6 Jul 2023 10:30:10 +0200 From: Christian Brauner To: Luca Vizzarro Cc: linux-kernel@vger.kernel.org, Alexander Viro , Jeff Layton , Chuck Lever , Kevin Brodsky , Vincenzo Frascino , Szabolcs Nagy , Theodore Ts'o , David Laight , Mark Rutland , linux-fsdevel@vger.kernel.org, linux-morello@op-lists.linaro.org Subject: Re: [PATCH v2 0/5] Alter fcntl to handle int arguments correctly Message-ID: <20230706-truthahn-knecht-c0902bf61ae5@brauner> References: <20230414152459.816046-1-Luca.Vizzarro@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230414152459.816046-1-Luca.Vizzarro@arm.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 14, 2023 at 04:24:54PM +0100, Luca Vizzarro wrote: > According to the documentation of fcntl, some commands take an int as > argument. In practice not all of them enforce this behaviour, as they > instead accept a more permissive long and in most cases not even a > range check is performed. > > An issue could possibly arise from a combination of the handling of the > varargs in user space and the ABI rules of the target, which may result > in the top bits of an int argument being non-zero. > > This issue was originally raised and detailed in the following thread: > https://lore.kernel.org/linux-api/Y1%2FDS6uoWP7OSkmd@arm.com/ > And was discovered during the porting of Linux to Morello [1]. > > This series modifies the interested commands so that they explicitly > take an int argument. It also propagates this change down to helper and > related functions as necessary. > > This series is also available on my fork at: > https://git.morello-project.org/Sevenarth/linux/-/commits/fcntl-int-handling-v2 > > Best regards, > Luca Vizzarro > > [1] https://git.morello-project.org/morello/kernel/linux > > Luca Vizzarro (5): > fcntl: Cast commands with int args explicitly > fs: Pass argument to fcntl_setlease as int > pipe: Pass argument of pipe_fcntl as int > memfd: Pass argument of memfd_fcntl as int > dnotify: Pass argument of fcntl_dirnotify as int Applied, minus the already upstreamed memfd patch.