Skip to contentSkip to conversation

linux-user updates and fixes

GIT PULL Applied [email protected] 3 participants 11 messages Feb 25, 2016 – May 25, 2016

lore
Share & tools
lore
#0 lore raw

From: Riku Voipio <[email protected]>

The following changes since commit 1b1624092d1f1f746adea6e1237a07f6788c2e3d:

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20160223-1' into staging (2016-02-23 16:14:17 +0000)

are available in the git repository at:

git://git.linaro.org/people/riku.voipio/qemu.git tags/pull-linux-user-20160225

for you to fetch changes up to f894efd19917321844b31e5dd7a061fdc6fb322d:

linux-user: add getrandom() syscall (2016-02-24 15:22:15 +0200)

----------------------------------------------------------------
Second pull req with getrandom fix

----------------------------------------------------------------
Laurent Vivier (3):
linux-user: fix realloc size of target_fd_trans.
linux-user: set ppc64/ppc64le default CPU to POWER8
linux-user: add getrandom() syscall

Lluís Vilanova (1):
build: [linux-user] Rename "syscall.h" to "target_syscall.h" in target
directories

Peter Maydell (1):
linux-user: Don't assert if guest tries shmdt(0)

Riku Voipio (3):
linux-user: sync syscall numbers with kernel
linux-user: remove unavailable syscalls from aarch64
linux-user: correct timerfd_create syscall numbers

 linux-user/aarch64/syscall.h           |  13 --
 linux-user/aarch64/syscall_nr.h        |  61 +-------
 linux-user/aarch64/target_syscall.h    |  18 +++
 linux-user/alpha/syscall.h             | 257 --------------------------------
 linux-user/alpha/syscall_nr.h          |   6 +
 linux-user/alpha/target_syscall.h      | 262 +++++++++++++++++++++++++++++++++
 linux-user/arm/syscall.h               |  50 -------
 linux-user/arm/target_syscall.h        |  54 +++++++
 linux-user/cris/syscall.h              |  46 ------
 linux-user/cris/syscall_nr.h           |  24 +++
 linux-user/cris/target_syscall.h       |  46 ++++++
 linux-user/i386/syscall.h              | 152 -------------------
 linux-user/i386/syscall_nr.h           |  29 +++-
 linux-user/i386/target_syscall.h       | 157 ++++++++++++++++++++
 linux-user/m68k/syscall.h              |  25 ----
 linux-user/m68k/syscall_nr.h           |   2 +-
 linux-user/m68k/target_syscall.h       |  29 ++++
 linux-user/main.c                      |   2 +-
 linux-user/microblaze/syscall.h        |  56 -------
 linux-user/microblaze/syscall_nr.h     |   8 +
 linux-user/microblaze/target_syscall.h |  56 +++++++
 linux-user/mips/syscall.h              | 233 -----------------------------
 linux-user/mips/target_syscall.h       | 237 +++++++++++++++++++++++++++++
 linux-user/mips64/syscall.h            | 230 -----------------------------
 linux-user/mips64/syscall_nr.h         |  23 +++
 linux-user/mips64/target_syscall.h     | 234 +++++++++++++++++++++++++++++
 linux-user/openrisc/syscall.h          |  29 ----
 linux-user/openrisc/syscall_nr.h       |  28 ++--
 linux-user/openrisc/target_syscall.h   |  34 +++++
 linux-user/ppc/syscall.h               |  75 ----------
 linux-user/ppc/syscall_nr.h            |  26 +++-
 linux-user/ppc/target_syscall.h        |  80 ++++++++++
 linux-user/qemu.h                      |   2 +-
 linux-user/s390x/syscall.h             |  29 ----
 linux-user/s390x/syscall_nr.h          |  30 ++++
 linux-user/s390x/target_syscall.h      |  34 +++++
 linux-user/sh4/syscall.h               |  17 ---
 linux-user/sh4/syscall_nr.h            |   2 +-
 linux-user/sh4/target_syscall.h        |  22 +++
 linux-user/sparc/syscall.h             |  20 ---
 linux-user/sparc/syscall_nr.h          |  16 +-
 linux-user/sparc/target_syscall.h      |  25 ++++
 linux-user/sparc64/syscall.h           |  21 ---
 linux-user/sparc64/syscall_nr.h        |  14 ++
 linux-user/sparc64/target_syscall.h    |  26 ++++
 linux-user/syscall.c                   |  31 ++--
 linux-user/tilegx/syscall.h            |  43 ------
 linux-user/tilegx/syscall_nr.h         |   4 +
 linux-user/tilegx/target_syscall.h     |  43 ++++++
 linux-user/unicore32/syscall.h         |  60 --------
 linux-user/unicore32/target_syscall.h  |  60 ++++++++
 linux-user/x86_64/syscall.h            | 102 -------------
 linux-user/x86_64/syscall_nr.h         |  15 +-
 linux-user/x86_64/target_syscall.h     | 107 ++++++++++++++
 54 files changed, 1754 insertions(+), 1551 deletions(-)
 delete mode 100644 linux-user/aarch64/syscall.h
 create mode 100644 linux-user/aarch64/target_syscall.h
 delete mode 100644 linux-user/alpha/syscall.h
 create mode 100644 linux-user/alpha/target_syscall.h
 delete mode 100644 linux-user/arm/syscall.h
 create mode 100644 linux-user/arm/target_syscall.h
 delete mode 100644 linux-user/cris/syscall.h
 create mode 100644 linux-user/cris/target_syscall.h
 delete mode 100644 linux-user/i386/syscall.h
 create mode 100644 linux-user/i386/target_syscall.h
 delete mode 100644 linux-user/m68k/syscall.h
 create mode 100644 linux-user/m68k/target_syscall.h
 delete mode 100644 linux-user/microblaze/syscall.h
 create mode 100644 linux-user/microblaze/target_syscall.h
 delete mode 100644 linux-user/mips/syscall.h
 create mode 100644 linux-user/mips/target_syscall.h
 delete mode 100644 linux-user/mips64/syscall.h
 create mode 100644 linux-user/mips64/target_syscall.h
 delete mode 100644 linux-user/openrisc/syscall.h
 create mode 100644 linux-user/openrisc/target_syscall.h
 delete mode 100644 linux-user/ppc/syscall.h
 create mode 100644 linux-user/ppc/target_syscall.h
 delete mode 100644 linux-user/s390x/syscall.h
 create mode 100644 linux-user/s390x/target_syscall.h
 delete mode 100644 linux-user/sh4/syscall.h
 create mode 100644 linux-user/sh4/target_syscall.h
 delete mode 100644 linux-user/sparc/syscall.h
 create mode 100644 linux-user/sparc/target_syscall.h
 delete mode 100644 linux-user/sparc64/syscall.h
 create mode 100644 linux-user/sparc64/target_syscall.h
 delete mode 100644 linux-user/tilegx/syscall.h
 create mode 100644 linux-user/tilegx/target_syscall.h
 delete mode 100644 linux-user/unicore32/syscall.h
 create mode 100644 linux-user/unicore32/target_syscall.h
 delete mode 100644 linux-user/x86_64/syscall.h
 create mode 100644 linux-user/x86_64/target_syscall.h
Signature · 1 line
2.1.4
#1 lore raw

