Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp902081pxp; Wed, 16 Mar 2022 20:42:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx75t2Q+f2nCb/3cycYr3rzoyPCTtHP2Ju3k74o+cMMGgRZne4BGqnf3Rxq7tTMnKw7tyqZ X-Received: by 2002:a17:902:9348:b0:14f:c715:2a94 with SMTP id g8-20020a170902934800b0014fc7152a94mr2933680plp.66.1647488538640; Wed, 16 Mar 2022 20:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647488538; cv=none; d=google.com; s=arc-20160816; b=ur73CtrEUvZu7k+1YjzZLs6wQWztTgAFPmiWhmeY61jvBTBeIKtAwr5JatJSFh1oX/ TAtLcAam5SGJzIepKqLIvJObU0EDGIFwIyqwdrRGMS2zgjqb+EAUWNEzwZyxGRzmUwir ct6W052MZaBLLiyHEX1q3QHLdKMlCaf0haF5R2g7yhlD1CN9tDHdwYoRevyM5n5ZkoEI FghhduBq/vLfVhHRf2vujevscIWTrGAeLxJfHJhs+EdCLIrMbWQcJ67eE9x6YbuLgBTX Ta+oLH4gsH6WipjDsJxfFf/+giMZvRNzD0rINZ+TTFh8tFJURqayEr6mOSC7u/dybQEz ZWeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XZW7zFhvECcnVxp2s/tmL4Gnp4bEiH1MRGe6QJgFmWw=; b=VWjdTLhy1D/5TRE12gCJHcGoaVUdBlkIKW4AaIQbvRF41bBAZK8sDi48DLW1MpB7vd 4877fHAO2JQA/DKuoh8+CjbZJRBsLiUCs901a/tf50hk+XfdYvGJApmg4G2ajsj3ZisY u/SzRbFGF6Xp2JXzDFNa+f5sAOk1Aw5aEjJZAwO+GUnfOcjDs9cJReJyK6FTFNN3oemo XIXzNnkMuCy3E9j3wYtCANDPYbelgXm/a2C+1bJOtBNu6S03XVQBKutihGYGgt3f3Awn sNKAtzO3FtKeWoXjQFit53dO9Wvh0It//6x/wdxCXQN9enBRAuxjTqJS651fqzKA5ZHJ Msvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qgCW7RY/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j12-20020aa7800c000000b004fa2150eddcsi3175410pfi.300.2022.03.16.20.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 20:42:18 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qgCW7RY/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B5ED064BF9; Wed, 16 Mar 2022 20:34:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347000AbiCPSGt (ORCPT + 99 others); Wed, 16 Mar 2022 14:06:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236096AbiCPSGs (ORCPT ); Wed, 16 Mar 2022 14:06:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9947A4C436; Wed, 16 Mar 2022 11:05:33 -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 ams.source.kernel.org (Postfix) with ESMTPS id 51DC9B81637; Wed, 16 Mar 2022 18:05:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DED1DC340E9; Wed, 16 Mar 2022 18:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647453931; bh=EUwl1rJPMN38j2p42kZ+S3LhlRJpuLGqUxqQYMv+5QE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qgCW7RY/0j2r7RQhPEWzTAdZHI91zrT43bm01uJMd9tulx3QwbBL8PBjcxHTe5Uor B6gu/3FB37YqzAa2bnXyFSLn2ugdAAPHJWucZ2ynC4yonofmq1dErOcRo7CTLyVmBX QscVjgfsN3QeWa9mjSPnS9HLWUnohQDReVoFkrpd5GcIyoa/VgtJbypGyH6CS0WbaM 5Erftk/ilvDwQyzctnRJrZ+h3oSecgWG5tVoAjk4FN+D8Kcnr5Px94xWmz9IUnzxeQ gmiedvhyi1MJB1coBxncSbLAHo1HeV2tRDLTcbnCXAfroE0UEruDfV0azXZiaDsWPp 0h+qWumkY3SfQ== Date: Wed, 16 Mar 2022 18:05:29 +0000 From: Eric Biggers To: Christoph Hellwig Cc: axboe@kernel.dk, jaegeuk@kernel.org, chao@kernel.org, ulf.hansson@linaro.org, Adrian Hunter , Daeho Jeong , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Subject: Re: security issue: data exposure when using block layer secure erase Message-ID: References: <20220316093740.GA7714@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220316093740.GA7714@lst.de> X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 16, 2022 at 10:37:40AM +0100, Christoph Hellwig wrote: > Hi all, > > while staring at the block layer code I found what I think is a major > security issue with the use of REQ_OP_SECURE_ERASE. > > The issue is not about the actual protocol implementation, which only > exists for eMMC [1], but about we handle issuing the operation in the > block layer. That is done through __blkdev_issue_discard, which > takes various parameters into account to align the issue discard > request to what the hardware prefers. Which is perfectly fine for > discard as an advisory operation, but deadly for an operation that > wants to make data inaccessible. The problem has existed ever since > secure erase support was added to the kernel with commit > 8d57a98ccd0b ("block: add secure discard"), which added secure erase > support as a REQ_SECURE flag to the discard operation. __blkdev_issue_discard() can break up the region into multiple bios, but I don't see where it actually skips parts of the region. Can you explain more specifically where the problem is? - Eric