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 2B41CC38142 for ; Mon, 23 Jan 2023 17:20:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233629AbjAWRUy (ORCPT ); Mon, 23 Jan 2023 12:20:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233574AbjAWRUw (ORCPT ); Mon, 23 Jan 2023 12:20:52 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3231F6594 for ; Mon, 23 Jan 2023 09:19:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674494398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pOoqxnL289W8RYJpdgnKmU7vs7+RtONm5/MOnF58uqA=; b=SCnQDeHJGERVWmMCpkbCQ5FpuJCj2hH2GL+Eae7KcJNhN8j7fImkREGmm/APhMT4y4EZPb DodBP829K5OSxMuCttEt3/hY98ji/U/I2UwSsKmEREZJRvNbd8NJ6j46jyxGphI39Hlas7 wLvsWFF7XEEoe80SPNYujwqJi4kOd30= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-164-DQJIWadMMVONSMP0SVtNSQ-1; Mon, 23 Jan 2023 12:19:53 -0500 X-MC-Unique: DQJIWadMMVONSMP0SVtNSQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE35D3C10220; Mon, 23 Jan 2023 17:19:52 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1421492B02; Mon, 23 Jan 2023 17:19:51 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20230120175556.3556978-1-dhowells@redhat.com> <318138.1674491927@warthog.procyon.org.uk> To: Matthew Wilcox Cc: dhowells@redhat.com, John Hubbard , Al Viro , Christoph Hellwig , Jens Axboe , Jan Kara , Jeff Layton , Logan Gunthorpe , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 0/8] iov_iter: Improve page extraction (ref, pin or just list) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <324814.1674494391.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Mon, 23 Jan 2023 17:19:51 +0000 Message-ID: <324815.1674494391@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Matthew Wilcox wrote: > > Wouldn't that potentially make someone's entire malloc() heap entirely= NOCOW > > if they did a single DIO to/from it. > = > Yes. Would that be an actual problem for any real application? Without auditing all applications that do direct I/O writes, it's hard to say - but a big database engine, Oracle for example, forking off a process= , say, could cause a massive slow down as fork suddenly has to copy a huge amount of malloc'd data unnecessarily[*]. [*] I'm making wild assumptions about how Oracle's DB engine works. > > Also you only mention DIO read - but what about "start DIO write; fork= (); > > touch buffer" in the parent - now the write buffer belongs to the chil= d > > and they can affect the parent's write. > = > I'm struggling to see the problem here. If the child hasn't exec'd, the > parent and child are still in the same security domain. The parent > could have modified the buffer before calling fork(). It could still inadvertently change the data its parent set to write out. = The child *shouldn't* be able to change the parent's in-progress write. The m= ost obvious problem would be in something that does DIO from a stack buffer, I think. David