Re: Possible shared mapping bug in 2.4.23 (at least MIPS/Sparc)

From: Linus Torvalds (torvalds_at_osdl.org)
Date: 12/14/03

  • Next message: Daniel Gryniewicz: "Re: 2.4 vs 2.6"
    Date:	Sun, 14 Dec 2003 10:05:03 -0800 (PST)
    To: Peter Horton <pdh@colonel-panic.org>
    
    

    On Sun, 14 Dec 2003, Peter Horton wrote:
    > >
    > > Just document it as a bug in the user program if this causes problems.
    > > Don't blame the kernel - the kernel is only doing what the user asked it
    > > to do.
    >
    > I've seen code written for X86 use MAP_FIXED to create self wrapping
    > ring buffers. Surely it's better to fail the mmap() on other archs
    > rather than for the code to fail in unexpected ways?

    Yes and no.

    In _that_ case it would clearly be polite to just fail the mmap(). No
    question about that - it's always nice if the kernel can find problems
    early rather than late.

    However, there are other ways you can screw yourself in user space, and
    I'm not convinced it is always wrong to create a unaligned shared mapping.
    For example, I can see that being useful exactly because you want to write
    some CPU test in user space, for example.

    So I'm generally opposed to the kernel saying "you can't do that" if there
    isn't some really fundamental reason (security or stability) for it to be
    really a no-no. It's often better to give the user rope to hang himself:
    that rope might be used for interesting things too.

    > It's a bug either way ... either the test should be fixed up or it
    > should be removed from arch_get_unmapped_area() to save confusion.

    I agree that we might as well remove it, but it's not 2.6.x material.

                    Linus
    -
    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/


  • Next message: Daniel Gryniewicz: "Re: 2.4 vs 2.6"

    Relevant Pages

    • Re: Inotify problem [was Re: 2.6.13-rc6-mm1]
      ... >> I think the best thing is to take idr into user space and emulate the ... > and findalso seems to fail. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: New do_mremap vulnerabitily.
      ... Yes it can fail, and no, bad things can't happen. ... error code to user space, but on the other hand, by the time the munmap ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)
    • Re: 0xdeadbeef vs 0xdeadbeefL
      ... about obscure rules they would fail. ... fail it" because I don't know some obscure typing rule that I wouldn't ... Do you Yahoo!? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: I request inclusion of SAS Transport Layer and AIC-94xx into the kernel
      ... > allow us to pass an arbitrary request buffer, ... > suffice for most storage management apps. ... Sorry but I completely fail to see this argument. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [RFC as402] Delaying module memory release
      ... > input to the rmmod process has been redirected to a pseudo-file that pins ... [Snip poor man's two-stage module delete patch]. ... Most people want "remove or fail" ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)