Re: [PATCH] coredump - as root not only if euid switched

From: Andrew Morton
Date: Thu Apr 22 2004 - 03:59:32 EST


Peter Waechtler <pwaechtler@xxxxxxx> wrote:
>
> >Is it not possible to call sys_unlink() directly from there? Something like
> >
> >long kernel_unlink(const char *name)
> >{
> > mm_segment_t old_fs = get_fs();
> > long ret;
> >
> > set_fs(KERNEL_DS);
> > ret = sys_unlink(name);
> > set_fs(old_fs);
> > return ret;
> >}
>
> And you're asking me? ;)

Well someone has to know ;)

> While getname() has a check for user/kernelspace - do you really
> care about "the overhead" for a function call level with 1 argument?
> Uhm, probably if you even care to write this..

It's very small, but heck, we unlink a lot more often than we dump core.
Most of us, that is.

> What is the cost for switching the segments?

Teeny.

> But I agree that sys_unlink should be the fast call and dumping core
> is the exception :)
>
> would fastcall do_unlink() help? I guess the arg is then passed in a
> register

I've never been able to measure any size or space benefit for fastcall, and
we do it via compiler options kernel-wide nowadays.

The above will work fine. You can probably just open-code it at the place
where you're unlinking the file.

(why are you trying to unlink the old file anyway?)
-
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/