From patchwork Thu Feb 28 23:11:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 10834271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACE81139A for ; Thu, 28 Feb 2019 23:14:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C44E2FC2B for ; Thu, 28 Feb 2019 23:14:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9024B2FC46; Thu, 28 Feb 2019 23:14:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4151E2FC2B for ; Thu, 28 Feb 2019 23:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727861AbfB1XOU (ORCPT ); Thu, 28 Feb 2019 18:14:20 -0500 Received: from mail-qk1-f202.google.com ([209.85.222.202]:44307 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387732AbfB1XMb (ORCPT ); Thu, 28 Feb 2019 18:12:31 -0500 Received: by mail-qk1-f202.google.com with SMTP id o2so1040242qkb.11 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=Cb31KZ/Hd9caacw81Y0p0lPWjMLatU4EKDXN0a92NEM4MKSUXcF0K5avNx6ukJQ58o mx5kjAbJ2H5leo0yjYaYTsVp7Xa9kUPEMhqjDviWTiEPIsZtxmjaY041u9agtkN37uq5 nVoiOUnsBqZAHczHCYwnsjRaj5glYHyEMjMGtlX8bydqWQn3Kz/B1BczXcUqCoOH11c3 fLFdAl9+8MW+sisuaT2G1rBZiPbYV0O799xnNmfol8BEgPdxRF9Iwi5QFnrPsSiRSJ+j 26XCtCcgXqe8lzQHEL3rQYfslegmrH3WXNcKoDfl0q9+Ohpewv6M1qRmF/Ktxth62n3K 810w== X-Gm-Message-State: APjAAAVhcLgeurWzoBO90X2zvlcsKcgCH5D66ipdzKBoQ/UwbxswnSKM SbLIO2+RTpshxGwXeAIEqzG9cEiolnoaOEvuHAJ30g== X-Google-Smtp-Source: APXvYqzQpfa57TSK8bbnGQUeo2CjRL0Deo0vZcTr3Ki5Q9LwxiBCVwYNCWwOLgKVHp85Cd+X48GXglBT5kx+zg6IcAYxFw== 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 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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)) {