[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Arm: avoid .init.data to be marked as executable


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 11 Jun 2021 11:39:21 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5tcyDQtqV243Vt1Pu4MZc3Wx8qSzPD4ZzLi6EoT2Pmo=; b=mBwroHljrUJAN69Mq04M+Rw3/wWKn5/5nBmaN3554EbjkAUViUqW1FN3wHLk9X48WZrFicMQRsNLAWWf3vzpPYjE2bHiNSku/3E/MXGQ5cxAduTkUPEITNPtfiJnWeTnkiDKVfIV3+3iENsII2MML6SfB9bcGYigkKFUDKn0IwJznEL/XkCrertEznf9Y8oqzPLjYSSdGddeW/BmtipesUp2g7iRnLxN3L83Btdh/Wxk8eQdDM0vjcXMYjtyh2mXvYX9wO3tgZ8HvjqUD47ey5FoNUJVdqoZdueXccHIwqnu0DW+sQKZy65jIs8zEFQcv8jWijCOhnx7bvVjP9ThYg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GcfAy0q1nbDEoq7+LPviz3cpfGEekELTZGCVL2T/rgBIDhjPQBSwxG3Bn2yPE/IhCtWsUDrWw1EQOUgd2DCon35d3Q54OGG8O3U04at/6rDEVZYkWLnTilU85CV+9UTQ8yeofqY+Alw+yIT/C1q0B6EylMoSyiPaZkKcNRok32WrsPaJXKPtrGIG11xNVt8g6d7a+WzDuVtH2+tHY+k8MeIJLh0K562BweTUfqgOVqOCRyFMf7nksSi164ONmS1bSIpIDTIHvEaefeQ4cO71keXjtHqdNKErZhURbT4X4l0869x8/U382Mp/A0TUHbst/JTUoOItm6ySfWh3UwF+5w==
  • Authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=suse.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Fri, 11 Jun 2021 09:39:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This confuses disassemblers, at the very least. Move
.altinstr_replacement to .init.text, dropping the redundant ALIGN().

Also, to have .altinstr_replacement have consistent attributes in the
object files, add "x" to the one instance where it was missing.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
I'm uncertain whether having .altinstr_replacement inside or outside the
[_sinittext,_einittext) region is better; I simply followed what we have
on the x86 side right now.

--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -147,6 +147,7 @@ SECTIONS
   .init.text : {
        _sinittext = .;
        *(.init.text)
+       *(.altinstr_replacement)
        _einittext = .;
   } :text
   . = ALIGN(PAGE_SIZE);
@@ -169,8 +170,6 @@ SECTIONS
        __alt_instructions = .;
        *(.altinstructions)
        __alt_instructions_end = .;
-       . = ALIGN(4);
-       *(.altinstr_replacement)
 
 #ifdef CONFIG_DEBUG_LOCK_PROFILE
        . = ALIGN(POINTER_ALIGN);
--- a/xen/include/asm-arm/alternative.h
+++ b/xen/include/asm-arm/alternative.h
@@ -67,7 +67,7 @@ int apply_alternatives(const struct alt_
        ALTINSTR_ENTRY(feature,cb)                                      \
        ".popsection\n"                                                 \
        " .if " __stringify(cb) " == 0\n"                               \
-       ".pushsection .altinstr_replacement, \"a\"\n"                   \
+       ".pushsection .altinstr_replacement, \"ax\"\n"                  \
        "663:\n\t"                                                      \
        newinstr "\n"                                                   \
        "664:\n\t"                                                      \




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.