lkml.org 
[lkml]   [2010]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH -mm 1/1] ptrace: PTRACE_GETFDPIC: fix the unsafe usage of child->mm
    On 05/25, David Howells wrote:
    >
    > Roland McGrath <roland@redhat.com> wrote:
    >
    > > The mm pointer is only used by these uncommon ptrace operations
    >
    > Like PEEKTEXT and POKETEXT?

    They use access_process_vm().

    According to grep, mm is only use to read a couple of members.

    Perhaps can even add the simple helper

    struct mm_xxx {
    unsigned long start_code, end_code, start_data, end_data;
    ... some more ...
    };

    int get_mm_xxx(struct task_struct *tracee, struct mm_xxx *mm_xxx)
    {
    struct mm_struct *mm = get_task_mm(tracee);
    ...
    }

    Except:

    - arch/um/kernel/ptrace.c PTRACE_SWITCH_MM does something
    really strange

    - arch/blackfin/kernel/ptrace.c:is_user_addr_valid()
    needs mmap_sem around find_vma()

    The lockless access to mm->context.sram_list doesn't look
    safe to me.

    If we add get_task_mm() - this protects us against
    destroy_context() only. What is the tracee's sub-thread
    does sys_sram_alloc() or sys_sram_free() in parallel?

    Oleg.



    \
     
     \ /
      Last update: 2010-05-25 12:27    [W:3.946 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site