public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: Tarun Sahu <tsahu@linux.ibm.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] tst_creat_unlinked(): Add missing mode argument
Date: Fri, 13 Dec 2024 23:02:58 +0100	[thread overview]
Message-ID: <20241213220258.GA1577592@pevik> (raw)
In-Reply-To: <20241211105500.13530-1-mdoucha@suse.cz>

Hi Martin,

> The open() syscall requires the mode parameter if O_CREAT flag is used.
> Add the missing mode parameter to the tst_creat_unlinked() helper function.

> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---

> During investigation of strange hugemmap11 failures I've noticed that
> the test tries to create a scratch file with uninitialized access mode.
> This was unrelated to the failures but should be fixed anyway.

Good catch, rebased and merged.

I see from man open(2):


	The mode argument specifies the file mode bits to be applied when a new file
	is created.  If neither O_CREAT nor O_TMPFILE is specified in flags, then
	mode is ignored (and can thus be specified as 0, or simply omitted).  The
	mode argument must be supplied if O_CREAT or O_TMPFILE is specified in
	flags; if it is not supplied, some arbitrary bytes from the stack will be
	applied as the file mode.

It looks like that all O_TMPFILE are covered. Too late now to check O_CREAT.

It would be handy if somebody spent time to add this check into our sparse
checks.

Kind regards,
Petr

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

      reply	other threads:[~2024-12-13 22:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 10:54 [LTP] [PATCH] tst_creat_unlinked(): Add missing mode argument Martin Doucha
2024-12-13 22:02 ` Petr Vorel [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=20241213220258.GA1577592@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    --cc=tsahu@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox