Re: [PATCH 02/19] Make vma_dump_size() generic

From: Janani Venkataraman1
Date: Mon Oct 07 2013 - 23:54:40 EST






From: Ryan Mallon <rmallon@xxxxxxxxx>
To: Janani Venkataraman1/India/IBM@IBMIN,
linux-kernel@xxxxxxxxxxxxxxx,
Cc: amwang@xxxxxxxxxx, rdunlap@xxxxxxxxxxxx, andi@xxxxxxxxxxxxxx,
aravinda@xxxxxxxxxxxxxxxxxx, hch@xxxxxx, mhiramat@xxxxxxxxxx,
jeremy.fitzhardinge@xxxxxxxxxx, xemul@xxxxxxxxxxxxx,
suzuki@xxxxxxxxxxxxxxxxxx, kosaki.motohiro@xxxxxxxxxxxxxx,
adobriyan@xxxxxxxxx, tarundsk@xxxxxxxxxxxxxxxxxx,
vapier@xxxxxxxxxx, roland@xxxxxxxxxxxxx, tj@xxxxxxxxxx,
ananth@xxxxxxxxxxxxxxxxxx, gorcunov@xxxxxxxxxx,
avagin@xxxxxxxxxx, oleg@xxxxxxxxxx, eparis@xxxxxxxxxx,
d.hatayama@xxxxxxxxxxxxxx, james.hogan@xxxxxxxxxx,
akpm@xxxxxxxxxxxxxxxxxxxx, torvalds@xxxxxxxxxxxxxxxxxxxx
Date: 10/08/2013 05:52 AM
Subject: Re: [PATCH 02/19] Make vma_dump_size() generic



On 04/10/13 20:30, Janani Venkataraman wrote:
> From:Suzuki K. Poulose <suzuki@xxxxxxxxxx>
>
> vma_dump_size calculates the file size of a vma area in the core file. It
> assumes the vma belongs to the "current". Make it generic to work for any
task.
> This will be reused by application core dump infrastructure.
>
> Signed-off-by: Suzuki K. Poulose <suzuki@xxxxxxxxxx>
> ---

> -static unsigned long vma_dump_size(struct vm_area_struct *vma,
> +unsigned long vma_dump_size(struct task_struct *p, struct vm_area_struct
*vma,
> unsigned long
mm_flags)
> {
> #define FILTER(type) (mm_flags & (1UL << MMF_DUMP_##type))
> @@ -143,10 +143,18 @@ static unsigned long vma_dump_size(struct
vm_area_struct *vma,
> * Switch to the user "segment" for get_user(),
> * then put back what elf_core_dump() had in
place.
> */
> - set_fs(USER_DS);
> - if (unlikely(get_user(word, header)))
> - word = 0;
> - set_fs(fs);
> + if (p->mm == current->mm) {
> + mm_segment_t fs = get_fs();

It looks like you missed the removal of the old:

mm_segment_t fs = get_fs();

above? Just below if (FILTER(ELF_HEADERS)).

Yes thats correct. I will remove it. Thanks for pointing it out.

Thanks
Janani

~Ryan



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/