Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp84405ybi; Thu, 20 Jun 2019 18:22:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcLyI1EYhWxRZ6By2JQYJdoPN0lYq7To0UYDiiWfsbbupWyri1f95iW/S2j/KqCOuQeFX7 X-Received: by 2002:a17:90a:aa0a:: with SMTP id k10mr2919031pjq.43.1561080138563; Thu, 20 Jun 2019 18:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561080138; cv=none; d=google.com; s=arc-20160816; b=pHkRDnDaNPNWkzcMSUdpUI4X5Pv0D/3pN8rQP0QB8lZ56BiyHi6Pk8TXhWz6XBoxSb WbjovD5EK//P6ub8Q3puzOVqw2SEK0a3C7i4u3G6ztXE0ShG10w1+oOBMSpJ8XDW19wL qRP7erb7vtvMdDeKE/JMTMIspP+SNCMCc5n4H08q8Spx++V8FrphG/dUqIIZlHvq3Yv9 xKq55g5ksSKpMg1xmT0lWRjEccUwFvK/Phldev44MFaSg/uJREYy3boW3AYz3Eklu6Hs bFOY23ahYZeSLpNMynQ09U/Sh4OwxVqbN3bumZ/CKu6u9DCFYVbazNP0qaudq7Uj7hzL KUpg== 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=JqSAbEGn1HiZP7c6GcuMsV6mwVA+ao3NtmgYDy/YB50=; b=sOUeHtD3Hcrzzn/elwA7vSG85x6GvqxK0oRW95k7mmUfJvJ/93L7cfbQCyaVsPOfl7 54OYzyGVf3JFWaza4OqMBt/6b/JdzjBlicwnPI6PHTW2gTcXbSXF0ggLiwdXKjanG80K EK/7CQzp4mnXDpf641q9ihXO3OsYNWxs//zrZABZJqBt3Oh7MSQRxc355EJ9/vWadAyU kC2e2cAuNQCGAIuTyuZqzo6u+kKxPY1hQGZviM1g2DbaNu+bUNjdb1RByRW2T2qayDnk jCc+sdTHjkSap1k2aTr/jkzpHGU/46+LeOYJMU7iSbaZulTuljd9HYWbd07ojl2z5CP2 doYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uAl+pb5U; 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 l9si1234194plb.317.2019.06.20.18.22.03; Thu, 20 Jun 2019 18:22:18 -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=uAl+pb5U; 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 S1726633AbfFUBUT (ORCPT + 99 others); Thu, 20 Jun 2019 21:20:19 -0400 Received: from mail-pl1-f202.google.com ([209.85.214.202]:50913 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726610AbfFUBUQ (ORCPT ); Thu, 20 Jun 2019 21:20:16 -0400 Received: by mail-pl1-f202.google.com with SMTP id 71so2653718pld.17 for ; Thu, 20 Jun 2019 18:20:16 -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=JqSAbEGn1HiZP7c6GcuMsV6mwVA+ao3NtmgYDy/YB50=; b=uAl+pb5UgR8qbNWvTqgNyUdGrjYg0S8BfztU1IaK3wSoovw9zlPCjs+fxR/Zldidjt wn9jEjHX6zhp2cY/ATrv0Ui2iFYIO/84hN6Y9U0zSrxpdUGNw4l6ofnhy4DW6H1w1REh e7xaSuXohECGbWYKz7+urb02nPjB4dMxHHraE2pgWMJeOrKlP6Brq6ZYzgnti8M6knOD M5dofE5spcg4W1bE+A2c24KQml7+KGHeAK64yt51wq5qc77KvrpFdOMYA4aIUfufBhW/ VF40DkSCXitcpI+sAdK9CQdmQyjHL8QEx8o56v+XmnMnicC0CjNjNkw0OspKK1lBtU/2 MRZw== 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=JqSAbEGn1HiZP7c6GcuMsV6mwVA+ao3NtmgYDy/YB50=; b=nRT9cI1qSUSE6OADpPit18E2iSxMQX58uvgwwoyWaIgG1bRD1g87/QciWbP4w60RRt jK9XmgVruXF0rSPcjvcdCFR/VGNviqBRaAxqGZOkRjaSV/V2/6Yi3cPax3ZJ3STM6XAI LxQwLOpYjNq3G2Nf3tU8TaW3pyLhzuGxpzGRywePmuMDKsqxfgEi+1tQ0JlnB9nc39G7 czOuYM5Q3heMEPCDicSdDgKaRU4uzjDgDlFOQ6zAbzgfx9sbmaI1RENE9Q1ZWtMYxlht JbsNRKI5ApslgAi/yuhrRMsCy3Sdw095edHTjQy3xbQ9uZmLP53n8ljg34LseYAC1e8w fevg== X-Gm-Message-State: APjAAAX0nyEVZLxzduT/oc0SgEFeF2TTb+Y7mkESX7KecBTBBXQRqs23 IPg90YktgO1v9HIOMH7Q2/jI8Qe5wkXtTmEoTa5gTA== X-Received: by 2002:a65:5006:: with SMTP id f6mr10257389pgo.402.1561080015411; Thu, 20 Jun 2019 18:20:15 -0700 (PDT) Date: Thu, 20 Jun 2019 18:19:22 -0700 In-Reply-To: <20190621011941.186255-1-matthewgarrett@google.com> Message-Id: <20190621011941.186255-12-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190621011941.186255-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog Subject: [PATCH V33 11/30] uswsusp: Disable when the kernel is locked down From: Matthew Garrett To: jmorris@namei.org Cc: linux-security@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Matthew Garrett , David Howells , 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/power/user.c b/kernel/power/user.c index 2d8b60a3c86b..8a8d7f1c8fbb 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -52,6 +53,9 @@ static int snapshot_open(struct inode *inode, struct file *filp) if (!hibernation_available()) return -EPERM; + if (security_is_locked_down(LOCKDOWN_HIBERNATION)) + return -EPERM; + lock_system_sleep(); if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { -- 2.22.0.410.gd8fdbe21b5-goog