All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Pallewatta Mano-FPCD67 <Mano.Pallewatta@motorola.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] linux-2.6.16.51 gzipped core dump patch
Date: Tue, 4 Sep 2007 04:26:37 +0100	[thread overview]
Message-ID: <20070904032637.GY21089@ftp.linux.org.uk> (raw)
In-Reply-To: <1188AA083E6C7C4EBCE34803004A84014FE926@de01exm72.ds.mot.com>

On Mon, Sep 03, 2007 at 10:32:00PM -0400, Pallewatta Mano-FPCD67 wrote:
> This patch was developed for embedded systems which had limited space
> for file storage. If an external process is to compress core files you
> will need to store those files somewhere first as core dump output
> cannot be directly fed to the stdin of compression program.

Why?  Create a pipe, start a new process, put the reader struct file
into its descriptor table as stdin, do execve in new process and
pass the writer struct file to ->core_dump().

As the matter of fact, it's already done - see
        lock_kernel();
        ispipe = format_corename(corename, core_pattern, signr);
        unlock_kernel();
        if (ispipe) {
                /* SIGPIPE can happen, but it's just never processed */
                if(call_usermodehelper_pipe(corename+1, NULL, NULL, &file)) {
                        printk(KERN_INFO "Core dump to %s pipe failed\n",
                               corename);
                        goto fail_unlock;
                }
        } else
                file = filp_open(corename,
                                 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
                                 0600);
in do_coredump().  So take a look at fs/exec.c:format_corename() and see
what to feed for it in order to get the equivalent of your patch.
core_patttern is set by sysctl (just say
echo [whatever] >/proc/sys/kernel/core_pattern 
and don't forget quoting, since | should be the first character to indicate
that you want to pipe coredump through a helper).

I really don't see a reason to do that kind of work in the kernel, embedded
system or not.

  reply	other threads:[~2007-09-04  3:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-04  0:49 [PATCH] linux-2.6.16.51 gzipped core dump patch Pallewatta Mano-FPCD67
2007-09-04  1:38 ` Al Viro
2007-09-04  2:32   ` Pallewatta Mano-FPCD67
2007-09-04  3:26     ` Al Viro [this message]
2007-09-04  4:04       ` Pallewatta Mano-FPCD67
2007-09-04  4:12         ` Al Viro

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=20070904032637.GY21089@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=Mano.Pallewatta@motorola.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.