[Qemu-devel] [PULL v2 1/8] linux-user: fix realloc size of target_fd_trans.

From: Laurent Vivier <[email protected]>

target_fd_trans is an array of "TargetFdTrans *": compute size accordingly. Use g_renew() as proposed by Paolo.

---
 linux-user/syscall.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/syscall.c +2 -2
index 54ce14a..dac5518 100644
@@ -318,8 +318,8 @@ static void fd_trans_register(int fd, TargetFdTrans *trans)
     if (fd >= target_fd_max) {
         oldmax = target_fd_max;
         target_fd_max = ((fd >> 6) + 1) << 6; /* by slice of 64 entries */
-        target_fd_trans = g_realloc(target_fd_trans,
-                                    target_fd_max * sizeof(TargetFdTrans));
+        target_fd_trans = g_renew(TargetFdTrans *,
+                                  target_fd_trans, target_fd_max);
         memset((void *)(target_fd_trans + oldmax), 0,
                (target_fd_max - oldmax) * sizeof(TargetFdTrans *));
     }
Signature · 1 line
2.1.4
#2 lore raw

[Qemu-devel] [PULL v2 3/8] linux-user: set ppc64/ppc64le default CPU to POWER8

In reply to [email protected]

From: Laurent Vivier <[email protected]>

Set the default to the latest CPU version to have the largest set of available features.

It is also really needed in little-endian mode because POWER7 is not really supported in this mode and some distros (at least debian) generate POWER8 code for their ppc64le target.

---
 linux-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/main.c +1 -1
index e719a2d..2a692e0 100644
@@ -4160,7 +4160,7 @@ int main(int argc, char **argv, char **envp)
         cpu_model = "or1200";
 #elif defined(TARGET_PPC)
 # ifdef TARGET_PPC64
-        cpu_model = "POWER7";
+        cpu_model = "POWER8";
 # else
         cpu_model = "750";
 # endif
Signature · 1 line
2.1.4
#3 lore raw

Re: [Qemu-devel] [PULL v2 3/8] linux-user: set ppc64/ppc64le default CPU to POWER8

Hi,

Sorry ignore these "pull v2" mails, apparently I had some old files lying around..

Quoted 36 lines · On Wed, May 25, 2016 at 08:27:38AM +0300, [email protected] wrote:

From: Laurent Vivier <[email protected]>

Set the default to the latest CPU version to have the largest set of available features.

It is also really needed in little-endian mode because POWER7 is not really supported in this mode and some distros (at least debian) generate POWER8 code for their ppc64le target.

---
 linux-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/main.c +1 -1
index e719a2d..2a692e0 100644
@@ -4160,7 +4160,7 @@ int main(int argc, char **argv, char **envp)
         cpu_model = "or1200";
 #elif defined(TARGET_PPC)
 # ifdef TARGET_PPC64
-        cpu_model = "POWER7";
+        cpu_model = "POWER8";
 # else
         cpu_model = "750";
 # endif
Signature · 1 line
2.1.4
#4 lore raw

[Qemu-devel] [PULL v2 6/8] linux-user: remove unavailable syscalls from aarch64

In reply to [email protected]

From: Riku Voipio <[email protected]>

QEMU lists deprecated system call numbers in for Aarch64. These are never enabled for Linux kernel, so don't define them in Qemu either. Remove the ifdef around host_to_target_stat64 since all architectures need it now.

---
 linux-user/aarch64/syscall_nr.h | 59 -----------------------------------------
 linux-user/syscall.c            |  2 --
 2 files changed, 61 deletions(-)
linux-user/aarch64/syscall_nr.h +0 -59
index c8a8599..59511d8 100644
@@ -275,62 +275,3 @@
 #define TARGET_NR_mlock2 284
 #define TARGET_NR_copy_file_range 285
 
-#define TARGET_NR_open 1024
-#define TARGET_NR_link 1025
-#define TARGET_NR_unlink 1026
-#define TARGET_NR_mknod 1027
-#define TARGET_NR_chmod 1028
-#define TARGET_NR_chown 1029
-#define TARGET_NR_mkdir 1030
-#define TARGET_NR_rmdir 1031
-#define TARGET_NR_lchown 1032
-#define TARGET_NR_access 1033
-#define TARGET_NR_rename 1034
-#define TARGET_NR_readlink 1035
-#define TARGET_NR_symlink 1036
-#define TARGET_NR_utimes 1037
-#define TARGET_NR_stat 1038
-#define TARGET_NR_lstat 1039
-#define TARGET_NR_pipe 1040
-#define TARGET_NR_dup2 1041
-#define TARGET_NR_epoll_create 1042
-#define TARGET_NR_inotify_init 1043
-#define TARGET_NR_eventfd 1044
-#define TARGET_NR_signalfd 1045
-#define TARGET_NR_sendfile64 1046
-#define TARGET_NR_ftruncate64 1047
-#define TARGET_NR_truncate64 1048
-#define TARGET_NR_stat64 1049
-#define TARGET_NR_lstat64 1050
-#define TARGET_NR_fstat64 1051
-#define TARGET_NR_fcntl64 1052
-/* #define TARGET_NR_fadvise64 1053 */
-#define TARGET_NR_newfstatat 1054
-#define TARGET_NR_fstatfs64 1055
-#define TARGET_NR_statfs64 1056
-#define TARGET_NR_lseek64 1057
-#define TARGET_NR_mmap64 1058
-#define TARGET_NR_alarm 1059
-#define TARGET_NR_getpgrp 1060
-#define TARGET_NR_pause 1061
-#define TARGET_NR_time 1062
-#define TARGET_NR_utime 1063
-#define TARGET_NR_creat 1064
-#define TARGET_NR_getdents 1065
-#define TARGET_NR_futimesat 1066
-#define TARGET_NR_select 1067
-#define TARGET_NR_poll 1068
-#define TARGET_NR_epoll_wait 1069
-#define TARGET_NR_ustat 1070
-#define TARGET_NR_vfork 1071
-#define TARGET_NR_oldwait4 1072
-#define TARGET_NR_recv 1073
-#define TARGET_NR_send 1074
-#define TARGET_NR_bdflush 1075
-#define TARGET_NR_umount 1076
-#define TARGET_NR_uselib 1077
-#define TARGET_NR__sysctl 1078
-#define TARGET_NR_fork 1079
-#define TARGET_NR_syscalls (__NR_fork+1)
-
-#define TARGET_NR_sigreturn 1999
linux-user/syscall.c +0 -2
index 8b76169..539183a 100644
@@ -5231,7 +5231,6 @@ static inline int target_to_host_mlockall_arg(int arg)
 }
 #endif
 
-#if defined(TARGET_NR_stat64) || defined(TARGET_NR_newfstatat)
 static inline abi_long host_to_target_stat64(void *cpu_env,
                                              abi_ulong target_addr,
                                              struct stat *host_st)
@@ -5294,7 +5293,6 @@ static inline abi_long host_to_target_stat64(void *cpu_env,
 
     return 0;
 }
