RE: linux interprets an fcntl int arg as long
From: David Laight <hidden>
Date: 2022-11-01 13:29:52
Also in:
linux-arm-kernel, lkml
From: David Laight <hidden>
Date: 2022-11-01 13:29:52
Also in:
linux-arm-kernel, lkml
From: Mark Rutland
Sent: 01 November 2022 13:13 On Tue, Nov 01, 2022 at 12:19:51PM +0000, David Laight wrote:quoted
From: 'Szabolcs Nagy' <redacted>quoted
Sent: 01 November 2022 11:45 The 11/01/2022 10:02, David Laight wrote:quoted
From: Szabolcs Nagyquoted
quoted
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. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)