Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3662411img; Mon, 25 Mar 2019 15:11:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGT089ESegmscYFSD8SL4xphSjwA3PkhTNBZEdewlezE68QJKvFC7FxcAYl31zmFjp+Jj3 X-Received: by 2002:a17:902:586:: with SMTP id f6mr27099060plf.68.1553551895279; Mon, 25 Mar 2019 15:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553551895; cv=none; d=google.com; s=arc-20160816; b=cKayi1EYDDdRi4X3mqqFZClpRWHQK5Gi8Tnt4/kfCe+fzwv6+zoDHKsUI0U+lscE9+ NmJdeUynqBnxseVKhxc1kSDcKGZOp80LAi/a5C/yVcs7x7MF2mysjNPEB78yIZcDGczR nnjQG1pKargR733vvtyTKIzKDLOgkvaHaaCPAkSWpTcw1h5duf3goXJRI8hP9/0yWSaO ptjXA1+x7XLupJuZIHLeJj0zqfEH+gPl7TZn/H34Py9fINoLBSFofUKcfzEPsyEvexJq pK9KWFd8Js8QuJFAuPKQGc4IxC6HJvzO9le0App2f6rpUpYDCbKFLwV8t2o3U4ZksyZA eKtg== 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=xS16JMOxZwcG/rVliMetOoh+ZZR4mUKe0/mNdxJ1B6I=; b=KwdPGDp+he1xCtBDpfLrhl1GGlu+9R5fXvYgxhqWZ1I7XTxViMTOZWHTC8DimWOQfv FXP23N71rJ3ubXLK5bxybLpL+lqiRh1ega/M39t+V/9WY+R0M2oZFLEV3jNxLcpQwbGD sO+dmrFaXlnSFyBo1GLsJJyIrMHe39T6E+1zOEWGgEWB/F+4//QtmeiHaVwGYDotFhkj ZzuZU0qAoKUigx70HQ68AEl/MV0QT+043ZrpVQfPx4boyK+Q80HU/N+Ns3DrjmlvCm2U cYvAyFQxS0hl8lrvGN4uXGJNeg6BTYbSjCkIKMJ/7fNLSOui3XV9XCpG7y8Ig5crMbzz sg7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rFLwckKv; 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 r35si14543101pgm.179.2019.03.25.15.11.20; Mon, 25 Mar 2019 15:11:35 -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=rFLwckKv; 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 S1730877AbfCYWKZ (ORCPT + 99 others); Mon, 25 Mar 2019 18:10:25 -0400 Received: from mail-qk1-f201.google.com ([209.85.222.201]:46764 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730820AbfCYWKW (ORCPT ); Mon, 25 Mar 2019 18:10:22 -0400 Received: by mail-qk1-f201.google.com with SMTP id 75so9936144qki.13 for ; Mon, 25 Mar 2019 15:10:21 -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=xS16JMOxZwcG/rVliMetOoh+ZZR4mUKe0/mNdxJ1B6I=; b=rFLwckKvnZaBZEGlLyTz4YcQ5TpfXquDDLFv8EpNBBi8bl0H0aSpKbKlPmFsmJzv88 3s6m1iSnNGuRtAX7+GNWd2g9ka8O638ik4FPSJBJV5pRYd6bDqXfhUVknENqAjwj4phg ZBeThTpXCyvDIvKExlijnHhU7emouiyrTRHxYNNujKIPbNen6HUgDtriMiWILJkoVwSA VVGV8s5Vdp2kHgLsYghn2sBzhcQ4djG3Mg4picl1KnN4fEcpD276WFgQ7ohf4Qa5elqa AgffeNZduS1YSvn0RL82wvaNQg89a0p0VKGWQ4w6kG9QkJsl5oAYX7uvYcn10rHNeQC/ FZkA== 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=xS16JMOxZwcG/rVliMetOoh+ZZR4mUKe0/mNdxJ1B6I=; b=TbS4r+YvtCqHY0QN185RJNyEGN/4Eb9NJFYPFJLgsLigNRTx4YYocwqaP0S1z4nHdv iWRSr/0CKFJ7hhQXVUdmy3ThPIgb6HP7U/HEaWdS9tLftCqWqDklnniJpFwrRLz6pC6M AQK1b3SmoWr5eE4hqjhXhoYw7UBF+9q1TN31WRFA0e6g5yg9EwWI9bPaYDu3FV0AeXjg J3CP+0UmpaWc82cmI1ytNI28xh8u2rXc4TS/OnQ/zbwlUYSiUM+NWcmiRGMXY+43R1CP 4e6kjzjDifDTwb0SLTWqdvw9UsoFCyYn8AKaynaa0ig7KkSYiyq6l60hgP6Z6o/i7Uh/ Bc7w== X-Gm-Message-State: APjAAAVI75t5ohyPsAHeivadBFVIOjZ2izDIiiB9n2GFznhTCpH3NOdC a5lEzbr+EtNXA8XIqlF3hHDoXKP0Ha6WNzp+0waCiA== X-Received: by 2002:a0c:8aad:: with SMTP id 42mr23012965qvv.247.1553551821400; Mon, 25 Mar 2019 15:10:21 -0700 (PDT) Date: Mon, 25 Mar 2019 15:09:36 -0700 In-Reply-To: <20190325220954.29054-1-matthewgarrett@google.com> Message-Id: <20190325220954.29054-10-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190325220954.29054-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH 09/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, Matthew Garrett , James Morris , linux-pm@vger.kernel.org, pavel@ucw.cz, rjw@rjwysocki.net, Matthew Garrett 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: James Morris cc: linux-pm@vger.kernel.org Cc: pavel@ucw.cz Cc: rjw@rjwysocki.net 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.392.gf8f6787159e-goog