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:	Wed, 09 Apr 2014 12:38:22 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	dborkman@...hat.com
Cc:	netdev@...r.kernel.org, linux-sctp@...r.kernel.org,
	vyasevic@...hat.com
Subject: Re: [PATCH net v3] net: sctp: test if association is dead in
 sctp_wake_up_waiters

From: Daniel Borkmann <dborkman@...hat.com>
Date: Wed,  9 Apr 2014 16:10:20 +0200

> In function sctp_wake_up_waiters(), we need to involve a test
> if the association is declared dead. If so, we don't have any
> reference to a possible sibling association anymore and need
> to invoke sctp_write_space() instead, and normally walk the
> socket's associations and notify them of new wmem space. The
> reason for special casing is that otherwise, we could run
> into the following issue when a sctp_primitive_SEND() call
> from sctp_sendmsg() fails, and tries to flush an association's
> outq, i.e. in the following way:
 ...
> Therefore, only walk the list in an 'optimized' way if we find
> that the current association is still active. We could also use
> list_del_init() in addition when we call sctp_association_free(),
> but as Vlad suggests, we want to trap such bugs and thus leave
> it poisoned as is.
> 
> Why is it safe to resolve the issue by testing for asoc->base.dead?
> Parallel calls to sctp_sendmsg() are protected under socket lock,
> that is lock_sock()/release_sock(). Only within that path under
> lock held, we're setting skb/chunk owner via sctp_set_owner_w().
> Eventually, chunks are freed directly by an association still
> under that lock. So when traversing association list on destruction
> time from sctp_wake_up_waiters() via sctp_wfree(), a different
> CPU can't be running sctp_wfree() while another one calls
> sctp_association_free() as both happens under the same lock.
> Therefore, this can also not race with setting/testing against
> asoc->base.dead as we are guaranteed for this to happen in order,
> under lock. Further, Vlad says: the times we check asoc->base.dead
> is when we've cached an association pointer for later processing.
> In between cache and processing, the association may have been
> freed and is simply still around due to reference counts. We check
> asoc->base.dead under a lock, so it should always be safe to check
> and not race against sctp_association_free(). Stress-testing seems
> fine now, too.
> 
> Fixes: cd253f9f357d ("net: sctp: wake up all assocs if sndbuf policy is per socket")
> Signed-off-by: Daniel Borkmann <dborkman@...hat.com>
> Cc: Vlad Yasevich <vyasevic@...hat.com>
> Acked-by: Neil Horman <nhorman@...driver.com>
> Acked-by: Vlad Yasevich <vyasevic@...hat.com>

Applied and queued up for -stable, thanks!
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