-#endif
 
 /* ??? Using host futex calls even when target atomic operations
    are not really atomic probably breaks things.  However implementing
Signature · 1 line
2.1.4
#5 lore raw

[Qemu-devel] [PULL v2 5/8] linux-user: sync syscall numbers with kernel

In reply to [email protected]

From: Riku Voipio <[email protected]>

Sync syscall numbers to match the linux v4.5-rc1 kernel.

---
 linux-user/aarch64/syscall_nr.h    |  2 +-
 linux-user/alpha/syscall_nr.h      |  6 ++++++
 linux-user/cris/syscall_nr.h       | 24 ++++++++++++++++++++++++
 linux-user/i386/syscall_nr.h       | 27 +++++++++++++++++++++++++++
 linux-user/microblaze/syscall_nr.h |  8 ++++++++
 linux-user/mips64/syscall_nr.h     | 23 +++++++++++++++++++++++
 linux-user/openrisc/syscall_nr.h   | 28 ++++++++++++----------------
 linux-user/ppc/syscall_nr.h        | 24 ++++++++++++++++++++++++
 linux-user/s390x/syscall_nr.h      | 30 ++++++++++++++++++++++++++++++
 linux-user/sparc/syscall_nr.h      | 14 ++++++++++++++
 linux-user/sparc64/syscall_nr.h    | 14 ++++++++++++++
 linux-user/tilegx/syscall_nr.h     |  4 ++++
 linux-user/x86_64/syscall_nr.h     | 13 +++++++++++++
 13 files changed, 200 insertions(+), 17 deletions(-)
linux-user/aarch64/syscall_nr.h +1 -1
index 74f4275..c8a8599 100644
@@ -262,7 +262,6 @@
 #define TARGET_NR_process_vm_writev 271
 #define TARGET_NR_kcmp 272
 #define TARGET_NR_finit_module 273
-
 #define TARGET_NR_sched_setattr 274
 #define TARGET_NR_sched_getattr 275
 #define TARGET_NR_renameat2 276
@@ -274,6 +273,7 @@
 #define TARGET_NR_userfaultfd 282
 #define TARGET_NR_membarrier 283
 #define TARGET_NR_mlock2 284
+#define TARGET_NR_copy_file_range 285
 
 #define TARGET_NR_open 1024
 #define TARGET_NR_link 1025
linux-user/alpha/syscall_nr.h +6 -0
index dde8d5c..00e14bb 100644
@@ -444,3 +444,9 @@
 #define TARGET_NR_process_vm_writev             505
 #define TARGET_NR_kcmp                          506
 #define TARGET_NR_finit_module                  507
+#define TARGET_NR_sched_setattr                 508
+#define TARGET_NR_sched_getattr                 509
+#define TARGET_NR_renameat2                     510
+#define TARGET_NR_getrandom                     511
+#define TARGET_NR_memfd_create                  512
+#define TARGET_NR_execveat                      513
linux-user/cris/syscall_nr.h +24 -0
index 694bd02..44f0b64 100644
@@ -336,3 +336,27 @@
 #define TARGET_NR_preadv             333
 #define TARGET_NR_pwritev            334
 #define TARGET_NR_setns              335
+#define TARGET_NR_name_to_handle_at  336
+#define TARGET_NR_open_by_handle_at  337
+#define TARGET_NR_rt_tgsigqueueinfo  338
+#define TARGET_NR_perf_event_open    339
+#define TARGET_NR_recvmmsg           340
+#define TARGET_NR_accept4            341
+#define TARGET_NR_fanotify_init      342
+#define TARGET_NR_fanotify_mark      343
+#define TARGET_NR_prlimit64          344
+#define TARGET_NR_clock_adjtime      345
+#define TARGET_NR_syncfs             346
+#define TARGET_NR_sendmmsg           347
+#define TARGET_NR_process_vm_readv   348
+#define TARGET_NR_process_vm_writev  349
+#define TARGET_NR_kcmp               350
+#define TARGET_NR_finit_module       351
+#define TARGET_NR_sched_setattr      352
+#define TARGET_NR_sched_getattr      353
+#define TARGET_NR_renameat2          354
+#define TARGET_NR_seccomp            355
+#define TARGET_NR_getrandom          356
+#define TARGET_NR_memfd_create       357
+#define TARGET_NR_bpf                358
+#define TARGET_NR_execveat           359
linux-user/i386/syscall_nr.h +27 -0
index c8f7302..fa3f0b4 100644
@@ -353,3 +353,30 @@
 #define TARGET_NR_process_vm_writev     348
 #define TARGET_NR_kcmp                  349
 #define TARGET_NR_finit_module          350
+#define TARGET_NR_sched_setattr         351
+#define TARGET_NR_sched_getattr         352
+#define TARGET_NR_renameat2             353
+#define TARGET_NR_seccomp               354
+#define TARGET_NR_getrandom             355
+#define TARGET_NR_memfd_create          356
+#define TARGET_NR_bpf                   357
+#define TARGET_NR_execveat              358
+#define TARGET_NR_socket                359
+#define TARGET_NR_socketpair            360
+#define TARGET_NR_bind                  361
+#define TARGET_NR_connect               362
+#define TARGET_NR_listen                363
+#define TARGET_NR_accept4               364
+#define TARGET_NR_getsockopt            365
+#define TARGET_NR_setsockopt            366
+#define TARGET_NR_getsockname           367
+#define TARGET_NR_getpeername           368
+#define TARGET_NR_sendto                369
+#define TARGET_NR_sendmsg               370
+#define TARGET_NR_recvfrom              371
+#define TARGET_NR_recvmsg               372
+#define TARGET_NR_shutdown              373
+#define TARGET_NR_userfaultfd           374
+#define TARGET_NR_membarrier            375
+#define TARGET_NR_mlock2                376
+#define TARGET_NR_copy_file_range       377
linux-user/microblaze/syscall_nr.h +8 -0
index 6f530f9..0704449 100644
@@ -382,3 +382,11 @@
 #define TARGET_NR_process_vm_writev     378
 #define TARGET_NR_kcmp                  379
 #define TARGET_NR_finit_module          380
+#define TARGET_NR_sched_setattr         381
+#define TARGET_NR_sched_getattr         382
+#define TARGET_NR_renameat2             383
+#define TARGET_NR_seccomp               384
+#define TARGET_NR_getrandom             385
+#define TARGET_NR_memfd_create          386
+#define TARGET_NR_bpf                   387
+#define TARGET_NR_execveat              388
linux-user/mips64/syscall_nr.h +23 -0
index 004232a..746cc26 100644
@@ -316,6 +316,18 @@
 #define TARGET_NR_process_vm_writev     (TARGET_NR_Linux + 310)
 #define TARGET_NR_kcmp                  (TARGET_NR_Linux + 311)
 #define TARGET_NR_finit_module          (TARGET_NR_Linux + 312)
+#define TARGET_NR_sched_setattr         (TARGET_NR_Linux + 313)
+#define TARGET_NR_sched_getattr         (TARGET_NR_Linux + 314)
+#define TARGET_NR_renameat2             (TARGET_NR_Linux + 315)
+#define TARGET_NR_seccomp               (TARGET_NR_Linux + 316)
+#define TARGET_NR_getrandom             (TARGET_NR_Linux + 317)
+#define TARGET_NR_memfd_create          (TARGET_NR_Linux + 318)
+#define TARGET_NR_bpf                   (TARGET_NR_Linux + 319)
+#define TARGET_NR_execveat              (TARGET_NR_Linux + 320)
+#define TARGET_NR_userfaultfd           (TARGET_NR_Linux + 321)
+#define TARGET_NR_membarrier            (TARGET_NR_Linux + 322)
+#define TARGET_NR_mlock2                (TARGET_NR_Linux + 323)
+
 #else
 /*
  * Linux 64-bit syscalls are in the range from 5000 to 5999.
@@ -630,4 +642,15 @@
 #define TARGET_NR_kcmp                  (TARGET_NR_Linux + 306)
 #define TARGET_NR_finit_module          (TARGET_NR_Linux + 307)
 #define TARGET_NR_getdents64            (TARGET_NR_Linux + 308)
+#define TARGET_NR_sched_setattr         (TARGET_NR_Linux + 309)
+#define TARGET_NR_sched_getattr         (TARGET_NR_Linux + 310)
+#define TARGET_NR_renameat2             (TARGET_NR_Linux + 311)
+#define TARGET_NR_seccomp               (TARGET_NR_Linux + 312)
+#define TARGET_NR_getrandom             (TARGET_NR_Linux + 313)
+#define TARGET_NR_memfd_create          (TARGET_NR_Linux + 314)
+#define TARGET_NR_bpf                   (TARGET_NR_Linux + 315)
+#define TARGET_NR_execveat              (TARGET_NR_Linux + 316)
+#define TARGET_NR_userfaultfd           (TARGET_NR_Linux + 317)
+#define TARGET_NR_membarrier            (TARGET_NR_Linux + 318)
+#define TARGET_NR_mlock2                (TARGET_NR_Linux + 319)
 #endif
linux-user/openrisc/syscall_nr.h +12 -16
index 4c386ea..6b1c7d2 100644
@@ -382,9 +382,18 @@
 #define TARGET_NR_process_vm_writev 271
 #define TARGET_NR_kcmp 272
 #define TARGET_NR_finit_module 273
-
-#undef TARGET_NR_syscalls
-#define TARGET_NR_syscalls 274
+#define TARGET_NR_sched_setattr 274
+#define TARGET_NR_sched_getattr 275
+#define TARGET_NR_renameat2 276
+#define TARGET_NR_seccomp 277
+#define TARGET_NR_getrandom 278
+#define TARGET_NR_memfd_create 279
+#define TARGET_NR_bpf 280
+#define TARGET_NR_execveat 281
+#define TARGET_NR_userfaultfd 282
+#define TARGET_NR_membarrier 283
+#define TARGET_NR_mlock2 284
+#define TARGET_NR_copy_file_range 285
 
 /*
  * All syscalls below here should go away really,
@@ -411,9 +420,6 @@
 #define TARGET_NR_3264_stat 1038
 #define TARGET_NR_3264_lstat 1039
 
-#undef TARGET_NR_syscalls
-#define TARGET_NR_syscalls (TARGET_NR_3264_lstat+1)
-
 #define TARGET_NR_pipe 1040
 #define TARGET_NR_dup2 1041
 #define TARGET_NR_epoll_create 1042
@@ -421,10 +427,6 @@
 #define TARGET_NR_eventfd 1044
 #define TARGET_NR_signalfd 1045
 
-#undef TARGET_NR_syscalls
-#define TARGET_NR_syscalls (TARGET_NR_signalfd+1)
-
-
 #define TARGET_NR_sendfile 1046
 #define TARGET_NR_ftruncate 1047
 #define TARGET_NR_truncate 1048
@@ -441,9 +443,6 @@
 #define TARGET_NR_lseek 1057
 #define TARGET_NR_mmap 1058
 
-#undef TARGET_NR_syscalls
-#define TARGET_NR_syscalls (TARGET_NR_mmap+1)
-
 #define TARGET_NR_alarm 1059
 #define __ARCH_WANT_SYS_ALARM
 #define TARGET_NR_getpgrp 1060
@@ -477,9 +476,6 @@
 
 #define TARGET_NR_fork 1079
 
-#undef TARGET_NR_syscalls
-#define TARGET_NR_syscalls (TARGET_NR_fork+1)
-
 
 /*
  * 32 bit systems traditionally used different
linux-user/ppc/syscall_nr.h +24 -0
index 1e1736e..0a5fd54 100644
@@ -368,3 +368,27 @@
 #define TARGET_NR_process_vm_writev     352
 #define TARGET_NR_finit_module          353
 #define TARGET_NR_kcmp                  354
+#define TARGET_NR_sched_setattr         355
+#define TARGET_NR_sched_getattr         356
+#define TARGET_NR_renameat2             357
+#define TARGET_NR_seccomp               358
+#define TARGET_NR_getrandom             359
+#define TARGET_NR_memfd_create          360
+#define TARGET_NR_bpf                   361
+#define TARGET_NR_execveat              362
+#define TARGET_NR_switch_endian         363
+#define TARGET_NR_userfaultfd           364
+#define TARGET_NR_membarrier            365
+#define TARGET_NR_semop                 366
+#define TARGET_NR_semget                367
+#define TARGET_NR_semctl                368
+#define TARGET_NR_semtimedop            369
+#define TARGET_NR_msgsnd                370
+#define TARGET_NR_msgrcv                371
+#define TARGET_NR_msgget                372
+#define TARGET_NR_msgctl                373
+#define TARGET_NR_shmat                 374
+#define TARGET_NR_shmdt                 375
+#define TARGET_NR_shmget                376
+#define TARGET_NR_shmctl                377
+#define TARGET_NR_mlock2                378
linux-user/s390x/syscall_nr.h +30 -0
index 7c0b8b2..1a66c55 100644
@@ -271,6 +271,36 @@
 #define TARGET_NR_s390_runtime_instr    342
 #define TARGET_NR_kcmp                  343
 #define TARGET_NR_finit_module          344
+#define TARGET_NR_sched_setattr         345
+#define TARGET_NR_sched_getattr         346
+#define TARGET_NR_renameat2             347
+#define TARGET_NR_seccomp               348
+#define TARGET_NR_getrandom             349
+#define TARGET_NR_memfd_create          350
+#define TARGET_NR_bpf                   351
+#define TARGET_NR_s390_pci_mmio_write   352
+#define TARGET_NR_s390_pci_mmio_read    353
+#define TARGET_NR_execveat              354
+#define TARGET_NR_userfaultfd           355
+#define TARGET_NR_membarrier            356
+#define TARGET_NR_recvmmsg              357
+#define TARGET_NR_sendmmsg              358
+#define TARGET_NR_socket                359
+#define TARGET_NR_socketpair            360
+#define TARGET_NR_bind                  361
+#define TARGET_NR_connect               362
+#define TARGET_NR_listen                363
+#define TARGET_NR_accept4               364
+#define TARGET_NR_getsockopt            365
+#define TARGET_NR_setsockopt            366
+#define TARGET_NR_getsockname           367
+#define TARGET_NR_getpeername           368
+#define TARGET_NR_sendto                369
+#define TARGET_NR_sendmsg               370
+#define TARGET_NR_recvfrom              371
+#define TARGET_NR_recvmsg               372
+#define TARGET_NR_shutdown              373
+#define TARGET_NR_mlock2                374
 
 /*
  * There are some system calls that are not present on 64 bit, some
linux-user/sparc/syscall_nr.h +14 -0
index 181cd32..5b582a5 100644
@@ -309,3 +309,17 @@
 #define TARGET_NR_kern_features         340
 #define TARGET_NR_kcmp                  341
 #define TARGET_NR_finit_module          342
+#define TARGET_NR_sched_setattr         343
+#define TARGET_NR_sched_getattr         344
+#define TARGET_NR_renameat2             345
+#define TARGET_NR_seccomp               346
+#define TARGET_NR_getrandom             347
+#define TARGET_NR_memfd_create          348
+#define TARGET_NR_bpf                   349
+#define TARGET_NR_execveat              350
+#define TARGET_NR_membarrier            351
+#define TARGET_NR_userfaultfd           352
+#define TARGET_NR_bind                  353
+#define TARGET_NR_listen                354
+#define TARGET_NR_setsockopt            355
+#define TARGET_NR_mlock2                356
linux-user/sparc64/syscall_nr.h +14 -0
index 34a984c..2b49ead 100644
@@ -341,3 +341,17 @@
 #define TARGET_NR_kern_features         340
 #define TARGET_NR_kcmp                  341
 #define TARGET_NR_finit_module          342
+#define TARGET_NR_sched_setattr         343
+#define TARGET_NR_sched_getattr         344
+#define TARGET_NR_renameat2             345
+#define TARGET_NR_seccomp               346
+#define TARGET_NR_getrandom             347
+#define TARGET_NR_memfd_create          348
+#define TARGET_NR_bpf                   349
+#define TARGET_NR_execveat              350
+#define TARGET_NR_membarrier            351
+#define TARGET_NR_userfaultfd           352
+#define TARGET_NR_bind                  353
+#define TARGET_NR_listen                354
+#define TARGET_NR_setsockopt            355
+#define TARGET_NR_mlock2                356
linux-user/tilegx/syscall_nr.h +4 -0
index 1dca348..87fb72c 100644
@@ -274,6 +274,10 @@
 #define TARGET_NR_memfd_create                  279
 #define TARGET_NR_bpf                           280
 #define TARGET_NR_execveat                      281
+#define TARGET_NR_userfaultfd                   282
+#define TARGET_NR_membarrier                    283
+#define TARGET_NR_mlock2                        284
+#define TARGET_NR_copy_file_range               285
 
 #define TARGET_NR_open                          1024
 #define TARGET_NR_link                          1025
linux-user/x86_64/syscall_nr.h +13 -0
index 7c59e3a..f00fa2b 100644
@@ -312,3 +312,16 @@
 #define TARGET_NR_process_vm_writev     311
 #define TARGET_NR_kcmp                  312
 #define TARGET_NR_finit_module          313
+#define TARGET_NR_sched_setattr         314
+#define TARGET_NR_sched_getattr         315
+#define TARGET_NR_renameat2             316
+#define TARGET_NR_seccomp               317
+#define TARGET_NR_getrandom             318
+#define TARGET_NR_memfd_create          319
+#define TARGET_NR_kexec_file_load       320
+#define TARGET_NR_bpf                   321
+#define TARGET_NR_execveat              322
+#define TARGET_NR_userfaultfd           323
+#define TARGET_NR_membarrier            324
+#define TARGET_NR_mlock2                325
+#define TARGET_NR_copy_file_range       326
Signature · 1 line
2.1.4
#6 lore raw

[Qemu-devel] [PULL v2 4/8] linux-user: Don't assert if guest tries shmdt(0)

In reply to [email protected]

From: Peter Maydell <[email protected]>

Our implementation of shmat() and shmdt() for linux-user was using "zero guest address" as its marker for "entry in the shm_regions[] array is not in use". This meant that if the guest did a shmdt(0) we would match on an unused array entry and call page_set_flags() with both start and end addresses zero, which causes an assertion failure.

Use an explicit in_use flag to manage the shm_regions[] array, so that we avoid this problem.

---
 linux-user/syscall.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
linux-user/syscall.c +7 -5
index dac5518..8b76169 100644
@@ -2598,8 +2598,9 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
 #define N_SHM_REGIONS	32
 
 static struct shm_region {
-    abi_ulong	start;
-    abi_ulong	size;
+    abi_ulong start;
+    abi_ulong size;
+    bool in_use;
 } shm_regions[N_SHM_REGIONS];
 
 struct target_semid_ds
@@ -3291,7 +3292,8 @@ static inline abi_ulong do_shmat(int shmid, abi_ulong shmaddr, int shmflg)
                    ((shmflg & SHM_RDONLY)? 0 : PAGE_WRITE));
 
     for (i = 0; i < N_SHM_REGIONS; i++) {
-        if (shm_regions[i].start == 0) {
+        if (!shm_regions[i].in_use) {
+            shm_regions[i].in_use = true;
             shm_regions[i].start = raddr;
             shm_regions[i].size = shm_info.shm_segsz;
             break;
@@ -3308,8 +3310,8 @@ static inline abi_long do_shmdt(abi_ulong shmaddr)
     int i;
 
     for (i = 0; i < N_SHM_REGIONS; ++i) {
-        if (shm_regions[i].start == shmaddr) {
-            shm_regions[i].start = 0;
+        if (shm_regions[i].in_use && shm_regions[i].start == shmaddr) {
+            shm_regions[i].in_use = false;
             page_set_flags(shmaddr, shmaddr + shm_regions[i].size, 0);
             break;
         }
Signature · 1 line
2.1.4
#7 lore raw

[Qemu-devel] [PULL v2 2/8] build: [linux-user] Rename "syscall.h" to "target_syscall.h" in target directories

In reply to [email protected]

From: Lluís Vilanova <[email protected]>

This fixes double-definitions in linux-user builds when using the UST tracing backend (which indirectly includes the system's "syscall.h").

---
 linux-user/aarch64/syscall.h           |  13 --
 linux-user/aarch64/target_syscall.h    |  18 +++
 linux-user/alpha/syscall.h             | 257 --------------------------------
 linux-user/alpha/target_syscall.h      | 262 +++++++++++++++++++++++++++++++++
 linux-user/arm/syscall.h               |  50 -------
 linux-user/arm/target_syscall.h        |  54 +++++++
 linux-user/cris/syscall.h              |  46 ------
 linux-user/cris/target_syscall.h       |  46 ++++++
 linux-user/i386/syscall.h              | 152 -------------------
 linux-user/i386/target_syscall.h       | 157 ++++++++++++++++++++
 linux-user/m68k/syscall.h              |  25 ----
 linux-user/m68k/target_syscall.h       |  29 ++++
 linux-user/microblaze/syscall.h        |  56 -------
 linux-user/microblaze/target_syscall.h |  56 +++++++
 linux-user/mips/syscall.h              | 233 -----------------------------
 linux-user/mips/target_syscall.h       | 237 +++++++++++++++++++++++++++++
 linux-user/mips64/syscall.h            | 230 -----------------------------
 linux-user/mips64/target_syscall.h     | 234 +++++++++++++++++++++++++++++
 linux-user/openrisc/syscall.h          |  29 ----
 linux-user/openrisc/target_syscall.h   |  34 +++++
 linux-user/ppc/syscall.h               |  75 ----------
 linux-user/ppc/target_syscall.h        |  80 ++++++++++
 linux-user/qemu.h                      |   2 +-
 linux-user/s390x/syscall.h             |  29 ----
 linux-user/s390x/target_syscall.h      |  34 +++++
 linux-user/sh4/syscall.h               |  17 ---
 linux-user/sh4/target_syscall.h        |  22 +++
 linux-user/sparc/syscall.h             |  20 ---
 linux-user/sparc/target_syscall.h      |  25 ++++
 linux-user/sparc64/syscall.h           |  21 ---
 linux-user/sparc64/target_syscall.h    |  26 ++++
 linux-user/tilegx/syscall.h            |  43 ------
 linux-user/tilegx/target_syscall.h     |  43 ++++++
 linux-user/unicore32/syscall.h         |  60 --------
 linux-user/unicore32/target_syscall.h  |  60 ++++++++
 linux-user/x86_64/syscall.h            | 102 -------------
 linux-user/x86_64/target_syscall.h     | 107 ++++++++++++++
 37 files changed, 1525 insertions(+), 1459 deletions(-)
 delete mode 100644 linux-user/aarch64/syscall.h
 create mode 100644 linux-user/aarch64/target_syscall.h
 delete mode 100644 linux-user/alpha/syscall.h
 create mode 100644 linux-user/alpha/target_syscall.h
 delete mode 100644 linux-user/arm/syscall.h
 create mode 100644 linux-user/arm/target_syscall.h
 delete mode 100644 linux-user/cris/syscall.h
 create mode 100644 linux-user/cris/target_syscall.h
 delete mode 100644 linux-user/i386/syscall.h
 create mode 100644 linux-user/i386/target_syscall.h
 delete mode 100644 linux-user/m68k/syscall.h
 create mode 100644 linux-user/m68k/target_syscall.h
 delete mode 100644 linux-user/microblaze/syscall.h
 create mode 100644 linux-user/microblaze/target_syscall.h
 delete mode 100644 linux-user/mips/syscall.h
 create mode 100644 linux-user/mips/target_syscall.h
 delete mode 100644 linux-user/mips64/syscall.h
 create mode 100644 linux-user/mips64/target_syscall.h
 delete mode 100644 linux-user/openrisc/syscall.h
 create mode 100644 linux-user/openrisc/target_syscall.h
 delete mode 100644 linux-user/ppc/syscall.h
 create mode 100644 linux-user/ppc/target_syscall.h
 delete mode 100644 linux-user/s390x/syscall.h
 create mode 100644 linux-user/s390x/target_syscall.h
 delete mode 100644 linux-user/sh4/syscall.h
 create mode 100644 linux-user/sh4/target_syscall.h
 delete mode 100644 linux-user/sparc/syscall.h
 create mode 100644 linux-user/sparc/target_syscall.h
 delete mode 100644 linux-user/sparc64/syscall.h
 create mode 100644 linux-user/sparc64/target_syscall.h
 delete mode 100644 linux-user/tilegx/syscall.h
 create mode 100644 linux-user/tilegx/target_syscall.h
 delete mode 100644 linux-user/unicore32/syscall.h
 create mode 100644 linux-user/unicore32/target_syscall.h
 delete mode 100644 linux-user/x86_64/syscall.h
 create mode 100644 linux-user/x86_64/target_syscall.h
linux-user/aarch64/syscall.h deleted +0 -13
deleted file mode 100644
index dc72a15..0000000
@@ -1,13 +0,0 @@
-struct target_pt_regs {
-    uint64_t        regs[31];
-    uint64_t        sp;
-    uint64_t        pc;
-    uint64_t        pstate;
-};
-
-#define UNAME_MACHINE "aarch64"
-#define UNAME_MINIMUM_RELEASE "3.8.0"
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ       2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
linux-user/aarch64/target_syscall.h new file +18 -0
new file mode 100644
index 0000000..f458018
@@ -0,0 +1,18 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+    uint64_t        regs[31];
+    uint64_t        sp;
+    uint64_t        pc;
+    uint64_t        pstate;
+};
+
+#define UNAME_MACHINE "aarch64"
+#define UNAME_MINIMUM_RELEASE "3.8.0"
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ       2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
linux-user/alpha/syscall.h deleted +0 -257

257 lines not on this page · raw message

linux-user/alpha/target_syscall.h new file +262 -0

262 lines not on this page · raw message

linux-user/arm/syscall.h deleted +0 -50

50 lines not on this page · raw message

linux-user/arm/target_syscall.h new file +54 -0

54 lines not on this page · raw message

linux-user/cris/syscall.h deleted +0 -46

46 lines not on this page · raw message

linux-user/cris/target_syscall.h new file +46 -0

46 lines not on this page · raw message

linux-user/i386/syscall.h deleted +0 -152

152 lines not on this page · raw message

linux-user/i386/target_syscall.h new file +157 -0

157 lines not on this page · raw message

linux-user/m68k/syscall.h deleted +0 -25
deleted file mode 100644
index 9218493..0000000
@@ -1,25 +0,0 @@
-
-/* this struct defines the way the registers are stored on the
-   stack during a system call. */
-
-struct target_pt_regs {
-    abi_long d1, d2, d3, d4, d5, d6, d7;
-    abi_long a0, a1, a2, a3, a4, a5, a6;
-    abi_ulong d0;
-    abi_ulong usp;
-    abi_ulong orig_d0;
-    int16_t stkadj;
-    uint16_t sr;
-    abi_ulong pc;
-    uint16_t fntvex;
-    uint16_t __fill;
-};
-
-#define UNAME_MACHINE "m68k"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
-
-void do_m68k_simcall(CPUM68KState *, int);
linux-user/m68k/target_syscall.h new file +29 -0
new file mode 100644
index 0000000..97a4cc0
@@ -0,0 +1,29 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* this struct defines the way the registers are stored on the
+   stack during a system call. */
+
+struct target_pt_regs {
+    abi_long d1, d2, d3, d4, d5, d6, d7;
+    abi_long a0, a1, a2, a3, a4, a5, a6;
+    abi_ulong d0;
+    abi_ulong usp;
+    abi_ulong orig_d0;
+    int16_t stkadj;
+    uint16_t sr;
+    abi_ulong pc;
+    uint16_t fntvex;
+    uint16_t __fill;
+};
+
+#define UNAME_MACHINE "m68k"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+void do_m68k_simcall(CPUM68KState *, int);
+
+#endif  /* TARGET_SYSCALL_H */
linux-user/microblaze/syscall.h deleted +0 -56

