Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3353645ybl; Mon, 19 Aug 2019 17:20:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwupoUF9aS2+s6Qvc4bOSCFCD0jHZRP7jrnD1WkCaQZergEhoCNDbfNMknw4wLw29Imy/ZI X-Received: by 2002:aa7:83ce:: with SMTP id j14mr26696376pfn.55.1566260403211; Mon, 19 Aug 2019 17:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566260403; cv=none; d=google.com; s=arc-20160816; b=RM28/FwN/m2ysGySekNmQb3asIbqLmGCcxBDKwJKTcf1Xwj+pCuCYR5gqxjf6TE61r b9UbeQ/LjMRiLMcXZY5VHeoucpqXtqvRtCXPe563B3hNASMB0wPobvSFpJNrXR4JEhh4 RxDMB1EvqIP5B+Kw0agAJmdTRnWF8VoRsu7NOD8b2rnk60cm6N28gxhZXj7UMDshxFpF 7YIp+Hpeeu5V12LEKtDq+1wKrCaCoRxHQlaVmtqcYYQTrhFvFyfr4OrEugkh24+xptqZ otHXM7miyTbH/icKimc42/O8xoOBNOLLBSJNZgsqKhD1rx+vz3BFRT+h49v/MKWURie9 JLVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=dNVh2iEH8Vj5QaP2UTGBHWYWiLKLUyALWKFvKJ3rNPk=; b=OJB66mxUPPJWNipcBWVu4dyG4wH96kzEODjHFn7xETyM5ke/XrEesDwBdoBqn92OnJ 1K8DTNmzSq0QERNEYr1ZuIONBfUmF8RzguV+EpFrMviRYOpjCF9eMfkl05GRXUM/Kslj Z8BCd+RLAJlXc/z8wBT/KoH05cEWLYUM1WIgpociM7sRPUiy5nQ4D99a+q4XS486Q1hW TeqULzrOEL5wOPnsc4+gyQ7ej6QvHGITrKyqcUMiUu/XPqhT7zknUrp/dvfEY2Tvd1gz TcUirDhphOxX07wcTpMUELMi21J2cqiK+IhuSvVnwBGTbqj07/3bkOaI/mKYe7H76MKs k9OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=s+DzVRUa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y20si10808768plp.335.2019.08.19.17.19.48; Mon, 19 Aug 2019 17:20:03 -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=@google.com header.s=20161025 header.b=s+DzVRUa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728998AbfHTASk (ORCPT + 99 others); Mon, 19 Aug 2019 20:18:40 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:33357 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728984AbfHTASh (ORCPT ); Mon, 19 Aug 2019 20:18:37 -0400 Received: by mail-pf1-f201.google.com with SMTP id r130so3533556pfc.0 for ; Mon, 19 Aug 2019 17:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=dNVh2iEH8Vj5QaP2UTGBHWYWiLKLUyALWKFvKJ3rNPk=; b=s+DzVRUaCC07PkCzszpSdYfvTDGl8hxUTCDu/FpF5b4WNQAmCbk6BOrwtJXUoFR6Uz qKm/vW6UcajgcQNbuCy/wUqoTzb68lOw8pytLYFdDjt3L0bszBv6MJlhpX/W5PUC9TpY 8AX7s/PxVrj8PbsOCZi0M6Dwr0BexH+KjnuS/B9q0DCyAkJ9k9Og7T4oCTwqUM3loX8X APyKduoOLI+CQCWk+EDINB1/1Sy/dGLCuGyBGFyMwA8wNU1tWivpS7m1mJNEdM/ahsl+ 888b9JvYy2AlusJGjtmnpS9xM8sUy6qm69rS3ahSS5Hw/shTovUguhjEUiK5vOG3eo0m 1c+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=dNVh2iEH8Vj5QaP2UTGBHWYWiLKLUyALWKFvKJ3rNPk=; b=Wzrn+voYTJMq5XUes3lM+ms9WRxruulG6POTFlNN+gn+SGiBWYaLoLdwlFGq4NgJXG 6GqExKXdm6PmsS8zMvD2YXqWFPLgtbEzK1BdweQd9zYaVwMsB+qItS1VYWY0XGCdki/E 8fxHab1/enICBIU1rvUjYjJLCsHEMPYqoYcIePpspiOW220ie6Buz3P5eB1QaJv4+Hu1 h2y5/R1AsinlNIkpVPgUFMFSu1WZEBRGDvA8yvAhKvtMWCPPp+BnQevMhZh6UZ73UGWL 4jZQdJhg2eDgRCuAnaRsU53gANLEwPDe/b0I6/0Oi8hvSCFPdt6vApG24YdH4ZF1uctV q4Ag== X-Gm-Message-State: APjAAAWfOJsOQiiQkIQjxXqqxMWtuZ8brQLHqTIzJKUCIz3KEyoDWyq3 /Q3Z2AzgcSill3aaG6/tUZ815LUXAFi2nuyRUOPY2A== X-Received: by 2002:a63:e48:: with SMTP id 8mr21980312pgo.389.1566260316132; Mon, 19 Aug 2019 17:18:36 -0700 (PDT) Date: Mon, 19 Aug 2019 17:17:46 -0700 In-Reply-To: <20190820001805.241928-1-matthewgarrett@google.com> Message-Id: <20190820001805.241928-11-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190820001805.241928-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH V40 10/29] hibernate: Disable when the kernel is locked down From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Josh Boyer , David Howells , Matthew Garrett , Kees Cook , rjw@rjwysocki.net, pavel@ucw.cz, linux-pm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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", }; -- 2.23.0.rc1.153.gdeed80330f-goog