From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4681FA3743 for ; Tue, 1 Nov 2022 13:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6OdApzIzpQaOiRMwP+x23mNEzA6bLbFhn2rVgmppVyA=; b=Fk3+Tqzew+earA 8za+m8INbNG7rHcpKMcWgsWIW7gbFkmZLOcY5+yK9+h51CdwlulWQeV1Dft9+XR3WCuVIZurSLtvP YfE37ML/a/3SbuP1lD3m5xjFyG1ltxK2hZLfmNb/P9TEVeZ/9y2KIz6AyC6jrRLznFJ2XQSA5dJst gEJZpVHLvUrIvX+PZAVtCWfeuy+JHNTfUfvDkZeEPDkEgl6gW80u1FFjMK2bTO1/1QZ9sZmlnGgTs frxjRo76F8zltp4Goopr7W9VyeD8mzIt6CffcM9pagvTixM7T7weB9B5sfhwVaHrYHofc96IEyII/ mWZQTO++nSw2oo4o4zMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opr4Q-005F9L-OQ; Tue, 01 Nov 2022 13:12:46 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opr4N-005F8l-RE for linux-arm-kernel@lists.infradead.org; Tue, 01 Nov 2022 13:12:45 +0000 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-Disposition: inline In-Reply-To: <0030a20a94cd49628c5461d044bb28ed@AcuMS.aculab.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221101_061243_940345_8AB64D1C X-CRM114-Status: GOOD ( 11.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel