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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79677C433EF for ; Thu, 7 Apr 2022 20:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231324AbiDGUyj (ORCPT ); Thu, 7 Apr 2022 16:54:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231330AbiDGUyY (ORCPT ); Thu, 7 Apr 2022 16:54:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16582F8455; Thu, 7 Apr 2022 13:50:56 -0700 (PDT) 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 3A4BE61F7C; 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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;