Boot broken due to buffer overrun
PATCH 1/1 Boot broken due to buffer overrun
mconsole_init() passed 256 bytes as length in os_create_unix_socket, while the sizeof UNIX_PATH_MAX is 108. This patch fixes that problem and avoids a big overrun bug reported on UML bootup.
---
arch/um/drivers/mconsole_kern.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/um/drivers/mconsole_kern.c renamed from arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creation +3 -1
@@ -16,6 +16,8 @@#include <linux/slab.h> #include <linux/syscalls.h> #include <linux/utsname.h> +#include <linux/socket.h> +#include <linux/un.h> #include <linux/workqueue.h> #include <linux/mutex.h> #include <asm/uaccess.h>
@@ -785,7 +787,7 @@ static int __init mconsole_init(void)/* long to avoid size mismatch warnings from gcc */ long sock;int err; -char file[256 ]; +char file[UNIX_PATH_MAX ];if (umid_file_name ("mconsole" , file,sizeof (file)))return -1 ;
_
Signature · 11 lines
Balbir ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Hi Balbir,
Quoted 3 lines · Balbir Singh
mconsole_init()passed 256 bytes as length inos_create_unix_socket, while the sizeofUNIX_PATH_MAXis 108. This patch fixes that problem and avoids a big overrun bug reported on UML bootup.
Maybe mention that ->sun_path in struct sockaddr_un is UNIX_PATH_MAX long which causes the problem?
Quoted 3 lines
Reported-by Vikas K Managutte <[email protected]>Reported-by Sarvesh Kumar Lal Das <[email protected]>Signed-off-by Balbir Singh <[email protected]>
Quoted 28 lines
---
arch/um/drivers/mconsole_kern.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)diff -puN
arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creationarch/um/drivers/mconsole_kern.carch/um/drivers/mconsole_kern.c 2008-11-29 15:32:23.000000000 +0530 renamed from arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creation 2008-11-29 15:29:04.000000000 +0530 +3
-1@@ -16,6 +16,8 @@ #include <linux/slab.h> #include <linux/syscalls.h> #include <linux/utsname.h> +#include <linux/socket.h> +#include <linux/un.h> #include <linux/workqueue.h> #include <linux/mutex.h> #include <asm/uaccess.h>@@ -785,7 +787,7 @@ static int __init mconsole_init(void) /* long to avoid size mismatch warnings from gcc */ long sock; int err; - char file[256]; + char file[UNIX_PATH_MAX]; if (umid_file_name("mconsole", file, sizeof(file))) return -1;_
Quoted 8 lines
--
Balbir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 26 lines · Balbir Singh
mconsole_init()passed 256 bytes as length inos_create_unix_socket, while the sizeofUNIX_PATH_MAXis 108. This patch fixes that problem and avoids a big overrun bug reported on UML bootup.Reported-by Vikas K Managutte <[email protected]>Reported-by Sarvesh Kumar Lal Das <[email protected]>Signed-off-by Balbir Singh <[email protected]>---
arch/um/drivers/mconsole_kern.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)diff -puN
arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creationarch/um/drivers/mconsole_kern.carch/um/drivers/mconsole_kern.c 2008-11-29 15:32:23.000000000 +0530 renamed from arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creation 2008-11-29 15:29:04.000000000 +0530 +2
-0@@ -16,6 +16,8 @@ #include <linux/slab.h> #include <linux/syscalls.h> #include <linux/utsname.h> +#include <linux/socket.h> +#include <linux/un.h> #include <linux/workqueue.h> #include <linux/mutex.h> #include <asm/uaccess.h>
arch/um/drivers/mconsole_kern.c 2008-11-29 15:32:23.000000000 +0530 static int __init mconsole_init(void) · line 791
Quoted 6 lines
arch/um/drivers/mconsole_kern.c 2008-11-29 15:32:23.000000000 +0530 renamed from arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creation 2008-11-29 15:29:04.000000000 +0530 +1
-1@@ -785,7 +787,7 @@ static int __init mconsole_init(void) /* long to avoid size mismatch warnings from gcc */ long sock; int err; - char file[256]; + char file[UNIX_PATH_MAX];
Aha, good spot!
Please also correct the length of mconsole_socket_name.
Anyway,
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 11 lines · Pekka Enberg
Hi Balbir,
Quoted 3 lines · Balbir Singh
mconsole_init()passed 256 bytes as length inos_create_unix_socket, while the sizeofUNIX_PATH_MAXis 108. This patch fixes that problem and avoids a big overrun bug reported on UML bootup.Maybe mention that ->sun_path in struct
sockaddr_unisUNIX_PATH_MAXlong which causes the problem?
Yes, the changelog can definitely add that to the changelog, I'll resend the patch if Jeff asks for it.
Quoted 5 lines
Quoted 3 lines
Reported-by Vikas K Managutte <[email protected]>Reported-by Sarvesh Kumar Lal Das <[email protected]>Signed-off-by Balbir Singh <[email protected]>Reviewed-by Pekka Enberg <[email protected]>
Thanks!
Signature · 11 lines
Balbir ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 38 lines · WANG Cong
Quoted 26 lines · Balbir Singh
mconsole_init()passed 256 bytes as length inos_create_unix_socket, while the sizeofUNIX_PATH_MAXis 108. This patch fixes that problem and avoids a big overrun bug reported on UML bootup.Reported-by Vikas K Managutte <[email protected]>Reported-by Sarvesh Kumar Lal Das <[email protected]>Signed-off-by Balbir Singh <[email protected]>---
arch/um/drivers/mconsole_kern.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)diff -puN
arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creationarch/um/drivers/mconsole_kern.carch/um/drivers/mconsole_kern.c 2008-11-29 15:32:23.000000000 +0530 renamed from arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creation 2008-11-29 15:29:04.000000000 +0530 +2
-0@@ -16,6 +16,8 @@ #include <linux/slab.h> #include <linux/syscalls.h> #include <linux/utsname.h> +#include <linux/socket.h> +#include <linux/un.h> #include <linux/workqueue.h> #include <linux/mutex.h> #include <asm/uaccess.h>arch/um/drivers/mconsole_kern.c 2008-11-29 15:32:23.000000000 +0530 static int __init mconsole_init(void) · line 791
Quoted 6 lines
arch/um/drivers/mconsole_kern.c 2008-11-29 15:32:23.000000000 +0530 renamed from arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creation 2008-11-29 15:29:04.000000000 +0530 +1
-1@@ -785,7 +787,7 @@ static int __init mconsole_init(void) /* long to avoid size mismatch warnings from gcc */ long sock; int err; - char file[256]; + char file[UNIX_PATH_MAX];Aha, good spot!
Quoted 2 lines
Please also correct the length of
mconsole_socket_name.
I did not fix that with UNIX_PATH_MAX since, mconsole_user.c already includes sys/un.h and sys/socket.h and I did not want to include kernel headers linux/socket.h and linux/un.h there. I could have hard-coded those values to 108, but I just let it be for now. If you feel strongly about it, it can be done.
Quoted 3 lines
Anyway,
Reviewed-by WANG Cong <[email protected]>
Thanks!
Signature · 11 lines
Balbir ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 7 lines · Balbir Singh
I did not fix that with
UNIX_PATH_MAXsince,mconsole_user.calready includessys/un.handsys/socket.hand I did not want to include kernel headerslinux/socket.handlinux/un.hthere. I could have hard-coded those values to 108, but I just let it be for now. If you feel strongly about it, it can be done.
No, you can leave it to me. :)
Thanks.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 10 lines · On Sat, 29 Nov 2008 17:50:39 +0530 Balbir Singh <[email protected]>…
Quoted 8 lines · Pekka Enberg
Hi Balbir,
Quoted 3 lines · Balbir Singh
mconsole_init()passed 256 bytes as length inos_create_unix_socket, while the sizeofUNIX_PATH_MAXis 108. This patch fixes that problem and avoids a big overrun bug reported on UML bootup.
Quoted 6 lines
Quoted 3 lines
Maybe mention that ->sun_path in struct
sockaddr_unisUNIX_PATH_MAXlong which causes the problem?Yes, the changelog can definitely add that to the changelog, I'll resend the patch if Jeff asks for it.
Jeff's been quiet lately - I'll merge this one.
I also tagged it for -stable, subject to Jeff's OK. I'm wondering why this wasn't observed in earlier kernels?
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 13 lines · Andrew Morton
Quoted 10 lines · On Sat, 29 Nov 2008 17:50:39 +0530 Balbir Singh <[email protected]>…
Quoted 8 lines · Pekka Enberg
Hi Balbir,
Quoted 3 lines · Balbir Singh
mconsole_init()passed 256 bytes as length inos_create_unix_socket, while the sizeofUNIX_PATH_MAXis 108. This patch fixes that problem and avoids a big overrun bug reported on UML bootup.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Maybe mention that ->sun_path in struct
sockaddr_unisUNIX_PATH_MAXlong which causes the problem?Yes, the changelog can definitely add that to the changelog, I'll resend the patch if Jeff asks for it.
Jeff's been quiet lately - I'll merge this one.
Yes, indeed.
Quoted 3 lines
I also tagged it for -stable, subject to Jeff's OK. I'm wondering why this wasn't observed in earlier kernels?
Maybe because mconsole is not often used for uml? :)
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 13 lines · Andrew Morton
Quoted 10 lines · On Sat, 29 Nov 2008 17:50:39 +0530 Balbir Singh <[email protected]>…
Quoted 8 lines · Pekka Enberg
Hi Balbir,
Quoted 3 lines · Balbir Singh
mconsole_init()passed 256 bytes as length inos_create_unix_socket, while the sizeofUNIX_PATH_MAXis 108. This patch fixes that problem and avoids a big overrun bug reported on UML bootup.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Maybe mention that ->sun_path in struct
sockaddr_unisUNIX_PATH_MAXlong which causes the problem?Yes, the changelog can definitely add that to the changelog, I'll resend the patch if Jeff asks for it.
Jeff's been quiet lately - I'll merge this one.
Thanks!
Quoted 3 lines
I also tagged it for -stable, subject to Jeff's OK. I'm wondering why this wasn't observed in earlier kernels?
I observed it with the newer toolchain that uses __USE_FORTIFY_LEVEL and __FORTIFY_SOURCE
Signature · 11 lines
Balbir ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel