aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'executor/common_linux.h')
-rw-r--r--executor/common_linux.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index d73f8a66a..8c20101ec 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -184,10 +184,10 @@ static int netlink_send_ext(struct nlmsg* nlmsg, int sock,
if (n != hdr->nlmsg_len)
fail("short netlink write: %d/%d", n, hdr->nlmsg_len);
n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0);
- if (hdr->nlmsg_type == NLMSG_DONE) {
+ if (reply_len)
*reply_len = 0;
+ if (hdr->nlmsg_type == NLMSG_DONE)
return 0;
- }
if (n < sizeof(struct nlmsghdr))
fail("short netlink read: %d", n);
if (reply_len && hdr->nlmsg_type == reply_type) {
@@ -1381,12 +1381,6 @@ static long syz_emit_ethernet(volatile long a0, volatile long a1, volatile long
#define CQ_RING_OVERFLOW_OFFSET 284
#define CQ_FLAGS_OFFSET 280
#define CQ_CQES_OFFSET 320
-#define SQ_ARRAY_OFFSET(sq_entries, cq_entries) (round_up(CQ_CQES_OFFSET + cq_entries * SIZEOF_IO_URING_CQE, 64))
-
-uint32 round_up(uint32 x, uint32 a)
-{
- return (x + a - 1) & ~(a - 1);
-}
#if SYZ_EXECUTOR || __NR_syz_io_uring_complete
@@ -1538,7 +1532,7 @@ static long syz_io_uring_submit(volatile long a0, volatile long a1, volatile lon
uint32 cq_ring_entries = *(uint32*)(ring_ptr + CQ_RING_ENTRIES_OFFSET);
// Compute the sq_array offset
- uint32 sq_array_off = SQ_ARRAY_OFFSET(sq_ring_entries, cq_ring_entries);
+ uint32 sq_array_off = (CQ_CQES_OFFSET + cq_ring_entries * SIZEOF_IO_URING_CQE + 63) & ~63;
// Get the ptr to the destination for the sqe
if (sq_ring_entries)
@@ -3452,8 +3446,8 @@ static int do_sandbox_namespace(void)
#define AID_EVERYBODY 9997
#define AID_APP 10000
-#define UNTRUSTED_APP_UID AID_APP + 999
-#define UNTRUSTED_APP_GID AID_APP + 999
+#define UNTRUSTED_APP_UID (AID_APP + 999)
+#define UNTRUSTED_APP_GID (AID_APP + 999)
const char* const SELINUX_CONTEXT_UNTRUSTED_APP = "u:r:untrusted_app:s0:c512,c768";
const char* const SELINUX_LABEL_APP_DATA_FILE = "u:object_r:app_data_file:s0:c512,c768";