56 lines not on this page · raw message

linux-user/microblaze/target_syscall.h new file +56 -0

56 lines not on this page · raw message

linux-user/mips/syscall.h deleted +0 -233

233 lines not on this page · raw message

linux-user/mips/target_syscall.h new file +237 -0

237 lines not on this page · raw message

linux-user/mips64/syscall.h deleted +0 -230

230 lines not on this page · raw message

linux-user/mips64/target_syscall.h new file +234 -0

234 lines not on this page · raw message

linux-user/openrisc/syscall.h deleted +0 -29
deleted file mode 100644
index 8ac0365..0000000
@@ -1,29 +0,0 @@
-struct target_pt_regs {
-    union {
-        struct {
-            /* Named registers */
-            uint32_t sr;       /* Stored in place of r0 */
-            target_ulong sp;   /* r1 */
-        };
-        struct {
-            /* Old style */
-            target_ulong offset[2];
-            target_ulong gprs[30];
-        };
-        struct {
-            /* New style */
-            target_ulong gpr[32];
-        };
-    };
-    target_ulong pc;
-    target_ulong orig_gpr11;   /* For restarting system calls */
-    uint32_t syscallno;        /* Syscall number (used by strace) */
-    target_ulong dummy;     /* Cheap alignment fix */
-};
-
-#define UNAME_MACHINE "openrisc"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
linux-user/openrisc/target_syscall.h new file +34 -0
new file mode 100644
index 0000000..19aeffc
@@ -0,0 +1,34 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+    union {
+        struct {
+            /* Named registers */
+            uint32_t sr;       /* Stored in place of r0 */
+            target_ulong sp;   /* r1 */
+        };
+        struct {
+            /* Old style */
+            target_ulong offset[2];
+            target_ulong gprs[30];
+        };
+        struct {
+            /* New style */
+            target_ulong gpr[32];
+        };
+    };
+    target_ulong pc;
+    target_ulong orig_gpr11;   /* For restarting system calls */
+    uint32_t syscallno;        /* Syscall number (used by strace) */
+    target_ulong dummy;     /* Cheap alignment fix */
+};
+
+#define UNAME_MACHINE "openrisc"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
linux-user/ppc/syscall.h deleted +0 -75

