Re: bin/149130: grdc(6) stops after n/2 seconds
Synopsis: grdc(6) stops after n/2 seconds Responsible-Changed-From-To: freebsd-bugs->uqs Responsible-Changed-By: uqs Responsible-Changed-When: Sat Jul 31 11:07:06 UTC 2010 Responsible-Changed-Why: I'll take it. http://www.freebsd.org/cgi/query-pr.cgi?pr=149130 ___ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"
Re: bin/139345: commit references a PR
The following reply was made to PR bin/139345; it has been noted by GNATS. From: dfil...@freebsd.org (dfilter service) To: bug-follo...@freebsd.org Cc: Subject: Re: bin/139345: commit references a PR Date: Sat, 31 Jul 2010 14:30:22 + (UTC) Author: kib Date: Sat Jul 31 14:30:11 2010 New Revision: 210679 URL: http://svn.freebsd.org/changeset/base/210679 Log: Report the time left for the sleep on SIGINFO. Be stricter in the checking of interval specification. PR: bin/139345 MFC after: 3 weeks Modified: head/bin/sleep/sleep.c Modified: head/bin/sleep/sleep.c == --- head/bin/sleep/sleep.c Sat Jul 31 14:26:10 2010(r210678) +++ head/bin/sleep/sleep.c Sat Jul 31 14:30:11 2010(r210679) @@ -42,26 +42,34 @@ static char sccsid[] = "@(#)sleep.c8.3 __FBSDID("$FreeBSD$"); #include +#include #include +#include #include #include #include #include -void usage(void); +static void usage(void); + +static volatile sig_atomic_t report_requested; +static void +report_request(int signo __unused) +{ + + report_requested = 1; +} int main(int argc, char *argv[]) { struct timespec time_to_sleep; - long l; + long l, original; int neg; char *p; - if (argc != 2) { + if (argc != 2) usage(); - return(1); - } p = argv[1]; @@ -74,10 +82,8 @@ main(int argc, char *argv[]) if (*p == '-') { neg = 1; ++p; - if (!isdigit((unsigned char)*p) && *p != '.') { + if (!isdigit((unsigned char)*p) && *p != '.') usage(); - return(1); - } } else if (*p == '+') ++p; @@ -85,13 +91,13 @@ main(int argc, char *argv[]) /* Calculate seconds. */ if (isdigit((unsigned char)*p)) { l = strtol(p, &p, 10); - if (l > INT_MAX) { - /* - * Avoid overflow when `seconds' is huge. This assumes - * that the maximum value for a time_t is <= INT_MAX. - */ + + /* + * Avoid overflow when `seconds' is huge. This assumes + * that the maximum value for a time_t is <= INT_MAX. + */ + if (l > INT_MAX) l = INT_MAX; - } } else l = 0; time_to_sleep.tv_sec = (time_t)l; @@ -110,16 +116,38 @@ main(int argc, char *argv[]) } while (l); } - if (!neg && (time_to_sleep.tv_sec > 0 || time_to_sleep.tv_nsec > 0)) - (void)nanosleep(&time_to_sleep, (struct timespec *)NULL); + /* Skip over the trailing whitespace. */ + while (isspace((unsigned char)*p)) + ++p; + if (*p != '\0') + usage(); + + signal(SIGINFO, report_request); + if (!neg && (time_to_sleep.tv_sec > 0 || time_to_sleep.tv_nsec > 0)) { + original = time_to_sleep.tv_sec; + while (nanosleep(&time_to_sleep, &time_to_sleep) != 0) { + if (report_requested) { + /* + * Reporting does not bother with + * fractions of a second... + */ + warnx("about %ld second(s) left" + " out of the original %ld", + time_to_sleep.tv_sec, original); + report_requested = 0; + } else + break; + } + } - return(0); + return (0); } -void +static void usage(void) { - const char msg[] = "usage: sleep seconds\n"; + static const char msg[] = "usage: sleep seconds\n"; write(STDERR_FILENO, msg, sizeof(msg) - 1); + exit(1); } ___ svn-src-...@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org" ___ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"
bin/149152: [patch] BSD grep loops with EISDIR trying to read a directory
>Number: 149152 >Category: bin >Synopsis: [patch] BSD grep loops with EISDIR trying to read a directory >Confidential: no >Severity: serious >Priority: low >Responsible:freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jul 31 15:10:04 UTC 2010 >Closed-Date: >Last-Modified: >Originator: pluknet >Release:HEAD r210642 >Organization: >Environment: FreeBSD foo 9.0-CURRENT FreeBSD 9.0-CURRENT #36: Fri Jul 23 10:30:36 UTC 2010 r...@foo:/usr/obj/usr/src/sys/GENERIC amd64 >Description: BSD grep used in -CURRENT loops when it gets a directory as a file argument for grepping. grep open()'s a dir, stat()'s that dir, and do a read() on that dir in an endless loop. It seems that grep has no enough error handling. >How-To-Repeat: Loop easily reproducible. Try this (on -CURRENT sources): grep IP_FW_GET /sys/netinet/ipfw*; or grep IP_FW_GET /sys/netinet/ip*; or grep IP_FW_GET /sys/netinet/* That will produce something like this: [...] 41740 grep CALL stat(0x7fffe6d4,0x7fffda50) 41740 grep NAMI "/sys/netinet/ipfw" 41740 grep STRU struct stat {dev=67174149, ino=47296976, mode=drwxr-xr-x , nlink=4, uid=0, gid=0, rdev=94607662, atime=1276302257, stime=1279007706, ctime=1279007706, birthtime=-1, size=1024, blksize=4096, blocks=4, flags=0x0 } 41740 grep RET stat 0 41740 grep CALL open(0x7fffe6d4,O_RDONLY,0x1b6) 41740 grep NAMI "/sys/netinet/ipfw" 41740 grep RET open 3 41740 grep CALL stat(0x507300,0x7fffd860) 41740 grep NAMI "/sys/netinet/ipfw" 41740 grep STRU struct stat {dev=67174149, ino=47296976, mode=drwxr-xr-x , nlink=4, uid=0, gid=0, rdev=94607662, atime=1276302257, stime=1279007706, ctime=1279007706, birthtime=-1, size=1024, blksize=4096, blocks=4, flags=0x0 } 41740 grep RET stat 0 41740 grep CALL fstat(0x3,0x7fffd730) 41740 grep STRU struct stat {dev=67174149, ino=47296976, mode=drwxr-xr-x , nlink=4, uid=0, gid=0, rdev=94607662, atime=1276302257, stime=1279007706, ctime=1279007706, birthtime=-1, size=1024, blksize=4096, blocks=4, flags=0x0 } 41740 grep RET fstat 0 41740 grep CALL read(0x3,0x800c38000,0x1000) 41740 grep RET read -1 errno 21 Is a directory 41740 grep CALL read(0x3,0x800c38000,0x1000) 41740 grep RET read -1 errno 21 Is a directory 41740 grep CALL read(0x3,0x800c38000,0x1000) 41740 grep RET read -1 errno 21 Is a directory 41740 grep CALL read(0x3,0x800c38000,0x1000) 41740 grep RET read -1 errno 21 Is a directory 41740 grep CALL read(0x3,0x800c38000,0x1000) 41740 grep RET read -1 errno 21 Is a directory 41740 grep CALL read(0x3,0x800c38000,0x1000) 41740 grep RET read -1 errno 21 Is a directory 41740 grep CALL read(0x3,0x800c38000,0x1000) 41740 grep RET read -1 errno 21 Is a directory 41740 grep CALL read(0x3,0x800c38000,0x1000) 41740 grep RET read -1 errno 21 Is a directory 41740 grep CALL read(0x3,0x800c38000,0x1000) [...] >Fix: This is a sort of concept to demonstrate a possible way to handle around the issue. Patch attached with submission follows: Index: file.c === --- file.c (revision 210642) +++ file.c (working copy) @@ -164,9 +164,12 @@ lnbuflen *= 2; lnbuf = grep_realloc(lnbuf, ++lnbuflen); } - if ((ch == '\n') || (ch == EOF)) { + if ((ch == '\n') || (ch == EOF && errno != EISDIR)) { lnbuf[i] = '\0'; break; + } else if (ch == EOF && errno == EISDIR) { + lnbuf[i] = '\0'; + return (NULL); /* XXX unclear why '\0' doesn't work */ } else lnbuf[i] = ch; } >Release-Note: >Audit-Trail: >Unformatted: ___ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"
Re: bin/149152: [patch] grep(1): BSD grep loops with EISDIR trying to read a directory
Old Synopsis: [patch] BSD grep loops with EISDIR trying to read a directory New Synopsis: [patch] grep(1): BSD grep loops with EISDIR trying to read a directory Responsible-Changed-From-To: freebsd-bugs->gabor Responsible-Changed-By: linimon Responsible-Changed-When: Sat Jul 31 20:16:41 UTC 2010 Responsible-Changed-Why: Over to maintainer. http://www.freebsd.org/cgi/query-pr.cgi?pr=149152 ___ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"
kern/149168: Linux sendmsg / recvmsg / etc fixes for pulseaudio
>Number: 149168 >Category: kern >Synopsis: Linux sendmsg / recvmsg / etc fixes for pulseaudio >Confidential: no >Severity: non-critical >Priority: low >Responsible:freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Aug 01 04:30:04 UTC 2010 >Closed-Date: >Last-Modified: >Originator: John Wehle >Release:8.1 >Organization: >Environment: FreeBSD wagner.FEITH.COM 8.1-RC2 FreeBSD 8.1-RC2 #0: Thu Jul 29 03:35:35 EDT 2010 r...@wagner.feith.com:/usr/obj/usr/src/sys/CUSTOM i386 >Description: The enclosed lightly tested patch extends the Linux emulation so that pulseaudio runs. Specifically tested: a) Fedora 10 paplay (client) talking to FreeBSD 8.1 pulseaudio (server) over both TCP and UNIX domain sockets. b) FreeBSD 8.1 paplay (client) talking to Fedora 10 pulseaudio (server) over both TCP and UNIX domain sockets. c) Fedora 10 paplay (client) talking to Fedora 10 pulseaudio (server) over both TCP and UNIX domain sockets. Changes: 1) Implement NO-OP stubs for capget, capset, prctl PR_GET_KEEPCAPS, and prctl PR_SET_KEEPCAPS so that the pulseaudio server will start. 2) Added SCM_CREDS support to sendmsg and recvmsg. 3) Modify sendmsg to ignore control messages if not using UNIX domain sockets. >How-To-Repeat: Install the Fedora 10 pulseaudio client / server software and try using paplay. >Fix: Patch attached with submission follows: --- ./compat/linux/linux_misc.h.ORIGINAL2010-06-13 22:09:06.0 -0400 +++ ./compat/linux/linux_misc.h 2010-07-31 23:33:18.0 -0400 @@ -37,6 +37,8 @@ * Second arg is a ptr to return the * signal. */ +#defineLINUX_PR_GET_KEEPCAPS 7 /* Get drop capabilities on setuid */ +#defineLINUX_PR_SET_KEEPCAPS 8 /* Set drop capabilities on setuid */ #defineLINUX_PR_SET_NAME 15 /* Set process name. */ #defineLINUX_PR_GET_NAME 16 /* Get process name. */ --- ./compat/linux/linux_misc.c.ORIGINAL2010-06-13 22:09:06.0 -0400 +++ ./compat/linux/linux_misc.c 2010-07-31 00:09:16.0 -0400 @@ -1733,6 +1733,87 @@ linux_exit_group(struct thread *td, stru return (0); } +#define _LINUX_CAPABILITY_VERSION 0x19980330 + +struct l_user_cap_header { + l_int version; + l_int pid; +}; + +struct l_user_cap_data { + l_int effective; + l_int permitted; + l_int inheritable; +}; + +int +linux_capget(struct thread *td, struct linux_capget_args *args) +{ + struct l_user_cap_header luch; + struct l_user_cap_data lucd; + int error; + + if (! args->hdrp) + return (EFAULT); + + error = copyin(args->hdrp, &luch, sizeof(luch)); + if (error != 0) + return (error); + + if (luch.version != _LINUX_CAPABILITY_VERSION) { + luch.version = _LINUX_CAPABILITY_VERSION; + error = copyout(&luch, args->hdrp, sizeof(luch)); + if (error) + return (error); + return (EINVAL); + } + + if (luch.pid) + return (EPERM); + + if (args->datap) { + bzero (&lucd, sizeof(lucd)); + error = copyout(&lucd, args->datap, sizeof(lucd)); + } + + return (error); +} + +int +linux_capset(struct thread *td, struct linux_capset_args *args) +{ + struct l_user_cap_header luch; + struct l_user_cap_data lucd; + int error; + + if (! args->hdrp || ! args->datap) + return (EFAULT); + + error = copyin(args->hdrp, &luch, sizeof(luch)); + if (error != 0) + return (error); + + if (luch.version != _LINUX_CAPABILITY_VERSION) { + luch.version = _LINUX_CAPABILITY_VERSION; + error = copyout(&luch, args->hdrp, sizeof(luch)); + if (error) + return (error); + return (EINVAL); + } + + if (luch.pid) + return (EPERM); + + error = copyin(args->datap, &lucd, sizeof(lucd)); + if (error != 0) + return (error); + + if (lucd.effective || lucd.permitted || lucd.inheritable) + return (EPERM); + + return (0); +} + int linux_prctl(struct thread *td, struct linux_prctl_args *args) { @@ -1766,6 +1847,11 @@ linux_prctl(struct thread *td, struct li (void *)(register_t)args->arg2, sizeof(pdeath_signal)); break; + case LINUX_PR_GET_KEEPCAPS: + td->td_retval[0] = 0; + break; + case LINUX_PR_SET_KEEPCAPS: + break; case LINUX_PR_SET_NAME: