Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp13840ybl; Tue, 20 Aug 2019 14:44:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVltiCKw4/rDb4hWy4sqq8p2FLLOo8xgRBI6V0H5uvSxrA1TPB40GoNlNr8Dfv1OUNnzcg X-Received: by 2002:a63:2b0c:: with SMTP id r12mr26439867pgr.206.1566337467348; Tue, 20 Aug 2019 14:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566337467; cv=none; d=google.com; s=arc-20160816; b=MyNoxMkcie8WzVsDQM1RNx1EKI5oGd2/7743LBNfhCKRrOvNvHS8YemyJt7CKZWVBq 6jXs8W2FpbfN7f4C5dCaqAPScng5yRof52+bATgxErkQ5FCzB34PzQvFZh22st5fn9+e Qgx8m/nLFKgbSdSxl5rUZ+1vf00vz+JEmHEFxQB6C5y2iZ4ZW1eGtkT5810k6ck10uGV usu/FYKrznHxv3sJxOhLvY7pVb01XLgWgTa4C1WtDY1ZsRaF/KFiHG9b6D04fHKm9mBk abe8GWMtNrJBE5H+AbfleadZyqYDjK0G3ED5wadGZfjXX8buual5NjD7kswQTfwrJZOj KKvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rDWeJUJz4KABwbYHuiZm68wDBjhAVvLSXIGgAgCXU8I=; b=aqdctwadRZ6jZ5DlyAw7/2o345r+3BWxwDDm2MXCUvpQMThTuK0863fK0qjA/rA+tJ ySxoa+vKK+rnC3yNPus9DevV1iKJlGekGUNmENCGt+J15eeslRJo6riuivIwGQ2pTODu ZA/X2K5lyTc0rb+uPN9Gi6vQniaYUz/o9DhBKEcUzlC4Ua1c3bookaU+B830/p+2Vz3i x6f+pwCdiahKRNpGGbSynO9Sg4T6qaPBymdXuypCVG4Xgy475SiuS9BnvCmKpSWvy7mC qCPQ+24DVFOkys+ga/2n0QS9kKT1vQmh6F3YGNZmrTal4VI1qopdNC8uaQQiI9vqXSde x/4Q== 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 t15si13103797ply.162.2019.08.20.14.44.12; Tue, 20 Aug 2019 14:44:27 -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 S1730906AbfHTVnL (ORCPT + 99 others); Tue, 20 Aug 2019 17:43:11 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:53468 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730811AbfHTVnJ (ORCPT ); Tue, 20 Aug 2019 17:43:09 -0400 Received: from 79.184.254.79.ipv4.supernova.orange.pl (79.184.254.79) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.275) id 9f5a329664f2f650; Tue, 20 Aug 2019 23:43:06 +0200 From: "Rafael J. Wysocki" 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 , Kees Cook , pavel@ucw.cz, linux-pm@vger.kernel.org Subject: Re: [PATCH V40 10/29] hibernate: Disable when the kernel is locked down Date: Tue, 20 Aug 2019 23:43:06 +0200 Message-ID: <2636170.u2GatYtffq@kreacher> In-Reply-To: <20190820001805.241928-11-matthewgarrett@google.com> References: <20190820001805.241928-1-matthewgarrett@google.com> <20190820001805.241928-11-matthewgarrett@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, August 20, 2019 2:17:46 AM CEST 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 > Signed-off-by: David Howells > Signed-off-by: Matthew Garrett > Reviewed-by: Kees Cook > Cc: rjw@rjwysocki.net > Cc: pavel@ucw.cz > cc: linux-pm@vger.kernel.org > Signed-off-by: James Morris Acked-by: Rafael J. Wysocki > --- > 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 b607a8ac97fe..80ac7fb27aa9 100644 > --- a/include/linux/security.h > +++ b/include/linux/security.h > @@ -106,6 +106,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 cd7434e6000d..3c0a5a8170b0 100644 > --- a/kernel/power/hibernate.c > +++ b/kernel/power/hibernate.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include > #include > > #include "power.h" > @@ -68,7 +69,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 aaf30ad351f9..3462f7edcaac 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", > }; >