lkml.org 
[lkml]   [2008]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] x86_64: Implement personality ADDR_LIMIT_32BIT
    On Fri, Oct 03, 2008 at 10:02:44AM +0200, Ingo Molnar wrote:
    >
    > * Kirill A. Shutemov <kirill@shutemov.name> wrote:
    >
    > > - /* for MAP_32BIT mappings we force the legact mmap base */
    > > - if (!test_thread_flag(TIF_IA32) && (flags & MAP_32BIT))
    > > + /* for MAP_32BIT mappings and ADDR_LIMIT_32BIT personality we force the
    > > + * legact mmap base
    > > + */
    >
    > please use the customary multi-line comment style:
    >
    > /*
    > * Comment .....
    > * ...... goes here:
    > */
    >
    > and you might use the opportunity to fix the s/legact/legacy typo as
    > well.

    Ok, I'll fix it.

    >
    > but more generally, we already have ADDR_LIMIT_3GB support on x86.

    Does ADDR_LIMIT_3GB really work?

    $ cat 1.c
    #include <stdio.h>
    #include <sys/personality.h>
    #include <sys/ipc.h>
    #include <sys/shm.h>

    #define ADDR_LIMIT_3GB 0x8000000

    int main(void)
    {
    int id;
    void *shm;

    personality(ADDR_LIMIT_3GB);

    id = shmget(0x123456, 1, IPC_CREAT | 0600);
    shm = shmat(id, NULL, 0);
    printf("shm: %p\n", shm);
    shmdt(shm);

    return 0;
    }
    $ gcc -Wall 1.c
    $ sudo ./a.out
    shm: 0x7f4fca755000

    > Why
    > should support for ADDR_LIMIT_32BIT be added?

    It's useful for user mode qemu when you try emulate 32-bit target on
    x86_64. For example, if shmat(2) return addres above 32-bit, target will
    get SIGSEGV on access to it.

    --
    Regards, Kirill A. Shutemov
    + Belarus, Minsk
    + ALT Linux Team, http://www.altlinux.com/
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2008-10-03 11:27    [W:4.118 / U:0.212 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site