Re: [RFC][PATCH 1/3] [RFC][PATCH] Fix procfs task exe symlinks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 31 Oct 2007 20:35:09 -0700
Matt Helsley <[email protected]> wrote:

> +++ linux-2.6.23/include/linux/sched.h
> @@ -430,10 +430,13 @@ struct mm_struct {
>  	struct completion *core_startup_done, core_done;
>  
>  	/* aio bits */
>  	rwlock_t		ioctx_list_lock;
>  	struct kioctx		*ioctx_list;
> +
> +	/* store ref to file /proc/<pid>/exe symlink points to */
> +	struct file *exe_file;
>  };

I guess with a little work this could be made conditional on
CONFIG_PROC_FS.  ie: change get_mm_exe_file() to

void get_mm_exe_file(struct mm_struct *newmm, struct mm_struct *old_mm);

> @@ -1716,10 +1744,14 @@ static void remove_vma_list(struct mm_st
>  
>  		mm->total_vm -= nrpages;
>  		if (vma->vm_flags & VM_LOCKED)
>  			mm->locked_vm -= nrpages;
>  		vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
> +		if (mm->exe_file && (vma->vm_file == mm->exe_file)) {
> +			fput(mm->exe_file);
> +			mm->exe_file = NULL;
> +		}
>  		vma = remove_vma(vma);
>  	} while (vma);
>  	validate_mm(mm);
>  }

hm, fput() while holding mmap_sem.  I wonder if that's a problem.

I assume you've runtime tested this with lockdep enabled, but fput() is one
of those funny things which can call all sorts of things which one least
expects and where testers hit things which developers don't.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux