Skip to contentSkip to conversation

linux-user: Update m68k syscall definitions to match Linux 4.4.

PATCH In review John Paul Adrian Glaubitz 3 participants 12 messages Dec 24, 2015 – Jan 11, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 linux-user: Update m68k syscall definitions to match Linux 4.4.

---
 linux-user/m68k/syscall_nr.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
linux-user/m68k/syscall_nr.h +27 -0
index 25f8521..a2daba0 100644
@@ -349,3 +349,30 @@
 #define TARGET_NR_process_vm_writev     346
 #define TARGET_NR_kcmp                  347
 #define TARGET_NR_finit_module          348
+#define TARGET_NR_sched_setattr         349
+#define TARGET_NR_sched_getattr         350
+#define TARGET_NR_renameat2             351
+#define TARGET_NR_getrandom             352
+#define TARGET_NR_memfd_create          353
+#define TARGET_NR_bpf                   354
+#define TARGET_NR_execveat              355
+#define TARGET_NR_socket                356
+#define TARGET_NR_socketpair            357
+#define TARGET_NR_bind                  358
+#define TARGET_NR_connect               359
+#define TARGET_NR_listen                360
+#define TARGET_NR_accept4               361
+#define TARGET_NR_getsockopt            362
+#define TARGET_NR_setsockopt            363
+#define TARGET_NR_getsockname           364
+#define TARGET_NR_getpeername           365
+#define TARGET_NR_sendto                366
+#define TARGET_NR_sendmsg               367
+#define TARGET_NR_recvfrom              368
+#define TARGET_NR_recvmsg               369
+#define TARGET_NR_shutdown              370
+#define TARGET_NR_recvmmsg              371
+#define TARGET_NR_sendmmsg              372
+#define TARGET_NR_userfaultfd           373
+#define TARGET_NR_membarrier            374
+#define TARGET_NR_mlock2                375
Signature · 1 line
2.6.2
#1 lore raw

PATCH 2/2 linux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up.

---
 linux-user/syscall.c      | 8 ++++++--
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)
linux-user/syscall.c +6 -2
index 6c64ba6..dd6ed47 100644
@@ -2171,7 +2171,6 @@ static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg,
     return ret;
 }
 
-#ifdef TARGET_NR_sendmmsg
 /* We don't rely on the C library to have sendmmsg/recvmmsg support,
  * so it might not have this *mmsg-specific flag either.
  */
@@ -2218,7 +2217,6 @@ static abi_long do_sendrecvmmsg(int fd, abi_ulong target_msgvec,
     }
     return ret;
 }
-#endif
 
 /* If we don't have a system accept4() then just call accept.
  * The callsites to do_accept4() will ensure that they don't
@@ -2441,6 +2439,8 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
         [SOCKOP_shutdown] = 2,    /* sockfd, how */
         [SOCKOP_sendmsg] = 3,     /* sockfd, msg, flags */
         [SOCKOP_recvmsg] = 3,     /* sockfd, msg, flags */
+        [SOCKOP_sendmmsg] = 4,    /* sockfd, msgvec, vlen, flags */
+        [SOCKOP_recvmmsg] = 4,    /* sockfd, msgvec, vlen, flags */
         [SOCKOP_setsockopt] = 5,  /* sockfd, level, optname, optval, optlen */
         [SOCKOP_getsockopt] = 5,  /* sockfd, level, optname, optval, optlen */
     };
@@ -2491,6 +2491,10 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
         return do_sendrecvmsg(a[0], a[1], a[2], 1);
     case SOCKOP_recvmsg: /* sockfd, msg, flags */
         return do_sendrecvmsg(a[0], a[1], a[2], 0);
+    case SOCKOP_sendmmsg: /* sockfd, msgvec, vlen, flags */
+        return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 1);
+    case SOCKOP_recvmmsg: /* sockfd, msgvec, vlen, flags */
+        return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 0);
     case SOCKOP_setsockopt: /* sockfd, level, optname, optval, optlen */
         return do_setsockopt(a[0], a[1], a[2], a[3], a[4]);
     case SOCKOP_getsockopt: /* sockfd, level, optname, optval, optlen */
