From: Cyril Hrubis <chrubis@suse.cz>
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v6 2/3] syscalls/modify_ldt02: Refactor into new API
Date: Mon, 7 Apr 2025 14:24:29 +0200 [thread overview]
Message-ID: <Z_PD_RUdYQAlewP6@yuki.lan> (raw)
In-Reply-To: <20250402-conversions-modify_ldt-v6-2-2e4b0e27870e@suse.com>
Hi!
> --- /dev/null
> +++ b/testcases/kernel/syscalls/modify_ldt/common.h
> @@ -0,0 +1,30 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) International Business Machines Corp., 2001
> + * 07/2001 Ported by Wayne Boyer
> + * Copyright (c) 2025 SUSE LLC Ricardo B. Marlière <rbm@suse.com>
> + */
> +
> +#ifndef COMMON_H
> +#define COMMON_H
> +
> +#include "tst_test.h"
> +#include "lapi/ldt.h"
> +
> +int create_segment(void *seg, size_t size)
This should be void now, since we are not checking the return value
anyways.
> +{
> + struct user_desc entry = {
> + .entry_number = 0,
> + .base_addr = (unsigned long)seg,
> + .limit = size,
> + .seg_32bit = 1,
> + .contents = 0,
> + .read_exec_only = 0,
> + .limit_in_pages = 0,
> + .seg_not_present = 0,
> + };
> +
> + return SAFE_MODIFY_LDT(1, &entry, sizeof(entry));
> +}
...
> + if (!pid) {
> + signal(SIGSEGV, SIG_DFL);
We do not mess with signal handlers in the new test library, so this
shouldn't be needed.
> + read_segment(0);
> + exit(1);
> + }
> +
> + SAFE_WAITPID(pid, &status, 0);
> + if (WEXITSTATUS(status) != 0) {
> + tst_res(TFAIL, "Did not generate SEGV, child returned "
> + "unexpected status");
> + } else {
> + if (WIFSIGNALED(status) && (WTERMSIG(status) == SIGSEGV))
> + tst_res(TPASS, "generate SEGV as expected");
> + else
> + tst_res(TFAIL, "Did not generate SEGV");
> + }
This should be just:
if (WIFSIGNALED(status) && (WTERMSIG(status) == SIGSEGV))
tst_res(TPASS, "generate SEGV as expected");
else
tst_res(TFAIL, "child %s", tst_strstatus(status));
> }
>
> -#endif /* if defined(__i386__) */
> +static struct tst_test test = {
> + .test_all = run,
> + .forks_child = 1,
> +};
> +
> +#else
> +TST_TEST_TCONF("Test supported only on i386");
> +#endif /* __i386__ */
>
> --
> 2.49.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-04-07 12:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 9:58 [LTP] [PATCH v6 0/3] syscalls/modify_ldt: Refactor into new API Ricardo B. Marlière via ltp
2025-04-02 9:58 ` [LTP] [PATCH v6 1/3] syscalls/modify_ldt: Add lapi/ldt.h Ricardo B. Marlière via ltp
2025-04-07 12:09 ` Cyril Hrubis
2025-04-07 12:18 ` Ricardo B. Marli��re via ltp
2025-04-02 9:58 ` [LTP] [PATCH v6 2/3] syscalls/modify_ldt02: Refactor into new API Ricardo B. Marlière via ltp
2025-04-07 12:24 ` Cyril Hrubis [this message]
2025-04-02 9:58 ` [LTP] [PATCH v6 3/3] syscalls/modify_ldt01: " Ricardo B. Marlière via ltp
2025-04-07 12:41 ` Cyril Hrubis
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=Z_PD_RUdYQAlewP6@yuki.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=rbm@suse.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox