[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110904161822.GA8176@rere.qmqm.pl>
Date: Sun, 4 Sep 2011 18:18:22 +0200
From: Michał Mirosław <mirq@...e.qmqm.pl>
To: kaber@...sh.net
Cc: davem@...emloft.net, netfilter-devel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH 08/11] netlink: implement memory mapped sendmsg()
On Sat, Sep 03, 2011 at 07:26:08PM +0200, kaber@...sh.net wrote:
> From: Patrick McHardy <kaber@...sh.net>
>
> Add support for memory mapped sendmsg() to netlink. Userspace queued to
> be processed frames into the TX ring and invokes sendmsg with
> msg.iov.iov_base = NULL to trigger processing of all pending messages.
>
> Since the kernel usually performs full message validation before beginning
> processing, userspace must be prevented from modifying the message
> contents while the kernel is processing them. In order to do so, the
> frames contents are copied to an allocated skb in case the the ring is
> mapped more than once or the file descriptor is shared (f.i. through
> AF_UNIX file descriptor passing).
>
> Otherwise an skb without a data area is allocated, the data pointer set
> to point to the data area of the ring frame and the skb is processed.
> Once the skb is freed, the destructor releases the frame back to userspace
> by setting the status to NL_MMAP_STATUS_UNUSED.
Is this protected from threads? Like: one thread waits on sendmsg() and
another (same process) changes the buffer.
Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists