public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 04/10] Add SAFE_PRCTL macro
Date: Wed, 10 Jul 2024 17:47:53 +0200	[thread overview]
Message-ID: <20240710154753.GA300896@pevik> (raw)
In-Reply-To: <20240701-landlock-v1-4-58e9af649a72@suse.com>

Hi Andrea, Li,

...
> +int safe_prctl(const char *file, const int lineno,
> +	int option, unsigned long arg2, unsigned long arg3,
> +	unsigned long arg4, unsigned long arg5)
> +{
> +	int rval;
> +
> +	rval = prctl(option, arg2, arg3, arg4, arg5);
> +	if (rval == -1) {
> +		tst_brk_(file, lineno, TBROK | TERRNO,
> +			"prctl(%d, %lu, %lu, %lu, %lu)",
> +			option, arg2, arg3, arg4, arg5);
If I understand man prctl(2) correctly, valid values are >= 0, -1 is for error.
Shouldn't we check for invalid return value, e.g. else if (rval < 0) should
TBROK (see other uses safe_dup)? If yes, this applies to landlock SAFE_* macros
as well.

Also, some modes are for new kernels: PR_SET_IO_FLUSHER (since Linux 5.6), but I
would solve it once needed.

Otherwise LGTM.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

> +	}
> +
> +	return rval;
> +}

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

  parent reply	other threads:[~2024-07-10 15:48 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01 15:42 [LTP] [PATCH 00/10] landlock testing suite Andrea Cervesato
2024-07-01 15:42 ` [LTP] [PATCH 01/10] Add landlock syscalls definitions Andrea Cervesato
2024-07-02  7:30   ` Li Wang
2024-07-01 15:42 ` [LTP] [PATCH 02/10] Add lapi/landlock.h fallback Andrea Cervesato
2024-07-02  7:32   ` Li Wang
2024-07-02  7:41     ` Li Wang
2024-07-01 15:42 ` [LTP] [PATCH 03/10] Add landlock SAFE_* macros Andrea Cervesato
2024-07-02  7:47   ` Li Wang
2024-07-10 15:53   ` Petr Vorel
2024-07-10 17:53     ` Andrea Cervesato via ltp
2024-07-11  5:27       ` Petr Vorel
2024-07-11  6:30         ` Li Wang
2024-07-01 15:42 ` [LTP] [PATCH 04/10] Add SAFE_PRCTL macro Andrea Cervesato
2024-07-02  7:52   ` Li Wang
2024-07-10 15:47   ` Petr Vorel [this message]
2024-07-01 15:42 ` [LTP] [PATCH 05/10] Add landlock01 test Andrea Cervesato
2024-07-02  8:34   ` Li Wang
2024-07-02  9:09     ` Li Wang
2024-07-02  9:20       ` Andrea Cervesato via ltp
2024-07-02  9:54         ` Li Wang
2024-07-01 15:42 ` [LTP] [PATCH 06/10] Add landlock02 test Andrea Cervesato
2024-07-02  8:46   ` Li Wang
2024-07-01 15:42 ` [LTP] [PATCH 07/10] Add landlock03 test Andrea Cervesato
2024-07-02 11:00   ` Li Wang
2024-07-01 15:42 ` [LTP] [PATCH 08/10] Add landlock04 test Andrea Cervesato
2024-07-02  8:00   ` Li Wang
2024-07-02 12:22     ` Li Wang
2024-07-03 13:42       ` Andrea Cervesato via ltp
2024-07-04  1:53         ` Li Wang
2024-07-03  8:20   ` Li Wang
2024-07-03  9:22     ` Andrea Cervesato via ltp
2024-07-01 15:42 ` [LTP] [PATCH 09/10] Add landlock05 test Andrea Cervesato
2024-07-03  7:32   ` Li Wang
2024-07-03  7:36     ` Andrea Cervesato via ltp
2024-07-03  7:40       ` Li Wang
2024-07-01 15:42 ` [LTP] [PATCH 10/10] Add landlock06 test Andrea Cervesato
2024-07-03 13:29   ` Li Wang

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=20240710154753.GA300896@pevik \
    --to=pvorel@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