Skip to content

Commit

Permalink
Update versions of things in CI.
Browse files Browse the repository at this point in the history
Update to the latest nightly Rust, actions/cache, and QEMU patches
from rustix, and remove unneeded `feature` declarations.
  • Loading branch information
sunfishcode committed Oct 20, 2024
1 parent 5a96c77 commit b8a8155
Show file tree
Hide file tree
Showing 8 changed files with 404 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
rustup target add ${{ matrix.target }}
if: matrix.target != ''

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ runner.tool_cache }}/qemu
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patched
Expand Down Expand Up @@ -107,6 +107,10 @@ jobs:
patch -p1 < $GITHUB_WORKSPACE/ci/s390x-stat-have-nsec.patch
patch -p1 < $GITHUB_WORKSPACE/ci/aarch64-o-largefile.patch
patch -p1 < $GITHUB_WORKSPACE/ci/tcgets2-tcsets2.patch
patch -p1 < $GITHUB_WORKSPACE/ci/tiocgsid.patch
patch -p1 < $GITHUB_WORKSPACE/ci/more-sockopts.patch
patch -p1 < $GITHUB_WORKSPACE/ci/pidfd-open.patch
patch -p1 < $GITHUB_WORKSPACE/ci/select-setsize.patch
./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache }}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs
ninja -C build install
if: matrix.qemu != '' && matrix.os == 'ubuntu-latest'
Expand Down
92 changes: 92 additions & 0 deletions ci/more-sockopts.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
From Dan Gohman <[email protected]>
Subject: [PATCH] Implement various socket options.

This implements the `SO_INCOMING_CPU`, `SO_COOKIE`, and `SO_PROTOCOL`
socket options.

diff -ur -x roms -x build a/linux-user/generic/sockbits.h b/linux-user/generic/sockbits.h
--- a/linux-user/generic/sockbits.h
+++ b/linux-user/generic/sockbits.h
@@ -60,4 +60,10 @@

#define TARGET_SO_PROTOCOL 38
#define TARGET_SO_DOMAIN 39
+#ifndef TARGET_SO_INCOMING_CPU
+#define TARGET_SO_INCOMING_CPU 49
+#endif
+#ifndef TARGET_SO_COOKIE
+#define TARGET_SO_COOKIE 57
+#endif
#endif
diff -ur -x roms -x build a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h
--- a/linux-user/mips/sockbits.h
+++ b/linux-user/mips/sockbits.h
@@ -73,6 +73,9 @@
#define TARGET_SO_RCVBUFFORCE 33
#define TARGET_SO_PASSSEC 34

+#define TARGET_SO_INCOMING_CPU 49
+#define TARGET_SO_COOKIE 57
+
/** sock_type - Socket types
*
* Please notice that for binary compat reasons MIPS has to
diff -ur -x roms -x build a/linux-user/syscall.c b/linux-user/syscall.c
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2476,6 +2476,9 @@
case TARGET_SO_RCVLOWAT:
optname = SO_RCVLOWAT;
break;
+ case TARGET_SO_INCOMING_CPU:
+ optname = SO_INCOMING_CPU;
+ break;
default:
goto unimplemented;
}
@@ -2534,6 +2537,7 @@
{
abi_long ret;
int len, val;
+ int64_t val64;
socklen_t lv;

switch(level) {
@@ -2733,6 +2737,27 @@
case TARGET_SO_DOMAIN:
optname = SO_DOMAIN;
goto int_case;
+ case TARGET_SO_INCOMING_CPU:
+ optname = SO_INCOMING_CPU;
+ goto int_case;
+ case TARGET_SO_COOKIE:
+ optname = SO_COOKIE;
+ if (get_user_u32(len, optlen))
+ return -TARGET_EFAULT;
+ if (len < 0)
+ return -TARGET_EINVAL;
+ lv = sizeof(val64);
+ ret = get_errno(getsockopt(sockfd, level, optname, &val64, &lv));
+ if (ret < 0)
+ return ret;
+ if (len > lv)
+ len = lv;
+ assert(len == 8);
+ if (put_user_u64(val64, optval_addr))
+ return -TARGET_EFAULT;
+ if (put_user_u32(len, optlen))
+ return -TARGET_EFAULT;
+ break;
default:
goto int_case;
}
@@ -2756,6 +2781,9 @@
case SO_ERROR:
val = host_to_target_errno(val);
break;
+ case SO_PROTOCOL:
+ val = host_to_target_errno(val);
+ break;
}
if (level == SOL_SOCKET && optname == SO_ERROR) {
val = host_to_target_errno(val);
19 changes: 19 additions & 0 deletions ci/pidfd-open.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From Dan Gohman <[email protected]>
Subject: [PATCH] Fix the flags argument of `pidfd_open`.

This corrects the flags value of `pidfd_open` to avoid passing
target flags to the host. Currently the only flag is `PIDFD_NONBLOCK`
so we use the `fcntl_flags_tbl` to translate it.

--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9477,7 +9477,8 @@
#endif
#if defined(__NR_pidfd_open) && defined(TARGET_NR_pidfd_open)
case TARGET_NR_pidfd_open:
- return get_errno(pidfd_open(arg1, arg2));
+ return get_errno(pidfd_open(arg1,
+ target_to_host_bitmask(arg2, fcntl_flags_tbl)));
#endif
#if defined(__NR_pidfd_send_signal) && defined(TARGET_NR_pidfd_send_signal)
case TARGET_NR_pidfd_send_signal:
Loading

0 comments on commit b8a8155

Please sign in to comment.