linux-user/syscall_defs.h +2 -0
index f996acf..0d6d141 100644
@@ -28,6 +28,8 @@
 #define SOCKOP_sendmsg          16
 #define SOCKOP_recvmsg          17
 #define SOCKOP_accept4          18
+#define SOCKOP_recvmmsg         19
+#define SOCKOP_sendmmsg         20
 
 #define IPCOP_semop		1
 #define IPCOP_semget		2
Signature · 1 line
2.6.2
Reviewed-by on v1 2/2
#2 lore raw

Re: [Qemu-devel] [PATCH 2/2] linux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up.

Quoted 52 lines · John Paul Adrian Glaubitz
---
 linux-user/syscall.c      | 8 ++++++--
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)
linux-user/syscall.c +6 -2
index 6c64ba6..dd6ed47 100644
@@ -2171,7 +2171,6 @@ static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg,
     return ret;
 }
 
-#ifdef TARGET_NR_sendmmsg
 /* We don't rely on the C library to have sendmmsg/recvmmsg support,
  * so it might not have this *mmsg-specific flag either.
  */
@@ -2218,7 +2217,6 @@ static abi_long do_sendrecvmmsg(int fd, abi_ulong target_msgvec,
     }
     return ret;
 }
-#endif
 
 /* If we don't have a system accept4() then just call accept.
  * The callsites to do_accept4() will ensure that they don't
@@ -2441,6 +2439,8 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
         [SOCKOP_shutdown] = 2,    /* sockfd, how */
         [SOCKOP_sendmsg] = 3,     /* sockfd, msg, flags */
         [SOCKOP_recvmsg] = 3,     /* sockfd, msg, flags */
+        [SOCKOP_sendmmsg] = 4,    /* sockfd, msgvec, vlen, flags */
+        [SOCKOP_recvmmsg] = 4,    /* sockfd, msgvec, vlen, flags */
         [SOCKOP_setsockopt] = 5,  /* sockfd, level, optname, optval, optlen */
         [SOCKOP_getsockopt] = 5,  /* sockfd, level, optname, optval, optlen */
     };
@@ -2491,6 +2491,10 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
         return do_sendrecvmsg(a[0], a[1], a[2], 1);
     case SOCKOP_recvmsg: /* sockfd, msg, flags */
         return do_sendrecvmsg(a[0], a[1], a[2], 0);
+    case SOCKOP_sendmmsg: /* sockfd, msgvec, vlen, flags */
+        return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 1);
+    case SOCKOP_recvmmsg: /* sockfd, msgvec, vlen, flags */
+        return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 0);
     case SOCKOP_setsockopt: /* sockfd, level, optname, optval, optlen */
         return do_setsockopt(a[0], a[1], a[2], a[3], a[4]);
     case SOCKOP_getsockopt: /* sockfd, level, optname, optval, optlen */
linux-user/syscall_defs.h +0 -0
index f996acf..0d6d141 100644

linux-user/syscall_defs.h line 35

Quoted 8 lines
linux-user/syscall_defs.h +2 -0
@@ -28,6 +28,8 @@
 #define SOCKOP_sendmsg          16
 #define SOCKOP_recvmsg          17
 #define SOCKOP_accept4          18
+#define SOCKOP_recvmmsg         19
+#define SOCKOP_sendmmsg         20
 
 #define IPCOP_semop		1
 #define IPCOP_semget		2
#3 lore raw
In reply to John Paul Adrian Glaubitz

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Laurent!

Here are, as discussed previously, my proposed patches which change the following:

PATCH 1/2 updates the syscall table for m68k to match Linux 4.4. This one should be very obvious.

PATCH 2/2 adds the definitions for the socket calls SOCKOP_sendmmsg and SOCKOP_recvmmsg and wires them up with the rest of the code. The necessary function do_sendrecvmmsg() is already present in linux-user/syscall.c. After adding these two definitions and wiring them up, I no longer receive an error message about the unimplemented socket calls when running "apt-get update" on Debian unstable running on qemu with glibc_2.21 on m68k.

Cheers,
Adrian

