|
|
Descriptionnet: detect bad F_DUPFD_CLOEXEC on OS X 10.6
On 10.6, OS X's fcntl returns EBADF instead of EINVAL.
Patch Set 1 #Patch Set 2 : diff -r 0539958c11bb https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 0539958c11bb https://go.googlecode.com/hg/ #Patch Set 4 : diff -r 0539958c11bb https://go.googlecode.com/hg/ #Patch Set 5 : diff -r a14c507d13e9 https://go.googlecode.com/hg/ #Patch Set 6 : diff -r a14c507d13e9 https://go.googlecode.com/hg/ #Patch Set 7 : diff -r 50c9f3544eed https://go.googlecode.com/hg/ #MessagesTotal messages: 15
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
Sign in to reply to this message.
According to build.golang.org the call is failing with EBADF, so suppose we just try handling that the same way we handle EINVAL.
Sign in to reply to this message.
Maybe. But I don't want a real EBADF to neuter it for the lifetime of the process, especially on systems that aren't OS X 10.6. But maybe that can't happen. On Mon, Aug 5, 2013 at 5:23 PM, <iant@golang.org> wrote: > According to build.golang.org the call is failing with EBADF, so suppose > we just try handling that the same way we handle EINVAL. > > https://codereview.appspot.**com/12493043/<https://codereview.appspot.com/124... >
Sign in to reply to this message.
I'm getting off the bus soon here, so somebody else can fix this if it's urgent. On Mon, Aug 5, 2013 at 5:25 PM, Brad Fitzpatrick <bradfitz@golang.org>wrote: > Maybe. But I don't want a real EBADF to neuter it for the lifetime of the > process, especially on systems that aren't OS X 10.6. > > But maybe that can't happen. > > > > On Mon, Aug 5, 2013 at 5:23 PM, <iant@golang.org> wrote: > >> According to build.golang.org the call is failing with EBADF, so suppose >> we just try handling that the same way we handle EINVAL. >> >> https://codereview.appspot.**com/12493043/<https://codereview.appspot.com/124... >> > >
Sign in to reply to this message.
On Mon, Aug 5, 2013 at 5:25 PM, Brad Fitzpatrick <bradfitz@golang.org> wrote: > Maybe. But I don't want a real EBADF to neuter it for the lifetime of the > process, especially on systems that aren't OS X 10.6. > > But maybe that can't happen. I don't think it can happen in a normal program that isn't doing something broken like calling File() on a net.TCPListener that was closed. Ian > On Mon, Aug 5, 2013 at 5:23 PM, <iant@golang.org> wrote: >> >> According to build.golang.org the call is failing with EBADF, so suppose >> we just try handling that the same way we handle EINVAL. >> >> https://codereview.appspot.com/12493043/ > >
Sign in to reply to this message.
I have a darwin/386 system here, let me test. On 06/08/2013, at 10:25, Brad Fitzpatrick <bradfitz@golang.org> wrote: > Maybe. But I don't want a real EBADF to neuter it for the lifetime of the process, especially on systems that aren't OS X 10.6. > > But maybe that can't happen. > > > > On Mon, Aug 5, 2013 at 5:23 PM, <iant@golang.org> wrote: >> According to build.golang.org the call is failing with EBADF, so suppose >> we just try handling that the same way we handle EINVAL. >> >> https://codereview.appspot.com/12493043/ > > -- > > --- > You received this message because you are subscribed to the Google Groups "golang-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > >
Sign in to reply to this message.
I just booted my 10.6 machine. It was running pre-Go 1 go from Dec 21, 2011. But I can reproduce the failure now too. On Mon, Aug 5, 2013 at 6:29 PM, Dave Cheney <dave@cheney.net> wrote: > I have a darwin/386 system here, let me test. > > > > On 06/08/2013, at 10:25, Brad Fitzpatrick <bradfitz@golang.org> wrote: > > Maybe. But I don't want a real EBADF to neuter it for the lifetime of the > process, especially on systems that aren't OS X 10.6. > > But maybe that can't happen. > > > > On Mon, Aug 5, 2013 at 5:23 PM, <iant@golang.org> wrote: > >> According to build.golang.org the call is failing with EBADF, so suppose >> we just try handling that the same way we handle EINVAL. >> >> https://codereview.appspot.**com/12493043/<https://codereview.appspot.com/124... >> > > -- > > --- > You received this message because you are subscribed to the Google Groups > "golang-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > >
Sign in to reply to this message.
LGTM. Passes on my darwin/386 machine.
Sign in to reply to this message.
I downloaded http://www.opensource.apple.com/tarballs/xnu/xnu-1504.15.3.tar.gz (the kernel for 10.6 on my machine at least) and read bsd/kern/kern_descrip.c's fcntl_nocancel. Looks like we're hitting: default: /* * This is an fcntl() that we d not recognize at this level; * if this is a vnode, we send it down into the VNOP_IOCTL * for this vnode; this can include special devices, and will * effectively overload fcntl() to send ioctl()'s. */ if((uap->cmd & IOC_VOID) && (uap->cmd & IOC_INOUT)){ error = EINVAL; goto out; } if (fp->f_type != DTYPE_VNODE) { error = EBADF; goto out; } And sure enough, in xnu-1699 (for 10.7) and xnu-2050 (for 10.8), I see: switch (uap->cmd) { case F_DUPFD: case F_DUPFD_CLOEXEC: In any case, at least I understand the EBADF now. The 10.6 fcntl(2) manpage says nothing about that fallback-to-ioctl behavior, of course, nor the EBADF-on-bogus-cmd. On Mon, Aug 5, 2013 at 7:18 PM, <dave@cheney.net> wrote: > LGTM. Passes on my darwin/386 machine. > > https://codereview.appspot.**com/12493043/<https://codereview.appspot.com/124... >
Sign in to reply to this message.
Hello golang-dev@googlegroups.com, iant@golang.org, dave@cheney.net (cc: golang-dev@googlegroups.com), Please take another look.
Sign in to reply to this message.
PTAL. Slightly tweaked, no more init func, and better comment. On Mon, Aug 5, 2013 at 8:58 PM, <bradfitz@golang.org> wrote: > Hello golang-dev@googlegroups.com, iant@golang.org, dave@cheney.net (cc: > golang-dev@googlegroups.com), > > Please take another look. > > > https://codereview.appspot.**com/12493043/<https://codereview.appspot.com/124... >
Sign in to reply to this message.
Testing now. On 06/08/2013, at 13:59, Brad Fitzpatrick <bradfitz@golang.org> wrote: > PTAL. Slightly tweaked, no more init func, and better comment. > > > > On Mon, Aug 5, 2013 at 8:58 PM, <bradfitz@golang.org> wrote: >> Hello golang-dev@googlegroups.com, iant@golang.org, dave@cheney.net (cc: >> golang-dev@googlegroups.com), >> >> Please take another look. >> >> >> https://codereview.appspot.com/12493043/ >
Sign in to reply to this message.
LGTM
Sign in to reply to this message.
LGTM. Thanks.
Sign in to reply to this message.
*** Submitted as https://code.google.com/p/go/source/detail?r=2585605c42c0 *** net: detect bad F_DUPFD_CLOEXEC on OS X 10.6 On 10.6, OS X's fcntl returns EBADF instead of EINVAL. R=golang-dev, iant, dave CC=golang-dev https://codereview.appspot.com/12493043
Sign in to reply to this message.
|