Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5052632imm; Tue, 7 Aug 2018 11:47:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfm7Pb72uDrLdVgsGeQscnsfQQ8EmX2WfPo2w57RzPKb0JLNFkt1Qu4WDFAz0gRQcwpHvXo X-Received: by 2002:a63:fe4d:: with SMTP id x13-v6mr19551250pgj.152.1533667649671; Tue, 07 Aug 2018 11:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533667649; cv=none; d=google.com; s=arc-20160816; b=gJBwZlFaLjz1QbT1OVRLt2Tv/K8xgNI9n4+lvf5kQ+QLKuSJVE3bb0nPXZjxceazpD CIdUPQr7moPdT/jUSkl/5i7hcmWVZMISDJbDGYcmCXrlL5GjqZqmREzgNk1ODNF2rNqy DGB70oJSP1ynM9l2k/4VamewYwZ03R2JLPLDlmkoB5aoLauRWTYZF1XgVs2j5YlCQmg3 U8zG35mw5SXkxtOZ01faqdqTPvnXCvDUM+3pTp4kfVUH2XiE6t4810YDcPIj+bSr5FNg 9Ca5NSTj3NUxVm45COYIIYEMpndtTfcx6ClDnXCaNxz1pof7Y+hsHS80RIruNE7+Yi6B GoIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=0kuaAHPPuXndq/alKPfTyPU8nu2V6r4d1iTEAAGid9Y=; b=bZT4DxM4z8n/wZzM979gkVs2ZgyqsY/uNfbekw+6L3W8OcMo7XEQUw11onrxTXU7+w lqPoYpijnrlOEJ5Vu090yMFUZY+9J6lC9C4wIABrVCTNepY0UhwmEgeQgI8V7+C8Yxnd Uaowc2XxiEK/ec6EDwa4gu7ar301TBzRYBtLa65siPq0SS3NHsagw3GqtjFFO0rATxIY zGESW3t3rQ3Y8qcTHdSWu4IOvLfXX09GU0oQ6yP3QmETPr0TsdgXjSI5s5uvt1qpqzLy dvzF6JG+J9Uymv6/WxW+KpMWaF6arZEV1ChwPKOo2dmXwSn8jDM4FAP3A8sHhGA/bXoP Psqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6-v6si1787417pgk.474.2018.08.07.11.47.14; Tue, 07 Aug 2018 11:47:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389384AbeHGSnQ (ORCPT + 99 others); Tue, 7 Aug 2018 14:43:16 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:32786 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730869AbeHGSnP (ORCPT ); Tue, 7 Aug 2018 14:43:15 -0400 Received: from linux-l9pv.suse (124-11-22-254.static.tfn.net.tw [124.11.22.254]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 07 Aug 2018 18:28:03 +0200 Date: Wed, 8 Aug 2018 00:27:46 +0800 From: joeyli To: Yu Chen Cc: Pavel Machek , Ryan Chen , oneukum@suse.com, "Rafael J. Wysocki" , ebiggers@google.com, Theodore Ts'o , smueller@chronox.de, denkenz@gmail.com, Linux PM list , linux-crypto@vger.kernel.org, Linux Kernel Mailing List , kookoo.gu@intel.com, Zhang Rui Subject: Re: [PATCH 0/4][RFC v2] Introduce the in-kernel hibernation encryption Message-ID: <20180807162746.GJ19234@linux-l9pv.suse> References: <1532590246.7411.3.camel@suse.com> <20180726081404.GG4244@linux-l9pv.suse> <20180730170415.GQ4244@linux-l9pv.suse> <20180803033702.GB416@sandybridge-desktop> <20180803053445.GC4244@linux-l9pv.suse> <20180805100200.GB22948@amd> <20180806084534.GB12124@chenyu-desktop> <20180806103958.GI27062@linux-l9pv.suse> <20180807074312.GB17894@chenyu-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180807074312.GB17894@chenyu-desktop> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 07, 2018 at 03:43:12PM +0800, Yu Chen wrote: > On Mon, Aug 06, 2018 at 06:39:58PM +0800, joeyli wrote: > > On Mon, Aug 06, 2018 at 04:45:34PM +0800, Yu Chen wrote: > > > Hi Pavel, > > > On Sun, Aug 05, 2018 at 12:02:00PM +0200, Pavel Machek wrote: > > > > Hi! > > > > > > > > > > User space doesn't need to involve. The EFI root key is generated by > > > > > > EFI boot stub and be transfer to kernel. It's stored in EFI boot service > > > > > > variable that it can only be accessed by trusted EFI binary when > > > > > > secure boot is enabled. > > > > > > > > > > > Okay, this apply to the 'suspend' phase, right? > > > > > I'm still a little confused about the 'resume' phase. > > > > > Taking encryption as example(not signature), > > > > > the purpose of doing hibernation encryption is to prevent other users > > > > > from stealing ram content. Say, user A uses a passphrase to generate the > > > > > > > > No, I don't think that's purpose here. > > > > > > > > Purpose here is to prevent user from reading/modifying kernel memory > > > > content on machine he owns. > > > > > > > Say, A puts his laptop into hibernation and walks away, > > > and B walks by, and opens A's laptop and wakes up the system and he > > > can do what he wants. Although EFI key/TPM trusted key is enabled, > > > currently there's no certification during resume, which sounds > > > unsafe to me. Afterall, the original requirement is to probe > > > user for password during resume, which sounds more natural. > > > > OK, I saw your case. This is a physical accessing. > > > > I have a question: The suspend to memory also has the same behavior > > and more people are using suspend. Should we think a common solution > > to cover S3 and S4? > > > Since STD behaves more likely a boot up, STR does not have solid > requirement for certification. In your A/B user case, when STR, B user can still open A's laptop and wakes up the system and do what he wants because he can get the console like resume from STD. I didn't see difference. > > > > Strange as it may sound, that is what "secure" boot requires (and what > > > > Disney wants). > > > > > > > Ok, I understand this requirement, and I'm also concerning how to > > > distinguish different users from seeing data of each other. > > > > > > Joey, > > > I'm thinking of a possible direction which could take advantage > > > of the password. It leverages either EFI key or TPM > > > trusted key to get it done. Does it make sense? > > > > > > 1. The user space generates a symetric key key_user using > > > the password, and passes the key_user to the kernel as the master > > > key. > > > 2. The kernel uses the EFI key or TPM trusted key to encrypt > > > the key_user thus gets a encrypt_key. > > > 3. Uses the encrypt_key to do snapshot encryption > > > 4. During resume, the same encrypt_key is generated following > > > the same steps(I assume the same EFI key or TPM key could be fetched > > > during resumed, right?) and do the snapshot decryption. > > > > > > > Yes, we can use TPM key to protect the user key. But I suggest that we > > should give user a function to disable the user key because not everyone > > want to key-in a password for hibernate/resume and also snapshot image > > encryption. > > > > Two policies: > > - When user key-in user key, the snapshot image must be encryption. > > - Without key-in user key, I still want the snapshot image can be encryption. > > > > No matter that the user key be key-in or not, the snapshot image must be > > encrypted by a kernel key. So I suggest that we treat the user key as a salt > > for snapshot image encryption and authentication. If the user key > > be disabled, then kernel just generates a random number as a salt. > > > > Actually, the kernel must compares the user key before snapshot decryption. > > If the user key doesn't match but user space still triggers furture resume > > process. Then kernel direct drops the snapshot image. > > > Anyway I'm ok with using TPM for major 'security', please feel free > to send a second version out, and for certification implementation > we can have further discussion on that later. > Regards Joey Lee