- --

 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWfEHBAAoJEHQmOzf1tfkTE8MQAL8csEYAtrrMy1VQlQOBj4rV +yLUkCRYobisEplXl9mQrgJ3ATswJYvj5C2wfU6wAlzUkHoLLZ/IbJwHDY9DhplN GlkzHqjpp7mhf8lngsrdyQqmD+06ebEGvnXA8/4xwY7zVsYpddRt31ThYBvUTrbt OwmttTypOry9aivitjBEUehpPPa82h4bc2/Jc90THyxbbb0t90MHSTsh42wY9JPT 5ePBcMSjjXi3lab7DWyPBgT0vDEDez0WhP3xbGKP4/nRKQcdJhwxxa1yBydIgEKT WbzOUBydO6OjeX4ZYza+gLcKqRrhqokXuUW77CLrXlv+gwon3oI4m66zUq1J1xZz kNIe5bdIPQbJ9ShCWuvbL7y0EFH/s6IOf8dcLtX/rnJ6/QvXuZJk3j3lrIn1BHK8 7aK/I1QkPvFAl3SCpi4XkEemuvKNkgDiK73WzgKHbfBSpx8UqoXH6ws4x6hhYJEv QvN92VPj8KTUxmtG+Lhbi/yS7kowXk4N8RO3zWU4Ul94KY8PFYVIPqkyC/DcN94F I7a7uqKrWxurzksPLsSMhmIyY5F/vik3Kw3I7Wo9+1/qB0KhCMtFTJwefLZnWoj/ 2UrjE6wItlJIvMOGHt+Ih4UrXRp52PwcAcHyM7F+fhwvN5mQvtzNJehYuM/JQJZP qXHC3MwjACFQJme1O2KT
=oAZC
-----END PGP SIGNATURE-----

#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Quoted 8 lines · John Paul Adrian Glaubitz

Hi Laurent!

Here are, as discussed previously, my proposed patches which change the following:

PATCH 1/2 updates the syscall table for m68k to match Linux 4.4. This one should be very obvious.

Quoted 7 lines

PATCH 2/2 adds the definitions for the socket calls SOCKOP_sendmmsg and SOCKOP_recvmmsg and wires them up with the rest of the code. The necessary function do_sendrecvmmsg() is already present in linux-user/syscall.c. After adding these two definitions and wiring them up, I no longer receive an error message about the unimplemented socket calls when running "apt-get update" on Debian unstable running on qemu with glibc_2.21 on m68k.

I think you should have added this description in the commit message of the patch.

You can also create your patch series with "git format-patch -n
- --cover-letter" to have a "[PATCH 0/2]" mail template to describe your series.

Thanks,
Laurent

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWfGHNAAoJEPMMOL0/L748kX8QAJYs62/Uge60BbaBhBWBPNEL AT1YzgnLN6yDUXl/rv538DyMoWnxxe5FkM4mc/fV3Wo84nHAAI61IwmdcxivPvXQ 0PHe0hNIaH4T8E0zQyVY85r983QQyYldpeW8kBGp/KhegEmpQDxyeIplPht6sZNI zRuDHNP6xSNm+W6giPr0vK0RrUNQ2OdAKYNIKskrLS1u9p2pTzk7X0AXEhJjMHQX ZoFkQYQX8cnWm3L5k6HCFIx6N0lVNfu6TClLq13Qo2XkRwR/ckWfgzXtdkZmyIBE 5E/0Fn69wNz4TbuQDKQc4Ef8OYC00eyhpV03d6Yt0+eb4yiUgayI620Ji6SVnvZw edSwnvYVlQ7g6FqppiL7eXlXopOFBR7qMNWhdjtAsfSRh+XbAAf7IkPaYay4kJKE j9XCeMimaqJdRBbbsVqd5okmkb86hlfriHpn1jsa9tHuTKJdgy4oDjmo7mDLB/uT jmOWdlC/+/+huEI95mCahLt4Nz4G/7ikyFQYDZKFPa+nJzZLdV2SxZ8NNGG5ZlPt 2BoxDYVicN+VlVYDclDDu5yRM1TFH6zWAhs/dC1e2l7c4Ty1e5hTWoJgYUukXZxJ gxq81DH2M57TjFvZsek80S/raiBGYYLd14Edau+I4JZd1XPuN0IlzWtSMC2J/eDG jdPrS3fEJTE/5t+rT9T8
=aRxF
-----END PGP SIGNATURE-----

#5 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Quoted 2 lines · Laurent Vivier

