Sean Hefty [Wed, 11 Feb 2015 00:50:08 +0000 (16:50 -0800)]
rsocket: Fix race in indexer map
Although insertions and removals of rsockets are protected
against accesses to the index map, when reading the map using
a non-rsocket (i.e. normal fd), the reading of the map may
overlap with the removal of an rsocket. This can result in
accessing freed memory.
We can avoid this by not freeing the memory when rsockets
no longer reference an index array. This ensures that the
memory is valid, and protects against reading the memory without
adding locking into the read path.
Problem reported by: Sasha Kotchubievsky <sashakot@mellanox.com>
Sean Hefty [Wed, 11 Feb 2015 00:50:08 +0000 (16:50 -0800)]
rsocket: Fix race in indexer map
Although insertions and removals of rsockets are protected
against accesses to the index map, when reading the map using
a non-rsocket (i.e. normal fd), the reading of the map may
overlap with the removal of an rsocket. This can result in
accessing freed memory.
We can avoid this by not freeing the memory when rsockets
no longer reference an index array. This ensures that the
memory is valid, and protects against reading the memory without
adding locking into the read path.
Problem reported by: Sasha Kotchubievsky <sashakot@mellanox.com>
Sean Hefty [Wed, 11 Feb 2015 00:50:08 +0000 (16:50 -0800)]
rsocket: Fix race in indexer map
Although insertions and removals of rsockets are protected
against accesses to the index map, when reading the map using
a non-rsocket (i.e. normal fd), the reading of the map may
overlap with the removal of an rsocket. This can result in
accessing freed memory.
Problem reported by: Sasha Kotchubievsky <sashakot@mellanox.com>
Sean Hefty [Wed, 11 Feb 2015 00:50:08 +0000 (16:50 -0800)]
rsocket: Fix race in indexer map
Although insertions and removals of rsockets are protected
against accesses to the index map, when reading the map using
a non-rsocket (i.e. normal fd), the reading of the map may
overlap with the removal of an rsocket. This can result in
accessing freed memory.
Sean Hefty [Fri, 6 Feb 2015 05:17:03 +0000 (21:17 -0800)]
rsockets: Fix setting flags in rfctl
The rfcntl() call to set rsocket flags merely OR's in
the updated flags with the existing ones, rather than
replacing them. Also, it does not handle setting an
rsocket from nonblocking mode back to blocking mode.
Sean Hefty [Fri, 6 Feb 2015 05:17:03 +0000 (21:17 -0800)]
rsockets: Fix setting flags in rfctl
The rfcntl() call to set rsocket flags merely OR's in
the updated flags with the existing ones, rather than
replacing them. Also, it does not handle setting an
rsocket from nonblocking mode back to blocking mode.
Sean Hefty [Fri, 6 Feb 2015 05:17:03 +0000 (21:17 -0800)]
rsockets: Fix setting flags in rfctl
The rfcntl() call to set rsocket flags merely OR's in
the updated flags with the existing ones, rather than
replacing them. Also, it does not handle setting an
rsocket from nonblocking mode back to blocking mode.
Steve Wise [Mon, 12 Jan 2015 16:57:40 +0000 (10:57 -0600)]
rping: create persistent server threads in DETACHED state
Since the persistent server threads aren't joined, they must be created in
the DETACHED state or resources will not be cleaned up when they exit.
This results in pthread_create() failures after thousands of rping
instances are run against a persistent server.
Also check the return from all calls to pthread_create() so we don't
ignore a thread creation failure.
Signed-off-by: Steve Wise <swise@opengridcomputing.com>