public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: lepillai@linux.ibm.com
Cc: lekshmi-cpillai <lekshmi@ktes.isst.tadn.ibm.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] Added new_behavior flag to detect kernel version Kernel >= 6.11: Tests that creat() succeeds (write to executed file allowed)
Date: Wed, 8 Apr 2026 12:10:57 +0200	[thread overview]
Message-ID: <adYpsZP2IKxco4au@yuki.lan> (raw)
In-Reply-To: <20260408053655.3818590-1-lepillai@linux.ibm.com>

Hi!
> +static int new_behavior;
> +
>  static void verify_creat(void)
>  {
>  	pid_t pid;
> @@ -33,16 +35,26 @@ static void verify_creat(void)
>  
>  	TEST(creat(TEST_APP, O_WRONLY));
>  
> -	if (TST_RET != -1) {
> -		tst_res(TFAIL, "creat() succeeded unexpectedly");
> -		return;
> +	if (new_behavior) {
> +		/* Kernel >= 6.11: write to executed file is allowed */
> +		if (TST_RET != -1) {
> +			SAFE_CLOSE(TST_RET);
> +			tst_res(TPASS, "creat() succeeded as expected (new behavior)");
> +		} else {
> +			tst_res(TFAIL | TTERRNO, "creat() failed unexpectedly");
> +		}
> +	} else {
> +		/* Kernel < 6.11: write to executed file returns ETXTBSY */
> +		if (TST_RET != -1) {
> +			tst_res(TFAIL, "creat() succeeded unexpectedly");
> +			SAFE_CLOSE(TST_RET);
> +		} else if (TST_ERR == ETXTBSY) {
> +			tst_res(TPASS, "creat() received ETXTBSY");
> +		} else {
> +			tst_res(TFAIL | TTERRNO, "creat() failed unexpectedly");
> +		}
>  	}
>  
> -	if (TST_ERR == ETXTBSY)
> -		tst_res(TPASS, "creat() received EXTBSY");
> -	else
> -		tst_res(TFAIL | TTERRNO, "creat() failed unexpectedly");
> -
>  	SAFE_KILL(pid, SIGKILL);
>  	SAFE_WAITPID(pid, NULL, 0);
>  }
> @@ -50,9 +62,13 @@ static void verify_creat(void)
>  static void setup(void)
>  {
>  	if ((tst_kvercmp(6, 11, 0)) >= 0) {
> -		tst_brk(TCONF, "Skipping test, write to executed file is "
> -			"allowed since 6.11-rc1.\n"
> -			"2a010c412853 (\"fs: don't block i_writecount during exec\")");
> +		new_behavior = 1;
> +		tst_res(TINFO, "Testing new behavior: write to executed file is "
> +			"allowed since 6.11-rc1 (2a010c412853)");
> +	} else {
> +		new_behavior = 0;
> +		tst_res(TINFO, "Testing old behavior: write to executed file "
> +			"returns ETXTBSY");

Apart from the code being ugly and having way too much verbose messages
the test is likely broken with -i 2 command line option on newer
kernels.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2026-04-08 10:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-08  5:36 [LTP] [PATCH] Added new_behavior flag to detect kernel version Kernel >= 6.11: Tests that creat() succeeds (write to executed file allowed) lepillai
2026-04-08 10:10 ` Cyril Hrubis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-08  5:33 lepillai

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=adYpsZP2IKxco4au@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=lekshmi@ktes.isst.tadn.ibm.com \
    --cc=lepillai@linux.ibm.com \
    --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