lkml.org 
[lkml]   [2008]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH][UML] Boot broken due to buffer overrun
    Hi Balbir,

    On Sat, Nov 29, 2008 at 12:08 PM, Balbir Singh
    <balbir@linux.vnet.ibm.com> wrote:
    > 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.

    Maybe mention that ->sun_path in struct sockaddr_un is UNIX_PATH_MAX
    long which causes the problem?

    > Reported-by: Vikas K Managutte <vikki.km@gmail.com>
    > Reported-by: Sarvesh Kumar Lal Das <skldas@gmail.com>
    > Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>

    Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>

    > ---
    >
    > 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-creation arch/um/drivers/mconsole_kern.c
    > --- linux-2.6.28-rc6/arch/um/drivers/mconsole_kern.c~fix-uml-buggy-socket-creation 2008-11-29 15:29:04.000000000 +0530
    > +++ linux-2.6.28-rc6-balbir/arch/um/drivers/mconsole_kern.c 2008-11-29 15:32:23.000000000 +0530
    > @@ -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;
    > _
    >
    > --
    > Balbir
    > --
    > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    > the body of a message to majordomo@vger.kernel.org
    > More majordomo info at http://vger.kernel.org/majordomo-info.html
    > Please read the FAQ at http://www.tux.org/lkml/
    >


    \
     
     \ /
      Last update: 2008-11-29 11:25    [W:0.023 / U:88.968 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site