All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rémi Denis-Courmont" <remi@remlab.net>
To: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: [Qemu-arm] [PATCHv2 2/3] target/arm: actually enable PAuth in user mode
Date: Sat, 26 Jan 2019 08:52:11 +0200	[thread overview]
Message-ID: <20190126065211.3587-2-remi@remlab.net> (raw)
In-Reply-To: <1648289.tQCHxfjYn9@basile.remlab.net>

From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>

This always enables IA, IB, DA and DB keys in user mode on the maximum
CPU, in a manner that is consistent with the other CPUs. That is to say
redefining the reset value of SCTLR_ELx registers.

Without this patch, the PAC* and AUT* instructions have no effects
(except PACGA of course).

Signed-off-by: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
---
 target/arm/cpu64.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index e9bc461c36..c8ed943c65 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -287,7 +287,7 @@ static void cpu_max_get_packey(Object *obj, Visitor *v, const char *name,
 {
     ARMCPU *cpu = ARM_CPU(obj);
     const uint64_t *bit = opaque;
-    bool enabled = (cpu->env.cp15.sctlr_el[1] & *bit) != 0;
+    bool enabled = (cpu->reset_sctlr & *bit) != 0;
 
     visit_type_bool(v, name, &enabled, errp);
 }
@@ -304,9 +304,9 @@ static void cpu_max_set_packey(Object *obj, Visitor *v, const char *name,
 
     if (!err) {
         if (enabled) {
-            cpu->env.cp15.sctlr_el[1] |= *bit;
+            cpu->reset_sctlr |= *bit;
         } else {
-            cpu->env.cp15.sctlr_el[1] &= ~*bit;
+            cpu->reset_sctlr &= ~*bit;
         }
     }
     error_propagate(errp, err);
@@ -413,8 +413,8 @@ static void aarch64_max_initfn(Object *obj)
                                 (void *)&apdb_bit, &error_fatal);
 
             /* Enable all PAC keys by default.  */
-            cpu->env.cp15.sctlr_el[1] |= SCTLR_EnIA | SCTLR_EnIB;
-            cpu->env.cp15.sctlr_el[1] |= SCTLR_EnDA | SCTLR_EnDB;
+            cpu->reset_sctlr |= SCTLR_EnIA | SCTLR_EnIB;
+            cpu->reset_sctlr |= SCTLR_EnDA | SCTLR_EnDB;
         }
 #endif
 
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: "Rémi Denis-Courmont" <remi@remlab.net>
To: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCHv2 2/3] target/arm: actually enable PAuth in user mode
Date: Sat, 26 Jan 2019 08:52:11 +0200	[thread overview]
Message-ID: <20190126065211.3587-2-remi@remlab.net> (raw)
In-Reply-To: <1648289.tQCHxfjYn9@basile.remlab.net>

From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>

This always enables IA, IB, DA and DB keys in user mode on the maximum
CPU, in a manner that is consistent with the other CPUs. That is to say
redefining the reset value of SCTLR_ELx registers.

Without this patch, the PAC* and AUT* instructions have no effects
(except PACGA of course).

Signed-off-by: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
---
 target/arm/cpu64.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index e9bc461c36..c8ed943c65 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -287,7 +287,7 @@ static void cpu_max_get_packey(Object *obj, Visitor *v, const char *name,
 {
     ARMCPU *cpu = ARM_CPU(obj);
     const uint64_t *bit = opaque;
-    bool enabled = (cpu->env.cp15.sctlr_el[1] & *bit) != 0;
+    bool enabled = (cpu->reset_sctlr & *bit) != 0;
 
     visit_type_bool(v, name, &enabled, errp);
 }
@@ -304,9 +304,9 @@ static void cpu_max_set_packey(Object *obj, Visitor *v, const char *name,
 
     if (!err) {
         if (enabled) {
-            cpu->env.cp15.sctlr_el[1] |= *bit;
+            cpu->reset_sctlr |= *bit;
         } else {
-            cpu->env.cp15.sctlr_el[1] &= ~*bit;
+            cpu->reset_sctlr &= ~*bit;
         }
     }
     error_propagate(errp, err);
@@ -413,8 +413,8 @@ static void aarch64_max_initfn(Object *obj)
                                 (void *)&apdb_bit, &error_fatal);
 
             /* Enable all PAC keys by default.  */
-            cpu->env.cp15.sctlr_el[1] |= SCTLR_EnIA | SCTLR_EnIB;
-            cpu->env.cp15.sctlr_el[1] |= SCTLR_EnDA | SCTLR_EnDB;
+            cpu->reset_sctlr |= SCTLR_EnIA | SCTLR_EnIB;
+            cpu->reset_sctlr |= SCTLR_EnDA | SCTLR_EnDB;
         }
 #endif
 