75 lines not on this page · raw message

linux-user/ppc/target_syscall.h new file +80 -0

80 lines not on this page · raw message

linux-user/qemu.h +1 -1
index ba5b433..26b0ba2 100644
@@ -13,7 +13,7 @@
 
 #include "exec/user/thunk.h"
 #include "syscall_defs.h"
-#include "syscall.h"
+#include "target_syscall.h"
 #include "exec/gdbstub.h"
 #include "qemu/queue.h"
 
linux-user/s390x/syscall.h deleted +0 -29
deleted file mode 100644
index 35f170a..0000000
@@ -1,29 +0,0 @@
-/* this typedef defines how a Program Status Word looks like */
-typedef struct {
-    abi_ulong mask;
-    abi_ulong addr;
-} __attribute__ ((aligned(8))) target_psw_t;
-
-/*
- * The pt_regs struct defines the way the registers are stored on
- * the stack during a system call.
- */
-
-#define TARGET_NUM_GPRS        16
-
-struct target_pt_regs {
-    abi_ulong args[1];
-    target_psw_t psw;
-    abi_ulong gprs[TARGET_NUM_GPRS];
-    abi_ulong orig_gpr2;
-    unsigned short ilen;
-    unsigned short trap;
-};
-
-#define UNAME_MACHINE "s390x"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_CLONE_BACKWARDS2
-#define TARGET_MINSIGSTKSZ        2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
linux-user/s390x/target_syscall.h new file +34 -0
new file mode 100644
index 0000000..02061ef
@@ -0,0 +1,34 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* this typedef defines how a Program Status Word looks like */
+typedef struct {
+    abi_ulong mask;
+    abi_ulong addr;
+} __attribute__ ((aligned(8))) target_psw_t;
+
+/*
+ * The pt_regs struct defines the way the registers are stored on
+ * the stack during a system call.
+ */
+
+#define TARGET_NUM_GPRS        16
+
+struct target_pt_regs {
+    abi_ulong args[1];
+    target_psw_t psw;
+    abi_ulong gprs[TARGET_NUM_GPRS];
+    abi_ulong orig_gpr2;
+    unsigned short ilen;
+    unsigned short trap;
+};
+
+#define UNAME_MACHINE "s390x"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_CLONE_BACKWARDS2
+#define TARGET_MINSIGSTKSZ        2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
linux-user/sh4/syscall.h deleted +0 -17
deleted file mode 100644
index 7aa4f23..0000000
@@ -1,17 +0,0 @@
-struct target_pt_regs {
-        unsigned long regs[16];
-        unsigned long pc;
-        unsigned long pr;
-        unsigned long sr;
-        unsigned long gbr;
-        unsigned long mach;
-        unsigned long macl;
-        long tra;
-};
-
-#define UNAME_MACHINE "sh4"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
linux-user/sh4/target_syscall.h new file +22 -0
new file mode 100644
index 0000000..9f3381b
@@ -0,0 +1,22 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+        unsigned long regs[16];
+        unsigned long pc;
+        unsigned long pr;
+        unsigned long sr;
+        unsigned long gbr;
+        unsigned long mach;
+        unsigned long macl;
+        long tra;
+};
+
+#define UNAME_MACHINE "sh4"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
linux-user/sparc/syscall.h deleted +0 -20
deleted file mode 100644
index 58573b9..0000000
@@ -1,20 +0,0 @@
-struct target_pt_regs {
-	abi_ulong psr;
-	abi_ulong pc;
-	abi_ulong npc;
-	abi_ulong y;
-	abi_ulong u_regs[16];
-};
-
-#define UNAME_MACHINE "sun4"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-/* SPARC kernels don't define this in their Kconfig, but they have the
- * same ABI as if they did, implemented by sparc-specific code which fishes
- * directly in the u_regs() struct for half the parameters in sparc_do_fork()
- * and copy_thread().
- */
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ      4096
-#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
linux-user/sparc/target_syscall.h new file +25 -0
new file mode 100644
index 0000000..a73fa6d
@@ -0,0 +1,25 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+	abi_ulong psr;
+	abi_ulong pc;
+	abi_ulong npc;
+	abi_ulong y;
+	abi_ulong u_regs[16];
+};
+
+#define UNAME_MACHINE "sun4"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+/* SPARC kernels don't define this in their Kconfig, but they have the
+ * same ABI as if they did, implemented by sparc-specific code which fishes
+ * directly in the u_regs() struct for half the parameters in sparc_do_fork()
+ * and copy_thread().
+ */
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ      4096
+#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
+
+#endif  /* TARGET_SYSCALL_H */
linux-user/sparc64/syscall.h deleted +0 -21
deleted file mode 100644
index 8398d3f..0000000
@@ -1,21 +0,0 @@
-struct target_pt_regs {
-	abi_ulong u_regs[16];
-	abi_ulong tstate;
-	abi_ulong pc;
-	abi_ulong npc;
-	abi_ulong y;
-	abi_ulong fprs;
-};
-
-#define UNAME_MACHINE "sun4u"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-/* SPARC kernels don't define this in their Kconfig, but they have the
- * same ABI as if they did, implemented by sparc-specific code which fishes
- * directly in the u_regs() struct for half the parameters in sparc_do_fork()
- * and copy_thread().
- */
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ      4096
-#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
linux-user/sparc64/target_syscall.h new file +26 -0
new file mode 100644
index 0000000..eb827fc
@@ -0,0 +1,26 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+	abi_ulong u_regs[16];
+	abi_ulong tstate;
+	abi_ulong pc;
+	abi_ulong npc;
+	abi_ulong y;
+	abi_ulong fprs;
+};
+
+#define UNAME_MACHINE "sun4u"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+/* SPARC kernels don't define this in their Kconfig, but they have the
+ * same ABI as if they did, implemented by sparc-specific code which fishes
+ * directly in the u_regs() struct for half the parameters in sparc_do_fork()
+ * and copy_thread().
+ */
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ      4096
+#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
+
+#endif  /* TARGET_SYSCALL_H */
linux-user/tilegx/syscall.h deleted +0 -43

