Message ID | 20180623022058.10935-15-takahiro.akashi@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1548200lji; Fri, 22 Jun 2018 19:21:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIXLaFPdcDAg9KIZA9t9DughoBF7cy3md90RksB6+AU0qJTCR5EH0Ytp6HIIssMW16DTjz4 X-Received: by 2002:a62:3d05:: with SMTP id k5-v6mr4084367pfa.122.1529720517588; Fri, 22 Jun 2018 19:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529720517; cv=none; d=google.com; s=arc-20160816; b=Seoy+XlMPvFlG1j3L+L8Ten2hjZ9xUSL1RqnyWyAWXSQDfUCuMJnwCzbVwStN7qRi9 brgqGDLOwCjOY4YjPIr97nM2z3LeUeDc5TrA8lraR0dUH4W1ztsiZ4SpCzSECOZykop7 cI8ZJiJuj5PL9ZQvEGmAppmJ/96k+hE6/JuPzS3i3B3ImrGmA8nQdN7YXlBD+2eZFS24 FmXv9jmFm9kvn+Ay8zN40sJPeI1P+uh7JXeZ/WguglwZypVgF+I7A5Y8wf9DURJxvLnl 134Y9WH9w25P7urdZl+apkj142ZyL+3xiD+vOefMQdCTsmIIj4G7eIJ4lVSs1xcjhMh/ hITg== 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=kjrhtHupdHh4T5Hnsk+P2sAae5O1LRvrUqSekVnnVSw=; b=K3eJlSxS4O50EoE5pIrB9xbLXZXk/Ndhndsk3NrYEOH0xx+5ORJc+rHCutl5DsYn6U y5w1Mab2XuwdjTF7Lkwee+VS/deIan9FTaXPPMEtiXlu0gUxzv3CPilOFK6Oqu13tWr3 CBsoWaNmNXkBIwclhRDF2FZWrGpqZqoKFFr/C+LG6b+RyyRq9ocb/dBJ979pIT8gwAK1 L7VjL58PYFherSNX9kSth93k3MR3VVziFtrnS51+QhquiDSdFkE/iHZPrlq18xSh+sdw 2wLpToGyBspdBWBr9W0AtMlX3cdem0AJOU7t+V1LYB3bkrxn9Bnw7PLy2V1PzLIjS8xQ Eu0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kNofj1H0; 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 m11-v6si7374029pgr.104.2018.06.22.19.21.57; Fri, 22 Jun 2018 19:21:57 -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=kNofj1H0; 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 S934935AbeFWCV4 (ORCPT <rfc822; heyi.guo@linaro.org> + 31 others); Fri, 22 Jun 2018 22:21:56 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:43723 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934856AbeFWCVx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 22 Jun 2018 22:21:53 -0400 Received: by mail-pf0-f193.google.com with SMTP id y8-v6so3991581pfm.10 for <linux-kernel@vger.kernel.org>; Fri, 22 Jun 2018 19:21:52 -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=kjrhtHupdHh4T5Hnsk+P2sAae5O1LRvrUqSekVnnVSw=; b=kNofj1H0U7Jw4ClKkIBEMiVX02MACndzKKCawpN+Ze9B3jo6c4pewzlZtXN+62sR87 p/niEICqNaT2bXBkULcysrad368qaB1aMcZznES1lHarEOYCJbBueMORBP5d5U7e8teN n4zukzR+/fEZ4yFinkoL/i316OWePqGkYwrhU= 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=kjrhtHupdHh4T5Hnsk+P2sAae5O1LRvrUqSekVnnVSw=; b=eZHVywgCz/FU+WXrcG81e7Kl+bw7dk+SYcGznV5qxsSeYlJlQFF6y04YHDr9GKIO4K nSidFGb8/BYCGDqzfC8UaG9nd9iNSJZiGUenZYg5NTDLv7wWKwzuS/ZX1WkXk50EzjTY D1EXnMVMG3ucr1CFw5+is2l0PwX3TdwX1JHMR+vGLPABRH7AyWVX51J4joJdkF4O+oY1 niGYILhT+pMFNQZnEAVLXStuUskme212qdlCD0SBbCJcSdc+oSQddSTup1KIrO0sQfdK AfhJ8unV6H9fbRJhsWmclNKJQKInD2vYQ9ZpH8ic/LyjI+psiwrrtkm04FvzTC242lJp dAtw== X-Gm-Message-State: APt69E0j2VO3Ijb5HLabmTXkVE/Tf8lXSvbQuPCzkdNxMRVVh1nWwNcr uYDmf5cEIKsaN4StQL7uXoMt1w== X-Received: by 2002:a63:2b88:: with SMTP id r130-v6mr3349043pgr.170.1529720512561; Fri, 22 Jun 2018 19:21:52 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id e81-v6sm19973085pfb.62.2018.06.22.19.21.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jun 2018 19:21:52 -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 v10 14/14] arm64: kexec_file: add kaslr support Date: Sat, 23 Jun 2018 11:20:58 +0900 Message-Id: <20180623022058.10935-15-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180623022058.10935-1-takahiro.akashi@linaro.org> References: <20180623022058.10935-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 |
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 6aec996d015a..1283c1d912f2 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> @@ -132,6 +133,12 @@ static int setup_dtb(struct kimage *image, goto out_err; } + /* 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 "kalsr-seed" to dtb enables triggering kaslr, or kernel virtual address randomization, at secondary kernel boot. We always do this as it wll 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