Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1229254pxk; Mon, 31 Aug 2020 13:27:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjzWdzORHk3dlcYXToSKA5fI70ohhKub6Fs1jLqexumE+KVxM1XG6E/L1+/8iBuAorZwNm X-Received: by 2002:a50:9e6b:: with SMTP id z98mr2620754ede.365.1598905677501; Mon, 31 Aug 2020 13:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598905677; cv=none; d=google.com; s=arc-20160816; b=fRxfepzs+74GV8QAD6Xx03c4KFuRrTdO/6Zia9t8Nt9b8pczIqtwT0SLfEZpqnArhB A/HyXZAf6Jmvr5VDK//sO+vIELdfAfPZdtD9dwjaG1PWE0TfH4H3BjGcNZ+9ctuMEooD ShEVZlUsMZWASOTYhcCpojoZkKrdLh7HedtGPdYGEWAVwJLXzNaSamp5eUz0crRJKUlh F0/xKwyxWIS4u8jUqx2JjJsgyaYPoqdetZpvGh3N7GZmy7iqci57tmVp/x+5cl1P0pea Td8JvHZiWT/+UyZorX9WTZkX7I3drjJRyI0RUJNxzy0ZDx2RH40nsqcbv0q2RrLlmz+s 9PPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=NupQwOin7OIUMIEQkBORyIATGdqAz+bfGvsiSPmfA0g=; b=WbwTKJdIeDr2ZiD2jQ6yudDy9EOImDvayMDIbFVcvPfsYn4ECje/cjbI1A2YRyT3AT yTo70iEavhJwZhNUZbGQX6Ohx/K3MDnn1G1z8c2+Bhpmz5W4IR83yNEd5MjOVbtaThPX ou6ILCIC0WIYUT1F0wef5OWHyyepP8/GfYPd2IHtRCwT5gx8xCK3LDYiu4v+bSKuoleb jhmvj69Roedi1LqySViS/PVtbCvg7LfMg5gmzZhu9mBsY+1F54rHcExJgOycCPxtvHKS Q+WNeyoFVRp0Dy4QV13Z9GV9M6FyT4VaJ9soxVjTkoOmYKEKbxsSKiT5CICIqyGARmIL y6+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ZSrrE7lj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck20si5949136ejb.15.2020.08.31.13.27.34; Mon, 31 Aug 2020 13:27:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ZSrrE7lj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728838AbgHaRFk (ORCPT + 99 others); Mon, 31 Aug 2020 13:05:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728829AbgHaRFi (ORCPT ); Mon, 31 Aug 2020 13:05:38 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C6F9C061575 for ; Mon, 31 Aug 2020 10:05:37 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id g14so6788116iom.0 for ; Mon, 31 Aug 2020 10:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=NupQwOin7OIUMIEQkBORyIATGdqAz+bfGvsiSPmfA0g=; b=ZSrrE7lja8S44m6VDFYpuUVPj180evZgepv+n5Olz62tJeG0Mm1veMfhBfsAzclMDD rCgw+cTEYzFaVjKm8FruvNBxQ+DCr6mi7KNx8Yu5V04AlHm2IP73U+weUhecberMWoiN dJysYL7nXrAjuGZhjiwnFAbOdk08W2jihSLi6xBeLQ+6/5Y4J7YlSB8/czZ9Xdam4hF9 ItM4t8BNCQexQ0BtVZoPD01thRQKRh7R0QHo/AyofQXoJZw3l8l/sOXubq1s4NET6gtj 3IAcyViBF75bWfpg7iP8tyZYH6pziaXSAWfgSzbdnJ2dQQPOHdvgP3JZal708Ib+4zY7 Bp5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=NupQwOin7OIUMIEQkBORyIATGdqAz+bfGvsiSPmfA0g=; b=Se/74DHA/ppQ3rfSz8doDLSkJpRlbCig+XF4kxyhq6dJYfDTiegJ/1Cu97hBTJWa39 YWN253nvEA64o1pyo6QGMkaILMawXpZemgNgHKNzExmrPBLd9hwhawMnP4xrlvIsTFXc O5DaZBxa1gWsieGFyBk38sjSoBl4zB4zxkYPmJichSJbzIVAZVY1wZbryBLh5gKNiQn9 o3+BZOPRKWDD4NJCpYToSyVI7CZQT9naXABe7LAQh/1jQmyywX3dwXTrL8hvhKafUz3G jdwU2XVrROiIf3e37THt9hRkH0vNH7GSlQ+lI9fwt8dMLZ75Trd9/cBnOjrz2CI+M20i HiBw== X-Gm-Message-State: AOAM532fARAYTbolqnDcBCV1FzhxuTIWid/meoTTLnu+baUPn2xhnj11 /B0zX3qbbvc02kOXOmcihiWYcQ== X-Received: by 2002:a02:a30b:: with SMTP id q11mr2053911jai.77.1598893536338; Mon, 31 Aug 2020 10:05:36 -0700 (PDT) Received: from [192.168.1.58] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id k16sm4626707ilc.38.2020.08.31.10.05.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Aug 2020 10:05:35 -0700 (PDT) Subject: Re: [PATCH v2] vfs: add RWF_NOAPPEND flag for pwritev2 To: Jann Horn , Rich Felker , Alexander Viro Cc: linux-fsdevel , kernel list , Linux API , Pavel Begunkov References: <20200831153207.GO3265@brightrain.aerifal.cx> From: Jens Axboe Message-ID: Date: Mon, 31 Aug 2020 11:05:34 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/31/20 9:46 AM, Jann Horn wrote: > On Mon, Aug 31, 2020 at 5:32 PM Rich Felker wrote: >> The pwrite function, originally defined by POSIX (thus the "p"), is >> defined to ignore O_APPEND and write at the offset passed as its >> argument. However, historically Linux honored O_APPEND if set and >> ignored the offset. This cannot be changed due to stability policy, >> but is documented in the man page as a bug. >> >> Now that there's a pwritev2 syscall providing a superset of the pwrite >> functionality that has a flags argument, the conforming behavior can >> be offered to userspace via a new flag. Since pwritev2 checks flag >> validity (in kiocb_set_rw_flags) and reports unknown ones with >> EOPNOTSUPP, callers will not get wrong behavior on old kernels that >> don't support the new flag; the error is reported and the caller can >> decide how to handle it. >> >> Signed-off-by: Rich Felker > > Reviewed-by: Jann Horn > > Note that if this lands, Michael Kerrisk will probably be happy if you > send a corresponding patch for the manpage man2/readv.2. > > Btw, I'm not really sure whose tree this should go through - VFS is > normally Al Viro's turf, but it looks like the most recent > modifications to this function have gone through Jens Axboe's tree? Should probably go through Al's tree, I've only carried them when they've been associated with io_uring in some shape or form. -- Jens Axboe