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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4AA2A257.3000409@ameritech.net>
Date:	Sat, 05 Sep 2009 13:39:35 -0400
From:	"F. Heitkamp" <heitkamp@...ritech.net>
To:	Ulrich Drepper <drepper@...il.com>
CC:	Andreas Schwab <schwab@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: popen2 popen call

Ulrich Drepper wrote:
> On Thu, Aug 27, 2009 at 11:39,<heitkamp@...ritech.net>  wrote:
>    
>> OK.  I read in one of the messages, that glibc, passes the popen call to a ABI in the kernel. I have not
>> looked at the code in glibc yet.
>>      
>
> popen uses pipe2.  There is fallback code to use pipe if necessary.
> It's compiled out only of the libc assumes the kernel support is
> available.
> --
> 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/
>
>    
OK.  I think I found the problem but how do I fix it?
Did I miss a kernel config option?
I got the code from the man page:
http://linux.die.net/man/2/pipe
http://manpages.courier-mta.org/htmlman2/pipe.2.html

bash-4.0$ gcc -o linux-pipe linux-pipe.c
/tmp/ccHHOYkD.o: In function `main':
linux-pipe.c:(.text+0x3b): warning: warning: pipe2 is not implemented 
and will always fail
bash-4.0$ ./linux-pipe ls
pipe: Function not implemented
bash-4.0$


#include <sys/wait.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int
main(int argc, char *argv[])
{
     int pfd[2];
     pid_t cpid;
     char buf;
     assert(argc == 2);
     if (pipe2(pfd) == -1) { perror("pipe"); exit(EXIT_FAILURE); }
     cpid = fork();
     if (cpid == -1) { perror("fork"); exit(EXIT_FAILURE); }
     if (cpid == 0) {    /* Child reads from pipe */
         close(pfd[1]);          /* Close unused write end */
         while (read(pfd[0], &buf, 1) > 0)
             write(STDOUT_FILENO, &buf, 1);
         write(STDOUT_FILENO, "\n", 1);
         close(pfd[0]);
         _exit(EXIT_SUCCESS);
     } else {            /* Parent writes argv[1] to pipe */
         close(pfd[0]);          /* Close unused read end */
         write(pfd[1], argv[1], strlen(argv[1]));
         close(pfd[1]);          /* Reader will see EOF */
         wait(NULL);             /* Wait for child */
         exit(EXIT_SUCCESS);
     }
}

--
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