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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ABD0C433F5 for ; Thu, 7 Apr 2022 20:51:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 498AC6B0072; Thu, 7 Apr 2022 16:51:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4473B6B0073; Thu, 7 Apr 2022 16:51:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 336C06B0074; Thu, 7 Apr 2022 16:51:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id 2048B6B0072 for ; Thu, 7 Apr 2022 16:51:07 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C462F183D88CD for ; Thu, 7 Apr 2022 20:50:56 +0000 (UTC) X-FDA: 79331277312.26.A7A3D74 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 2DE051A0002 for ; Thu, 7 Apr 2022 20:50:56 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3A96561F7A; Thu, 7 Apr 2022 20:50:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68752C385A8; Thu, 7 Apr 2022 20:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1649364654; bh=1vFrHO/IV/OlcF4Lq304ipCo0E3OpEp58N3JX16PGRQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UINhBf9lLNG+xMtTtcUk2JIJy6jl18do1S006ZOXeNJ/aeVS8b7KCqu5js3b8QA3f euuuTPkACA2sC1+9nSZ/+PfYBJC8EUYQBIQ59JTcnJpO5yhXHjYWkmZMEPLu5X4kt/ iRDaLH5yWwNaZ7VE7b1Abi+93mDrdpBLDac9EyYI= Date: Thu, 7 Apr 2022 13:50:53 -0700 From: Andrew Morton To: Axel Rasmussen Cc: Matthew Wilcox , Mike Rapoport , Linux MM , LKML , stable@vger.kernel.org Subject: Re: [PATCH] mm/secretmem: fix panic when growing a memfd_secret Message-Id: <20220407135053.6652bdad545fe98fc9babfbc@linux-foundation.org> In-Reply-To: References: <20220324210909.1843814-1-axelrasmussen@google.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: dgcjrzmeidksaq7tzyche8em3mwpcmmp Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=UINhBf9l; dmarc=none; spf=pass (imf19.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Queue-Id: 2DE051A0002 X-HE-Tag: 1649364656-301560 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 31 Mar 2022 10:42:12 -0700 Axel Rasmussen wrote: > Any strong opinions on which error code is used? I think overall I > would still pick EOPNOTSUPP, but happy to change it if anyone feels > strongly. > > - I think ENOSYS is specific to syscall nr not defined > - I think ENOTTY is specific to ioctls > - The kernel (sort of mistakenly) defines ENOTSUPP instead of ENOTSUP, > but it's marked deprecated and it's recommended to use EOPNOTSUPP > instead (despite POSIX saying these should be distinct and for > different uses). `man ftruncate' sayeth EINVAL The argument length is negative or larger than the maximum file size. which reasonably accurately describes what we're doing here? + if ((ia_valid & ATTR_SIZE) && inode->i_size) + return -EOPNOTSUPP;