Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp183813lqo; Tue, 7 May 2024 17:06:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWhBewDx0OsQO/e5BE3rOj+chFLHrHhxR+WbGaEez7+2GRqdOpQ8JM+5YAGTntetO/NmM4G46HNMsr+A+WUaTobVZpo+zKz4lpgFMA76Q== X-Google-Smtp-Source: AGHT+IF0BbZEv9mKswv/w3ZvUqyVuVqf2/xzjCW/78TIuZI5nKpdu63NknkoqKuUH/01paygSiI+ X-Received: by 2002:a05:6e02:1a46:b0:36c:3d57:d68a with SMTP id e9e14a558f8ab-36caed5a61fmr11620115ab.25.1715126762856; Tue, 07 May 2024 17:06:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715126762; cv=pass; d=google.com; s=arc-20160816; b=hB3H3H82BYvzC85d9W9xQtju0NA8n8C/8DSlTZxxnw3JRflUwmATsewk8bdu4qTBWi qrVi5OIUclaUdtTBYpArqdcMoYYrumlJGPzHahckzNM3FDE5lk2iLd7F9eN49VGAn9J2 wyP+2qQ382uLNYnZn8ZV0cVjcOIqi4tmOOm9WBV2oi9iI5NzK7AFBbt0Jzc3N78kORsr 7yAH0YQ5QHrw1FijYnaWZpHSxl3AeT0zZqjvD8IMNdlRiAdNpTYh2VhxQImhUM9fdjkZ m7XhhTAz3PVTNj7UBQo7+t7aDdkKtG1JPwkC+j8FKjzGG2efHNEEr7WNz4yeu53LtZ6+ sPGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=v9zJDO22Cr7JYwbDTf74P1evoyVYgaZ/vZG2O1vDe34=; fh=hfT2gEfPg3lh91W3p4MwShnG32gn5cKZjZg9EibTLAw=; b=J9d0aN1G6XUnhJkN1EzVKVS3o0+5rc/iEkEhdDK88YWkUfoAFreg+8K/RDK6QqVO9C q0auYcV/C5zhVpHz8gR5P8fl9LkgvdeBhbQcmEVYl49N3LufPFq171H1Ip6yChOK3kNV rXj8YkH9bFBqU85lY34gmVTdIhuBE6aNb2DGvbr3gQ6VB9xFb594sBL58bEk8j/bVnTJ 3NKAHRdG9pEZJlrZ1Ue6am3JfrZtWHzC0OmwXCz4+f+QmUWA+OOAtBwXnV9CUM+bwSFv 0dhcPfqDYK1+cYsUq0ewwQ+mq1W1fmHA96TprxJdzFuc6ts1MeLSP215+M7UoGPzsbn0 6eLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z9iwS89O; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172525-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g13-20020a63520d000000b0062d84e130desi1643412pgb.354.2024.05.07.17.06.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 17:06:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172525-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z9iwS89O; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172525-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B9AE1284D1B for ; Wed, 8 May 2024 00:05:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 564EC132464; Tue, 7 May 2024 23:36:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z9iwS89O" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BFF7131BAD; Tue, 7 May 2024 23:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715125006; cv=none; b=olDVxFx4munOwkSZt41Vsjz+oYaHsyXlZVgmmINGbNkFCcQ+SPHBo75h3tTovsy87Imrp6ZpVSiuqrKxRBj31eGjEovOoM2KhybHo+ZUnYrM13tNACjSZKCKiowpuRi93m6YlX9QAP3TCpBdDr8sMRu5OhF5Prp6eV1nhFWV9ZY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715125006; c=relaxed/simple; bh=wnAuMuelVqBaOBHPNrOn1dHFRLCS5aMFuxMXl2adm8I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fIdrPA0hD7XXe6K6HrOxopi1aeSUoFtwYRyXaqEvwI+/lGuYjCoAHTiYuZEtVstKuci6Tu9+IpyoaDHnu74lcsq2ReNf3EKr+YPMfzNtBHlaTviVViWOfsaEeNdO3sQHVcVsYnhTMcjFcTQlQzxrsHLReKc4phrWaTIHlvWpSYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z9iwS89O; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12984C2BBFC; Tue, 7 May 2024 23:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715125006; bh=wnAuMuelVqBaOBHPNrOn1dHFRLCS5aMFuxMXl2adm8I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Z9iwS89OFb3ScbwH3X1Sd6EDA1EOXQ5QRFMuzuV/rhDDd9OF7rqDr4Le82rfdIMvK svqVrTxhPbAQsV75hM2+qI+e6RktobL99LpJrZ8bwkUBWUTrouOxYj+GBjWHWYCYS6 834xXhzMZ1sBRbvtsVHS2Y64O7KHzOfdeZx7Zu5ArjF8Et7zhvnF5YRLhHgqwdKu13 jhpL5ncMBGQmQaJZ3TMNCv0XaUoJaD9Hthbe2cYQFHsid3q55VVqze1mS+BmKtKzBg vEBIwu6T6QUFThpiaMbNaDeVnplTKkfqqaSR3jtNxdUcBcvJ0aZDLbtzjnpHWizuX8 KPuQ9bNFKzT2A== Date: Tue, 7 May 2024 16:36:45 -0700 From: "Darrick J. Wong" To: Christoph Hellwig Cc: Dan Carpenter , Chandan Babu R , linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] xfs: check for negatives in xfs_exchange_range_checks() Message-ID: <20240507233645.GZ360919@frogsfrogsfrogs> References: <0e7def98-1479-4f3a-a69a-5f4d09e12fa8@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, May 06, 2024 at 11:40:25PM -0700, Christoph Hellwig wrote: > On Tue, May 07, 2024 at 09:33:40AM +0300, Dan Carpenter wrote: > > On Mon, May 06, 2024 at 11:06:17PM -0700, Christoph Hellwig wrote: > > > On Sat, May 04, 2024 at 02:27:36PM +0300, Dan Carpenter wrote: > > > > The fxr->file1_offset and fxr->file2_offset variables come from the user > > > > in xfs_ioc_exchange_range(). They are size loff_t which is an s64. > > > > Check the they aren't negative. > > > > > > > > Fixes: 9a64d9b3109d ("xfs: introduce new file range exchange ioctl") > > > > > > In this commit file1_offset and file2_offset are u64. They used to > > > be u64 in the initial submission, but we changed that as part of the > > > review process. > > > > I've just checked again, and I think it was loff_t in that commit. > > There are two related structs, the one that's userspace API and the > > one that's internal. The userspace API is u64 but internally it's > > loff_t. > > Ah, yes. The in-kernel ones probably just needs to move to use u64 > as well. I don't think we want userspace to be able to exchangerange data at file positions that they can't read or write with a standard fs syscall. --D