From: Al Viro <viro@zeniv.linux.org.uk>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-fsdevel@vger.kernel.org, brauner@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] signalfd: convert to ->read_iter()
Date: Wed, 3 Apr 2024 23:57:47 +0100 [thread overview]
Message-ID: <20240403225747.GO538574@ZenIV> (raw)
In-Reply-To: <20240403140446.1623931-4-axboe@kernel.dk>
On Wed, Apr 03, 2024 at 08:02:54AM -0600, Jens Axboe wrote:
> Rather than use the older style ->read() hook, use ->read_iter() so that
> signalfd can support both O_NONBLOCK and IOCB_NOWAIT for non-blocking
> read attempts.
>
> Split the fd setup into two parts, so that signalfd can mark the file
> mode with FMODE_NOWAIT before installing it into the process table.
Same issue with copy_to_iter() calling conventions; what's more, userland
really does not expect partial copies here, so it might be worth adding
static inline
bool copy_to_iter_full(void *addr, size_t bytes, struct iov_iter *i)
{
size_t copied = copy_to_iter(addr, bytes, i);
if (likely(copied == bytes))
return true;
iov_iter_revert(i, copied);
return false;
}
to include/linux/uio.h for the sake of those suckers. Then
they could go for
return copy_to_iter_full(&new, sizeof(new), to) ? sizeof(new) : -EFAULT;
and similar in other two.
NOTE: the userland ABI is somewhat sucky here - if the buffer goes
unmapped (or r/o) at the offset that is *not* a multiple of
sizeof(struct signalfd_siginfo), you get an event quietly lost.
Not sure what can be done with that - it is a user-visible ABI.
next prev parent reply other threads:[~2024-04-03 22:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 14:02 [PATCHSET v2 0/3] Convert fs drivers to ->read_iter() Jens Axboe
2024-04-03 14:02 ` [PATCH 1/3] timerfd: convert " Jens Axboe
2024-04-03 22:40 ` Al Viro
2024-04-04 12:51 ` Jens Axboe
2024-04-03 14:02 ` [PATCH 2/3] userfaultfd: " Jens Axboe
2024-04-03 22:45 ` Al Viro
2024-04-03 14:02 ` [PATCH 3/3] signalfd: " Jens Axboe
2024-04-03 22:57 ` Al Viro [this message]
2024-04-04 12:52 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2024-04-02 20:18 [PATCHSET 0/3] Convert fs drivers " Jens Axboe
2024-04-02 20:18 ` [PATCH 3/3] signalfd: convert " 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=20240403225747.GO538574@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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.