Hi all,
This patch series addresses the issue reported in the following issue: https://git.morello-project.org/morello/kernel/linux/-/issues/43
Changes available at: https://git.morello-project.org/Sevenarth/linux/-/commits/morello/6.1-compat...
Luca Vizzarro (1): fs/fcntl: Fix pointer conversion in compat
fs/fcntl.c | 7 +++++++ 1 file changed, 7 insertions(+)
The compat fcntl handler currently does not perform simple pointer conversions for the commands which take a user pointer as an argument. This commit adds this new case to the switch in the handler, by converting the argument before calling do_fcntl for the relevant commands.
Signed-off-by: Luca Vizzarro Luca.Vizzarro@arm.com --- fs/fcntl.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/fs/fcntl.c b/fs/fcntl.c index 918d0136d12b..5f55eed7793b 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -654,6 +654,13 @@ static long do_compat_fcntl64(unsigned int fd, unsigned int cmd, break; err = fcntl_setlk(fd, f.file, convert_fcntl_cmd(cmd), &flock); break; + case F_GETOWN_EX: + case F_SETOWN_EX: + case F_GETOWNER_UIDS: + case F_GET_RW_HINT: + case F_SET_RW_HINT: + err = do_fcntl(fd, cmd, (user_uintptr_t)compat_ptr(arg), f.file); + break; default: err = do_fcntl(fd, cmd, arg, f.file); break;
On 07/02/2023 15:31, Luca Vizzarro wrote:
The compat fcntl handler currently does not perform simple pointer conversions for the commands which take a user pointer as an argument.
More specifically not all of them, as it already handles F_GETLK/F_SETLK.
LGTM otherwise.
Kevin
This commit adds this new case to the switch in the handler, by converting the argument before calling do_fcntl for the relevant commands.
Signed-off-by: Luca Vizzarro Luca.Vizzarro@arm.com
fs/fcntl.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/fs/fcntl.c b/fs/fcntl.c index 918d0136d12b..5f55eed7793b 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -654,6 +654,13 @@ static long do_compat_fcntl64(unsigned int fd, unsigned int cmd, break; err = fcntl_setlk(fd, f.file, convert_fcntl_cmd(cmd), &flock); break;
- case F_GETOWN_EX:
- case F_SETOWN_EX:
- case F_GETOWNER_UIDS:
- case F_GET_RW_HINT:
- case F_SET_RW_HINT:
err = do_fcntl(fd, cmd, (user_uintptr_t)compat_ptr(arg), f.file);
default: err = do_fcntl(fd, cmd, arg, f.file); break;break;
linux-morello@op-lists.linaro.org