From: David Laight <David.Laight@ACULAB.COM>
To: 'Mark Rutland' <mark.rutland@arm.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:35:23 +0000 [thread overview]
Message-ID: <b3d815b3ee734278a6fa34d4d129d15d@AcuMS.aculab.com> (raw)
In-Reply-To: <267402c9e66a4cac91a2e1df749dea6a@AcuMS.aculab.com>
From: David Laight
> Sent: 01 November 2022 13:30
>
> From: Mark Rutland
> > Sent: 01 November 2022 13:13
> >
> > 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 assignment to argv is earlier.
Clearly I meant argp :-)
Alternatively all the helper functions should be changed to
have an 'unsigned int' argument instead of 'unsigned long'.
That might show up any that try to read user buffers.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2022-11-01 13:35 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
2022-11-01 13:29 ` David Laight
2022-11-01 13:35 ` David Laight [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=b3d815b3ee734278a6fa34d4d129d15d@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--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