From: Cyril Hrubis <chrubis@suse.cz>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] execve: Add negative test for execve
Date: Wed, 21 Aug 2024 12:30:30 +0200 [thread overview]
Message-ID: <ZsXBxlFZGy4ETPa8@yuki.lan> (raw)
In-Reply-To: <20240416080141.22616-1-xuyang2018.jy@fujitsu.com>
Hi!
> +/*\
> + * [Description]
> + *
> + * Verify that execve(2) fails with
> + *
> + * - ELOOP when too many symbolic links are encountered in filename
> + */
> +
> +#include "tst_test.h"
> +
> +#define TEST_ELOOP "test_eloop"
> +#define TEST_ELOOP2 "test_eloop2"
> +
> +static struct test_case_t {
> + char *filename;
> + int expected_errno;
> + int user;
> + char *desc;
> +} tcases[] = {
> + {TEST_ELOOP, ELOOP, 0,
> + "too many symbolic links are encountered in filename"},
> +};
> +
> +static void setup(void)
> +{
> + SAFE_SYMLINK(TEST_ELOOP, TEST_ELOOP2);
> + SAFE_SYMLINK(TEST_ELOOP2, TEST_ELOOP);
> +}
> +
> +static void verify_execve(unsigned int i)
> +{
> + struct test_case_t *tc = &tcases[i];
> + char *argv[2] = {tc->filename, NULL};
> +
> + TST_EXP_FAIL(execve(tc->filename, argv, NULL), tc->expected_errno,
> + "%s", tc->desc);
> +}
> +
> +static struct tst_test test = {
> + .setup = setup,
> + .tcnt = ARRAY_SIZE(tcases),
> + .test = verify_execve,
> + .needs_tmpdir = 1,
> + .needs_root = 1,
> +};
Any reason why this isn't added to execve03.c instead?
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-08-21 10:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 8:01 [LTP] [PATCH] execve: Add negative test for execve Yang Xu via ltp
2024-08-21 10:30 ` Cyril Hrubis [this message]
2024-10-21 12:52 ` Petr Vorel
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=ZsXBxlFZGy4ETPa8@yuki.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=xuyang2018.jy@fujitsu.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 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.