fcntl: Fix pointer conversion in compat
The compat fcntl handler currently does not perform simple pointer
conversions for all of 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(a)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;
--
2.34.1
Hi all,
This patch 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-compa…
v2:
- reword commit message
Hi all,
This patch series addresses the issue reported in the following issue:
https://git.morello-project.org/morello/kernel/linux/-/issues/42
Changes available at:
https://git.morello-project.org/Sevenarth/linux/-/commits/morello/6.1-fix-f…
v4:
- update arg type of fcntl's setfl and f_setown
- reword commits
- update arg type of dnotify's fcntl_dirnotify and convert_arg
v3:
- move the explicit cast change before updating the interfaces
- fix typos
v2:
- added a new argi variable which performs explicit int casting
- updated all of the commands with int argument to use argi explicitly
- updated signatures for the abstract generic_setlease and vfs_setlease with int argument
Luca Vizzarro (5):
fcntl: Cast commands with int args explicitly
fs: Pass argument to fcntl_setlease as int
pipe: Pass argument of pipe_fcntl as int
memfd: Pass argument of memfd_fcntl as int
dnotify: Pass argument of fcntl_dirnotify as int
fs/cifs/cifsfs.c | 2 +-
fs/fcntl.c | 29 +++++++++++++++--------------
fs/libfs.c | 2 +-
fs/locks.c | 22 +++++++++++-----------
fs/nfs/nfs4file.c | 2 +-
fs/nfs/nfs4proc.c | 4 ++--
fs/notify/dnotify/dnotify.c | 4 ++--
fs/pipe.c | 6 +++---
include/linux/dnotify.h | 4 ++--
include/linux/fs.h | 16 ++++++++--------
include/linux/memfd.h | 4 ++--
include/linux/pipe_fs_i.h | 4 ++--
mm/memfd.c | 6 +-----
13 files changed, 51 insertions(+), 54 deletions(-)
--
2.34.1
This series makes it possible for purecap apps to use the io_uring
system.
With these patches, all io_uring LTP tests pass in both Purecap and
compat modes. Note that the LTP tests only address the basic
functionality of the io_uring system and a significant portion of the
multiplexed functionality is untested in LTP.
I have started running and investigating liburing tests and examples, so
this is not a final version, but review is still very much appreciated
while I go through the liburing tests.
v2:
- Rebase on top of release 6.1
- Remove VM_READ_CAPS/VM_LOAD_CAPS patches as they are already merged
- Update commit message in PATCH 1
- Add the generic changes PATCH 2 and PATCH 3 to avoid copying user
pointers from/to userspace unnecesarily. These could be upstreamable.
- Split "pulling the cqes memeber out" change into PATCH 4
- The changes for PATCH 5 and 6 are now split into their respective
files after the rebase.
- Format and change organization based on the feedback on the
previous version, including creating helpers copy_*_from_* for various
uAPI structs
- Add comments related to handling of setup flags IORING_SETUP_SQE128
and IORING_SETUP_CQE32
- Add handling for new uAPI structs: io_uring_buf, io_uring_buf_ring,
io_uring_buf_reg, io_uring_sync_cancel_reg.
Gitlab issue:
https://git.morello-project.org/morello/kernel/linux/-/issues/2
Review branch:
https://git.morello-project.org/tudcre01/linux/-/commits/morello/io_uring_v2
Tudor Cretu (7):
compiler_types: Add (u)intcap_t to native_words
io_uring/rw : Restrict copy to only uiov->len from userspace
io_uring/tctx: Copy only the offset field back to user
io_uring: Pull cqes member out from rings struct
io_uring: Implement compat versions of uAPI structs and handle them
io_uring: Use user pointer type in the uAPI structs
io_uring: Allow capability tag access on the shared memory
include/linux/compiler_types.h | 7 +
include/linux/io_uring_types.h | 160 ++++++++++++++--
include/uapi/linux/io_uring.h | 62 ++++---
io_uring/advise.c | 2 +-
io_uring/cancel.c | 40 +++-
io_uring/cancel.h | 2 +-
io_uring/epoll.c | 2 +-
io_uring/fdinfo.c | 64 ++++++-
io_uring/fs.c | 16 +-
io_uring/io_uring.c | 329 +++++++++++++++++++++++++--------
io_uring/io_uring.h | 126 ++++++++++---
io_uring/kbuf.c | 119 ++++++++++--
io_uring/kbuf.h | 8 +-
io_uring/msg_ring.c | 4 +-
io_uring/net.c | 18 +-
io_uring/openclose.c | 4 +-
io_uring/poll.c | 4 +-
io_uring/rsrc.c | 150 ++++++++++++---
io_uring/rw.c | 17 +-
io_uring/statx.c | 4 +-
io_uring/tctx.c | 57 +++++-
io_uring/timeout.c | 10 +-
io_uring/uring_cmd.c | 5 +
io_uring/uring_cmd.h | 7 +
io_uring/xattr.c | 12 +-
25 files changed, 977 insertions(+), 252 deletions(-)
--
2.34.1
Hi,
Following up on Luca's series addressing ioctl-related GCC warnings,
this series takes care of the remaining warnings reported by GCC (but
not Clang). The patches are all straightforward, except patch 13 (see
below).
Some notes:
- Patch 1-3 fix up small oversights in our own commits (see Fixes:
tags).
- Patch 9-10 are about creating user pointers in cases where it is
unavoidable, such cases are not concerning.
- Patch 11-12 and 14-18 are about creating user pointers because of
uapi deficiencies (i.e. user pointers represented as __u64 in
structs). They should therefore be viewed as a stopgap while waiting
for a full solution (uapi change and compat handling); this is tracked
by the following tickets:
* Patch 11: https://git.morello-project.org/morello/kernel/linux/-/issues/48
* Patch 12: https://git.morello-project.org/morello/kernel/linux/-/issues/47
* Patch 14: https://git.morello-project.org/morello/kernel/linux/-/issues/46
* Patch 15: https://git.morello-project.org/morello/kernel/linux/-/issues/50
* Patch 16: https://git.morello-project.org/morello/kernel/linux/-/issues/51
* Patch 17-18: https://git.morello-project.org/morello/kernel/linux/-/issues/52
- Patch 13 is upstreamable and is written in that spirit. Fixing up the
msg_control/msg_control_user split required grepping all uses, as only
a few misuses actually lead to warnings in PCuABI. Note that as an
exceptional bending of the rules, this patch introduces a warning
(both with Clang and GCC), which is impossible to avoid in a patch for
upstream. The next patch (14) fixes the warnings so it should not be
an issue in practice.
With these patches and Luca's, only a handful of genuine GCC warnings
are left:
- A few in fs/aio.c, tracked by
https://git.morello-project.org/morello/kernel/linux/-/issues/49
- A few under kernel/bpf/, should be addressed by
https://git.morello-project.org/morello/kernel/linux/-/issues/4
Other warnings are Morello GCC defects and have been reported.
Thanks,
Kevin
Kevin Brodsky (18):
arm64: signal: Avoid unnecessary capability arithmetic
drivers/android/binder: Cast to (void *) when printing %p
drivers/android/binder: Cast user_uintptr_t arg when printing
math.h: Make round_{up,down} capability-friendly
asm-generic/cacheflush.h: Use appropriate user pointer conversion
kernel: signal: Use appropriate user pointer conversion
perf/core: Use appropriate user pointer conversion
compat: Fix shift warning in compat64
audit: Explicitly create user pointer
coredump: Explicitly create user pointer
kernel/futex: Explicitly create user pointer
rseq: Explicitly create user pointers
net: Finish up ->msg_control{,_user} split
tcp: Explicitly create user pointers
Input: evdev: Explicitly create user pointers
mmc: block: Explicitly create user pointers
drm: Explicitly create user pointers
drm/panfrost: Explicitly create user pointers
arch/arm64/kernel/signal.c | 6 +++--
drivers/android/binder.c | 4 ++--
drivers/android/binder_alloc.c | 25 +++++++++++----------
drivers/gpu/drm/drm_atomic_uapi.c | 8 +++----
drivers/gpu/drm/drm_color_mgmt.c | 12 +++++-----
drivers/gpu/drm/drm_connector.c | 8 +++----
drivers/gpu/drm/drm_crtc.c | 2 +-
drivers/gpu/drm/drm_framebuffer.c | 2 +-
drivers/gpu/drm/drm_lease.c | 4 ++--
drivers/gpu/drm/drm_mode_object.c | 4 ++--
drivers/gpu/drm/drm_plane.c | 2 +-
drivers/gpu/drm/panfrost/panfrost_drv.c | 4 ++--
drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 2 +-
drivers/input/evdev.c | 4 ++--
drivers/mmc/core/block.c | 6 ++---
fs/coredump.c | 2 +-
include/asm-generic/cacheflush.h | 6 ++---
include/linux/math.h | 5 +++++
kernel/auditsc.c | 2 +-
kernel/compat.c | 4 ++--
kernel/events/core.c | 2 +-
kernel/futex/waitwake.c | 2 +-
kernel/rseq.c | 4 ++--
kernel/signal.c | 2 +-
net/compat.c | 13 ++++++-----
net/core/scm.c | 9 +++++---
net/ipv4/tcp.c | 8 +++----
27 files changed, 82 insertions(+), 70 deletions(-)
--
2.38.1
Hi all,
This patch series addresses the issue reported in the following issue:
https://git.morello-project.org/morello/kernel/linux/-/issues/42
Changes available at:
https://git.morello-project.org/Sevenarth/linux/-/commits/morello/6.1-fix-f…
v2:
- added a new argi variable which performs explicit int casting
- updated all of the commands with int argument to use argi explicitly
- updated signatures for the abstract generic_setlease and vfs_setlease with int argument
Luca Vizzarro (5):
fs/fcntl: Fix F_SETLEASE argument type
fs/fcntl: Fix F_SETSIG argument type
fs/fcntl: Fix F_SETPIPE_SZ argument type
fs/fcntl: Fix F_ADD_SEALS argument type
fs/fcntl: Update commands with argi
fs/cifs/cifsfs.c | 2 +-
fs/fcntl.c | 23 ++++++++++++-----------
fs/libfs.c | 2 +-
fs/locks.c | 22 +++++++++++-----------
fs/nfs/nfs4file.c | 2 +-
fs/nfs/nfs4proc.c | 4 ++--
fs/pipe.c | 6 +++---
include/linux/fs.h | 16 ++++++++--------
include/linux/memfd.h | 4 ++--
include/linux/pipe_fs_i.h | 4 ++--
mm/memfd.c | 6 +-----
11 files changed, 44 insertions(+), 47 deletions(-)
--
2.34.1
Hi all,
This patch series addresses the issue reported in the following issue:
https://git.morello-project.org/morello/kernel/linux/-/issues/42
Changes available at:
https://git.morello-project.org/Sevenarth/linux/-/commits/morello/6.1-fix-f…
v3:
- move the explicit cast change before updating the interfaces
- fix typos
v2:
- added a new argi variable which performs explicit int casting
- updated all of the commands with int argument to use argi explicitly
- updated signatures for the abstract generic_setlease and vfs_setlease with int argument
Luca Vizzarro (4):
fs/fcntl: Cast commands with int args explicitly
fs/fcntl: Fix F_SETLEASE helper functions
fs/fcntl: Fix F_SETPIPE_SZ helper functions
fs/fcntl: Fix F_ADD_SEALS helper functions
fs/cifs/cifsfs.c | 2 +-
fs/fcntl.c | 23 ++++++++++++-----------
fs/libfs.c | 2 +-
fs/locks.c | 22 +++++++++++-----------
fs/nfs/nfs4file.c | 2 +-
fs/nfs/nfs4proc.c | 4 ++--
fs/pipe.c | 6 +++---
include/linux/fs.h | 16 ++++++++--------
include/linux/memfd.h | 4 ++--
include/linux/pipe_fs_i.h | 4 ++--
mm/memfd.c | 6 +-----
11 files changed, 44 insertions(+), 47 deletions(-)
--
2.34.1
On 13/02/2023 14:30, Björn Töpel wrote:
> Björn Töpel <bjorn(a)kernel.org> writes:
>
>> From: Björn Töpel <bjorn(a)rivosinc.com>
>>
>> When the BPF selftests are cross-compiled, only the a host version of
>> bpftool is built. This version of bpftool is used to generate various
>> intermediates, e.g., skeletons.
>>
>> The test runners are also using bpftool. The Makefile will symlink
>> bpftool from the selftest/bpf root, where the test runners will look
>> for the tool:
>>
>> | ...
>> | $(Q)ln -sf $(if $2,..,.)/tools/build/bpftool/bootstrap/bpftool \
>> | $(OUTPUT)/$(if $2,$2/)bpftool
>>
>> There are two issues for cross-compilation builds:
>>
>> 1. There is no native (cross-compilation target) build of bpftool
>> 2. The bootstrap variant of bpftool is never cross-compiled (by
>> design)
>>
>> Make sure that a native/cross-compiled version of bpftool is built,
>> and if CROSS_COMPILE is set, symlink to the native/non-bootstrap
>> version.
>
> ...and the grand master plan is to add BPF CI support for riscv64, where
> this patch a prerequisite to [1]. I would suspect that other platforms
> might benefit from cross-compilation builds as well.
Similar use case. There also seems to be a lot of issues building these
tests out of tree.
I have some potential fixes up to 6.1 but linux-next seems to have
introduced a few more issues on top.
>
> [1] https://github.com/kernel-patches/vmtest/pull/194