I think you should have added this description in the commit message of the patch.

Hmm, ok. Let's wait for other comments. I'm open to make any improvements in this regards but I also think the changes are easy to understand without much commenting.

Quoted 3 lines

You can also create your patch series with "git format-patch -n --cover-letter" to have a "[PATCH 0/2]" mail template to describe your series.

You are right. I was thinking about that right after I sent the patches in :).

- --

 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWfId6AAoJEHQmOzf1tfkTitEP+gIOJgkDCKQ2+VvIjc+XRKlT 4HinsXuC4URRHWfqGw4g2Bf0GDrz5R3wtM9w+UmTNhGAyyo1dx8lJRNbcftYym65 RA2CnvbBw5KydfHI0QElla3wUn83zbU42ldWYjZcIdmTSqQ8kgJIugSXGRxBX5H3 91sCUylCdOQKBeNj69p7bPgB0+fKYFaRVfhKfd7UEHQnxGoYLr/NJrc5tkm2VCio 6WU391JTwyEvywSswk+Bn8isoEKJVIZn3zmfY7b0ba69xcgsmnuxT/Ei9tmK74wO uZBFkb7edpm24WML4Gr6UXOraJGYh06exq1C4+NoGN3eydBL4ZAnPMkqUbsh2ITt ZDTsJKWwbYMqehsg73+xquwG3/zkJOR5BxKbPJylAolvcbmW44/sF3iVbbObMx2r A4ZqYW1QbSaeZXr02vxp1e0CWDN0zlS2pHWR+ShNlKOEBPLf8l3TA5Eg+crxpqaU fKhkCEeI8JQw1AZM61XE2YR/rlGGU93zDhjxmdkrmWwHqJozZfRrf9LkhhWYaiQS dn/9QBaHpxbSq4EmQl8YE8yn+ZbKvJ3rwSOKMRp3tXiH9TnpBPuBUpPSxfYk5nxP nJC56ihQMi1UIYVyc1BRpPoVFbn0jaKiHtN+WSZLrpgnzIRlvrqpeCRLvyXNSivE +0xDL+UyJKTZ20NXSzGu
=NBeh
-----END PGP SIGNATURE-----

#6 lore raw
In reply to John Paul Adrian Glaubitz

Hi,

Quoted 6 lines · John Paul Adrian Glaubitz

Here are, as discussed previously, my proposed patches which change the following:

PATCH 1/2 updates the syscall table for m68k to match Linux 4.4. This one should be very obvious.

Quoted 7 lines

PATCH 2/2 adds the definitions for the socket calls SOCKOP_sendmmsg and SOCKOP_recvmmsg and wires them up with the rest of the code. The necessary function do_sendrecvmmsg() is already present in linux-user/syscall.c. After adding these two definitions and wiring them up, I no longer receive an error message about the unimplemented socket calls when running "apt-get update" on Debian unstable running on qemu with glibc_2.21 on m68k.

I've applied these changing the commit messages using the text above. However, a static busybox from debian/unstable doesn't work for me. With or without these patches I just get a target segfault.

Since debian-m68k list is talking about using qemu for builds, I take I'm missing something obvious here.

Riku

#7 lore raw
Quoted 18 lines · Riku Voipio

Hi,

Quoted 6 lines · John Paul Adrian Glaubitz

Here are, as discussed previously, my proposed patches which change the following:

PATCH 1/2 updates the syscall table for m68k to match Linux 4.4. This one should be very obvious.

Quoted 7 lines

PATCH 2/2 adds the definitions for the socket calls SOCKOP_sendmmsg and SOCKOP_recvmmsg and wires them up with the rest of the code. The necessary function do_sendrecvmmsg() is already present in linux-user/syscall.c. After adding these two definitions and wiring them up, I no longer receive an error message about the unimplemented socket calls when running "apt-get update" on Debian unstable running on qemu with glibc_2.21 on m68k.

Quoted 6 lines

I've applied these changing the commit messages using the text above. However, a static busybox from debian/unstable doesn't work for me. With or without these patches I just get a target segfault.

Since debian-m68k list is talking about using qemu for builds, I take I'm missing something obvious here.

