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 34E22CDB482 for ; Fri, 13 Oct 2023 04:38:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229504AbjJMEiN (ORCPT ); Fri, 13 Oct 2023 00:38:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjJMEiM (ORCPT ); Fri, 13 Oct 2023 00:38:12 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BF25B8 for ; Thu, 12 Oct 2023 21:38:10 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id E048D67373; Fri, 13 Oct 2023 06:38:06 +0200 (CEST) Date: Fri, 13 Oct 2023 06:38:06 +0200 From: Christoph Hellwig To: Kanchan Joshi Cc: Keith Busch , Christoph Hellwig , Kanchan Joshi , axboe@kernel.dk, sagi@grimberg.me, linux-nvme@lists.infradead.org, vincentfu@gmail.com, ankit.kumar@samsung.com, cpgs@samsung.com, stable@vger.kernel.org, Vincent Fu Subject: Re: [PATCH v3] nvme: fix memory corruption for passthrough metadata Message-ID: <20231013043806.GA5797@lst.de> References: <1891546521.01696823881551.JavaMail.epsvc@epcpadp4> <20231010074634.GA6514@lst.de> <20231011050254.GA32444@lst.de> <20231012043652.GA1368@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Fri, Oct 13, 2023 at 07:49:19AM +0530, Kanchan Joshi wrote: > > precedent to start doing it. > In my mind, this was about dealing with the specific case when the > kernel memory is being used for device DMA. > We have just two cases: (i) separate meta buffer, and (ii) bounce > buffer for data (+metadata). > I had not planned sanity checks for user inputs for anything beyond that. > As opposed to being preventive (in all cases), it was about failing > only when we are certain that DMA will take place and it will corrupt > kernel memory. > > In the long-term, it may be possible for the path to do away with > memory copies. The checks can disappear with that. As soon as the user buffer is unaligned we need to bounce buffer, including for the data buffer.