From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Andrea Cervesato" <andrea.cervesato@suse.de>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v6 1/3] lapi/sched: add SAFE_SCHED_SETATTR()
Date: Thu, 03 Sep 2026 07:38:45 +0000 [thread overview]
Message-ID: <6a992406.c70771d4.a9d0c.493d@mx.google.com> (raw)
In-Reply-To: <20260903-cve-ghostlock-v6-1-a3272bb81e4d@suse.com>
Hi Cyril,
> -static inline int sched_setattr(pid_t pid, const struct sched_attr *attr,
> +static inline int sched_setattr(pid_t pid, struct sched_attr *attr,
> unsigned int flags)
> {
> return syscall(__NR_sched_setattr, pid, attr, flags);
> @@ -169,4 +169,33 @@ static inline int getcpu(unsigned *cpu, unsigned *node)
> # define CLONE_INTO_CGROUP 0x200000000ULL
> #endif
>
> +static inline int safe_sched_setattr(const char *file, const int lineno,
> + pid_t pid, struct sched_attr *attr,
> + unsigned int flags)
> +{
> + int ret;
> +
> + ret = sched_setattr(pid, attr, flags);
> +
> + if (ret == -1) {
> + tst_brk_(file, lineno, TBROK | TERRNO,
> + "sched_setattr(%i) failed", pid);
> + }
> +
> + return ret;
> +}
> +
> +/**
> + * SAFE_SCHED_SETATTR() - Safe wrapper for sched_setattr().
> + * @pid: Target process or thread ID (0 for caller).
> + * @attr: Pointer to a sched_attr structure.
> + * @flags: Flags modifying the scheduling behavior.
> + *
> + * Calls sched_setattr() and breaks the test with TBROK | TERRNO on failure.
> + *
> + * Return: Zero on success.
> + */
> +#define SAFE_SCHED_SETATTR(pid, attr, flags)\
> + safe_sched_setattr(__FILE__, __LINE__, (pid), (attr), (flags))
> +
> #endif /* LAPI_SCHED_H__ */
the header is used by sched_setattr01, so I can't include the SAFE_*
definition in here, which is the right place, since we are trying to
move them into the related headers. It causes a build failure due to
the old vs. new API mix. I will send a new patch-set with the
sched_setattr01 rewrite.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-09-03 7:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 7:26 [LTP] [PATCH v6 0/3] Reproducer for ghostlock Andrea Cervesato
2026-09-03 7:26 ` [LTP] [PATCH v6 1/3] lapi/sched: add SAFE_SCHED_SETATTR() Andrea Cervesato
2026-09-03 7:38 ` Andrea Cervesato via ltp [this message]
2026-09-03 12:02 ` [LTP] " linuxtestproject.agent
2026-09-03 7:26 ` [LTP] [PATCH v6 2/3] lapi/prctl: add more fallback definitions Andrea Cervesato
2026-09-03 7:26 ` [LTP] [PATCH v6 3/3] cve: add CVE-2026-43499 reproducer Andrea Cervesato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a992406.c70771d4.a9d0c.493d@mx.google.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=andrea.cervesato@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.