From patchwork Fri Aug 9 14:49:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri John Ledkov X-Patchwork-Id: 1144749 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ubuntu.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=surgut.co.uk header.i=@surgut.co.uk header.b="QCMnnYoR"; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 464p6y22CFz9sPJ; Sat, 10 Aug 2019 00:49:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hw6D7-0005DZ-Ko; Fri, 09 Aug 2019 14:49:41 +0000 Received: from mail-wr1-f67.google.com ([209.85.221.67]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1hw6D6-0005DK-53 for kernel-team@lists.ubuntu.com; Fri, 09 Aug 2019 14:49:40 +0000 Received: by mail-wr1-f67.google.com with SMTP id k2so12651729wrq.2 for ; Fri, 09 Aug 2019 07:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=surgut.co.uk; s=google; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K6IVHxNTzt6GfgCA7NU/mp4cidOkGoOipNbyUtvtY2I=; b=QCMnnYoRawyPtIz++4cOWw2TkwRhKQY57gvQuFFF4X3bC5A+CHPLhEAXeWF6flGgsK ZCDXITxOq2zB/TKJ3dvqtwbJMAaqAV6sEDW8VNNFn5sFf+b0Zw+WTnxSOKfL2wv1iRm+ xqLllmmm2FgCPEUbMhFPVc6FztfETifRKyg1I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=K6IVHxNTzt6GfgCA7NU/mp4cidOkGoOipNbyUtvtY2I=; b=kY4rq52ezQd7nj+parhPgE58vrLEERBVKTY9xseQ85U1pwhLndtwghiyKnGQufjhrX cdoJa+2zzYivUwrzvxVcm4UN/w1hIcxIp2JWdOPvBU+t3ydU2lepGEaHf/8h1t9fnuvE Jp1RvozHYD7YoLJLb6ilIq7yFSvHOCDhxwN881zXKjoDz24YRiMxTMPJDDhzEldLT/sk tP9KuGBJ8OUqUIwyG8eeEnhncp/NtvEA9ovlgNEicD7tEpfiVDKbKvNXSTvHsqEHTn8l 03YtGFWuqFXUAPTi/m3/wkLvOXLoSpNWxLAyU+sBRP7A+m71xavMI3SbcsOMeAFwfKJi KmGA== X-Gm-Message-State: APjAAAUqGKYx2xmEI1D09CPXN+og/SOqu1v5JaowGh8cMSFk7uJtk2C3 DaWtmvsUuHOauwX1RapRJsdx9JhUwkY= X-Google-Smtp-Source: APXvYqyLvr70zN33QGuoQUneflew3oFoDkpzZ7zAByKcAMRZIgD49pLneFB3Pxagr4c2Ev9b5cD/fQ== X-Received: by 2002:a5d:5386:: with SMTP id d6mr25160635wrv.207.1565362179342; Fri, 09 Aug 2019 07:49:39 -0700 (PDT) Received: from localhost (9.a.8.f.7.f.e.f.f.f.2.3.f.4.a.1.1.4.e.1.c.6.e.d.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:de6c:1e41:1a4f:32ff:fef7:f8a9]) by smtp.gmail.com with ESMTPSA id n8sm82923857wro.89.2019.08.09.07.49.38 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 07:49:38 -0700 (PDT) From: Dimitri John Ledkov To: kernel-team@lists.ubuntu.com Subject: [UNSTABLE][PATCH 1/2] UBUNTU: SAUCE: (lockdown) s390/ipl: lockdown kernel when booted secure Date: Fri, 9 Aug 2019 15:49:28 +0100 Message-Id: <20190809144929.17651-2-xnox@ubuntu.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190809144929.17651-1-xnox@ubuntu.com> References: <20190809144929.17651-1-xnox@ubuntu.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: prudo@linux.ibm.com, Dimitri John Ledkov Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Philipp Rudo BugLink: https://bugs.launchpad.net/bugs/1839622 Signed-off-by: Philipp Rudo Signed-off-by: Dimitri John Ledkov --- arch/s390/include/asm/ipl.h | 1 + arch/s390/kernel/ipl.c | 5 +++++ security/lock_down.c | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h index 084e71b7272a..1d1b5ec7357b 100644 --- a/arch/s390/include/asm/ipl.h +++ b/arch/s390/include/asm/ipl.h @@ -109,6 +109,7 @@ int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf, unsigned char flags, unsigned short cert); int ipl_report_add_certificate(struct ipl_report *report, void *key, unsigned long addr, unsigned long len); +bool ipl_get_secureboot(void); /* * DIAG 308 support diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 2c0a515428d6..db491b068061 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c @@ -1851,3 +1851,8 @@ int ipl_report_free(struct ipl_report *report) } #endif + +bool ipl_get_secureboot(void) +{ + return !!ipl_secure_flag; +} diff --git a/security/lock_down.c b/security/lock_down.c index b66b3bac8d79..973118384a0c 100644 --- a/security/lock_down.c +++ b/security/lock_down.c @@ -15,6 +15,9 @@ #include #include #include +#ifdef CONFIG_S390 +#include +#endif #ifdef CONFIG_ALLOW_LOCKDOWN_LIFT_BY_SYSRQ static __read_mostly bool kernel_locked_down; @@ -55,6 +58,10 @@ void __init init_lockdown(void) if (efi_enabled(EFI_SECURE_BOOT)) lock_kernel_down("EFI secure boot"); #endif +#ifdef CONFIG_S390 + if (ipl_get_secureboot()) + lock_kernel_down("Secure IPL"); +#endif } /**