All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/6] net: better validate user provided tunnel names
@ 2018-04-05 13:39 Eric Dumazet
  2018-04-05 13:39 ` [PATCH net 1/6] net: fool proof dev_valid_name() Eric Dumazet
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Eric Dumazet @ 2018-04-05 13:39 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Steffen Klassert, Eric Dumazet, Eric Dumazet

This series changes dev_valid_name() to not attempt reading
a possibly too long user-provided device name, then use
this helper in five different tunnel providers.

Eric Dumazet (6):
  net: fool proof dev_valid_name()
  ip_tunnel: better validate user provided tunnel names
  ipv6: sit: better validate user provided tunnel names
  ip6_gre: better validate user provided tunnel names
  ip6_tunnel: better validate user provided tunnel names
  vti6: better validate user provided tunnel names

 net/core/dev.c        |  2 +-
 net/ipv4/ip_tunnel.c  | 11 ++++++-----
 net/ipv6/ip6_gre.c    |  8 +++++---
 net/ipv6/ip6_tunnel.c | 11 +++++++----
 net/ipv6/ip6_vti.c    |  7 +++++--
 net/ipv6/sit.c        |  8 +++++---
 6 files changed, 29 insertions(+), 18 deletions(-)

-- 
2.17.0.484.g0c8726318c-goog

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH net 1/6] net: fool proof dev_valid_name()
  2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
@ 2018-04-05 13:39 ` Eric Dumazet
  2018-04-05 13:39 ` [PATCH net 2/6] ip_tunnel: better validate user provided tunnel names Eric Dumazet
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Eric Dumazet @ 2018-04-05 13:39 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Steffen Klassert, Eric Dumazet, Eric Dumazet

We want to use dev_valid_name() to validate tunnel names,
so better use strnlen(name, IFNAMSIZ) than strlen(name) to make
sure to not upset KASAN.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 9b04a9fd1dfd0e065a7fe798dd840a07f0e0a4df..969462ebb296250fe5f3b7c4621e9ba9720a2dbe 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1027,7 +1027,7 @@ bool dev_valid_name(const char *name)
 {
 	if (*name == '\0')
 		return false;
-	if (strlen(name) >= IFNAMSIZ)
+	if (strnlen(name, IFNAMSIZ) == IFNAMSIZ)
 		return false;
 	if (!strcmp(name, ".") || !strcmp(name, ".."))
 		return false;
-- 
2.17.0.484.g0c8726318c-goog

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net 2/6] ip_tunnel: better validate user provided tunnel names
  2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
  2018-04-05 13:39 ` [PATCH net 1/6] net: fool proof dev_valid_name() Eric Dumazet
@ 2018-04-05 13:39 ` Eric Dumazet
  2018-04-09  3:37     ` Sasha Levin
  2018-04-05 13:39 ` [PATCH net 3/6] ipv6: sit: " Eric Dumazet
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Eric Dumazet @ 2018-04-05 13:39 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Steffen Klassert, Eric Dumazet, Eric Dumazet

Use dev_valid_name() to make sure user does not provide illegal
device name.

syzbot caught the following bug :

BUG: KASAN: stack-out-of-bounds in strlcpy include/linux/string.h:300 [inline]
BUG: KASAN: stack-out-of-bounds in __ip_tunnel_create+0xca/0x6b0 net/ipv4/ip_tunnel.c:257
Write of size 20 at addr ffff8801ac79f810 by task syzkaller268107/4482

CPU: 0 PID: 4482 Comm: syzkaller268107 Not tainted 4.16.0+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b9/0x29f lib/dump_stack.c:53
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 memcpy+0x37/0x50 mm/kasan/kasan.c:303
 strlcpy include/linux/string.h:300 [inline]
 __ip_tunnel_create+0xca/0x6b0 net/ipv4/ip_tunnel.c:257
 ip_tunnel_create net/ipv4/ip_tunnel.c:352 [inline]
 ip_tunnel_ioctl+0x818/0xd40 net/ipv4/ip_tunnel.c:861
 ipip_tunnel_ioctl+0x1c5/0x420 net/ipv4/ipip.c:350
 dev_ifsioc+0x43e/0xb90 net/core/dev_ioctl.c:334
 dev_ioctl+0x69a/0xcc0 net/core/dev_ioctl.c:525
 sock_ioctl+0x47e/0x680 net/socket.c:1015
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x1cf/0x1650 fs/ioctl.c:684
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701
 SYSC_ioctl fs/ioctl.c:708 [inline]
 SyS_ioctl+0x24/0x30 fs/ioctl.c:706
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
---
 net/ipv4/ip_tunnel.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index de6d94482fe7ef6be52eeea3291849cfb9d961f9..6b0e362cc99b5d3510ea7aa8db68dcb5c8eb675c 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -253,13 +253,14 @@ static struct net_device *__ip_tunnel_create(struct net *net,
 	struct net_device *dev;
 	char name[IFNAMSIZ];
 
-	if (parms->name[0])
+	err = -E2BIG;
+	if (parms->name[0]) {
+		if (!dev_valid_name(parms->name))
+			goto failed;
 		strlcpy(name, parms->name, IFNAMSIZ);
-	else {
-		if (strlen(ops->kind) > (IFNAMSIZ - 3)) {
-			err = -E2BIG;
+	} else {
+		if (strlen(ops->kind) > (IFNAMSIZ - 3))
 			goto failed;
-		}
 		strlcpy(name, ops->kind, IFNAMSIZ);
 		strncat(name, "%d", 2);
 	}
-- 
2.17.0.484.g0c8726318c-goog

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net 3/6] ipv6: sit: better validate user provided tunnel names
  2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
  2018-04-05 13:39 ` [PATCH net 1/6] net: fool proof dev_valid_name() Eric Dumazet
  2018-04-05 13:39 ` [PATCH net 2/6] ip_tunnel: better validate user provided tunnel names Eric Dumazet
@ 2018-04-05 13:39 ` Eric Dumazet
  2018-04-09  3:37     ` Sasha Levin
  2018-04-05 13:39 ` [PATCH net 4/6] ip6_gre: " Eric Dumazet
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Eric Dumazet @ 2018-04-05 13:39 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Steffen Klassert, Eric Dumazet, Eric Dumazet

