lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 02 Feb 2023 10:47:17 -0800
From:   Stefan Roesch <shr@...kernel.io>
To:     Ammar Faizi <ammarfaizi2@...weeb.org>
Cc:     Facebook Kernel Team <kernel-team@...com>,
        Jens Axboe <axboe@...nel.dk>,
        Olivier Langlois <olivier@...llion01.com>,
        netdev Mailing List <netdev@...r.kernel.org>,
        io-uring Mailing List <io-uring@...r.kernel.org>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH v6 2/3] io_uring: add api to set / get napi configuration.


Ammar Faizi <ammarfaizi2@...weeb.org> writes:

> On Wed, Feb 01, 2023 at 02:22:53PM -0800, Stefan Roesch wrote:
>> +static int io_unregister_napi(struct io_ring_ctx *ctx, void __user *arg)
>> +{
>> +#ifdef CONFIG_NET_RX_BUSY_POLL
>> +	const struct io_uring_napi curr = {
>> +		.busy_poll_to = ctx->napi_busy_poll_to,
>> +	};
>> +
>> +	if (arg) {
>> +		if (copy_to_user(arg, &curr, sizeof(curr)))
>> +			return -EFAULT;
>> +	}
>> +
>> +	WRITE_ONCE(ctx->napi_busy_poll_to, 0);
>> +	return 0;
>> +#else
>> +	return -EINVAL;
>> +#endif
>> +}
>
> Just to follow the common pattern when a feature is not enabled the
> return value is -EOPNOTSUPP instead of -EINVAL. What do you think?
>

Sounds good, I'll return -EOPNOTSUPP when CONFIG_NET_RX_BUSY_POLL is not
enabled. I'll make the change for the register and the unregister
function.

>> +	case IORING_UNREGISTER_NAPI:
>> +		ret = -EINVAL;
>> +		if (!arg)
>> +			break;
>> +		ret = io_unregister_napi(ctx, arg);
>> +		break;
>
> This needs to be corrected. If the @arg var is NULL, you return -EINVAL.
> So io_unregister_napi() will always have @arg != NULL. This @arg check
> should go, allow the user to pass a NULL pointer to it.
>
> Our previous agreement on this API is to allow the user to pass a NULL
> pointer in case the user doesn't care about the old value.
>
> Also, having a liburing test case that verifies this behavior would be
> excellent.
>

I'll remove the check for the arg parameter. In addition I will output
the busy poll timeout and the prefer busy poll setting in the client
example program if one of the settings has been enabled.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