Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1882142rwd; Fri, 9 Jun 2023 03:43:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40e9l/mGciSImYspoP7OExLIOk9m8Y35omPvd2cQQ2D6DldNUsqxgsAKF8l78We6OFiNfs X-Received: by 2002:a17:90a:184:b0:259:b504:5829 with SMTP id 4-20020a17090a018400b00259b5045829mr708691pjc.0.1686307402404; Fri, 09 Jun 2023 03:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686307402; cv=none; d=google.com; s=arc-20160816; b=RQErnvg2wmyCMNmdGD2PcxuzLXt7KE2/Ru81YqUy5rcPKGhe9uYuKqrii6Co6p4O9F Z74fjWbarFHnq/NNIBCEdhAtVUscZvpFipGaYyj/GDZDbeUNH/txUsBzs7b7OAQGx6BH Pob3nb8t+fGL47qspdO6IQ1ax0+NCK8tmHKTHKqpq7rOBsa65oM2veQnwC0xeYX20vEs lneEvanbVanCHy3DyPTRzI62zmu9VEr+G3jCofIWBio5HoDAEPq4yU9+RDEzP3iLpihP ubSrJ93Hr8GD43sjShKOo8hJVxsFSAu3i82tDU/d6W9dTSYEv+LKZ8pQpSZvMfnVWShx h8tg== 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=M0n8/D5gSrVbcAskz0QgbStZ+qE9a1Ww6ORHIZhs/gc=; b=L1SO7kpLwPjGjcwy11tBnnFrZzHHPj2SmctJgnDI2KWvEdE0SjYsJBZX5vGvbKp6mx s4rfVM67AN4kyxm2hH04nPsEDet2+GavlawR82mhX5dD30ysYvYaO7I3NSeFrN7LxqRe V5JQPRi+WTyfJ/IsPHVXoRuxc3p9fjXYW8UoiErl7HH5tMeAlmGHHUISK/oVRhNeg1Lq AsqZM0mJpdZsoAHOPfBVUUIjyXQvDDXp3jumcpU/W43Zz9CXgvi9wrrc/vJqzZRdH2zT sNfAa8tpp0U5V1Cp7/n8880/N95WoB0WS2y53AWWusQhRNrhQOMWPbJW2E5mTa0on+uo FsuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PgMiccRq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a170903235100b001b22c8d0dc5si2635058plh.437.2023.06.09.03.43.08; Fri, 09 Jun 2023 03:43:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PgMiccRq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237678AbjFIKOB (ORCPT + 99 others); Fri, 9 Jun 2023 06:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbjFIKNX (ORCPT ); Fri, 9 Jun 2023 06:13:23 -0400 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 E3B2859D8 for ; Fri, 9 Jun 2023 03:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686304860; 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: in-reply-to:in-reply-to:references:references; bh=M0n8/D5gSrVbcAskz0QgbStZ+qE9a1Ww6ORHIZhs/gc=; b=PgMiccRqL79Lb4ge9uoYcOxMYdeILtQXD7y0dU1A9F8vOTUID/8c3/RyxASiCIwqSuGZJB Y6k7fzXBNOhxVRWcvoguV67i8teGFXmL66pVvqqYy3Ga5inHbTgRPONSCS9v2FlqayOG+V rpncxhKsRySbF9Qlyg9sLgU4fqQ169A= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-458-op3wBjmnOOytQ9Il1aTeiQ-1; Fri, 09 Jun 2023 06:00:52 -0400 X-MC-Unique: op3wBjmnOOytQ9Il1aTeiQ-1 Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-1b0116fef51so4084085ad.0 for ; Fri, 09 Jun 2023 03:00:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686304852; x=1688896852; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=M0n8/D5gSrVbcAskz0QgbStZ+qE9a1Ww6ORHIZhs/gc=; b=JIlwKc/PxKG62UWWjYvbtjoWR7SVdxGajbiVbpwqBsUSIR+aDd94sqBG2u1wrI+yeW 1YddAFe8wRljgcFsLopUZMnCAACxk0bYG77/UYNj+XuWu/tFTLdh6aEM+XbgBWdBM/nq KPEMI9bCDq8uIjRYPsuIdnDePC4HOYJQz59I7YZJ/z/wgst00NjEpBaPXIBKDYNG+dWn 1oAKQC7lWKFIg4ndrLvjBy6NGP8mxlkBH3e5q5aHTZJVgQAleUU238s5tp2b7hKkVxz7 nb7y9Ytc7BS8GB3aQ63yFH4ahp+YVTIabw1yGzPAji1j7CnmxEa/Ad+2tv8i+i+svjhX It5A== X-Gm-Message-State: AC+VfDxluXRGvoPAzABxpyhVBO1JoKmAJtKTliZ4CHRtt7o8TG8W0eEs TK0s0INYZTlvHD1EgQFnNHC2mNXECtrmchBMZD8SvHkUislmAI/3zuJqj9qJw9ca0H/wAZ7hkNS b7D/KyKFttByCr6i3du23Gskq X-Received: by 2002:a17:902:b194:b0:1b0:74f5:bf10 with SMTP id s20-20020a170902b19400b001b074f5bf10mr468749plr.65.1686304851826; Fri, 09 Jun 2023 03:00:51 -0700 (PDT) X-Received: by 2002:a17:902:b194:b0:1b0:74f5:bf10 with SMTP id s20-20020a170902b19400b001b074f5bf10mr468730plr.65.1686304851467; Fri, 09 Jun 2023 03:00:51 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id az5-20020a170902a58500b001b034faf49csm1437300plb.285.2023.06.09.03.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 03:00:50 -0700 (PDT) Date: Fri, 9 Jun 2023 17:58:11 +0800 From: Coiby Xu To: Milan Broz Cc: Eric Biggers , kexec@lists.infradead.org, Baoquan He , x86@kernel.org, dm-devel@redhat.com, Pingfan Liu , linux-kernel@vger.kernel.org, Dave Hansen , Kairui Song , Jan Pazdziora , Thomas Staudt , Vitaly Kuznetsov , Dave Young , Ondrej Kozina Subject: Re: [PATCH 0/5] Support kdump with LUKS encryption by reusing LUKS volume key Message-ID: References: <20230601072444.2033855-1-coxu@redhat.com> <20230602213452.GC628@quark.localdomain> <36mz3gn764ceadfbuhhmoo2zaiqmzplpkdcnszha2hzhmb3i62@sm6hilxryzk4> <88581a3c-8bd3-f7b2-064c-c809a2152ed3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 Thu, Jun 08, 2023 at 12:39:26PM +0200, Milan Broz wrote: >On 6/7/23 14:39, Coiby Xu wrote: >... >>>I do not think you need any cryptsetup patches, all you need is to write >>>decrypted volume key from LUKS metadata with >>> cryptsetup luksDump ---dump-volume-key -volume-key-file >>>(or any code equivalent with libcryptsetup), am I correct? >> >>Correct me if I'm wrong, but I don't think there will be a safer way to >>preserve key without patching cryptsetup. Actually the --dump-volume-key >>approach has been proposed before and I agree with your conclusion [1] >>on that approach i.e. "passing volume key this way is quite insecure". >>Without patching cryptsetup, even if I save the volume key in the memory >>reserved for the kdump kernel, I need to retrieve this key in the >>userspace to unlock the LUKS device which may lead to quite a security >>vulnerability. > >Hm, where are the patches for cryptsetup, then? I am afraid we do not want >to add such specific things there. Thanks for cleaning up the text to make the discussion easier! Sorry I only mentioned it [3] in the cover letter and didn't provide one in previous reply. [3] was done in a quick-and-dirty way (I plan to send a formal merge request after finishing the kernel part) and there is no need to read it. Let's me explain what [3] does here instead, 1) After unlocking the LUKS-encrypted device, if cryptsetup finds /sys/kernel/crash_luks_volume_key exists, it will write the key description of the volume key to it to notify the kernel to save a copy of this logon key linked to its thread keyring for the kdump kernel 2) After the 1st kernel crashes, if crytpsetup finds it's in the kdump kernel, instead of deriving the volume key from a passphrase, it will write the key description to /sys/kernel/crash_luks_volume_key to ask the kdump kernel to link the saved key to its thread keyring. [3] https://gitlab.com/coxu/cryptsetup/-/commit/750a46d933fac82e0c994b5c41de40a0b8cac647 > >But we are just going to merge a patchset that changes how we use keyring >where you can tell cryptsetup to store/link key under some specific name >and to specific keyring >(see https://gitlab.com/cryptsetup/cryptsetup/-/merge_requests/492) >(Please talk to Red Hat cryptsetup maintainers for more info, >I just mentioned this mail to them today.) Thanks for pointing me to the above MR which looks promising! Unlike treating the kdump use case as a special case [3], it just provides a generic way with the implemented options --link-vk-to-keyring and --volume-key-keyring. > >>I respect the efforts from you and the cryptsetup community to make LUKS >>as secure as possible. And kdump is used in product environment. Kdump >>is to a server as a black box is to an aircraft. So by no means I want >>to reverse the used security measures and patching cryptsetup can allow >>to keep the security measures. One concern raised by you against "FRC >>v1" was a copy of the LUKS volume key for the kdump kernel creates an >>attack vector. I took this feedback seriously and have sought advice >>from my colleagues to implement the countermeasures ([PATCH 1/5] and >>[Patch 4/5]). >> >>[1] https://yhbt.net/lore/all/e5abd089-3398-fdb4-7991-0019be434b79@gmail.com/ > >Yes, I appreciate that. And it is perfectly ok if your customers accept >the trade-off and security risk of handling the key this way. > >Anyway, I feel we are going in circles here, and as it seems to be my fault, >I do not want to sound grumpy as I am perhaps missing some context. Actually I should thank you for your patience! You have been always offering your feedback on this work kindly and promptly starting with the first proposed solution [1]. > >Could you please talk to internal RH cryptsetup maintainers first and discuss >your solution? They know what we can do here can help to find an acceptable >solution. (I added cc to Ondra.) Sure, I'll talk to them first. Thanks for letting Ondra know! > >Thanks, >Milan > -- Best regards, Coiby