Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4526769imb; Wed, 6 Mar 2019 16:00:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwlRUZJpRndsuCayTAVWgnsM0bCdM2NUrR9m0MABPqupDFrzBfwJr0ci3W7mz5n2XrDBmYp X-Received: by 2002:a63:d347:: with SMTP id u7mr8833668pgi.269.1551916854032; Wed, 06 Mar 2019 16:00:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551916854; cv=none; d=google.com; s=arc-20160816; b=Z4Q+hFCvWLB3sID0FTg79O44OfmxSXvAB95YLKV8e5Vk0/he+EXzNvnbChLanX89wK mNEO9+bhdwviyGJ41vhUoIQ0kkMrZStQC1s4aUVOkbBNxmG+T61lAuKaWFYDDXnNy4cw FNBfU3hiW5n3Y/B7RjxHDsJZo8vweSz792sEiSOdPddikRmpa/YeuFtzoR2kjY+rQ3wE MLlttt8vGlw0lTiZcm4HIGSFZXdgvIV84rEpVFLWJN7pHSeFii9TrlSTFq+pevpgaaHi XDaosznFsacK660G6ljabkOr+AB4I2x9mkGOIH15XhnvKRtfJekvQbO89h/YqgjJEQqQ DV+w== 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=JJMzCu+QpYD9Z8bckP0m6/xbjWctPMS7pd0b7hNmVSQ=; b=v7Vr4h66wTI+M31xTuS99gYDSsaoo3dHL5fkQ/iREat7slkBKa0OB3WownRNEygQwn lK3FMBlj3pzAuIypYTZZ3wzPlXAyG0J5s1D5LDa3Bi8rKIBR3gqy1n3yRLd+u22Ii237 WCywFIoj3ZZM00o10Wzw61057A/qHxnwCa+08i1o2rduCfrziJVKyz6H9a6Dd7+gUYaz L7n8wAYjHGQzld0GCZsYyNSYMEi7GwUuh1jegatMB4eRbSw/zJxAn5T42NHJ3gPjhJ72 ro+jQxSeBrAhL29ST3lIsfRe2E0RzFTRoR9ZjLSJhWQDJPANpha/oj6G9JbPPYqSIYxB Q4vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tLboHTMM; 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 y14si2630508plr.78.2019.03.06.16.00.38; Wed, 06 Mar 2019 16:00:54 -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=tLboHTMM; 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 S1726498AbfCFX7y (ORCPT + 99 others); Wed, 6 Mar 2019 18:59:54 -0500 Received: from mail-yw1-f74.google.com ([209.85.161.74]:34714 "EHLO mail-yw1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726445AbfCFX7w (ORCPT ); Wed, 6 Mar 2019 18:59:52 -0500 Received: by mail-yw1-f74.google.com with SMTP id y129so20874600ywd.1 for ; Wed, 06 Mar 2019 15:59:52 -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=JJMzCu+QpYD9Z8bckP0m6/xbjWctPMS7pd0b7hNmVSQ=; b=tLboHTMMoMV+yRf3rMjN1/hTQNg/8muTL2AwsTexQzcvw3NgdeYfhtTcpiJqFfIUB0 37eVsZnj2OHgLGKYMUaoTIjBxEyPUDRdn+d4GtnwAuLkNDndOXzUxAneLXi5m0ocs9cY 8/iiGPiCS4IHrBXgVjfoNrehXn58s6SKrlaQq3Xp0VQD95pUZPnZlBX14hu9F4J4qocJ CL8cUZvbqaAj3lvvbYvEjZJowX1ZxeAAF9iJEJmMZs2yLtbDwFrM5iQE+n7t0zy8lPyv Abr86iUavjIxK/vFIqmKm4uxNNaO2dosOCi/oMgW+ZL1joZj0fOxNgjte+HsXLqPjvGF BpKQ== 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=JJMzCu+QpYD9Z8bckP0m6/xbjWctPMS7pd0b7hNmVSQ=; b=bKTJPNjuRj1y5aOfg7i+qK5GA8Zvd24cnd7/ORr59ivJ9MZxuSVbVwB/0M8FW6HlmC KqGMngIXnew8NZZEMkV78gJVyRWe63Nw322A4zRMrfU98KXgmhCrUzI0sTwju/LIAK6Y iOT0ccddWb9UiNBJSd4/87gebb+B0RY0vGzc/Ax0puE2eceJjW2K0rLA0o9Jxysso0E+ E4SDlwBJ/m5BXZpwB8cMuy3UX6eA8hC0h7ccr+WbCRzRL6K8E0TvmvwRp5veC8aecChn M2ovlQmeCxovNN76+Q0Ozz4TANOS0m5vZRH5DnyR1jaE9Tb4QD9+3/Nz2tXmYe/a/WmP H0Bw== X-Gm-Message-State: APjAAAWzEh/tjYjk8QnVxipxBcXUQGsjOnZ8jLtFHQHUXqKukHNXyGV2 C1vbfXZiA29/2d/qD3GfKDjF2pdR6uLCUcN8gim+qQ== X-Received: by 2002:a5b:44e:: with SMTP id s14mr1091714ybp.55.1551916791554; Wed, 06 Mar 2019 15:59:51 -0800 (PST) Date: Wed, 6 Mar 2019 15:58:56 -0800 In-Reply-To: <20190306235913.6631-1-matthewgarrett@google.com> Message-Id: <20190306235913.6631-11-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190306235913.6631-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 Signed-off-by: Matthew Garrett --- 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