-- 
2.20.1

  parent reply	other threads:[~2019-01-26  6:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 21:48 [Qemu-arm] [PATCH 0/3] target/arm: fix PAuth in user mode Rémi Denis-Courmont
2019-01-25 21:48 ` [Qemu-devel] " Rémi Denis-Courmont
2019-01-25 21:49 ` [Qemu-arm] [PATCH 1/3] target/arm: fix AArch64 virtual address space size Rémi Denis-Courmont
2019-01-25 21:49   ` [Qemu-devel] " Rémi Denis-Courmont
2019-01-25 23:29   ` [Qemu-arm] " Richard Henderson
2019-01-25 23:29     ` Richard Henderson
2019-01-26  6:36     ` [Qemu-arm] " Rémi Denis-Courmont
2019-01-26  6:36       ` [Qemu-devel] [Qemu-arm] " Rémi Denis-Courmont
2019-01-26  6:46       ` [Qemu-arm] [Qemu-devel] " Rémi Denis-Courmont
2019-01-26  6:46         ` [Qemu-devel] [Qemu-arm] " Rémi Denis-Courmont
2019-01-26 20:00       ` [Qemu-arm] [Qemu-devel] " Richard Henderson
2019-01-26 20:00         ` [Qemu-devel] [Qemu-arm] " Richard Henderson
2019-01-25 21:49 ` [Qemu-devel] [PATCH 2/3] target/arm: actually enable PAuth in user mode Rémi Denis-Courmont
2019-01-25 23:34   ` [Qemu-arm] " Richard Henderson
2019-01-25 23:34     ` Richard Henderson
2019-01-25 21:49 ` [Qemu-arm] [PATCH 3/3] target/arm: fix decoding of B{,L}RA{A,B} Rémi Denis-Courmont
2019-01-25 21:49   ` [Qemu-devel] " Rémi Denis-Courmont
2019-01-25 23:40   ` [Qemu-arm] [Qemu-devel] [PATCH 3/3] target/arm: fix decoding of B{, L}RA{A, B} Richard Henderson
2019-01-25 23:40     ` Richard Henderson
2019-01-27 19:06     ` [Qemu-arm] " Richard Henderson
2019-01-27 19:06       ` Richard Henderson
2019-01-26  6:52 ` [Qemu-arm] [PATCHv2 1/3] target/arm: fix AArch64 virtual address space size Rémi Denis-Courmont
2019-01-26  6:52   ` [Qemu-devel] " Rémi Denis-Courmont
2019-01-27 18:47   ` Richard Henderson
2019-01-26  6:52 ` Rémi Denis-Courmont [this message]
2019-01-26  6:52   ` [Qemu-devel] [PATCHv2 2/3] target/arm: actually enable PAuth in user mode Rémi Denis-Courmont
2019-01-27 18:48   ` [Qemu-arm] " Richard Henderson
2019-01-27 18:48     ` Richard Henderson
2019-02-01 15:27 ` [Qemu-arm] [PATCH 0/3] target/arm: fix " Peter Maydell
2019-02-01 15:27   ` [Qemu-devel] " Peter Maydell

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=20190126065211.3587-2-remi@remlab.net \
    --to=remi@remlab.net \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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.