Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bpf_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,13 @@ bpf_queue_open1(struct quark_queue *qq, int use_fentry)
bpf_program__set_autoload(p->progs.kprobe__ptrace_attach, 1);
}

if (qq->flags & QQ_TTY) {
if (use_fentry)
bpf_program__set_autoload(p->progs.fentry__tty_write, 1);
else
bpf_program__set_autoload(p->progs.kprobe__tty_write, 1);
}

/*
* These are probes that are not attached to a feature and not currently
* used in quark, but we need to maintain compatibility in BYPASS.
Expand Down
18 changes: 18 additions & 0 deletions quark-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,23 @@ t_memfd(const struct test *t, struct quark_queue_attr *qa)
return (0);
}

/* XXX Only probe loading for now */
static int
t_tty(const struct test *t, struct quark_queue_attr *qa)
{
struct quark_queue qq;

qa->flags &= ~QQ_ENTRY_LEADER;
qa->flags |= QQ_BYPASS | QQ_TTY;

if (quark_queue_open(&qq, qa) != 0)
err(1, "quark_queue_open");

quark_queue_close(&qq);

return (0);
}

static int
t_sock_conn(const struct test *t, struct quark_queue_attr *qa)
{
Expand Down Expand Up @@ -1068,6 +1085,7 @@ struct test all_tests[] = {
T_EBPF(t_bypass),
T_EBPF(t_file),
T_EBPF(t_memfd),
T_EBPF(t_tty),
T_EBPF(t_sock_conn),
T_EBPF(t_dns),
T(t_namespace),
Expand Down
4 changes: 2 additions & 2 deletions quark.c
Original file line number Diff line number Diff line change
Expand Up @@ -2310,9 +2310,9 @@ quark_queue_open(struct quark_queue *qq, struct quark_queue_attr *qa)
qa->max_length = 1;
}
/*
* QQ_{FILE,MEMFD} needs QQ_BYPASS for now
* QQ_{FILE,MEMFD,TTY} needs QQ_BYPASS for now
*/
if ((qa->flags & (QQ_FILE|QQ_MEMFD))
if ((qa->flags & (QQ_FILE|QQ_MEMFD|QQ_TTY))
&& !(qa->flags & QQ_BYPASS))
return (errno = EINVAL, -1);

Expand Down
1 change: 1 addition & 0 deletions quark.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ struct quark_queue_attr {
#define QQ_BYPASS (1 << 7)
#define QQ_FILE (1 << 8)
#define QQ_MEMFD (1 << 9)
#define QQ_TTY (1 << 10)
#define QQ_ALL_BACKENDS (QQ_KPROBE | QQ_EBPF)
int flags;
int max_length;
Expand Down