Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1474035lqa; Mon, 29 Apr 2024 09:23:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWxAdwsUyH+ugiyjUmzHbblGlZpry+J1l2qLMNHtq8HsrYI2s7or2Gi8c9hgZ5/Z+fEXpzwnF2Hu0aFI+SXp/ACsaNaFkbRf7jDmMS2xg== X-Google-Smtp-Source: AGHT+IFBo5ebj+zyXim9H8IdcbJVusbb51dkeDCJ7sUu0k8gFoXt73MEY8+HYHZAUcUB+MxLGxVa X-Received: by 2002:a05:690c:9e:b0:618:25fc:e2a9 with SMTP id be30-20020a05690c009e00b0061825fce2a9mr7993514ywb.38.1714407799788; Mon, 29 Apr 2024 09:23:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714407799; cv=pass; d=google.com; s=arc-20160816; b=kdS4VkQE+mURzEKEWWCTmFI0Y2gmTpgNW6uwXfgUIhsE0dh6+IibW+Z7DmhmzYdfpO ZPI7gCP0slMHl+IjiYqR0nEK8SsEuBfVcvOseOwMMPpf514iIQUfwH+aoJNs2tiPx9Rz bKat/a1pbby6uMwJqXXYSv367CfKeF1IBOXoypXYaP6at+R5DWdOWJudmT3r+oLPT1Xn kZwEhkDlockYK4sKEq3I/81FWZ4sK18l2Bmq0gwQLU503059XcFhI9WUeX/ABqJENul8 cK4hGMpJMTLx0Sfzsh1z+S0SoJ9BkgYucTC7BrQfvVUhOoAAG0XsHtknFYCRRYCqbljS 1teA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=ECKsR7gSc7PqtSVqfVdKo6YqBA37ol9wKk+epOGXAQY=; fh=lXFsxB+2UAxK47sGplc7rl4z84P89BdSrXMs+7bg/Vo=; b=CaWNDd+6qebG1E+QeUgR7PFKoQt+BHX5agqSEhFQ+FIFvLhqu/hExs7KX6w3yeL82Q bG+LOBZpiaJDb7fMXqWZa9J139de4H643PpbAwh7b5SY/IXmGKkh2n5TZjEVTeEGqCfA hd60hYVK1wfJl84Ft+ojNlr2C4qmIXVw+93Ih+O5WDUDdDQtV1+KHq/+05T/0qjDcuyi aXtwh5FIMHGbBQCPJX/WXfiprbnX8xESLuOeI2RvC0AVP/2omk9JLxAu9g/Eev7byPnJ 3aox6ATOzUIRT/vGcQV0qmdZvZsFxxGRkOY9Oyn0ue3GvrKUN3gy408fYpOxxegOVDMn vsxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=LrKzQntE; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-162678-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162678-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q41-20020a05613002a900b007f0f48e9547si296984uac.141.2024.04.29.09.23.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 09:23:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162678-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=LrKzQntE; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-162678-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162678-linux.lists.archive=gmail.com@vger.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D9251C20359 for ; Mon, 29 Apr 2024 16:23:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 50DC084D39; Mon, 29 Apr 2024 16:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="LrKzQntE" 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 5B76A824AE; Mon, 29 Apr 2024 16:23:09 +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=1714407790; cv=none; b=QAJTSnf90cF6Dm624geBugwYANxWKliKjHmJtdbyqNOzAQZ6rU/WIfJUwr7n0XiOVNsKDE9GhpD+1i/l6S9j8BgAakIkMBJQW2zwYsfNxEJWWFqwwgg3FeJ52dX15yYwL0QoFmmuwwzYXDB7fbwNbSirvTolcuVs2NAD16pSkfM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714407790; c=relaxed/simple; bh=leIF1FkkaAIGefMANabaMQGP376d/EtqqslqBj0skp4=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=qLecB1ibSUXinbYa201SAy/MgURGwfl/YT4PkfTrIkpm1Wt7gwD17J9e8rlBqi7yg7Uly/g035zgDDIBQChSMW6nuXLcvKtCzo5QhCYXO8jadavjSvrWQl0I0gwwPSeoNhDCWZ8NSmwAncwVMmsPj3kHN7WBCUPLQNlZ8b9LeDc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=LrKzQntE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90B2FC113CD; Mon, 29 Apr 2024 16:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1714407789; bh=leIF1FkkaAIGefMANabaMQGP376d/EtqqslqBj0skp4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LrKzQntEeZj2BfgfUv6nBmFwPfgwHh0sru4q3QdBSe8rnwxUpw/sH2YaoWBJqsi1G 46aNixPeM47BJAbqbRQPFcSOBRXjr3JJObNiK1TSFoRp9nlnMo50clkx0wOXSS65F8 uJyH9w7LEd7Y8cA/y9koOTgq/+WCXzpbUnWO+FtE= Date: Mon, 29 Apr 2024 09:23:07 -0700 From: Andrew Morton To: Luis Chamberlain Cc: ziy@nvidia.com, linux-mm@kvack.org, fstests@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, willy@infradead.org, hare@suse.de, john.g.garry@oracle.com, p.raghav@samsung.com, da.gomez@samsung.com Subject: Re: [PATCH 1/2] mm/huge_memory: skip invalid debugfs file entry for folio split Message-Id: <20240429092307.37bf51c79f70bad4922f6277@linux-foundation.org> In-Reply-To: References: <20240424225449.1498244-1-mcgrof@kernel.org> <20240424225449.1498244-2-mcgrof@kernel.org> <20240425140126.2a62a5ec686813ee7deea658@linux-foundation.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Sun, 28 Apr 2024 21:04:50 -0700 Luis Chamberlain wrote: > On Thu, Apr 25, 2024 at 02:01:26PM -0700, Andrew Morton wrote: > > On Wed, 24 Apr 2024 15:54:48 -0700 Luis Chamberlain wrote: > > > > > If the file entry is too long we may easily end up going out of bounds > > > and crash after strsep() on sscanf(). > > > > > > > Can you explain why? I'm not seeing it. > > I couldn't see it either but I just looked at the crash below and > its the only thing I could think of. So I think its when userspace > somehow abuses MAX_INPUT_BUF_SZ a lot somehow. This isn't a good basis for making kernel changes :( Can you investigate a little further please? What actually is present at *buf when your new checks succeed? Could we be seeing 0xNNN,0xNNN and leaving new_order unaltered? Or something.