Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2322949rwi; Tue, 1 Nov 2022 06:32:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sL1Lm2ImyJAxgWfGlZlfb9SyUFLFY36T0bGn/Pt1t/C8QMWJHEylTfBH8OYpaEyP+N3V1 X-Received: by 2002:a17:907:2d29:b0:7ad:b388:df3c with SMTP id gs41-20020a1709072d2900b007adb388df3cmr16616130ejc.45.1667309537836; Tue, 01 Nov 2022 06:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667309537; cv=none; d=google.com; s=arc-20160816; b=FwnUu/04sWN2dEuxFZhfibFEsGigJmx5odd+vwdhqT6Oh8tCePGvoSmXBEgPB/rTQ9 759syfrA9TgZ6QjkTWfcoBcIDGu95B6Rui4GBgHuzVcj1L8ux5ji7C2z3Wao1raLXXSX Ifki47//UcJXr1htUQLHgBM1J5TEYZM6iw2BphM5ta5dM4tkjr5R26jxlqWuj5UmNvE4 gyytfmio6R1joLv7syk2W+CijJWetJRYr9hw0kEkHQfDLd7PxUuldNt+Zn4wXQuX8NGl qM0yNh9MlfozGe2M1i8Cd68rTIUzxy9087v/QtPP2hyxwZ37iRYqfIvfpJqca041t4CE mYng== 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; bh=cizA11UUjEyop+/ibVH5gyfXm3MiCe20NsRqbVrgImA=; b=Fx6yZHtBwSnfZXxgIyKStpKVAFxQjQ+QEs3M+vMKRI+2w79dsnfX1UEyDdyJM24RIj kkh+1a76juhP2uUTEmHytBdi4D6MW+Wpa4oXt0R73J3ZDRwXlf0sSSwZ6a/r8HutCoLb Woa2VB/HZgJ8aGfx+/9hPCsxL7CtwsF0+G8wPF4iGvjIV1xbIeqy/tO7vjJordDX10Q9 BsHlob+H3OZVPI9z0/8HZVKSBMkORLILj8oVRX7/0bEG0N8r8m9/roFtEEfAPY6S7zxC AcpuT/yFH/KMGcB3LlAk/J/KAFWm0rijXcml8Dafpo4cZcKVqGIyLxZawlF18TpEJVWh d0RQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs37-20020a1709073ea500b007882926848bsi12663582ejc.818.2022.11.01.06.31.52; Tue, 01 Nov 2022 06:32:17 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230072AbiKANMq (ORCPT + 97 others); Tue, 1 Nov 2022 09:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbiKANMo (ORCPT ); Tue, 1 Nov 2022 09:12:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 30C2E1A83A; Tue, 1 Nov 2022 06:12:43 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3FA4B1FB; Tue, 1 Nov 2022 06:12:49 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.3.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D6A693F703; Tue, 1 Nov 2022 06:12:41 -0700 (PDT) Date: Tue, 1 Nov 2022 13:12:39 +0000 From: Mark Rutland To: David Laight Cc: 'Szabolcs Nagy' , Theodore Ts'o , "linux-api@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: linux interprets an fcntl int arg as long Message-ID: References: <0030a20a94cd49628c5461d044bb28ed@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0030a20a94cd49628c5461d044bb28ed@AcuMS.aculab.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 Tue, Nov 01, 2022 at 12:19:51PM +0000, David Laight wrote: > From: 'Szabolcs Nagy' > > Sent: 01 November 2022 11:45 > > > > The 11/01/2022 10:02, David Laight wrote: > > > From: Szabolcs Nagy > > kernel code: > > ------------ > > SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) > > { > > That is just a wrapper and calls do_fcntl(). > which needs changing to be add: > arg &= ~0U; > before the switch(cmd) { Just to check, do you mean the switch in do_fcntl(), or the switch within memfd_fcntl() ? The former handles other APIs which do expect arg to be a long (e.g. F_SET_RW_HINT and F_GET_RW_HINT expect it to hold a full 64-bit pointer), so that'd break things. The latter would work (as would casting arg to int when calling memfd_add_seals()). Mark.