[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2B6jcLUJ1F2y2yL@mit.edu>
Date: Mon, 31 Oct 2022 21:46:53 -0400
From: "Theodore Ts'o" <tytso@....edu>
To: Szabolcs Nagy <szabolcs.nagy@....com>
Cc: linux-api@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: linux interprets an fcntl int arg as long
On Mon, Oct 31, 2022 at 12:44:59PM +0000, Szabolcs Nagy wrote:
> and such fcntl call can happen with c code that just passes
> F_SEAL_WRITE since it is an int and e.g. with aarch64 pcs rules
> it is passed in a register where top bits can be non-zero
> (unlikely in practice but valid).
In Linux's aarch64 ABI, an int is a 4-byte value. It is *not* an
8-byte value. So passing in "F_SEAL_WRITE | 0xF00000000" as an int
(as in your example) is simply not valid thing for the userspace
program to do.
Now, if there is a C program which has "int c = F_SEAL_WRITE", if the
PCS allows the compiler to pass a function paramter c --- for example
f(a, b, c) --- where the 4-byte paramter 'c' is placed in a 64-bit
register where the high bits of the 64-bit register contains non-zero
garbage values, I would argue that this is a bug in the PCS and/or the
compiler.
- Ted
Powered by blists - more mailing lists