All of lore.kernel.org
 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 1/7] Add fallback definitions of LSM syscalls
Date: Tue, 4 Mar 2025 13:00:07 +0100	[thread overview]
Message-ID: <Z8brR4pxW-r5BDoI@yuki.lan> (raw)
In-Reply-To: <20250110-lsm-v2-1-bd38035f86bc@suse.com>

Hi!
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2024 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> + */
> +
> +#ifndef LAPI_LSM_H__
> +#define LAPI_LSM_H__
> +
> +#include "config.h"
> +
> +#ifdef HAVE_LINUX_LSM_H
> +#include <linux/lsm.h>
> +#else

It's kind of broken to have an else branch here...

> +#include <stdint.h>
> +#include "lapi/syscalls.h"
> +
> +#ifndef HAVE_STRUCT_LSM_CTX
> +
> +/**
> + * struct lsm_ctx - LSM context information
> + * @id: the LSM id number, see LSM_ID_XXX
> + * @flags: LSM specific flags
> + * @len: length of the lsm_ctx struct, @ctx and any other data or padding
> + * @ctx_len: the size of @ctx
> + * @ctx: the LSM context value
> + *
> + * The @len field MUST be equal to the size of the lsm_ctx struct
> + * plus any additional padding and/or data placed after @ctx.
> + *
> + * In all cases @ctx_len MUST be equal to the length of @ctx.
> + * If @ctx is a string value it should be nul terminated with
> + * @ctx_len equal to `strlen(@ctx) + 1`.  Binary values are
> + * supported.
> + *
> + * The @flags and @ctx fields SHOULD only be interpreted by the
> + * LSM specified by @id; they MUST be set to zero/0 when not used.
> + */
> +struct lsm_ctx {
> +	uint64_t id;
> +	uint64_t flags;
> +	uint64_t len;
> +	uint64_t ctx_len;
> +	uint8_t ctx[4096];
> +};
> +#endif

... when most of the entries are guarded by their own ifdefs.


So I would be for dropping the else and just making sure that everyting
else is guarded by ifdef. This is only way how to make sure that we have
all defintions on older variants of linux/lsm.h that may miss some of
the ifdefs that are currently in the #else branch.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2025-03-04 12:00 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 [this message]
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

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=Z8brR4pxW-r5BDoI@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 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.