Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp43726imb; Thu, 28 Feb 2019 15:26:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IaTq8Mis8XGzE5kxlVHlPrPhj6cw6BND99HmR/DTy3ofVaio9tfbxrOmfFtQNPA91PsNzUS X-Received: by 2002:a62:564d:: with SMTP id k74mr2235933pfb.19.1551396386298; Thu, 28 Feb 2019 15:26:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551396386; cv=none; d=google.com; s=arc-20160816; b=meWeVEn+P6PC9I/Mdb67bS+4mfSdVB76VuXF3lOnxeCcJ+DYWcqbNZgX31oqRVz1pq 5H9prVSoHsf4JVrnd6iV0U54oePXUyn1djh5d1JIuge+40plRbAsWTsmFPzBzOySz3Fr nSm/MoPE/53T41NbiiCQp3K3+b0RxNGLjld3106QTYlUrrWlA+n54cB6hVhVo6HL0Vjq pj/2G25MhCoOFG6oLCshNBiUjSAfyoMx/CvHwwNrK1/SnM01xW8/Uxw8+EDVyo7F18uk F3ijQFIwqZGuuyVr0O81KqxaKOLArIzf3A3xuTr4iSry5q6W6Z2sGoq5qZx5KHzPxy42 LJsg== 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=F6zxXD+nTPfsZfQbyiR2ANcc9A38R04iH+muysUyqZY=; b=XTkxMkL5E0k9YIQIypXS/VYLpl2IbqzCFarxS2IfS7ld2GkSX7lXcaHr3LQPvF6XQ9 csKhGenpsl5ICZ6bo9wbSuYitVUn9kzMiUc2r61shV/PUDq8V++91Z9l2dbqQUOSWX5y EyGrqbR1uTA+8h9g+FL8F5z1GGyiP10kl3fsxIr8ZBhzTuh7M2LzrgGAsI3dG+rBCyUq Pjgws7aRcKbvYAMpzSs7TxmkxvdicGvkru9GlwMLshNYm9n4ADGhKzePKM3G5gk+uyil 9dkx482MNYSVLC9T3JzbFcJodD20RK/OX1zpVs+rHeSplFV3C8iDPnWQwCTZf5CN3MN3 u+GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rqy8vjp1; 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 h18si18581991pgj.479.2019.02.28.15.26.11; Thu, 28 Feb 2019 15:26:26 -0800 (PST) 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=rqy8vjp1; 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 S1731820AbfB1XOV (ORCPT + 99 others); Thu, 28 Feb 2019 18:14:21 -0500 Received: from mail-qk1-f201.google.com ([209.85.222.201]:52338 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387733AbfB1XMb (ORCPT ); Thu, 28 Feb 2019 18:12:31 -0500 Received: by mail-qk1-f201.google.com with SMTP id k21so12225435qkg.19 for ; Thu, 28 Feb 2019 15:12:30 -0800 (PST) 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=F6zxXD+nTPfsZfQbyiR2ANcc9A38R04iH+muysUyqZY=; b=rqy8vjp1yaqAU5BNxNa+MvsSVvcaRzr5lInb84HYbk4bKsE1qZ5Kdhh6iwvWec6VQI Np0PGekQ4lc9JNlPa7Kxi8g+sTyR9WDN0BAB8LElq4VRXg9ZSpNOYJGbXDOvllPDroQN 2j/vGXeZFSbT3AqFzebVnIlnUd30MR+dw+CcWu+lHBkdhWoN9G+2jK/jxwszpTlaMq7b ScY+uB4+r5cbc4LO3RDnYKxygYSd7sH/q5w5hlbyufWWwC06HjE/XFwuCWyA4ATNAV7N Xz45Z+siZGWFacREImKXDG2LLH2L8raULbzyeoCyNOUfh6xq5Qa6YtY8SD3ll41nWY2V FJGA== 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=F6zxXD+nTPfsZfQbyiR2ANcc9A38R04iH+muysUyqZY=; b=NN8Evj6Z6ADC902AtivOuUpGZosY7EwMLKK1NDrK9uoxNW9ih99d7ZwiN/2E+5ocFk l0vs+ZEMd/yRY03od+OasTzZaMYwOvXK25A8o53KCg5yTxjGWnTNxPgktOCOsAzqvm/i OzA41mNG11dIQ0x3rYqfU3u8eOoWvC+9vwW5tKNEcpoAVqKQOM5ZwNi+ZaOKFtp8J7Yt gUQwJgCfsJ7c3vw7dOQ/BtZ/E/NOonGol1XlbMJs6nvHkD2Wt3b8BOx90KsirdsHBKJp 3EX6Cm2w+DNOX5nsrHVKjusiUoe8iYvsFgOvHUh0YxwPBz5HzYic8DDjOfjv9DG9VXnz Y9Bw== X-Gm-Message-State: APjAAAWTwp4DN+BEIU/SkLtlUmCXAtPZcnByOtG4erfpt9ZYGQxEjIWB g+swpsZH6y/+1xhSxg3TfrzLw3uX/EvV/WmlSqbWEA== X-Received: by 2002:ac8:1b68:: with SMTP id p37mr1177129qtk.50.1551395550264; Thu, 28 Feb 2019 15:12:30 -0800 (PST) Date: Thu, 28 Feb 2019 15:11:46 -0800 In-Reply-To: <20190228231203.212359-1-matthewgarrett@google.com> Message-Id: <20190228231203.212359-10-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190228231203.212359-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.352.gf09ad66450-goog Subject: [PATCH 10/27] uswsusp: 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, dhowells@redhat.com 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: Matthew Garrett uswsusp allows a user process to dump and then restore kernel state, which makes it possible to modify the running kernel. Disable this if the kernel is locked down. Signed-off-by: Matthew Garrett Signed-off-by: David Howells Reviewed-by: "Lee, Chun-Yi" Reviewed-by: James Morris cc: linux-pm@vger.kernel.org --- kernel/power/user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/power/user.c b/kernel/power/user.c index 2d8b60a3c86b..0305d513c274 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -52,6 +52,9 @@ static int snapshot_open(struct inode *inode, struct file *filp) if (!hibernation_available()) return -EPERM; + if (kernel_is_locked_down("/dev/snapshot")) + return -EPERM; + lock_system_sleep(); if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { -- 2.21.0.352.gf09ad66450-goog