NetBSD Problem Report #51894
From www@NetBSD.org Sun Jan 15 21:34:27 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id EB9CE7A2BE
for <gnats-bugs@gnats.NetBSD.org>; Sun, 15 Jan 2017 21:34:27 +0000 (UTC)
Message-Id: <20170115213420.D61E57A2C3@mollari.NetBSD.org>
Date: Sun, 15 Jan 2017 21:34:20 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/lib/libc/ssp/h_read: various fixes
X-Send-Pr-Version: www-1.0
>Number: 51894
>Category: bin
>Synopsis: [PATCH] tests/lib/libc/ssp/h_read: various fixes
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jan 15 21:35:00 +0000 2017
>Closed-Date: Mon Jan 16 18:47:31 +0000 2017
>Last-Modified: Mon Jan 16 18:47:31 +0000 2017
>Originator: Ngie Cooper
>Release: 7.0.2
>Organization:
>Environment:
n/a
>Description:
- Use /dev/zero (_PATH_DEVZERO) instead of using/mangling `0` (stdin) -- IIRC the reasoning for this was that the test helper was hanging periodically on an older version of FreeBSD or when run by itself.
- Check the results of open/read and abort if they fail (this will still trigger the ssp edgecases). This is being done to resolve issues pointed out by Coverity.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51894: [PATCH] tests/lib/libc/ssp/h_read: various fixes
Date: Sun, 15 Jan 2017 13:35:29 -0800
--Apple-Mail=_B3231C21-B7C5-494D-8C4F-95756A4B3F20
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Patch attached.
-Ngie
--Apple-Mail=_B3231C21-B7C5-494D-8C4F-95756A4B3F20
Content-Disposition: attachment;
filename=h_read-various-fixes.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="h_read-various-fixes.patch"
Content-Transfer-Encoding: 7bit
Index: lib/libc/ssp/h_read.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/ssp/h_read.c,v
retrieving revision 1.1
diff -u -r1.1 h_read.c
--- lib/libc/ssp/h_read.c 27 Dec 2010 02:04:19 -0000 1.1
+++ lib/libc/ssp/h_read.c 15 Jan 2017 21:30:11 -0000
@@ -32,6 +32,8 @@
__RCSID("$NetBSD: h_read.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
#include <sys/param.h>
+#include <fcntl.h>
+#include <paths.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -40,8 +42,13 @@
main(int argc, char *argv[])
{
char b[MAXPATHLEN];
+ int fd, n;
size_t len = atoi(argv[1]);
- (void)read(0, b, len);
+
+ if ((fd = open(_PATH_DEVZERO, O_RDONLY)) == -1)
+ abort();
+ if ((n = read(fd, b, len)) == -1)
+ abort();
(void)printf("%s\n", b);
- return 0;
+ return (0);
}
--Apple-Mail=_B3231C21-B7C5-494D-8C4F-95756A4B3F20--
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51894 CVS commit: src/tests/lib/libc/ssp
Date: Mon, 16 Jan 2017 11:35:58 -0500
Module Name: src
Committed By: christos
Date: Mon Jan 16 16:35:57 UTC 2017
Modified Files:
src/tests/lib/libc/ssp: h_read.c
Log Message:
PR/51894: Ngie Cooper: Use /dev/zero to read instead of stdin
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/ssp/h_read.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Mon, 16 Jan 2017 18:47:31 +0000
State-Changed-Why:
christos committed it. thanks!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.