Use dev_valid_name() to make sure user does not provide illegal
device name.

syzbot caught the following bug :

BUG: KASAN: stack-out-of-bounds in strlcpy include/linux/string.h:300 [inline]
BUG: KASAN: stack-out-of-bounds in ipip6_tunnel_locate+0x63b/0xaa0 net/ipv6/sit.c:254
Write of size 33 at addr ffff8801b64076d8 by task syzkaller932654/4453

CPU: 0 PID: 4453 Comm: syzkaller932654 Not tainted 4.16.0+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b9/0x29f lib/dump_stack.c:53
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 memcpy+0x37/0x50 mm/kasan/kasan.c:303
 strlcpy include/linux/string.h:300 [inline]
 ipip6_tunnel_locate+0x63b/0xaa0 net/ipv6/sit.c:254
 ipip6_tunnel_ioctl+0xe71/0x241b net/ipv6/sit.c:1221
 dev_ifsioc+0x43e/0xb90 net/core/dev_ioctl.c:334
 dev_ioctl+0x69a/0xcc0 net/core/dev_ioctl.c:525
 sock_ioctl+0x47e/0x680 net/socket.c:1015
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x1cf/0x1650 fs/ioctl.c:684
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701
 SYSC_ioctl fs/ioctl.c:708 [inline]
 SyS_ioctl+0x24/0x30 fs/ioctl.c:706
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
---
 net/ipv6/sit.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 1522bcfd253fcc0a01a4daa0ebcfb8bf154ab5dc..2afce37a71776f5ebd44d20e2d064909cb91f8dd 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -250,11 +250,13 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net,
 	if (!create)
 		goto failed;
 
-	if (parms->name[0])
+	if (parms->name[0]) {
+		if (!dev_valid_name(parms->name))
+			goto failed;
 		strlcpy(name, parms->name, IFNAMSIZ);
-	else
+	} else {
 		strcpy(name, "sit%d");
-
+	}
 	dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN,
 			   ipip6_tunnel_setup);
 	if (!dev)
-- 
2.17.0.484.g0c8726318c-goog

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net 4/6] ip6_gre: better validate user provided tunnel names
  2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
                   ` (2 preceding siblings ...)
  2018-04-05 13:39 ` [PATCH net 3/6] ipv6: sit: " Eric Dumazet
