* Re: [PATCH v2 1/2] virtio-net: Verify page list size before fitting into skb
From: Michael S. Tsirkin @ 2011-10-03 19:04 UTC (permalink / raw)
To: Sasha Levin; +Cc: linux-kernel, Rusty Russell, virtualization, netdev, kvm
In-Reply-To: <1317220855-9352-1-git-send-email-levinsasha928@gmail.com>
On Wed, Sep 28, 2011 at 05:40:54PM +0300, Sasha Levin wrote:
> This patch verifies that the length of a buffer stored in a linked list
> of pages is small enough to fit into a skb.
>
> If the size is larger than a max size of a skb, it means that we shouldn't
> go ahead building skbs anyway since we won't be able to send the buffer as
> the user requested.
>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: netdev@vger.kernel.org
> Cc: kvm@vger.kernel.org
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
> drivers/net/virtio_net.c | 13 +++++++++++++
> 1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 0c7321c..bde0dec 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -195,6 +195,19 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
> len -= copy;
> offset += copy;
>
> + /*
> + * Verify that we can indeed put this data into a skb.
> + * This is here to handle cases when the device erroneously
> + * tries to receive more than is possible. This is usually
> + * the case of a broken device.
> + */
> + if (unlikely(len > MAX_SKB_FRAGS * PAGE_SIZE)) {
> + if (net_ratelimit())
> + pr_debug("%s: too much data\n", skb->dev->name);
> + dev_kfree_skb(skb);
> + return NULL;
> + }
> +
BTW, receive_mergeable does
pr_debug("%s: packet too long\n", skb->dev->name);
skb->dev->stats.rx_length_errors++;
which makes sense.
> while (len) {
> set_skb_frag(skb, page, offset, &len);
> page = (struct page *)page->private;
> --
> 1.7.6.1
^ permalink raw reply
* Re: [PATCH v2 2/2] virtio-net: Prevent NULL dereference
From: Michael S. Tsirkin @ 2011-10-03 19:05 UTC (permalink / raw)
To: Sasha Levin; +Cc: linux-kernel, Rusty Russell, virtualization, netdev, kvm
In-Reply-To: <1317220855-9352-2-git-send-email-levinsasha928@gmail.com>
On Wed, Sep 28, 2011 at 05:40:55PM +0300, Sasha Levin wrote:
> This patch prevents a NULL dereference when the user has passed a length
> longer than an actual buffer to virtio-net.
>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: netdev@vger.kernel.org
> Cc: kvm@vger.kernel.org
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
> drivers/net/virtio_net.c | 12 +++++++++++-
> 1 files changed, 11 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index bde0dec..4a53d2a 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -208,12 +208,22 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
> return NULL;
> }
>
> - while (len) {
> + while (len && page) {
I think if (unlikely(!page))
goto err_page;
would make the logic clearer. But see below
> set_skb_frag(skb, page, offset, &len);
> page = (struct page *)page->private;
> offset = 0;
> }
>
> + /*
> + * This is the case where we ran out of pages in our linked list, but
> + * supposedly have more data to read.
> + */
> + if (len > 0) {
> + pr_debug("%s: missing data to assemble skb\n", skb->dev->name);
> + dev_kfree_skb(skb);
> + return NULL;
> + }
> +
> if (page)
> give_pages(vi, page);
>
I thought about this some more. If length was too large host is
right now writing into pages that we have freed.
That is very bad, and I don't know what do do with it,
really not worth prettifying that IMO, NULL pointer is the least of our
worries.
But, with mergeable buffers at least, and that is the main mode anyway,
there is always a single page per buf, right?
So I think we should change the code,
and for mergeable buffers we shall only verify that
length <= PAGE_SIZE.
IOW copy a bit of code from page_to_skb(vi, page, len)
to receive_mergeable, maybe add a common function
if we need to avoid duplication.
> --
> 1.7.6.1
^ permalink raw reply
* cloning net-next tree (from git-hub ?)
From: Kevin Wilson @ 2011-10-03 19:52 UTC (permalink / raw)
To: netdev
Hi,
According to:
http://lwn.net/Articles/459795/#Comments
There are some github reps for some kernel subsystems because of the
kernel.org outage.
Though this is from 21.9.11, and it could be that since than the
problem was solved, still my question is this:
I do not see in taht link net-next (or any other net) tree.
I want to download the git tree of net-next.
what URL should I use for git clone ?
rgs,
Kevin
^ permalink raw reply
* Re: [PATCH 01/15] add Documentation/namespaces/user_namespace.txt (v3)
From: Eric W. Biederman @ 2011-10-03 19:53 UTC (permalink / raw)
To: Serge E. Hallyn
Cc: Vasiliy Kulikov, Serge Hallyn, akpm, linux-kernel, netdev,
containers, dhowells, rdunlap, kernel-hardening
In-Reply-To: <m1aa9i4zkx.fsf@fess.ebiederm.org>
ebiederm@xmission.com (Eric W. Biederman) writes:
> "Serge E. Hallyn" <serge.hallyn@canonical.com> writes:
>
>> Quoting Vasiliy Kulikov (segoon@openwall.com):
>>> On Tue, Sep 27, 2011 at 08:21 -0500, Serge E. Hallyn wrote:
>>> > > First, the patches by design expose much kernel code to unprivileged
>>> > > userspace processes. This code doesn't expect malformed data (e.g. VFS,
>>> > > specific filesystems, block layer, char drivers, sysadmin part of LSMs,
>>> > > etc. etc.). By relaxing permission rules you greatly increase attack
>>> > > surface of the kernel from unprivileged users. Are you (or somebody
>>> > > else) planning to audit this code?
>
> Well in theory this codes does expose this code to unprivileged user
> space in a way that increases the attack surface. However right now
> there are a lot of cases where because the kernel lacks a sufficient
> mechanism people are just given root provileges so that can get things
> done. Network manager controlling the network stack as an unprivileged
> user. Random filesystems on usb sticks being mounted and unmounted
> automatically when the usb sticks are inserted and removed.
>
> I completely agree that auditing and looking at the code is necessary I
> think most of what will happen is that we will start directly supporting
> how the kernel is actually used in the real world. Which should
> actually reduce our level of vulnerability, because we give up the
> delusion that large classes of operations don't need careful
> attention because only root can perform them. Operations which the
> user space authors turn around and write a suid binary for and
> unprivileged user space performs those operations all day long.
>
>>> > I had wanted to (but didn't) propose a discussion at ksummit about how
>>> > best to approach the filesystem code. That's not even just for user
>>> > namespaces - patches have been floated in the past to make mount an
>>> > unprivileged operation depending on the FS and the user's permission
>>> > over the device and target.
>>>
>>> This is a dangerous operation by itself.
>>
>> Of course it is :) And it's been a while since it has been brought up,
>> but it *was* quite well thought through and throrougly discussed - see
>> i.e. https://lkml.org/lkml/2008/1/8/131
>>
>> Oh, that's right. In the end the reason it didn't go in had to do with
>> the ability for an unprivileged user to prevent a privileged user from
>> unmounting trees by leaving a busy mount in a hidden namespace.
>>
>> Eric, in the past we didn't know what to do about that, but I wonder
>> if setns could be used in some clever way to solve it from userspace.
>
> Oh. That is a good objection. I had not realized that unprivileged
> mounts had that problem.
I just re-read the discussion you are referring to and that wasn't
it. Fuse already has something like a revoke in it's umount -f
implementation.
Eric
^ permalink raw reply
* Re: [PATCH 01/15] add Documentation/namespaces/user_namespace.txt (v3)
From: Serge E. Hallyn @ 2011-10-03 20:04 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Vasiliy Kulikov, Serge Hallyn, akpm, linux-kernel, netdev,
containers, dhowells, rdunlap, kernel-hardening
In-Reply-To: <m1zkhh3l83.fsf@fess.ebiederm.org>
Quoting Eric W. Biederman (ebiederm@xmission.com):
> ebiederm@xmission.com (Eric W. Biederman) writes:
>
> > "Serge E. Hallyn" <serge.hallyn@canonical.com> writes:
> >
> >> Quoting Vasiliy Kulikov (segoon@openwall.com):
> >>> On Tue, Sep 27, 2011 at 08:21 -0500, Serge E. Hallyn wrote:
> >>> > > First, the patches by design expose much kernel code to unprivileged
> >>> > > userspace processes. This code doesn't expect malformed data (e.g. VFS,
> >>> > > specific filesystems, block layer, char drivers, sysadmin part of LSMs,
> >>> > > etc. etc.). By relaxing permission rules you greatly increase attack
> >>> > > surface of the kernel from unprivileged users. Are you (or somebody
> >>> > > else) planning to audit this code?
> >
> > Well in theory this codes does expose this code to unprivileged user
> > space in a way that increases the attack surface. However right now
> > there are a lot of cases where because the kernel lacks a sufficient
> > mechanism people are just given root provileges so that can get things
> > done. Network manager controlling the network stack as an unprivileged
> > user. Random filesystems on usb sticks being mounted and unmounted
> > automatically when the usb sticks are inserted and removed.
> >
> > I completely agree that auditing and looking at the code is necessary I
> > think most of what will happen is that we will start directly supporting
> > how the kernel is actually used in the real world. Which should
> > actually reduce our level of vulnerability, because we give up the
> > delusion that large classes of operations don't need careful
> > attention because only root can perform them. Operations which the
> > user space authors turn around and write a suid binary for and
> > unprivileged user space performs those operations all day long.
> >
> >>> > I had wanted to (but didn't) propose a discussion at ksummit about how
> >>> > best to approach the filesystem code. That's not even just for user
> >>> > namespaces - patches have been floated in the past to make mount an
> >>> > unprivileged operation depending on the FS and the user's permission
> >>> > over the device and target.
> >>>
> >>> This is a dangerous operation by itself.
> >>
> >> Of course it is :) And it's been a while since it has been brought up,
> >> but it *was* quite well thought through and throrougly discussed - see
> >> i.e. https://lkml.org/lkml/2008/1/8/131
> >>
> >> Oh, that's right. In the end the reason it didn't go in had to do with
> >> the ability for an unprivileged user to prevent a privileged user from
> >> unmounting trees by leaving a busy mount in a hidden namespace.
> >>
> >> Eric, in the past we didn't know what to do about that, but I wonder
> >> if setns could be used in some clever way to solve it from userspace.
> >
> > Oh. That is a good objection. I had not realized that unprivileged
> > mounts had that problem.
>
> I just re-read the discussion you are referring to and that wasn't
The one I linked was one discussion, but not the final one.
https://lkml.org/lkml/2008/10/6/72 is the one where the need for
revoke is brought up.
> it. Fuse already has something like a revoke in it's umount -f
> implementation.
I'll have to (haven't yet) take a look at it.
-serge
^ permalink raw reply
* Re: cloning net-next tree (from git-hub ?)
From: Randy Dunlap @ 2011-10-03 20:20 UTC (permalink / raw)
To: Kevin Wilson; +Cc: netdev
In-Reply-To: <CAGXs5wUAa=K5SdX_JCMrWmZsLMNJDGbAL6yBJakc31Kup36jXg@mail.gmail.com>
On 10/03/11 12:52, Kevin Wilson wrote:
> Hi,
>
> According to:
> http://lwn.net/Articles/459795/#Comments
>
> There are some github reps for some kernel subsystems because of the
> kernel.org outage.
> Though this is from 21.9.11, and it could be that since than the
> problem was solved, still my question is this:
> I do not see in taht link net-next (or any other net) tree.
>
> I want to download the git tree of net-next.
>
> what URL should I use for git clone ?
https://github.com/davem330/net-next says that you can use
https://github.com/davem330/net-next.git
--
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply
* Re: [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled
From: Thadeu Lima de Souza Cascardo @ 2011-10-03 20:53 UTC (permalink / raw)
To: Yevgeny Petrilin
Cc: netdev@vger.kernel.org, Eli Cohen, eli@dev.mellanox.co.il,
Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <953B660C027164448AE903364AC447D2235DAA9D@MTLDAG02.mtl.com>
On Mon, Oct 03, 2011 at 02:56:08PM +0000, Yevgeny Petrilin wrote:
> > Hello, Yevgeny.
> >
> > We use a MT26448 (lspci -v output bellow) on a POWER7. Any other
> > information, tests or debug patches you want me to try, just tell me.
> >
> > I expected this was really not the proper fix, but thought it would be
> > better to send it than just guess. Any clues what the problem might be?
> > Perhaps, we would have to disable blue frame for this particular device?
> >
> > Regards,
> > Cascardo.
> >
> > ---
> > lspci output
> > 0006:01:00.0 Ethernet controller: Mellanox Technologies MT26448 [ConnectX EN 10GigE, PCIe 2.0 5GT/s] (rev b0)
> > ---
> > lspci -v output
> > 0006:01:00.0 0200: 15b3:6750 (rev b0)
> > Subsystem: 1014:0416
> > Flags: bus master, fast devsel, latency 0, IRQ 31
> > Memory at 3da47be00000 (64-bit, non-prefetchable) [size=1M]
> > Memory at 3da47c000000 (64-bit, prefetchable) [size=32M]
> > Expansion ROM at 3da47bf00000 [disabled] [size=1M]
> > Capabilities: [40] Power Management version 3
> > Capabilities: [48] Vital Product Data
> > Capabilities: [9c] MSI-X: Enable+ Count=128 Masked-
> > Capabilities: [60] Express Endpoint, MSI 00
> > Capabilities: [100] Alternative Routing-ID Interpretation (ARI)
> > Capabilities: [148] Device Serial Number 00-02-c9-03-00-0f-50-be
> > Kernel driver in use: mlx4_core
> > Kernel modules: mlx4_en, mlx4_core
> > ---
>
> Cascardo,
>
> Can you also send me the output of ethtool -i?
> It seems that there is a problem with write combining on Power processors, we will check this issue.
>
> Yevgeny
Hello, Yevgeny.
You will find the output of ethtool -i below.
I am copying Ben and powerpc list, in case this is an issue with Power
processors. They can provide us some more insight into this.
Thanks,
Cascardo.
---
# ethtool -i eth10
driver: mlx4_en
version: 1.5.4.1 (March 2011)
firmware-version: 2.9.4130
bus-info: 0006:01:00.0
^ permalink raw reply
* Re: [PATCH 2/2] IPVS netns shutdown/startup dead-lock (Take II)
From: Julian Anastasov @ 2011-10-03 20:55 UTC (permalink / raw)
To: Hans Schillstrom; +Cc: horms, wensong, lvs-devel, netdev, netfilter-devel, hans
In-Reply-To: <1317639399-4522-2-git-send-email-hans.schillstrom@ericsson.com>
Hello,
On Mon, 3 Oct 2011, Hans Schillstrom wrote:
> From: Hans Schillstrom <hans@schillstrom.com>
>
> ip_vs_mutext is used by both netns shutdown code and startup
> and both implicit uses sk_lock-AF_INET mutex.
>
> cleanup CPU-1 startup CPU-2
> ip_vs_dst_event() ip_vs_genl_set_cmd()
> sk_lock-AF_INET __ip_vs_mutex
> sk_lock-AF_INET
> __ip_vs_mutex
> * DEAD LOCK *
>
> A new mutex placed in ip_vs netns struct called sync_mutex is added.
>
> Comments from Julian and Simon added.
> This patch has been running for more than 3 month now and it seems to work.
May be IP_VS_SO_GET_DAEMON in do_ip_vs_get_ctl
must be protected by sync_mutex in a similar way.
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: [PATCH 2/2] IPVS netns shutdown/startup dead-lock (Take II)
From: Hans Schillstrom @ 2011-10-03 21:12 UTC (permalink / raw)
To: Julian Anastasov
Cc: Hans Schillstrom, horms, wensong, lvs-devel, netdev,
netfilter-devel
In-Reply-To: <alpine.LFD.2.00.1110032350500.1868@ja.ssi.bg>
Hi Julian
On Monday, October 03, 2011 22:55:02 Julian Anastasov wrote:
>
> Hello,
>
> On Mon, 3 Oct 2011, Hans Schillstrom wrote:
>
> > From: Hans Schillstrom <hans@schillstrom.com>
> >
> > ip_vs_mutext is used by both netns shutdown code and startup
> > and both implicit uses sk_lock-AF_INET mutex.
> >
> > cleanup CPU-1 startup CPU-2
> > ip_vs_dst_event() ip_vs_genl_set_cmd()
> > sk_lock-AF_INET __ip_vs_mutex
> > sk_lock-AF_INET
> > __ip_vs_mutex
> > * DEAD LOCK *
> >
> > A new mutex placed in ip_vs netns struct called sync_mutex is added.
> >
> > Comments from Julian and Simon added.
> > This patch has been running for more than 3 month now and it seems to work.
>
> May be IP_VS_SO_GET_DAEMON in do_ip_vs_get_ctl
> must be protected by sync_mutex in a similar way.
>
That's right there is a small risk inconsistent data there...
I will send a new patch tomorrow.
Thanks
Hans
^ permalink raw reply
* Re: [PATCH] SELinux: Fix RCU deref check warning in sel_netport_insert()
From: Paul Moore @ 2011-10-03 21:30 UTC (permalink / raw)
To: David Howells; +Cc: selinux, netdev
In-Reply-To: <20111003135824.15303.10147.stgit@warthog.procyon.org.uk>
On Monday, October 03, 2011 02:58:24 PM David Howells wrote:
> Fix the following bug in sel_netport_insert() where rcu_dereference() should
> be rcu_dereference_protected() as sel_netport_lock is held.
>
> ===================================================
> [ INFO: suspicious rcu_dereference_check() usage. ]
> ---------------------------------------------------
> security/selinux/netport.c:127 invoked rcu_dereference_check() without
> protection!
>
> other info that might help us debug this:
>
>
> rcu_scheduler_active = 1, debug_locks = 0
> 1 lock held by ossec-rootcheck/3323:
> #0: (sel_netport_lock){+.....}, at: [<ffffffff8117d775>]
> sel_netport_sid+0xbb/0x226
>
> stack backtrace:
> Pid: 3323, comm: ossec-rootcheck Not tainted 3.1.0-rc8-fsdevel+ #1095
> Call Trace:
> [<ffffffff8105cfb7>] lockdep_rcu_dereference+0xa7/0xb0
> [<ffffffff8117d871>] sel_netport_sid+0x1b7/0x226
> [<ffffffff8117d6ba>] ? sel_netport_avc_callback+0xbc/0xbc
> [<ffffffff8117556c>] selinux_socket_bind+0x115/0x230
> [<ffffffff810a5388>] ? might_fault+0x4e/0x9e
> [<ffffffff810a53d1>] ? might_fault+0x97/0x9e
> [<ffffffff81171cf4>] security_socket_bind+0x11/0x13
> [<ffffffff812ba967>] sys_bind+0x56/0x95
> [<ffffffff81380dac>] ? sysret_check+0x27/0x62
> [<ffffffff8105b767>] ? trace_hardirqs_on_caller+0x11e/0x155
> [<ffffffff81076fcd>] ? audit_syscall_entry+0x17b/0x1ae
> [<ffffffff811b5eae>] ? trace_hardirqs_on_thunk+0x3a/0x3f
> [<ffffffff81380d7b>] system_call_fastpath+0x16/0x1b
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
>
> security/selinux/netport.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
We should probably do the same for the security/selinux/netif.c as it uses the
same logic; David is this something you want to tackle?
Acked-by: Paul Moore <paul@paul-moore.com>
> diff --git a/security/selinux/netport.c b/security/selinux/netport.c
> index 0b62bd1..39e2138 100644
> --- a/security/selinux/netport.c
> +++ b/security/selinux/netport.c
> @@ -123,7 +123,9 @@ static void sel_netport_insert(struct sel_netport *port)
> if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) {
> struct sel_netport *tail;
> tail = list_entry(
> - rcu_dereference(sel_netport_hash[idx].list.prev),
> + rcu_dereference_protected(
> + sel_netport_hash[idx].list.prev,
> + spin_is_locked(&sel_netport_lock)),
> struct sel_netport, list);
> list_del_rcu(&tail->list);
> kfree_rcu(tail, rcu);
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
paul moore
www.paul-moore.com
^ permalink raw reply
* Re: [PATCH] SELinux: Fix RCU deref check warning in sel_netport_insert()
From: David Howells @ 2011-10-03 23:07 UTC (permalink / raw)
To: Paul Moore
Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA, selinux-+05T5uksL2qpZYMLLGbcSA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <2230709.7n5noARWFd@sifl>
Paul Moore <paul-r2n+y4ga6xFZroRs9YW3xA@public.gmane.org> wrote:
> We should probably do the same for the security/selinux/netif.c as it uses
> the same logic; David is this something you want to tackle?
I can have a look, but it won't be before Wednesday.
David
^ permalink raw reply
* Re: [PATCH] virtio-net: Read MAC only after initializing MSI-X
From: Rusty Russell @ 2011-10-03 23:51 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Sasha Levin, linux-kernel, virtualization, netdev, kvm,
David Gibson
In-Reply-To: <20111002090900.GA29706@redhat.com>
On Sun, 2 Oct 2011 11:09:00 +0200, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Mon, Sep 19, 2011 at 05:19:49PM +0930, Rusty Russell wrote:
> > On Mon, 19 Sep 2011 09:01:50 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > On Mon, Sep 19, 2011 at 01:05:17PM +0930, Rusty Russell wrote:
> > > > On Sat, 20 Aug 2011 23:00:44 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > > > On Fri, Aug 19, 2011 at 07:33:07PM +0300, Sasha Levin wrote:
> > > > > > Maybe this is better solved by copying the way it was done in PCI itself
> > > > > > with capability linked list?
> > > > >
> > > > > There are any number of ways to lay out the structure. I went for what
> > > > > seemed a simplest one. For MSI-X the train has left the station. We
> > > > > can probably still tweak where the high 32 bit features
> > > > > for 64 bit features are. No idea if it's worth it.
> > > >
> > > > Sorry, this has been in the back of my mind. I think it's a good idea;
> > > > can we use the capability linked list for pre-device specific stuff from
> > > > now on?
> > > >
> > > > Thanks,
> > > > Rusty.
> > >
> > > Do we even want capability bits then?
> > > We can give each capability an ack flag ...
> >
> > We could have, and if I'd known PCI when I designed virtio I might have.
> >
> > But it's not easy now to map structure offsets to that scheme, and we
> > can't really force such a change on the non-PCI users. So I'd say we
> > should only do it for the non-device-specific options. ie. we'll still
> > have the MSI-X case move the device-specific config, but we'll use a
> > linked list from now on, eg. for the next 32 features bits...
> >
> > Thoughts?
> > Rusty.
>
> So I thought about this some more. It probably makes sense to
> stop adding info in the io space, and start adding new stuff in
> memory space which is much less contrained.
>
> As we need to keep compatibility, and also because memory access is
> much slower with kvm so we prefer io for datapath, we could have the
> first X bytes still mirrored in io space.
>
> MSIX is there, and it's pointed to from config space,
> so we could just put our stuff at offset 0.
>
> Or if we wanted a lot of flexibility, we could add pointers, in config
> space, to device specific and non device specific regions in memory
> space.
>
> Makes sense?
I've cc'd David Gibson who has noted in the past that I/O space on PPC
is icky.
I think a linked list for future virtio-pci extensions makes sense (not
device-specific stuff, that's great as a simple structure). I think
mirroring everything in mem space makes sense, too.
Thanks,
Rusty.
^ permalink raw reply
* Re: [PATCH] SELinux: Fix RCU deref check warning in sel_netport_insert()
From: Paul Moore @ 2011-10-04 0:06 UTC (permalink / raw)
To: David Howells; +Cc: selinux, netdev
In-Reply-To: <25906.1317683262@redhat.com>
On Tuesday, October 4, 2011 12:07:42 AM David Howells wrote:
> Paul Moore <paul@paul-moore.com> wrote:
> > We should probably do the same for the security/selinux/netif.c as it
> > uses the same logic; David is this something you want to tackle?
>
> I can have a look, but it won't be before Wednesday.
Not a problem, if you don't get to it just let me know and I'll put together a
patch.
Thanks.
--
paul moore
www.paul-moore.com
^ permalink raw reply
* Re: [PATCH v4 1/8] Basic kernel memory functionality for the Memory Controller
From: KAMEZAWA Hiroyuki @ 2011-10-04 0:38 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, ebiederm, davem, gthelen, netdev,
linux-mm, kirill, avagin
In-Reply-To: <1317637123-18306-2-git-send-email-glommer@parallels.com>
On Mon, 3 Oct 2011 14:18:36 +0400
Glauber Costa <glommer@parallels.com> wrote:
> This patch lays down the foundation for the kernel memory component
> of the Memory Controller.
>
> As of today, I am only laying down the following files:
>
> * memory.independent_kmem_limit
> * memory.kmem.limit_in_bytes (currently ignored)
> * memory.kmem.usage_in_bytes (always zero)
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> CC: Paul Menage <paul@paulmenage.org>
> CC: Greg Thelen <gthelen@google.com>
> ---
> Documentation/cgroups/memory.txt | 30 +++++++++++-
> init/Kconfig | 11 ++++
> mm/memcontrol.c | 94 +++++++++++++++++++++++++++++++++++---
> 3 files changed, 126 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
> index 6f3c598..6f1954a 100644
> --- a/Documentation/cgroups/memory.txt
> +++ b/Documentation/cgroups/memory.txt
> @@ -44,8 +44,9 @@ Features:
> - oom-killer disable knob and oom-notifier
> - Root cgroup has no limit controls.
>
> - Kernel memory and Hugepages are not under control yet. We just manage
> - pages on LRU. To add more controls, we have to take care of performance.
> + Hugepages is not under control yet. We just manage pages on LRU. To add more
> + controls, we have to take care of performance. Kernel memory support is work
> + in progress, and the current version provides basically functionality.
>
> Brief summary of control files.
>
> @@ -56,8 +57,11 @@ Brief summary of control files.
> (See 5.5 for details)
> memory.memsw.usage_in_bytes # show current res_counter usage for memory+Swap
> (See 5.5 for details)
> + memory.kmem.usage_in_bytes # show current res_counter usage for kmem only.
> + (See 2.7 for details)
> memory.limit_in_bytes # set/show limit of memory usage
> memory.memsw.limit_in_bytes # set/show limit of memory+Swap usage
> + memory.kmem.limit_in_bytes # if allowed, set/show limit of kernel memory
> memory.failcnt # show the number of memory usage hits limits
> memory.memsw.failcnt # show the number of memory+Swap hits limits
> memory.max_usage_in_bytes # show max memory usage recorded
> @@ -72,6 +76,9 @@ Brief summary of control files.
> memory.oom_control # set/show oom controls.
> memory.numa_stat # show the number of memory usage per numa node
>
> + memory.independent_kmem_limit # select whether or not kernel memory limits are
> + independent of user limits
> +
> 1. History
>
> The memory controller has a long history. A request for comments for the memory
> @@ -255,6 +262,25 @@ When oom event notifier is registered, event will be delivered.
> per-zone-per-cgroup LRU (cgroup's private LRU) is just guarded by
> zone->lru_lock, it has no lock of its own.
>
> +2.7 Kernel Memory Extension (CONFIG_CGROUP_MEM_RES_CTLR_KMEM)
> +
> + With the Kernel memory extension, the Memory Controller is able to limit
> +the amount of kernel memory used by the system. Kernel memory is fundamentally
> +different than user memory, since it can't be swapped out, which makes it
> +possible to DoS the system by consuming too much of this precious resource.
> +Kernel memory limits are not imposed for the root cgroup.
> +
> +Memory limits as specified by the standard Memory Controller may or may not
> +take kernel memory into consideration. This is achieved through the file
> +memory.independent_kmem_limit. A Value different than 0 will allow for kernel
> +memory to be controlled separately.
> +
> +When kernel memory limits are not independent, the limit values set in
> +memory.kmem files are ignored.
> +
> +Currently no soft limit is implemented for kernel memory. It is future work
> +to trigger slab reclaim when those limits are reached.
> +
Please add some CAUTION like
==
"CAUTION: the kmem extetion prevents tasks from moving among cgroups.
If a task has kmem accounting in a cgroup, the task cannot be moved
until the kmem resource is released. And more, until the resource is
fully released, the cgroup cannot be destroyed. So, please consider
your use cases and set kmem extention config carefully".
==
And add some memo to KCONFIG. This should be warned.
> +config CGROUP_MEM_RES_CTLR_KMEM
> + bool "Memory Resource Controller Kernel Memory accounting (EXPERIMENTAL)"
> + depends on CGROUP_MEM_RES_CTLR && EXPERIMENTAL
> + default y
default must be n until you fixes the bug.
Thanks,
-Kame
^ permalink raw reply
* Re: [PATCH v4 2/8] socket: initial cgroup code.
From: KAMEZAWA Hiroyuki @ 2011-10-04 0:41 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, ebiederm, davem, gthelen, netdev,
linux-mm, kirill, avagin
In-Reply-To: <1317637123-18306-3-git-send-email-glommer@parallels.com>
On Mon, 3 Oct 2011 14:18:37 +0400
Glauber Costa <glommer@parallels.com> wrote:
> We aim to control the amount of kernel memory pinned at any
> time by tcp sockets. To lay the foundations for this work,
> this patch adds a pointer to the kmem_cgroup to the socket
> structure.
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
> CC: Eric W. Biederman <ebiederm@xmission.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtsu.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH v4 3/8] foundations of per-cgroup memory pressure controlling.
From: KAMEZAWA Hiroyuki @ 2011-10-04 0:57 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, ebiederm, davem, gthelen, netdev,
linux-mm, kirill, avagin
In-Reply-To: <1317637123-18306-4-git-send-email-glommer@parallels.com>
On Mon, 3 Oct 2011 14:18:38 +0400
Glauber Costa <glommer@parallels.com> wrote:
> This patch converts struct sock fields memory_pressure,
> memory_allocated, sockets_allocated, and sysctl_mem (now prot_mem)
> to function pointers, receiving a struct mem_cgroup parameter.
>
> enter_memory_pressure is kept the same, since all its callers
> have socket a context, and the kmem_cgroup can be derived from
> the socket itself.
>
> To keep things working, the patch convert all users of those fields
> to use acessor functions.
>
> In my benchmarks I didn't see a significant performance difference
> with this patch applied compared to a baseline (around 1 % diff, thus
> inside error margin).
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
> CC: Eric W. Biederman <ebiederm@xmission.com>
A nitpick.
> #ifdef CONFIG_INET
> struct sock;
> +struct proto;
> #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
> void sock_update_memcg(struct sock *sk);
> void sock_release_memcg(struct sock *sk);
> -
> +void memcg_sock_mem_alloc(struct mem_cgroup *mem, struct proto *prot,
> + int amt, int *parent_failure);
> +void memcg_sock_mem_free(struct mem_cgroup *mem, struct proto *prot, int amt);
> +void memcg_sockets_allocated_dec(struct mem_cgroup *mem, struct proto *prot);
> +void memcg_sockets_allocated_inc(struct mem_cgroup *mem, struct proto *prot);
> #else
> +/* memcontrol includes sockets.h, that includes memcontrol.h ... */
> +static inline void memcg_sock_mem_alloc(struct mem_cgroup *mem,
> + struct proto *prot, int amt,
> + int *parent_failure)
> +{
> +}
In these days, at naming memory cgroup pointers, we use "memcg" instead of
"mem". So, could you use "memcg" for represeinting memory cgroup ?
> +
> +void memcg_sock_mem_alloc(struct mem_cgroup *mem, struct proto *prot,
> + int amt, int *parent_failure)
> +{
> + mem = parent_mem_cgroup(mem);
> + for (; mem != NULL; mem = parent_mem_cgroup(mem)) {
> + long alloc;
> + long *prot_mem = prot->prot_mem(mem);
> + /*
> + * Large nestings are not the common case, and stopping in the
> + * middle would be complicated enough, that we bill it all the
> + * way through the root, and if needed, unbill everything later
> + */
> + alloc = atomic_long_add_return(amt,
> + prot->memory_allocated(mem));
> + *parent_failure |= (alloc > prot_mem[2]);
> + }
> +}
> +EXPORT_SYMBOL(memcg_sock_mem_alloc);
Hmm. why not using res_counter ? for reusing 'unbill' code ?
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH v4 4/8] per-cgroup tcp buffers control
From: KAMEZAWA Hiroyuki @ 2011-10-04 1:16 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, ebiederm, davem, gthelen, netdev,
linux-mm, kirill, avagin
In-Reply-To: <1317637123-18306-5-git-send-email-glommer@parallels.com>
On Mon, 3 Oct 2011 14:18:39 +0400
Glauber Costa <glommer@parallels.com> wrote:
> With all the infrastructure in place, this patch implements
> per-cgroup control for tcp memory pressure handling.
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
> CC: Eric W. Biederman <ebiederm@xmission.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtisu.com>
One question.
> +void tcp_enter_memory_pressure(struct sock *sk)
> +{
> + struct mem_cgroup *memcg = sk->sk_cgrp;
> + if (!memcg->tcp.tcp_memory_pressure) {
> + NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMEMORYPRESSURES);
> + memcg->tcp.tcp_memory_pressure = 1;
> + }
> +}
It seems memcg->tcp.tcp_memory_pressure has no locks and not atomic.
no problematic race ?
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH v4 5/8] per-netns ipv4 sysctl_tcp_mem
From: KAMEZAWA Hiroyuki @ 2011-10-04 1:18 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, ebiederm, davem, gthelen, netdev,
linux-mm, kirill, avagin
In-Reply-To: <1317637123-18306-6-git-send-email-glommer@parallels.com>
On Mon, 3 Oct 2011 14:18:40 +0400
Glauber Costa <glommer@parallels.com> wrote:
> This patch allows each namespace to independently set up
> its levels for tcp memory pressure thresholds. This patch
> alone does not buy much: we need to make this values
> per group of process somehow. This is achieved in the
> patches that follows in this patchset.
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
> CC: Eric W. Biederman <ebiederm@xmission.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
^ permalink raw reply
* Re: [PATCH v4 6/8] tcp buffer limitation: per-cgroup limit
From: KAMEZAWA Hiroyuki @ 2011-10-04 1:21 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, ebiederm, davem, gthelen, netdev,
linux-mm, kirill, avagin
In-Reply-To: <1317637123-18306-7-git-send-email-glommer@parallels.com>
On Mon, 3 Oct 2011 14:18:41 +0400
Glauber Costa <glommer@parallels.com> wrote:
> This patch uses the "tcp_max_mem" field of the kmem_cgroup to
> effectively control the amount of kernel memory pinned by a cgroup.
>
> We have to make sure that none of the memory pressure thresholds
> specified in the namespace are bigger than the current cgroup.
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
> CC: Eric W. Biederman <ebiederm@xmission.com>
> ---
> Documentation/cgroups/memory.txt | 1 +
> include/linux/memcontrol.h | 10 +++++
> include/net/tcp.h | 1 +
> mm/memcontrol.c | 76 +++++++++++++++++++++++++++++++++++---
> net/ipv4/sysctl_net_ipv4.c | 20 ++++++++++
> 5 files changed, 102 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
> index 6f1954a..1ffde3e 100644
> --- a/Documentation/cgroups/memory.txt
> +++ b/Documentation/cgroups/memory.txt
> @@ -78,6 +78,7 @@ Brief summary of control files.
>
> memory.independent_kmem_limit # select whether or not kernel memory limits are
> independent of user limits
> + memory.kmem.tcp.max_memory # set/show hard limit for tcp buf memory
>
What is the releationship between tcp.max_memory and kmem_limit ?
tcp.max_memory < kmem_limit ?
usage of tcp memory is included in kmem usage ?
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH 2/2] bridge: allow forwarding some link local frames
From: Stephen Hemminger @ 2011-10-04 4:14 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
In-Reply-To: <20111004041444.793960297@vyatta.com>
[-- Attachment #1: bridge-multicast-filter.patch --]
[-- Type: text/plain, Size: 5475 bytes --]
This is based on an earlier patch by Nick Carter with comments
by David Lamparter but with some refinements. Thanks for their patience
this is a confusing area with overlap of standards, user requirements,
and compatibility with earlier releases.
It adds a new sysfs attribute
/sys/class/net/brX/bridge/group_fwd_mask
that controls forwarding of frames with address of: 01-80-C2-00-00-0X
The default setting has no forwarding to retain compatibility.
One change from earlier releases is that forwarding of group
addresses is not dependent on STP being enabled or disabled. This
choice was made based on interpretation of tie 802.1 standards.
I expect complaints will arise because of this, but better to follow
the standard than continue acting incorrectly by default.
The filtering mask is writeable, but only values that don't forward
known control frames are allowed. It intentionally blocks attempts
to filter control protocols. For example: writing a 8 allows
forwarding 802.1X PAE addresses which is the most common request.
Reported-by: David Lamparter <equinox@diac24.net>
Original-patch-by: Nick Carter <ncarter100@gmail.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
net/bridge/br_device.c | 2 ++
net/bridge/br_input.c | 12 ++++++------
net/bridge/br_private.h | 11 +++++++++++
net/bridge/br_sysfs_br.c | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 53 insertions(+), 6 deletions(-)
--- a/net/bridge/br_device.c 2011-10-03 11:08:42.648254251 -0700
+++ b/net/bridge/br_device.c 2011-10-03 11:08:43.932271613 -0700
@@ -358,6 +358,8 @@ void br_dev_setup(struct net_device *dev
memcpy(br->group_addr, br_group_address, ETH_ALEN);
br->stp_enabled = BR_NO_STP;
+ br->group_fwd_mask = BR_GROUPFWD_DEFAULT;
+
br->designated_root = br->bridge_id;
br->bridge_max_age = br->max_age = 20 * HZ;
br->bridge_hello_time = br->hello_time = 2 * HZ;
--- a/net/bridge/br_input.c 2011-10-03 11:08:32.944122866 -0700
+++ b/net/bridge/br_input.c 2011-10-03 11:18:31.063811030 -0700
@@ -162,14 +162,37 @@ rx_handler_result_t br_handle_frame(stru
p = br_port_get_rcu(skb->dev);
if (unlikely(is_link_local(dest))) {
- /* Pause frames shouldn't be passed up by driver anyway */
- if (skb->protocol == htons(ETH_P_PAUSE))
+ /*
+ * See IEEE 802.1D Table 7-10 Reserved addresses
+ *
+ * Assignment Value
+ * Bridge Group Address 01-80-C2-00-00-00
+ * (MAC Control) 802.3 01-80-C2-00-00-01
+ * (Link Aggregation) 802.3 01-80-C2-00-00-02
+ * 802.1X PAE address 01-80-C2-00-00-03
+ *
+ * 802.1AB LLDP 01-80-C2-00-00-0E
+ *
+ * Others reserved for future standardization
+ */
+ switch (dest[5]) {
+ case 0x00: /* Bridge Group Address */
+ /* If STP is turned off,
+ then must forward to keep loop detection */
+ if (p->br->stp_enabled == BR_NO_STP)
+ goto forward;
+ break;
+
+ case 0x01: /* IEEE MAC (Pause) */
goto drop;
- /* If STP is turned off, then forward */
- if (p->br->stp_enabled == BR_NO_STP && dest[5] == 0)
- goto forward;
+ default:
+ /* Allow selective forwarding for most other protocols */
+ if (p->br->group_fwd_mask & (1u << dest[5]))
+ goto forward;
+ }
+ /* Deliver packet to local host only */
if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
NULL, br_handle_local_finish)) {
return RX_HANDLER_CONSUMED; /* consumed by filter */
--- a/net/bridge/br_private.h 2011-10-03 11:08:32.888122106 -0700
+++ b/net/bridge/br_private.h 2011-10-03 11:18:22.967713859 -0700
@@ -29,6 +29,11 @@
#define BR_VERSION "2.3"
+/* Control of forwarding link local multicast */
+#define BR_GROUPFWD_DEFAULT 0
+/* Don't allow forwarding control protocols like STP and LLDP */
+#define BR_GROUPFWD_RESTRICTED 0x4007u
+
/* Path to usermode spanning tree program */
#define BR_STP_PROG "/sbin/bridge-stp"
@@ -193,6 +198,8 @@ struct net_bridge
unsigned long flags;
#define BR_SET_MAC_ADDR 0x00000001
+ u16 group_fwd_mask;
+
/* STP */
bridge_id designated_root;
bridge_id bridge_id;
--- a/net/bridge/br_sysfs_br.c 2011-10-03 11:08:32.920122541 -0700
+++ b/net/bridge/br_sysfs_br.c 2011-10-03 11:08:43.932271613 -0700
@@ -149,6 +149,39 @@ static ssize_t store_stp_state(struct de
static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
store_stp_state);
+static ssize_t show_group_fwd_mask(struct device *d,
+ struct device_attribute *attr, char *buf)
+{
+ struct net_bridge *br = to_bridge(d);
+ return sprintf(buf, "%#x\n", br->group_fwd_mask);
+}
+
+
+static ssize_t store_group_fwd_mask(struct device *d,
+ struct device_attribute *attr, const char *buf,
+ size_t len)
+{
+ struct net_bridge *br = to_bridge(d);
+ char *endp;
+ unsigned long val;
+
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+
+ val = simple_strtoul(buf, &endp, 0);
+ if (endp == buf)
+ return -EINVAL;
+
+ if (val & BR_GROUPFWD_RESTRICTED)
+ return -EINVAL;
+
+ br->group_fwd_mask = val;
+
+ return len;
+}
+static DEVICE_ATTR(group_fwd_mask, S_IRUGO | S_IWUSR, show_group_fwd_mask,
+ store_group_fwd_mask);
+
static ssize_t show_priority(struct device *d, struct device_attribute *attr,
char *buf)
{
@@ -652,6 +685,7 @@ static struct attribute *bridge_attrs[]
&dev_attr_max_age.attr,
&dev_attr_ageing_time.attr,
&dev_attr_stp_state.attr,
+ &dev_attr_group_fwd_mask.attr,
&dev_attr_priority.attr,
&dev_attr_bridge_id.attr,
&dev_attr_root_id.attr,
^ permalink raw reply
* [PATCH 1/2] bridge: leave carrier on for empty bridge
From: Stephen Hemminger @ 2011-10-04 4:14 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
In-Reply-To: <20111004041444.793960297@vyatta.com>
[-- Attachment #1: br-carrier-default.patch --]
[-- Type: text/plain, Size: 1058 bytes --]
This resolves a regression seen by some users of bridging.
Some users use the bridge like a dummy device.
They expect to be able to put an IPv6 address on the device
with no ports attached. Although there are better ways of doing
this, there is no reason to not allow it.
Note: the bridge still will reflect the state of ports in the
bridge if there are any added.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
This fix needs to go to stable as well since it has
been reported as a regression.
--- a/net/bridge/br_device.c 2011-09-01 08:52:27.596631192 -0700
+++ b/net/bridge/br_device.c 2011-09-01 09:01:03.256611801 -0700
@@ -91,7 +91,6 @@ static int br_dev_open(struct net_device
{
struct net_bridge *br = netdev_priv(dev);
- netif_carrier_off(dev);
netdev_update_features(dev);
netif_start_queue(dev);
br_stp_enable_bridge(br);
@@ -108,8 +107,6 @@ static int br_dev_stop(struct net_device
{
struct net_bridge *br = netdev_priv(dev);
- netif_carrier_off(dev);
-
br_stp_disable_bridge(br);
br_multicast_stop(br);
^ permalink raw reply
* Re: [PATCH] SELinux: Fix RCU deref check warning in sel_netport_insert()
From: Eric Dumazet @ 2011-10-04 4:22 UTC (permalink / raw)
To: Paul Moore; +Cc: David Howells, selinux, netdev
In-Reply-To: <2230709.7n5noARWFd@sifl>
Le lundi 03 octobre 2011 à 17:30 -0400, Paul Moore a écrit :
> On Monday, October 03, 2011 02:58:24 PM David Howells wrote:
> > Fix the following bug in sel_netport_insert() where rcu_dereference() should
> > be rcu_dereference_protected() as sel_netport_lock is held.
> >
> > ===================================================
> > [ INFO: suspicious rcu_dereference_check() usage. ]
> > ---------------------------------------------------
> > security/selinux/netport.c:127 invoked rcu_dereference_check() without
> > protection!
> >
> > other info that might help us debug this:
> >
> >
> > rcu_scheduler_active = 1, debug_locks = 0
> > 1 lock held by ossec-rootcheck/3323:
> > #0: (sel_netport_lock){+.....}, at: [<ffffffff8117d775>]
> > sel_netport_sid+0xbb/0x226
> >
> > stack backtrace:
> > Pid: 3323, comm: ossec-rootcheck Not tainted 3.1.0-rc8-fsdevel+ #1095
> > Call Trace:
> > [<ffffffff8105cfb7>] lockdep_rcu_dereference+0xa7/0xb0
> > [<ffffffff8117d871>] sel_netport_sid+0x1b7/0x226
> > [<ffffffff8117d6ba>] ? sel_netport_avc_callback+0xbc/0xbc
> > [<ffffffff8117556c>] selinux_socket_bind+0x115/0x230
> > [<ffffffff810a5388>] ? might_fault+0x4e/0x9e
> > [<ffffffff810a53d1>] ? might_fault+0x97/0x9e
> > [<ffffffff81171cf4>] security_socket_bind+0x11/0x13
> > [<ffffffff812ba967>] sys_bind+0x56/0x95
> > [<ffffffff81380dac>] ? sysret_check+0x27/0x62
> > [<ffffffff8105b767>] ? trace_hardirqs_on_caller+0x11e/0x155
> > [<ffffffff81076fcd>] ? audit_syscall_entry+0x17b/0x1ae
> > [<ffffffff811b5eae>] ? trace_hardirqs_on_thunk+0x3a/0x3f
> > [<ffffffff81380d7b>] system_call_fastpath+0x16/0x1b
> >
> > Signed-off-by: David Howells <dhowells@redhat.com>
> > ---
> >
> > security/selinux/netport.c | 4 +++-
> > 1 files changed, 3 insertions(+), 1 deletions(-)
>
> We should probably do the same for the security/selinux/netif.c as it uses the
> same logic; David is this something you want to tackle?
>
> Acked-by: Paul Moore <paul@paul-moore.com>
>
> > diff --git a/security/selinux/netport.c b/security/selinux/netport.c
> > index 0b62bd1..39e2138 100644
> > --- a/security/selinux/netport.c
> > +++ b/security/selinux/netport.c
> > @@ -123,7 +123,9 @@ static void sel_netport_insert(struct sel_netport *port)
> > if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) {
> > struct sel_netport *tail;
> > tail = list_entry(
> > - rcu_dereference(sel_netport_hash[idx].list.prev),
> > + rcu_dereference_protected(
> > + sel_netport_hash[idx].list.prev,
> > + spin_is_locked(&sel_netport_lock)),
Usual way is to use :
rcu_dereference_protected(
sel_netport_hash[idx].list.prev,
lockdep_is_held(&sel_netport_lock)),
^ permalink raw reply
* Re: [PATCH v4 4/8] per-cgroup tcp buffers control
From: Glauber Costa @ 2011-10-04 5:43 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-kernel, paul, lizf, ebiederm, davem, gthelen, netdev,
linux-mm, kirill, avagin
In-Reply-To: <20111004101633.6b44201d.kamezawa.hiroyu@jp.fujitsu.com>
On 10/04/2011 05:16 AM, KAMEZAWA Hiroyuki wrote:
> It seems memcg->tcp.tcp_memory_pressure has no locks and not atomic.
>
> no problematic race ?
>
> Thanks,
> -Kame
Well,
prior to this patch, it was a global variable. And nobody complained so
far...
My impression is that the only thing that really needs to be atomic is
the memory accounting, which is already. If we miss a memory pressure
condition entry, we'll get to it next time.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH net-next] ipv6: remove a rcu_read_lock in ndisc_constructor
From: rongqing.li @ 2011-10-04 5:43 UTC (permalink / raw)
To: netdev
From: Roy.Li <rongqing.li@windriver.com>
in6_dev_get(dev) takes a reference on struct inet6_dev, we dont need
rcu locking in ndisc_constructor()
Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
net/ipv6/ndisc.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 9da6e02..dd633ff 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -370,17 +370,14 @@ static int ndisc_constructor(struct neighbour *neigh)
struct neigh_parms *parms;
int is_multicast = ipv6_addr_is_multicast(addr);
- rcu_read_lock();
in6_dev = in6_dev_get(dev);
if (in6_dev == NULL) {
- rcu_read_unlock();
return -EINVAL;
}
parms = in6_dev->nd_parms;
__neigh_parms_put(neigh->parms);
neigh->parms = neigh_parms_clone(parms);
- rcu_read_unlock();
neigh->type = is_multicast ? RTN_MULTICAST : RTN_UNICAST;
if (!dev->header_ops) {
--
1.7.1
^ permalink raw reply related
* Re: [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled
From: Benjamin Herrenschmidt @ 2011-10-04 6:02 UTC (permalink / raw)
To: Thadeu Lima de Souza Cascardo
Cc: Yevgeny Petrilin, netdev@vger.kernel.org, Eli Cohen,
eli@dev.mellanox.co.il, linuxppc-dev
In-Reply-To: <20111003205358.GB3596@oc1711230544.ibm.com>
On Mon, 2011-10-03 at 17:53 -0300, Thadeu Lima de Souza Cascardo wrote:
.../...
> > Can you also send me the output of ethtool -i?
> > It seems that there is a problem with write combining on Power processors, we will check this issue.
> >
> > Yevgeny
>
> Hello, Yevgeny.
>
> You will find the output of ethtool -i below.
>
> I am copying Ben and powerpc list, in case this is an issue with Power
> processors. They can provide us some more insight into this.
May I get some background please ? :-)
I'm not aware of a specific issue with write combining but I'd need to
know more about what you are doing and the code to do it to comment on
whether it should work or not.
Cheers,
Ben.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox