Message ID | 20180711074203.3019-16-takahiro.akashi@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4801178ljj; Wed, 11 Jul 2018 00:43:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpejYZkVwmRpWBMCv+9TeWmkFl6PkW50g6Dvm09OS97aEUz6rOcZ949EMEZD1K/70u7yvzk0 X-Received: by 2002:a17:902:a989:: with SMTP id bh9-v6mr28232122plb.245.1531295015293; Wed, 11 Jul 2018 00:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531295015; cv=none; d=google.com; s=arc-20160816; b=tGqtvK6jMRvm+OPI/w97rG6ULVCg9bmnOI8Xtceofp7vaRtTfbT8VWVwYP5RRFl3R5 DhNmtN3W/ALLcsBJerUhNIWGrgbE3LyuJwugEf59F6bVKjWz2We2+yCwrg36/V+IPCz8 s93VZ0Jb3hCy78DHagh3ThLigAolq7fiL6GibD56J7f/8ogByh32GxXnjg6kl/a8Wd8k yn5iem7bA/SJ8UhbyPr2OVn0pWTrz4yJJiVzzcWHO6BXXSy1HBwCBu+iaYYTyVnpgOfz 99c4sSt2mOdm9sfhTCqpTZ+X7QDzzwP1p9Ph+PPVClXyz2cXjpBVVRBPedGabHWX75Ad UVdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=uQoziQZkHVnlrNNUZNXAOepb9dTdnP1dZcnkI2L9pzA=; b=k/FweTK7aD6tjAsEEKVDsHyEF1tCFHZ0SVj3YHJY0RWfbLMFSOpzeXi10g+h8lKooT fIEMh30mHn+Mxum2HWiIl8ILo5diWCUsD3HOVX7SdJYoRmFpE4+yramSwlr/5g3LWDuN ZAIoF18dxSDBIXqS0A4fzoPbwjRYwvEgqry6p1+oAmsJ7k+RjlDwsjcVdvN5eNCJOkaE BYCP5ggp6WjdDXeij0HSGxACMw6wtdwMRj/RbYN7JsnHIoTwsH2b+7PfhHaHCMso+HNr +gYbNCXuczGOqO1U0YPyiZi+6MAUB0dsvo8ekEv+YKRQuNSYeCdO5JPQjmRlvzq0wiiw ua1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SIE6TkGL; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1-v6si17319142pgp.18.2018.07.11.00.43.35; Wed, 11 Jul 2018 00:43:35 -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=@linaro.org header.s=google header.b=SIE6TkGL; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732418AbeGKHq3 (ORCPT <rfc822;julien.grall@linaro.org> + 22 others); Wed, 11 Jul 2018 03:46:29 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43831 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726289AbeGKHq2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 11 Jul 2018 03:46:28 -0400 Received: by mail-pg1-f195.google.com with SMTP id v13-v6so2688364pgr.10 for <linux-kernel@vger.kernel.org>; Wed, 11 Jul 2018 00:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uQoziQZkHVnlrNNUZNXAOepb9dTdnP1dZcnkI2L9pzA=; b=SIE6TkGLdOsMdh5DXKeCj9XxFa424kGQP+vU592YrheWapegYtykabNa2h6p3Z7ZF+ uzo2EzV2GsH+kHAU04n4Co1PZrY9NY8bZywVXdpjE8EK1OWGKT6nzGW0sVsj0dm4VnMg 1ag1YVyppqMmEmMrgjDIGpJscQzPOylYVhunA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uQoziQZkHVnlrNNUZNXAOepb9dTdnP1dZcnkI2L9pzA=; b=GgFx9ZfccxLCoTc8OoASTjmTZ+kdofG7jXmZ/VcVs0zDHCaHJnjURhapPp1LZJ82PT bRLcn4RCPeCP+BQy5cay6LqeD9CdQS5nmbKpmXgxS5BSZcAxepdRLKT8AYk9qsN3gy2J JG7rI6zNkBSPyfaNbENrtHxWLNiurT27cGF+qPow3CWKv7Mbwmfx7+iYHTACnrUL2Ril a00Bp0huXGztkE8JowLB+WAE6f/YUGFweTTYI8FDPS94bCDYdA357P2ya5zoSmTlWtt3 iwb8B+uD4nNaKepxhFGiEhMFnjlg82RaIhKWk7LcwPhjh2Re4jNXF31fcxx/153hQizy I+6g== X-Gm-Message-State: APt69E14g/suSkmjd1riOA1JMGKTDMHgHxd0WgObhoRwaOIrcr9PLiQX Y9j/wZgyo3lvakR4mWCwHfR1KQ== X-Received: by 2002:a63:f:: with SMTP id 15-v6mr19477044pga.430.1531295011680; Wed, 11 Jul 2018 00:43:31 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id v17-v6sm23357015pfn.177.2018.07.11.00.43.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 00:43:31 -0700 (PDT) From: AKASHI Takahiro <takahiro.akashi@linaro.org> To: catalin.marinas@arm.com, will.deacon@arm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de Cc: ard.biesheuvel@linaro.org, james.morse@arm.com, bhsharma@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro <takahiro.akashi@linaro.org> Subject: [PATCH v11 15/15] arm64: kexec_file: add kaslr support Date: Wed, 11 Jul 2018 16:42:03 +0900 Message-Id: <20180711074203.3019-16-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180711074203.3019-1-takahiro.akashi@linaro.org> References: <20180711074203.3019-1-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
subject: arm64: kexec: add kexec_file_load() support
|
expand
|
diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c index 261564df7210..99d771afe88e 100644 --- a/arch/arm64/kernel/machine_kexec_file.c +++ b/arch/arm64/kernel/machine_kexec_file.c @@ -16,6 +16,7 @@ #include <linux/libfdt.h> #include <linux/memblock.h> #include <linux/of_fdt.h> +#include <linux/random.h> #include <linux/slab.h> #include <linux/types.h> #include <linux/vmalloc.h> @@ -161,6 +162,12 @@ static int setup_dtb(struct kimage *image, } } + /* add kaslr-seed */ + get_random_bytes(&value, sizeof(value)); + ret = fdt_setprop(buf, nodeoffset, "kaslr-seed", &value, sizeof(value)); + if (ret) + goto out_err; + /* trim a buffer */ fdt_pack(buf); *dtb_buf = buf;
Adding "kaslr-seed" to dtb enables triggering kaslr, or kernel virtual address randomization, at secondary kernel boot. We always do this as it will have no harm on kaslr-incapable kernel. We don't have any "switch" to turn off this feature directly, but still can suppress it by passing "nokaslr" as a kernel boot argument. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> --- arch/arm64/kernel/machine_kexec_file.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.0