lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <cfd18e0f0804151409q178addf4t4c6cba683bd0bff4@mail.gmail.com>
Date:	Tue, 15 Apr 2008 23:09:45 +0200
From:	"Michael Kerrisk" <mtk.manpages@...glemail.com>
To:	ak@...e.de
Cc:	"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
	"Petr Gajdos" <pgajdos@...e.cz>, michael.kerrisk@...il.com
Subject: core_pattern piping strangeness

Hi Andi,

In 2.6.19 you added the pipiing syntax
(http://lwn.net/Articles/195310/) to core_pattern.  Petr pointed out
that this is not yet documented in core(5), so I set to testing it.

The change log has the text:

    The core dump proces will run with the privileges and in the name space
    of the process that caused the core dump.

This appears not to be true (as tested on 2.6.25-rc8).  Instead the
pipe program is run as root.  I'm not sure what "in the name space of
the process that caused the core dump" means -- I wondered if it might
mean that the current working directory of the program would be the
same as that of the process that caused the core dump.  However that
is not so: the current directory for the pipe program is the root
directory.

Can you comment?  Am I misunderstanding something?

Test program and shell session shown below.

Cheers,

Michael


$ cat core_pattern_test.c
/* core_pattern_test.c */

#define _GNU_SOURCE
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define BUF_SIZE 1024

int
main(int argc, char *argv[])
{
    int fd, tot;
    ssize_t numRead;
    char buf[BUF_SIZE];
    FILE *fp;

    fd = open(argv[1], O_CREAT | O_WRONLY | O_TRUNC, 0666);

    fp = fdopen(fd, "a");
    fprintf(fp, "PID=%ld\n", (long) getpid());
    fprintf(fp, "cwd=%s\n", get_current_dir_name());
    fprintf(fp, "UID=%ld; EUID=%ld\n", (long) getuid(), (long) geteuid());

    /* Count bytes in standard input */

    tot = 0;
    while ((numRead = read(STDIN_FILENO, buf, BUF_SIZE)) > 0)
        tot += numRead;
    fprintf(fp, "Total bytes in core dump: %d\n", tot);

    exit(EXIT_SUCCESS);
}

$ cc core_pattern_test.c
$ su
Password:
# echo "|$PWD/a.out $PWD/core.log" > /proc/sys/kernel/core_pattern
# exit
$ sleep 100 &
[1] 5637
$ kill -QUIT %1
[1]+  Quit                    (core dumped) sleep 100
$ cat core.log
PID=5638
cwd=/
UID=0; EUID=0
Total bytes in core dump: 282624
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