Not obvious. Adrian is working with my m68k branch of qemu (qemu-m68k). Pure qemu supports only coldfire, if you want to test it, you can't use debian. There is a coldfire image at http://wiki.qemu.org/Testing, but of course, it doesn't use the syscalls added by these patches.

I'm currently working to be able to merge my m68k branch into mainstream qemu. A first series of patch will be available in the few coming days.

Laurent

#8 lore raw

Hi Riku!

Quoted 4 lines · Laurent Vivier

Not obvious. Adrian is working with my m68k branch of qemu (qemu-m68k). Pure qemu supports only coldfire, if you want to test it, you can't use debian. There is a coldfire image at http://wiki.qemu.org/Testing, but of course, it doesn't use the syscalls added by these patches.

Thanks for merging the patches.

If you want to gives Lauren't qemu-m68k fork a try, you can follow the guide I set up in the Debian Wiki [1]. It might be advisable though to switch to Laurent's current 2.4.0-dev branch since the master branch mentioned in the wiki lacks the CAS2 instruction which is used by libpthread in glibc_2.21 or later.

On the other hand, I lost networking when using Laurent's latest branch. I will probably have to retest again, then update the Debian Wiki page.

Adrian

Quoted 1 line

[1] https://wiki.debian.org/M68k/sbuildQEMU

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#9 lore raw
In reply to Laurent Vivier
Quoted 11 lines · Laurent Vivier
Quoted 4 lines · Riku Voipio

Hi,

On torstaina 24. joulukuuta 2015 21.04.38 EET, John Paul Adrian Glaubitz
wrote: ...

Not obvious. Adrian is working with my m68k branch of qemu (qemu-m68k). Pure qemu supports only coldfire, if you want to test it, you can't use debian. There is a coldfire image at http://wiki.qemu.org/Testing, but of course, it doesn't use the syscalls added by these patches.

Ok, thanks for clarification, I had forgotten that m68k in mainline Qemu was coldfire only. I'll be happy to add debian/m68k to my tests when the support gets merged.

Riku

#10 lore raw
Quoted 4 lines · Riku Voipio

Ok, thanks for clarification, I had forgotten that m68k in mainline Qemu was coldfire only. I'll be happy to add debian/m68k to my tests when the support
gets merged.

Laurent's master-dev branch seems to have improved quite a lot, currently testing it. The networking issue has been resolved.

You need to apply both of my patches though as otherwise apt complains about the missing socket calls 19/20.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Reviewed-by on v1 1/2
#11 lore raw
In reply to John Paul Adrian Glaubitz
Quoted 31 lines · John Paul Adrian Glaubitz
---
 linux-user/m68k/syscall_nr.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
linux-user/m68k/syscall_nr.h +17 -0
index 25f8521..a2daba0 100644
@@ -349,3 +349,30 @@
 #define TARGET_NR_process_vm_writev     346
 #define TARGET_NR_kcmp                  347
 #define TARGET_NR_finit_module          348
+#define TARGET_NR_sched_setattr         349
+#define TARGET_NR_sched_getattr         350
+#define TARGET_NR_renameat2             351
+#define TARGET_NR_getrandom             352
+#define TARGET_NR_memfd_create          353
+#define TARGET_NR_bpf                   354
+#define TARGET_NR_execveat              355
+#define TARGET_NR_socket                356
+#define TARGET_NR_socketpair            357
+#define TARGET_NR_bind                  358
+#define TARGET_NR_connect               359
+#define TARGET_NR_listen                360
+#define TARGET_NR_accept4               361
+#define TARGET_NR_getsockopt            362
+#define TARGET_NR_setsockopt            363
+#define TARGET_NR_getsockname           364
+#define TARGET_NR_getpeername           365

linux-user/m68k/syscall_nr.h line 378

Quoted 10 lines
linux-user/m68k/syscall_nr.h +10 -0
+#define TARGET_NR_sendto                366
+#define TARGET_NR_sendmsg               367
+#define TARGET_NR_recvfrom              368
+#define TARGET_NR_recvmsg               369
+#define TARGET_NR_shutdown              370
+#define TARGET_NR_recvmmsg              371
+#define TARGET_NR_sendmmsg              372
+#define TARGET_NR_userfaultfd           373
+#define TARGET_NR_membarrier            374
+#define TARGET_NR_mlock2                375