Re: [PATCH 2/2] coredump: exit_mm: clear ->mm first, then play with ->core_state

From: Roland McGrath
Date: Sun Jul 20 2008 - 20:10:47 EST


> Yes, oom_kill.c in turn need fixes but still this is not nice, and I
> personally hate this coredump code in the middle of exit_mm().

I agree. I think what we should work towards is having the coredump
synchronization take place earlier (the tracehook_report_exit point should
be fine, i.e. before PF_EXITING). Then have the dumping and the waiting
for it be killable. I don't think we can get there in only one or two
steps, though.

[The rest if quite off-topic, please do it separately.]

> btw, arch/sparc64/kernel/ptrace.c has a lot of
>
> if (target == current)
> copy_xxx_user();
> else
> access_process_vm();
>
> perhaps it make sense to make a helper.

Dave actually has get_from_target and set_to_target helpers for that.
The places they aren't used, I assume are either just older code not
yet streamlined, or places where the separate get/put_user calls perform
especially better than copy_xxx_user (you'd have to ask Dave). If multiple
arch ports find such helpers useful, they could move into common code later.

> Just curious (I don't know what regset is), is it possible that ->get()
> is called when target->mm == NULL?

It should not happen. It's only kosher to use user_regset calls on a task
in a known state (like ptrace stop, or current), and never on kernel threads.


Thanks,
Roland
--
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/