Skip to contentSkip to conversation

linux-user: Add AT_SECURE auxval

PATCH In review Marco A L Barbosa 3 participants 6 messages Jan 11, 2018 – Jan 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 linux-user: Add AT_SECURE auxval

---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/elfload.c +2 -1
index 20f3d8c2c3..32a47674e6 100644
@@ -1354,7 +1354,7 @@ struct exec
                                  ~(abi_ulong)(TARGET_ELF_EXEC_PAGESIZE-1))
 #define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1))
 
-#define DLINFO_ITEMS 14
+#define DLINFO_ITEMS 15
 
 static inline void memcpy_fromfs(void * to, const void * from, unsigned long n)
 {
@@ -1786,6 +1786,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
     NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);
     NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK));
     NEW_AUX_ENT(AT_RANDOM, (abi_ulong) u_rand_bytes);
+    NEW_AUX_ENT(AT_SECURE, (abi_ulong) qemu_getauxval(AT_SECURE));
 
 #ifdef ELF_HWCAP2
     NEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2);
Signature · 1 line
2.11.0
#1 lore raw

For some reason send-email didn't include my comments, sorry.

Following the Peter Maydell advice we just pass through the host AT_SECURE.

This fixes https://bugs.launchpad.net/qemu/+bug/1738771

Version 1 for reference:
https://lists.gnu.org/archive/html/qemu-devel/2017-10/msg03667.html
https://lists.gnu.org/archive/html/qemu-devel/2018-01/msg01298.html

Quoted 32 lines · Marco A L Barbosa
---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/elfload.c +1 -1
index 20f3d8c2c3..32a47674e6 100644
@@ -1354,7 +1354,7 @@ struct exec
                                  ~(abi_ulong)(TARGET_ELF_EXEC_
 PAGESIZE-1))
 #define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1))
 
-#define DLINFO_ITEMS 14
+#define DLINFO_ITEMS 15
 
 static inline void memcpy_fromfs(void * to, const void * from, unsigned

long n)
{

linux-user/elfload.c +1 -0
@@ -1786,6 +1786,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int
 argc, int envc,
     NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);
     NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK));
     NEW_AUX_ENT(AT_RANDOM, (abi_ulong) u_rand_bytes);
+    NEW_AUX_ENT(AT_SECURE, (abi_ulong) qemu_getauxval(AT_SECURE));
 
 #ifdef ELF_HWCAP2
     NEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2);

--
2.11.0

Signature · 3 lines
Marco A L Barbosa
http://malbarbo.pro.br
--
#2 lore raw
In reply to Marco A L Barbosa
Quoted 3 lines · Marco A L Barbosa
---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

This is missing your Signed-off-by: line, which we need to be able to accept the patch.

(I've also cc'd the linux-user maintainers.)

Quoted 14 lines
linux-user/elfload.c +1 -1
index 20f3d8c2c3..32a47674e6 100644
@@ -1354,7 +1354,7 @@ struct exec
                                  ~(abi_ulong)(TARGET_ELF_EXEC_PAGESIZE-1))
 #define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1))
 
-#define DLINFO_ITEMS 14
+#define DLINFO_ITEMS 15
 
 static inline void memcpy_fromfs(void * to, const void * from, unsigned long n)
 {

linux-user/elfload.c static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,

Quoted 8 lines
linux-user/elfload.c +1 -1
@@ -1786,6 +1786,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
     NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);
     NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK));
     NEW_AUX_ENT(AT_RANDOM, (abi_ulong) u_rand_bytes);
+    NEW_AUX_ENT(AT_SECURE, (abi_ulong) qemu_getauxval(AT_SECURE));
 
 #ifdef ELF_HWCAP2
     NEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2);
--

For the content, Reviewed-by: Peter Maydell <[email protected]>

thanks
-- PMM

#3 lore raw

Thanks Peter,

Quoted 41 lines · Peter Maydell
Quoted 3 lines · Marco A L Barbosa
---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

This is missing your Signed-off-by: line, which we need to be able to accept the patch.

(I've also cc'd the linux-user maintainers.)

linux-user/elfload.c struct exec · line 1354

Quoted 6 lines
linux-user/elfload.c +0 -0
index 20f3d8c2c3..32a47674e6 100644
@@ -1354,7 +1354,7 @@ struct exec
                                  ~(abi_ulong)(TARGET_ELF_EXEC_

PAGESIZE-1))

linux-user/elfload.c struct exec

Quoted 6 lines
linux-user/elfload.c +1 -1
 #define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1))
 
-#define DLINFO_ITEMS 14
+#define DLINFO_ITEMS 15
 
 static inline void memcpy_fromfs(void * to, const void * from, unsigned

long n)

linux-user/elfload.c static abi_ulong create_elf_tables(abi_ulong p,

Quoted 2 lines
linux-user/elfload.c +0 -0
 {
@@ -1786,6 +1786,7 @@ static abi_ulong create_elf_tables(abi_ulong p,

int argc, int envc,

linux-user/elfload.c static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,

Quoted 8 lines
linux-user/elfload.c +1 -1
     NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);
     NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK));
     NEW_AUX_ENT(AT_RANDOM, (abi_ulong) u_rand_bytes);
+    NEW_AUX_ENT(AT_SECURE, (abi_ulong) qemu_getauxval(AT_SECURE));
 
 #ifdef ELF_HWCAP2
     NEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2);
--

For the content, Reviewed-by: Peter Maydell <[email protected]>

thanks
-- PMM

Signature · 3 lines
Marco A L Barbosa
http://malbarbo.pro.br
--
Reviewed-by on v2 1/1
#5 lore raw
In reply to Marco A L Barbosa

Le 11/01/2018 à 19:37, Marco A L Barbosa a écrit :

Quoted 19 lines
---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/elfload.c +1 -1
index 20f3d8c2c3..32a47674e6 100644
@@ -1354,7 +1354,7 @@ struct exec
                                  ~(abi_ulong)(TARGET_ELF_EXEC_PAGESIZE-1))
 #define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1))
 
-#define DLINFO_ITEMS 14
+#define DLINFO_ITEMS 15
 
 static inline void memcpy_fromfs(void * to, const void * from, unsigned long n)
 {

linux-user/elfload.c static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, · line 1792

Quoted 7 lines
linux-user/elfload.c +1 -0
@@ -1786,6 +1786,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
     NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);
     NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK));
     NEW_AUX_ENT(AT_RANDOM, (abi_ulong) u_rand_bytes);
+    NEW_AUX_ENT(AT_SECURE, (abi_ulong) qemu_getauxval(AT_SECURE));
 
 #ifdef ELF_HWCAP2
     NEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2);

after adding the comment and the S-o-b of v1: