From patchwork Sun Sep 3 12:07:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9936135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D4FA4603D7 for ; Sun, 3 Sep 2017 12:10:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C65EE286A9 for ; Sun, 3 Sep 2017 12:10:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB139286B0; Sun, 3 Sep 2017 12:10:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4C31A286B3 for ; Sun, 3 Sep 2017 12:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Oc/H8r+wtOlFiAQmNy3d0KazWDLeYVB9tPCac1bDdus=; b=DvTcfUhfD9Uigt8rY8UmwFz3rF XAFSampv1v/GTOsYT9V1iMppDsWLr1ZyjV78BeN8R2JyiD1guA1Y32YKjOLke3Kv4LWPm24qiDrXL pFAXgYZBIVfVN9uC581uRuYqgQfUL/J5hSt7v9+W8uVEJAEaICZiA4gtt13eWf5ec0vEBlsIvpsKK sxgDRReGWX0rKs15TV+IhUeMi5uh3C34x4YEH0/lsc0AChMvuBLsqMk1I3u5zvudXCU5lnrd5ht9v JXQ7LEtB5Ju/bZNs5Q83H6teYWcpsje0fd1VQ4ZcgoRE70APgQdGHfHwPVBR/zfBSJjdbD7YPVm5p z2arzXNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1doTjZ-0002lK-N9; Sun, 03 Sep 2017 12:10:37 +0000 Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1doThl-0001RO-4U for linux-arm-kernel@lists.infradead.org; Sun, 03 Sep 2017 12:08:47 +0000 Received: by mail-wr0-x22a.google.com with SMTP id w62so2138637wrc.4 for ; Sun, 03 Sep 2017 05:08:24 -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=9/7dHbpFD4D1dJwLNVhR63gUTZrSEJJwP37i3VxFnkM=; b=K8pBCNMqPmW5bNMjiu2oniHXJq1ycbC2oHTIH2BguvmRumRClttG7pTLd26OUui6AT fwgDlv3WI/Hp9JuUCZK3Wtke66gJgkPHWgffWaNivrAvV0i4rBmZG41ofaRucryjvXLy 31OXwaz3ww93HEjCGMQZmuHRCFbTk93HNy1xk= 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=9/7dHbpFD4D1dJwLNVhR63gUTZrSEJJwP37i3VxFnkM=; b=SZKWIuXlCdt1h1S0yrRErpYJH3BpJmMe8xC0yBgoa+4+G5TlvN/H8laer8LP69aSrU z0NMI+ptsaGWBUM3rjXVDU/35hXRN/FkfIJ0B7GboK7oJBx/6EWpRYk06mGKNWaHIjNS n0AkSnsJxTmSL65Gy0xkM81tSFgUrFtW14uY/+4nNzF83oRDFW5Iu5UgwpR5n+RcbLWj 9KqBQR+H6ufBkaLMZRAEuQfTZgpBQgjQLAV2aV63zloH/yKDRKJkxozyu34r7Zl+EK8M OlC+RHh8OtVE3aCcxATSzuM3JbedulxpY/RV3RVEeWSubkbjXAu4mra00IYsgKw39ZHG fUhw== X-Gm-Message-State: AHPjjUjAzc0GNL1umgRh6WFWpYwQku5c6aEQC+a36LSQFNJ3W7rPWU5n lYpGXNMRRJEQhnzsBz+Z6g== X-Google-Smtp-Source: ADKCNb6RHYpF6vn5ZdOQNBMX7adW3aDPj+U1rQS/yIMR5o9P3myyK+qZOwd9x2e0fQbClf765XZiLA== X-Received: by 10.223.145.5 with SMTP id j5mr4136054wrj.148.1504440502864; Sun, 03 Sep 2017 05:08:22 -0700 (PDT) Received: from localhost.localdomain ([154.151.223.220]) by smtp.gmail.com with ESMTPSA id b196sm4392664wmd.29.2017.09.03.05.08.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Sep 2017 05:08:22 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com Subject: [PATCH v2 02/29] asm-generic: add .data.rel.ro sections to __ro_after_init Date: Sun, 3 Sep 2017 13:07:30 +0100 Message-Id: <20170903120757.14968-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170903120757.14968-1-ard.biesheuvel@linaro.org> References: <20170903120757.14968-1-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170903_050845_375161_69F1601C X-CRM114-Status: GOOD ( 11.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kees Cook , Arnd Bergmann , Nicolas Pitre , Marc Zyngier , Ard Biesheuvel , Russell King , Dave Martin , Tony Lindgren , Thomas Garnier , Matt Fleming MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When running in PIC mode, the compiler will emit const structures containing runtime relocatable quantities into .data.rel.ro.* sections, so that the linker can be smart about placing them together in a segment that is read-write initially, and is remapped read-only afterwards. This is exactly what __ro_after_init aims to provide, so move these sections together. Acked-by: Arnd Bergmann Signed-off-by: Ard Biesheuvel Acked-by: Nicolas Pitre Acked-by: Kees Cook --- include/asm-generic/vmlinux.lds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index da0be9a8d1de..d16537b0b102 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -261,7 +261,7 @@ #ifndef RO_AFTER_INIT_DATA #define RO_AFTER_INIT_DATA \ VMLINUX_SYMBOL(__start_ro_after_init) = .; \ - *(.data..ro_after_init) \ + *(.data..ro_after_init .data.rel.ro.*) \ VMLINUX_SYMBOL(__end_ro_after_init) = .; #endif