Spam detection software, running on the system "mail-gray.research.att.com", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: Glenn, should F_dupfd_cloexec not be intercepted in libast,
by an _ast_fcntl() (libshell calling fcntl() intercepted by sh_fcntl()
intercepted
by ast_fcntl())? Olga On Fri, Sep 7, 2012 at 3:47 PM, Irek Szczesniak wrote:
> On Fri, Sep 7, 2012 at 3:14 PM, Irek Szczesniak wrote: >> On Fri, Sep 7,
2012 at 2:53 PM, Irek Szczesniak wrote: >>> On Fri, Sep 7, 2012 at 1:47 PM,
Irek Szczesniak wrote: >>>> David, I've tried the new ast-ksh.20120831
yesterday
and hit these >>>> errors when running the alias.sh tests on Solaris 11:
>>>> ./src/cmd/ksh93/tests/shtests: line 307: write to 1 failed [Bad file
number] >>>> ./src/cmd/ksh93/tests/shtests: line 307: open file limit exceeded
[Bad >>>> file number] >>>> >>>> truss reports that the fd 1 is closed
immediately
after the open() in >>>> the shtests process (the process running alias.sh
is not involved): >>>> 23914:
open("/home/irek/work/ksh/astksh20120831/build/arch/sol11.i386-64/src/cmd/ksh93/.paths",
>>>> O_RDONLY) Err#2 ENOENT >>>> 23914: open("/bin/.paths", O_RDONLY) Err#2
ENOENT >>>> 23914: close(12) = 0 >>>> 23914: close(1) = 0 >>>> 23914:
open("/tmp/test001/sf34.c85",
O_RDWR|O_CREAT|O_EXCL, 0666) = 1 >>>> 23914: close(1) = 0 >>>> 23914:
close(4)
= 0 >>>> 23914: close(1) = 0 >>>> 23914: read(3, " 2 4\n", 8192) = 3 >>>>
23914: read(3, 0xFFFFFD7FFFDFB490, 8192) = 0 >>>> 23914: close(3) = 0 >>>>
23914: open("/usr/lib/locale/en_US.UTF-8/LC_MESSAGES/SUNW_OST_OSLIB.mo",
>>>> O_RDONLY) Err#2 ENOENT >>>> 23914: write(1, " 2 4\n", 3) Err#9 EBADF
>>>> 23914: write(2, " . / s r c / c m d / k s".., 77) = 77 >>>> 23914:
close(11)
= 0 >>>> >>>> Any quick or dirty cure would be appreciated. >>> >>> I can't
reproduce the problem with ast-ksh.20120824. >> >> This fails: >>
./arch/sol11.i386\-64/bin/ksh
-c 'x=$( /bin/true ; true ; )'' >> ./arch/sol11.i386-64/bin/ksh: open file
limit exceeded [Bad file number] >> >> This does not fail: >>
./arch/sol11.i386\-64/bin/ksh
-c 'x=${ /bin/true ; true ; }'' >> >> truss reports some suspicious syscalls:
>> fcntl(1, 4294967197, 0x0000000A) Err#22 EINVAL >> fcntl(4294967295,
F_SETFD,
0x00000001) Err#9 EBADF >> [...]
Content analysis details: (4.7 points, 4.5 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
provider
(olga.kryzhanovska[at]gmail.com)
0.8 SPF_NEUTRAL SPF: sender does not match SPF record (neutral)
3.2 CHARSET_FARAWAY_HEADER A foreign language charset used in headers
0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60%
[score: 0.5000]
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
author's
domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
valid
--- Begin Message ---
Glenn, should F_dupfd_cloexec not be intercepted in libast, by an
_ast_fcntl() (libshell calling fcntl() intercepted by sh_fcntl()
intercepted by ast_fcntl())?
Olga
On Fri, Sep 7, 2012 at 3:47 PM, Irek Szczesniak <iszczesn...@gmail.com> wrote:
> On Fri, Sep 7, 2012 at 3:14 PM, Irek Szczesniak <iszczesn...@gmail.com> wrote:
>> On Fri, Sep 7, 2012 at 2:53 PM, Irek Szczesniak <iszczesn...@gmail.com>
>> wrote:
>>> On Fri, Sep 7, 2012 at 1:47 PM, Irek Szczesniak <iszczesn...@gmail.com>
>>> wrote:
>>>> David, I've tried the new ast-ksh.20120831 yesterday and hit these
>>>> errors when running the alias.sh tests on Solaris 11:
>>>> ./src/cmd/ksh93/tests/shtests: line 307: write to 1 failed [Bad file
>>>> number]
>>>> ./src/cmd/ksh93/tests/shtests: line 307: open file limit exceeded [Bad
>>>> file number]
>>>>
>>>> truss reports that the fd 1 is closed immediately after the open() in
>>>> the shtests process (the process running alias.sh is not involved):
>>>> 23914:
>>>> open("/home/irek/work/ksh/astksh20120831/build/arch/sol11.i386-64/src/cmd/ksh93/.paths",
>>>> O_RDONLY) Err#2 ENOENT
>>>> 23914: open("/bin/.paths", O_RDONLY) Err#2 ENOENT
>>>> 23914: close(12) = 0
>>>> 23914: close(1) = 0
>>>> 23914: open("/tmp/test001/sf34.c85", O_RDWR|O_CREAT|O_EXCL, 0666) = 1
>>>> 23914: close(1) = 0
>>>> 23914: close(4) = 0
>>>> 23914: close(1) = 0
>>>> 23914: read(3, " 2 4\n", 8192) = 3
>>>> 23914: read(3, 0xFFFFFD7FFFDFB490, 8192) = 0
>>>> 23914: close(3) = 0
>>>> 23914: open("/usr/lib/locale/en_US.UTF-8/LC_MESSAGES/SUNW_OST_OSLIB.mo",
>>>> O_RDONLY) Err#2 ENOENT
>>>> 23914: write(1, " 2 4\n", 3) Err#9 EBADF
>>>> 23914: write(2, " . / s r c / c m d / k s".., 77) = 77
>>>> 23914: close(11) = 0
>>>>
>>>> Any quick or dirty cure would be appreciated.
>>>
>>> I can't reproduce the problem with ast-ksh.20120824.
>>
>> This fails:
>> ./arch/sol11.i386\-64/bin/ksh -c 'x=$( /bin/true ; true ; )''
>> ./arch/sol11.i386-64/bin/ksh: open file limit exceeded [Bad file number]
>>
>> This does not fail:
>> ./arch/sol11.i386\-64/bin/ksh -c 'x=${ /bin/true ; true ; }''
>>
>> truss reports some suspicious syscalls:
>> fcntl(1, 4294967197, 0x0000000A) Err#22 EINVAL
>> fcntl(4294967295, F_SETFD, 0x00000001) Err#9 EBADF
>> close(1) = 0
>>
>> My guess is that the new emulation for F_DUPFD_CLOEXEC is not
>> intercepted properly.
>>
>> OS is Opensolaris 2011.05 (an early version of Solaris 11), which
>> didn't have F_DUPFD_CLOEXEC
>
> Patch below.
>
> src/lib/libast/misc/procopen.c still has an unresolved "if ((m->save =
> fcntl(arg2, F_dupfd_cloexec, 3)) < 0" and there are numerous cases of
> sh_fcntl(fd,F_dupfd_cloexec,...) followed by
> fcntl(fd,F_SETFD,FD_CLOEXEC)
>
> diff -r -u src/cmd/ksh93/edit/history.c src/cmd/ksh93/edit/history.c
> --- src/cmd/ksh93/edit/history.c Tue Aug 28 15:58:07 2012
> +++ src/cmd/ksh93/edit/history.c Fri Sep 7 15:22:37 2012
> @@ -151,7 +151,7 @@
> (unsigned)acctfd < 10)
> {
> int n;
> - if((n = fcntl(acctfd, F_dupfd_cloexec, 10)) >= 0)
> + if((n = sh_fcntl(acctfd, F_dupfd_cloexec, 10)) >= 0)
> {
> sh_close(acctfd);
> acctfd = n;
> @@ -269,7 +269,7 @@
> if((unsigned)fd <=2)
> {
> int n;
> - if((n=fcntl(fd,F_dupfd_cloexec,10))>=0)
> + if((n=sh_fcntl(fd,F_dupfd_cloexec,10))>=0)
> {
> sh_close(fd);
> fd=n;
> @@ -1194,7 +1194,7 @@
> sh_close(oldfd=sffileno(fp));
>
> if((newfd=open(hp->histname,O_BINARY|O_APPEND|O_CREAT|O_RDWR|O_cloexec,S_IRUSR|S_IWUSR))
>>= 0)
> {
> - if(fcntl(newfd, F_dupfd_cloexec, oldfd) !=oldfd)
> + if(sh_fcntl(newfd, F_dupfd_cloexec, oldfd) !=oldfd)
> return(-1);
> fcntl(oldfd,F_SETFD,FD_CLOEXEC);
> close(newfd);
> diff -r -u src/cmd/ksh93/sh/path.c src/cmd/ksh93/sh/path.c
> --- src/cmd/ksh93/sh/path.c Tue Aug 28 16:09:27 2012
> +++ src/cmd/ksh93/sh/path.c Fri Sep 7 15:21:40 2012
> @@ -1296,7 +1296,7 @@
> if(n!=10)
> {
> sh_close(10);
> - fcntl(n, F_dupfd_cloexec, 10);
> + sh_fcntl(n, F_dupfd_cloexec, 10);
> sh_close(n);
> n=10;
> }
> diff -r -u src/cmd/ksh93/sh/xec.c src/cmd/ksh93/sh/xec.c
> --- src/cmd/ksh93/sh/xec.c Tue Aug 28 16:23:11 2012
> +++ src/cmd/ksh93/sh/xec.c Fri Sep 7 15:20:56 2012
> @@ -122,7 +122,7 @@
> return(0);
> usepipe++;
> fcntl(subpipe[0],F_SETFD,FD_CLOEXEC);
> - subpipe[2] = fcntl(1,F_dupfd_cloexec,10);
> + subpipe[2] = sh_fcntl(1,F_dupfd_cloexec,10);
> fcntl(subpipe[2],F_SETFD,FD_CLOEXEC);
> shp->fdstatus[subpipe[2]] = shp->fdstatus[1];
> while(close(1)<0 && errno==EINTR)
> @@ -3392,7 +3392,7 @@
> sh_pipe(shp->cpipe);
> if((outfd=shp->cpipe[1]) < 10)
> {
> - int fd=fcntl(shp->cpipe[1],F_dupfd_cloexec,10);
> + int fd=sh_fcntl(shp->cpipe[1],F_dupfd_cloexec,10);
> if(fd>=10)
> {
> shp->fdstatus[fd] =
> (shp->fdstatus[outfd]&~IOCLEX);
>
> Irek
> _______________________________________________
> ast-developers mailing list
> ast-developers@research.att.com
> https://mailman.research.att.com/mailman/listinfo/ast-developers
--
, _ _ ,
{ \/`o;====- Olga Kryzhanovska -====;o`\/ }
.----'-/`-/ olga.kryzhanov...@gmail.com \-`\-'----.
`'-..-| / http://twitter.com/fleyta \ |-..-'`
/\/\ Solaris/BSD//C/C++ programmer /\/\
`--` `--`
--- End Message ---
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers