From: Jeff Moyer <jmoyer@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: io-uring <io-uring@vger.kernel.org>
Subject: Re: [PATCH] io_uring/register: guard compat syscall with CONFIG_COMPAT
Date: Wed, 17 Jan 2024 10:59:13 -0500 [thread overview]
Message-ID: <x49il3suf1q.fsf@segfault.usersys.redhat.com> (raw)
In-Reply-To: <80eceef8-b2d7-47e8-9ef9-7264249dedbb@kernel.dk> (Jens Axboe's message of "Wed, 17 Jan 2024 07:51:07 -0700")
Hi, Jens,
Jens Axboe <axboe@kernel.dk> writes:
> Add compat.h include to avoid a potential build issue:
>
> io_uring/register.c:281:6: error: call to undeclared function 'in_compat_syscall'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
>
> if (in_compat_syscall()) {
> ^
> 1 warning generated.
> io_uring/register.c:282:9: error: call to undeclared function 'compat_get_bitmap'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
> ret = compat_get_bitmap(cpumask_bits(new_mask),
> ^
>
> Fixes: c43203154d8a ("io_uring/register: move io_uring_register(2) related code to register.c")
> Reported-by: Manu Bretelle <chantra@meta.com>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>
> ---
>
> diff --git a/io_uring/register.c b/io_uring/register.c
> index 708dd1d89add..5e62c1208996 100644
> --- a/io_uring/register.c
> +++ b/io_uring/register.c
> @@ -14,6 +14,7 @@
> #include <linux/slab.h>
> #include <linux/uaccess.h>
> #include <linux/nospec.h>
> +#include <linux/compat.h>
> #include <linux/io_uring.h>
> #include <linux/io_uring_types.h>
This makes sense to me, but I wasn't able to reproduce that build error
after disabling CONFIG_COMPAT.
> @@ -278,13 +279,14 @@ static __cold int io_register_iowq_aff(struct io_ring_ctx *ctx,
> if (len > cpumask_size())
> len = cpumask_size();
>
> - if (in_compat_syscall()) {
> +#ifdef CONFIG_COMPAT
> + if (in_compat_syscall())
I don't think this is needed.
linux/compat.h:
...
#else /* !CONFIG_COMPAT */
#define is_compat_task() (0)
/* Ensure no one redefines in_compat_syscall() under !CONFIG_COMPAT */
#define in_compat_syscall in_compat_syscall
static inline bool in_compat_syscall(void) { return false; }
Isn't the code fine as-is?
-Jeff
> ret = compat_get_bitmap(cpumask_bits(new_mask),
> (const compat_ulong_t __user *)arg,
> len * 8 /* CHAR_BIT */);
> - } else {
> + else
> +#endif
> ret = copy_from_user(new_mask, arg, len);
> - }
>
> if (ret) {
> free_cpumask_var(new_mask);
next prev parent reply other threads:[~2024-01-17 15:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 14:51 [PATCH] io_uring/register: guard compat syscall with CONFIG_COMPAT Jens Axboe
2024-01-17 15:59 ` Jeff Moyer [this message]
2024-01-17 16:04 ` Jens Axboe
2024-01-17 16:24 ` Jeff Moyer
2024-01-17 16:45 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=x49il3suf1q.fsf@segfault.usersys.redhat.com \
--to=jmoyer@redhat.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.