Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753268AbbDFNaE (ORCPT ); Mon, 6 Apr 2015 09:30:04 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:34252 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752847AbbDFNaB (ORCPT ); Mon, 6 Apr 2015 09:30:01 -0400 From: Pali =?utf-8?q?Roh=C3=A1r?= To: Mike Snitzer Subject: Re: [PATCH 0/3] dm-crypt: Adds support for wiping key when doing suspend/hibernation Date: Mon, 6 Apr 2015 15:29:57 +0200 User-Agent: KMail/1.13.7 (Linux/4.0.0-040000rc6-generic; KDE/4.14.2; x86_64; ; ) Cc: Alasdair Kergon , Neil Brown , "Rafael J. Wysocki" , Len Brown , Pavel Machek , dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org References: <1428254419-7334-1-git-send-email-pali.rohar@gmail.com> <20150406130045.GA18583@redhat.com> In-Reply-To: <20150406130045.GA18583@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1933368.W9vSGLKYyh"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201504061529.57299@pali> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3937 Lines: 101 --nextPart1933368.W9vSGLKYyh Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Monday 06 April 2015 15:00:46 Mike Snitzer wrote: > On Sun, Apr 05 2015 at 1:20pm -0400, >=20 > Pali Roh=C3=A1r wrote: > > This patch series increase security of suspend and hibernate > > actions. It allows user to safely wipe crypto keys before > > suspend and hibernate actions starts without race > > conditions on userspace process with heavy I/O. > >=20 > > To automatically wipe cryto key for before > > hibernate action call: $ dmsetup message 0 key > > wipe_on_hibernation 1 > >=20 > > To automatically wipe cryto key for before suspend > > action call: $ dmsetup message 0 key > > wipe_on_suspend 1 > >=20 > > (Value 0 after wipe_* string reverts original behaviour - to > > not wipe key) >=20 > Can you elaborate on the attack vector your changes are meant > to protect against? The user already authorized access, why > is it inherently dangerous to _not_ wipe the associated key > across these events? Hi, yes, I will try to explain current problems with cryptsetup=20 luksSuspend command and hibernation. =46irst, sometimes it is needed to put machine into other hands.=20 You can still watch other person what is doing with machine, but=20 once if you let machine unlocked (e.g opened luks disk), she/he=20 can access encrypted data. If you turn off machine, it could be safe, because luks disk=20 devices are locked. But if you enter machine into suspend or=20 hibernate state luks devices are still open. And my patches try=20 to achieve similar security as when machine is off (=3D no crypto=20 keys in RAM or on swap). When doing hibernate on unencrypted swap it is to prevent leaking=20 crypto keys to hibernate image (which is stored in swap). When doing suspend action it is again to prevent leaking crypto=20 keys. E.g when you suspend laptop and put it off (somebody can=20 remove RAMs and do some cold boot attack). The most common situation is: You have mounted partition from dm-crypt device (e.g. /home/),=20 some userspace processes access it (e.g opened firefox which=20 still reads/writes to cache ~/.firefox/) and you want to drop=20 crypto keys from kernel for some time. =46or that operation there is command cryptsetup luksSuspend, which=20 suspend dm device and then tell kernel to wipe crypto keys. All=20 I/O operations are then stopped and userspace processes which=20 want to do some those I/O operations are stopped too (until you=20 call cryptsetup luksResume and enter correct key). Now if you want to suspend/hiberate your machine (when some of dm=20 devices are suspeneded and some processes are stopped due to=20 pending I/O) it is not possible. Kernel freeze_processes function=20 will fail because userspace processes are still stopped inside=20 some I/O syscall (read/write, etc,...). My patches fixes this problem and do those operations (suspend dm=20 device, wipe crypto keys, enter suspend/hiberate) in correct=20 order and without race condition. dm device is suspended *after* userspace processes are freezed=20 and after that are crypto keys wiped. And then computer/laptop=20 enters into suspend/hibernate state. =2D-=20 Pali Roh=C3=A1r pali.rohar@gmail.com --nextPart1933368.W9vSGLKYyh Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAlUiilUACgkQi/DJPQPkQ1KklgCgywqcKHqUpcj/IA+R8ff8bVBf vE8An1j2X42WqynGPflzaB42WKUBqn9X =dMDB -----END PGP SIGNATURE----- --nextPart1933368.W9vSGLKYyh-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/