Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4544213img; Tue, 26 Mar 2019 11:29:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqytCrk3pQ8nF62d5VpusNgGf4jJ1ll+SED7/x4Q/uhVFWsc8c2jAoxjthyB1vQqRpemTG/f X-Received: by 2002:a17:902:900a:: with SMTP id a10mr33393115plp.183.1553624967987; Tue, 26 Mar 2019 11:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553624967; cv=none; d=google.com; s=arc-20160816; b=ESmRHgLSSvQaBNKaHf/6F++bsCxUaNShLCnPTH8y9RCaGRZb5Gtoognvm16qjqXL7Z hJa27FYio5U8V1y8ILsTax0udmflns+pib9Brk2BnJ7ZnXJ78JCyHR1BuX/vIqXnHzxJ PLIZpXJ8Tb0ekpiQA8O2ZvPR2VOsFZySh21II3JU4lo8LUBu55M07qcVe7BAuql8ipji WAIEzlCDTtVcRtcVAiGZSrngf71IFCqYq6ZqpMSesCq0lm+9WA4xH4WUi1Ef3JGGMZgQ a97LPcoGqSP0LncIvUVZtOfUMHOQAtDPqJhaiXLRD2nDQ46YzgUCghqAGxGyI0Sn6G5R bS0A== 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=UWUYbOZniscPzPib57I8cPwH1j1zNPSziYufzU02lOY=; b=SMGgKFVU6Y5m0QcCtiAtEu3l9gDlDonu94jiPx8IPmO1Na2d18pInBU8XqIFWm6TO4 FqYLJ6V47oN9jaFj+D36BwVrAFMTzVyW3OmqYgxvXzPoH1EweXjs3vScNrK+Wod37181 3QWQ4UGx9Dy+AqSZ/2G8glKKaZSDcIxmxR3V7FCFA1Vnoxv4vIvDmwCBtf/NGTKOKg5z s0KXQV6AjI/ZI9AUUF1hpTDg4+vP3RJR/RFz+0XKQqH47vxPbgwzhOXnPyibBjft21T0 Q55C4eCOn/3FCj5ioC5/cADJVbWkOY8zz31yCKkYNwCoBikgEC5/Y6dk4IR/p8tSL8qZ eyvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Oz9kzY7d; 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 d4si16706934pgk.501.2019.03.26.11.29.13; Tue, 26 Mar 2019 11:29:27 -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=Oz9kzY7d; 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 S1732679AbfCZS2U (ORCPT + 99 others); Tue, 26 Mar 2019 14:28:20 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:55895 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732665AbfCZS2T (ORCPT ); Tue, 26 Mar 2019 14:28:19 -0400 Received: by mail-qt1-f201.google.com with SMTP id h51so14375447qte.22 for ; Tue, 26 Mar 2019 11:28:18 -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=UWUYbOZniscPzPib57I8cPwH1j1zNPSziYufzU02lOY=; b=Oz9kzY7d3lv55fVkI6Kb0Gzd3zJwJVSAVP1ulUaw9XyfUgwUTFQ69SW1TpPJkSkz4I 8NUL2BguYiSmd8NFIwTgZKd7UB7lU8F2hm+SV82c1BpjE00Nve3eEAV5dCvYM6U0Adft 8cHrLisTQIpYkEfVr7pSsB7vKPAWYQArSJSuLNv7EWxW+QmxHN7LZdgApdkQI107/Ow2 GZ3GQday6ZqELcHEK3ZUIq2VgMJhr6I6/cma2bxfcIUaCW826/CfZVTmkThJ3vczr5og R+xZyn2RY8eloJabWhb+3U23suPmtoBLFDiFAW2oz2cFDyDctnrk/MCbULdQ+P4rFbUa 32UQ== 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=UWUYbOZniscPzPib57I8cPwH1j1zNPSziYufzU02lOY=; b=o/Wd23G3vp4ZeuiQ+Jd4Xe4JFjB290GjMEjk6NkfZXu4PZau2DnT5qtwOs8n4c6eVR S1uForDS7vX0xl9F5vtDaoxrPUeceF7ys79WrVf7ioApGrhOmjpZiw4IYuktOMOvwZVM z7TS/dJRY7HTMm4IuFFSr2Eyg4fitsCHipdZtiHdvC7w1PDm51KLFFq7CqnUI514qWJK okdjFsb6mWBtzzm+975CdE0mLIbceosCdxjexBpHtQX8kIoqxwXvR9X1WcqDs6VCgZtQ BNVJ3kMJQxM9opAYm5Bj2AdjrtiUcigIne23OD2UZQ+RYvqzjZM2VdAcQ+o3RDLcrj5C HpIQ== X-Gm-Message-State: APjAAAVP46UCbfFi8ynL78unKxY0RA6A5J6UW0GXjygkI3fcuwgmsGlN OuEjYQbcZBYqXvORRdVr9NG+dR6yFSX5VenK3HH2qQ== X-Received: by 2002:ac8:1091:: with SMTP id a17mr25977158qtj.135.1553624898035; Tue, 26 Mar 2019 11:28:18 -0700 (PDT) Date: Tue, 26 Mar 2019 11:27:25 -0700 In-Reply-To: <20190326182742.16950-1-matthewgarrett@google.com> Message-Id: <20190326182742.16950-10-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190326182742.16950-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH V31 09/25] 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, linux-api@vger.kernel.org, luto@kernel.org, Matthew Garrett , Matthew Garrett , linux-pm@vger.kernel.org, pavel@ucw.cz, rjw@rjwysocki.net 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: David Howells Signed-off-by: Matthew Garrett cc: linux-pm@vger.kernel.org Cc: pavel@ucw.cz Cc: rjw@rjwysocki.net --- kernel/power/user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/power/user.c b/kernel/power/user.c index 2d8b60a3c86b..99e13fd13237 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", LOCKDOWN_INTEGRITY)) + return -EPERM; + lock_system_sleep(); if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { -- 2.21.0.392.gf8f6787159e-goog