Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp843446ybd; Sat, 22 Jun 2019 16:56:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhZbuT9YeCjDRhgSe/iGz2ivLWv3WUVc336u43Ljp5mKn19R4gwuPuGk6kydVGB7d8vufV X-Received: by 2002:a63:7e43:: with SMTP id o3mr25792883pgn.450.1561247784511; Sat, 22 Jun 2019 16:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561247784; cv=none; d=google.com; s=arc-20160816; b=Ndtzno4imKv/0iOy1ETR82VGE0MwSgnrU8cAD2+eoBLjQgcUi17C3A1xHzmb5nCQ/A vmL/GFtl7fjLSEzB3DmPe4k6voARrkYdOsVIsThsYoxMP1Z7h7+tuaKoVM+zoo5HqkB0 gN3dywRfOxQ0bGoHYPNTw0dvMf1BNHAovjKIJdT0cUudJZDzykqJ6mmBHsQrbiJCB3i1 Qkp95g/p9JN33cONr+97owpDu0qEC9leMNIA1yojHHomwg9zAqp6aVay4juILM5DoeuH +rjbcsnep2ruM4idvbdtyajtFQ1NrVXlF0gLKE4ebleTvvZMGI0Gnjk1qtciy1bDSUAH OAzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SjQZBQwyRup4ZgjZsTGkIfrR8oSEkQFDWOMWBVdqA8o=; b=Ujyl8mfR85lLdMqyOVQZIK52VU+s1INOFa0k8n1zFS8jLSkaOkoBeDq3NGz5fylDmu DoqTmNqOV88LTZ85Y9Ich0wsSCcac/e4qPcorvfeacYWyjuOGpbhpzZPetocTG2HALrz D3tOspAqejFa9URy1Fuhzh5l1qPYt9Mhn+5+PLQDVmZMZAAFK8acenjuoUc4TiVdjpMn QFQvShW/sIEXI7cLaaJjC6g1NdFOdaL6nb0zoGzibiBgnIeZ4cGcYjg6W35o5B3caAxA WlpifK/+t1J1XJ5g8CTe6zzabkELTKpk1Dq/jGtm7uCV+J37a4hJ0nDnRHfsQRmoCJSg 7V8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b4yIyei7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y134si6777227pfc.285.2019.06.22.16.56.06; Sat, 22 Jun 2019 16:56:24 -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; dkim=pass header.i=@chromium.org header.s=google header.b=b4yIyei7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726526AbfFVXzD (ORCPT + 99 others); Sat, 22 Jun 2019 19:55:03 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36789 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbfFVXzC (ORCPT ); Sat, 22 Jun 2019 19:55:02 -0400 Received: by mail-pf1-f196.google.com with SMTP id r7so5437485pfl.3 for ; Sat, 22 Jun 2019 16:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SjQZBQwyRup4ZgjZsTGkIfrR8oSEkQFDWOMWBVdqA8o=; b=b4yIyei7kCqChIwyxRMK9L2ScXhNbiV5AdZTg09Edgu8KuQbWRTRVCYFKjoNewPdOz GGrNefQqTdQpIn4q+uEzPYYYwByaxqq37l9rrIWGR3STOs0jz+fmlDhNVpuLvmt3ZV8I JZAFPjyK43uqRTd+i/Z+dKZdF9+DE9UOgi7WM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SjQZBQwyRup4ZgjZsTGkIfrR8oSEkQFDWOMWBVdqA8o=; b=PpDqfaI8tUUoDwZKyUetNlYMU11EvUrSjDQ7tqvF/xOJhg5KKxcwEZ9FRHdDF2hrcD xEfLTeqamgkvhhYoYNYs/pggvCi9harCJ0fLatphHqIQehrIqJwdBJAL7hbc7KgarA3J wWeX6r7iR1uk50MYUhA6nbJyNlq1l6rFfAZwr1ZifmYCfKqodzEwIlwnTV/nLwoLKusn gAWHqIYRMJrqVbxuFg3IOxO8t9jwv3sx4s3fz7gv0+ziprWW9PcgmaLZE48UTnUm8dpt Egp298uB6kKf/2Peg++O4n12VMEhTNdlpb3gMTgvh/ZmL43EMt/Xwi+ZYyJvqI/JbKPc BA6w== X-Gm-Message-State: APjAAAXo35cHWFGEffsALLZlMKlykN5nNgr8ClFfKshV9jGiLjgSTNUO fXtUYPkvTgHIncP1ymxZad4nFA== X-Received: by 2002:a63:5a02:: with SMTP id o2mr24581635pgb.93.1561247701888; Sat, 22 Jun 2019 16:55:01 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a12sm14146254pjh.1.2019.06.22.16.55.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Jun 2019 16:55:01 -0700 (PDT) Date: Sat, 22 Jun 2019 16:55:00 -0700 From: Kees Cook To: Matthew Garrett Cc: jmorris@namei.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Josh Boyer , David Howells , Matthew Garrett , rjw@rjwysocki.net, pavel@ucw.cz, linux-pm@vger.kernel.org Subject: Re: [PATCH V34 10/29] hibernate: Disable when the kernel is locked down Message-ID: <201906221654.99E7598@keescook> References: <20190622000358.19895-1-matthewgarrett@google.com> <20190622000358.19895-11-matthewgarrett@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190622000358.19895-11-matthewgarrett@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 05:03:39PM -0700, Matthew Garrett wrote: > From: Josh Boyer > > There is currently no way to verify the resume image when returning > from hibernate. This might compromise the signed modules trust model, > so until we can work with signed hibernate images we disable it when the > kernel is locked down. > > Signed-off-by: Josh Boyer Reviewed-by: Kees Cook -Kees > Signed-off-by: David Howells > Signed-off-by: Matthew Garrett > Cc: rjw@rjwysocki.net > Cc: pavel@ucw.cz > cc: linux-pm@vger.kernel.org > --- > include/linux/security.h | 1 + > kernel/power/hibernate.c | 3 ++- > security/lockdown/lockdown.c | 1 + > 3 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/include/linux/security.h b/include/linux/security.h > index 00a31ab2e5ba..a051f21a1144 100644 > --- a/include/linux/security.h > +++ b/include/linux/security.h > @@ -85,6 +85,7 @@ enum lockdown_reason { > LOCKDOWN_MODULE_SIGNATURE, > LOCKDOWN_DEV_MEM, > LOCKDOWN_KEXEC, > + LOCKDOWN_HIBERNATION, > LOCKDOWN_INTEGRITY_MAX, > LOCKDOWN_CONFIDENTIALITY_MAX, > }; > diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c > index abef759de7c8..3a9cb2d3da4a 100644 > --- a/kernel/power/hibernate.c > +++ b/kernel/power/hibernate.c > @@ -32,6 +32,7 @@ > #include > #include > #include > +#include > #include > > #include "power.h" > @@ -70,7 +71,7 @@ static const struct platform_hibernation_ops *hibernation_ops; > > bool hibernation_available(void) > { > - return (nohibernate == 0); > + return nohibernate == 0 && !security_locked_down(LOCKDOWN_HIBERNATION); > } > > /** > diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c > index 08fcd8116db3..ce5b3da9bd09 100644 > --- a/security/lockdown/lockdown.c > +++ b/security/lockdown/lockdown.c > @@ -21,6 +21,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = { > [LOCKDOWN_MODULE_SIGNATURE] = "unsigned module loading", > [LOCKDOWN_DEV_MEM] = "/dev/mem,kmem,port", > [LOCKDOWN_KEXEC] = "kexec of unsigned images", > + [LOCKDOWN_HIBERNATION] = "hibernation", > [LOCKDOWN_INTEGRITY_MAX] = "integrity", > [LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality", > }; > -- > 2.22.0.410.gd8fdbe21b5-goog > -- Kees Cook