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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 43FFFC2BA1A for ; Fri, 21 Jun 2024 07:48:14 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=VfFN+Huq; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4W58bv5LcRz3cZ5 for ; Fri, 21 Jun 2024 17:48:11 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=VfFN+Huq; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=brauner@kernel.org; receiver=lists.ozlabs.org) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4W58b805Nzz3cGb for ; Fri, 21 Jun 2024 17:47:31 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E1CF662345; Fri, 21 Jun 2024 07:47:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ED54C2BBFC; Fri, 21 Jun 2024 07:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718956049; bh=+n1uE1MrLQMFhNN+7jwAvQajIquhPpIK6hC9WogIb1Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VfFN+HuqInMOioum3nOUUAxrTdtVdjbZPYztVw5rmIyxcrJKkfr//GPMMvssZ97mF bc16USxoEeLnXgt2+ZWBhKfJaZxF6h94UXw/6wVZmRCosK7MzmOV/zy0hFkL9oAOTY pLA96PVGw92edy7QBoumKi8/eHn/jpPrkZVF8iciR02xYit0fMKT5AKfFI28z2S/Xo 7cTGqzDyXh0801wUzYZXCV5iG5ibGw7x8NUtpfJaovfGEj4d4xgd71H8ZAoG1ltp5R DaYwRoRG9BedSojyfpOn0Rc1oP+3UrPp/XDKQIT4MVW7tJ4oBBcq8vXMRLFcoNlAPv I1hJb8yogM0Jw== Date: Fri, 21 Jun 2024 09:47:19 +0200 From: Christian Brauner To: Arnd Bergmann Subject: Re: [PATCH 01/15] ftruncate: pass a signed offset Message-ID: <20240621-jeden-hinab-e265b0d0807a@brauner> References: <20240620162316.3674955-1-arnd@kernel.org> <20240620162316.3674955-2-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240620162316.3674955-2-arnd@kernel.org> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , Andreas Larsson , linux-mips@vger.kernel.org, Guo Ren , Christophe Leroy , "H. Peter Anvin" , sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Helge Deller , linux-sh@vger.kernel.org, linux-csky@vger.kernel.org, "Naveen N . Rao" , Arnd Bergmann , Heiko Carstens , musl@lists.openwall.com, Nicholas Piggin , Alexander Viro , John Paul Adrian Glaubitz , ltp@lists.linux.it, Brian Cain , Thomas Bogendoerfer , libc-alpha@sourceware.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Jun 20, 2024 at 06:23:02PM GMT, Arnd Bergmann wrote: > From: Arnd Bergmann > > The old ftruncate() syscall, using the 32-bit off_t misses a sign > extension when called in compat mode on 64-bit architectures. As a > result, passing a negative length accidentally succeeds in truncating > to file size between 2GiB and 4GiB. > > Changing the type of the compat syscall to the signed compat_off_t > changes the behavior so it instead returns -EINVAL. > > The native entry point, the truncate() syscall and the corresponding > loff_t based variants are all correct already and do not suffer > from this mistake. > > Fixes: 3f6d078d4acc ("fix compat truncate/ftruncate") > Cc: stable@vger.kernel.org > Signed-off-by: Arnd Bergmann > --- Looks good to me, Reviewed-by: Christian Brauner