43 lines not on this page · raw message

linux-user/tilegx/target_syscall.h new file +43 -0

43 lines not on this page · raw message

linux-user/unicore32/syscall.h deleted +0 -60

60 lines not on this page · raw message

linux-user/unicore32/target_syscall.h new file +60 -0

60 lines not on this page · raw message

linux-user/x86_64/syscall.h deleted +0 -102

102 lines not on this page · raw message

linux-user/x86_64/target_syscall.h new file +107 -0

107 lines not on this page · raw message

Signature · 1 line
2.1.4
#8 lore raw

[Qemu-devel] [PULL v2 8/8] linux-user: add getrandom() syscall

In reply to [email protected]

From: Laurent Vivier <[email protected]>

getrandom() has been introduced in kernel 3.17 and is now used during the boot sequence of Debian unstable (stretch/sid).

---
 linux-user/syscall.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
linux-user/syscall.c +13 -0
index 539183a..9517531 100644
@@ -249,6 +249,9 @@ _syscall2(int, ioprio_get, int, which, int, who)
 #if defined(TARGET_NR_ioprio_set) && defined(__NR_ioprio_set)
 _syscall3(int, ioprio_set, int, which, int, who, int, ioprio)
 #endif
+#if defined(TARGET_NR_getrandom) && defined(__NR_getrandom)
+_syscall3(int, getrandom, void *, buf, size_t, buflen, unsigned int, flags)
+#endif
 
 static bitmask_transtbl fcntl_flags_tbl[] = {
   { TARGET_O_ACCMODE,   TARGET_O_WRONLY,    O_ACCMODE,   O_WRONLY,    },
@@ -7541,6 +7544,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         ret = get_errno(shutdown(arg1, arg2));
         break;
 #endif
+#if defined(TARGET_NR_getrandom) && defined(__NR_getrandom)
+    case TARGET_NR_getrandom:
+        p = lock_user(VERIFY_WRITE, arg1, arg2, 0);
+        if (!p) {
+            goto efault;
+        }
+        ret = get_errno(getrandom(p, arg2, arg3));
+        unlock_user(p, arg1, ret);
+        break;
+#endif
 #ifdef TARGET_NR_socket
     case TARGET_NR_socket:
         ret = do_socket(arg1, arg2, arg3);
Signature · 1 line
2.1.4
#9 lore raw

[Qemu-devel] [PULL v2 7/8] linux-user: correct timerfd_create syscall numbers

In reply to [email protected]

From: Riku Voipio <[email protected]>

x86, m68k, ppc, sh4 and sparc failed to enable timerfd, because they didn't have timerfd_create system call defined. Instead QEMU defined timerfd syscall. Checking with kernel sources, it appears kernel developers reused timerfd syscall number with timerfd_create, presumably since no userspace called the old syscall number.

---
 linux-user/i386/syscall_nr.h   | 2 +-
 linux-user/m68k/syscall_nr.h   | 2 +-
 linux-user/ppc/syscall_nr.h    | 2 +-
 linux-user/sh4/syscall_nr.h    | 2 +-
 linux-user/sparc/syscall_nr.h  | 2 +-
 linux-user/x86_64/syscall_nr.h | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
linux-user/i386/syscall_nr.h +1 -1
index fa3f0b4..bc1bc23 100644
@@ -324,7 +324,7 @@
 #define TARGET_NR_epoll_pwait	319
 #define TARGET_NR_utimensat		320
 #define TARGET_NR_signalfd		321
-#define TARGET_NR_timerfd		322
+#define TARGET_NR_timerfd_create	322
 #define TARGET_NR_eventfd		323
 #define TARGET_NR_fallocate		324
 #define TARGET_NR_timerfd_settime	325
linux-user/m68k/syscall_nr.h +1 -1
index a2daba0..4b50fb2 100644
@@ -317,7 +317,7 @@
 #define TARGET_NR_epoll_pwait	315
 #define TARGET_NR_utimensat		316
 #define TARGET_NR_signalfd		317
-#define TARGET_NR_timerfd		318
+#define TARGET_NR_timerfd_create	318
 #define TARGET_NR_eventfd		319
 #define TARGET_NR_fallocate		320
 #define TARGET_NR_timerfd_settime	321
linux-user/ppc/syscall_nr.h +1 -1
index 0a5fd54..46ed8a6 100644
@@ -319,7 +319,7 @@
 #define TARGET_NR_epoll_pwait	303
 #define TARGET_NR_utimensat		304
 #define TARGET_NR_signalfd		305
-#define TARGET_NR_timerfd		306
+#define TARGET_NR_timerfd_create	306
 #define TARGET_NR_eventfd		307
 #define TARGET_NR_sync_file_range2	308
 #define TARGET_NR_fallocate		309
linux-user/sh4/syscall_nr.h +1 -1
index bdf8742..5009984 100644
@@ -323,7 +323,7 @@
 #define TARGET_NR_epoll_pwait	319
 #define TARGET_NR_utimensat		320
 #define TARGET_NR_signalfd		321
-#define TARGET_NR_timerfd		322
+#define TARGET_NR_timerfd_create	322
 #define TARGET_NR_eventfd		323
 #define TARGET_NR_fallocate		324
 #define TARGET_NR_timerfd_settime	325
linux-user/sparc/syscall_nr.h +1 -1
index 5b582a5..732b105 100644
@@ -278,7 +278,7 @@
 #define TARGET_NR_epoll_pwait	309
 #define TARGET_NR_utimensat		310
 #define TARGET_NR_signalfd		311
-#define TARGET_NR_timerfd		312
+#define TARGET_NR_timerfd_create	312
 #define TARGET_NR_eventfd		313
 #define TARGET_NR_fallocate		314
 #define TARGET_NR_timerfd_settime	315
linux-user/x86_64/syscall_nr.h +1 -1
index f00fa2b..16397b3 100644
@@ -281,7 +281,7 @@
 #define TARGET_NR_utimensat		280
 #define TARGET_NR_epoll_pwait	281
 #define TARGET_NR_signalfd		282
-#define TARGET_NR_timerfd		283
+#define TARGET_NR_timerfd_create	283
 #define TARGET_NR_eventfd		284
 #define TARGET_NR_fallocate		285
 #define TARGET_NR_timerfd_settime	286
Signature · 1 line
2.1.4
#10 lore raw
In reply to [email protected]
Quoted 8 lines · On 25 February 2016 at 11:01, <[email protected]> wrote:

From: Riku Voipio <[email protected]>

The following changes since commit 1b1624092d1f1f746adea6e1237a07f6788c2e3d:

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20160223-1' into staging (2016-02-23 16:14:17 +0000)

are available in the git repository at:

Quoted 9 lines

git://git.linaro.org/people/riku.voipio/qemu.git tags/pull-linux-user-20160225

for you to fetch changes up to f894efd19917321844b31e5dd7a061fdc6fb322d:

linux-user: add getrandom() syscall (2016-02-24 15:22:15 +0200)

----------------------------------------------------------------
Second pull req with getrandom fix

Applied, thanks.

-- PMM