lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 1 Nov 2022 13:35:23 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Mark Rutland' <mark.rutland@....com>
CC:     'Szabolcs Nagy' <szabolcs.nagy@....com>,
        'Theodore Ts'o' <tytso@....edu>,
        "'linux-api@...r.kernel.org'" <linux-api@...r.kernel.org>,
        "'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
        "'linux-arm-kernel@...ts.infradead.org'" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: RE: linux interprets an fcntl int arg as long

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@....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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