From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-f194.google.com ([209.85.160.194]:33861 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727243AbeLJUGz (ORCPT ); Mon, 10 Dec 2018 15:06:55 -0500 Received: by mail-qt1-f194.google.com with SMTP id r14so13860203qtp.1 for ; Mon, 10 Dec 2018 12:06:54 -0800 (PST) Message-ID: <1544472412.18488.5.camel@redhat.com> Subject: Re: [PATCH] block: Restore tape support From: Laurence Oberman To: Keith Busch , Bart Van Assche Cc: Jens Axboe , linux-block@vger.kernel.org, Christoph Hellwig , Todd Aiken , stable@vger.kernel.org Date: Mon, 10 Dec 2018 15:06:52 -0500 In-Reply-To: <20181210153230.GB25206@localhost.localdomain> References: <20181210030814.13235-1-bvanassche@acm.org> <20181210153230.GB25206@localhost.localdomain> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: On Mon, 2018-12-10 at 08:32 -0700, Keith Busch wrote: > On Sun, Dec 09, 2018 at 07:08:14PM -0800, Bart Van Assche wrote: > > According to what I found in > > https://bugzilla.kernel.org/show_bug.cgi?id=201935 patch "block: > > Clear > > kernel memory before copying to user" broke tape access. Hence > > revert > > that patch. > > Instead of reverting back to the leaking arbitrary kernel memory, why > not just make a fix on top of it? This should do it: > > --- > diff --git a/block/bio.c b/block/bio.c > index c4ef8aa46452..55a5386fd431 100644 > --- a/block/bio.c > +++ b/block/bio.c > @@ -1262,7 +1262,8 @@ struct bio *bio_copy_user_iov(struct > request_queue *q, >   if (ret) >   goto cleanup; >   } else { > - zero_fill_bio(bio); > + if (bmd->is_our_pages) > + zero_fill_bio(bio); >   iov_iter_advance(iter, bio->bi_iter.bi_size); >   } >   > -- Reproduced on 4.20-rc6 # tar cvf /dev/st0 /etc ... Showed data was written in tar However listing is empty, data not actually written # tar tvf /dev/st0  # Then: Applied Keith Patch # tar cvf /dev/st0 /etc ... # tar tvf /dev/st0 Data was written and can be read ..drwxr-xr-x root/root         0 2018-10-31 08:41 etc/fwupd/ -rw-r--r-- root/root       292 2018-06-07 08:27 etc/fwupd/daemon.conf drwxr-xr-x root/root         0 2018-10-31 08:41 etc/fwupd/remotes.d/ -rw-r--r-- root/root       181 2018-09-05 06:00 etc/fwupd/remotes.d/fwupd.conf -rw-r--r-- root/root       327 2018-06-07 08:27 etc/fwupd/remotes.d/lvfs-testing.conf -rw-r--r-- root/root       283 2018-09-05 06:00 etc/fwupd/remotes.d/lvfs.conf -rw-r--r-- root/root       283 2018-09-05 06:00 etc/fwupd/remotes.d/vendor.conf -rw-r--r-- root/root       118 2018-09-05 06:00 etc/fwupd/uefi.conf -r--r----- root/root      4328 2018-09-25 01:57 etc/sudoers.rpmnew -rw-r--r-- root/root      2331 2018-11-02 14:50 etc/hercules.cnf -rw-r--r-- root/root       147 2018-11-06 17:08 etc/minirc.p2000 [   96.272548] st 2:0:0:0: [st0] Block limits 1 - 16777215 bytes. [   96.300782] st 2:0:0:0: [st0] Mode sense. Length 11, medium 0, WBS 10, BLL 8 [   96.334985] st 2:0:0:0: [st0] Density 58, tape length: 0, drv buffer: 1 [   96.367366] st 2:0:0:0: [st0] Block size: 0, buffer size: 4096 (1 blocks). [   97.197209] st 2:0:0:0: [st0] Rewinding tape. [  103.104429] st 2:0:0:0: [st0] Block limits 1 - 16777215 bytes. [  103.133142] st 2:0:0:0: [st0] Mode sense. Length 11, medium 0, WBS 10, BLL 8 [  103.167421] st 2:0:0:0: [st0] Density 58, tape length: 0, drv buffer: 1 [  103.199711] st 2:0:0:0: [st0] Block size: 0, buffer size: 4096 (1 blocks). [  104.109081] st 2:0:0:0: [st0] Rewinding tape. Tested and works fine. Thanks All Tested-by: Laurence Oberman