Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1402876

Re: [PATCH] net: af_unix: protect ->sk_shutdown change with lock_sock()

From Hannes Frederic Sowa <hannes@stressinduktion.org>
Newsgroups linux.kernel
Subject Re: [PATCH] net: af_unix: protect ->sk_shutdown change with lock_sock()
Date 2016-05-18 12:40 +0200
Message-ID <rA73s-SY-33@gated-at.bofh.it> (permalink)
References <rA73s-SY-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 18.05.2016 12:14, Andrey Ryabinin wrote:
> ->sk_shutdown bits share one bitfield with some other bits in sock struct,
> such as ->sk_no_check_[r,t]x, ->sk_userlocks ...
> sock_setsockopt() may write to these bits, while holding the socket lock.
> In case of AF_UNIX sockets, we change ->sk_shutdown bits while holding only
> unix_state_lock(). So concurrent setsockopt() and shutdown() may lead
> to corrupting these bits.
> 
> Fix that by protecting writes to ->sk_shutdown with lock_sock()

Is it possible to move sk_shutdown out of the bitfields? Maybe a whole
which suites is available somewhere?

af_unix doesn't depend on the socket locks anywhere and it would keep
locking much easier if we only depend on the state lock.

Bye,
Hannes

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] net: af_unix: protect ->sk_shutdown change with  lock_sock() Hannes Frederic Sowa <hannes@stressinduktion.org> - 2016-05-18 12:40 +0200
  [PATCH v2] net: sock: move ->sk_shutdown out of bitfields. Andrey Ryabinin <aryabinin@virtuozzo.com> - 2016-05-18 14:10 +0200
    Re: [PATCH v2] net: sock: move ->sk_shutdown out of bitfields. Eric Dumazet <eric.dumazet@gmail.com> - 2016-05-18 15:10 +0200
      Re: [PATCH v2] net: sock: move ->sk_shutdown out of bitfields. Andrey Ryabinin <aryabinin@virtuozzo.com> - 2016-05-18 15:30 +0200
        Re: [PATCH v2] net: sock: move ->sk_shutdown out of bitfields. Eric Dumazet <eric.dumazet@gmail.com> - 2016-05-18 15:50 +0200
      [PATCH v3] net: sock: move ->sk_shutdown out of bitfields. Andrey Ryabinin <aryabinin@virtuozzo.com> - 2016-05-18 17:00 +0200
        Re: [PATCH v3] net: sock: move ->sk_shutdown out of bitfields. Eric Dumazet <eric.dumazet@gmail.com> - 2016-05-18 17:40 +0200
          [PATCH v4] net: sock: move ->sk_shutdown out of bitfields. Andrey Ryabinin <aryabinin@virtuozzo.com> - 2016-05-18 19:00 +0200
            Re: [PATCH v4] net: sock: move ->sk_shutdown out of bitfields. Eric Dumazet <eric.dumazet@gmail.com> - 2016-05-18 19:20 +0200
            Re: [PATCH v4] net: sock: move ->sk_shutdown out of bitfields. David Miller <davem@davemloft.net> - 2016-05-21 00:10 +0200
  Re: [PATCH] net: af_unix: protect ->sk_shutdown change with  lock_sock() Andrey Ryabinin <aryabinin@virtuozzo.com> - 2016-05-18 15:00 +0200

csiph-web