Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4522681ybv; Mon, 17 Feb 2020 00:33:02 -0800 (PST) X-Google-Smtp-Source: APXvYqyyQO9ksDOkdxKvKgtFEQcQADcyV3Tbo1qqL6J9JGvHNCuKWhVXgTdyfEGcrOXvqS/B5BW2 X-Received: by 2002:a05:6830:1d8b:: with SMTP id y11mr11866517oti.4.1581928382668; Mon, 17 Feb 2020 00:33:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581928382; cv=none; d=google.com; s=arc-20160816; b=qTKnsueGr2pySfSUHdrjzt7wGrSKYu76LnH7abIBzxMQWAy0yisgwlveGpmvOqckqR BK14meEm/2fxAfaMF/lC+Wm92EvhTo1zbyYkf6jvR9jhVSe1gVcjmEG6WOQdN4hM4P2v xa7aK5HTFy91N6Hx79E1kqjPvXcGf8dj02iUu6gFdrNm8vzrdIgqHH3dzaVG7NAEKM8Y LsHVP1vfMJOJJ8He31Q9OZLPlDH2mCBvPGAlgn7w2Lj25+Q7gyrqpdZ96mSh38bQX/G7 ctGzPV7uwzoFefgJ7QjCGI8zxhPDuDN0nugTYfJK/EOh2rp2jJc6ne1ExwZv+l8dHQqZ f7Uw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QNyXncKaYuryFlTH69WlWZYPk4kAmZEfUmd5TonVcFM=; b=WZEDaQpEYPQGeDiErI1A0LeGGTduimnQwzFo7AI33xdl4eLgA9cF1IfML/fzxgJ6pf spQ4FSrQCTrqTIjo+JFD2EbO1Xe+mGPOlUwbQBGnfvmCYcyzxnHT7Ax/7nxetkPQjRAp ONRv8+TvkbWniqb6TIvvnNEL9pseo8qZo0GUS7JJ1s5dSKKkQQDf8X7i2het/AOKa1SH H8j9a0ddzJrKjH2DwlNBM/tbfRdEyKt1QEVzfQZl2kfSgfhEZUOkW71/rY3ajFzKRvUG HH9okmV5ZfuMft7qnuYqXxDFdKioDnxf6R/m7kHxvX9VQoPnHxMq0wH0p9sllAoY5FQ+ Viug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Gsd372ng; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r21si6606870otd.135.2020.02.17.00.32.50; Mon, 17 Feb 2020 00:33:02 -0800 (PST) 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=@sifive.com header.s=google header.b=Gsd372ng; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728352AbgBQIch (ORCPT + 99 others); Mon, 17 Feb 2020 03:32:37 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33100 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728337AbgBQIcg (ORCPT ); Mon, 17 Feb 2020 03:32:36 -0500 Received: by mail-pf1-f195.google.com with SMTP id n7so8452001pfn.0 for ; Mon, 17 Feb 2020 00:32:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QNyXncKaYuryFlTH69WlWZYPk4kAmZEfUmd5TonVcFM=; b=Gsd372ngP7zyebK4/CGgbTK5xouhrNYPxDq+3swGBCC0ZSYcePHQFjp3+n5hBWWXwC aWLvnXVIYcac0owRO8bnd7I+XHzLdoh0ve80PIU0mQdcjnmTj8h9mZRe5T1Q9IrkaAsk hOAWPYp0iDKpEhz1qqQwsRJmQzyQgd7bwPojIOMRp7zX7q4Yp7tWBw4TufZYAB1j9LOp p9E4e+xlAlnswSu2BH4Dov8tV/nQZ5cVmwCkfGjPUPTu5Yo+fuklw68b8DlYqAQ3UdLC hll/p8eOuGfqpSj4Sca0bR7qOM+BrDLmHVZjvsLDMEbPvUEAKgu77BRvUOjrxWnK+zLB RZOw== 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:mime-version:content-transfer-encoding; bh=QNyXncKaYuryFlTH69WlWZYPk4kAmZEfUmd5TonVcFM=; b=crVjljg2ZGb5bJUvW6RyN5t3I+mCHUkZmbjmhFwjiJkpDndEVI8VfUDcDS8vlLgnlk uIFLh5v0f+iamYmK7SeJblomTrTErVaqRSooAhLm3o/QfMzjiaxY+KTR69gjixnvV8tR Uoo8GOf68u+kUQyRAptgtQ620OXuvJvjo+dWWWveSpzynHZC2lnTC2zHCcjW6SJOdex1 VmvxLSY+1jUi+xL4q0RRkk49PdwQ1lURZHU6JiORZHLtKA2bVq6zxXeLdnGUJY0gnFn8 Rivge2Pz6TyaQQvqF0po8re5/yOSajqriK8sw5PBqIY2sZJ1OklBZkWQIcLiJkRsfVeY 2rvA== X-Gm-Message-State: APjAAAXtBz2GFqmbtLrOQ5/JKoqK2Wyz4zN119N/5ivdjdwq2ymwRrL1 S223214IGS82goR7Td6s7LU6uQ== X-Received: by 2002:a62:e217:: with SMTP id a23mr15644730pfi.50.1581928355848; Mon, 17 Feb 2020 00:32:35 -0800 (PST) Received: from hsinchu02.internal.sifive.com (220-132-236-182.HINET-IP.hinet.net. [220.132.236.182]) by smtp.gmail.com with ESMTPSA id z10sm16989319pgz.88.2020.02.17.00.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 00:32:35 -0800 (PST) From: Zong Li To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Zong Li Subject: [PATCH 4/8] riscv: move exception table immediately after RO_DATA Date: Mon, 17 Feb 2020 16:32:19 +0800 Message-Id: <20200217083223.2011-5-zong.li@sifive.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200217083223.2011-1-zong.li@sifive.com> References: <20200217083223.2011-1-zong.li@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move EXCEPTION_TABLE immediately after RO_DATA. Make it easy to set the attribution of the sections which should be read-only at a time. Move .sdata to indicate the start of data section with write permission. This patch is prepared for STRICT_KERNEL_RWX support. Signed-off-by: Zong Li --- arch/riscv/kernel/vmlinux.lds.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index 1e0193ded420..4ba8a5397e8b 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -9,6 +9,7 @@ #include #include #include +#include OUTPUT_ARCH(riscv) ENTRY(_start) @@ -52,12 +53,15 @@ SECTIONS } /* Start of data section */ - _sdata = .; RO_DATA(L1_CACHE_BYTES) .srodata : { *(.srodata*) } + EXCEPTION_TABLE(0x10) + + _sdata = .; + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) .sdata : { __global_pointer$ = . + 0x800; @@ -69,8 +73,6 @@ SECTIONS BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0) - EXCEPTION_TABLE(0x10) - .rel.dyn : { *(.rel.dyn*) } -- 2.25.0