[lkml]   [2009]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[patch 07/18] kbuild: fix Module.markers permission error under cygwin
    2.6.27-stable review patch.  If anyone has any objections, please let us know.


    From: Cedric Hombourger <>

    commit 99e3a1eb3c22bb671c6f3d22d8244bfc9fad8185 upstream.

    While building the kernel, we end-up calling modpost with -K and -M
    options for the same file (Modules.markers). This is resulting in
    modpost's main function calling read_markers() and then write_markers() on
    the same file.

    We then have read_markers() mmap'ing the file, and writer_markers()
    opening that same file for writing.

    The issue is that read_markers() exits without munmap'ing the file and is
    as a matter holding a reference on Modules.markers. When write_markers()
    is opening that very same file for writing, we still have a reference on
    it and cygwin (Windows?) is then making fopen() fail with EPERM.

    Calling release_file() before exiting read_markers() clears that reference
    (and memory leak) and fopen() then succeeds.

    Tested on both cygwin (1.3.22) and Linux. Also ran modpost within
    valgrind on Linux to make sure that the munmap'ed file was not accessed
    after read_markers()

    Signed-off-by: Cedric Hombourger <>
    Cc: <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Sam Ravnborg <>
    Signed-off-by: Greg Kroah-Hartman <>

    scripts/mod/modpost.c | 1 +
    1 file changed, 1 insertion(+)

    --- a/scripts/mod/modpost.c
    +++ b/scripts/mod/modpost.c
    @@ -1997,6 +1997,7 @@ static void read_markers(const char *fna
    if (!mod->skip)
    add_marker(mod, marker, fmt);
    + release_file(file, size);
    fatal("parse error in markers list file\n");

     \ /
      Last update: 2009-05-06 22:45    [W:0.021 / U:3.784 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site