linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: 'Szabolcs Nagy' <szabolcs.nagy@arm.com>,
	Theodore Ts'o <tytso@mit.edu>,
	"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: linux interprets an fcntl int arg as long
Date: Tue, 1 Nov 2022 13:12:39 +0000	[thread overview]
Message-ID: <Y2EbR6YnQcgK4B8T@FVFF77S0Q05N> (raw)
In-Reply-To: <0030a20a94cd49628c5461d044bb28ed@AcuMS.aculab.com>

On Tue, Nov 01, 2022 at 12:19:51PM +0000, David Laight wrote:
> From: 'Szabolcs Nagy' <szabolcs.nagy@arm.com>
> > Sent: 01 November 2022 11:45
> > 
> > The 11/01/2022 10:02, David Laight wrote:
> > > From: Szabolcs Nagy

> > kernel code:
> > ------------
> > SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
> > {
> 
> That is just a wrapper and calls do_fcntl().
> which needs changing to be add:
> 	arg &= ~0U;
> before the switch(cmd) {

Just to check, do you mean the switch in do_fcntl(), or the switch within memfd_fcntl() ?

The former handles other APIs which do expect arg to be a long (e.g.
F_SET_RW_HINT and F_GET_RW_HINT expect it to hold a full 64-bit pointer), so
that'd break things.

The latter would work (as would casting arg to int when calling
memfd_add_seals()).

Mark.

  parent reply	other threads:[~2022-11-01 13:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31 12:44 linux interprets an fcntl int arg as long Szabolcs Nagy
2022-11-01  1:46 ` Theodore Ts'o
2022-11-01  9:11   ` Szabolcs Nagy
2022-11-01 10:02     ` David Laight
2022-11-01 11:44       ` 'Szabolcs Nagy'
2022-11-01 12:19         ` David Laight
2022-11-01 12:49           ` 'Szabolcs Nagy'
2022-11-01 13:12           ` Mark Rutland [this message]
2022-11-01 13:29             ` David Laight
2022-11-01 13:35               ` David Laight

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=Y2EbR6YnQcgK4B8T@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=szabolcs.nagy@arm.com \
    --cc=tytso@mit.edu \
    /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;
as well as URLs for NNTP newsgroup(s).