Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fixes
Browse files Browse the repository at this point in the history
drop my changes from 087d22f which were replicated in master
  • Loading branch information
turistu committed Nov 26, 2024
2 parents 707d1d2 + e905568 commit 33cf9d2
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 38 deletions.
17 changes: 1 addition & 16 deletions src/epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@ SYS_FUNC(epoll_create1)

#include "xlat/epollevents.h"

static void
print_epoll_data(const __u64 data)
{
/*
* We cannot know what format the tracee uses, so
* print both u32 and u64 which will cover every value.
*/
union dummy { __u64 u64; __u32 u32; } u; u.u64 = data;
tprint_struct_begin();
PRINT_FIELD_U(u, u32);
tprint_struct_next();
PRINT_FIELD_U(u, u64);
tprint_struct_end();
}

static bool
print_epoll_event(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
Expand All @@ -56,7 +41,7 @@ print_epoll_event(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
tprint_struct_begin();
PRINT_FIELD_FLAGS(*ev, events, epollevents, "EPOLL???");
tprint_struct_next();
PRINT_FIELD_OBJ_VAL(*ev, data, print_epoll_data);
PRINT_FIELD_X(*ev, data);
tprint_struct_end();

return true;
Expand Down
6 changes: 3 additions & 3 deletions tests/epoll_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

#include <inttypes.h>
#include <stdio.h>
#include <sys/epoll.h>
#include <unistd.h>
#include <linux/eventpoll.h>

static long
invoke_syscall(unsigned long epfd, unsigned long op, unsigned long fd, void *ev)
Expand All @@ -30,8 +30,8 @@ main(void)

long rc = invoke_syscall(-1U, EPOLL_CTL_ADD, -2U, ev);
printf("epoll_ctl(-1, EPOLL_CTL_ADD, -2"
", {events=EPOLLIN, data={u32=%u, u64=%" PRIu64 "}}) = %s\n",
ev->data.u32, ev->data.u64, sprintrc(rc));
", {events=EPOLLIN, data=%#" PRI__x64 "}) = %s\n",
ev->data, sprintrc(rc));

rc = invoke_syscall(-3U, EPOLL_CTL_DEL, -4U, ev);
printf("epoll_ctl(-3, EPOLL_CTL_DEL, -4, %p) = %s\n",
Expand Down
2 changes: 1 addition & 1 deletion tests/epoll_pwait.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

# include <signal.h>
# include <stdio.h>
# include <sys/epoll.h>
# include <unistd.h>
# include <linux/eventpoll.h>

int
main(void)
Expand Down
2 changes: 1 addition & 1 deletion tests/epoll_pwait2-y.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define DECODE_FDS 1
#define FD9_PATH "</dev/full>"
#define SKIP_IF_PROC_IS_UNAVAILABLE skip_if_unavailable("/proc/self/fd/")

#include "epoll_pwait2.c"
17 changes: 5 additions & 12 deletions tests/epoll_pwait2.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
#include "tests.h"
#include "scno.h"
#include "xmalloc.h"
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/epoll.h>
#include <linux/eventpoll.h>
#include "kernel_timespec.h"

#ifndef DECODE_FDS
# define DECODE_FDS 0
#ifndef FD9_PATH
# define FD9_PATH ""
#endif
#ifndef SKIP_IF_PROC_IS_UNAVAILABLE
# define SKIP_IF_PROC_IS_UNAVAILABLE
Expand Down Expand Up @@ -52,14 +51,8 @@ main(void)
{
SKIP_IF_PROC_IS_UNAVAILABLE;

static const char fd_path[] = "/dev/full";
int fd = open(fd_path, O_WRONLY);
if (fd < 0)
perror_msg_and_fail("open: %s", fd_path);
char *fd_str = xasprintf("%d%s%s%s", fd,
DECODE_FDS ? "<" : "",
DECODE_FDS ? fd_path : "",
DECODE_FDS ? ">" : "");
int fd = 9;
char *fd_str = xasprintf("%d%s", fd, FD9_PATH);

TAIL_ALLOC_OBJECT_CONST_PTR(struct epoll_event, events);
TAIL_ALLOC_OBJECT_CONST_PTR(kernel_timespec64_t, timeout);
Expand Down
2 changes: 1 addition & 1 deletion tests/epoll_wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#ifdef __NR_epoll_wait

# include <stdio.h>
# include <sys/epoll.h>
# include <unistd.h>
# include <linux/eventpoll.h>

int
main(void)
Expand Down
6 changes: 3 additions & 3 deletions tests/gen_tests.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ epoll_create -a17
epoll_create1 -a28
epoll_ctl
epoll_pwait
epoll_pwait2
epoll_pwait2-P --trace=epoll_pwait2 -P /dev/full
epoll_pwait2-y --trace=epoll_pwait2 -y
epoll_pwait2 9>>/dev/full
epoll_pwait2-P --trace=epoll_pwait2 -P /dev/full 9>>/dev/full
epoll_pwait2-y --trace=epoll_pwait2 -y 9>>/dev/full
epoll_wait -a26
erestartsys -a34 -e signal=none -e trace=recvfrom
eventfd-yy -a15 --trace=eventfd2,fchdir -yy -qq
Expand Down
1 change: 0 additions & 1 deletion tests/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ test_pidns()

check_scno_tampering()
{
uname_r="$(uname -r)"
case "$STRACE_ARCH" in
arm)
# PTRACE_SET_SYSCALL is supported by linux kernel
Expand Down

0 comments on commit 33cf9d2

Please sign in to comment.