@ 2018-04-05 13:39 ` Eric Dumazet
  2018-04-09  3:37     ` Sasha Levin
  2018-04-05 13:39 ` [PATCH net 5/6] ip6_tunnel: " Eric Dumazet
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Eric Dumazet @ 2018-04-05 13:39 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Steffen Klassert, Eric Dumazet, Eric Dumazet

Use dev_valid_name() to make sure user does not provide illegal
device name.

syzbot caught the following bug :

BUG: KASAN: stack-out-of-bounds in strlcpy include/linux/string.h:300 [inline]
BUG: KASAN: stack-out-of-bounds in ip6gre_tunnel_locate+0x334/0x860 net/ipv6/ip6_gre.c:339
Write of size 20 at addr ffff8801afb9f7b8 by task syzkaller851048/4466

CPU: 1 PID: 4466 Comm: syzkaller851048 Not tainted 4.16.0+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b9/0x29f lib/dump_stack.c:53
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 memcpy+0x37/0x50 mm/kasan/kasan.c:303
 strlcpy include/linux/string.h:300 [inline]
 ip6gre_tunnel_locate+0x334/0x860 net/ipv6/ip6_gre.c:339
 ip6gre_tunnel_ioctl+0x69d/0x12e0 net/ipv6/ip6_gre.c:1195
 dev_ifsioc+0x43e/0xb90 net/core/dev_ioctl.c:334
 dev_ioctl+0x69a/0xcc0 net/core/dev_ioctl.c:525
 sock_ioctl+0x47e/0x680 net/socket.c:1015
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x1cf/0x1650 fs/ioctl.c:684
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701
 SYSC_ioctl fs/ioctl.c:708 [inline]
 SyS_ioctl+0x24/0x30 fs/ioctl.c:706
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
---
 net/ipv6/ip6_gre.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index f8a103bdbd603be103bf6c18ed6a55703aab18df..69727bc168cb027009dac95431e40b71291697da 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -335,11 +335,13 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
 	if (t || !create)
 		return t;
 
-	if (parms->name[0])
+	if (parms->name[0]) {
+		if (!dev_valid_name(parms->name))
+			return NULL;
 		strlcpy(name, parms->name, IFNAMSIZ);
-	else
+	} else {
 		strcpy(name, "ip6gre%d");
-
+	}
 	dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN,
 			   ip6gre_tunnel_setup);
 	if (!dev)
-- 
2.17.0.484.g0c8726318c-goog

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net 5/6] ip6_tunnel: better validate user provided tunnel names
  2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
                   ` (3 preceding siblings ...)
  2018-04-05 13:39 ` [PATCH net 4/6] ip6_gre: " Eric Dumazet
@ 2018-04-05 13:39 ` Eric Dumazet
  2018-04-09  3:37     ` Sasha Levin
  2018-04-05 13:39 ` [PATCH net 6/6] vti6: " Eric Dumazet
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Eric Dumazet @ 2018-04-05 13:39 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Steffen Klassert, Eric Dumazet, Eric Dumazet

Use valid_name() to make sure user does not provide illegal
device name.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/ip6_tunnel.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index df4c29f7d59f030729b1158b809a10f4115d4bbf..da66aaac51cecbf933827c8842e61a8cbb4d274f 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -297,13 +297,16 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p)
 	struct net_device *dev;
 	struct ip6_tnl *t;
 	char name[IFNAMSIZ];
-	int err = -ENOMEM;
+	int err = -E2BIG;
 
-	if (p->name[0])
+	if (p->name[0]) {
+		if (!dev_valid_name(p->name))
+			goto failed;
 		strlcpy(name, p->name, IFNAMSIZ);
-	else
+	} else {
 		sprintf(name, "ip6tnl%%d");
-
+	}
+	err = -ENOMEM;
 	dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN,
 			   ip6_tnl_dev_setup);
 	if (!dev)
-- 
2.17.0.484.g0c8726318c-goog

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net 6/6] vti6: better validate user provided tunnel names
  2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
                   ` (4 preceding siblings ...)
  2018-04-05 13:39 ` [PATCH net 5/6] ip6_tunnel: " Eric Dumazet
@ 2018-04-05 13:39 ` Eric Dumazet
  2018-04-09  3:37     ` Sasha Levin
  2018-04-05 19:21 ` [PATCH net 0/6] net: " David Miller
  2018-04-09  3:37   ` Sasha Levin
  7 siblings, 1 reply; 21+ messages in thread
From: Eric Dumazet @ 2018-04-05 13:39 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Steffen Klassert, Eric Dumazet, Eric Dumazet

Use valid_name() to make sure user does not provide illegal
device name.

Fixes: ed1efb2aefbb ("ipv6: Add support for IPsec virtual tunnel interfaces")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/ipv6/ip6_vti.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 6ebb2e8777f42054ca5ee8338aa560f5501d8262..c214ffec02f06f6dccfb9769fc8640e5e56da618 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -212,10 +212,13 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p
 	char name[IFNAMSIZ];
 	int err;
 
