All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	"Ross Lagerwall" <ross.lagerwall@citrix.com>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 2/3] xen/virtual-region: Include rodata pointers
Date: Tue,  5 Mar 2024 12:11:20 +0000	[thread overview]
Message-ID: <20240305121121.3527944-3-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20240305121121.3527944-1-andrew.cooper3@citrix.com>

These are optional.  .init doesn't distinguish types of data like this, and
livepatches don't necesserily have any .rodata either.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Ross Lagerwall <ross.lagerwall@citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/livepatch.c           | 6 ++++++
 xen/common/virtual_region.c      | 2 ++
 xen/include/xen/virtual_region.h | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 888beb273244..cabfb6391117 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -788,6 +788,12 @@ static int prepare_payload(struct payload *payload,
     region->text_start = payload->text_addr;
     region->text_end = payload->text_addr + payload->text_size;
 
+    if ( payload->ro_size )
+    {
+        region->rodata_start = payload->ro_addr;
+        region->rodata_end = payload->ro_addr + payload->ro_size;
+    }
+
     /* Optional sections. */
     for ( i = 0; i < BUGFRAME_NR; i++ )
     {
diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c
index b74030d70065..d2efe9e11492 100644
--- a/xen/common/virtual_region.c
+++ b/xen/common/virtual_region.c
@@ -13,6 +13,8 @@ static struct virtual_region core = {
     .list = LIST_HEAD_INIT(core.list),
     .text_start = _stext,
     .text_end = _etext,
+    .rodata_start = _srodata,
+    .rodata_end = _erodata,
 };
 
 /* Becomes irrelevant when __init sections are cleared. */
diff --git a/xen/include/xen/virtual_region.h b/xen/include/xen/virtual_region.h
index c76e7d7932ff..7712f6ad3632 100644
--- a/xen/include/xen/virtual_region.h
+++ b/xen/include/xen/virtual_region.h
@@ -16,6 +16,9 @@ struct virtual_region
     const void *text_start;                /* .text virtual address start. */
     const void *text_end;                  /* .text virtual address end. */
 
+    const void *rodata_start;              /* .rodata virtual address start (optional). */
+    const void *rodata_end;                /* .rodata virtual address end. */
+
     /* If this is NULL the default lookup mechanism is used. */
     symbols_lookup_t *symbols_lookup;
 
-- 
2.30.2



  parent reply	other threads:[~2024-03-05 12:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 12:11 [PATCH 0/3] x86/livepatch: Reinstate the ability to patch .rodata Andrew Cooper
2024-03-05 12:11 ` [PATCH 1/3] xen/virtual-region: Rename start/end fields Andrew Cooper
2024-03-05 13:35   ` Roger Pau Monné
2024-03-07 13:05   ` Ross Lagerwall
2024-03-05 12:11 ` Andrew Cooper [this message]
2024-03-05 13:46   ` [PATCH 2/3] xen/virtual-region: Include rodata pointers Roger Pau Monné
2024-03-05 14:17   ` Jan Beulich
2024-03-06 17:09     ` Ross Lagerwall
2024-03-06 17:21       ` Andrew Cooper
2024-03-07  7:39         ` Jan Beulich
2024-03-07 11:31           ` Andrew Cooper
2024-03-07 11:58             ` Jan Beulich
2024-03-07 12:16               ` Andrew Cooper
2024-03-07 13:03                 ` Ross Lagerwall
2024-03-07 13:10                   ` Andrew Cooper
2024-03-05 12:11 ` [PATCH 3/3] x86/livepatch: Relax permissions on rodata too Andrew Cooper
2024-03-05 13:02   ` Andrew Cooper
2024-03-05 13:48     ` Roger Pau Monné
2024-03-07 13:04     ` Ross Lagerwall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240305121121.3527944-3-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=roger.pau@citrix.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.