lkml.org 
[lkml]   [2012]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC] c/r: prctl: Add ability to set new mm_struct::exe_file v3
    On Tue, Mar 13, 2012 at 04:43:37PM +0100, Oleg Nesterov wrote:
    > > +
    > > + /*
    > > + * For security reason changing mm->exe_file
    > > + * is one-shot action.
    > > + */
    > > + down_write(&mm->mmap_sem);
    > > + if (likely(!mm->exe_file))
    >
    > This means that the num_exe_file_vmas check at the start is not needed.
    > If you want it as a "fast-path" check, please fix the comment. Or just
    > remove it. Otherwise the code looks as if we have to check them both.

    Yes, I wanted a fast test first, while the second test will give
    one-shot condition and the second attempt to setup new exe_file
    will fail. OK, I'll update the comment block.

    >
    > Matt, is it really possible to hit mm->exe_file = NULL in
    > removed_exe_file_vma ? Unless I missed something, this check just
    > hides the potentional problem, no?
    >
    > IOW, shouldn't it do
    >
    > void removed_exe_file_vma(struct mm_struct *mm)
    > {
    > WARN_ON(!mm->exe_file);
    > WARN_ON(mm->num_exe_file_vmas <= 0);
    >

    I guess if num_exe_file_vmas < 1 here we've a bug somewhere
    and should not decrement the counter at all.

    Cyrill


    \
     
     \ /
      Last update: 2012-03-13 17:03    [W:4.600 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site