-	if (p->name[0])
+	if (p->name[0]) {
+		if (!dev_valid_name(p->name))
+			goto failed;
 		strlcpy(name, p->name, IFNAMSIZ);
-	else
+	} else {
 		sprintf(name, "ip6_vti%%d");
+	}
 
 	dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, vti6_dev_setup);
 	if (!dev)
-- 
2.17.0.484.g0c8726318c-goog

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH net 0/6] net: better validate user provided tunnel names
  2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
                   ` (5 preceding siblings ...)
  2018-04-05 13:39 ` [PATCH net 6/6] vti6: " Eric Dumazet
@ 2018-04-05 19:21 ` David Miller
  2018-04-05 19:40   ` Eric Dumazet
  2018-04-09  3:37   ` Sasha Levin
  7 siblings, 1 reply; 21+ messages in thread
From: David Miller @ 2018-04-05 19:21 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, steffen.klassert, eric.dumazet

From: Eric Dumazet <edumazet@google.com>
Date: Thu,  5 Apr 2018 06:39:25 -0700

> This series changes dev_valid_name() to not attempt reading
> a possibly too long user-provided device name, then use
> this helper in five different tunnel providers.

Series applied and queued up for -stable, thanks Eric.

Reading over this series makes me wonder if we generally have an
off-by-one bug for device names which are exactly IFNAMSIZ.

We validate the size using the test:

	if (strlen(name) >= IFNAMSIZ)
		return ERROR;

and thusly after Eric's changes:

	if (strnlen(name, IFNAMSIZ) == IFNAMSIZ)
		return ERROR;

This value computed by str{,n}len() doesn't include the trailing null
byte.

So we will accept a name that has exactly IFNAMSIZ bytes long not
including the trailing null.

Then we will copy IFNAMSIZ bytes, minus 1, into the device name and
then tack on the trailling null byte.

So essentially we will set the final non-null byte in the string to
a null byte.

Am I misreading things?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 0/6] net: better validate user provided tunnel names
  2018-04-05 19:21 ` [PATCH net 0/6] net: " David Miller
@ 2018-04-05 19:40   ` Eric Dumazet
  0 siblings, 0 replies; 21+ messages in thread
From: Eric Dumazet @ 2018-04-05 19:40 UTC (permalink / raw)
  To: David Miller, edumazet; +Cc: netdev, steffen.klassert, eric.dumazet



On 04/05/2018 12:21 PM, David Miller wrote:
> From: Eric Dumazet <edumazet@google.com>
> Date: Thu,  5 Apr 2018 06:39:25 -0700
> 
>> This series changes dev_valid_name() to not attempt reading
>> a possibly too long user-provided device name, then use
>> this helper in five different tunnel providers.
> 
> Series applied and queued up for -stable, thanks Eric.
> 
> Reading over this series makes me wonder if we generally have an
> off-by-one bug for device names which are exactly IFNAMSIZ.
> 
> We validate the size using the test:
> 
> 	if (strlen(name) >= IFNAMSIZ)
> 		return ERROR;
> 
> and thusly after Eric's changes:
> 
> 	if (strnlen(name, IFNAMSIZ) == IFNAMSIZ)
> 		return ERROR;
> 
> This value computed by str{,n}len() doesn't include the trailing null
> byte.
> 
> So we will accept a name that has exactly IFNAMSIZ bytes long not
> including the trailing null.

In this case strnlen(name, IFNAMSIZ) returns IFNAMSIZ.

So  (strnlen(name, IFNAMSIZ) == IFNAMSIZ) would definitely be true.

The only effect of the change is that strlen() would read 1000 bytes of a
malicious string before we reached the test on the length to reject such name.

While strnlen() is guaranteed to not read more than IFNAMSIZ bytes.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 3/6] ipv6: sit: better validate user provided tunnel names
  2018-04-05 13:39 ` [PATCH net 3/6] ipv6: sit: " Eric Dumazet
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 1da177e4c3f4 Linux-2.6.12-rc2.

The bot has also determined it's probably a bug fixing patch. (score: 53.2877)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 3/6] ipv6: sit: better validate user provided tunnel names
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 1da177e4c3f4 Linux-2.6.12-rc2.

