public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Devin Bayer <devin@freeshell.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] allow core_patten to be a FIFO, kernel 2.6.14
Date: 30 Nov 2005 22:35:56 -0700	[thread overview]
Message-ID: <p73hd9tfkg3.fsf@verdi.suse.de> (raw)
In-Reply-To: <438E4307.10508@freeshell.org>

Devin Bayer <devin@freeshell.org> writes:
> 
> I'm looking for comments, testing and inclusion in the next release.
> I have tested it in UML and one i686 build. The coredump files
> produced were valid.

I did a similar patch some time ago, but it allowed to execute a program
instead of allowing fifos with the core on stdin. IMHO that's a better
usage model because it doesn't require a daemon (and if you want one
you can use a trivial forwarder) 

I didn't post it because it still needed some cleanup and
double checking of a few corner cases and ran out of time for that.

I agree it's very useful. In my case the idea was to do 
automatic crash reporting. I wrote some simpleminded backup
scripts for that.

If there is interest I can dig it out. I think it was already
in better shape than your patch ;-)

>  {
> -	if (file->f_op->llseek) {
> +	if (off == file->f_pos) +		return 1;
> +	if (file->f_op->llseek == no_llseek && off > file->f_pos) {
> +		int nr = off - file->f_pos;
> +		char zeros[nr];
> +
> +		memset(zeros,0,nr);
> +		return dump_write(file, zeros, nr);

That's a exploitable root hole and a likely crash I think.

> +	    if (do_truncate(file->f_dentry, 0) != 0)
> +		    goto close_fail;
> +	}
>  	retval = binfmt->core_dump(signr, regs, file);
>  +	if(S_ISFIFO(inode->i_mode))
> +	    spin_unlock(&fifo_core_lock);

You're holding a spinlock over operations that can sleep like
write or truncate? That's totally wrong.

-Andi

      reply	other threads:[~2005-12-01  1:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-01  0:25 [PATCH] allow core_patten to be a FIFO, kernel 2.6.14 Devin Bayer
2005-12-01  5:35 ` Andi Kleen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=p73hd9tfkg3.fsf@verdi.suse.de \
    --to=ak@suse.de \
    --cc=devin@freeshell.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox