From owner-svn-src-all@freebsd.org Sun Sep 4 16:05:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70936A9DAAF; Sun, 4 Sep 2016 16:05:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0085FC5D; Sun, 4 Sep 2016 16:05:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x22c.google.com with SMTP id 1so101051045wmz.1; Sun, 04 Sep 2016 09:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WnFMQ9yEeX41srBWF7V9jeXV2AZkyx71Qj/lDXnUExQ=; b=sQQ9yoaSo/kDXt/o9FNp41+/tedCG0kT48ibDzxRJxIuuL7IGO1hPl5JPjMwD+TOzG YpaLarV0ogs4MPi217OgxN8+M5wfY89mgqJvSSfWp7H4ypaTeYa4OB55d4f+2IWtcIk/ 0D3seIXvFE8JKI3NfyTpZp5MBy3qJPznRMIYQO+aWdJ10Qvjkvihoi0UmkfGEwjhzV+4 sTVs19SWneBVMQJzAhd4mo08zwnpeymsOnBXu0k73J8b4Aq+Uw+7BK3zJwmOCoh8yOAM lTxeilvXOQ+w1bQjauNgWaITsdt+GaVAMJQWF2M+FHW2w69AX4tR6S/WIAbMKmnUfHTJ NHhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WnFMQ9yEeX41srBWF7V9jeXV2AZkyx71Qj/lDXnUExQ=; b=eSkfmvDAiFpxfCdXckOko2HHdmIwEcLvKcZzc6qOYaX5xZzqU858LqTWeQht3PkslS ZyUtFlQretfFr+u5BEtA+CdRu3dRYQ7T4LOJGxUI5ng00kxdjhaT8hvfXCCmi2FpCHrV n5GE/C5aM5tvtO7rijc+O6ugA9rhh4iXhH1TsaVH36CgMOkYUAIcmI7LwO8l9vxV5TzX bS1BJk1oRsUMcGyzZWouTwdKKVdkgg+bRAGQXxk7OUP2CGFo/AfjyWyWxYEtu7pCh75w 6R+r1HasiR/oWOzY1/uGZCVYD8Lfix8jBkCbyqmSbRcXgYTMN7rNuWoMoCZMmdpcx4yR eDdA== X-Gm-Message-State: AE9vXwOiLvNsW7dWj0k1dPCpSgH2rSvjyVVZF2RvV9bRg66jgb7bAud2VFpm9oAp47YIUQ== X-Received: by 10.194.112.233 with SMTP id it9mr4358546wjb.176.1473005150958; Sun, 04 Sep 2016 09:05:50 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id u7sm13949263wmf.8.2016.09.04.09.05.49 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 04 Sep 2016 09:05:50 -0700 (PDT) Date: Sun, 4 Sep 2016 18:05:48 +0200 From: Mateusz Guzik To: Conrad Meyer Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305383 - head/sys/sys Message-ID: <20160904160547.GD25473@dft-labs.eu> References: <201609041331.u84DVwIX061144@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 16:05:53 -0000 On Sun, Sep 04, 2016 at 09:00:38AM -0700, Conrad Meyer wrote: > Do you know which revision this was introduced (i.e. what revision > range should be avoided)? The most relevant commit seems to be > r305093 but I'm not sure how that would have broken this (nothing in > that diff was checking fde_file before). > The problem was present since r305093 to this very commit. The problem affects weird programs which do F_GETFD to see if they got given fd installed, like bash. Prior to r305093 they would get EBADF. But due to incorrect test in fdeget_locked, they would get 0 instead. > Best, > Conrad > > On Sun, Sep 4, 2016 at 6:31 AM, Mateusz Guzik wrote: > > Author: mjg > > Date: Sun Sep 4 13:31:57 2016 > > New Revision: 305383 > > URL: https://svnweb.freebsd.org/changeset/base/305383 > > > > Log: > > fd: fix up fdeget_file > > > > It was supposed to return NULL if a fp is not installed. > > > > Facepalm-by: mjg > > > > Modified: > > head/sys/sys/filedesc.h > > > > Modified: head/sys/sys/filedesc.h > > ============================================================================== > > --- head/sys/sys/filedesc.h Sun Sep 4 12:22:14 2016 (r305382) > > +++ head/sys/sys/filedesc.h Sun Sep 4 13:31:57 2016 (r305383) > > @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd > > static __inline struct filedescent * > > fdeget_locked(struct filedesc *fdp, int fd) > > { > > + struct filedescent *fde; > > > > FILEDESC_LOCK_ASSERT(fdp); > > > > if (fd < 0 || fd > fdp->fd_lastfile) > > return (NULL); > > > > - return (&fdp->fd_ofiles[fd]); > > + fde = &fdp->fd_ofiles[fd]; > > + if (fde->fde_file == NULL) > > + return (NULL); > > + > > + return (fde); > > } > > > > static __inline bool > > -- Mateusz Guzik