lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 19 Jun 2024 07:36:55 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Howard Chu <howardchu95@...il.com>, Jiri Olsa <jolsa@...nel.org>, 
	Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, 
	Kan Liang <kan.liang@...ux.intel.com>, linux-kernel@...r.kernel.org, 
	linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v2 5/5] perf trace: Add test for enum augmentation

Hi,

On Wed, Jun 19, 2024 at 6:51 AM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> On Wed, Jun 19, 2024 at 04:20:42PM +0800, Howard Chu wrote:
> > Check for vmlinux's existence in sysfs as prerequisite.
> >
> > Add landlock_add_rule.c workload. Trace landlock_add_rule syscall to see
> > if the output is desirable.
> >
> > Trace the non-syscall tracepoint 'timer:hrtimer_init' and
> > 'timer:hrtimer_start', see if the 'mode' argument is augmented,
> > the 'mode' enum argument has the prefix of 'HRTIMER_MODE_'
> > in its name.
> >
> > Suggested-by: Arnaldo Carvalho de Melo <acme@...nel.org>
> > Signed-off-by: Howard Chu <howardchu95@...il.com>
> > ---
[SNIP]
> > diff --git a/tools/perf/tests/workloads/landlock_add_rule.c b/tools/perf/tests/workloads/landlock_add_rule.c
> > new file mode 100644
> > index 000000000000..529b5f1ea5a7
> > --- /dev/null
> > +++ b/tools/perf/tests/workloads/landlock_add_rule.c
> > @@ -0,0 +1,32 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#include <linux/compiler.h>
> > +#include <uapi/asm-generic/unistd.h> // for __NR_landlock_add_rule
> > +#include <unistd.h>
> > +#include <linux/landlock.h>
>
> This file was introduced on linux in 2021, unsure if it will be present
> in some of the older distros we test, I'll check with my container test
> suite.
>
> Maybe we'll have to just define those LANDLOCK_ACCESS_FS_READ_FILE,
> LANDLOCK_ACCESS_NET_CONNECT_TCP, etc as plain #define to make sure it
> builds ok with uCLibc, musl libc and older glibc.

Maybe we can check if the syscall number is defined first and
include the landlock header.

#ifdef __NR_landlock_add_rule
#include <linux/landlock.h>
...

Then we need a way to skip the test if it's not defined.

Thanks,
Namhyung


>
> - Arnaldo
>
> > +#include "../tests.h"
> > +
> > +static int landlock_add_rule(int argc __maybe_unused, const char **argv __maybe_unused)
> > +{
> > +     int fd = 11;
> > +     int flags = 45;
> > +
> > +     struct landlock_path_beneath_attr path_beneath_attr = {
> > +         .allowed_access = LANDLOCK_ACCESS_FS_READ_FILE,
> > +         .parent_fd = 14,
> > +     };
> > +
> > +     struct landlock_net_port_attr net_port_attr = {
> > +         .port = 19,
> > +         .allowed_access = LANDLOCK_ACCESS_NET_CONNECT_TCP,
> > +     };
> > +
> > +     syscall(__NR_landlock_add_rule, fd, LANDLOCK_RULE_PATH_BENEATH,
> > +             &path_beneath_attr, flags);
> > +
> > +     syscall(__NR_landlock_add_rule, fd, LANDLOCK_RULE_NET_PORT,
> > +             &net_port_attr, flags);
> > +
> > +     return 0;
> > +}
> > +
> > +DEFINE_WORKLOAD(landlock_add_rule);
> > --
> > 2.45.2
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