The bot has also determined it's probably a bug fixing patch. (score: 53.2877)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 5/6] ip6_tunnel: better validate user provided tunnel names
  2018-04-05 13:39 ` [PATCH net 5/6] ip6_tunnel: " Eric Dumazet
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 1da177e4c3f4 Linux-2.6.12-rc2.

The bot has also determined it's probably a bug fixing patch. (score: 24.0820)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 5/6] ip6_tunnel: better validate user provided tunnel names
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 1da177e4c3f4 Linux-2.6.12-rc2.

The bot has also determined it's probably a bug fixing patch. (score: 24.0820)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 4/6] ip6_gre: better validate user provided tunnel names
  2018-04-05 13:39 ` [PATCH net 4/6] ip6_gre: " Eric Dumazet
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: c12b395a4664 gre: Support GRE over IPv6.

The bot has also determined it's probably a bug fixing patch. (score: 52.9896)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 4/6] ip6_gre: better validate user provided tunnel names
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: c12b395a4664 gre: Support GRE over IPv6.

The bot has also determined it's probably a bug fixing patch. (score: 52.9896)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 6/6] vti6: better validate user provided tunnel names
  2018-04-05 13:39 ` [PATCH net 6/6] vti6: " Eric Dumazet
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller
  Cc: netdev, Steffen Klassert, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: ed1efb2aefbb ipv6: Add support for IPsec virtual tunnel interfaces.

The bot has also determined it's probably a bug fixing patch. (score: 65.4654)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 6/6] vti6: better validate user provided tunnel names
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller
  Cc: netdev, Steffen Klassert, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: ed1efb2aefbb ipv6: Add support for IPsec virtual tunnel interfaces.

The bot has also determined it's probably a bug fixing patch. (score: 65.4654)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 0/6] net: better validate user provided tunnel names
  2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
@ 2018-04-09  3:37   ` Sasha Levin
  2018-04-05 13:39 ` [PATCH net 2/6] ip_tunnel: better validate user provided tunnel names Eric Dumazet
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: ed1efb2aefbb ipv6: Add support for IPsec virtual tunnel interfaces.

The bot has also determined it's probably a bug fixing patch. (score: 53.6463)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 0/6] net: better validate user provided tunnel names
@ 2018-04-09  3:37   ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: ed1efb2aefbb ipv6: Add support for IPsec virtual tunnel interfaces.

The bot has also determined it's probably a bug fixing patch. (score: 53.6463)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 2/6] ip_tunnel: better validate user provided tunnel names
  2018-04-05 13:39 ` [PATCH net 2/6] ip_tunnel: better validate user provided tunnel names Eric Dumazet
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: c54419321455 GRE: Refactor GRE tunneling code..

The bot has also determined it's probably a bug fixing patch. (score: 46.6256)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net 2/6] ip_tunnel: better validate user provided tunnel names
@ 2018-04-09  3:37     ` Sasha Levin
  0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2018-04-09  3:37 UTC (permalink / raw)
  To: Sasha Levin, Eric Dumazet, David S . Miller; +Cc: netdev, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: c54419321455 GRE: Refactor GRE tunneling code..

The bot has also determined it's probably a bug fixing patch. (score: 46.6256)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-04-09  3:37 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
2018-04-05 13:39 ` [PATCH net 1/6] net: fool proof dev_valid_name() Eric Dumazet
2018-04-05 13:39 ` [PATCH net 2/6] ip_tunnel: better validate user provided tunnel names Eric Dumazet
2018-04-09  3:37   ` Sasha Levin
2018-04-09  3:37     ` Sasha Levin
2018-04-05 13:39 ` [PATCH net 3/6] ipv6: sit: " Eric Dumazet
2018-04-09  3:37   ` Sasha Levin
2018-04-09  3:37     ` Sasha Levin
2018-04-05 13:39 ` [PATCH net 4/6] ip6_gre: " Eric Dumazet
2018-04-09  3:37   ` Sasha Levin
2018-04-09  3:37     ` Sasha Levin
2018-04-05 13:39 ` [PATCH net 5/6] ip6_tunnel: " Eric Dumazet
2018-04-09  3:37   ` Sasha Levin
2018-04-09  3:37     ` Sasha Levin
2018-04-05 13:39 ` [PATCH net 6/6] vti6: " Eric Dumazet
2018-04-09  3:37   ` Sasha Levin
2018-04-09  3:37     ` Sasha Levin
2018-04-05 19:21 ` [PATCH net 0/6] net: " David Miller
2018-04-05 19:40   ` Eric Dumazet
2018-04-09  3:37 ` Sasha Levin
2018-04-09  3:37   ` Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.