Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 7/7] Add lsm_set_self_attr01 test
Date: Tue, 4 Mar 2025 14:26:19 +0100	[thread overview]
Message-ID: <Z8b_e1F1gX5avllJ@yuki.lan> (raw)
In-Reply-To: <20250110-lsm-v2-7-bd38035f86bc@suse.com>

Hi!
> +static void run(unsigned int n)
> +{
> +	struct tcase *tc = &tcases[n];
> +
> +	/* just in case lsm_set_self_attr() pass , we won't change
> +	 * LSM configuration for the following process
> +	 */
> +	memcpy(ctx, ctx_orig, sizeof(struct lsm_ctx));
> +
> +	ctx_size = page_size;
> +	ctx_size_small = 1;
> +	ctx_size_big = ctx_size + 1;
> +
> +	TST_EXP_FAIL(lsm_set_self_attr(tc->attr, *tc->ctx, *tc->size, tc->flags),
> +	      tc->exp_errno,
> +	      "%s", tc->msg);
> +}
> +
> +static void setup(void)
> +{
> +	int ret;
> +	uint32_t size;
> +
> +	verify_supported_attr_current();
> +
> +	page_size = SAFE_SYSCONF(_SC_PAGESIZE);
> +	size = page_size;
> +
> +	ret = lsm_get_self_attr(LSM_ATTR_CURRENT, ctx_orig, &size, 0);

Here as well, the handling of the size is wrong.

> +	if (ret < 0)
> +		tst_brk(TBROK, "Can't read LSM current attribute");
> +}
> +
> +static struct tst_test test = {
> +	.test = run,
> +	.setup = setup,
> +	.tcnt = ARRAY_SIZE(tcases),
> +	.min_kver = "6.8",
> +	.bufs = (struct tst_buffers[]) {
> +		{&ctx, .size = sizeof(struct lsm_ctx)},
> +		{&ctx_orig, .size = sizeof(struct lsm_ctx)},
> +		{}
> +	},
> +};
> 
> -- 
> 2.43.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2025-03-04 13:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10 12:55 [LTP] [PATCH v2 0/7] LSM testing suite Andrea Cervesato
2025-01-10 12:55 ` [LTP] [PATCH v2 1/7] Add fallback definitions of LSM syscalls Andrea Cervesato
2025-03-04 12:00   ` Cyril Hrubis
2025-01-10 12:55 ` [LTP] [PATCH v2 2/7] Add lsm_get_self_attr01 test Andrea Cervesato
2025-03-04 12:21   ` Cyril Hrubis
2025-01-10 12:55 ` [LTP] [PATCH v2 3/7] Add lsm_get_self_attr02 test Andrea Cervesato
2025-03-04 12:29   ` Cyril Hrubis
2025-01-10 12:55 ` [LTP] [PATCH v2 4/7] Add lsm_get_self_attr03 test Andrea Cervesato
2025-03-04 13:11   ` Cyril Hrubis
2025-03-21 12:23     ` Andrea Cervesato via ltp
2025-04-28 14:50       ` Cyril Hrubis
2025-01-10 12:55 ` [LTP] [PATCH v2 5/7] Add lsm_list_modules01 test Andrea Cervesato
2025-01-10 12:55 ` [LTP] [PATCH v2 6/7] Add lsm_list_modules02 test Andrea Cervesato
2025-03-04 13:24   ` Cyril Hrubis
2025-01-10 12:55 ` [LTP] [PATCH v2 7/7] Add lsm_set_self_attr01 test Andrea Cervesato
2025-03-04 13:26   ` Cyril Hrubis [this message]

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=Z8b_e1F1gX5avllJ@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /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