Received: by 10.192.165.156 with SMTP id m28csp934036imm; Wed, 11 Apr 2018 09:30:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx482vw7SkAMRY3W4nFhh5bdgfFGKqt1kYJe8UcLDMMCVSpRoyJpfQi40BRaPKqriqs4Am2Bz X-Received: by 10.99.114.12 with SMTP id n12mr3917838pgc.133.1523464201858; Wed, 11 Apr 2018 09:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523464201; cv=none; d=google.com; s=arc-20160816; b=ZE1pV3oQ2OcsCnSDpivNii40AhghNy5yHt1HIsQLjUFBBE0pRb8RK7dL/lqHJBBl0Q NEY7Iho3M0AICrcKzo/Wh9YduZgLIfxm8UgjXTimCeSnCdxWUggRdTeAxhRkSVlYrafl GVKoJ5ZtJj5YO0ul2KwMoq8A3Z9ad+VqPGvH0kUXT+9PZn4J3GTZWuxwVFJFL1p7ttHS QSppXTnwVTXb6U7mFalSDOwRY/e+eUFbQmHdJYWkw1VP9ZWiU7FFuk14of49EDl8zJAk hwU7WnP+MUxvL3L1L6wZIwLiP8lLU00mlxqlP8hgkkBRDGNDZ2ETcHFTeEr1Qw/T9BcR zWBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:arc-authentication-results; bh=1Ind2Si9ea5l0IV2ucPkeBZqL0L5edO5YqftIF/pklw=; b=SDeiWHU7HiNF9WkuLms4Eh5cf8poOPSXN/zCJfuP1jV2JXjdUlv9HqiSzU761s1tPL T6gqVrA5P9jUxSrWChPUeoPUoBuqOoI98NGMY81GuaxOpd6IpzHEJ589qOeLrkf7S3RM oVtPwon3h6Rpd/YRIxi0NalZqqxWC44SLM89/aQe/sbTdm1Z2N/9T9dyEU8afphyBxzc KyhvqDmR63anziL2Kk1vK50bxL7ISvR1hKqTOr3SG3wcQ4S9rUMDg51I4cPsb2aq7GtI 0VnkXQS35QzzcTajmIA4TjHCyeijZLP0b/gLj/K3tnNx8WD5JPGUhnD1oAYiNNlX2Cm2 ritw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w24-v6si1388058plq.481.2018.04.11.09.29.23; Wed, 11 Apr 2018 09:30:01 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754103AbeDKQZg (ORCPT + 99 others); Wed, 11 Apr 2018 12:25:36 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42826 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752804AbeDKQZd (ORCPT ); Wed, 11 Apr 2018 12:25:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2177F11E110; Wed, 11 Apr 2018 16:25:33 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-8.rdu2.redhat.com [10.10.120.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A990BDC2F; Wed, 11 Apr 2018 16:25:32 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 08/24] uswsusp: Disable when the kernel is locked down From: David Howells To: torvalds@linux-foundation.org Cc: linux-man@vger.kernel.org, linux-api@vger.kernel.org, jmorris@namei.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, linux-security-module@vger.kernel.org Date: Wed, 11 Apr 2018 17:25:31 +0100 Message-ID: <152346393165.4030.14932574511330889453.stgit@warthog.procyon.org.uk> In-Reply-To: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> References: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 11 Apr 2018 16:25:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 11 Apr 2018 16:25:33 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' 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 75c959de4b29..959b336d8eca 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)) {