Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-23 Thread Thomas Haller
On Thu, 2015-10-22 at 20:56 +0200, Thomas Graf wrote: > On 10/22/15 at 07:21pm, Hannes Frederic Sowa wrote: > > Hi Thomas, > > > > On Thu, Oct 22, 2015, at 18:45, Thomas Graf wrote: > > > I understand the race but when does it occur? Whoever creates > > > the original interface owns it and is

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-22 Thread Hannes Frederic Sowa
Hi Thomas, On Thu, Oct 22, 2015, at 18:45, Thomas Graf wrote: > On 10/22/15 at 05:00pm, Jiri Benc wrote: > > On Thu, 22 Oct 2015 16:52:13 +0200, Nicolas Dichtel wrote: > > > With the proposed scenario: > > > 1. create netns 'new_netns' > > > 2. in root netns, move the interface with ifindex 2 to

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-22 Thread Thomas Graf
On 10/22/15 at 07:21pm, Hannes Frederic Sowa wrote: > Hi Thomas, > > On Thu, Oct 22, 2015, at 18:45, Thomas Graf wrote: > > I understand the race but when does it occur? Whoever creates > > the original interface owns it and is responsible for its > > lifecycle. *Iff* for some reason multiple

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-22 Thread Jiri Benc
On Thu, 22 Oct 2015 16:52:13 +0200, Nicolas Dichtel wrote: > With the proposed scenario: > 1. create netns 'new_netns' > 2. in root netns, move the interface with ifindex 2 to new_netns > 3. in new_netns, delete the interface with ifindex 2 > 4. in new_netns, create an interface - it will get

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-22 Thread Nicolas Dichtel
Le 21/10/2015 19:12, Hannes Frederic Sowa a écrit : Hello, On Wed, Oct 21, 2015, at 17:56, David Miller wrote: From: Jiri Benc Date: Wed, 21 Oct 2015 17:25:02 +0200 On Wed, 21 Oct 2015 08:32:14 -0700 (PDT), David Miller wrote: As you say the apps are broken, so file a bug

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-22 Thread Thomas Haller
On Thu, 2015-10-22 at 16:52 +0200, Nicolas Dichtel wrote: > Le 21/10/2015 19:12, Hannes Frederic Sowa a écrit : > > Hello, > > > > On Wed, Oct 21, 2015, at 17:56, David Miller wrote: > > > From: Jiri Benc > > > Date: Wed, 21 Oct 2015 17:25:02 +0200 > > > > > > > On Wed, 21 Oct

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-22 Thread Nicolas Dichtel
Le 22/10/2015 17:00, Jiri Benc a écrit : On Thu, 22 Oct 2015 16:52:13 +0200, Nicolas Dichtel wrote: With the proposed scenario: 1. create netns 'new_netns' 2. in root netns, move the interface with ifindex 2 to new_netns 3. in new_netns, delete the interface with ifindex 2 4. in new_netns,

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-22 Thread Hannes Frederic Sowa
Hello, On Thu, Oct 22, 2015, at 17:00, Jiri Benc wrote: > On Thu, 22 Oct 2015 16:52:13 +0200, Nicolas Dichtel wrote: > > With the proposed scenario: > > 1. create netns 'new_netns' > > 2. in root netns, move the interface with ifindex 2 to new_netns > > 3. in new_netns, delete the interface with

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-22 Thread Thomas Haller
On Thu, 2015-10-22 at 17:00 +0200, Jiri Benc wrote: > On Thu, 22 Oct 2015 16:52:13 +0200, Nicolas Dichtel wrote: > > With the proposed scenario: > > 1. create netns 'new_netns' > > 2. in root netns, move the interface with ifindex 2 to new_netns > > 3. in new_netns, delete the interface with

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-22 Thread Thomas Graf
On 10/22/15 at 05:00pm, Jiri Benc wrote: > On Thu, 22 Oct 2015 16:52:13 +0200, Nicolas Dichtel wrote: > > With the proposed scenario: > > 1. create netns 'new_netns' > > 2. in root netns, move the interface with ifindex 2 to new_netns > > 3. in new_netns, delete the interface with ifindex 2 > > 4.

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-21 Thread David Miller
From: Jiri Benc Date: Wed, 21 Oct 2015 16:46:13 +0200 > For example, we could always alloc a new ifindex when moving interfaces > between name spaces. That would be probably the tiniest race window we > could get to (still not zero!) but I guess it would break apps that >

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-21 Thread Jiri Benc
On Wed, 21 Oct 2015 08:32:14 -0700 (PDT), David Miller wrote: > As you say the apps are broken, so file a bug and have them fixed. > > The assumption is clearly invalid, so apps cannot make such an > assumption. Does it mean you would be okay with a patch that always allocates and assigns a new

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-21 Thread David Miller
From: Jiri Benc Date: Fri, 16 Oct 2015 13:07:59 +0200 > This of course does not fix the reuse problem for the applications; > it just makes it less likely to be hit in common usage patterns. Not only does this not fix the problem, it makes the incentive to fix that problem

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-21 Thread Jiri Benc
On Wed, 21 Oct 2015 07:43:32 -0700 (PDT), David Miller wrote: > Fix the real problem, then come talk to us. I don't think the real problem is fixable, given that any kind of unique non-settable identifier would break CRIU. And anything settable will have the exact same problem. All we can do is

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-21 Thread David Miller
From: Jiri Benc Date: Wed, 21 Oct 2015 17:25:02 +0200 > On Wed, 21 Oct 2015 08:32:14 -0700 (PDT), David Miller wrote: >> As you say the apps are broken, so file a bug and have them fixed. >> >> The assumption is clearly invalid, so apps cannot make such an >> assumption. > >

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-21 Thread Hannes Frederic Sowa
Hello, On Wed, Oct 21, 2015, at 17:56, David Miller wrote: > From: Jiri Benc > Date: Wed, 21 Oct 2015 17:25:02 +0200 > > > On Wed, 21 Oct 2015 08:32:14 -0700 (PDT), David Miller wrote: > >> As you say the apps are broken, so file a bug and have them fixed. > >> > >> The

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-19 Thread Jiri Benc
On Sun, 18 Oct 2015 08:11:58 -0700, Alexei Starovoitov wrote: > it looks dangerous. > Does it mean that 'for (4B) { create new dev; free old dev; } > will keep incrementing that max index and dos it eventually? This is not changed by this patch in any way. As for the current behavior (with or

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-19 Thread Alexei Starovoitov
On Mon, Oct 19, 2015 at 11:06:49AM +0200, Jiri Benc wrote: > On Sun, 18 Oct 2015 08:11:58 -0700, Alexei Starovoitov wrote: > > it looks dangerous. > > Does it mean that 'for (4B) { create new dev; free old dev; } > > will keep incrementing that max index and dos it eventually? > > This is not

Re: [PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-18 Thread Alexei Starovoitov
On Fri, Oct 16, 2015 at 01:07:59PM +0200, Jiri Benc wrote: > When moving interfaces to a different netns, the ifindex of the interface is > kept if possible. However, this is not kept in sync with allocation of new > interfaces in the target netns. While the ifindex will be skipped when > creating

[PATCH net] net: try harder to not reuse ifindex when moving interfaces

2015-10-16 Thread Jiri Benc
When moving interfaces to a different netns, the ifindex of the interface is kept if possible. However, this is not kept in sync with allocation of new interfaces in the target netns. While the ifindex will be skipped when creating a new interface in the netns, it will be reused when the old