From: David Miller <davem@davemloft.net>
To: kuznet@ms2.inr.ac.ru
Cc: dim@openvz.org, netdev@vger.kernel.org, dev@sw.ru
Subject: Re: [PATCH] fix sk->sk_filter field access
Date: Wed, 30 Aug 2006 15:32:59 -0700 (PDT) [thread overview]
Message-ID: <20060830.153259.59653494.davem@davemloft.net> (raw)
In-Reply-To: <20060830222042.GA21714@ms2.inr.ac.ru>
From: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Date: Thu, 31 Aug 2006 02:20:42 +0400
> Current code in tcp_v4_rcv() calls sk_filter() _before_ it takes socket lock.
> This happened when LSM patches were applied. Apparently, LSM does not
> want to see socket locked in security_sock_rcv_skb().
Ok.
> Obvious solution is to change the third argument of sk_filter
> "needlock" to 1. Then we see that sk_filter() is not used with
> needlock=0 anymore, therefore it can be completely eliminated. It
> was original fix.
Really?
It is used with needlock=0 by DCCP ipv6, for example. This case seems
correct too. What about sk_receive_skb()? dn_queue_skb()? In fact,
there seems to be numerous uses still with needlock=0, all legitimate.
> I suggested to remove ugly misuse of bh_lock_sock() (introduced by
> me, just because there was no better lock to use) and replace it
> with RCU, which is logical and clean.
>
> The patch looks decent. I had one doubt about misuse of
> rcu_read_lock_bh() in sk_attach_filter(). Probably, it should be
> plain local_bh_disable(), I do not know. But because
> rcu_read_lock_bh() actually is local_bh_disable(), it seems to be
> not a serious issue.
Let us to fix bugs first, and then consider rewriting the locking.
:-)
next prev parent reply other threads:[~2006-08-30 22:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-30 13:07 [PATCH] fix sk->sk_filter field access Dmitry Mishin
2006-08-30 21:30 ` David Miller
2006-08-30 22:20 ` Alexey Kuznetsov
2006-08-30 22:32 ` David Miller [this message]
2006-08-30 23:14 ` Alexey Kuznetsov
2006-08-30 23:16 ` David Miller
2006-08-31 22:29 ` David Miller
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=20060830.153259.59653494.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dev@sw.ru \
--cc=dim@openvz.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).