From owner-svn-src-stable-10@freebsd.org Sun May 22 20:44:12 2016 Return-Path: Delivered-To: svn-src-stable-10@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 6BE44B45751; Sun, 22 May 2016 20:44:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DCB61302; Sun, 22 May 2016 20:44:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MKiBCD022930; Sun, 22 May 2016 20:44:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MKiB6D022929; Sun, 22 May 2016 20:44:11 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201605222044.u4MKiB6D022929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 22 May 2016 20:44:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300437 - stable/10/etc/defaults X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 May 2016 20:44:12 -0000 Author: rmacklem Date: Sun May 22 20:44:11 2016 New Revision: 300437 URL: https://svnweb.freebsd.org/changeset/base/300437 Log: MFC: r299242 Make "-S" a default option for mountd. After a discussion on freebsd-fs@ there seemed to be a consensus that the "-S" option for mountd should become the default. Since the only known issue w.r.t. using "-S" was fixed by r299201, this commit adds "-S" to the default mountd_flags. Modified: stable/10/etc/defaults/rc.conf Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/defaults/rc.conf ============================================================================== --- stable/10/etc/defaults/rc.conf Sun May 22 20:31:52 2016 (r300436) +++ stable/10/etc/defaults/rc.conf Sun May 22 20:44:11 2016 (r300437) @@ -332,7 +332,7 @@ oldnfs_server_enable="NO" # Run the old nfs_server_flags="-u -t" # Flags to nfsd (if enabled). nfs_server_managegids="NO" # The NFS server maps gids for AUTH_SYS (or NO). mountd_enable="NO" # Run mountd (or NO). -mountd_flags="-r" # Flags to mountd (if NFS server enabled). +mountd_flags="-r -S" # Flags to mountd (if NFS server enabled). weak_mountd_authentication="NO" # Allow non-root mount requests to be served. nfs_reserved_port_only="NO" # Provide NFS only on secure port (or NO). nfs_bufpackets="" # bufspace (in packets) for client From owner-svn-src-stable-10@freebsd.org Mon May 23 00:58:54 2016 Return-Path: Delivered-To: svn-src-stable-10@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 364EEB454BD; Mon, 23 May 2016 00:58:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1AB516A4; Mon, 23 May 2016 00:58:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N0wq1k098402; Mon, 23 May 2016 00:58:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N0wqsL098400; Mon, 23 May 2016 00:58:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605230058.u4N0wqsL098400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 23 May 2016 00:58:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300441 - in stable/10/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 00:58:54 -0000 Author: kib Date: Mon May 23 00:58:52 2016 New Revision: 300441 URL: https://svnweb.freebsd.org/changeset/base/300441 Log: MFC r300305, r300332: Check for overflow and return EINVAL if detected. Use unsigned index. Modified: stable/10/sys/amd64/amd64/sys_machdep.c stable/10/sys/i386/i386/sys_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/sys_machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/sys_machdep.c Sun May 22 23:28:23 2016 (r300440) +++ stable/10/sys/amd64/amd64/sys_machdep.c Mon May 23 00:58:52 2016 (r300441) @@ -334,18 +334,20 @@ amd64_set_ioperm(td, uap) struct thread *td; struct i386_ioperm_args *uap; { - int i, error; char *iomap; struct amd64tss *tssp; struct system_segment_descriptor *tss_sd; u_long *addr; struct pcb *pcb; + u_int i; + int error; if ((error = priv_check(td, PRIV_IO)) != 0) return (error); if ((error = securelevel_gt(td->td_ucred, 0)) != 0) return (error); - if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY) + if (uap->start > uap->start + uap->length || + uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY) return (EINVAL); /* Modified: stable/10/sys/i386/i386/sys_machdep.c ============================================================================== --- stable/10/sys/i386/i386/sys_machdep.c Sun May 22 23:28:23 2016 (r300440) +++ stable/10/sys/i386/i386/sys_machdep.c Mon May 23 00:58:52 2016 (r300441) @@ -344,8 +344,9 @@ i386_set_ioperm(td, uap) struct thread *td; struct i386_ioperm_args *uap; { - int i, error; char *iomap; + u_int i; + int error; if ((error = priv_check(td, PRIV_IO)) != 0) return (error); @@ -363,7 +364,8 @@ i386_set_ioperm(td, uap) return (error); iomap = (char *)td->td_pcb->pcb_ext->ext_iomap; - if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY) + if (uap->start > uap->start + uap->length || + uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY) return (EINVAL); for (i = uap->start; i < uap->start + uap->length; i++) { From owner-svn-src-stable-10@freebsd.org Mon May 23 04:47:25 2016 Return-Path: Delivered-To: svn-src-stable-10@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 DD46CB46294; Mon, 23 May 2016 04:47:25 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA620117A; Mon, 23 May 2016 04:47:25 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N4lOxl074959; Mon, 23 May 2016 04:47:24 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N4lOpg074958; Mon, 23 May 2016 04:47:24 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230447.u4N4lOpg074958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 04:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300449 - stable/10/usr.sbin/config X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 04:47:26 -0000 Author: truckman Date: Mon May 23 04:47:24 2016 New Revision: 300449 URL: https://svnweb.freebsd.org/changeset/base/300449 Log: MFC r299893 Don't free fnamebuf before we calling cfgfile_add(). This changes a use-after-free error into a minor memory leak. Reported by: Coverity CID: 1006084 Modified: stable/10/usr.sbin/config/lang.l Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/config/lang.l ============================================================================== --- stable/10/usr.sbin/config/lang.l Mon May 23 04:17:27 2016 (r300448) +++ stable/10/usr.sbin/config/lang.l Mon May 23 04:47:24 2016 (r300449) @@ -267,7 +267,8 @@ include(const char *fname, int ateof) asprintf(&fnamebuf, "../../conf/%s", fname); if (fnamebuf != NULL) { fp = fopen(fnamebuf, "r"); - free(fnamebuf); + if (fp == NULL) + free(fnamebuf); } } if (fp == NULL) { @@ -275,10 +276,10 @@ include(const char *fname, int ateof) asprintf(&fnamebuf, "%s/%s", ipath->path, fname); if (fnamebuf != NULL) { fp = fopen(fnamebuf, "r"); - free(fnamebuf); } if (fp != NULL) break; + free(fnamebuf); } } if (fp == NULL) { From owner-svn-src-stable-10@freebsd.org Mon May 23 04:50:02 2016 Return-Path: Delivered-To: svn-src-stable-10@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 4A9EAB46379; Mon, 23 May 2016 04:50:02 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A1221499; Mon, 23 May 2016 04:50:02 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N4o1o0075120; Mon, 23 May 2016 04:50:01 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N4o1oq075119; Mon, 23 May 2016 04:50:01 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230450.u4N4o1oq075119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 04:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300450 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 04:50:02 -0000 Author: truckman Date: Mon May 23 04:50:01 2016 New Revision: 300450 URL: https://svnweb.freebsd.org/changeset/base/300450 Log: MFC r299894 pdu_delete(request) frees request, so move the call after login_new_response(request) to avoid a use-after-free error Reported by: Coverity CID: 1331219, 1331220 Modified: stable/10/usr.sbin/ctld/login.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/login.c ============================================================================== --- stable/10/usr.sbin/ctld/login.c Mon May 23 04:47:24 2016 (r300449) +++ stable/10/usr.sbin/ctld/login.c Mon May 23 04:50:01 2016 (r300450) @@ -754,10 +754,10 @@ login_wait_transition(struct connection login_send_error(request, 0x02, 0x00); log_errx(1, "got no \"T\" flag after answering AuthMethod"); } - pdu_delete(request); log_debugx("got state transition request"); response = login_new_response(request); + pdu_delete(request); login_set_nsg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION); pdu_send(response); pdu_delete(response); From owner-svn-src-stable-10@freebsd.org Mon May 23 04:52:28 2016 Return-Path: Delivered-To: svn-src-stable-10@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 8E03DB464EF; Mon, 23 May 2016 04:52:28 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D2241975; Mon, 23 May 2016 04:52:28 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N4qRHL077904; Mon, 23 May 2016 04:52:27 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N4qRmG077903; Mon, 23 May 2016 04:52:27 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230452.u4N4qRmG077903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 04:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300451 - stable/10/usr.sbin/rpc.lockd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 04:52:28 -0000 Author: truckman Date: Mon May 23 04:52:27 2016 New Revision: 300451 URL: https://svnweb.freebsd.org/changeset/base/300451 Log: MFC r299897 NULL releasedfl after calling deallocate_file_lock() which frees it to avoid a use-after-free error in the debuglog() call at the top of the loop. Reported by: Coverity CID: 1006080 Modified: stable/10/usr.sbin/rpc.lockd/lockd_lock.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/rpc.lockd/lockd_lock.c ============================================================================== --- stable/10/usr.sbin/rpc.lockd/lockd_lock.c Mon May 23 04:50:01 2016 (r300450) +++ stable/10/usr.sbin/rpc.lockd/lockd_lock.c Mon May 23 04:52:27 2016 (r300451) @@ -1600,6 +1600,7 @@ unlock_partialfilelock(const struct file */ deallocate_file_lock(releasedfl); + releasedfl = NULL; } } From owner-svn-src-stable-10@freebsd.org Mon May 23 05:07:15 2016 Return-Path: Delivered-To: svn-src-stable-10@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 42FD3B46793; Mon, 23 May 2016 05:07:15 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F7AA1F40; Mon, 23 May 2016 05:07:14 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N57EM6081266; Mon, 23 May 2016 05:07:14 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N57EAI081265; Mon, 23 May 2016 05:07:14 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230507.u4N57EAI081265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:07:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300452 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:07:15 -0000 Author: truckman Date: Mon May 23 05:07:13 2016 New Revision: 300452 URL: https://svnweb.freebsd.org/changeset/base/300452 Log: MFC r299922 Don't call free_addrselectpolicy(&policyhead) before policyhead has been initialized. Reported by: Coverity CID: 1018727 Modified: stable/10/lib/libc/net/name6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/name6.c ============================================================================== --- stable/10/lib/libc/net/name6.c Mon May 23 04:52:27 2016 (r300451) +++ stable/10/lib/libc/net/name6.c Mon May 23 05:07:13 2016 (r300452) @@ -655,7 +655,6 @@ _hpreorder(struct hostent *hp) #endif break; default: - free_addrselectpolicy(&policyhead); return hp; } From owner-svn-src-stable-10@freebsd.org Mon May 23 05:11:09 2016 Return-Path: Delivered-To: svn-src-stable-10@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 D4761B46863; Mon, 23 May 2016 05:11:09 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5D241204; Mon, 23 May 2016 05:11:09 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5B8YW082117; Mon, 23 May 2016 05:11:08 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5B8DE082116; Mon, 23 May 2016 05:11:08 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230511.u4N5B8DE082116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300453 - stable/10/lib/libpam/modules/pam_unix X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:11:09 -0000 Author: truckman Date: Mon May 23 05:11:08 2016 New Revision: 300453 URL: https://svnweb.freebsd.org/changeset/base/300453 Log: MFC r299926 Hoist the getpwnam() call outside the first if/else block in pam_sm_chauthtok(). Set user = getlogin() inside the true branch so that it is initialized for the following PAM_LOG() call. This is how it is done in pam_sm_authenticate(). Reported by: Coverity CID: 272498 Modified: stable/10/lib/libpam/modules/pam_unix/pam_unix.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libpam/modules/pam_unix/pam_unix.c ============================================================================== --- stable/10/lib/libpam/modules/pam_unix/pam_unix.c Mon May 23 05:07:13 2016 (r300452) +++ stable/10/lib/libpam/modules/pam_unix/pam_unix.c Mon May 23 05:11:08 2016 (r300453) @@ -278,13 +278,13 @@ pam_sm_chauthtok(pam_handle_t *pamh, int int pfd, tfd, retval; if (openpam_get_option(pamh, PAM_OPT_AUTH_AS_SELF)) - pwd = getpwnam(getlogin()); + user = getlogin(); else { retval = pam_get_user(pamh, &user, NULL); if (retval != PAM_SUCCESS) return (retval); - pwd = getpwnam(user); } + pwd = getpwnam(user); if (pwd == NULL) return (PAM_AUTHTOK_RECOVERY_ERR); From owner-svn-src-stable-10@freebsd.org Mon May 23 05:11:33 2016 Return-Path: Delivered-To: svn-src-stable-10@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 1F4ECB468AF; Mon, 23 May 2016 05:11:33 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CAD0E1392; Mon, 23 May 2016 05:11:32 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5BWQx082178; Mon, 23 May 2016 05:11:32 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5BW56082177; Mon, 23 May 2016 05:11:32 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605230511.u4N5BW56082177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 May 2016 05:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300454 - stable/10/lib/libc/tests/nss X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:11:33 -0000 Author: ngie Date: Mon May 23 05:11:31 2016 New Revision: 300454 URL: https://svnweb.freebsd.org/changeset/base/300454 Log: MFC r299654: Read the contents of the snapshot files properly - Use fgetln instead of fgets; localize complexity related to fgetln(3) inside the loop. - Skip over blank lines. - Skip over lines (properly) that start with a "#" Modified: stable/10/lib/libc/tests/nss/testutil.h Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/tests/nss/testutil.h ============================================================================== --- stable/10/lib/libc/tests/nss/testutil.h Mon May 23 05:11:08 2016 (r300453) +++ stable/10/lib/libc/tests/nss/testutil.h Mon May 23 05:11:31 2016 (r300454) @@ -252,9 +252,7 @@ int \ __##ent##_snapshot_read(char const *fname, struct ent##_test_data *td, \ int (*read_func)(struct ent *, char *)) \ { \ - char buffer[1024]; \ struct ent data; \ - char *s; \ FILE *fi; \ size_t len; \ int rv; \ @@ -267,23 +265,22 @@ __##ent##_snapshot_read(char const *fnam return (-1); \ \ rv = 0; \ - memset(buffer, 0, sizeof(buffer)); \ while (!feof(fi)) { \ - s = fgets(buffer, sizeof(buffer), fi); \ - if (s != NULL && s[0] != '#') { \ - len = strlen(s); \ - if (len == 0) \ - continue; \ - if (buffer[len - 1] == '\n') \ - buffer[len -1] = '\0'; \ - \ - rv = read_func(&data, s); \ - if (rv == 0) { \ - __##ent##_test_data_append(td, &data); \ - td->free_func(&data); \ - } else \ - goto fin; \ - } \ + char *buf = fgetln(fi, &len); \ + if (buf == NULL || len <= 1) \ + continue; \ + if (buf[len - 1] == '\n') \ + buf[len - 1] = '\0'; \ + else \ + buf[len] = '\0'; \ + if (buf[0] == '#') \ + continue; \ + rv = read_func(&data, buf); \ + if (rv == 0) { \ + __##ent##_test_data_append(td, &data); \ + td->free_func(&data); \ + } else \ + goto fin; \ } \ \ fin: \ From owner-svn-src-stable-10@freebsd.org Mon May 23 05:14:27 2016 Return-Path: Delivered-To: svn-src-stable-10@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 89661B46AB7; Mon, 23 May 2016 05:14:27 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5ADB018E3; Mon, 23 May 2016 05:14:27 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5EQm4084347; Mon, 23 May 2016 05:14:26 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5EQfv084346; Mon, 23 May 2016 05:14:26 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230514.u4N5EQfv084346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300456 - stable/10/lib/libpam/modules/pam_unix X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:14:27 -0000 Author: truckman Date: Mon May 23 05:14:26 2016 New Revision: 300456 URL: https://svnweb.freebsd.org/changeset/base/300456 Log: MFC r299948 Set retval in the empty password case to avoid a path through the code that fails to set retval before falling through to the final return(). Reported by: emaste Reported by: Coverity CID: 1018711 Modified: stable/10/lib/libpam/modules/pam_unix/pam_unix.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libpam/modules/pam_unix/pam_unix.c ============================================================================== --- stable/10/lib/libpam/modules/pam_unix/pam_unix.c Mon May 23 05:11:38 2016 (r300455) +++ stable/10/lib/libpam/modules/pam_unix/pam_unix.c Mon May 23 05:14:26 2016 (r300456) @@ -332,6 +332,7 @@ pam_sm_chauthtok(pam_handle_t *pamh, int * XXX check PAM_DISALLOW_NULL_AUTHTOK */ old_pass = ""; + retval = PAM_SUCCESS; } else { retval = pam_get_authtok(pamh, PAM_OLDAUTHTOK, &old_pass, NULL); From owner-svn-src-stable-10@freebsd.org Mon May 23 05:19:38 2016 Return-Path: Delivered-To: svn-src-stable-10@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 34AB4B46BD4; Mon, 23 May 2016 05:19:38 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0543E1BD0; Mon, 23 May 2016 05:19:37 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5JbQH084674; Mon, 23 May 2016 05:19:37 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5JblV084673; Mon, 23 May 2016 05:19:37 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230519.u4N5JblV084673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300458 - stable/10/usr.bin/ldd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:19:38 -0000 Author: truckman Date: Mon May 23 05:19:37 2016 New Revision: 300458 URL: https://svnweb.freebsd.org/changeset/base/300458 Log: MFC r299952 Increase size of argv[] array to avoid running off the end. Reported by: Coverity CID: 1193819 Modified: stable/10/usr.bin/ldd/ldd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/ldd/ldd.c ============================================================================== --- stable/10/usr.bin/ldd/ldd.c Mon May 23 05:15:06 2016 (r300457) +++ stable/10/usr.bin/ldd/ldd.c Mon May 23 05:19:37 2016 (r300458) @@ -83,7 +83,7 @@ static void usage(void); static int execldd32(char *file, char *fmt1, char *fmt2, int aflag, int vflag) { - char *argv[8]; + char *argv[9]; int i, rval, status; LDD_UNSETENV("TRACE_LOADED_OBJECTS"); From owner-svn-src-stable-10@freebsd.org Mon May 23 05:21:56 2016 Return-Path: Delivered-To: svn-src-stable-10@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 4AA3BB46DF6; Mon, 23 May 2016 05:21:56 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1492D1F6F; Mon, 23 May 2016 05:21:56 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5LtOL085469; Mon, 23 May 2016 05:21:55 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5LtQZ085468; Mon, 23 May 2016 05:21:55 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230521.u4N5LtQZ085468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300459 - stable/10/usr.sbin/makefs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:21:56 -0000 Author: truckman Date: Mon May 23 05:21:55 2016 New Revision: 300459 URL: https://svnweb.freebsd.org/changeset/base/300459 Log: MFC r299953 Fix an off by one error to avoid overflowing rp[]. Reported by: Coverity CID: 1007579 Modified: stable/10/usr.sbin/makefs/mtree.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/makefs/mtree.c ============================================================================== --- stable/10/usr.sbin/makefs/mtree.c Mon May 23 05:19:37 2016 (r300458) +++ stable/10/usr.sbin/makefs/mtree.c Mon May 23 05:21:55 2016 (r300459) @@ -150,7 +150,7 @@ mtree_file_path(fsnode *node) depth = 0; rp[depth] = node->name; - for (pnode = node->parent; pnode && depth < MAKEFS_MAX_TREE_DEPTH; + for (pnode = node->parent; pnode && depth < MAKEFS_MAX_TREE_DEPTH - 1; pnode = pnode->parent) { if (strcmp(pnode->name, ".") == 0) break; From owner-svn-src-stable-10@freebsd.org Mon May 23 05:23:54 2016 Return-Path: Delivered-To: svn-src-stable-10@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 4963FB46EE0; Mon, 23 May 2016 05:23:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1657B1269; Mon, 23 May 2016 05:23:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5NrED087711; Mon, 23 May 2016 05:23:53 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5NrDv087710; Mon, 23 May 2016 05:23:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605230523.u4N5NrDv087710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 May 2016 05:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300460 - stable/10/sys/boot/i386/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:23:54 -0000 Author: ngie Date: Mon May 23 05:23:53 2016 New Revision: 300460 URL: https://svnweb.freebsd.org/changeset/base/300460 Log: MFC r299655: Add missing prototype for getchar(..) Modified: stable/10/sys/boot/i386/common/cons.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/i386/common/cons.h ============================================================================== --- stable/10/sys/boot/i386/common/cons.h Mon May 23 05:21:55 2016 (r300459) +++ stable/10/sys/boot/i386/common/cons.h Mon May 23 05:23:53 2016 (r300460) @@ -28,6 +28,7 @@ void xputc(int c); void putchar(int c); int getc(int fn); int xgetc(int fn); +int getchar(void); int keyhit(unsigned int secs); void getstr(char *cmdstr, size_t cmdstrsize); From owner-svn-src-stable-10@freebsd.org Mon May 23 05:25:30 2016 Return-Path: Delivered-To: svn-src-stable-10@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 BC47FB46F4A; Mon, 23 May 2016 05:25:30 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D1B413C3; Mon, 23 May 2016 05:25:30 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5PTg1087840; Mon, 23 May 2016 05:25:29 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5PTvX087839; Mon, 23 May 2016 05:25:29 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230525.u4N5PTvX087839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:25:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300461 - stable/10/usr.bin/chat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:25:30 -0000 Author: truckman Date: Mon May 23 05:25:29 2016 New Revision: 300461 URL: https://svnweb.freebsd.org/changeset/base/300461 Log: MFC r299971 Fix off by one error that overflowed the rep_len array when doing the final NUL termination. Reported by: Coverity CID: 1007617 Modified: stable/10/usr.bin/chat/chat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/chat/chat.c ============================================================================== --- stable/10/usr.bin/chat/chat.c Mon May 23 05:23:53 2016 (r300460) +++ stable/10/usr.bin/chat/chat.c Mon May 23 05:25:29 2016 (r300461) @@ -521,7 +521,7 @@ void terminate(int status) size_t rep_len; rep_len = strlen(report_buffer); - while (rep_len + 1 <= sizeof(report_buffer)) { + while (rep_len + 1 < sizeof(report_buffer)) { alarm(1); c = get_char(); alarm(0); From owner-svn-src-stable-10@freebsd.org Mon May 23 05:27:32 2016 Return-Path: Delivered-To: svn-src-stable-10@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 593EDB46018; Mon, 23 May 2016 05:27:32 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2AE7D1839; Mon, 23 May 2016 05:27:32 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5RVOF088039; Mon, 23 May 2016 05:27:31 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5RVGU088038; Mon, 23 May 2016 05:27:31 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230527.u4N5RVGU088038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:27:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300463 - stable/10/usr.sbin/rpc.lockd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:27:32 -0000 Author: truckman Date: Mon May 23 05:27:31 2016 New Revision: 300463 URL: https://svnweb.freebsd.org/changeset/base/300463 Log: MFC r299986 Actually use the loop interation limit so carefully computed on the previous line to prevent buffer overflow. This turns out to not be important because the upstream xdr code already capped the object size at the proper value. Using the correct limit here looks a lot less scary and should please Coverity. Reported by: Coverity CID: 1199309, 1199310 Modified: stable/10/usr.sbin/rpc.lockd/lock_proc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/rpc.lockd/lock_proc.c ============================================================================== --- stable/10/usr.sbin/rpc.lockd/lock_proc.c Mon May 23 05:25:34 2016 (r300462) +++ stable/10/usr.sbin/rpc.lockd/lock_proc.c Mon May 23 05:27:31 2016 (r300463) @@ -115,7 +115,7 @@ log_netobj(obj) } /* Prevent the security hazard from the buffer overflow */ maxlen = (obj->n_len < MAX_NETOBJ_SZ ? obj->n_len : MAX_NETOBJ_SZ); - for (i=0, tmp1 = objvalbuffer, tmp2 = objascbuffer; i < obj->n_len; + for (i=0, tmp1 = objvalbuffer, tmp2 = objascbuffer; i < maxlen; i++, tmp1 +=2, tmp2 +=1) { sprintf(tmp1,"%02X",*(obj->n_bytes+i)); sprintf(tmp2,"%c",*(obj->n_bytes+i)); From owner-svn-src-stable-10@freebsd.org Mon May 23 05:28:03 2016 Return-Path: Delivered-To: svn-src-stable-10@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 AC9F0B46099; Mon, 23 May 2016 05:28:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D04D19DE; Mon, 23 May 2016 05:28:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5S2kF088115; Mon, 23 May 2016 05:28:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5S2xO088114; Mon, 23 May 2016 05:28:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605230528.u4N5S2xO088114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 May 2016 05:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300464 - stable/10/sys/boot/i386/zfsboot X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:28:03 -0000 Author: ngie Date: Mon May 23 05:28:02 2016 New Revision: 300464 URL: https://svnweb.freebsd.org/changeset/base/300464 Log: MFC r299659: Remove unused const variable Modified: stable/10/sys/boot/i386/zfsboot/zfsboot.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- stable/10/sys/boot/i386/zfsboot/zfsboot.c Mon May 23 05:27:31 2016 (r300463) +++ stable/10/sys/boot/i386/zfsboot/zfsboot.c Mon May 23 05:28:02 2016 (r300464) @@ -83,7 +83,6 @@ static const unsigned char flags[NOPT] = }; uint32_t opts; -static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; static const unsigned char dev_maj[NDEV] = {30, 4, 2}; static char cmd[512]; From owner-svn-src-stable-10@freebsd.org Mon May 23 05:31:55 2016 Return-Path: Delivered-To: svn-src-stable-10@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 0190DB46307; Mon, 23 May 2016 05:31:55 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADBE910E6; Mon, 23 May 2016 05:31:54 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5Vr4b089053; Mon, 23 May 2016 05:31:53 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5VrSD089052; Mon, 23 May 2016 05:31:53 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201605230531.u4N5VrSD089052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Mon, 23 May 2016 05:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300467 - stable/10/sys/amd64/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:31:55 -0000 Author: dchagin Date: Mon May 23 05:31:53 2016 New Revision: 300467 URL: https://svnweb.freebsd.org/changeset/base/300467 Log: MFC r299249: Add a forgotten in r283424 .eh_frame section with CFI & FDE records to allow stack unwinding through signal handler. Modified: stable/10/sys/amd64/linux/linux_locore.s Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/linux_locore.s ============================================================================== --- stable/10/sys/amd64/linux/linux_locore.s Mon May 23 05:30:24 2016 (r300466) +++ stable/10/sys/amd64/linux/linux_locore.s Mon May 23 05:31:53 2016 (r300467) @@ -29,6 +29,7 @@ NON_GPROF_ENTRY(linux_rt_sigcode) movq $LINUX_SYS_linux_rt_sigreturn,%rax /* linux_rt_sigreturn() */ syscall /* enter kernel with args */ hlt +.endrtsigcode: 0: jmp 0b NON_GPROF_ENTRY(__vdso_clock_gettime) @@ -74,3 +75,34 @@ NON_GPROF_ENTRY(__vdso_getcpu) .balign 4 .previous #endif + + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI0: + .long .LENDCIEDLSI0-.LSTARTCIEDLSI0 +.LSTARTCIEDLSI0: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zR" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address register column */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0x0c /* DW_CFA_def_cfa */ + .uleb128 4 + .uleb128 4 + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .uleb128 1 + .align 4 +.LENDCIEDLSI0: + .long .LENDFDEDLSI0-.LSTARTFDEDLSI0 /* Length FDE */ +.LSTARTFDEDLSI0: + .long .LSTARTFDEDLSI0-.LSTARTFRAMEDLSI0 /* CIE pointer */ + .long .startrtsigcode-. /* PC-relative start address */ + .long .endrtsigcode-.startrtsigcode + .uleb128 0 + .align 4 +.LENDFDEDLSI0: + .previous From owner-svn-src-stable-10@freebsd.org Mon May 23 05:38:41 2016 Return-Path: Delivered-To: svn-src-stable-10@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 CD7C5B4640A; Mon, 23 May 2016 05:38:41 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81DB9143C; Mon, 23 May 2016 05:38:41 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5cesx091622; Mon, 23 May 2016 05:38:40 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5ceId091621; Mon, 23 May 2016 05:38:40 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230538.u4N5ceId091621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300469 - stable/10/usr.sbin/rpc.statd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:38:41 -0000 Author: truckman Date: Mon May 23 05:38:40 2016 New Revision: 300469 URL: https://svnweb.freebsd.org/changeset/base/300469 Log: MFC r299988 Set ai2 to NULL in in find_host() before the loop and after calling freeaddrinfo() on it to indicate that it doesn't point to a valid addrinfo list. This fixes this Coverity issues: 1006368 Uninitialized pointer read 1018506 Double free 1305590 Resource leak that can be triggered in the hp->hostname[0] != '\0' case. Don't treat a character as a boolean. Fix these Coverity issues: 1009293 Unchecked return value from library 1194246 Wrong size argument by tweaking the status file extend code. Reported by: Coverity CID: 1006368, 1018506, 1305590, 1009293, 1194246 Reviewed by: rmacklem Feedback from: hrs Differential Revision: https://reviews.freebsd.org/D6398 Modified: stable/10/usr.sbin/rpc.statd/file.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/rpc.statd/file.c ============================================================================== --- stable/10/usr.sbin/rpc.statd/file.c Mon May 23 05:37:45 2016 (r300468) +++ stable/10/usr.sbin/rpc.statd/file.c Mon May 23 05:38:40 2016 (r300469) @@ -82,6 +82,7 @@ HostInfo *find_host(char *hostname, int struct addrinfo *ai1, *ai2; int i; + ai2 = NULL; if (getaddrinfo(hostname, NULL, NULL, &ai1) != 0) ai1 = NULL; for (i = 0, hp = status_info->hosts; i < status_info->noOfHosts; i++, hp++) @@ -91,7 +92,7 @@ HostInfo *find_host(char *hostname, int result = hp; break; } - if (hp->hostname[0] && + if (hp->hostname[0] != '\0' && getaddrinfo(hp->hostname, NULL, NULL, &ai2) != 0) ai2 = NULL; if (ai1 && ai2) @@ -113,8 +114,10 @@ HostInfo *find_host(char *hostname, int if (result) break; } - if (ai2) + if (ai2) { freeaddrinfo(ai2); + ai2 = NULL; + } if (!spare_slot && !hp->monList && !hp->notifyReqd) spare_slot = hp; } @@ -134,9 +137,8 @@ HostInfo *find_host(char *hostname, int if (desired_size > status_file_len) { /* Extend file by writing 1 byte of junk at the desired end pos */ - lseek(status_fd, desired_size - 1, SEEK_SET); - i = write(status_fd, &i, 1); - if (i < 1) + if (lseek(status_fd, desired_size - 1, SEEK_SET) == -1 || + write(status_fd, "\0", 1) < 0) { syslog(LOG_ERR, "Unable to extend status file"); return (NULL); From owner-svn-src-stable-10@freebsd.org Mon May 23 05:41:24 2016 Return-Path: Delivered-To: svn-src-stable-10@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 8BE40B4649D; Mon, 23 May 2016 05:41:24 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C29118BD; Mon, 23 May 2016 05:41:24 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5fNWQ091868; Mon, 23 May 2016 05:41:23 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5fNZL091867; Mon, 23 May 2016 05:41:23 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230541.u4N5fNZL091867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300470 - stable/10/usr.sbin/ppp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:41:24 -0000 Author: truckman Date: Mon May 23 05:41:23 2016 New Revision: 300470 URL: https://svnweb.freebsd.org/changeset/base/300470 Log: MFC r299991 Don't walk off the end of the array when proto isn't explicitly listed above. Instead update the catch-all "Others" bucket. Reported by: Coverity CID: 1007571, 1007572 Modified: stable/10/usr.sbin/ppp/link.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ppp/link.c ============================================================================== --- stable/10/usr.sbin/ppp/link.c Mon May 23 05:38:40 2016 (r300469) +++ stable/10/usr.sbin/ppp/link.c Mon May 23 05:41:23 2016 (r300470) @@ -209,7 +209,7 @@ static struct protostatheader { { PROTO_LQR, "LQR" }, { PROTO_CHAP, "CHAP" }, { PROTO_MP, "MULTILINK" }, - { 0, "Others" } + { 0, "Others" } /* must be last */ }; void @@ -218,13 +218,13 @@ link_ProtocolRecord(struct link *l, u_sh int i; for (i = 0; i < NPROTOSTAT; i++) - if (ProtocolStat[i].number == proto) + if (ProtocolStat[i].number == proto || ProtocolStat[i].number == 0) { + if (type == PROTO_IN) + l->proto_in[i]++; + else + l->proto_out[i]++; break; - - if (type == PROTO_IN) - l->proto_in[i]++; - else - l->proto_out[i]++; + } } void From owner-svn-src-stable-10@freebsd.org Mon May 23 05:41:54 2016 Return-Path: Delivered-To: svn-src-stable-10@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 898B9B465B1; Mon, 23 May 2016 05:41:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 655711A9A; Mon, 23 May 2016 05:41:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5frgU094636; Mon, 23 May 2016 05:41:53 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5friJ094634; Mon, 23 May 2016 05:41:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605230541.u4N5friJ094634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 May 2016 05:41:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300471 - stable/10/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:41:54 -0000 Author: ngie Date: Mon May 23 05:41:53 2016 New Revision: 300471 URL: https://svnweb.freebsd.org/changeset/base/300471 Log: MFC r299712,r299759,r299760,r299761,r299762: r299712: Fix some trivial clang/gcc warnings in bsnmptc.c - By definition, `enum snmp_tc` can't be false (the implied starting sequence index for the enum is 0). Don't test for it being < 0. - Staticize `struct snmp_text_conv` to mute a -Wmissing-variable-declarations warning from clang. - Remove set but unused variable, ptr, in parse_bridge_id(..) and parse_bport_id(..) to mute warning from gcc 4.9+. - Mark value and string unused in snmp_inetaddr2oct(..) and parse_inetaddr(..) as they're just stub functions. r299759: Use calloc instead of memset(.., 0, ..) + malloc r299760: Sort variables in parse_ascii(..) per style(9) r299761: parse_ascii: make count size_t to mute a -Wsign-compare issue count is always unsigned. r299762: Mark snmptoolctx unused in parse_authentication(..), parse_privacy(..), parse_context(..), and parse_user_security(..). Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Mon May 23 05:41:23 2016 (r300470) +++ stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Mon May 23 05:41:53 2016 (r300471) @@ -93,7 +93,7 @@ static char *snmp_oct2bits(uint32_t len, static char *snmp_bits2oct(char *str, struct asn_oid *oid); static int32_t parse_bits(struct snmp_value *value, char *string); -struct snmp_text_conv { +static struct snmp_text_conv { enum snmp_tc tc; const char *tc_str; int32_t len; @@ -158,7 +158,7 @@ snmp_oct2tc(enum snmp_tc tc, uint32_t le uint32_t tc_len; char * buf; - if (tc < 0 || tc > SNMP_UNKNOWN) + if (tc > SNMP_UNKNOWN) tc = SNMP_UNKNOWN; if (text_convs[tc].len > 0) @@ -183,7 +183,7 @@ snmp_oct2tc(enum snmp_tc tc, uint32_t le char * snmp_tc2oid(enum snmp_tc tc, char *str, struct asn_oid *oid) { - if (tc < 0 || tc > SNMP_UNKNOWN) + if (tc > SNMP_UNKNOWN) tc = SNMP_UNKNOWN; return (text_convs[tc].tc2oid(str, oid)); @@ -192,7 +192,7 @@ snmp_tc2oid(enum snmp_tc tc, char *str, int32_t snmp_tc2oct(enum snmp_tc tc, struct snmp_value *value, char *string) { - if (tc < 0 || tc > SNMP_UNKNOWN) + if (tc > SNMP_UNKNOWN) tc = SNMP_UNKNOWN; return (text_convs[tc].tc2oct(value, string)); @@ -929,12 +929,11 @@ snmp_bridgeid2oct(char *str, struct asn_ static int32_t parse_bridge_id(struct snmp_value *sv, char *string) { - char *ptr, *endptr; + char *endptr; int32_t i, saved_errno; uint32_t v; uint8_t bridge_id[SNMP_BRIDGEID_OCTETS]; - ptr = string; /* Read the priority. */ saved_errno = errno; errno = 0; @@ -1057,12 +1056,11 @@ snmp_bport_id2oct(char *str, struct asn_ static int32_t parse_bport_id(struct snmp_value *value, char *string) { - char *ptr, *endptr; + char *endptr; int saved_errno; uint32_t v; uint8_t bport_id[SNMP_BPORT_OCTETS]; - ptr = string; /* Read the priority. */ saved_errno = errno; errno = 0; @@ -1175,13 +1173,13 @@ snmp_oct2inetaddr(uint32_t len, char *oc } static char * -snmp_inetaddr2oct(char *str, struct asn_oid *oid) +snmp_inetaddr2oct(char *str __unused, struct asn_oid *oid __unused) { return (NULL); } static int32_t -parse_inetaddr(struct snmp_value *value, char *string) +parse_inetaddr(struct snmp_value *value __unused, char *string __unused) { return (-1); } Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Mon May 23 05:41:23 2016 (r300470) +++ stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Mon May 23 05:41:53 2016 (r300471) @@ -256,14 +256,12 @@ add_filename(struct snmp_toolinfo *snmpt return (-1); } - if ((entry = malloc(sizeof(struct fname))) == NULL) { + if ((entry = calloc(1, sizeof(struct fname))) == NULL) { warnx("malloc() failed - %s", strerror(errno)); free(fstring); return (-1); } - memset(entry, 0, sizeof(struct fname)); - if (cut != NULL) asn_append_oid(&(entry->cut), cut); strlcpy(fstring, filename, strlen(filename) + 1); @@ -446,9 +444,10 @@ parse_flist(struct snmp_toolinfo *snmpto static int32_t parse_ascii(char *ascii, uint8_t *binstr, size_t binlen) { - int32_t alen, count, saved_errno, i; - uint32_t val; char dptr[3]; + size_t count; + int32_t alen, i, saved_errno; + uint32_t val; /* Filter 0x at the beginning */ if ((alen = strlen(ascii)) > 2 && ascii[0] == '0' && ascii[1] == 'x') @@ -483,7 +482,7 @@ parse_ascii(char *ascii, uint8_t *binstr * snmp_client structure. */ int32_t -parse_authentication(struct snmp_toolinfo *snmptoolctx, char *opt_arg) +parse_authentication(struct snmp_toolinfo *snmptoolctx __unused, char *opt_arg) { int32_t count, subopt; char *val, *option; @@ -538,7 +537,7 @@ parse_authentication(struct snmp_toolinf } int32_t -parse_privacy(struct snmp_toolinfo *snmptoolctx, char *opt_arg) +parse_privacy(struct snmp_toolinfo *snmptoolctx __unused, char *opt_arg) { int32_t count, subopt; char *val, *option; @@ -591,7 +590,7 @@ parse_privacy(struct snmp_toolinfo *snmp } int32_t -parse_context(struct snmp_toolinfo *snmptoolctx, char *opt_arg) +parse_context(struct snmp_toolinfo *snmptoolctx __unused, char *opt_arg) { int32_t count, subopt; char *val, *option; @@ -633,7 +632,7 @@ parse_context(struct snmp_toolinfo *snmp } int32_t -parse_user_security(struct snmp_toolinfo *snmptoolctx, char *opt_arg) +parse_user_security(struct snmp_toolinfo *snmptoolctx __unused, char *opt_arg) { int32_t count, subopt, saved_errno; char *val, *option; @@ -1366,12 +1365,11 @@ snmp_object_add(struct snmp_toolinfo *sn return (-1); } - if ((obj = malloc(sizeof(struct snmp_object))) == NULL) { + if ((obj = calloc(1, sizeof(struct snmp_object))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (-1); } - memset(obj, 0, sizeof(struct snmp_object)); if (func(snmptoolctx, obj, string) < 0) { warnx("Invalid OID - %s", string); free(obj); From owner-svn-src-stable-10@freebsd.org Mon May 23 05:44:00 2016 Return-Path: Delivered-To: svn-src-stable-10@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 EAFF5B4668F; Mon, 23 May 2016 05:44:00 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCA631D1C; Mon, 23 May 2016 05:44:00 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5hxI5094770; Mon, 23 May 2016 05:43:59 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5hx5W094769; Mon, 23 May 2016 05:43:59 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230543.u4N5hx5W094769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300472 - stable/10/usr.sbin/rarpd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:44:01 -0000 Author: truckman Date: Mon May 23 05:43:59 2016 New Revision: 300472 URL: https://svnweb.freebsd.org/changeset/base/300472 Log: MFC r300002 When clearing rtmsg, pass &rtmsg to bzero() instead of the address of just the header Reported by: Coverity CID: 1007568, 1194256 Modified: stable/10/usr.sbin/rarpd/rarpd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/rarpd/rarpd.c ============================================================================== --- stable/10/usr.sbin/rarpd/rarpd.c Mon May 23 05:41:53 2016 (r300471) +++ stable/10/usr.sbin/rarpd/rarpd.c Mon May 23 05:43:59 2016 (r300472) @@ -739,7 +739,7 @@ update_arptab(u_char *ep, in_addr_t ipad /* Get the type and interface index */ rt = &rtmsg.rthdr; - bzero(rt, sizeof(rtmsg)); + bzero(&rtmsg, sizeof(rtmsg)); rt->rtm_version = RTM_VERSION; rt->rtm_addrs = RTA_DST; rt->rtm_type = RTM_GET; From owner-svn-src-stable-10@freebsd.org Mon May 23 05:45:53 2016 Return-Path: Delivered-To: svn-src-stable-10@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 C96D3B467A9; Mon, 23 May 2016 05:45:53 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9952B1EBE; Mon, 23 May 2016 05:45:53 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5jqIY094916; Mon, 23 May 2016 05:45:52 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5jqLc094915; Mon, 23 May 2016 05:45:52 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230545.u4N5jqLc094915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:45:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300473 - stable/10/usr.bin/ncal X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:45:53 -0000 Author: truckman Date: Mon May 23 05:45:52 2016 New Revision: 300473 URL: https://svnweb.freebsd.org/changeset/base/300473 Log: MFC r300005 swprintf() and apparently wcsftime() want the their output buffer size specified in terms of the the number of wide characters and not sizeof(buffer). Reported by: Coverity CID: 1007605, 1007606 Modified: stable/10/usr.bin/ncal/ncal.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/ncal/ncal.c ============================================================================== --- stable/10/usr.bin/ncal/ncal.c Mon May 23 05:43:59 2016 (r300472) +++ stable/10/usr.bin/ncal/ncal.c Mon May 23 05:45:52 2016 (r300473) @@ -642,8 +642,8 @@ monthrangeb(int y, int m, int jd_flag, i wprintf(L"%-*ls ", mw, wcenter(ws, year[i].name, mw)); else { - swprintf(ws, sizeof(ws), L"%-ls %d", - year[i].name, M2Y(m + i)); + swprintf(ws, sizeof(ws)/sizeof(ws[0]), + L"%-ls %d", year[i].name, M2Y(m + i)); wprintf(L"%-*ls ", mw, wcenter(ws1, ws, mw)); } printf("\n"); @@ -958,7 +958,7 @@ mkweekdays(struct weekdays *wds) for (i = 0; i != 7; i++) { tm.tm_wday = (i+1) % 7; - wcsftime(buf, sizeof(buf), L"%a", &tm); + wcsftime(buf, sizeof(buf)/sizeof(buf[0]), L"%a", &tm); for (len = 2; len > 0; --len) { if ((width = wcswidth(buf, len)) <= 2) break; From owner-svn-src-stable-10@freebsd.org Mon May 23 06:01:05 2016 Return-Path: Delivered-To: svn-src-stable-10@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 C2900B46C29; Mon, 23 May 2016 06:01:05 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D6D217A3; Mon, 23 May 2016 06:01:05 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N614tp001091; Mon, 23 May 2016 06:01:04 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N6142W001090; Mon, 23 May 2016 06:01:04 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605230601.u4N6142W001090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 May 2016 06:01:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300475 - stable/10/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 06:01:05 -0000 Author: ngie Date: Mon May 23 06:01:04 2016 New Revision: 300475 URL: https://svnweb.freebsd.org/changeset/base/300475 Log: MFC r299710,r299711,r299763,r299783,r299811: r299710: Staticize global variables only used in bsnmpimport.c to fix -Wmissing-variable-declarations warnings r299711: Fold two malloc + memset(.., 0, ..) calls into equivalent calloc calls r299763: Mute -Wstrlcpy-strlcat-size warning by using nitems with the size of the buffer This is a no-op as the malloc above set the size of the buffer to the size used below, but this keeps things consistent in case the malloc call changes somehow. r299783: Convert tok from enum tok to int32_t in function calls get_token(..) returns int32_t, not enum tok, and in many cases tests for items not in enum tok (e.g. '('). Make the typing consistent with get_token, which includes a domino effect of changing enum tok to int32_t. r299811: Use strdup instead of malloc + strlcpy Fix error messages on failure for calloc/strdup Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c Mon May 23 05:52:47 2016 (r300474) +++ stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c Mon May 23 06:01:04 2016 (r300475) @@ -140,9 +140,9 @@ struct input { LIST_ENTRY(input) link; }; -LIST_HEAD(, input) inputs = LIST_HEAD_INITIALIZER(inputs); -struct input *input = NULL; -int32_t pbchar = -1; +static LIST_HEAD(, input) inputs = LIST_HEAD_INITIALIZER(inputs); +static struct input *input = NULL; +static int32_t pbchar = -1; #define MAX_PATHS 100 @@ -301,18 +301,18 @@ static const struct { { NULL, 0, 0 } }; -struct { +static struct { /* Current OID type, regarding table membership. */ enum snmp_tbl_entry tbl_type; /* A pointer to a structure in table list to add to its members. */ struct snmp_index_entry *table_idx; } table_data; -struct asn_oid current_oid; -char nexttok[MAXSTR]; -u_long val; /* integer values */ -int32_t all_cond; /* all conditions are true */ -int32_t saved_token = -1; +static struct asn_oid current_oid; +static char nexttok[MAXSTR]; +static u_long val; /* integer values */ +static int32_t all_cond; /* all conditions are true */ +static int32_t saved_token = -1; /* Prepare the global data before parsing a new file. */ static void @@ -513,7 +513,7 @@ snmp_import_update_table(enum snmp_tbl_e } static int32_t -parse_enum(struct snmp_toolinfo *snmptoolctx, enum tok *tok, +parse_enum(struct snmp_toolinfo *snmptoolctx, int32_t *tok, struct enum_pairs *enums) { while ((*tok = gettoken(snmptoolctx)) == TOK_STR) { @@ -532,7 +532,7 @@ parse_enum(struct snmp_toolinfo *snmptoo } static int32_t -parse_subtype(struct snmp_toolinfo *snmptoolctx, enum tok *tok, +parse_subtype(struct snmp_toolinfo *snmptoolctx, int32_t *tok, enum snmp_tc *tc) { if ((*tok = gettoken(snmptoolctx)) != TOK_STR) { @@ -547,7 +547,7 @@ parse_subtype(struct snmp_toolinfo *snmp } static int32_t -parse_type(struct snmp_toolinfo *snmptoolctx, enum tok *tok, +parse_type(struct snmp_toolinfo *snmptoolctx, int32_t *tok, enum snmp_tc *tc, struct enum_pairs **snmp_enum) { int32_t syntax, mem; @@ -630,17 +630,15 @@ snmp_import_head(struct snmp_toolinfo *s static int32_t snmp_import_table(struct snmp_toolinfo *snmptoolctx, struct snmp_oid2str *obj) { - int32_t i; + int32_t i, tok; enum snmp_tc tc; - enum tok tok; struct snmp_index_entry *entry; - if ((entry = malloc(sizeof(struct snmp_index_entry))) == NULL) { + if ((entry = calloc(1, sizeof(struct snmp_index_entry))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (-1); } - memset(entry, 0, sizeof(struct snmp_index_entry)); STAILQ_INIT(&(entry->index_list)); for (i = 0, tok = gettoken(snmptoolctx); i < SNMP_INDEXES_MAX; i++) { @@ -705,7 +703,7 @@ snmp_import_table(struct snmp_toolinfo * * Read everything after the syntax type that is certainly a leaf OID info. */ static int32_t -snmp_import_leaf(struct snmp_toolinfo *snmptoolctx, enum tok *tok, +snmp_import_leaf(struct snmp_toolinfo *snmptoolctx, int32_t *tok, struct snmp_oid2str *oid2str) { int32_t i, syntax; @@ -758,25 +756,23 @@ snmp_import_object(struct snmp_toolinfo { char *string; int i; - enum tok tok; + int32_t tok; struct snmp_oid2str *oid2str; if (snmp_import_head(snmptoolctx) < 0) return (-1); - if ((oid2str = malloc(sizeof(struct snmp_oid2str))) == NULL) { - syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); + if ((oid2str = calloc(1, sizeof(struct snmp_oid2str))) == NULL) { + syslog(LOG_ERR, "calloc() failed: %s", strerror(errno)); return (-1); } - if ((string = malloc(strlen(nexttok) + 1)) == NULL) { - syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); + if ((string = strdup(nexttok)) == NULL) { + syslog(LOG_ERR, "strdup() failed: %s", strerror(errno)); free(oid2str); return (-1); } - memset(oid2str, 0, sizeof(struct snmp_oid2str)); - strlcpy(string, nexttok, strlen(nexttok) + 1); oid2str->string = string; oid2str->strlen = strlen(nexttok); @@ -857,7 +853,7 @@ error: } static int32_t -snmp_import_tree(struct snmp_toolinfo *snmptoolctx, enum tok *tok) +snmp_import_tree(struct snmp_toolinfo *snmptoolctx, int32_t *tok) { while (*tok != TOK_EOF) { switch (*tok) { @@ -883,7 +879,7 @@ snmp_import_tree(struct snmp_toolinfo *s } static int32_t -snmp_import_top(struct snmp_toolinfo *snmptoolctx, enum tok *tok) +snmp_import_top(struct snmp_toolinfo *snmptoolctx, int32_t *tok) { enum snmp_tc tc; struct enum_type *t; @@ -940,7 +936,7 @@ static int32_t snmp_import(struct snmp_toolinfo *snmptoolctx) { int i; - enum tok tok; + int32_t tok; tok = gettoken(snmptoolctx); From owner-svn-src-stable-10@freebsd.org Mon May 23 07:15:24 2016 Return-Path: Delivered-To: svn-src-stable-10@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 A8A58B46CD8; Mon, 23 May 2016 07:15:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 792FA1E19; Mon, 23 May 2016 07:15:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N7FNEw022756; Mon, 23 May 2016 07:15:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N7FNW2022755; Mon, 23 May 2016 07:15:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201605230715.u4N7FNW2022755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 23 May 2016 07:15:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300482 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 07:15:24 -0000 Author: avg Date: Mon May 23 07:15:23 2016 New Revision: 300482 URL: https://svnweb.freebsd.org/changeset/base/300482 Log: MFC r300024: zfs_ioc_rename: fix a reversed condition PR: 209093 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon May 23 07:14:04 2016 (r300481) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon May 23 07:15:23 2016 (r300482) @@ -3790,7 +3790,7 @@ zfs_ioc_rename(zfs_cmd_t *zc) if (strncmp(zc->zc_name, zc->zc_value, at - zc->zc_name + 1)) return (SET_ERROR(EXDEV)); *at = '\0'; - if (zc->zc_objset_type == DMU_OST_ZFS && allow_mounted) { + if (zc->zc_objset_type == DMU_OST_ZFS && !allow_mounted) { error = dmu_objset_find(zc->zc_name, recursive_unmount, at + 1, recursive ? DS_FIND_CHILDREN : 0); From owner-svn-src-stable-10@freebsd.org Mon May 23 07:21:03 2016 Return-Path: Delivered-To: svn-src-stable-10@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 36950B46EC3; Mon, 23 May 2016 07:21:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0240712B9; Mon, 23 May 2016 07:21:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N7L2cC023720; Mon, 23 May 2016 07:21:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N7L29e023719; Mon, 23 May 2016 07:21:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201605230721.u4N7L29e023719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 23 May 2016 07:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300484 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 07:21:03 -0000 Author: avg Date: Mon May 23 07:21:01 2016 New Revision: 300484 URL: https://svnweb.freebsd.org/changeset/base/300484 Log: MFC r299916: vfs_read_dirent: increment ncookies after adding a cookie Modified: stable/10/sys/kern/vfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_subr.c ============================================================================== --- stable/10/sys/kern/vfs_subr.c Mon May 23 07:17:53 2016 (r300483) +++ stable/10/sys/kern/vfs_subr.c Mon May 23 07:21:01 2016 (r300484) @@ -4777,6 +4777,7 @@ vfs_read_dirent(struct vop_readdir_args *ap->a_cookies = realloc(*ap->a_cookies, (*ap->a_ncookies + 1) * sizeof(u_long), M_TEMP, M_WAITOK | M_ZERO); (*ap->a_cookies)[*ap->a_ncookies] = off; + *ap->a_ncookies += 1; return (0); } From owner-svn-src-stable-10@freebsd.org Mon May 23 09:44:07 2016 Return-Path: Delivered-To: svn-src-stable-10@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 A0B1EB44C55; Mon, 23 May 2016 09:44:07 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59087174A; Mon, 23 May 2016 09:44:07 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N9i6IT068253; Mon, 23 May 2016 09:44:06 GMT (envelope-from n_hibma@FreeBSD.org) Received: (from n_hibma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N9i69B068252; Mon, 23 May 2016 09:44:06 GMT (envelope-from n_hibma@FreeBSD.org) Message-Id: <201605230944.u4N9i69B068252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: n_hibma set sender to n_hibma@FreeBSD.org using -f From: Nick Hibma Date: Mon, 23 May 2016 09:44:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300488 - stable/10/sys/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 09:44:07 -0000 Author: n_hibma Date: Mon May 23 09:44:06 2016 New Revision: 300488 URL: https://svnweb.freebsd.org/changeset/base/300488 Log: MFC 299559: Allow silencing of 'promiscuous mode enabled/disabled' messages. Modified: stable/10/sys/net/if.c Modified: stable/10/sys/net/if.c ============================================================================== --- stable/10/sys/net/if.c Mon May 23 07:32:34 2016 (r300487) +++ stable/10/sys/net/if.c Mon May 23 09:44:06 2016 (r300488) @@ -113,6 +113,13 @@ SYSCTL_INT(_net_link, OID_AUTO, log_link &log_link_state_change, 0, "log interface link state change events"); +/* Log promiscuous mode change events */ +static int log_promisc_mode_change = 1; + +SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RW, + &log_promisc_mode_change, 1, + "log promiscuous mode change events"); + /* Interface description */ static unsigned int ifdescr_maxlen = 1024; SYSCTL_UINT(_net, OID_AUTO, ifdescr_maxlen, CTLFLAG_RW, @@ -2394,9 +2401,11 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, ifp->if_flags |= IFF_PROMISC; else if (ifp->if_pcount == 0) ifp->if_flags &= ~IFF_PROMISC; - log(LOG_INFO, "%s: permanently promiscuous mode %s\n", - ifp->if_xname, - (new_flags & IFF_PPROMISC) ? "enabled" : "disabled"); + if (log_promisc_mode_change) + log(LOG_INFO, "%s: permanently promiscuous mode %s\n", + ifp->if_xname, + ((new_flags & IFF_PPROMISC) ? + "enabled" : "disabled")); } ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) | (new_flags &~ IFF_CANTCHANGE); @@ -2951,7 +2960,8 @@ ifpromisc(struct ifnet *ifp, int pswitch error = if_setflag(ifp, IFF_PROMISC, IFF_PPROMISC, &ifp->if_pcount, pswitch); /* If promiscuous mode status has changed, log a message */ - if (error == 0 && ((ifp->if_flags ^ oldflags) & IFF_PROMISC)) + if (error == 0 && ((ifp->if_flags ^ oldflags) & IFF_PROMISC) && + log_promisc_mode_change) log(LOG_INFO, "%s: promiscuous mode %s\n", ifp->if_xname, (ifp->if_flags & IFF_PROMISC) ? "enabled" : "disabled"); From owner-svn-src-stable-10@freebsd.org Mon May 23 16:02:30 2016 Return-Path: Delivered-To: svn-src-stable-10@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 C8EACB47C99; Mon, 23 May 2016 16:02:30 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9808D1281; Mon, 23 May 2016 16:02:30 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NG2TJH084754; Mon, 23 May 2016 16:02:29 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NG2TuD084753; Mon, 23 May 2016 16:02:29 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605231602.u4NG2TuD084753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 23 May 2016 16:02:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300514 - stable/10/sbin/pfctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 16:02:30 -0000 Author: loos Date: Mon May 23 16:02:29 2016 New Revision: 300514 URL: https://svnweb.freebsd.org/changeset/base/300514 Log: MFC r297984: Make pfctl(8) more flexible when parsing bandwidth values. This is the current behaviour in OpenBSD and a similar patch exist in pfSense too. Obtained from: OpenBSD (partly - rev. 1.625) Sponsored by: Rubicon Communications (Netgate) Modified: stable/10/sbin/pfctl/parse.y Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/pfctl/parse.y ============================================================================== --- stable/10/sbin/pfctl/parse.y Mon May 23 15:44:39 2016 (r300513) +++ stable/10/sbin/pfctl/parse.y Mon May 23 16:02:29 2016 (r300514) @@ -1605,13 +1605,22 @@ bandwidth : STRING { bps = strtod($1, &cp); if (cp != NULL) { + if (strlen(cp) > 1) { + char *cu = cp + 1; + if (!strcmp(cu, "Bit") || + !strcmp(cu, "B") || + !strcmp(cu, "bit") || + !strcmp(cu, "b")) { + *cu = 0; + } + } if (!strcmp(cp, "b")) ; /* nothing */ - else if (!strcmp(cp, "Kb")) + else if (!strcmp(cp, "K")) bps *= 1000; - else if (!strcmp(cp, "Mb")) + else if (!strcmp(cp, "M")) bps *= 1000 * 1000; - else if (!strcmp(cp, "Gb")) + else if (!strcmp(cp, "G")) bps *= 1000 * 1000 * 1000; else if (!strcmp(cp, "%")) { if (bps < 0 || bps > 100) { From owner-svn-src-stable-10@freebsd.org Mon May 23 16:12:12 2016 Return-Path: Delivered-To: svn-src-stable-10@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 A103EB47F69; Mon, 23 May 2016 16:12:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D4BB1C0A; Mon, 23 May 2016 16:12:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NGCBrr087923; Mon, 23 May 2016 16:12:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NGCB4E087921; Mon, 23 May 2016 16:12:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605231612.u4NGCB4E087921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 23 May 2016 16:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300516 - in stable/10/sys/dev/ntb: if_ntb ntb_hw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 16:12:12 -0000 Author: mav Date: Mon May 23 16:12:11 2016 New Revision: 300516 URL: https://svnweb.freebsd.org/changeset/base/300516 Log: Add respective tunables to all sysctls. This is direct commit to stable/10, since head does not need it any more. Modified: stable/10/sys/dev/ntb/if_ntb/if_ntb.c stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: stable/10/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- stable/10/sys/dev/ntb/if_ntb/if_ntb.c Mon May 23 16:02:54 2016 (r300515) +++ stable/10/sys/dev/ntb/if_ntb/if_ntb.c Mon May 23 16:12:11 2016 (r300516) @@ -96,6 +96,7 @@ enum ntb_link_event { static SYSCTL_NODE(_hw, OID_AUTO, if_ntb, CTLFLAG_RW, 0, "if_ntb"); static unsigned g_if_ntb_debug_level; +TUNABLE_INT("hw.if_ntb.debug_level", &g_if_ntb_debug_level); SYSCTL_UINT(_hw_if_ntb, OID_AUTO, debug_level, CTLFLAG_RWTUN, &g_if_ntb_debug_level, 0, "if_ntb log level -- higher is more verbose"); #define ntb_printf(lvl, ...) do { \ @@ -107,17 +108,20 @@ SYSCTL_UINT(_hw_if_ntb, OID_AUTO, debug_ static unsigned transport_mtu = IP_MAXPACKET + ETHER_HDR_LEN + ETHER_CRC_LEN; static uint64_t max_mw_size; +TUNABLE_QUAD("hw.if_ntb.max_mw_size", &max_mw_size); SYSCTL_UQUAD(_hw_if_ntb, OID_AUTO, max_mw_size, CTLFLAG_RDTUN, &max_mw_size, 0, "If enabled (non-zero), limit the size of large memory windows. " "Both sides of the NTB MUST set the same value here."); static unsigned max_num_clients; +TUNABLE_INT("hw.if_ntb.max_num_clients", &max_num_clients); SYSCTL_UINT(_hw_if_ntb, OID_AUTO, max_num_clients, CTLFLAG_RDTUN, &max_num_clients, 0, "Maximum number of NTB transport clients. " "0 (default) - use all available NTB memory windows; " "positive integer N - Limit to N memory windows."); static unsigned enable_xeon_watchdog; +TUNABLE_INT("hw.if_ntb.enable_xeon_watchdog", &enable_xeon_watchdog); SYSCTL_UINT(_hw_if_ntb, OID_AUTO, enable_xeon_watchdog, CTLFLAG_RDTUN, &enable_xeon_watchdog, 0, "If non-zero, write a register every second to " "keep a watchdog from tearing down the NTB link"); Modified: stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Mon May 23 16:02:54 2016 (r300515) +++ stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Mon May 23 16:12:11 2016 (r300516) @@ -323,6 +323,7 @@ static int sysctl_handle_link_status(SYS static int sysctl_handle_register(SYSCTL_HANDLER_ARGS); static unsigned g_ntb_hw_debug_level; +TUNABLE_INT("hw.ntb.debug_level", &g_ntb_hw_debug_level); SYSCTL_UINT(_hw_ntb, OID_AUTO, debug_level, CTLFLAG_RWTUN, &g_ntb_hw_debug_level, 0, "ntb_hw log level -- higher is more verbose"); #define ntb_printf(lvl, ...) do { \ @@ -338,6 +339,7 @@ SYSCTL_UINT(_hw_ntb, OID_AUTO, debug_lev #define _NTB_PAT_WB 6 #define _NTB_PAT_UCM 7 static unsigned g_ntb_mw_pat = _NTB_PAT_UC; +TUNABLE_INT("hw.ntb.default_mw_pat", &g_ntb_mw_pat); SYSCTL_UINT(_hw_ntb, OID_AUTO, default_mw_pat, CTLFLAG_RDTUN, &g_ntb_mw_pat, 0, "Configure the default memory window cache flags (PAT): " "UC: " __XSTRING(_NTB_PAT_UC) ", " @@ -396,6 +398,7 @@ ntb_vm_memattr_to_str(vm_memattr_t pat) } static int g_ntb_mw_idx = -1; +TUNABLE_INT("hw.ntb.b2b_mw_idx", &g_ntb_mw_idx); SYSCTL_INT(_hw_ntb, OID_AUTO, b2b_mw_idx, CTLFLAG_RDTUN, &g_ntb_mw_idx, 0, "Use this memory window to access the peer NTB registers. A " "non-negative value starts from the first MW index; a negative value " @@ -510,30 +513,38 @@ static struct ntb_b2b_addr xeon_b2b_dsd_ SYSCTL_NODE(_hw_ntb, OID_AUTO, xeon_b2b, CTLFLAG_RW, 0, "B2B MW segment overrides -- MUST be the same on both sides"); +TUNABLE_QUAD("hw.ntb.usd_bar2_addr64", &xeon_b2b_usd_addr.bar2_addr64); SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO, usd_bar2_addr64, CTLFLAG_RDTUN, &xeon_b2b_usd_addr.bar2_addr64, 0, "If using B2B topology on Xeon " "hardware, use this 64-bit address on the bus between the NTB devices for " "the window at BAR2, on the upstream side of the link. MUST be the same " "address on both sides."); +TUNABLE_QUAD("hw.ntb.usd_bar4_addr64", &xeon_b2b_usd_addr.bar4_addr64); SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO, usd_bar4_addr64, CTLFLAG_RDTUN, &xeon_b2b_usd_addr.bar4_addr64, 0, "See usd_bar2_addr64, but BAR4."); +TUNABLE_QUAD("hw.ntb.usd_bar4_addr32", &xeon_b2b_usd_addr.bar4_addr32); SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO, usd_bar4_addr32, CTLFLAG_RDTUN, &xeon_b2b_usd_addr.bar4_addr32, 0, "See usd_bar2_addr64, but BAR4 " "(split-BAR mode)."); +TUNABLE_QUAD("hw.ntb.usd_bar5_addr32", &xeon_b2b_usd_addr.bar5_addr32); SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO, usd_bar5_addr32, CTLFLAG_RDTUN, &xeon_b2b_usd_addr.bar5_addr32, 0, "See usd_bar2_addr64, but BAR5 " "(split-BAR mode)."); +TUNABLE_QUAD("hw.ntb.dsd_bar2_addr64", &xeon_b2b_dsd_addr.bar2_addr64); SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO, dsd_bar2_addr64, CTLFLAG_RDTUN, &xeon_b2b_dsd_addr.bar2_addr64, 0, "If using B2B topology on Xeon " "hardware, use this 64-bit address on the bus between the NTB devices for " "the window at BAR2, on the downstream side of the link. MUST be the same" " address on both sides."); +TUNABLE_QUAD("hw.ntb.dsd_bar4_addr64", &xeon_b2b_dsd_addr.bar4_addr64); SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO, dsd_bar4_addr64, CTLFLAG_RDTUN, &xeon_b2b_dsd_addr.bar4_addr64, 0, "See dsd_bar2_addr64, but BAR4."); +TUNABLE_QUAD("hw.ntb.dsd_bar4_addr32", &xeon_b2b_dsd_addr.bar4_addr32); SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO, dsd_bar4_addr32, CTLFLAG_RDTUN, &xeon_b2b_dsd_addr.bar4_addr32, 0, "See dsd_bar2_addr64, but BAR4 " "(split-BAR mode)."); +TUNABLE_QUAD("hw.ntb.dsd_bar5_addr32", &xeon_b2b_dsd_addr.bar5_addr32); SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO, dsd_bar5_addr32, CTLFLAG_RDTUN, &xeon_b2b_dsd_addr.bar5_addr32, 0, "See dsd_bar2_addr64, but BAR5 " "(split-BAR mode)."); @@ -917,6 +928,7 @@ ntb_setup_msix(struct ntb_softc *ntb, ui * when someone gets their hands on some Xeon hardware. */ static int ntb_force_remap_mode; +TUNABLE_INT("hw.ntb.force_remap_mode", &ntb_force_remap_mode); SYSCTL_INT(_hw_ntb, OID_AUTO, force_remap_mode, CTLFLAG_RDTUN, &ntb_force_remap_mode, 0, "If enabled, force MSI-X messages to be remapped" " to a smaller number of ithreads, even if the desired number are " @@ -926,6 +938,7 @@ SYSCTL_INT(_hw_ntb, OID_AUTO, force_rema * In case it is NOT ok, give consumers an abort button. */ static int ntb_prefer_intx; +TUNABLE_INT("hw.ntb.prefer_intx_to_remap", &ntb_prefer_intx); SYSCTL_INT(_hw_ntb, OID_AUTO, prefer_intx_to_remap, CTLFLAG_RDTUN, &ntb_prefer_intx, 0, "If enabled, prefer to use legacy INTx mode rather " "than remapping MSI-X messages over available slots (match Linux driver " @@ -1453,6 +1466,7 @@ configure_atom_secondary_side_bars(struc * MW size is sufficiently large. */ static unsigned int ntb_b2b_mw_share; +TUNABLE_INT("hw.ntb.b2b_mw_share", &ntb_b2b_mw_share); SYSCTL_UINT(_hw_ntb, OID_AUTO, b2b_mw_share, CTLFLAG_RDTUN, &ntb_b2b_mw_share, 0, "If enabled (non-zero), prefer to share half of the B2B peer register " "MW with higher level consumers. Both sides of the NTB MUST set the same " From owner-svn-src-stable-10@freebsd.org Mon May 23 16:20:52 2016 Return-Path: Delivered-To: svn-src-stable-10@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 2A841B46142; Mon, 23 May 2016 16:20:52 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC55D1201; Mon, 23 May 2016 16:20:51 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NGKpgb088397; Mon, 23 May 2016 16:20:51 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NGKpGV088396; Mon, 23 May 2016 16:20:51 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605231620.u4NGKpGV088396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 23 May 2016 16:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300518 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 16:20:52 -0000 Author: loos Date: Mon May 23 16:20:50 2016 New Revision: 300518 URL: https://svnweb.freebsd.org/changeset/base/300518 Log: MFC r297985: Do not overwrite the dchg variable. It does not cause any real issues because the variable is overwritten only when the packet is forwarded (and the variable is not used anymore). Obtained from: pfSense Sponsored by: Rubicon Communications (Netgate) Modified: stable/10/sys/netinet/ip_input.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip_input.c ============================================================================== --- stable/10/sys/netinet/ip_input.c Mon May 23 16:19:51 2016 (r300517) +++ stable/10/sys/netinet/ip_input.c Mon May 23 16:20:50 2016 (r300518) @@ -499,8 +499,7 @@ tooshort: goto ours; } if (m->m_flags & M_IP_NEXTHOP) { - dchg = (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL); - if (dchg != 0) { + if (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL) { /* * Directly ship the packet on. This allows * forwarding packets originally destined to us From owner-svn-src-stable-10@freebsd.org Mon May 23 16:37:05 2016 Return-Path: Delivered-To: svn-src-stable-10@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 B6830B466EE; Mon, 23 May 2016 16:37:05 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 857DE1423; Mon, 23 May 2016 16:37:05 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NGb4mP094658; Mon, 23 May 2016 16:37:04 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NGb4HC094657; Mon, 23 May 2016 16:37:04 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605231637.u4NGb4HC094657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 23 May 2016 16:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300520 - stable/10/sys/dev/amdtemp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 16:37:05 -0000 Author: loos Date: Mon May 23 16:37:04 2016 New Revision: 300520 URL: https://svnweb.freebsd.org/changeset/base/300520 Log: MFC r298270: Add PCI ID for family 10h model 30h to amdtemp(4). This adds support to CPU found in PC Engines APU2 series. Sponsored by: Rubicon Communications (Netgate) Modified: stable/10/sys/dev/amdtemp/amdtemp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/10/sys/dev/amdtemp/amdtemp.c Mon May 23 16:24:34 2016 (r300519) +++ stable/10/sys/dev/amdtemp/amdtemp.c Mon May 23 16:37:04 2016 (r300520) @@ -80,6 +80,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC14 0x1703 #define DEVICEID_AMD_MISC15 0x1603 #define DEVICEID_AMD_MISC16 0x1533 +#define DEVICEID_AMD_MISC16_M30H 0x1583 #define DEVICEID_AMD_MISC17 0x141d static struct amdtemp_product { @@ -93,6 +94,7 @@ static struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC14 }, { VENDORID_AMD, DEVICEID_AMD_MISC15 }, { VENDORID_AMD, DEVICEID_AMD_MISC16 }, + { VENDORID_AMD, DEVICEID_AMD_MISC16_M30H }, { VENDORID_AMD, DEVICEID_AMD_MISC17 }, { 0, 0 } }; From owner-svn-src-stable-10@freebsd.org Tue May 24 02:44:45 2016 Return-Path: Delivered-To: svn-src-stable-10@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 C115BB47FAA; Tue, 24 May 2016 02:44:45 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 904121136; Tue, 24 May 2016 02:44:45 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O2ii30091649; Tue, 24 May 2016 02:44:44 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O2iilU091648; Tue, 24 May 2016 02:44:44 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201605240244.u4O2iilU091648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 24 May 2016 02:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300552 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 02:44:45 -0000 Author: kp Date: Tue May 24 02:44:44 2016 New Revision: 300552 URL: https://svnweb.freebsd.org/changeset/base/300552 Log: MFC 300307: pf: Fix fragment timeout We were inconsistent about the use of time_second vs. time_uptime. Always use time_uptime so the value can be meaningfully compared. Submitted by: "Max" Modified: stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Tue May 24 01:42:21 2016 (r300551) +++ stable/10/sys/netpfil/pf/pf_norm.c Tue May 24 02:44:44 2016 (r300552) @@ -434,7 +434,7 @@ pf_fillup_fragment(struct pf_fragment_cm *(struct pf_fragment_cmp *)frag = *key; frag->fr_flags = 0; - frag->fr_timeout = time_second; + frag->fr_timeout = time_uptime; frag->fr_maxlen = frent->fe_len; TAILQ_INIT(&frag->fr_queue); From owner-svn-src-stable-10@freebsd.org Tue May 24 02:57:14 2016 Return-Path: Delivered-To: svn-src-stable-10@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 95AA1B48324; Tue, 24 May 2016 02:57:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 662F61996; Tue, 24 May 2016 02:57:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O2vDvc095087; Tue, 24 May 2016 02:57:13 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O2vD7C095086; Tue, 24 May 2016 02:57:13 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201605240257.u4O2vD7C095086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 24 May 2016 02:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300553 - stable/10/usr.bin/sed X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 02:57:14 -0000 Author: pfg Date: Tue May 24 02:57:13 2016 New Revision: 300553 URL: https://svnweb.freebsd.org/changeset/base/300553 Log: MFV r299377: sed.1: Correction for the case insensitive case. Use the capital I instead of the lowercase. Submitted by: Mikhail T. Modified: stable/10/usr.bin/sed/sed.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/sed/sed.1 ============================================================================== --- stable/10/usr.bin/sed/sed.1 Tue May 24 02:44:44 2016 (r300552) +++ stable/10/usr.bin/sed/sed.1 Tue May 24 02:57:13 2016 (r300553) @@ -31,7 +31,7 @@ .\" @(#)sed.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd June 20, 2014 +.Dd May 10, 2016 .Dt SED 1 .Os .Sh NAME @@ -198,7 +198,7 @@ option was specified); a context address that consists of a regular expression preceded and followed by a delimiter. The closing delimiter can also optionally be followed by the -.Dq i +.Dq I character, to indicate that the regular expression is to be matched in a case-insensitive way. .El From owner-svn-src-stable-10@freebsd.org Tue May 24 03:08:33 2016 Return-Path: Delivered-To: svn-src-stable-10@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 4C11BB4859B; Tue, 24 May 2016 03:08:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 288E310C2; Tue, 24 May 2016 03:08:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O38WGV098665; Tue, 24 May 2016 03:08:32 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O38WWQ098664; Tue, 24 May 2016 03:08:32 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201605240308.u4O38WWQ098664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 24 May 2016 03:08:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300555 - stable/10/usr.bin/sed X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 03:08:33 -0000 Author: pfg Date: Tue May 24 03:08:32 2016 New Revision: 300555 URL: https://svnweb.freebsd.org/changeset/base/300555 Log: sed: rewrite the main loop. Rewrite the main loop of the "sed s/..." command, shortening it by ten lines and simplifying it by removing the switch statement implementing /g, /1, and /2 separately and repetitively. This will be needed to bring a fix from OpenBSD later. Obtained from: OpenBSD (schwarze CVS Rev. 1.18) Modified: stable/10/usr.bin/sed/process.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/sed/process.c ============================================================================== --- stable/10/usr.bin/sed/process.c Tue May 24 03:00:24 2016 (r300554) +++ stable/10/usr.bin/sed/process.c Tue May 24 03:08:32 2016 (r300555) @@ -369,7 +369,7 @@ substitute(struct s_command *cp) { SPACE tspace; regex_t *re; - regoff_t re_off, slen; + regoff_t slen; int lastempty, n; char *s; @@ -390,61 +390,55 @@ substitute(struct s_command *cp) n = cp->u.s->n; lastempty = 1; - switch (n) { - case 0: /* Global */ - do { - if (lastempty || match[0].rm_so != match[0].rm_eo) { - /* Locate start of replaced string. */ - re_off = match[0].rm_so; - /* Copy leading retained string. */ - cspace(&SS, s, re_off, APPEND); - /* Add in regular expression. */ + do { + /* Copy the leading retained string. */ + if (n <= 1 && match[0].rm_so) + cspace(&SS, s, match[0].rm_so, APPEND); + + /* Skip zero-length matches right after other matches. */ + if (lastempty || match[0].rm_so || + match[0].rm_so != match[0].rm_eo) { + if (n <= 1) { + /* Want this match: append replacement. */ regsub(&SS, s, cp->u.s->new); - } - - /* Move past this match. */ - if (match[0].rm_so != match[0].rm_eo) { - s += match[0].rm_eo; - slen -= match[0].rm_eo; - lastempty = 0; + if (n == 1) + n = -1; } else { - if (match[0].rm_so < slen) - cspace(&SS, s + match[0].rm_so, 1, - APPEND); - s += match[0].rm_so + 1; - slen -= match[0].rm_so + 1; - lastempty = 1; + /* Want a later match: append original. */ + if (match[0].rm_eo) + cspace(&SS, s, match[0].rm_eo, APPEND); + n--; } - } while (slen >= 0 && regexec_e(re, s, REG_NOTBOL, 0, slen)); - /* Copy trailing retained string. */ - if (slen > 0) - cspace(&SS, s, slen, APPEND); - break; - default: /* Nth occurrence */ - while (--n) { - if (match[0].rm_eo == match[0].rm_so) - match[0].rm_eo = match[0].rm_so + 1; - s += match[0].rm_eo; - slen -= match[0].rm_eo; - if (slen < 0) - return (0); - if (!regexec_e(re, s, REG_NOTBOL, 0, slen)) - return (0); } - /* FALLTHROUGH */ - case 1: /* 1st occurrence */ - /* Locate start of replaced string. */ - re_off = match[0].rm_so + (s - ps); - /* Copy leading retained string. */ - cspace(&SS, ps, re_off, APPEND); - /* Add in regular expression. */ - regsub(&SS, s, cp->u.s->new); - /* Copy trailing retained string. */ + + /* Move past this match. */ s += match[0].rm_eo; slen -= match[0].rm_eo; + + /* + * After a zero-length match, advance one byte, + * and at the end of the line, terminate. + */ + if (match[0].rm_so == match[0].rm_eo) { + if (*s == '\0' || *s == '\n') + slen = -1; + else + slen--; + if (*s != '\0') + cspace(&SS, s++, 1, APPEND); + lastempty = 1; + } else + lastempty = 0; + + } while (n >= 0 && slen >= 0 && regexec_e(re, s, REG_NOTBOL, 0, slen)); + + /* Did not find the requested number of matches. */ + if (n > 1) + return (0); + + /* Copy the trailing retained string. */ + if (slen > 0) cspace(&SS, s, slen, APPEND); - break; - } /* * Swap the substitute space and the pattern space, and make sure From owner-svn-src-stable-10@freebsd.org Tue May 24 03:35:38 2016 Return-Path: Delivered-To: svn-src-stable-10@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 6AA75B48C5A for ; Tue, 24 May 2016 03:35:38 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1.freebsd.org (Postfix) with SMTP id 2E93B150B for ; Tue, 24 May 2016 03:35:37 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: (qmail 3665 invoked by uid 99); 24 May 2016 03:35:37 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 May 2016 03:35:37 +0000 Received: from [192.168.0.100] (unknown [181.55.232.163]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 5E8B51A0117; Tue, 24 May 2016 03:35:36 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r300555 - stable/10/usr.bin/sed From: Pedro Giffuni In-Reply-To: <201605240308.u4O38WWQ098664@repo.freebsd.org> Date: Mon, 23 May 2016 22:35:34 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <1EEA4A50-9DD0-42F3-AAA8-263BFF058F62@freebsd.org> References: <201605240308.u4O38WWQ098664@repo.freebsd.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org X-Mailer: Apple Mail (2.2104) X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 03:35:38 -0000 > Il giorno 23/mag/2016, alle ore 22:08, Pedro F. Giffuni = ha scritto: >=20 > Author: pfg > Date: Tue May 24 03:08:32 2016 > New Revision: 300555 > URL: https://svnweb.freebsd.org/changeset/base/300555 >=20 > Log: MFC r299211 > sed: rewrite the main loop. >=20 > Rewrite the main loop of the "sed s/..." command, shortening it by = ten > lines and simplifying it by removing the switch statement = implementing > /g, /1, and /2 separately and repetitively. >=20 > This will be needed to bring a fix from OpenBSD later. >=20 > Obtained from: OpenBSD (schwarze CVS Rev. 1.18) >=20 > Modified: > stable/10/usr.bin/sed/process.c > Directory Properties: > stable/10/ (props changed) >=20 From owner-svn-src-stable-10@freebsd.org Tue May 24 04:24:00 2016 Return-Path: Delivered-To: svn-src-stable-10@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 38B66B474BF; Tue, 24 May 2016 04:24:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1BF21CD3; Tue, 24 May 2016 04:23:59 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O4NxBA022659; Tue, 24 May 2016 04:23:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O4NwDM022655; Tue, 24 May 2016 04:23:58 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605240423.u4O4NwDM022655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 24 May 2016 04:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300559 - in stable/10/usr.sbin/bsnmpd/tools: bsnmptools libbsnmptools X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 04:24:00 -0000 Author: ngie Date: Tue May 24 04:23:58 2016 New Revision: 300559 URL: https://svnweb.freebsd.org/changeset/base/300559 Log: MFC r299764,r299765,r299767,r299769,r299770,r299774,r299802,r299803,r299805,r299814: r299764: Use the size of the destination buffer, not the source buffer. Technically this is a no-op, but mute the clang warning in case the malloc call above for fstring ever changes in the future r299765: Fix theoretical buffer overflow issues in snmp_oid2asn_oid Increase the size of `string` by 1 to account for the '\0' terminator. In the event that `str` doesn't contain any non-alpha chars, i would be set to MAXSTR, and the subsequent strlcpy call would overflow by a character. Remove unnecessary `string[i] = '\0'` -- this is already handled by strlcpy. r299767: Mute sign compare warning by casting rc to u_int to match nbindings' type rc cannot be negative -- that was already tested for earlier on in the function r299769: Use the size of the destination buffer instead of the malloc size, repeated, in order to mute a -Wstrlcpy-strlcat-size warning r299770: Fix up r299764 I meant to use nitems, not sizeof(..) with the destination buffer. Using sizeof(..) on a pointer will always truncate the output in the destination buffer incorrectly Pointyhat to: ngie r299774: Do minimal work necessary to cure a -Wunused-but-set-variable warning from gcc How errno is saved before and restored after strtoul calls needs a rethink r299802: Fix up both r299764 and r299770 nitems was wrong too, as it was being tested against a pointer instead of a buffer on the stack. Since the old code was just doing malloc, then strlcpy'ing the contents of the source buffer into the destination buffer, replace it all with a call to strdup.. Supersized Duncecap to: ngie r299803: Replace malloc + memset(.., 0, ..) with calloc calls r299805: Fix up r299769 Similar to r299802, it was noted that using nitems on scalar pointers is invalid. Use strdup instead of malloc + strlcpy (which is what the old code was doing anyhow). Pointyhat to: ngie r299814: Replace malloc + memset(.., 0, ..) with calloc calls Modified: stable/10/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Tue May 24 04:18:15 2016 (r300558) +++ stable/10/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Tue May 24 04:23:58 2016 (r300559) @@ -500,7 +500,7 @@ snmptool_walk(struct snmp_toolinfo *snmp outputs += rc; snmp_pdu_free(&resp); - if (rc < resp.nbindings) + if ((u_int)rc < resp.nbindings) break; snmpwalk_nextpdu_create(op, Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Tue May 24 04:18:15 2016 (r300558) +++ stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Tue May 24 04:23:58 2016 (r300559) @@ -56,12 +56,11 @@ snmp_mapping_init(void) { struct snmp_mappings *m; - if ((m = malloc(sizeof(struct snmp_mappings))) == NULL) { + if ((m = calloc(1, sizeof(struct snmp_mappings))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (NULL); } - memset(m, 0, sizeof(struct snmp_mappings)); return (m); } @@ -269,21 +268,18 @@ enum_pair_insert(struct enum_pairs *head { struct enum_pair *e_new; - if ((e_new = malloc(sizeof(struct enum_pair))) == NULL) { + if ((e_new = calloc(1, sizeof(struct enum_pair))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (-1); } - memset(e_new, 0, sizeof(struct enum_pair)); - - if ((e_new->enum_str = malloc(strlen(enum_str) + 1)) == NULL) { + if ((e_new->enum_str = strdup(enum_str)) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); free(e_new); return (-1); } e_new->enum_val = enum_val; - strlcpy(e_new->enum_str, enum_str, strlen(enum_str) + 1); STAILQ_INSERT_TAIL(headp, e_new, link); return (1); @@ -482,13 +478,11 @@ snmp_syntax_insert(struct snmp_idxlist * { struct index *idx; - if ((idx = malloc(sizeof(struct index))) == NULL) { + if ((idx = calloc(1, sizeof(struct index))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (-1); } - memset(idx, 0, sizeof(struct index)); - if (snmp_index_insert(headp, idx) < 0) { free(idx); return (-1); @@ -558,18 +552,16 @@ snmp_enumtc_init(char *name) { struct enum_type *enum_tc; - if ((enum_tc = malloc(sizeof(struct enum_type))) == NULL) { + if ((enum_tc = calloc(1, sizeof(struct enum_type))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (NULL); } - memset(enum_tc, 0, sizeof(struct enum_type)); - if ((enum_tc->name = malloc(strlen(name) + 1)) == NULL) { + if ((enum_tc->name = strdup(name)) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); free(enum_tc); return (NULL); } - strlcpy(enum_tc->name, name, strlen(name) + 1); return (enum_tc); } Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Tue May 24 04:18:15 2016 (r300558) +++ stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Tue May 24 04:23:58 2016 (r300559) @@ -778,11 +778,11 @@ parse_ntp_ts(struct snmp_value *sv, char saved_errno = errno; v = strtoul(val, &endptr, 10); if (errno != 0 || (v / 1000) > 9) { - saved_errno = errno; + errno = saved_errno; warnx("Integer value %s not supported", val); return (-1); } else - saved_errno = errno; + errno = saved_errno; if (*endptr != '.') { warnx("Failed reading octet - %s", val); @@ -799,11 +799,11 @@ parse_ntp_ts(struct snmp_value *sv, char saved_errno = errno; v = strtoul(val, &endptr, 10); if (errno != 0 || (v / 1000) > 9) { - saved_errno = errno; + errno = saved_errno; warnx("Integer value %s not supported", val); return (-1); } else - saved_errno = errno; + errno = saved_errno; for (i = 0, d = 1000; i < 4; i++) { ntp_ts[i + 4] = v / d; Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Tue May 24 04:18:15 2016 (r300558) +++ stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Tue May 24 04:23:58 2016 (r300559) @@ -251,7 +251,7 @@ add_filename(struct snmp_toolinfo *snmpt return (0); } - if ((fstring = malloc(strlen(filename) + 1)) == NULL) { + if ((fstring = strdup(filename)) == NULL) { warnx("malloc() failed - %s", strerror(errno)); return (-1); } @@ -264,7 +264,6 @@ add_filename(struct snmp_toolinfo *snmpt if (cut != NULL) asn_append_oid(&(entry->cut), cut); - strlcpy(fstring, filename, strlen(filename) + 1); entry->name = fstring; entry->done = done; SLIST_INSERT_HEAD(&snmptoolctx->filelist, entry, link); @@ -1060,7 +1059,7 @@ snmp_oid2asn_oid(struct snmp_toolinfo *s struct asn_oid *oid) { int32_t i; - char string[MAXSTR], *endptr; + char string[MAXSTR + 1], *endptr; struct snmp_object obj; for (i = 0; i < MAXSTR; i++) @@ -1076,7 +1075,6 @@ snmp_oid2asn_oid(struct snmp_toolinfo *s return (NULL); } else { strlcpy(string, str, i + 1); - string[i] = '\0'; if (snmp_lookup_enumoid(snmptoolctx, &obj, string) < 0) { warnx("Unknown string - %s", string); return (NULL); From owner-svn-src-stable-10@freebsd.org Tue May 24 04:50:02 2016 Return-Path: Delivered-To: svn-src-stable-10@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 4C524B47AE8; Tue, 24 May 2016 04:50:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5C421945; Tue, 24 May 2016 04:50:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O4nx4f029162; Tue, 24 May 2016 04:49:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O4nxQQ029157; Tue, 24 May 2016 04:49:59 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605240449.u4O4nxQQ029157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 24 May 2016 04:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300561 - in stable/10: contrib/bsnmp/snmp_usm contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 04:50:02 -0000 Author: ngie Date: Tue May 24 04:49:58 2016 New Revision: 300561 URL: https://svnweb.freebsd.org/changeset/base/300561 Log: MFC r299465,r299807,r299808,r299817,r299831,r299832,r300167: r299465 (by cem): bsnmp: Don't overrun privkey buffer by copying wrong size The 'priv_key' array is SNMP_PRIV_KEY_SIZ bytes, not SNMP_AUTH_KEY_SIZ. CIDs: 1008326, 1009675 r299807: Replace QUADFMT with %ju and QUADXFMT with %jx and cast values with uintmax_t This will cure some -Wformat warnings r299808: Use sizeof(..)s for the destination buffers instead of hardcoded values corresponding to the destination buffer sizes r299817: Use SNMPD_INPUT_FAILED instead of SNMP_CODE_FAILED SNMPD_INPUT_FAILED is `enum snmpd_input_err` type (which matches the return code from the function). SNMP_CODE_FAILED is `enum snmp_code` type. r299831: Remove NO_WERROR and add WARNS?= 6 This now compiles cleanly on all architectures Tested with: clang 3.8, gcc 4.2.1, gcc 4.5, make tinderbox r299832: Remove trailing whitespace in license tort r300167 (by glebius): Revert r299830, it has couple of fatal errors. The CMSG_ family of macros take care of alignment, so we don't need r299830 at all, even if it was correct. Put NO_WCAST_ALIGN into Makefile. Together with: peter Modified: stable/10/contrib/bsnmp/snmp_usm/usm_snmp.c stable/10/contrib/bsnmp/snmpd/bsnmpd.1 stable/10/contrib/bsnmp/snmpd/config.c stable/10/contrib/bsnmp/snmpd/main.c stable/10/usr.sbin/bsnmpd/bsnmpd/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/bsnmp/snmp_usm/usm_snmp.c ============================================================================== --- stable/10/contrib/bsnmp/snmp_usm/usm_snmp.c Tue May 24 04:34:45 2016 (r300560) +++ stable/10/contrib/bsnmp/snmp_usm/usm_snmp.c Tue May 24 04:49:58 2016 (r300561) @@ -262,7 +262,7 @@ op_usm_users(struct snmp_context *ctx, s if (ctx->scratch->ptr1 == NULL) return (SNMP_ERR_GENERR); memcpy(ctx->scratch->ptr1, uuser->suser.priv_key, - SNMP_PRIV_KEY_SIZ); + sizeof(uuser->suser.priv_key)); memcpy(uuser->suser.priv_key, val->v.octetstring.octets, val->v.octetstring.len); break; @@ -286,7 +286,7 @@ op_usm_users(struct snmp_context *ctx, s uuser->user_public_len = val->v.octetstring.len; } else { memset(uuser->user_public, 0, - SNMP_ADM_STR32_SIZ); + sizeof(uuser->user_public)); uuser->user_public_len = 0; } break; @@ -351,7 +351,7 @@ op_usm_users(struct snmp_context *ctx, s case LEAF_usmUserAuthKeyChange: case LEAF_usmUserOwnAuthKeyChange: memcpy(uuser->suser.auth_key, ctx->scratch->ptr1, - SNMP_AUTH_KEY_SIZ); + sizeof(uuser->suser.auth_key)); free(ctx->scratch->ptr1); break; case LEAF_usmUserPrivProtocol: @@ -360,7 +360,7 @@ op_usm_users(struct snmp_context *ctx, s case LEAF_usmUserPrivKeyChange: case LEAF_usmUserOwnPrivKeyChange: memcpy(uuser->suser.priv_key, ctx->scratch->ptr1, - SNMP_AUTH_KEY_SIZ); + sizeof(uuser->suser.priv_key)); free(ctx->scratch->ptr1); break; case LEAF_usmUserPublic: @@ -371,7 +371,7 @@ op_usm_users(struct snmp_context *ctx, s free(ctx->scratch->ptr2); } else { memset(uuser->user_public, 0, - SNMP_ADM_STR32_SIZ); + sizeof(uuser->user_public)); uuser->user_public_len = 0; } break; Modified: stable/10/contrib/bsnmp/snmpd/bsnmpd.1 ============================================================================== --- stable/10/contrib/bsnmp/snmpd/bsnmpd.1 Tue May 24 04:34:45 2016 (r300560) +++ stable/10/contrib/bsnmp/snmpd/bsnmpd.1 Tue May 24 04:49:58 2016 (r300561) @@ -7,7 +7,7 @@ .\" All rights reserved. .\" .\" Author: Harti Brandt -.\" +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -16,7 +16,7 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" +.\" .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Modified: stable/10/contrib/bsnmp/snmpd/config.c ============================================================================== --- stable/10/contrib/bsnmp/snmpd/config.c Tue May 24 04:34:45 2016 (r300560) +++ stable/10/contrib/bsnmp/snmpd/config.c Tue May 24 04:49:58 2016 (r300561) @@ -823,7 +823,8 @@ parse_oid(const char *varname, struct as while (token == '.') { if (gettoken() == TOK_NUM) { if (numval > ASN_MAXID) - report("subid too large %#"QUADXFMT, numval); + report("subid too large %#jx", + (uintmax_t)numval); if (oid->len == ASN_MAXOIDLEN) report("index too long"); if (gettoken() != ':') @@ -878,7 +879,7 @@ parse_syntax_integer(struct snmp_value * if (token != TOK_NUM) report("bad INTEGER syntax"); if (numval > 0x7fffffff) - report("INTEGER too large %"QUADFMT, numval); + report("INTEGER too large %ju", (uintmax_t)numval); value->v.integer = numval; gettoken(); Modified: stable/10/contrib/bsnmp/snmpd/main.c ============================================================================== --- stable/10/contrib/bsnmp/snmpd/main.c Tue May 24 04:34:45 2016 (r300560) +++ stable/10/contrib/bsnmp/snmpd/main.c Tue May 24 04:49:58 2016 (r300561) @@ -648,11 +648,11 @@ decoded: } else if (usm_user->suser.auth_proto != SNMP_AUTH_NOAUTH && (pdu->engine.engine_boots == 0 || pdu->engine.engine_time == 0)) { snmpd_usmstats.not_in_time_windows++; - ret = SNMP_CODE_FAILED; + ret = SNMPD_INPUT_FAILED; } if ((code = snmp_pdu_auth_access(pdu, ip)) != SNMP_CODE_OK) - ret = SNMP_CODE_FAILED; + ret = SNMPD_INPUT_FAILED; return (ret); } Modified: stable/10/usr.sbin/bsnmpd/bsnmpd/Makefile ============================================================================== --- stable/10/usr.sbin/bsnmpd/bsnmpd/Makefile Tue May 24 04:34:45 2016 (r300560) +++ stable/10/usr.sbin/bsnmpd/bsnmpd/Makefile Tue May 24 04:49:58 2016 (r300561) @@ -16,7 +16,6 @@ XSYM= snmpMIB begemotSnmpdModuleTable be freeBSD freeBSDVersion CLEANFILES= oid.h tree.c tree.h MAN= bsnmpd.1 snmpmod.3 -NO_WERROR= FILESGROUPS= BMIBS DEFS @@ -27,7 +26,7 @@ DEFSDIR= ${SHAREDIR}/snmp/defs CFLAGS+= -DSNMPTREE_TYPES CFLAGS+= -I${CONTRIB}/lib -I${CONTRIB}/snmpd -I. -DUSE_LIBBEGEMOT -CFLAGS+= -DUSE_TCPWRAPPERS -DQUADFMT='"llu"' -DQUADXFMT='"llx"' +CFLAGS+= -DUSE_TCPWRAPPERS CFLAGS+= -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_ERR_H -DHAVE_STRLCPY DPADD= ${LIBBEGEMOT} ${LIBBSNMP} ${LIBWRAP} LDADD= -lbegemot -lbsnmp -lwrap @@ -49,4 +48,7 @@ MANFILTER= sed -e 's%@MODPATH@%${LIBDIR} -e 's%@DEFPATH@%${DEFSDIR}/%g' \ -e 's%@MIBSPATH@%${BMIBSDIR}/%g' +NO_WCAST_ALIGN= yes +WARNS?= 6 + .include From owner-svn-src-stable-10@freebsd.org Tue May 24 07:10:51 2016 Return-Path: Delivered-To: svn-src-stable-10@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 EDBC0B4721E; Tue, 24 May 2016 07:10:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBCB51C29; Tue, 24 May 2016 07:10:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7AohF073419; Tue, 24 May 2016 07:10:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7Ao0w073418; Tue, 24 May 2016 07:10:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240710.u4O7Ao0w073418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:10:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300577 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:10:52 -0000 Author: mav Date: Tue May 24 07:10:50 2016 New Revision: 300577 URL: https://svnweb.freebsd.org/changeset/base/300577 Log: MFC r299691: Fix FCP_CMD LENGTH mask in ATIO7 IOCB. This caused "long IU length (16384) ignored" errors following by others. Modified: stable/10/sys/dev/isp/isp_target.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_target.c ============================================================================== --- stable/10/sys/dev/isp/isp_target.c Tue May 24 07:07:11 2016 (r300576) +++ stable/10/sys/dev/isp/isp_target.c Tue May 24 07:10:50 2016 (r300577) @@ -169,7 +169,7 @@ isp_target_notify(ispsoftc_t *isp, void * Check for and do something with commands whose * IULEN extends past a single queue entry. */ - len = at7iop->at_ta_len & 0xfffff; + len = at7iop->at_ta_len & 0x0fff; if (len > (QENTRY_LEN - 8)) { len -= (QENTRY_LEN - 8); isp_prt(isp, ISP_LOGINFO, "long IU length (%d) ignored", len); From owner-svn-src-stable-10@freebsd.org Tue May 24 07:11:33 2016 Return-Path: Delivered-To: svn-src-stable-10@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 0D614B4728C; Tue, 24 May 2016 07:11:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1B8D1EBF; Tue, 24 May 2016 07:11:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7BWTB074146; Tue, 24 May 2016 07:11:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7BWlu074145; Tue, 24 May 2016 07:11:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240711.u4O7BWlu074145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300578 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:11:33 -0000 Author: mav Date: Tue May 24 07:11:31 2016 New Revision: 300578 URL: https://svnweb.freebsd.org/changeset/base/300578 Log: MFC r299955: No need to check login status for ZOMBIE ports. ZOMBIE ports are always logged out, and so initiator may try to relogin. Modified: stable/10/sys/dev/isp/isp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Tue May 24 07:10:50 2016 (r300577) +++ stable/10/sys/dev/isp/isp.c Tue May 24 07:11:31 2016 (r300578) @@ -3808,6 +3808,9 @@ fail: goto fail; } + if (lp->state == FC_PORTDB_STATE_ZOMBIE) + goto relogin; + /* * See if we're still logged into it. * From owner-svn-src-stable-10@freebsd.org Tue May 24 07:12:12 2016 Return-Path: Delivered-To: svn-src-stable-10@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 77686B473C3; Tue, 24 May 2016 07:12:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46C6B10CF; Tue, 24 May 2016 07:12:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7CBjw074224; Tue, 24 May 2016 07:12:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7CB2o074223; Tue, 24 May 2016 07:12:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240712.u4O7CB2o074223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300579 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:12:12 -0000 Author: mav Date: Tue May 24 07:12:11 2016 New Revision: 300579 URL: https://svnweb.freebsd.org/changeset/base/300579 Log: MFC r299957: Reduce verbosity of "now sending synthesized status" message. Modified: stable/10/sys/dev/isp/isp_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Tue May 24 07:11:31 2016 (r300578) +++ stable/10/sys/dev/isp/isp_freebsd.c Tue May 24 07:12:11 2016 (r300579) @@ -1363,7 +1363,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u * and status, don't do it again and do the status portion now. */ if (atp->sendst) { - isp_prt(isp, ISP_LOGTINFO, "[0x%x] now sending synthesized status orig_dl=%u xfered=%u bit=%u", + isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] now sending synthesized status orig_dl=%u xfered=%u bit=%u", cso->tag_id, atp->orig_datalen, atp->bytes_xfered, atp->bytes_in_transit); xfrlen = 0; /* we already did the data transfer */ atp->sendst = 0; From owner-svn-src-stable-10@freebsd.org Tue May 24 07:12:55 2016 Return-Path: Delivered-To: svn-src-stable-10@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 7DAE2B4748C; Tue, 24 May 2016 07:12:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E21512B7; Tue, 24 May 2016 07:12:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7Csr2076263; Tue, 24 May 2016 07:12:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7CsIM076260; Tue, 24 May 2016 07:12:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240712.u4O7CsIM076260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:12:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300580 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:12:55 -0000 Author: mav Date: Tue May 24 07:12:53 2016 New Revision: 300580 URL: https://svnweb.freebsd.org/changeset/base/300580 Log: MFC r300052: Completely remove broken now autologin port flag. Firmware automatically logs in only to local loop ports, and those ports can be easily identified without extra flag by zero domain and area IDs. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_library.c stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Tue May 24 07:12:11 2016 (r300579) +++ stable/10/sys/dev/isp/isp.c Tue May 24 07:12:53 2016 (r300580) @@ -3206,7 +3206,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan) case FC_PORTDB_STATE_DEAD: lp->state = FC_PORTDB_STATE_NIL; isp_async(isp, ISPASYNC_DEV_GONE, chan, lp); - if (lp->autologin == 0) { + if ((lp->portid & 0xffff00) != 0) { (void) isp_plogx(isp, chan, lp->handle, lp->portid, PLOGX_FLG_CMD_LOGO | @@ -3304,7 +3304,6 @@ isp_pdb_add_update(ispsoftc_t *isp, int } ISP_MEMZERO(lp, sizeof (fcportdb_t)); - lp->autologin = 1; lp->probational = 0; lp->state = FC_PORTDB_STATE_NEW; lp->portid = lp->new_portid = pdb->portid; Modified: stable/10/sys/dev/isp/isp_library.c ============================================================================== --- stable/10/sys/dev/isp/isp_library.c Tue May 24 07:12:11 2016 (r300579) +++ stable/10/sys/dev/isp/isp_library.c Tue May 24 07:12:53 2016 (r300580) @@ -437,8 +437,8 @@ isp_dump_portdb(ispsoftc_t *isp, int cha } isp_gen_role_str(buf1, sizeof (buf1), lp->prli_word3); isp_gen_role_str(buf2, sizeof (buf2), lp->new_prli_word3); - isp_prt(isp, ISP_LOGALL, "Chan %d [%d]: hdl 0x%x %s al%d %s 0x%06x =>%s 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x", - chan, i, lp->handle, dbs[lp->state], lp->autologin, buf1, lp->portid, buf2, lp->new_portid, + isp_prt(isp, ISP_LOGALL, "Chan %d [%d]: hdl 0x%x %s %s 0x%06x =>%s 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x", + chan, i, lp->handle, dbs[lp->state], buf1, lp->portid, buf2, lp->new_portid, (uint32_t) (lp->node_wwn >> 32), (uint32_t) (lp->node_wwn), (uint32_t) (lp->port_wwn >> 32), (uint32_t) (lp->port_wwn)); } } Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Tue May 24 07:12:11 2016 (r300579) +++ stable/10/sys/dev/isp/ispvar.h Tue May 24 07:12:53 2016 (r300580) @@ -380,9 +380,6 @@ typedef struct { uint16_t handle; /* - * A device is 'autologin' if the firmware automatically logs into - * it (re-logins as needed). Basically, local private loop devices. - * * PRLI word 3 parameters contains role as well as other things. * * The state is the current state of this entry. @@ -396,8 +393,7 @@ typedef struct { */ uint16_t prli_word3; /* PRLI parameters */ uint16_t new_prli_word3; /* Incoming new PRLI parameters */ - uint16_t : 11, - autologin : 1, /* F/W does PLOGI/PLOGO */ + uint16_t : 12, probational : 1, state : 3; uint32_t : 6, From owner-svn-src-stable-10@freebsd.org Tue May 24 07:13:44 2016 Return-Path: Delivered-To: svn-src-stable-10@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 0625CB47526; Tue, 24 May 2016 07:13:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADF5714CF; Tue, 24 May 2016 07:13:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7DgI2076344; Tue, 24 May 2016 07:13:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7Dg2R076343; Tue, 24 May 2016 07:13:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240713.u4O7Dg2R076343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300581 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:13:44 -0000 Author: mav Date: Tue May 24 07:13:42 2016 New Revision: 300581 URL: https://svnweb.freebsd.org/changeset/base/300581 Log: MFC r300058: Make RQCS_PORT_LOGGED_OUT for ZOMBIE ports retriable. It is normal for ZOMBIE ports to be logged out. This status is not really an error until Gone Device Timeout expires, so make CAM retry after delay. Modified: stable/10/sys/dev/isp/isp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Tue May 24 07:12:53 2016 (r300580) +++ stable/10/sys/dev/isp/isp.c Tue May 24 07:13:42 2016 (r300581) @@ -6517,6 +6517,8 @@ isp_parse_status(ispsoftc_t *isp, ispsta { const char *reason; uint8_t sts = sp->req_completion_status & 0xff; + fcparam *fcp = FCPARAM(isp, 0); + fcportdb_t *lp; /* * It was there (maybe)- treat as a selection timeout. @@ -6534,8 +6536,8 @@ isp_parse_status(ispsoftc_t *isp, ispsta * to force a re-login of this unit. If we're on fabric, * then we'll have to log in again as a matter of course. */ - if (FCPARAM(isp, 0)->isp_topo == TOPO_NL_PORT || - FCPARAM(isp, 0)->isp_topo == TOPO_FL_PORT) { + if (fcp->isp_topo == TOPO_NL_PORT || + fcp->isp_topo == TOPO_FL_PORT) { mbreg_t mbs; MBSINIT(&mbs, MBOX_INIT_LIP, MBLOGALL, 0); if (ISP_CAP_2KLOGIN(isp)) { @@ -6544,7 +6546,12 @@ isp_parse_status(ispsoftc_t *isp, ispsta isp_mboxcmd_qnw(isp, &mbs, 1); } if (XS_NOERR(xs)) { - XS_SETERR(xs, HBA_SELTIMEOUT); + lp = &fcp->portdb[XS_TGT(xs)]; + if (lp->state == FC_PORTDB_STATE_ZOMBIE) { + *XS_STSP(xs) = SCSI_BUSY; + XS_SETERR(xs, HBA_TGTBSY); + } else + XS_SETERR(xs, HBA_SELTIMEOUT); } return; } @@ -6668,6 +6675,8 @@ isp_parse_status_24xx(ispsoftc_t *isp, i { const char *reason; uint8_t sts = sp->req_completion_status & 0xff; + fcparam *fcp = FCPARAM(isp, XS_CHANNEL(xs)); + fcportdb_t *lp; /* * It was there (maybe)- treat as a selection timeout. @@ -6685,7 +6694,12 @@ isp_parse_status_24xx(ispsoftc_t *isp, i * There is no MBOX_INIT_LIP for the 24XX. */ if (XS_NOERR(xs)) { - XS_SETERR(xs, HBA_SELTIMEOUT); + lp = &fcp->portdb[XS_TGT(xs)]; + if (lp->state == FC_PORTDB_STATE_ZOMBIE) { + *XS_STSP(xs) = SCSI_BUSY; + XS_SETERR(xs, HBA_TGTBSY); + } else + XS_SETERR(xs, HBA_SELTIMEOUT); } return; } From owner-svn-src-stable-10@freebsd.org Tue May 24 07:14:25 2016 Return-Path: Delivered-To: svn-src-stable-10@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 AAB49B475DD; Tue, 24 May 2016 07:14:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AE851836; Tue, 24 May 2016 07:14:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7EOqW076429; Tue, 24 May 2016 07:14:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7EO5V076428; Tue, 24 May 2016 07:14:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240714.u4O7EO5V076428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300582 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:14:25 -0000 Author: mav Date: Tue May 24 07:14:24 2016 New Revision: 300582 URL: https://svnweb.freebsd.org/changeset/base/300582 Log: MFC r300157: Unify Multi ID target code by reusing isp_find_chan_by_did(). Modified: stable/10/sys/dev/isp/isp_target.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_target.c ============================================================================== --- stable/10/sys/dev/isp/isp_target.c Tue May 24 07:13:42 2016 (r300581) +++ stable/10/sys/dev/isp/isp_target.c Tue May 24 07:14:24 2016 (r300582) @@ -775,18 +775,17 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_en notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32); notify.nt_lreserved = aep; sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | (aep->at_hdr.s_id[2]); - - /* Channel has to derived from D_ID */ did = (aep->at_hdr.d_id[0] << 16) | (aep->at_hdr.d_id[1] << 8) | aep->at_hdr.d_id[2]; - for (chan = 0; chan < isp->isp_nchan; chan++) { - if (FCPARAM(isp, chan)->isp_portid == did) { - break; + if (ISP_CAP_MULTI_ID(isp) && isp->isp_nchan > 1) { + /* Channel has to be derived from D_ID */ + isp_find_chan_by_did(isp, did, &chan); + if (chan == ISP_NOCHAN) { + isp_prt(isp, ISP_LOGWARN, "%s: D_ID 0x%x not found on any channel", __func__, did); + /* just drop on the floor */ + return; } - } - if (chan == isp->isp_nchan) { - isp_prt(isp, ISP_LOGWARN, "%s: D_ID 0x%x not found on any channel", __func__, did); - /* just drop on the floor */ - return; + } else { + chan = 0; } notify.nt_nphdl = NIL_HANDLE; /* unknown here */ notify.nt_sid = sid; From owner-svn-src-stable-10@freebsd.org Tue May 24 07:15:11 2016 Return-Path: Delivered-To: svn-src-stable-10@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 AEDDEB47679; Tue, 24 May 2016 07:15:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 638B61A14; Tue, 24 May 2016 07:15:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7FAAk076519; Tue, 24 May 2016 07:15:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7FAcA076518; Tue, 24 May 2016 07:15:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240715.u4O7FAcA076518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:15:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300583 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:15:11 -0000 Author: mav Date: Tue May 24 07:15:10 2016 New Revision: 300583 URL: https://svnweb.freebsd.org/changeset/base/300583 Log: MFC r300217: Add IOCB debugging for ISPCTL_RESET_DEV and ISPCTL_ABORT_CMD. Modified: stable/10/sys/dev/isp/isp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Tue May 24 07:14:24 2016 (r300582) +++ stable/10/sys/dev/isp/isp.c Tue May 24 07:15:10 2016 (r300583) @@ -4699,6 +4699,8 @@ isp_control(ispsoftc_t *isp, ispctl_t ct tmf->tmf_tidhi = lp->portid >> 16; tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan); isp_put_24xx_tmf(isp, tmf, isp->isp_iocb); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "TMF IOCB request", QENTRY_LEN, isp->isp_iocb); MEMORYBARRIER(isp, SYNC_IFORDEV, 0, QENTRY_LEN, chan); fcp->sendmarker = 1; @@ -4715,6 +4717,8 @@ isp_control(ispsoftc_t *isp, ispctl_t ct break; MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "TMF IOCB response", QENTRY_LEN, &((isp24xx_statusreq_t *)isp->isp_iocb)[1]); sp = (isp24xx_statusreq_t *) local; isp_get_24xx_response(isp, &((isp24xx_statusreq_t *)isp->isp_iocb)[1], sp); if (sp->req_completion_status == 0) { @@ -4781,6 +4785,8 @@ isp_control(ispsoftc_t *isp, ispctl_t ct ab->abrt_tidhi = lp->portid >> 16; ab->abrt_vpidx = ISP_GET_VPIDX(isp, chan); isp_put_24xx_abrt(isp, ab, isp->isp_iocb); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "AB IOCB quest", QENTRY_LEN, isp->isp_iocb); MEMORYBARRIER(isp, SYNC_IFORDEV, 0, 2 * QENTRY_LEN, chan); ISP_MEMZERO(&mbs, sizeof (mbs)); @@ -4796,6 +4802,8 @@ isp_control(ispsoftc_t *isp, ispctl_t ct break; MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "AB IOCB response", QENTRY_LEN, &((isp24xx_abrt_t *)isp->isp_iocb)[1]); isp_get_24xx_abrt(isp, &((isp24xx_abrt_t *)isp->isp_iocb)[1], ab); if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) { return (0); From owner-svn-src-stable-10@freebsd.org Tue May 24 07:15:54 2016 Return-Path: Delivered-To: svn-src-stable-10@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 94705B476FE; Tue, 24 May 2016 07:15:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 576311B9A; Tue, 24 May 2016 07:15:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7Fr7Y076599; Tue, 24 May 2016 07:15:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7FrJt076596; Tue, 24 May 2016 07:15:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240715.u4O7FrJt076596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:15:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300584 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:15:54 -0000 Author: mav Date: Tue May 24 07:15:53 2016 New Revision: 300584 URL: https://svnweb.freebsd.org/changeset/base/300584 Log: MFC r300218: Add proper reporting for early task management errors. This covers unknown requests and requests to unknown virtual ports. Previously it "worked" only because of timeout handling on initiator. Modified: stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_target.c stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Tue May 24 07:15:10 2016 (r300583) +++ stable/10/sys/dev/isp/isp_freebsd.c Tue May 24 07:15:53 2016 (r300584) @@ -2103,7 +2103,7 @@ isp_handle_platform_atio7(ispsoftc_t *is "%s: [0x%x] no state pointer for lun %jx or wildcard", __func__, aep->at_rxid, (uintmax_t)lun); if (lun == 0) { - isp_endcmd(isp, aep, nphdl, SCSI_STATUS_BUSY, 0); + isp_endcmd(isp, aep, nphdl, chan, SCSI_STATUS_BUSY, 0); } else { isp_endcmd(isp, aep, nphdl, chan, SCSI_STATUS_CHECK_COND | ECMD_SVALID | (0x5 << 12) | (0x25 << 16), 0); } Modified: stable/10/sys/dev/isp/isp_target.c ============================================================================== --- stable/10/sys/dev/isp/isp_target.c Tue May 24 07:15:10 2016 (r300583) +++ stable/10/sys/dev/isp/isp_target.c Tue May 24 07:15:53 2016 (r300584) @@ -539,13 +539,22 @@ isp_endcmd(ispsoftc_t *isp, ...) } else if (code & ECMD_SVALID) { cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS; cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8); - cto->rsp.m1.ct_resplen = cto->ct_senselen = min(16, MAXRESPLEN_24XX); + cto->ct_senselen = min(16, MAXRESPLEN_24XX); ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp)); cto->rsp.m1.ct_resp[0] = 0xf0; cto->rsp.m1.ct_resp[2] = (code >> 12) & 0xf; cto->rsp.m1.ct_resp[7] = 8; cto->rsp.m1.ct_resp[12] = (code >> 16) & 0xff; cto->rsp.m1.ct_resp[13] = (code >> 24) & 0xff; + } else if (code & ECMD_RVALID) { + cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS; + cto->ct_scsi_status |= (FCP_RSPLEN_VALID << 8); + cto->rsp.m1.ct_resplen = 4; + ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp)); + cto->rsp.m1.ct_resp[0] = (code >> 12) & 0xf; + cto->rsp.m1.ct_resp[1] = (code >> 16) & 0xff; + cto->rsp.m1.ct_resp[2] = (code >> 24) & 0xff; + cto->rsp.m1.ct_resp[3] = 0; } else { cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS; } @@ -764,6 +773,7 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_en isp_notify_t notify; static const char f1[] = "%s from PortID 0x%06x lun %x seq 0x%08x"; static const char f2[] = "unknown Task Flag 0x%x lun %x PortID 0x%x tag 0x%08x"; + fcportdb_t *lp; uint16_t chan; uint32_t sid, did; @@ -774,20 +784,23 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_en notify.nt_tagval = aep->at_rxid; notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32); notify.nt_lreserved = aep; - sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | (aep->at_hdr.s_id[2]); + sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2]; did = (aep->at_hdr.d_id[0] << 16) | (aep->at_hdr.d_id[1] << 8) | aep->at_hdr.d_id[2]; if (ISP_CAP_MULTI_ID(isp) && isp->isp_nchan > 1) { /* Channel has to be derived from D_ID */ isp_find_chan_by_did(isp, did, &chan); if (chan == ISP_NOCHAN) { isp_prt(isp, ISP_LOGWARN, "%s: D_ID 0x%x not found on any channel", __func__, did); - /* just drop on the floor */ + isp_endcmd(isp, aep, NIL_HANDLE, ISP_NOCHAN, ECMD_TERMINATE, 0); return; } } else { chan = 0; } - notify.nt_nphdl = NIL_HANDLE; /* unknown here */ + if (isp_find_pdb_by_portid(isp, chan, sid, &lp)) + notify.nt_nphdl = lp->handle; + else + notify.nt_nphdl = NIL_HANDLE; notify.nt_sid = sid; notify.nt_did = did; notify.nt_channel = chan; @@ -815,6 +828,7 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_en } else { isp_prt(isp, ISP_LOGWARN, f2, aep->at_cmnd.fcp_cmnd_task_management, notify.nt_lun, sid, aep->at_rxid); notify.nt_ncode = NT_UNKNOWN; + isp_endcmd(isp, aep, notify.nt_nphdl, chan, ECMD_RVALID | (0x4 << 12), 0); return; } isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Tue May 24 07:15:10 2016 (r300583) +++ stable/10/sys/dev/isp/ispvar.h Tue May 24 07:15:53 2016 (r300584) @@ -1143,7 +1143,8 @@ int isp_target_put_atio(ispsoftc_t *, vo */ int isp_endcmd(ispsoftc_t *, ...); #define ECMD_SVALID 0x100 -#define ECMD_TERMINATE 0x200 +#define ECMD_RVALID 0x200 +#define ECMD_TERMINATE 0x400 /* * Handle an asynchronous event From owner-svn-src-stable-10@freebsd.org Tue May 24 07:17:10 2016 Return-Path: Delivered-To: svn-src-stable-10@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 DDFCAB47787; Tue, 24 May 2016 07:17:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF1C51D14; Tue, 24 May 2016 07:17:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7H9go076702; Tue, 24 May 2016 07:17:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7H9Ep076701; Tue, 24 May 2016 07:17:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240717.u4O7H9Ep076701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300585 - stable/10/sys/dev/fb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:17:11 -0000 Author: mav Date: Tue May 24 07:17:09 2016 New Revision: 300585 URL: https://svnweb.freebsd.org/changeset/base/300585 Log: MFC r300072: Fix NULL-dereference panic if VESA reports zero modes. Modified: stable/10/sys/dev/fb/vesa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/fb/vesa.c ============================================================================== --- stable/10/sys/dev/fb/vesa.c Tue May 24 07:15:53 2016 (r300584) +++ stable/10/sys/dev/fb/vesa.c Tue May 24 07:17:09 2016 (r300585) @@ -1026,7 +1026,8 @@ vesa_bios_init(void) ++modes; } - vesa_vmode[modes].vi_mode = EOT; + if (vesa_vmode != NULL) + vesa_vmode[modes].vi_mode = EOT; if (bootverbose) printf("VESA: %d mode(s) found\n", modes); From owner-svn-src-stable-10@freebsd.org Tue May 24 07:18:23 2016 Return-Path: Delivered-To: svn-src-stable-10@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 9EF4CB4784C; Tue, 24 May 2016 07:18:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 547DD1E96; Tue, 24 May 2016 07:18:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7IMoQ076796; Tue, 24 May 2016 07:18:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7IMpD076795; Tue, 24 May 2016 07:18:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240718.u4O7IMpD076795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300586 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:18:23 -0000 Author: mav Date: Tue May 24 07:18:22 2016 New Revision: 300586 URL: https://svnweb.freebsd.org/changeset/base/300586 Log: MFC r299329: Improve validation of some POPULATE TOKEN parameters. Modified: stable/10/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_tpc.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_tpc.c Tue May 24 07:17:09 2016 (r300585) +++ stable/10/sys/cam/ctl/ctl_tpc.c Tue May 24 07:18:22 2016 (r300586) @@ -1916,7 +1916,7 @@ ctl_populate_token(struct ctl_scsiio *ct struct ctl_port *port; struct tpc_list *list, *tlist; struct tpc_token *token; - int len, lendesc; + int len, lendata, lendesc; CTL_DEBUG_PRINT(("ctl_populate_token\n")); @@ -1953,10 +1953,19 @@ ctl_populate_token(struct ctl_scsiio *ct } data = (struct scsi_populate_token_data *)ctsio->kern_data_ptr; + lendata = scsi_2btoul(data->length); + if (lendata < sizeof(struct scsi_populate_token_data) - 2 + + sizeof(struct scsi_range_desc)) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, + /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0); + goto done; + } lendesc = scsi_2btoul(data->range_descriptor_length); - if (len < sizeof(struct scsi_populate_token_data) + lendesc) { + if (lendesc < sizeof(struct scsi_range_desc) || + len < sizeof(struct scsi_populate_token_data) + lendesc || + lendata < sizeof(struct scsi_populate_token_data) - 2 + lendesc) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, - /*field*/ 2, /*bit_valid*/ 0, /*bit*/ 0); + /*field*/ 14, /*bit_valid*/ 0, /*bit*/ 0); goto done; } /* @@ -1966,6 +1975,16 @@ ctl_populate_token(struct ctl_scsiio *ct scsi_4btoul(data->rod_type), scsi_2btoul(data->range_descriptor_length)); */ + + /* Validate INACTIVITY TIMEOUT field */ + if (scsi_4btoul(data->inactivity_timeout) > TPC_MAX_TOKEN_TIMEOUT) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 0, /*field*/ 4, /*bit_valid*/ 0, + /*bit*/ 0); + goto done; + } + + /* Validate ROD TYPE field */ if ((data->flags & EC_PT_RTV) && scsi_4btoul(data->rod_type) != ROD_TYPE_AUR) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, @@ -2016,11 +2035,6 @@ ctl_populate_token(struct ctl_scsiio *ct token->timeout = TPC_DFL_TOKEN_TIMEOUT; else if (token->timeout < TPC_MIN_TOKEN_TIMEOUT) token->timeout = TPC_MIN_TOKEN_TIMEOUT; - else if (token->timeout > TPC_MAX_TOKEN_TIMEOUT) { - ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, - /*command*/ 0, /*field*/ 4, /*bit_valid*/ 0, - /*bit*/ 0); - } memcpy(list->res_token, token->token, sizeof(list->res_token)); list->res_token_valid = 1; list->curseg = 0; From owner-svn-src-stable-10@freebsd.org Tue May 24 07:19:01 2016 Return-Path: Delivered-To: svn-src-stable-10@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 5C862B478E2; Tue, 24 May 2016 07:19:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37FA61001; Tue, 24 May 2016 07:19:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7J0P2076888; Tue, 24 May 2016 07:19:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7J0kT076887; Tue, 24 May 2016 07:19:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240719.u4O7J0kT076887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:19:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300587 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:19:01 -0000 Author: mav Date: Tue May 24 07:19:00 2016 New Revision: 300587 URL: https://svnweb.freebsd.org/changeset/base/300587 Log: MFC r299346: More XCOPY parameters validation. Modified: stable/10/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_tpc.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_tpc.c Tue May 24 07:18:22 2016 (r300586) +++ stable/10/sys/cam/ctl/ctl_tpc.c Tue May 24 07:19:00 2016 (r300587) @@ -1104,6 +1104,26 @@ tpc_ranges_length(struct scsi_range_desc } static int +tpc_check_ranges(struct scsi_range_desc *range, int nrange) +{ + uint64_t b1, b2; + uint32_t l1, l2; + int i, j; + + for (i = 0; i < nrange - 1; i++) { + b1 = scsi_8btou64(range[i].lba); + l1 = scsi_4btoul(range[i].length); + for (j = i + 1; j < nrange; j++) { + b2 = scsi_8btou64(range[j].lba); + l2 = scsi_4btoul(range[j].length); + if (b1 + l1 > b2 && b2 + l2 > b1) + return (-1); + } + } + return (0); +} + +static int tpc_skip_ranges(struct scsi_range_desc *range, int nrange, off_t skip, int *srange, off_t *soffset) { @@ -1992,6 +2012,16 @@ ctl_populate_token(struct ctl_scsiio *ct goto done; } + /* Validate list of ranges */ + if (tpc_check_ranges(&data->desc[0], + scsi_2btoul(data->range_descriptor_length) / + sizeof(struct scsi_range_desc))) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 0, + /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0, + /*bit*/ 0); + goto done; + } + list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO); list->service_action = cdb->service_action; list->init_port = ctsio->io_hdr.nexus.targ_port; @@ -2065,7 +2095,7 @@ ctl_write_using_token(struct ctl_scsiio struct ctl_lun *lun; struct tpc_list *list, *tlist; struct tpc_token *token; - int len, lendesc; + int len, lendata, lendesc; CTL_DEBUG_PRINT(("ctl_write_using_token\n")); @@ -2074,8 +2104,8 @@ ctl_write_using_token(struct ctl_scsiio cdb = (struct scsi_write_using_token *)ctsio->cdb; len = scsi_4btoul(cdb->length); - if (len < sizeof(struct scsi_populate_token_data) || - len > sizeof(struct scsi_populate_token_data) + + if (len < sizeof(struct scsi_write_using_token_data) || + len > sizeof(struct scsi_write_using_token_data) + TPC_MAX_SEGS * sizeof(struct scsi_range_desc)) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, /*field*/ 9, /*bit_valid*/ 0, /*bit*/ 0); @@ -2101,10 +2131,19 @@ ctl_write_using_token(struct ctl_scsiio } data = (struct scsi_write_using_token_data *)ctsio->kern_data_ptr; + lendata = scsi_2btoul(data->length); + if (lendata < sizeof(struct scsi_write_using_token_data) - 2 + + sizeof(struct scsi_range_desc)) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, + /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0); + goto done; + } lendesc = scsi_2btoul(data->range_descriptor_length); - if (len < sizeof(struct scsi_populate_token_data) + lendesc) { + if (lendesc < sizeof(struct scsi_range_desc) || + len < sizeof(struct scsi_write_using_token_data) + lendesc || + lendata < sizeof(struct scsi_write_using_token_data) - 2 + lendesc) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, - /*field*/ 2, /*bit_valid*/ 0, /*bit*/ 0); + /*field*/ 534, /*bit_valid*/ 0, /*bit*/ 0); goto done; } /* @@ -2113,6 +2152,17 @@ ctl_write_using_token(struct ctl_scsiio data->flags, scsi_8btou64(data->offset_into_rod), scsi_2btoul(data->range_descriptor_length)); */ + + /* Validate list of ranges */ + if (tpc_check_ranges(&data->desc[0], + scsi_2btoul(data->range_descriptor_length) / + sizeof(struct scsi_range_desc))) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 0, + /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0, + /*bit*/ 0); + goto done; + } + list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO); list->service_action = cdb->service_action; list->init_port = ctsio->io_hdr.nexus.targ_port; From owner-svn-src-stable-10@freebsd.org Tue May 24 07:19:54 2016 Return-Path: Delivered-To: svn-src-stable-10@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 31712B47968; Tue, 24 May 2016 07:19:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB2F8117A; Tue, 24 May 2016 07:19:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7Jr5A076970; Tue, 24 May 2016 07:19:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7Jrr9076969; Tue, 24 May 2016 07:19:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240719.u4O7Jrr9076969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300588 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:19:54 -0000 Author: mav Date: Tue May 24 07:19:52 2016 New Revision: 300588 URL: https://svnweb.freebsd.org/changeset/base/300588 Log: MFC r299347, r299348: Validate XCOPY range offsets and lengths. Modified: stable/10/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_tpc.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_tpc.c Tue May 24 07:19:00 2016 (r300587) +++ stable/10/sys/cam/ctl/ctl_tpc.c Tue May 24 07:19:52 2016 (r300588) @@ -1104,7 +1104,23 @@ tpc_ranges_length(struct scsi_range_desc } static int -tpc_check_ranges(struct scsi_range_desc *range, int nrange) +tpc_check_ranges_l(struct scsi_range_desc *range, int nrange, uint64_t maxlba) +{ + uint64_t b1; + uint32_t l1; + int i; + + for (i = 0; i < nrange; i++) { + b1 = scsi_8btou64(range[i].lba); + l1 = scsi_4btoul(range[i].length); + if (b1 + l1 < b1 || b1 + l1 > maxlba + 1) + return (-1); + } + return (0); +} + +static int +tpc_check_ranges_x(struct scsi_range_desc *range, int nrange) { uint64_t b1, b2; uint32_t l1, l2; @@ -2013,9 +2029,16 @@ ctl_populate_token(struct ctl_scsiio *ct } /* Validate list of ranges */ - if (tpc_check_ranges(&data->desc[0], + if (tpc_check_ranges_l(&data->desc[0], + scsi_2btoul(data->range_descriptor_length) / + sizeof(struct scsi_range_desc), + lun->be_lun->maxlba) != 0) { + ctl_set_lba_out_of_range(ctsio); + goto done; + } + if (tpc_check_ranges_x(&data->desc[0], scsi_2btoul(data->range_descriptor_length) / - sizeof(struct scsi_range_desc))) { + sizeof(struct scsi_range_desc)) != 0) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 0, /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0); @@ -2154,9 +2177,16 @@ ctl_write_using_token(struct ctl_scsiio */ /* Validate list of ranges */ - if (tpc_check_ranges(&data->desc[0], + if (tpc_check_ranges_l(&data->desc[0], + scsi_2btoul(data->range_descriptor_length) / + sizeof(struct scsi_range_desc), + lun->be_lun->maxlba) != 0) { + ctl_set_lba_out_of_range(ctsio); + goto done; + } + if (tpc_check_ranges_x(&data->desc[0], scsi_2btoul(data->range_descriptor_length) / - sizeof(struct scsi_range_desc))) { + sizeof(struct scsi_range_desc)) != 0) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 0, /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0); From owner-svn-src-stable-10@freebsd.org Tue May 24 07:21:25 2016 Return-Path: Delivered-To: svn-src-stable-10@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 116B8B47A40; Tue, 24 May 2016 07:21:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C83C416B5; Tue, 24 May 2016 07:21:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4O7LOaP077846; Tue, 24 May 2016 07:21:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4O7LNQk077844; Tue, 24 May 2016 07:21:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605240721.u4O7LNQk077844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 May 2016 07:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300589 - stable/10/sys/cam/scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 07:21:25 -0000 Author: mav Date: Tue May 24 07:21:23 2016 New Revision: 300589 URL: https://svnweb.freebsd.org/changeset/base/300589 Log: MFC r299373: Allow sleepable allocations in enclosure daemon threads. There were at least two places where M_NOWAIT was used without NULL check. This change should fix NULL-dereference panic there and possibly improve operation in other ways under memory pressure. Modified: stable/10/sys/cam/scsi/scsi_enc_safte.c stable/10/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_enc_safte.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_enc_safte.c Tue May 24 07:19:52 2016 (r300588) +++ stable/10/sys/cam/scsi/scsi_enc_safte.c Tue May 24 07:21:23 2016 (r300589) @@ -292,11 +292,8 @@ safte_process_config(enc_softc_t *enc, s cfg->DoorLock + cfg->Ntherm + cfg->Nspkrs + cfg->Ntstats + 1; ENC_FREE_AND_NULL(enc->enc_cache.elm_map); enc->enc_cache.elm_map = - ENC_MALLOCZ(enc->enc_cache.nelms * sizeof(enc_element_t)); - if (enc->enc_cache.elm_map == NULL) { - enc->enc_cache.nelms = 0; - return (ENOMEM); - } + malloc(enc->enc_cache.nelms * sizeof(enc_element_t), + M_SCSIENC, M_WAITOK|M_ZERO); r = 0; /* Modified: stable/10/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_enc_ses.c Tue May 24 07:19:52 2016 (r300588) +++ stable/10/sys/cam/scsi/scsi_enc_ses.c Tue May 24 07:21:23 2016 (r300589) @@ -715,13 +715,15 @@ ses_cache_clone(enc_softc_t *enc, enc_ca * The element map is independent even though it starts out * pointing to the same constant page data. */ - dst->elm_map = ENC_MALLOCZ(dst->nelms * sizeof(enc_element_t)); + dst->elm_map = malloc(dst->nelms * sizeof(enc_element_t), + M_SCSIENC, M_WAITOK); memcpy(dst->elm_map, src->elm_map, dst->nelms * sizeof(enc_element_t)); for (dst_elm = dst->elm_map, src_elm = src->elm_map, last_elm = &src->elm_map[src->nelms]; src_elm != last_elm; src_elm++, dst_elm++) { - dst_elm->elm_private = ENC_MALLOCZ(sizeof(ses_element_t)); + dst_elm->elm_private = malloc(sizeof(ses_element_t), + M_SCSIENC, M_WAITOK); memcpy(dst_elm->elm_private, src_elm->elm_private, sizeof(ses_element_t)); } @@ -1066,11 +1068,7 @@ ses_set_physpath(enc_softc_t *enc, enc_e cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_SCSI_DEVID; cdai.bufsiz = CAM_SCSI_DEVID_MAXLEN; - cdai.buf = devid = ENC_MALLOCZ(cdai.bufsiz); - if (devid == NULL) { - ret = ENOMEM; - goto out; - } + cdai.buf = devid = malloc(cdai.bufsiz, M_SCSIENC, M_WAITOK|M_ZERO); cam_periph_lock(enc->periph); xpt_action((union ccb *)&cdai); if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0) @@ -1371,12 +1369,8 @@ ses_process_config(enc_softc_t *enc, str * Now waltz through all the subenclosures summing the number of * types available in each. */ - subencs = ENC_MALLOCZ(ses_cfg_page_get_num_subenc(cfg_page) - * sizeof(*subencs)); - if (subencs == NULL) { - err = ENOMEM; - goto out; - } + subencs = malloc(ses_cfg_page_get_num_subenc(cfg_page) + * sizeof(*subencs), M_SCSIENC, M_WAITOK|M_ZERO); /* * Sub-enclosure data is const after construction (i.e. when * accessed via our cache object. @@ -1414,11 +1408,8 @@ ses_process_config(enc_softc_t *enc, str } /* Process the type headers. */ - ses_types = ENC_MALLOCZ(ntype * sizeof(*ses_types)); - if (ses_types == NULL) { - err = ENOMEM; - goto out; - } + ses_types = malloc(ntype * sizeof(*ses_types), + M_SCSIENC, M_WAITOK|M_ZERO); /* * Type data is const after construction (i.e. when accessed via * our cache object. @@ -1455,11 +1446,8 @@ ses_process_config(enc_softc_t *enc, str } /* Create the object map. */ - enc_cache->elm_map = ENC_MALLOCZ(nelm * sizeof(enc_element_t)); - if (enc_cache->elm_map == NULL) { - err = ENOMEM; - goto out; - } + enc_cache->elm_map = malloc(nelm * sizeof(enc_element_t), + M_SCSIENC, M_WAITOK|M_ZERO); enc_cache->nelms = nelm; ses_iter_init(enc, enc_cache, &iter); @@ -1473,11 +1461,8 @@ ses_process_config(enc_softc_t *enc, str element->subenclosure = thdr->etype_subenc; element->enctype = thdr->etype_elm_type; element->overall_status_elem = iter.type_element_index == 0; - element->elm_private = ENC_MALLOCZ(sizeof(ses_element_t)); - if (element->elm_private == NULL) { - err = ENOMEM; - goto out; - } + element->elm_private = malloc(sizeof(ses_element_t), + M_SCSIENC, M_WAITOK|M_ZERO); ENC_DLOG(enc, "%s: creating elmpriv %d(%d,%d) subenc %d " "type 0x%x\n", __func__, iter.global_element_index, iter.type_index, iter.type_element_index, From owner-svn-src-stable-10@freebsd.org Tue May 24 10:34:26 2016 Return-Path: Delivered-To: svn-src-stable-10@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 02446B46775; Tue, 24 May 2016 10:34:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C85761D5A; Tue, 24 May 2016 10:34:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OAYPGf038283; Tue, 24 May 2016 10:34:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OAYPu1038282; Tue, 24 May 2016 10:34:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605241034.u4OAYPu1038282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 May 2016 10:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300597 - stable/10/sys/ufs/ufs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 10:34:26 -0000 Author: kib Date: Tue May 24 10:34:24 2016 New Revision: 300597 URL: https://svnweb.freebsd.org/changeset/base/300597 Log: MFC r300027: Fix typo in the message. Modified: stable/10/sys/ufs/ufs/ufs_lookup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- stable/10/sys/ufs/ufs/ufs_lookup.c Tue May 24 10:21:39 2016 (r300596) +++ stable/10/sys/ufs/ufs/ufs_lookup.c Tue May 24 10:34:24 2016 (r300597) @@ -1133,7 +1133,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir error = UFS_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_NORMAL | IO_SYNC, cr); if (error != 0) - vprint("ufs_direnter: failted to truncate", dvp); + vprint("ufs_direnter: failed to truncate", dvp); #ifdef UFS_DIRHASH if (error == 0 && dp->i_dirhash != NULL) ufsdirhash_dirtrunc(dp, dp->i_endoff); From owner-svn-src-stable-10@freebsd.org Tue May 24 10:36:34 2016 Return-Path: Delivered-To: svn-src-stable-10@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 60DBAB467E8; Tue, 24 May 2016 10:36:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32BF71EB5; Tue, 24 May 2016 10:36:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OAaX2n038407; Tue, 24 May 2016 10:36:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OAaXcc038406; Tue, 24 May 2016 10:36:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605241036.u4OAaXcc038406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 May 2016 10:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300598 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 10:36:34 -0000 Author: kib Date: Tue May 24 10:36:33 2016 New Revision: 300598 URL: https://svnweb.freebsd.org/changeset/base/300598 Log: MFC r300030: Fix comments. Modified: stable/10/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_vfsops.c Tue May 24 10:34:24 2016 (r300597) +++ stable/10/sys/ufs/ffs/ffs_vfsops.c Tue May 24 10:36:33 2016 (r300598) @@ -512,7 +512,7 @@ ffs_mount(struct mount *mp) * We need the name for the mount point (also used for * "last mounted on") copied in. If an error occurs, * the mount point is discarded by the upper level code. - * Note that vfs_mount() populates f_mntonname for us. + * Note that vfs_mount_alloc() populates f_mntonname for us. */ if ((error = ffs_mountfs(devvp, mp, td)) != 0) { vrele(devvp); @@ -1058,7 +1058,7 @@ ffs_mountfs(devvp, mp, td) (void) ffs_sbupdate(ump, MNT_WAIT, 0); } /* - * Initialize filesystem stat information in mount struct. + * Initialize filesystem state information in mount struct. */ MNT_ILOCK(mp); mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | From owner-svn-src-stable-10@freebsd.org Tue May 24 10:39:56 2016 Return-Path: Delivered-To: svn-src-stable-10@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 4BBFAB468B8; Tue, 24 May 2016 10:39:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C0691095; Tue, 24 May 2016 10:39:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OAdttT038562; Tue, 24 May 2016 10:39:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OAdtfs038561; Tue, 24 May 2016 10:39:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605241039.u4OAdtfs038561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 May 2016 10:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300599 - stable/10/sys/ufs/ufs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 10:39:56 -0000 Author: kib Date: Tue May 24 10:39:55 2016 New Revision: 300599 URL: https://svnweb.freebsd.org/changeset/base/300599 Log: MFC r300082: For async UFS mounts, shrink the directory asynchronously, at least do not pass IO_SYNC to ffs_truncate() unneccessary. Modified: stable/10/sys/ufs/ufs/ufs_lookup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- stable/10/sys/ufs/ufs/ufs_lookup.c Tue May 24 10:36:33 2016 (r300598) +++ stable/10/sys/ufs/ufs/ufs_lookup.c Tue May 24 10:39:55 2016 (r300599) @@ -1131,7 +1131,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir if (tvp != NULL) VOP_UNLOCK(tvp, 0); error = UFS_TRUNCATE(dvp, (off_t)dp->i_endoff, - IO_NORMAL | IO_SYNC, cr); + IO_NORMAL | (DOINGASYNC(dvp) ? 0 : IO_SYNC), cr); if (error != 0) vprint("ufs_direnter: failed to truncate", dvp); #ifdef UFS_DIRHASH From owner-svn-src-stable-10@freebsd.org Tue May 24 10:41:36 2016 Return-Path: Delivered-To: svn-src-stable-10@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 059DBB46A4B; Tue, 24 May 2016 10:41:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA1F014E1; Tue, 24 May 2016 10:41:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OAfZTs040813; Tue, 24 May 2016 10:41:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OAfYar040812; Tue, 24 May 2016 10:41:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605241041.u4OAfYar040812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 May 2016 10:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300600 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 10:41:36 -0000 Author: kib Date: Tue May 24 10:41:34 2016 New Revision: 300600 URL: https://svnweb.freebsd.org/changeset/base/300600 Log: MFC r300083: If IO_SYNC was passed to ffs_truncate(), request synchronous inode update from the final ffs_update(). Modified: stable/10/sys/ufs/ffs/ffs_inode.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_inode.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_inode.c Tue May 24 10:39:55 2016 (r300599) +++ stable/10/sys/ufs/ffs/ffs_inode.c Tue May 24 10:41:34 2016 (r300600) @@ -562,7 +562,7 @@ extclean: softdep_journal_freeblocks(ip, cred, length, IO_EXT); else softdep_setup_freeblocks(ip, length, IO_EXT); - return (ffs_update(vp, !DOINGASYNC(vp))); + return (ffs_update(vp, (flags & IO_SYNC) != 0 || !DOINGASYNC(vp))); } /* From owner-svn-src-stable-10@freebsd.org Tue May 24 10:46:24 2016 Return-Path: Delivered-To: svn-src-stable-10@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 EB4FDB46C23; Tue, 24 May 2016 10:46:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAF9B1AD9; Tue, 24 May 2016 10:46:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4OAkNPF041908; Tue, 24 May 2016 10:46:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OAkN6M041907; Tue, 24 May 2016 10:46:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605241046.u4OAkN6M041907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 May 2016 10:46:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300601 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 10:46:25 -0000 Author: kib Date: Tue May 24 10:46:23 2016 New Revision: 300601 URL: https://svnweb.freebsd.org/changeset/base/300601 Log: MFC r300084: Do enable io accounting for read-only mounts and mounts which are remounted to writeable after initial read-only. Assign to dev->si_mountpt earlier to account the accesses done at the mount time. Modified: stable/10/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_vfsops.c Tue May 24 10:41:34 2016 (r300600) +++ stable/10/sys/ufs/ffs/ffs_vfsops.c Tue May 24 10:46:23 2016 (r300601) @@ -780,6 +780,8 @@ ffs_mountfs(devvp, mp, td) mp->mnt_iosize_max = MAXPHYS; devvp->v_bufobj.bo_ops = &ffs_ops; + if (devvp->v_type == VCHR) + devvp->v_rdev->si_mountpt = mp; fs = NULL; sblockloc = 0; @@ -1049,8 +1051,6 @@ ffs_mountfs(devvp, mp, td) ffs_flushfiles(mp, FORCECLOSE, td); goto out; } - if (devvp->v_type == VCHR && devvp->v_rdev != NULL) - devvp->v_rdev->si_mountpt = mp; if (fs->fs_snapinum[0] != 0) ffs_snapshot_mount(mp); fs->fs_fmod = 1; @@ -1083,6 +1083,8 @@ ffs_mountfs(devvp, mp, td) out: if (bp) brelse(bp); + if (devvp->v_type == VCHR && devvp->v_rdev != NULL) + devvp->v_rdev->si_mountpt = NULL; if (cp != NULL) { DROP_GIANT(); g_topology_lock(); From owner-svn-src-stable-10@freebsd.org Tue May 24 23:04:17 2016 Return-Path: Delivered-To: svn-src-stable-10@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 5B7D5B490E3; Tue, 24 May 2016 23:04:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C0EB1A87; Tue, 24 May 2016 23:04:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ON4Gta071861; Tue, 24 May 2016 23:04:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ON4GKI071860; Tue, 24 May 2016 23:04:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201605242304.u4ON4GKI071860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 24 May 2016 23:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300629 - in stable: 10/sys/conf 8/sys/conf 9/sys/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 23:04:17 -0000 Author: jhb Date: Tue May 24 23:04:16 2016 New Revision: 300629 URL: https://svnweb.freebsd.org/changeset/base/300629 Log: MFC 299310: Don't store generated firmware object files in the source directory. Trim the leading directory of a firmware source file from the resulting target object file name so the object file is stored in the object directory. Previously, using 'FIRMWS= /path/to/fw.bin:fw.bin' would store the generated 'fw.bin.fwo' file in the /path/to directory. Now it stores it in the object directory of the kernel module being built. Modified: stable/10/sys/conf/kmod.mk Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sys/conf/kmod.mk stable/9/sys/conf/kmod.mk Directory Properties: stable/8/sys/ (props changed) stable/8/sys/conf/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/10/sys/conf/kmod.mk ============================================================================== --- stable/10/sys/conf/kmod.mk Tue May 24 21:20:17 2016 (r300628) +++ stable/10/sys/conf/kmod.mk Tue May 24 23:04:16 2016 (r300629) @@ -164,7 +164,7 @@ SRCS+= ${KMOD:S/$/.c/} CLEANFILES+= ${KMOD:S/$/.c/} .for _firmw in ${FIRMWS} -${_firmw:C/\:.*$/.fwo/}: ${_firmw:C/\:.*$//} +${_firmw:C/\:.*$/.fwo/:T}: ${_firmw:C/\:.*$//} @${ECHO} ${_firmw:C/\:.*$//} ${.ALLSRC:M*${_firmw:C/\:.*$//}} @if [ -e ${_firmw:C/\:.*$//} ]; then \ ${LD} -b binary --no-warn-mismatch ${LDFLAGS} \ @@ -176,7 +176,7 @@ ${_firmw:C/\:.*$/.fwo/}: ${_firmw:C/\:.* rm ${_firmw:C/\:.*$//}; \ fi -OBJS+= ${_firmw:C/\:.*$/.fwo/} +OBJS+= ${_firmw:C/\:.*$/.fwo/:T} .endfor .endif From owner-svn-src-stable-10@freebsd.org Wed May 25 01:48:46 2016 Return-Path: Delivered-To: svn-src-stable-10@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 3F595B497BE; Wed, 25 May 2016 01:48:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D64D51328; Wed, 25 May 2016 01:48:45 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P1mjUH020943; Wed, 25 May 2016 01:48:45 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P1mjof020942; Wed, 25 May 2016 01:48:45 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201605250148.u4P1mjof020942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 25 May 2016 01:48:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300641 - stable/10/contrib/ipfilter/man X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 01:48:46 -0000 Author: cy Date: Wed May 25 01:48:44 2016 New Revision: 300641 URL: https://svnweb.freebsd.org/changeset/base/300641 Log: MFC r300177 and r300179: fix two typos in man page. Modified: stable/10/contrib/ipfilter/man/ipf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/ipfilter/man/ipf.5 ============================================================================== --- stable/10/contrib/ipfilter/man/ipf.5 Wed May 25 01:37:39 2016 (r300640) +++ stable/10/contrib/ipfilter/man/ipf.5 Wed May 25 01:48:44 2016 (r300641) @@ -881,7 +881,7 @@ through without needing to explicitly al An example of how this is done is as follows: .PP .nf -pass in proto udp from any prot = 2049 to any with frags keep fags +pass in proto udp from any port = 2049 to any with frags keep frags .fi .SH Building a tree of rules .PP From owner-svn-src-stable-10@freebsd.org Wed May 25 06:15:27 2016 Return-Path: Delivered-To: svn-src-stable-10@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 89963B4974D; Wed, 25 May 2016 06:15:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ACAC1D6D; Wed, 25 May 2016 06:15:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P6FQh7003175; Wed, 25 May 2016 06:15:26 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P6FQDR003173; Wed, 25 May 2016 06:15:26 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250615.u4P6FQDR003173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 25 May 2016 06:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300656 - stable/10/sys/dev/hyperv/storvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 06:15:27 -0000 Author: sephe Date: Wed May 25 06:15:26 2016 New Revision: 300656 URL: https://svnweb.freebsd.org/changeset/base/300656 Log: MFC r299505 hyperv/stor: Enable INQUIRY result check only on WIN10 like host systems On WIN8 like host systems, when rescan happens, the already installed disks seem to return random invalid results for INQUIRY. More investigation is under way to figure out why random invalid INQUIRY results are delivered to VM on WIN8 like host systems. Submitted by: Hongjiang Zhang Reviewed by: sephe MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6316 Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed May 25 06:01:47 2016 (r300655) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed May 25 06:15:26 2016 (r300656) @@ -81,12 +81,6 @@ __FBSDID("$FreeBSD$"); #define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS #define STORVSC_MAX_TARGETS (2) -#define STORVSC_WIN7_MAJOR 4 -#define STORVSC_WIN7_MINOR 2 - -#define STORVSC_WIN8_MAJOR 5 -#define STORVSC_WIN8_MINOR 1 - #define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) #define HV_ALIGN(x, a) roundup2(x, a) @@ -208,7 +202,7 @@ static struct storvsc_driver_props g_drv * Sense buffer size changed in win8; have a run-time * variable to track the size we should use. */ -static int sense_buffer_size; +static int sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; /* * The size of the vmscsi_request has changed in win8. The @@ -218,9 +212,46 @@ static int sense_buffer_size; * Track the correct size we need to apply. */ static int vmscsi_size_delta; +/* + * The storage protocol version is determined during the + * initial exchange with the host. It will indicate which + * storage functionality is available in the host. +*/ +static int vmstor_proto_version; + +struct vmstor_proto { + int proto_version; + int sense_buffer_size; + int vmscsi_size_delta; +}; -static int storvsc_current_major; -static int storvsc_current_minor; +static const struct vmstor_proto vmstor_proto_list[] = { + { + VMSTOR_PROTOCOL_VERSION_WIN10, + POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, + 0 + }, + { + VMSTOR_PROTOCOL_VERSION_WIN8_1, + POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, + 0 + }, + { + VMSTOR_PROTOCOL_VERSION_WIN8, + POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, + 0 + }, + { + VMSTOR_PROTOCOL_VERSION_WIN7, + PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE, + sizeof(struct vmscsi_win8_extension), + }, + { + VMSTOR_PROTOCOL_VERSION_WIN6, + PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE, + sizeof(struct vmscsi_win8_extension), + } +}; /* static functions */ static int storvsc_probe(device_t dev); @@ -435,7 +466,7 @@ storvsc_send_multichannel_request(struct static int hv_storvsc_channel_init(struct hv_device *dev) { - int ret = 0; + int ret = 0, i; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; struct storvsc_softc *sc; @@ -484,19 +515,20 @@ hv_storvsc_channel_init(struct hv_device goto cleanup; } - /* reuse the packet for version range supported */ + for (i = 0; i < nitems(vmstor_proto_list); i++) { + /* reuse the packet for version range supported */ - memset(vstor_packet, 0, sizeof(struct vstor_packet)); - vstor_packet->operation = VSTOR_OPERATION_QUERYPROTOCOLVERSION; - vstor_packet->flags = REQUEST_COMPLETION_FLAG; + memset(vstor_packet, 0, sizeof(struct vstor_packet)); + vstor_packet->operation = VSTOR_OPERATION_QUERYPROTOCOLVERSION; + vstor_packet->flags = REQUEST_COMPLETION_FLAG; - vstor_packet->u.version.major_minor = - VMSTOR_PROTOCOL_VERSION(storvsc_current_major, storvsc_current_minor); + vstor_packet->u.version.major_minor = + vmstor_proto_list[i].proto_version; - /* revision is only significant for Windows guests */ - vstor_packet->u.version.revision = 0; + /* revision is only significant for Windows guests */ + vstor_packet->u.version.revision = 0; - ret = hv_vmbus_channel_send_packet( + ret = hv_vmbus_channel_send_packet( dev->channel, vstor_packet, VSTOR_PKT_SIZE, @@ -504,20 +536,34 @@ hv_storvsc_channel_init(struct hv_device HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); - if (ret != 0) - goto cleanup; + if (ret != 0) + goto cleanup; - /* wait 5 seconds */ - ret = sema_timedwait(&request->synch_sema, 5 * hz); + /* wait 5 seconds */ + ret = sema_timedwait(&request->synch_sema, 5 * hz); - if (ret) - goto cleanup; + if (ret) + goto cleanup; - /* TODO: Check returned version */ - if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || - vstor_packet->status != 0) - goto cleanup; + if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO) { + ret = EINVAL; + goto cleanup; + } + if (vstor_packet->status == 0) { + vmstor_proto_version = + vmstor_proto_list[i].proto_version; + sense_buffer_size = + vmstor_proto_list[i].sense_buffer_size; + vmscsi_size_delta = + vmstor_proto_list[i].vmscsi_size_delta; + break; + } + } + if (vstor_packet->status != 0) { + ret = EINVAL; + goto cleanup; + } /** * Query channel properties */ @@ -916,19 +962,6 @@ storvsc_probe(device_t dev) int ata_disk_enable = 0; int ret = ENXIO; - if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 || - hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) { - sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; - vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); - storvsc_current_major = STORVSC_WIN7_MAJOR; - storvsc_current_minor = STORVSC_WIN7_MINOR; - } else { - sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; - vmscsi_size_delta = 0; - storvsc_current_major = STORVSC_WIN8_MAJOR; - storvsc_current_minor = STORVSC_WIN8_MINOR; - } - switch (storvsc_get_storage_type(dev)) { case DRIVER_BLKVSC: if(bootverbose) @@ -2070,6 +2103,13 @@ storvsc_io_done(struct hv_storvsc_reques ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); if (cmd->opcode == INQUIRY && + /* + * XXX: Temporary work around disk hot plugin on win2k12r2, + * only filtering the invalid disk on win10 or 2016 server. + * So, the hot plugin on win10 and 2016 server needs + * to be fixed. + */ + vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN10 && is_inquiry_valid( (const struct scsi_inquiry_data *)csio->data_ptr) == 0) { ccb->ccb_h.status |= CAM_DEV_NOT_THERE; Modified: stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h Wed May 25 06:01:47 2016 (r300655) +++ stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h Wed May 25 06:15:26 2016 (r300656) @@ -41,6 +41,11 @@ #define VMSTOR_PROTOCOL_VERSION(MAJOR_, MINOR_) ((((MAJOR_) & 0xff) << 8) | \ (((MINOR_) & 0xff) )) +#define VMSTOR_PROTOCOL_VERSION_WIN6 VMSTOR_PROTOCOL_VERSION(2, 0) +#define VMSTOR_PROTOCOL_VERSION_WIN7 VMSTOR_PROTOCOL_VERSION(4, 2) +#define VMSTOR_PROTOCOL_VERSION_WIN8 VMSTOR_PROTOCOL_VERSION(5, 1) +#define VMSTOR_PROTOCOL_VERSION_WIN8_1 VMSTOR_PROTOCOL_VERSION(6, 0) +#define VMSTOR_PROTOCOL_VERSION_WIN10 VMSTOR_PROTOCOL_VERSION(6, 2) /* * Invalid version. */ From owner-svn-src-stable-10@freebsd.org Wed May 25 07:09:55 2016 Return-Path: Delivered-To: svn-src-stable-10@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 AEC96B4917F; Wed, 25 May 2016 07:09:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E65216DB; Wed, 25 May 2016 07:09:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P79sQx018730; Wed, 25 May 2016 07:09:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P79sUl018726; Wed, 25 May 2016 07:09:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605250709.u4P79sUl018726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 May 2016 07:09:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300661 - in stable/10: share/man/man4 sys/conf sys/dev/ioat sys/modules sys/modules/ioat tools/tools/ioat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 07:09:55 -0000 Author: mav Date: Wed May 25 07:09:54 2016 New Revision: 300661 URL: https://svnweb.freebsd.org/changeset/base/300661 Log: MFC ioat(4) driver in its present state. Added: stable/10/sys/dev/ioat/ stable/10/sys/dev/ioat/ioat.c (contents, props changed) stable/10/sys/dev/ioat/ioat.h (contents, props changed) stable/10/sys/dev/ioat/ioat_hw.h (contents, props changed) stable/10/sys/dev/ioat/ioat_internal.h (contents, props changed) stable/10/sys/dev/ioat/ioat_test.c (contents, props changed) stable/10/sys/dev/ioat/ioat_test.h (contents, props changed) stable/10/sys/modules/ioat/ stable/10/sys/modules/ioat/Makefile (contents, props changed) stable/10/tools/tools/ioat/ stable/10/tools/tools/ioat/Makefile (contents, props changed) stable/10/tools/tools/ioat/ioatcontrol.8 (contents, props changed) stable/10/tools/tools/ioat/ioatcontrol.c (contents, props changed) Modified: stable/10/share/man/man4/Makefile stable/10/sys/conf/files.amd64 stable/10/sys/modules/Makefile Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Wed May 25 06:55:53 2016 (r300660) +++ stable/10/share/man/man4/Makefile Wed May 25 07:09:54 2016 (r300661) @@ -199,6 +199,7 @@ MAN= aac.4 \ intpm.4 \ intro.4 \ ${_io.4} \ + ${_ioat.4} \ ip.4 \ ip6.4 \ ipfirewall.4 \ @@ -797,6 +798,7 @@ MLINKS+=lindev.4 full.4 .if ${MACHINE_CPUARCH} == "amd64" _if_ntb.4= if_ntb.4 +_ioat.4= ioat.4 _ntb.4= ntb.4 _ntb_hw.4= ntb_hw.4 _qlxge.4= qlxge.4 Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Wed May 25 06:55:53 2016 (r300660) +++ stable/10/sys/conf/files.amd64 Wed May 25 07:09:54 2016 (r300661) @@ -203,6 +203,8 @@ dev/if_ndis/if_ndis_pccard.c optional nd dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci dev/if_ndis/if_ndis_usb.c optional ndis usb dev/io/iodev.c optional io +dev/ioat/ioat.c optional ioat pci +dev/ioat/ioat_test.c optional ioat pci dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_acpi.c optional ipmi acpi dev/ipmi/ipmi_isa.c optional ipmi isa Added: stable/10/sys/dev/ioat/ioat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/ioat/ioat.c Wed May 25 07:09:54 2016 (r300661) @@ -0,0 +1,2091 @@ +/*- + * Copyright (C) 2012 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ioat.h" +#include "ioat_hw.h" +#include "ioat_internal.h" + +#ifndef BUS_SPACE_MAXADDR_40BIT +#define BUS_SPACE_MAXADDR_40BIT 0xFFFFFFFFFFULL +#endif +#define IOAT_INTR_TIMO (hz / 10) +#define IOAT_REFLK (&ioat->submit_lock) + +static int ioat_probe(device_t device); +static int ioat_attach(device_t device); +static int ioat_detach(device_t device); +static int ioat_setup_intr(struct ioat_softc *ioat); +static int ioat_teardown_intr(struct ioat_softc *ioat); +static int ioat3_attach(device_t device); +static int ioat_start_channel(struct ioat_softc *ioat); +static int ioat_map_pci_bar(struct ioat_softc *ioat); +static void ioat_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, + int error); +static void ioat_interrupt_handler(void *arg); +static boolean_t ioat_model_resets_msix(struct ioat_softc *ioat); +static int chanerr_to_errno(uint32_t); +static void ioat_process_events(struct ioat_softc *ioat); +static inline uint32_t ioat_get_active(struct ioat_softc *ioat); +static inline uint32_t ioat_get_ring_space(struct ioat_softc *ioat); +static void ioat_free_ring(struct ioat_softc *, uint32_t size, + struct ioat_descriptor **); +static void ioat_free_ring_entry(struct ioat_softc *ioat, + struct ioat_descriptor *desc); +static struct ioat_descriptor *ioat_alloc_ring_entry(struct ioat_softc *, + int mflags); +static int ioat_reserve_space(struct ioat_softc *, uint32_t, int mflags); +static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *ioat, + uint32_t index); +static struct ioat_descriptor **ioat_prealloc_ring(struct ioat_softc *, + uint32_t size, boolean_t need_dscr, int mflags); +static int ring_grow(struct ioat_softc *, uint32_t oldorder, + struct ioat_descriptor **); +static int ring_shrink(struct ioat_softc *, uint32_t oldorder, + struct ioat_descriptor **); +static void ioat_halted_debug(struct ioat_softc *, uint32_t); +static void ioat_timer_callback(void *arg); +static void dump_descriptor(void *hw_desc); +static void ioat_submit_single(struct ioat_softc *ioat); +static void ioat_comp_update_map(void *arg, bus_dma_segment_t *seg, int nseg, + int error); +static int ioat_reset_hw(struct ioat_softc *ioat); +static void ioat_reset_hw_task(void *, int); +static void ioat_setup_sysctl(device_t device); +static int sysctl_handle_reset(SYSCTL_HANDLER_ARGS); +static inline struct ioat_softc *ioat_get(struct ioat_softc *, + enum ioat_ref_kind); +static inline void ioat_put(struct ioat_softc *, enum ioat_ref_kind); +static inline void _ioat_putn(struct ioat_softc *, uint32_t, + enum ioat_ref_kind, boolean_t); +static inline void ioat_putn(struct ioat_softc *, uint32_t, + enum ioat_ref_kind); +static inline void ioat_putn_locked(struct ioat_softc *, uint32_t, + enum ioat_ref_kind); +static void ioat_drain_locked(struct ioat_softc *); + +#define ioat_log_message(v, ...) do { \ + if ((v) <= g_ioat_debug_level) { \ + device_printf(ioat->device, __VA_ARGS__); \ + } \ +} while (0) + +MALLOC_DEFINE(M_IOAT, "ioat", "ioat driver memory allocations"); +SYSCTL_NODE(_hw, OID_AUTO, ioat, CTLFLAG_RD, 0, "ioat node"); + +static int g_force_legacy_interrupts; +SYSCTL_INT(_hw_ioat, OID_AUTO, force_legacy_interrupts, CTLFLAG_RDTUN, + &g_force_legacy_interrupts, 0, "Set to non-zero to force MSI-X disabled"); + +int g_ioat_debug_level = 0; +SYSCTL_INT(_hw_ioat, OID_AUTO, debug_level, CTLFLAG_RWTUN, &g_ioat_debug_level, + 0, "Set log level (0-3) for ioat(4). Higher is more verbose."); + +/* + * OS <-> Driver interface structures + */ +static device_method_t ioat_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ioat_probe), + DEVMETHOD(device_attach, ioat_attach), + DEVMETHOD(device_detach, ioat_detach), + DEVMETHOD_END +}; + +static driver_t ioat_pci_driver = { + "ioat", + ioat_pci_methods, + sizeof(struct ioat_softc), +}; + +static devclass_t ioat_devclass; +DRIVER_MODULE(ioat, pci, ioat_pci_driver, ioat_devclass, 0, 0); +MODULE_VERSION(ioat, 1); + +/* + * Private data structures + */ +static struct ioat_softc *ioat_channel[IOAT_MAX_CHANNELS]; +static int ioat_channel_index = 0; +SYSCTL_INT(_hw_ioat, OID_AUTO, channels, CTLFLAG_RD, &ioat_channel_index, 0, + "Number of IOAT channels attached"); + +static struct _pcsid +{ + u_int32_t type; + const char *desc; +} pci_ids[] = { + { 0x34308086, "TBG IOAT Ch0" }, + { 0x34318086, "TBG IOAT Ch1" }, + { 0x34328086, "TBG IOAT Ch2" }, + { 0x34338086, "TBG IOAT Ch3" }, + { 0x34298086, "TBG IOAT Ch4" }, + { 0x342a8086, "TBG IOAT Ch5" }, + { 0x342b8086, "TBG IOAT Ch6" }, + { 0x342c8086, "TBG IOAT Ch7" }, + + { 0x37108086, "JSF IOAT Ch0" }, + { 0x37118086, "JSF IOAT Ch1" }, + { 0x37128086, "JSF IOAT Ch2" }, + { 0x37138086, "JSF IOAT Ch3" }, + { 0x37148086, "JSF IOAT Ch4" }, + { 0x37158086, "JSF IOAT Ch5" }, + { 0x37168086, "JSF IOAT Ch6" }, + { 0x37178086, "JSF IOAT Ch7" }, + { 0x37188086, "JSF IOAT Ch0 (RAID)" }, + { 0x37198086, "JSF IOAT Ch1 (RAID)" }, + + { 0x3c208086, "SNB IOAT Ch0" }, + { 0x3c218086, "SNB IOAT Ch1" }, + { 0x3c228086, "SNB IOAT Ch2" }, + { 0x3c238086, "SNB IOAT Ch3" }, + { 0x3c248086, "SNB IOAT Ch4" }, + { 0x3c258086, "SNB IOAT Ch5" }, + { 0x3c268086, "SNB IOAT Ch6" }, + { 0x3c278086, "SNB IOAT Ch7" }, + { 0x3c2e8086, "SNB IOAT Ch0 (RAID)" }, + { 0x3c2f8086, "SNB IOAT Ch1 (RAID)" }, + + { 0x0e208086, "IVB IOAT Ch0" }, + { 0x0e218086, "IVB IOAT Ch1" }, + { 0x0e228086, "IVB IOAT Ch2" }, + { 0x0e238086, "IVB IOAT Ch3" }, + { 0x0e248086, "IVB IOAT Ch4" }, + { 0x0e258086, "IVB IOAT Ch5" }, + { 0x0e268086, "IVB IOAT Ch6" }, + { 0x0e278086, "IVB IOAT Ch7" }, + { 0x0e2e8086, "IVB IOAT Ch0 (RAID)" }, + { 0x0e2f8086, "IVB IOAT Ch1 (RAID)" }, + + { 0x2f208086, "HSW IOAT Ch0" }, + { 0x2f218086, "HSW IOAT Ch1" }, + { 0x2f228086, "HSW IOAT Ch2" }, + { 0x2f238086, "HSW IOAT Ch3" }, + { 0x2f248086, "HSW IOAT Ch4" }, + { 0x2f258086, "HSW IOAT Ch5" }, + { 0x2f268086, "HSW IOAT Ch6" }, + { 0x2f278086, "HSW IOAT Ch7" }, + { 0x2f2e8086, "HSW IOAT Ch0 (RAID)" }, + { 0x2f2f8086, "HSW IOAT Ch1 (RAID)" }, + + { 0x0c508086, "BWD IOAT Ch0" }, + { 0x0c518086, "BWD IOAT Ch1" }, + { 0x0c528086, "BWD IOAT Ch2" }, + { 0x0c538086, "BWD IOAT Ch3" }, + + { 0x6f508086, "BDXDE IOAT Ch0" }, + { 0x6f518086, "BDXDE IOAT Ch1" }, + { 0x6f528086, "BDXDE IOAT Ch2" }, + { 0x6f538086, "BDXDE IOAT Ch3" }, + + { 0x6f208086, "BDX IOAT Ch0" }, + { 0x6f218086, "BDX IOAT Ch1" }, + { 0x6f228086, "BDX IOAT Ch2" }, + { 0x6f238086, "BDX IOAT Ch3" }, + { 0x6f248086, "BDX IOAT Ch4" }, + { 0x6f258086, "BDX IOAT Ch5" }, + { 0x6f268086, "BDX IOAT Ch6" }, + { 0x6f278086, "BDX IOAT Ch7" }, + { 0x6f2e8086, "BDX IOAT Ch0 (RAID)" }, + { 0x6f2f8086, "BDX IOAT Ch1 (RAID)" }, + + { 0x00000000, NULL } +}; + +/* + * OS <-> Driver linkage functions + */ +static int +ioat_probe(device_t device) +{ + struct _pcsid *ep; + u_int32_t type; + + type = pci_get_devid(device); + for (ep = pci_ids; ep->type; ep++) { + if (ep->type == type) { + device_set_desc(device, ep->desc); + return (0); + } + } + return (ENXIO); +} + +static int +ioat_attach(device_t device) +{ + struct ioat_softc *ioat; + int error; + + ioat = DEVICE2SOFTC(device); + ioat->device = device; + + error = ioat_map_pci_bar(ioat); + if (error != 0) + goto err; + + ioat->version = ioat_read_cbver(ioat); + if (ioat->version < IOAT_VER_3_0) { + error = ENODEV; + goto err; + } + + error = ioat3_attach(device); + if (error != 0) + goto err; + + error = pci_enable_busmaster(device); + if (error != 0) + goto err; + + error = ioat_setup_intr(ioat); + if (error != 0) + goto err; + + error = ioat_reset_hw(ioat); + if (error != 0) + goto err; + + ioat_process_events(ioat); + ioat_setup_sysctl(device); + + ioat->chan_idx = ioat_channel_index; + ioat_channel[ioat_channel_index++] = ioat; + ioat_test_attach(); + +err: + if (error != 0) + ioat_detach(device); + return (error); +} + +static int +ioat_detach(device_t device) +{ + struct ioat_softc *ioat; + + ioat = DEVICE2SOFTC(device); + + ioat_test_detach(); + taskqueue_drain(taskqueue_thread, &ioat->reset_task); + + mtx_lock(IOAT_REFLK); + ioat->quiescing = TRUE; + ioat->destroying = TRUE; + wakeup(&ioat->quiescing); + + ioat_channel[ioat->chan_idx] = NULL; + + ioat_drain_locked(ioat); + mtx_unlock(IOAT_REFLK); + + ioat_teardown_intr(ioat); + callout_drain(&ioat->timer); + + pci_disable_busmaster(device); + + if (ioat->pci_resource != NULL) + bus_release_resource(device, SYS_RES_MEMORY, + ioat->pci_resource_id, ioat->pci_resource); + + if (ioat->ring != NULL) + ioat_free_ring(ioat, 1 << ioat->ring_size_order, ioat->ring); + + if (ioat->comp_update != NULL) { + bus_dmamap_unload(ioat->comp_update_tag, ioat->comp_update_map); + bus_dmamem_free(ioat->comp_update_tag, ioat->comp_update, + ioat->comp_update_map); + bus_dma_tag_destroy(ioat->comp_update_tag); + } + + bus_dma_tag_destroy(ioat->hw_desc_tag); + + return (0); +} + +static int +ioat_teardown_intr(struct ioat_softc *ioat) +{ + + if (ioat->tag != NULL) + bus_teardown_intr(ioat->device, ioat->res, ioat->tag); + + if (ioat->res != NULL) + bus_release_resource(ioat->device, SYS_RES_IRQ, + rman_get_rid(ioat->res), ioat->res); + + pci_release_msi(ioat->device); + return (0); +} + +static int +ioat_start_channel(struct ioat_softc *ioat) +{ + uint64_t status; + uint32_t chanerr; + int i; + + ioat_acquire(&ioat->dmaengine); + ioat_null(&ioat->dmaengine, NULL, NULL, 0); + ioat_release(&ioat->dmaengine); + + for (i = 0; i < 100; i++) { + DELAY(1); + status = ioat_get_chansts(ioat); + if (is_ioat_idle(status)) + return (0); + } + + chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET); + ioat_log_message(0, "could not start channel: " + "status = %#jx error = %b\n", (uintmax_t)status, (int)chanerr, + IOAT_CHANERR_STR); + return (ENXIO); +} + +/* + * Initialize Hardware + */ +static int +ioat3_attach(device_t device) +{ + struct ioat_softc *ioat; + struct ioat_descriptor **ring; + struct ioat_descriptor *next; + struct ioat_dma_hw_descriptor *dma_hw_desc; + int i, num_descriptors; + int error; + uint8_t xfercap; + + error = 0; + ioat = DEVICE2SOFTC(device); + ioat->capabilities = ioat_read_dmacapability(ioat); + + ioat_log_message(1, "Capabilities: %b\n", (int)ioat->capabilities, + IOAT_DMACAP_STR); + + xfercap = ioat_read_xfercap(ioat); + ioat->max_xfer_size = 1 << xfercap; + + ioat->intrdelay_supported = (ioat_read_2(ioat, IOAT_INTRDELAY_OFFSET) & + IOAT_INTRDELAY_SUPPORTED) != 0; + if (ioat->intrdelay_supported) + ioat->intrdelay_max = IOAT_INTRDELAY_US_MASK; + + /* TODO: need to check DCA here if we ever do XOR/PQ */ + + mtx_init(&ioat->submit_lock, "ioat_submit", NULL, MTX_DEF); + mtx_init(&ioat->cleanup_lock, "ioat_cleanup", NULL, MTX_DEF); + callout_init(&ioat->timer, 1); + TASK_INIT(&ioat->reset_task, 0, ioat_reset_hw_task, ioat); + + /* Establish lock order for Witness */ + mtx_lock(&ioat->submit_lock); + mtx_lock(&ioat->cleanup_lock); + mtx_unlock(&ioat->cleanup_lock); + mtx_unlock(&ioat->submit_lock); + + ioat->is_resize_pending = FALSE; + ioat->is_completion_pending = FALSE; + ioat->is_reset_pending = FALSE; + ioat->is_channel_running = FALSE; + + bus_dma_tag_create(bus_get_dma_tag(ioat->device), sizeof(uint64_t), 0x0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + sizeof(uint64_t), 1, sizeof(uint64_t), 0, NULL, NULL, + &ioat->comp_update_tag); + + error = bus_dmamem_alloc(ioat->comp_update_tag, + (void **)&ioat->comp_update, BUS_DMA_ZERO, &ioat->comp_update_map); + if (ioat->comp_update == NULL) + return (ENOMEM); + + error = bus_dmamap_load(ioat->comp_update_tag, ioat->comp_update_map, + ioat->comp_update, sizeof(uint64_t), ioat_comp_update_map, ioat, + 0); + if (error != 0) + return (error); + + ioat->ring_size_order = IOAT_MIN_ORDER; + + num_descriptors = 1 << ioat->ring_size_order; + + bus_dma_tag_create(bus_get_dma_tag(ioat->device), 0x40, 0x0, + BUS_SPACE_MAXADDR_40BIT, BUS_SPACE_MAXADDR, NULL, NULL, + sizeof(struct ioat_dma_hw_descriptor), 1, + sizeof(struct ioat_dma_hw_descriptor), 0, NULL, NULL, + &ioat->hw_desc_tag); + + ioat->ring = malloc(num_descriptors * sizeof(*ring), M_IOAT, + M_ZERO | M_WAITOK); + + ring = ioat->ring; + for (i = 0; i < num_descriptors; i++) { + ring[i] = ioat_alloc_ring_entry(ioat, M_WAITOK); + if (ring[i] == NULL) + return (ENOMEM); + + ring[i]->id = i; + } + + for (i = 0; i < num_descriptors - 1; i++) { + next = ring[i + 1]; + dma_hw_desc = ring[i]->u.dma; + + dma_hw_desc->next = next->hw_desc_bus_addr; + } + + ring[i]->u.dma->next = ring[0]->hw_desc_bus_addr; + + ioat->head = ioat->hw_head = 0; + ioat->tail = 0; + ioat->last_seen = 0; + return (0); +} + +static int +ioat_map_pci_bar(struct ioat_softc *ioat) +{ + + ioat->pci_resource_id = PCIR_BAR(0); + ioat->pci_resource = bus_alloc_resource_any(ioat->device, + SYS_RES_MEMORY, &ioat->pci_resource_id, RF_ACTIVE); + + if (ioat->pci_resource == NULL) { + ioat_log_message(0, "unable to allocate pci resource\n"); + return (ENODEV); + } + + ioat->pci_bus_tag = rman_get_bustag(ioat->pci_resource); + ioat->pci_bus_handle = rman_get_bushandle(ioat->pci_resource); + return (0); +} + +static void +ioat_comp_update_map(void *arg, bus_dma_segment_t *seg, int nseg, int error) +{ + struct ioat_softc *ioat = arg; + + KASSERT(error == 0, ("%s: error:%d", __func__, error)); + ioat->comp_update_bus_addr = seg[0].ds_addr; +} + +static void +ioat_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + bus_addr_t *baddr; + + KASSERT(error == 0, ("%s: error:%d", __func__, error)); + baddr = arg; + *baddr = segs->ds_addr; +} + +/* + * Interrupt setup and handlers + */ +static int +ioat_setup_intr(struct ioat_softc *ioat) +{ + uint32_t num_vectors; + int error; + boolean_t use_msix; + boolean_t force_legacy_interrupts; + + use_msix = FALSE; + force_legacy_interrupts = FALSE; + + if (!g_force_legacy_interrupts && pci_msix_count(ioat->device) >= 1) { + num_vectors = 1; + pci_alloc_msix(ioat->device, &num_vectors); + if (num_vectors == 1) + use_msix = TRUE; + } + + if (use_msix) { + ioat->rid = 1; + ioat->res = bus_alloc_resource_any(ioat->device, SYS_RES_IRQ, + &ioat->rid, RF_ACTIVE); + } else { + ioat->rid = 0; + ioat->res = bus_alloc_resource_any(ioat->device, SYS_RES_IRQ, + &ioat->rid, RF_SHAREABLE | RF_ACTIVE); + } + if (ioat->res == NULL) { + ioat_log_message(0, "bus_alloc_resource failed\n"); + return (ENOMEM); + } + + ioat->tag = NULL; + error = bus_setup_intr(ioat->device, ioat->res, INTR_MPSAFE | + INTR_TYPE_MISC, NULL, ioat_interrupt_handler, ioat, &ioat->tag); + if (error != 0) { + ioat_log_message(0, "bus_setup_intr failed\n"); + return (error); + } + + ioat_write_intrctrl(ioat, IOAT_INTRCTRL_MASTER_INT_EN); + return (0); +} + +static boolean_t +ioat_model_resets_msix(struct ioat_softc *ioat) +{ + u_int32_t pciid; + + pciid = pci_get_devid(ioat->device); + switch (pciid) { + /* BWD: */ + case 0x0c508086: + case 0x0c518086: + case 0x0c528086: + case 0x0c538086: + /* BDXDE: */ + case 0x6f508086: + case 0x6f518086: + case 0x6f528086: + case 0x6f538086: + return (TRUE); + } + + return (FALSE); +} + +static void +ioat_interrupt_handler(void *arg) +{ + struct ioat_softc *ioat = arg; + + ioat->stats.interrupts++; + ioat_process_events(ioat); +} + +static int +chanerr_to_errno(uint32_t chanerr) +{ + + if (chanerr == 0) + return (0); + if ((chanerr & (IOAT_CHANERR_XSADDERR | IOAT_CHANERR_XDADDERR)) != 0) + return (EFAULT); + if ((chanerr & (IOAT_CHANERR_RDERR | IOAT_CHANERR_WDERR)) != 0) + return (EIO); + /* This one is probably our fault: */ + if ((chanerr & IOAT_CHANERR_NDADDERR) != 0) + return (EIO); + return (EIO); +} + +static void +ioat_process_events(struct ioat_softc *ioat) +{ + struct ioat_descriptor *desc; + struct bus_dmadesc *dmadesc; + uint64_t comp_update, status; + uint32_t completed, chanerr; + int error; + + mtx_lock(&ioat->cleanup_lock); + + completed = 0; + comp_update = *ioat->comp_update; + status = comp_update & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK; + + CTR0(KTR_IOAT, __func__); + + if (status == ioat->last_seen) { + /* + * If we landed in process_events and nothing has been + * completed, check for a timeout due to channel halt. + */ + comp_update = ioat_get_chansts(ioat); + goto out; + } + + while (1) { + desc = ioat_get_ring_entry(ioat, ioat->tail); + dmadesc = &desc->bus_dmadesc; + CTR1(KTR_IOAT, "completing desc %d", ioat->tail); + + if (dmadesc->callback_fn != NULL) + dmadesc->callback_fn(dmadesc->callback_arg, 0); + + completed++; + ioat->tail++; + if (desc->hw_desc_bus_addr == status) + break; + } + + ioat->last_seen = desc->hw_desc_bus_addr; + + if (ioat->head == ioat->tail) { + ioat->is_completion_pending = FALSE; + callout_reset(&ioat->timer, IOAT_INTR_TIMO, + ioat_timer_callback, ioat); + } + + ioat->stats.descriptors_processed += completed; + +out: + ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN); + mtx_unlock(&ioat->cleanup_lock); + + if (completed != 0) { + ioat_putn(ioat, completed, IOAT_ACTIVE_DESCR_REF); + wakeup(&ioat->tail); + } + + if (!is_ioat_halted(comp_update) && !is_ioat_suspended(comp_update)) + return; + + ioat->stats.channel_halts++; + + /* + * Fatal programming error on this DMA channel. Flush any outstanding + * work with error status and restart the engine. + */ + ioat_log_message(0, "Channel halted due to fatal programming error\n"); + mtx_lock(&ioat->submit_lock); + mtx_lock(&ioat->cleanup_lock); + ioat->quiescing = TRUE; + + chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET); + ioat_halted_debug(ioat, chanerr); + ioat->stats.last_halt_chanerr = chanerr; + + while (ioat_get_active(ioat) > 0) { + desc = ioat_get_ring_entry(ioat, ioat->tail); + dmadesc = &desc->bus_dmadesc; + CTR1(KTR_IOAT, "completing err desc %d", ioat->tail); + + if (dmadesc->callback_fn != NULL) + dmadesc->callback_fn(dmadesc->callback_arg, + chanerr_to_errno(chanerr)); + + ioat_putn_locked(ioat, 1, IOAT_ACTIVE_DESCR_REF); + ioat->tail++; + ioat->stats.descriptors_processed++; + ioat->stats.descriptors_error++; + } + + /* Clear error status */ + ioat_write_4(ioat, IOAT_CHANERR_OFFSET, chanerr); + + mtx_unlock(&ioat->cleanup_lock); + mtx_unlock(&ioat->submit_lock); + + ioat_log_message(0, "Resetting channel to recover from error\n"); + error = taskqueue_enqueue(taskqueue_thread, &ioat->reset_task); + KASSERT(error == 0, + ("%s: taskqueue_enqueue failed: %d", __func__, error)); +} + +static void +ioat_reset_hw_task(void *ctx, int pending __unused) +{ + struct ioat_softc *ioat; + int error; + + ioat = ctx; + ioat_log_message(1, "%s: Resetting channel\n", __func__); + + error = ioat_reset_hw(ioat); + KASSERT(error == 0, ("%s: reset failed: %d", __func__, error)); + (void)error; +} + +/* + * User API functions + */ +bus_dmaengine_t +ioat_get_dmaengine(uint32_t index, int flags) +{ + struct ioat_softc *ioat; + + KASSERT((flags & ~(M_NOWAIT | M_WAITOK)) == 0, + ("invalid flags: 0x%08x", flags)); + KASSERT((flags & (M_NOWAIT | M_WAITOK)) != (M_NOWAIT | M_WAITOK), + ("invalid wait | nowait")); + + if (index >= ioat_channel_index) + return (NULL); + + ioat = ioat_channel[index]; + if (ioat == NULL || ioat->destroying) + return (NULL); + + if (ioat->quiescing) { + if ((flags & M_NOWAIT) != 0) + return (NULL); + + mtx_lock(IOAT_REFLK); + while (ioat->quiescing && !ioat->destroying) + msleep(&ioat->quiescing, IOAT_REFLK, 0, "getdma", 0); + mtx_unlock(IOAT_REFLK); + + if (ioat->destroying) + return (NULL); + } + + /* + * There's a race here between the quiescing check and HW reset or + * module destroy. + */ + return (&ioat_get(ioat, IOAT_DMAENGINE_REF)->dmaengine); +} + +void +ioat_put_dmaengine(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + ioat_put(ioat, IOAT_DMAENGINE_REF); +} + +int +ioat_get_hwversion(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + return (ioat->version); +} + +size_t +ioat_get_max_io_size(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + return (ioat->max_xfer_size); +} + +int +ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + if (!ioat->intrdelay_supported) + return (ENODEV); + if (delay > ioat->intrdelay_max) + return (ERANGE); + + ioat_write_2(ioat, IOAT_INTRDELAY_OFFSET, delay); + ioat->cached_intrdelay = + ioat_read_2(ioat, IOAT_INTRDELAY_OFFSET) & IOAT_INTRDELAY_US_MASK; + return (0); +} + +uint16_t +ioat_get_max_coalesce_period(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + return (ioat->intrdelay_max); +} + +void +ioat_acquire(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + mtx_lock(&ioat->submit_lock); + CTR0(KTR_IOAT, __func__); +} + +int +ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags) +{ + struct ioat_softc *ioat; + int error; + + ioat = to_ioat_softc(dmaengine); + ioat_acquire(dmaengine); + + error = ioat_reserve_space(ioat, n, mflags); + if (error != 0) + ioat_release(dmaengine); + return (error); +} + +void +ioat_release(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + CTR0(KTR_IOAT, __func__); + ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->hw_head); + mtx_unlock(&ioat->submit_lock); +} + +static struct ioat_descriptor * +ioat_op_generic(struct ioat_softc *ioat, uint8_t op, + uint32_t size, uint64_t src, uint64_t dst, + bus_dmaengine_callback_t callback_fn, void *callback_arg, + uint32_t flags) +{ + struct ioat_generic_hw_descriptor *hw_desc; + struct ioat_descriptor *desc; + int mflags; + + mtx_assert(&ioat->submit_lock, MA_OWNED); + + KASSERT((flags & ~_DMA_GENERIC_FLAGS) == 0, + ("Unrecognized flag(s): %#x", flags & ~_DMA_GENERIC_FLAGS)); + if ((flags & DMA_NO_WAIT) != 0) + mflags = M_NOWAIT; + else + mflags = M_WAITOK; + + if (size > ioat->max_xfer_size) { + ioat_log_message(0, "%s: max_xfer_size = %d, requested = %u\n", + __func__, ioat->max_xfer_size, (unsigned)size); + return (NULL); + } + + if (ioat_reserve_space(ioat, 1, mflags) != 0) + return (NULL); + + desc = ioat_get_ring_entry(ioat, ioat->head); + hw_desc = desc->u.generic; + + hw_desc->u.control_raw = 0; + hw_desc->u.control_generic.op = op; + hw_desc->u.control_generic.completion_update = 1; + + if ((flags & DMA_INT_EN) != 0) + hw_desc->u.control_generic.int_enable = 1; + if ((flags & DMA_FENCE) != 0) + hw_desc->u.control_generic.fence = 1; + + hw_desc->size = size; + hw_desc->src_addr = src; + hw_desc->dest_addr = dst; + + desc->bus_dmadesc.callback_fn = callback_fn; + desc->bus_dmadesc.callback_arg = callback_arg; + return (desc); +} + +struct bus_dmadesc * +ioat_null(bus_dmaengine_t dmaengine, bus_dmaengine_callback_t callback_fn, + void *callback_arg, uint32_t flags) +{ + struct ioat_dma_hw_descriptor *hw_desc; + struct ioat_descriptor *desc; + struct ioat_softc *ioat; + + CTR0(KTR_IOAT, __func__); + ioat = to_ioat_softc(dmaengine); + + desc = ioat_op_generic(ioat, IOAT_OP_COPY, 8, 0, 0, callback_fn, + callback_arg, flags); + if (desc == NULL) + return (NULL); + + hw_desc = desc->u.dma; + hw_desc->u.control.null = 1; + ioat_submit_single(ioat); + return (&desc->bus_dmadesc); +} + +struct bus_dmadesc * +ioat_copy(bus_dmaengine_t dmaengine, bus_addr_t dst, + bus_addr_t src, bus_size_t len, bus_dmaengine_callback_t callback_fn, + void *callback_arg, uint32_t flags) +{ + struct ioat_dma_hw_descriptor *hw_desc; + struct ioat_descriptor *desc; + struct ioat_softc *ioat; + + CTR0(KTR_IOAT, __func__); + ioat = to_ioat_softc(dmaengine); + + if (((src | dst) & (0xffffull << 48)) != 0) { + ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n", + __func__); + return (NULL); + } + + desc = ioat_op_generic(ioat, IOAT_OP_COPY, len, src, dst, callback_fn, + callback_arg, flags); + if (desc == NULL) + return (NULL); + + hw_desc = desc->u.dma; + if (g_ioat_debug_level >= 3) + dump_descriptor(hw_desc); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Wed May 25 07:14:53 2016 Return-Path: Delivered-To: svn-src-stable-10@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 7AA7AB49335; Wed, 25 May 2016 07:14:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 385B31C5E; Wed, 25 May 2016 07:14:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P7EqLH021704; Wed, 25 May 2016 07:14:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P7EqhX021703; Wed, 25 May 2016 07:14:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605250714.u4P7EqhX021703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 May 2016 07:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300663 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 07:14:53 -0000 Author: mav Date: Wed May 25 07:14:52 2016 New Revision: 300663 URL: https://svnweb.freebsd.org/changeset/base/300663 Log: Add ioat.4 missed in r300661. Added: stable/10/share/man/man4/ioat.4 (contents, props changed) Added: stable/10/share/man/man4/ioat.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/man/man4/ioat.4 Wed May 25 07:14:52 2016 (r300663) @@ -0,0 +1,334 @@ +.\" Copyright (c) 2015 EMC / Isilon Storage Division +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 3, 2016 +.Dt IOAT 4 +.Os +.Sh NAME +.Nm I/OAT +.Nd Intel I/O Acceleration Technology +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following line in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ioat" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ioat_load="YES" +.Ed +.Pp +In +.Xr loader.conf 5 : +.Pp +.Cd hw.ioat.force_legacy_interrupts=0 +.Pp +In +.Xr loader.conf 5 or +.Xr sysctl.conf 5 : +.Pp +.Cd hw.ioat.enable_ioat_test=0 +.Cd hw.ioat.debug_level=0 +(only critical errors; maximum of 3) +.Pp +.Ft typedef void +.Fn (*bus_dmaengine_callback_t) "void *arg" "int error" +.Pp +.Ft bus_dmaengine_t +.Fn ioat_get_dmaengine "uint32_t channel_index" +.Ft void +.Fn ioat_put_dmaengine "bus_dmaengine_t dmaengine" +.Ft int +.Fn ioat_get_hwversion "bus_dmaengine_t dmaengine" +.Ft size_t +.Fn ioat_get_max_io_size "bus_dmaengine_t dmaengine" +.Ft int +.Fn ioat_set_interrupt_coalesce "bus_dmaengine_t dmaengine" "uint16_t delay" +.Ft uint16_t +.Fn ioat_get_max_coalesce_period "bus_dmaengine_t dmaengine" +.Ft void +.Fn ioat_acquire "bus_dmaengine_t dmaengine" +.Ft int +.Fn ioat_acquire_reserve "bus_dmaengine_t dmaengine" "uint32_t n" "int mflags" +.Ft void +.Fn ioat_release "bus_dmaengine_t dmaengine" +.Ft struct bus_dmadesc * +.Fo ioat_copy +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t dst" +.Fa "bus_addr_t src" +.Fa "bus_size_t len" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_copy_8k_aligned +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t dst1" +.Fa "bus_addr_t dst2" +.Fa "bus_addr_t src1" +.Fa "bus_addr_t src2" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_copy_crc +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t dst" +.Fa "bus_addr_t src" +.Fa "bus_size_t len" +.Fa "uint32_t *initialseed" +.Fa "bus_addr_t crcptr" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_crc +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t src" +.Fa "bus_size_t len" +.Fa "uint32_t *initialseed" +.Fa "bus_addr_t crcptr" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_blockfill +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t dst" +.Fa "uint64_t fillpattern" +.Fa "bus_size_t len" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_null +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Sh DESCRIPTION +The +.Nm +driver provides a kernel API to a variety of DMA engines on some Intel server +platforms. +.Pp +There is a number of DMA channels per CPU package. +(Typically 4 or 8.) +Each may be used independently. +Operations on a single channel proceed sequentially. +.Pp +Blockfill operations can be used to write a 64-bit pattern to memory. +.Pp +Copy operations can be used to offload memory copies to the DMA engines. +.Pp +Null operations do nothing, but may be used to test the interrupt and callback +mechanism. +.Pp +All operations can optionally trigger an interrupt at completion with the +.Ar DMA_INT_EN +flag. +For example, a user might submit multiple operations to the same channel and +only enable an interrupt and callback for the last operation. +.Pp +The hardware can delay and coalesce interrupts on a given channel for a +configurable period of time, in microseconds. +This may be desired to reduce the processing and interrupt overhead per +descriptor, especially for workflows consisting of many small operations. +Software can control this on a per-channel basis with the +.Fn ioat_set_interrupt_coalesce +API. +The +.Fn ioat_get_max_coalesce_period +API can be used to determine the maximum coalescing period supported by the +hardware, in microseconds. +Current platforms support up to a 16.383 millisecond coalescing period. +Optimal configuration will vary by workflow and desired operation latency. +.Pp +All operations are safe to use in a non-blocking context with the +.Ar DMA_NO_WAIT +flag. +(Of course, allocations may fail and operations requested with +.Ar DMA_NO_WAIT +may return NULL.) +.Pp +Operations that depend on the result of prior operations should use +.Ar DMA_FENCE . +For example, such a scenario can happen when two related DMA operations are +queued. +First, a DMA copy to one location (A), followed directly by a DMA copy +from A to B. +In this scenario, some classes of I/OAT hardware may prefetch A for the second +operation before it is written by the first operation. +To avoid reading a stale value in sequences of dependent operations, use +.Ar DMA_FENCE . +.Pp +All operations, as well as +.Fn ioat_get_dmaengine , +can return NULL in special circumstances. +For example, if the +.Nm +driver is being unloaded, or the administrator has induced a hardware reset, or +a usage error has resulted in a hardware error state that needs to be recovered +from. +.Pp +It is invalid to attempt to submit new DMA operations in a +.Fa bus_dmaengine_callback_t +context. +.Pp +The CRC operations have three distinct modes. +The default mode is to accumulate. +By accumulating over multiple descriptors, a user may gather a CRC over several +chunks of memory and only write out the result once. +.Pp +The +.Ar DMA_CRC_STORE +flag causes the operation to emit the CRC32C result. +If +.Ar DMA_CRC_INLINE +is set, the result is written inline with the destination data (or source in +.Fn ioat_crc +mode). +If +.Ar DMA_CRC_INLINE +is not set, the result is written to the provided +.Fa crcptr . +.Pp +Similarly, the +.Ar DMA_CRC_TEST +flag causes the operation to compare the CRC32C result to an existing checksum. +If +.Ar DMA_CRC_INLINE +is set, the result is compared against the inline four bytes trailing the +source data. +If it is not set, the result is compared against the value pointed to by +.Fa crcptr . +.Pp +.Fn ioat_copy_crc +calculates a CRC32C while copying data. +.Fn ioat_crc +only computes a CRC32C of some data. +If the +.Fa initialseed +argument to either routine is non-NULL, the CRC32C engine is initialized with +the value it points to. +.Sh USAGE +A typical user will lookup the DMA engine object for a given channel with +.Fn ioat_get_dmaengine . +When the user wants to offload a copy, they will first +.Fn ioat_acquire +the +.Ar bus_dmaengine_t +object for exclusive access to enqueue operations on that channel. +Optionally, the user can reserve space by using +.Fn ioat_acquire_reserve +instead. +If +.Fn ioat_acquire_reserve +succeeds, there is guaranteed to be room for +.Fa N +new operations in the internal ring buffer. +.Pp +Then, they will submit one or more operations using +.Fn ioat_blockfill , +.Fn ioat_copy , +.Fn ioat_copy_8k_aligned , +.Fn ioat_copy_crc , +.Fn ioat_crc , +or +.Fn ioat_null . +After queuing one or more individual DMA operations, they will +.Fn ioat_release +the +.Ar bus_dmaengine_t +to drop their exclusive access to the channel. +The routine they provided for the +.Fa callback_fn +argument will be invoked with the provided +.Fa callback_arg +when the operation is complete. +When they are finished with the +.Ar bus_dmaengine_t , +the user should +.Fn ioat_put_dmaengine . +.Pp +Users MUST NOT block between +.Fn ioat_acquire +and +.Fn ioat_release . +Users SHOULD NOT hold +.Ar bus_dmaengine_t +references for a very long time to enable fault recovery and kernel module +unload. +.Pp +For an example of usage, see +.Pa src/sys/dev/ioat/ioat_test.c . +.Sh FILES +.Bl -tag +.It Pa /dev/ioat_test +test device for +.Xr ioatcontrol 8 +.El +.Sh SEE ALSO +.Xr ioatcontrol 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 11.0 . +.Sh AUTHORS +The +.Nm +driver was developed by +.An \&Jim Harris Aq Mt jimharris@FreeBSD.org , +.An \&Carl Delsey Aq Mt carl.r.delsey@intel.com , +and +.An \&Conrad Meyer Aq Mt cem@FreeBSD.org . +This manual page was written by +.An \&Conrad Meyer Aq Mt cem@FreeBSD.org . +.Sh CAVEATS +Copy operation takes bus addresses as parameters, not virtual addresses. +.Pp +Buffers for individual copy operations must be physically contiguous. +.Pp +Copies larger than max transfer size (1MB, but may vary by hardware) are not +supported. +Future versions will likely support this by breaking up the transfer into +smaller sizes. +.Sh BUGS +The +.Nm +driver only supports blockfill, copy, and null operations at this time. +The driver does not yet support advanced DMA modes, such as XOR, that some +I/OAT devices support. From owner-svn-src-stable-10@freebsd.org Wed May 25 08:09:15 2016 Return-Path: Delivered-To: svn-src-stable-10@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 DBF6CB49514; Wed, 25 May 2016 08:09:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8D811EC4; Wed, 25 May 2016 08:09:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P89EMN036813; Wed, 25 May 2016 08:09:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P89EFZ036812; Wed, 25 May 2016 08:09:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605250809.u4P89EFZ036812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 May 2016 08:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300668 - stable/10/tools/tools/ioat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 08:09:16 -0000 Author: mav Date: Wed May 25 08:09:14 2016 New Revision: 300668 URL: https://svnweb.freebsd.org/changeset/base/300668 Log: Fix build on stable/10. Modified: stable/10/tools/tools/ioat/Makefile Modified: stable/10/tools/tools/ioat/Makefile ============================================================================== --- stable/10/tools/tools/ioat/Makefile Wed May 25 07:48:36 2016 (r300667) +++ stable/10/tools/tools/ioat/Makefile Wed May 25 08:09:14 2016 (r300668) @@ -4,6 +4,7 @@ PROG= ioatcontrol MAN= ioatcontrol.8 CFLAGS+= -I${.CURDIR:H:H:H}/sys/dev/ioat WARNS?= 6 -LIBADD= util +#LIBADD= util +LDADD= -lutil .include From owner-svn-src-stable-10@freebsd.org Wed May 25 10:04:54 2016 Return-Path: Delivered-To: svn-src-stable-10@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 6582CB49C05; Wed, 25 May 2016 10:04:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 368B61E16; Wed, 25 May 2016 10:04:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PA4r2C073135; Wed, 25 May 2016 10:04:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PA4rbj073134; Wed, 25 May 2016 10:04:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605251004.u4PA4rbj073134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 25 May 2016 10:04:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300673 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 10:04:54 -0000 Author: kib Date: Wed May 25 10:04:53 2016 New Revision: 300673 URL: https://svnweb.freebsd.org/changeset/base/300673 Log: MFC r300432: Giant is dropped by mi_startup() before passing the control to swapper. Modified: stable/10/sys/vm/vm_glue.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_glue.c ============================================================================== --- stable/10/sys/vm/vm_glue.c Wed May 25 10:02:14 2016 (r300672) +++ stable/10/sys/vm/vm_glue.c Wed May 25 10:04:53 2016 (r300673) @@ -732,8 +732,6 @@ faultin(p) * This swapin algorithm attempts to swap-in processes only if there * is enough space for them. Of course, if a process waits for a long * time, it will be swapped in anyway. - * - * Giant is held on entry. */ void swapper(void) From owner-svn-src-stable-10@freebsd.org Wed May 25 14:30:34 2016 Return-Path: Delivered-To: svn-src-stable-10@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 DA139B49B6B; Wed, 25 May 2016 14:30:34 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A82901F56; Wed, 25 May 2016 14:30:34 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PEUXcU052593; Wed, 25 May 2016 14:30:33 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PEUXim052592; Wed, 25 May 2016 14:30:33 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201605251430.u4PEUXim052592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 25 May 2016 14:30:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300681 - stable/10/usr.sbin/camdd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 14:30:35 -0000 Author: ken Date: Wed May 25 14:30:33 2016 New Revision: 300681 URL: https://svnweb.freebsd.org/changeset/base/300681 Log: MFC r300224: ------------------------------------------------------------------------ r300224 | ken | 2016-05-19 13:13:43 -0600 (Thu, 19 May 2016) | 12 lines Adjust a couple of error cases in camdd(8). usr.sbin/camdd/camdd.c: In camdd_probe_file(), fix an error case after fstat where we were bailing out and leaving two lines of cleanup code unexecuted. Instead, just goto bailout_error. In camdd_probe_pass(), fail if the sector size is 0. ------------------------------------------------------------------------ Sponsored by: Spectra Logic Modified: stable/10/usr.sbin/camdd/camdd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/camdd/camdd.c ============================================================================== --- stable/10/usr.sbin/camdd/camdd.c Wed May 25 14:08:21 2016 (r300680) +++ stable/10/usr.sbin/camdd/camdd.c Wed May 25 14:30:33 2016 (r300681) @@ -1079,9 +1079,7 @@ camdd_probe_file(int fd, struct camdd_io retval = fstat(fd, &file_dev->sb); if (retval != 0) { warn("Cannot stat %s", dev->device_name); - goto bailout; - camdd_free_dev(dev); - dev = NULL; + goto bailout_error; } if (S_ISREG(file_dev->sb.st_mode)) { file_dev->file_type = CAMDD_FILE_REG; @@ -1383,6 +1381,11 @@ camdd_probe_pass(struct cam_device *cam_ block_len = scsi_4btoul(rcaplong.length); rcap_done: + if (block_len == 0) { + warnx("Sector size for %s%u is 0, cannot continue", + cam_dev->device_name, cam_dev->dev_unit_num); + goto bailout_error; + } bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); From owner-svn-src-stable-10@freebsd.org Wed May 25 15:10:09 2016 Return-Path: Delivered-To: svn-src-stable-10@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 0B310B4A60F; Wed, 25 May 2016 15:10:09 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B24D217E8; Wed, 25 May 2016 15:10:08 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4PFA7eq065170; Wed, 25 May 2016 15:10:07 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4PFA7eh065168; Wed, 25 May 2016 15:10:07 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201605251510.u4PFA7eh065168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 25 May 2016 15:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300682 - in stable/10: lib/libmt usr.bin/mt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 15:10:09 -0000 Author: ken Date: Wed May 25 15:10:07 2016 New Revision: 300682 URL: https://svnweb.freebsd.org/changeset/base/300682 Log: MFC r300327: ------------------------------------------------------------------------ r300327 | ken | 2016-05-20 13:30:52 -0600 (Fri, 20 May 2016) | 11 lines Add the density code for LTO-7 to libmt and the mt(1) man page. The density code and bits per mm values were obtained from an actual drive density report. The number of tracks were obtained from an LTO-7 hardware announcement on IBM's web site. ------------------------------------------------------------------------ Sponsored by: Spectra Logic Modified: stable/10/lib/libmt/mtlib.c stable/10/usr.bin/mt/mt.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libmt/mtlib.c ============================================================================== --- stable/10/lib/libmt/mtlib.c Wed May 25 14:30:33 2016 (r300681) +++ stable/10/lib/libmt/mtlib.c Wed May 25 15:10:07 2016 (r300682) @@ -643,6 +643,7 @@ static struct densities { { 0x55, 20670, 525018, "3592A5 (unencrypted)" }, { 0x58, 15142, 384607, "LTO-5" }, { 0x5A, 15142, 384607, "LTO-6" }, + { 0x5C, 19107, 485318, "LTO-7" }, { 0x71, 11800, 299720, "3592A1 (encrypted)" }, { 0x72, 11800, 299720, "3592A2 (encrypted)" }, { 0x73, 13452, 341681, "3592A3 (encrypted)" }, Modified: stable/10/usr.bin/mt/mt.1 ============================================================================== --- stable/10/usr.bin/mt/mt.1 Wed May 25 14:30:33 2016 (r300681) +++ stable/10/usr.bin/mt/mt.1 Wed May 25 15:10:07 2016 (r300682) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 3, 2014 +.Dd May 20, 2016 .Dt MT 1 .Os .Sh NAME @@ -517,6 +517,7 @@ Value Width Tracks Density 0x55 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (unencrypted) 0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5 0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6 +0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7 0x71 12.7 (0.5) 512 11,800 (299,720) C 3592A1 (encrypted) 0x72 12.7 (0.5) 896 11,800 (299,720) C 3592A2 (encrypted) 0x73 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (encrypted) From owner-svn-src-stable-10@freebsd.org Thu May 26 11:01:27 2016 Return-Path: Delivered-To: svn-src-stable-10@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 0FB95B4B162; Thu, 26 May 2016 11:01:27 +0000 (UTC) (envelope-from kadesai@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6D4317AB; Thu, 26 May 2016 11:01:26 +0000 (UTC) (envelope-from kadesai@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QB1PcZ097192; Thu, 26 May 2016 11:01:25 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QB1P6S097190; Thu, 26 May 2016 11:01:25 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201605261101.u4QB1P6S097190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Thu, 26 May 2016 11:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300730 - stable/10/sys/dev/mrsas X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2016 11:01:27 -0000 Author: kadesai Date: Thu May 26 11:01:25 2016 New Revision: 300730 URL: https://svnweb.freebsd.org/changeset/base/300730 Log: MFC r284872 - 284873 r284872: Kernel panic may be observed by user, if MR controller is under Chip reset (OCR) r284873: Counter part of mfi driver commit in mrsas gracefully fail, if the /dev/megaraid_sas_ioctl_node symlink already exists Modified: stable/10/sys/dev/mrsas/mrsas.c stable/10/sys/dev/mrsas/mrsas.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mrsas/mrsas.c ============================================================================== --- stable/10/sys/dev/mrsas/mrsas.c Thu May 26 10:55:19 2016 (r300729) +++ stable/10/sys/dev/mrsas/mrsas.c Thu May 26 11:01:25 2016 (r300730) @@ -811,6 +811,7 @@ mrsas_attach(device_t dev) { struct mrsas_softc *sc = device_get_softc(dev); uint32_t cmd, bar, error; + struct cdev *linux_dev; /* Look up our softc and initialize its fields. */ sc->mrsas_dev = dev; @@ -870,7 +871,8 @@ mrsas_attach(device_t dev) GID_OPERATOR, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP), "mrsas%u", device_get_unit(dev)); if (device_get_unit(dev) == 0) - make_dev_alias(sc->mrsas_cdev, "megaraid_sas_ioctl_node"); + make_dev_alias_p(MAKEDEV_CHECKNAME, &linux_dev, sc->mrsas_cdev, + "megaraid_sas_ioctl_node"); if (sc->mrsas_cdev) sc->mrsas_cdev->si_drv1 = sc; @@ -2712,6 +2714,7 @@ mrsas_reset_ctrl(struct mrsas_softc *sc) "resetting adapter from %s.\n", __func__); /* Now return commands back to the CAM layer */ + mtx_unlock(&sc->sim_lock); for (i = 0; i < sc->max_fw_cmds; i++) { mpt_cmd = sc->mpt_cmd_list[i]; if (mpt_cmd->ccb_ptr) { @@ -2721,6 +2724,7 @@ mrsas_reset_ctrl(struct mrsas_softc *sc) mrsas_atomic_dec(&sc->fw_outstanding); } } + mtx_lock(&sc->sim_lock); status_reg = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_scratch_pad)); Modified: stable/10/sys/dev/mrsas/mrsas.h ============================================================================== --- stable/10/sys/dev/mrsas/mrsas.h Thu May 26 10:55:19 2016 (r300729) +++ stable/10/sys/dev/mrsas/mrsas.h Thu May 26 11:01:25 2016 (r300730) @@ -102,7 +102,7 @@ __FBSDID("$FreeBSD$"); */ #define BYTE_ALIGNMENT 1 #define MRSAS_MAX_NAME_LENGTH 32 -#define MRSAS_VERSION "06.707.04.03-fbsd" +#define MRSAS_VERSION "06.707.05.00-fbsd" #define MRSAS_ULONG_MAX 0xFFFFFFFFFFFFFFFF #define MRSAS_DEFAULT_TIMEOUT 0x14 /* Temporarily set */ #define DONE 0 From owner-svn-src-stable-10@freebsd.org Thu May 26 12:00:15 2016 Return-Path: Delivered-To: svn-src-stable-10@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 F270CB4AC35; Thu, 26 May 2016 12:00:15 +0000 (UTC) (envelope-from kadesai@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90CAF12F5; Thu, 26 May 2016 12:00:15 +0000 (UTC) (envelope-from kadesai@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QC0Esk017999; Thu, 26 May 2016 12:00:14 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QC0EdX017997; Thu, 26 May 2016 12:00:14 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201605261200.u4QC0EdX017997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Thu, 26 May 2016 12:00:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300736 - stable/10/sys/dev/mrsas X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2016 12:00:16 -0000 Author: kadesai Date: Thu May 26 12:00:14 2016 New Revision: 300736 URL: https://svnweb.freebsd.org/changeset/base/300736 Log: MFC r299666 - r299672 r299666: Takes care of any firmware command timeout scenarios by initiating OCR. r299667: Similar to RAID map for Logical Drives, now JBOD map has been introduced r299668: This patch implements driver support for 1MB IO size. r299669: Implemented interrupt Config Hook in mrsas(4) to defer some of the tasks, like: registering AEN, creating cdev. r299670: Added support for Avago Intruder controller. r299671: bugs fixed as part of this patch in kdump and some NULL pointer dereference r299672: Version update patch. Sponsored by: AVAGO Technologies/ Broadcom Limited Modified: stable/10/sys/dev/mrsas/mrsas.c stable/10/sys/dev/mrsas/mrsas.h stable/10/sys/dev/mrsas/mrsas_cam.c stable/10/sys/dev/mrsas/mrsas_fp.c stable/10/sys/dev/mrsas/mrsas_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mrsas/mrsas.c ============================================================================== --- stable/10/sys/dev/mrsas/mrsas.c Thu May 26 11:58:36 2016 (r300735) +++ stable/10/sys/dev/mrsas/mrsas.c Thu May 26 12:00:14 2016 (r300736) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -63,6 +64,7 @@ static d_write_t mrsas_write; static d_ioctl_t mrsas_ioctl; static d_poll_t mrsas_poll; +static void mrsas_ich_startup(void *arg); static struct mrsas_mgmt_info mrsas_mgmt_info; static struct mrsas_ident *mrsas_find_ident(device_t); static int mrsas_setup_msix(struct mrsas_softc *sc); @@ -80,7 +82,8 @@ static int mrsas_setup_irq(struct mrsas_ static int mrsas_alloc_mem(struct mrsas_softc *sc); static int mrsas_init_fw(struct mrsas_softc *sc); static int mrsas_setup_raidmap(struct mrsas_softc *sc); -static int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex); +static void megasas_setup_jbod_map(struct mrsas_softc *sc); +static int megasas_sync_pd_seq_num(struct mrsas_softc *sc, boolean_t pend); static int mrsas_clear_intr(struct mrsas_softc *sc); static int mrsas_get_ctrl_info(struct mrsas_softc *sc); static void mrsas_update_ext_vd_details(struct mrsas_softc *sc); @@ -104,8 +107,9 @@ int mrsas_ioc_init(struct mrsas_softc *s int mrsas_bus_scan(struct mrsas_softc *sc); int mrsas_issue_dcmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); int mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); -int mrsas_reset_ctrl(struct mrsas_softc *sc); -int mrsas_wait_for_outstanding(struct mrsas_softc *sc); +int mrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason); +int mrsas_wait_for_outstanding(struct mrsas_softc *sc, u_int8_t check_reason); +int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex); int mrsas_issue_blocked_cmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); @@ -182,6 +186,8 @@ MRSAS_CTLR_ID device_table[] = { {0x1000, MRSAS_TBOLT, 0xffff, 0xffff, "AVAGO Thunderbolt SAS Controller"}, {0x1000, MRSAS_INVADER, 0xffff, 0xffff, "AVAGO Invader SAS Controller"}, {0x1000, MRSAS_FURY, 0xffff, 0xffff, "AVAGO Fury SAS Controller"}, + {0x1000, MRSAS_INTRUDER, 0xffff, 0xffff, "AVAGO Intruder SAS Controller"}, + {0x1000, MRSAS_INTRUDER_24, 0xffff, 0xffff, "AVAGO Intruder_24 SAS Controller"}, {0, 0, 0, 0, NULL} }; @@ -553,6 +559,7 @@ mrsas_get_seq_num(struct mrsas_softc *sc { struct mrsas_mfi_cmd *cmd; struct mrsas_dcmd_frame *dcmd; + u_int8_t do_ocr = 1, retcode = 0; cmd = mrsas_get_mfi_cmd(sc); @@ -580,16 +587,24 @@ mrsas_get_seq_num(struct mrsas_softc *sc dcmd->sgl.sge32[0].phys_addr = sc->el_info_phys_addr; dcmd->sgl.sge32[0].length = sizeof(struct mrsas_evt_log_info); - mrsas_issue_blocked_cmd(sc, cmd); + retcode = mrsas_issue_blocked_cmd(sc, cmd); + if (retcode == ETIMEDOUT) + goto dcmd_timeout; + do_ocr = 0; /* * Copy the data back into callers buffer */ memcpy(eli, sc->el_info_mem, sizeof(struct mrsas_evt_log_info)); mrsas_free_evt_log_info_cmd(sc); - mrsas_release_mfi_cmd(cmd); - return 0; +dcmd_timeout: + if (do_ocr) + sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR; + else + mrsas_release_mfi_cmd(cmd); + + return retcode; } @@ -811,7 +826,8 @@ mrsas_attach(device_t dev) { struct mrsas_softc *sc = device_get_softc(dev); uint32_t cmd, bar, error; - struct cdev *linux_dev; + + memset(sc, 0, sizeof(struct mrsas_softc)); /* Look up our softc and initialize its fields. */ sc->mrsas_dev = dev; @@ -852,12 +868,6 @@ mrsas_attach(device_t dev) mtx_init(&sc->mfi_cmd_pool_lock, "mrsas_mfi_cmd_pool_lock", NULL, MTX_DEF); mtx_init(&sc->raidmap_lock, "mrsas_raidmap_lock", NULL, MTX_DEF); - /* - * Intialize a counting Semaphore to take care no. of concurrent - * IOCTLs - */ - sema_init(&sc->ioctl_count_sema, MRSAS_MAX_MFI_CMDS - 5, IOCTL_SEMA_DESCRIPTION); - /* Intialize linked list */ TAILQ_INIT(&sc->mrsas_mpt_cmd_list_head); TAILQ_INIT(&sc->mrsas_mfi_cmd_list_head); @@ -866,16 +876,6 @@ mrsas_attach(device_t dev) sc->io_cmds_highwater = 0; - /* Create a /dev entry for this device. */ - sc->mrsas_cdev = make_dev(&mrsas_cdevsw, device_get_unit(dev), UID_ROOT, - GID_OPERATOR, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP), "mrsas%u", - device_get_unit(dev)); - if (device_get_unit(dev) == 0) - make_dev_alias_p(MAKEDEV_CHECKNAME, &linux_dev, sc->mrsas_cdev, - "megaraid_sas_ioctl_node"); - if (sc->mrsas_cdev) - sc->mrsas_cdev->si_drv1 = sc; - sc->adprecovery = MRSAS_HBA_OPERATIONAL; sc->UnevenSpanSupport = 0; @@ -885,7 +885,7 @@ mrsas_attach(device_t dev) if (mrsas_init_fw(sc) != SUCCESS) { goto attach_fail_fw; } - /* Register SCSI mid-layer */ + /* Register mrsas to CAM layer */ if ((mrsas_cam_attach(sc) != SUCCESS)) { goto attach_fail_cam; } @@ -893,38 +893,28 @@ mrsas_attach(device_t dev) if (mrsas_setup_irq(sc) != SUCCESS) { goto attach_fail_irq; } - /* Enable Interrupts */ - mrsas_enable_intr(sc); - error = mrsas_kproc_create(mrsas_ocr_thread, sc, &sc->ocr_thread, 0, 0, "mrsas_ocr%d", device_get_unit(sc->mrsas_dev)); if (error) { - printf("Error %d starting rescan thread\n", error); - goto attach_fail_irq; - } - mrsas_setup_sysctl(sc); - - /* Initiate AEN (Asynchronous Event Notification) */ - - if (mrsas_start_aen(sc)) { - printf("Error: start aen failed\n"); - goto fail_start_aen; + device_printf(sc->mrsas_dev, "Error %d starting OCR thread\n", error); + goto attach_fail_ocr_thread; } /* - * Add this controller to mrsas_mgmt_info structure so that it can be - * exported to management applications + * After FW initialization and OCR thread creation + * we will defer the cdev creation, AEN setup on ICH callback */ - if (device_get_unit(dev) == 0) - memset(&mrsas_mgmt_info, 0, sizeof(mrsas_mgmt_info)); - - mrsas_mgmt_info.count++; - mrsas_mgmt_info.sc_ptr[mrsas_mgmt_info.max_index] = sc; - mrsas_mgmt_info.max_index++; - - return (0); + sc->mrsas_ich.ich_func = mrsas_ich_startup; + sc->mrsas_ich.ich_arg = sc; + if (config_intrhook_establish(&sc->mrsas_ich) != 0) { + device_printf(sc->mrsas_dev, "Config hook is already established\n"); + } + mrsas_setup_sysctl(sc); + return SUCCESS; -fail_start_aen: +attach_fail_ocr_thread: + if (sc->ocr_thread_active) + wakeup(&sc->ocr_chan); attach_fail_irq: mrsas_teardown_intr(sc); attach_fail_cam: @@ -942,10 +932,7 @@ attach_fail_fw: mtx_destroy(&sc->mpt_cmd_pool_lock); mtx_destroy(&sc->mfi_cmd_pool_lock); mtx_destroy(&sc->raidmap_lock); - /* Destroy the counting semaphore created for Ioctl */ - sema_destroy(&sc->ioctl_count_sema); attach_fail: - destroy_dev(sc->mrsas_cdev); if (sc->reg_res) { bus_release_resource(sc->mrsas_dev, SYS_RES_MEMORY, sc->reg_res_id, sc->reg_res); @@ -954,6 +941,63 @@ attach_fail: } /* + * Interrupt config hook + */ +static void +mrsas_ich_startup(void *arg) +{ + struct mrsas_softc *sc = (struct mrsas_softc *)arg; + + /* + * Intialize a counting Semaphore to take care no. of concurrent IOCTLs + */ + sema_init(&sc->ioctl_count_sema, + MRSAS_MAX_MFI_CMDS - 5, + IOCTL_SEMA_DESCRIPTION); + + /* Create a /dev entry for mrsas controller. */ + sc->mrsas_cdev = make_dev(&mrsas_cdevsw, device_get_unit(sc->mrsas_dev), UID_ROOT, + GID_OPERATOR, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP), "mrsas%u", + device_get_unit(sc->mrsas_dev)); + + if (device_get_unit(sc->mrsas_dev) == 0) { + make_dev_alias_p(MAKEDEV_CHECKNAME, + &sc->mrsas_linux_emulator_cdev, sc->mrsas_cdev, + "megaraid_sas_ioctl_node"); + } + if (sc->mrsas_cdev) + sc->mrsas_cdev->si_drv1 = sc; + + /* + * Add this controller to mrsas_mgmt_info structure so that it can be + * exported to management applications + */ + if (device_get_unit(sc->mrsas_dev) == 0) + memset(&mrsas_mgmt_info, 0, sizeof(mrsas_mgmt_info)); + + mrsas_mgmt_info.count++; + mrsas_mgmt_info.sc_ptr[mrsas_mgmt_info.max_index] = sc; + mrsas_mgmt_info.max_index++; + + /* Enable Interrupts */ + mrsas_enable_intr(sc); + + /* Initiate AEN (Asynchronous Event Notification) */ + if (mrsas_start_aen(sc)) { + device_printf(sc->mrsas_dev, "Error: AEN registration FAILED !!! " + "Further events from the controller will not be communicated.\n" + "Either there is some problem in the controller" + "or the controller does not support AEN.\n" + "Please contact to the SUPPORT TEAM if the problem persists\n"); + } + if (sc->mrsas_ich.ich_arg != NULL) { + device_printf(sc->mrsas_dev, "Disestablish mrsas intr hook\n"); + config_intrhook_disestablish(&sc->mrsas_ich); + sc->mrsas_ich.ich_arg = NULL; + } +} + +/* * mrsas_detach: De-allocates and teardown resources * input: pointer to device struct * @@ -971,6 +1015,8 @@ mrsas_detach(device_t dev) sc->remove_in_progress = 1; /* Destroy the character device so no other IOCTL will be handled */ + if ((device_get_unit(dev) == 0) && sc->mrsas_linux_emulator_cdev) + destroy_dev(sc->mrsas_linux_emulator_cdev); destroy_dev(sc->mrsas_cdev); /* @@ -991,7 +1037,7 @@ mrsas_detach(device_t dev) i++; if (!(i % MRSAS_RESET_NOTICE_INTERVAL)) { mrsas_dprint(sc, MRSAS_INFO, - "[%2d]waiting for ocr to be finished\n", i); + "[%2d]waiting for OCR to be finished from %s\n", i, __func__); } pause("mr_shutdown", hz); } @@ -1067,7 +1113,14 @@ mrsas_free_mem(struct mrsas_softc *sc) if (sc->ld_drv_map[i] != NULL) free(sc->ld_drv_map[i], M_MRSAS); } - + for (i = 0; i < 2; i++) { + if (sc->jbodmap_phys_addr[i]) + bus_dmamap_unload(sc->jbodmap_tag[i], sc->jbodmap_dmamap[i]); + if (sc->jbodmap_mem[i] != NULL) + bus_dmamem_free(sc->jbodmap_tag[i], sc->jbodmap_mem[i], sc->jbodmap_dmamap[i]); + if (sc->jbodmap_tag[i] != NULL) + bus_dma_tag_destroy(sc->jbodmap_tag[i]); + } /* * Free version buffer memroy */ @@ -1229,9 +1282,7 @@ mrsas_teardown_intr(struct mrsas_softc * static int mrsas_suspend(device_t dev) { - struct mrsas_softc *sc; - - sc = device_get_softc(dev); + /* This will be filled when the driver will have hibernation support */ return (0); } @@ -1244,9 +1295,7 @@ mrsas_suspend(device_t dev) static int mrsas_resume(device_t dev) { - struct mrsas_softc *sc; - - sc = device_get_softc(dev); + /* This will be filled when the driver will have hibernation support */ return (0); } @@ -1317,9 +1366,7 @@ mrsas_ioctl(struct cdev *dev, u_long cmd i++; if (!(i % MRSAS_RESET_NOTICE_INTERVAL)) { mrsas_dprint(sc, MRSAS_INFO, - "[%2d]waiting for " - "OCR to be finished %d\n", i, - sc->ocr_thread_active); + "[%2d]waiting for OCR to be finished from %s\n", i, __func__); } pause("mr_ioctl", hz); } @@ -1483,7 +1530,7 @@ mrsas_isr(void *arg) * perform the appropriate action. Before we return, we clear the response * interrupt. */ -static int +int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex) { Mpi2ReplyDescriptorsUnion_t *desc; @@ -1580,7 +1627,9 @@ mrsas_complete_cmd(struct mrsas_softc *s if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) { if (sc->msix_enable) { if ((sc->device_id == MRSAS_INVADER) || - (sc->device_id == MRSAS_FURY)) + (sc->device_id == MRSAS_FURY) || + (sc->device_id == MRSAS_INTRUDER) || + (sc->device_id == MRSAS_INTRUDER_24)) mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex / 8], ((MSIxIndex & 0x7) << 24) | sc->last_reply_idx[MSIxIndex]); @@ -1602,7 +1651,9 @@ mrsas_complete_cmd(struct mrsas_softc *s /* Clear response interrupt */ if (sc->msix_enable) { if ((sc->device_id == MRSAS_INVADER) || - (sc->device_id == MRSAS_FURY)) { + (sc->device_id == MRSAS_FURY) || + (sc->device_id == MRSAS_INTRUDER) || + (sc->device_id == MRSAS_INTRUDER_24)) { mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex / 8], ((MSIxIndex & 0x7) << 24) | sc->last_reply_idx[MSIxIndex]); @@ -1686,9 +1737,9 @@ mrsas_alloc_mem(struct mrsas_softc *sc) BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MRSAS_MAX_IO_SIZE, /* maxsize */ - MRSAS_MAX_SGL, /* nsegments */ - MRSAS_MAX_IO_SIZE, /* maxsegsize */ + MAXPHYS, /* maxsize */ + sc->max_num_sge, /* nsegments */ + MAXPHYS, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->mrsas_parent_tag /* tag */ @@ -1885,9 +1936,9 @@ mrsas_alloc_mem(struct mrsas_softc *sc) BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, - MRSAS_MAX_IO_SIZE, - MRSAS_MAX_SGL, - MRSAS_MAX_IO_SIZE, + MAXPHYS, + sc->max_num_sge, /* nsegments */ + MAXPHYS, BUS_DMA_ALLOCNOW, busdma_lock_mutex, &sc->io_lock, @@ -1989,6 +2040,78 @@ ABORT: return (1); } +/** + * megasas_setup_jbod_map - setup jbod map for FP seq_number. + * @sc: Adapter soft state + * + * Return 0 on success. + */ +void +megasas_setup_jbod_map(struct mrsas_softc *sc) +{ + int i; + uint32_t pd_seq_map_sz; + + pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + + (sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1)); + + if (!sc->ctrl_info->adapterOperations3.useSeqNumJbodFP) { + sc->use_seqnum_jbod_fp = 0; + return; + } + if (sc->jbodmap_mem[0]) + goto skip_alloc; + + for (i = 0; i < 2; i++) { + if (bus_dma_tag_create(sc->mrsas_parent_tag, + 4, 0, + BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, + NULL, NULL, + pd_seq_map_sz, + 1, + pd_seq_map_sz, + BUS_DMA_ALLOCNOW, + NULL, NULL, + &sc->jbodmap_tag[i])) { + device_printf(sc->mrsas_dev, + "Cannot allocate jbod map tag.\n"); + return; + } + if (bus_dmamem_alloc(sc->jbodmap_tag[i], + (void **)&sc->jbodmap_mem[i], + BUS_DMA_NOWAIT, &sc->jbodmap_dmamap[i])) { + device_printf(sc->mrsas_dev, + "Cannot allocate jbod map memory.\n"); + return; + } + bzero(sc->jbodmap_mem[i], pd_seq_map_sz); + + if (bus_dmamap_load(sc->jbodmap_tag[i], sc->jbodmap_dmamap[i], + sc->jbodmap_mem[i], pd_seq_map_sz, + mrsas_addr_cb, &sc->jbodmap_phys_addr[i], + BUS_DMA_NOWAIT)) { + device_printf(sc->mrsas_dev, "Cannot load jbod map memory.\n"); + return; + } + if (!sc->jbodmap_mem[i]) { + device_printf(sc->mrsas_dev, + "Cannot allocate memory for jbod map.\n"); + sc->use_seqnum_jbod_fp = 0; + return; + } + } + +skip_alloc: + if (!megasas_sync_pd_seq_num(sc, false) && + !megasas_sync_pd_seq_num(sc, true)) + sc->use_seqnum_jbod_fp = 1; + else + sc->use_seqnum_jbod_fp = 0; + + device_printf(sc->mrsas_dev, "Jbod map is supported\n"); +} + /* * mrsas_init_fw: Initialize Firmware * input: Adapter soft state @@ -2088,18 +2211,28 @@ mrsas_init_fw(struct mrsas_softc *sc) if (sc->secure_jbod_support) device_printf(sc->mrsas_dev, "FW supports SED \n"); + if (sc->use_seqnum_jbod_fp) + device_printf(sc->mrsas_dev, "FW supports JBOD Map \n"); + if (mrsas_setup_raidmap(sc) != SUCCESS) { - device_printf(sc->mrsas_dev, "Set up RAID map failed.\n"); - return (1); + device_printf(sc->mrsas_dev, "Error: RAID map setup FAILED !!! " + "There seems to be some problem in the controller\n" + "Please contact to the SUPPORT TEAM if the problem persists\n"); } + megasas_setup_jbod_map(sc); + /* For pass-thru, get PD/LD list and controller info */ memset(sc->pd_list, 0, MRSAS_MAX_PD * sizeof(struct mrsas_pd_list)); - mrsas_get_pd_list(sc); - + if (mrsas_get_pd_list(sc) != SUCCESS) { + device_printf(sc->mrsas_dev, "Get PD list failed.\n"); + return (1); + } memset(sc->ld_ids, 0xff, MRSAS_MAX_LD_IDS); - mrsas_get_ld_list(sc); - + if (mrsas_get_ld_list(sc) != SUCCESS) { + device_printf(sc->mrsas_dev, "Get LD lsit failed.\n"); + return (1); + } /* * Compute the max allowed sectors per IO: The controller info has * two limits on max sectors. Driver should use the minimum of these @@ -2149,7 +2282,7 @@ int mrsas_init_adapter(struct mrsas_softc *sc) { uint32_t status; - u_int32_t max_cmd; + u_int32_t max_cmd, scratch_pad_2; int ret; int i = 0; @@ -2168,13 +2301,33 @@ mrsas_init_adapter(struct mrsas_softc *s sc->request_alloc_sz = sizeof(MRSAS_REQUEST_DESCRIPTOR_UNION) * max_cmd; sc->reply_alloc_sz = sizeof(MPI2_REPLY_DESCRIPTORS_UNION) * (sc->reply_q_depth); sc->io_frames_alloc_sz = MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE + (MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE * (max_cmd + 1)); - sc->chain_frames_alloc_sz = 1024 * max_cmd; + scratch_pad_2 = mrsas_read_reg(sc, offsetof(mrsas_reg_set, + outbound_scratch_pad_2)); + /* + * If scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK is set, + * Firmware support extended IO chain frame which is 4 time more + * than legacy Firmware. Legacy Firmware - Frame size is (8 * 128) = + * 1K 1M IO Firmware - Frame size is (8 * 128 * 4) = 4K + */ + if (scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK) + sc->max_chain_frame_sz = + ((scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_MASK) >> 5) + * MEGASAS_1MB_IO; + else + sc->max_chain_frame_sz = + ((scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_MASK) >> 5) + * MEGASAS_256K_IO; + + sc->chain_frames_alloc_sz = sc->max_chain_frame_sz * max_cmd; sc->max_sge_in_main_msg = (MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE - offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL)) / 16; - sc->max_sge_in_chain = MRSAS_MAX_SZ_CHAIN_FRAME / sizeof(MPI2_SGE_IO_UNION); + sc->max_sge_in_chain = sc->max_chain_frame_sz / sizeof(MPI2_SGE_IO_UNION); sc->max_num_sge = sc->max_sge_in_main_msg + sc->max_sge_in_chain - 2; + mrsas_dprint(sc, MRSAS_INFO, "Avago Debug: MAX sge 0x%X MAX chain frame size 0x%X \n", + sc->max_num_sge, sc->max_chain_frame_sz); + /* Used for pass thru MFI frame (DCMD) */ sc->chain_offset_mfi_pthru = offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL) / 16; @@ -2299,7 +2452,9 @@ mrsas_ioc_init(struct mrsas_softc *sc) /* driver support Extended MSIX */ if ((sc->device_id == MRSAS_INVADER) || - (sc->device_id == MRSAS_FURY)) { + (sc->device_id == MRSAS_FURY) || + (sc->device_id == MRSAS_INTRUDER) || + (sc->device_id == MRSAS_INTRUDER_24)) { init_frame->driver_operations. mfi_capabilities.support_additional_msix = 1; } @@ -2312,6 +2467,8 @@ mrsas_ioc_init(struct mrsas_softc *sc) init_frame->driver_operations.mfi_capabilities.support_ndrive_r1_lb = 1; init_frame->driver_operations.mfi_capabilities.support_max_255lds = 1; init_frame->driver_operations.mfi_capabilities.security_protocol_cmds_fw = 1; + if (sc->max_chain_frame_sz > MEGASAS_CHAIN_FRAME_SZ_MIN) + init_frame->driver_operations.mfi_capabilities.support_ext_io_size = 1; phys_addr = (bus_addr_t)sc->ioc_init_phys_mem + 1024; init_frame->queue_info_new_phys_addr_lo = phys_addr; init_frame->data_xfer_len = sizeof(Mpi2IOCInitRequest_t); @@ -2414,7 +2571,7 @@ mrsas_alloc_mpt_cmds(struct mrsas_softc for (i = 0; i < max_cmd; i++) { cmd = sc->mpt_cmd_list[i]; offset = MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE * i; - chain_offset = 1024 * i; + chain_offset = sc->max_chain_frame_sz * i; sense_offset = MRSAS_SENSE_LEN * i; memset(cmd, 0, sizeof(struct mrsas_mpt_cmd)); cmd->index = i + 1; @@ -2625,16 +2782,20 @@ mrsas_ocr_thread(void *arg) /* Sleep for 1 second and check the queue status */ msleep(&sc->ocr_chan, &sc->sim_lock, PRIBIO, "mrsas_ocr", sc->mrsas_fw_fault_check_delay * hz); - if (sc->remove_in_progress) { + if (sc->remove_in_progress || + sc->adprecovery == MRSAS_HW_CRITICAL_ERROR) { mrsas_dprint(sc, MRSAS_OCR, - "Exit due to shutdown from %s\n", __func__); + "Exit due to %s from %s\n", + sc->remove_in_progress ? "Shutdown" : + "Hardware critical error", __func__); break; } fw_status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_scratch_pad)); fw_state = fw_status & MFI_STATE_MASK; if (fw_state == MFI_STATE_FAULT || sc->do_timedout_reset) { - device_printf(sc->mrsas_dev, "OCR started due to %s!\n", + device_printf(sc->mrsas_dev, "%s started due to %s!\n", + sc->disableOnlineCtrlReset ? "Kill Adapter" : "OCR", sc->do_timedout_reset ? "IO Timeout" : "FW fault detected"); mtx_lock_spin(&sc->ioctl_lock); @@ -2642,7 +2803,7 @@ mrsas_ocr_thread(void *arg) sc->reset_count++; mtx_unlock_spin(&sc->ioctl_lock); mrsas_xpt_freeze(sc); - mrsas_reset_ctrl(sc); + mrsas_reset_ctrl(sc, sc->do_timedout_reset); mrsas_xpt_release(sc); sc->reset_in_progress = 0; sc->do_timedout_reset = 0; @@ -2689,14 +2850,14 @@ mrsas_reset_reply_desc(struct mrsas_soft * OCR, Re-fire Managment command and move Controller to Operation state. */ int -mrsas_reset_ctrl(struct mrsas_softc *sc) +mrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason) { int retval = SUCCESS, i, j, retry = 0; u_int32_t host_diag, abs_state, status_reg, reset_adapter; union ccb *ccb; struct mrsas_mfi_cmd *mfi_cmd; struct mrsas_mpt_cmd *mpt_cmd; - MRSAS_REQUEST_DESCRIPTOR_UNION *req_desc; + union mrsas_evt_class_locale class_locale; if (sc->adprecovery == MRSAS_HW_CRITICAL_ERROR) { device_printf(sc->mrsas_dev, @@ -2706,10 +2867,11 @@ mrsas_reset_ctrl(struct mrsas_softc *sc) mrsas_set_bit(MRSAS_FUSION_IN_RESET, &sc->reset_flags); sc->adprecovery = MRSAS_ADPRESET_SM_INFAULT; mrsas_disable_intr(sc); - DELAY(1000 * 1000); + msleep(&sc->ocr_chan, &sc->sim_lock, PRIBIO, "mrsas_ocr", + sc->mrsas_fw_fault_check_delay * hz); /* First try waiting for commands to complete */ - if (mrsas_wait_for_outstanding(sc)) { + if (mrsas_wait_for_outstanding(sc, reset_reason)) { mrsas_dprint(sc, MRSAS_OCR, "resetting adapter from %s.\n", __func__); @@ -2819,31 +2981,17 @@ mrsas_reset_ctrl(struct mrsas_softc *sc) mrsas_dprint(sc, MRSAS_OCR, "mrsas_ioc_init() failed!\n"); continue; } - /* Re-fire management commands */ for (j = 0; j < sc->max_fw_cmds; j++) { mpt_cmd = sc->mpt_cmd_list[j]; if (mpt_cmd->sync_cmd_idx != (u_int32_t)MRSAS_ULONG_MAX) { mfi_cmd = sc->mfi_cmd_list[mpt_cmd->sync_cmd_idx]; - if (mfi_cmd->frame->dcmd.opcode == - MR_DCMD_LD_MAP_GET_INFO) { - mrsas_release_mfi_cmd(mfi_cmd); - mrsas_release_mpt_cmd(mpt_cmd); - } else { - req_desc = mrsas_get_request_desc(sc, - mfi_cmd->cmd_id.context.smid - 1); - mrsas_dprint(sc, MRSAS_OCR, - "Re-fire command DCMD opcode 0x%x index %d\n ", - mfi_cmd->frame->dcmd.opcode, j); - if (!req_desc) - device_printf(sc->mrsas_dev, - "Cannot build MPT cmd.\n"); - else - mrsas_fire_cmd(sc, req_desc->addr.u.low, - req_desc->addr.u.high); - } + mrsas_release_mfi_cmd(mfi_cmd); + mrsas_release_mpt_cmd(mpt_cmd); } } + sc->aen_cmd = NULL; + /* Reset load balance info */ memset(sc->load_balance_info, 0, sizeof(LD_LOAD_BALANCE_INFO) * MAX_LOGICAL_DRIVES_EXT); @@ -2856,10 +3004,37 @@ mrsas_reset_ctrl(struct mrsas_softc *sc) if (!mrsas_get_map_info(sc)) mrsas_sync_map_info(sc); + megasas_setup_jbod_map(sc); + + memset(sc->pd_list, 0, + MRSAS_MAX_PD * sizeof(struct mrsas_pd_list)); + if (mrsas_get_pd_list(sc) != SUCCESS) { + device_printf(sc->mrsas_dev, "Get PD list failed from OCR.\n" + "Will get the latest PD LIST after OCR on event.\n"); + } + memset(sc->ld_ids, 0xff, MRSAS_MAX_LD_IDS); + if (mrsas_get_ld_list(sc) != SUCCESS) { + device_printf(sc->mrsas_dev, "Get LD lsit failed from OCR.\n" + "Will get the latest LD LIST after OCR on event.\n"); + } mrsas_clear_bit(MRSAS_FUSION_IN_RESET, &sc->reset_flags); mrsas_enable_intr(sc); sc->adprecovery = MRSAS_HBA_OPERATIONAL; + /* Register AEN with FW for last sequence number */ + class_locale.members.reserved = 0; + class_locale.members.locale = MR_EVT_LOCALE_ALL; + class_locale.members.class = MR_EVT_CLASS_DEBUG; + + if (mrsas_register_aen(sc, sc->last_seq_num, + class_locale.word)) { + device_printf(sc->mrsas_dev, + "ERROR: AEN registration FAILED from OCR !!! " + "Further events from the controller cannot be notified." + "Either there is some problem in the controller" + "or the controller does not support AEN.\n" + "Please contact to the SUPPORT TEAM if the problem persists\n"); + } /* Adapter reset completed successfully */ device_printf(sc->mrsas_dev, "Reset successful\n"); retval = SUCCESS; @@ -2891,7 +3066,7 @@ void mrsas_kill_hba(struct mrsas_softc *sc) { sc->adprecovery = MRSAS_HW_CRITICAL_ERROR; - pause("mrsas_kill_hba", 1000); + DELAY(1000 * 1000); mrsas_dprint(sc, MRSAS_OCR, "%s\n", __func__); mrsas_write_reg(sc, offsetof(mrsas_reg_set, doorbell), MFI_STOP_ADP); @@ -2937,7 +3112,7 @@ mrsas_complete_outstanding_ioctls(struct * completed. */ int -mrsas_wait_for_outstanding(struct mrsas_softc *sc) +mrsas_wait_for_outstanding(struct mrsas_softc *sc, u_int8_t check_reason) { int i, outstanding, retval = 0; u_int32_t fw_state, count, MSIxIndex; @@ -2959,6 +3134,12 @@ mrsas_wait_for_outstanding(struct mrsas_ retval = 1; goto out; } + if (check_reason == MFI_DCMD_TIMEOUT_OCR) { + mrsas_dprint(sc, MRSAS_OCR, + "DCMD IO TIMEOUT detected, will reset adapter.\n"); + retval = 1; + goto out; + } outstanding = mrsas_atomic_read(&sc->fw_outstanding); if (!outstanding) goto out; @@ -3016,6 +3197,7 @@ static int mrsas_get_ctrl_info(struct mrsas_softc *sc) { int retcode = 0; + u_int8_t do_ocr = 1; struct mrsas_mfi_cmd *cmd; struct mrsas_dcmd_frame *dcmd; @@ -3045,15 +3227,26 @@ mrsas_get_ctrl_info(struct mrsas_softc * dcmd->sgl.sge32[0].phys_addr = sc->ctlr_info_phys_addr; dcmd->sgl.sge32[0].length = sizeof(struct mrsas_ctrl_info); - if (!mrsas_issue_polled(sc, cmd)) - memcpy(sc->ctrl_info, sc->ctlr_info_mem, sizeof(struct mrsas_ctrl_info)); + retcode = mrsas_issue_polled(sc, cmd); + if (retcode == ETIMEDOUT) + goto dcmd_timeout; else - retcode = 1; + memcpy(sc->ctrl_info, sc->ctlr_info_mem, sizeof(struct mrsas_ctrl_info)); + do_ocr = 0; mrsas_update_ext_vd_details(sc); + sc->use_seqnum_jbod_fp = + sc->ctrl_info->adapterOperations3.useSeqNumJbodFP; + +dcmd_timeout: mrsas_free_ctlr_info_cmd(sc); - mrsas_release_mfi_cmd(cmd); + + if (do_ocr) + sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR; + else + mrsas_release_mfi_cmd(cmd); + return (retcode); } @@ -3172,7 +3365,7 @@ mrsas_issue_polled(struct mrsas_softc *s { struct mrsas_header *frame_hdr = &cmd->frame->hdr; u_int8_t max_wait = MRSAS_INTERNAL_CMD_WAIT_TIME; - int i, retcode = 0; + int i, retcode = SUCCESS; frame_hdr->cmd_status = 0xFF; frame_hdr->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; @@ -3195,12 +3388,12 @@ mrsas_issue_polled(struct mrsas_softc *s break; } } - if (frame_hdr->cmd_status != 0) { - if (frame_hdr->cmd_status == 0xFF) - device_printf(sc->mrsas_dev, "DCMD timed out after %d seconds.\n", max_wait); - else - device_printf(sc->mrsas_dev, "DCMD failed, status = 0x%x\n", frame_hdr->cmd_status); - retcode = 1; + if (frame_hdr->cmd_status == 0xFF) { + device_printf(sc->mrsas_dev, "DCMD timed out after %d " + "seconds from %s\n", max_wait, __func__); + device_printf(sc->mrsas_dev, "DCMD opcode 0x%X\n", + cmd->frame->dcmd.opcode); + retcode = ETIMEDOUT; } return (retcode); } @@ -3294,7 +3487,10 @@ mrsas_build_mptmfi_passthru(struct mrsas io_req = mpt_cmd->io_request; - if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY)) { + if ((sc->device_id == MRSAS_INVADER) || + (sc->device_id == MRSAS_FURY) || + (sc->device_id == MRSAS_INTRUDER) || + (sc->device_id == MRSAS_INTRUDER_24)) { pMpi25IeeeSgeChain64_t sgl_ptr_end = (pMpi25IeeeSgeChain64_t)&io_req->SGL; sgl_ptr_end += sc->max_sge_in_main_msg - 1; @@ -3311,7 +3507,7 @@ mrsas_build_mptmfi_passthru(struct mrsas mpi25_ieee_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT | MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR; - mpi25_ieee_chain->Length = MRSAS_MAX_SZ_CHAIN_FRAME; + mpi25_ieee_chain->Length = sc->max_chain_frame_sz; return (0); } @@ -3329,10 +3525,10 @@ mrsas_issue_blocked_cmd(struct mrsas_sof { u_int8_t max_wait = MRSAS_INTERNAL_CMD_WAIT_TIME; unsigned long total_time = 0; - int retcode = 0; + int retcode = SUCCESS; /* Initialize cmd_status */ - cmd->cmd_status = ECONNREFUSED; + cmd->cmd_status = 0xFF; /* Build MPT-MFI command for issue to FW */ if (mrsas_issue_dcmd(sc, cmd)) { @@ -3342,18 +3538,30 @@ mrsas_issue_blocked_cmd(struct mrsas_sof sc->chan = (void *)&cmd; while (1) { - if (cmd->cmd_status == ECONNREFUSED) { + if (cmd->cmd_status == 0xFF) { tsleep((void *)&sc->chan, 0, "mrsas_sleep", hz); } else break; - total_time++; - if (total_time >= max_wait) { - device_printf(sc->mrsas_dev, - "Internal command timed out after %d seconds.\n", max_wait); - retcode = 1; - break; + + if (!cmd->sync_cmd) { /* cmd->sync will be set for an IOCTL + * command */ + total_time++; + if (total_time >= max_wait) { + device_printf(sc->mrsas_dev, + "Internal command timed out after %d seconds.\n", max_wait); + retcode = 1; + break; + } } } + + if (cmd->cmd_status == 0xFF) { + device_printf(sc->mrsas_dev, "DCMD timed out after %d " + "seconds from %s\n", max_wait, __func__); + device_printf(sc->mrsas_dev, "DCMD opcode 0x%X\n", + cmd->frame->dcmd.opcode); + retcode = ETIMEDOUT; + } return (retcode); } @@ -3404,6 +3612,7 @@ mrsas_complete_mptmfi_passthru(struct mr (cmd->frame->dcmd.mbox.b[1] == 1)) { sc->fast_path_io = 0; mtx_lock(&sc->raidmap_lock); + sc->map_update_cmd = NULL; if (cmd_status != 0) { if (cmd_status != MFI_STAT_NOT_FOUND) device_printf(sc->mrsas_dev, "map sync failed, status=%x\n", cmd_status); @@ -3427,6 +3636,28 @@ mrsas_complete_mptmfi_passthru(struct mr cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET) { sc->mrsas_aen_triggered = 0; } + /* FW has an updated PD sequence */ + if ((cmd->frame->dcmd.opcode == + MR_DCMD_SYSTEM_PD_MAP_GET_INFO) && + (cmd->frame->dcmd.mbox.b[0] == 1)) { + + mtx_lock(&sc->raidmap_lock); + sc->jbod_seq_cmd = NULL; + mrsas_release_mfi_cmd(cmd); + + if (cmd_status == MFI_STAT_OK) { + sc->pd_seq_map_id++; + /* Re-register a pd sync seq num cmd */ + if (megasas_sync_pd_seq_num(sc, true)) + sc->use_seqnum_jbod_fp = 0; + } else { + sc->use_seqnum_jbod_fp = 0; + device_printf(sc->mrsas_dev, + "Jbod map sync failed, status=%x\n", cmd_status); + } + mtx_unlock(&sc->raidmap_lock); + break; + } /* See if got an event notification */ if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_WAIT) mrsas_complete_aen(sc, cmd); @@ -3458,7 +3689,7 @@ mrsas_wakeup(struct mrsas_softc *sc, str { cmd->cmd_status = cmd->frame->io.cmd_status; - if (cmd->cmd_status == ECONNREFUSED) + if (cmd->cmd_status == 0xFF) cmd->cmd_status = 0; sc->chan = (void *)&cmd; @@ -3489,9 +3720,10 @@ mrsas_shutdown_ctlr(struct mrsas_softc * } if (sc->aen_cmd) mrsas_issue_blocked_abort_cmd(sc, sc->aen_cmd); - if (sc->map_update_cmd) mrsas_issue_blocked_abort_cmd(sc, sc->map_update_cmd); + if (sc->jbod_seq_cmd) + mrsas_issue_blocked_abort_cmd(sc, sc->jbod_seq_cmd); dcmd = &cmd->frame->dcmd; memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); @@ -3553,6 +3785,85 @@ mrsas_flush_cache(struct mrsas_softc *sc return; } +int +megasas_sync_pd_seq_num(struct mrsas_softc *sc, boolean_t pend) +{ + int retcode = 0; + u_int8_t do_ocr = 1; + struct mrsas_mfi_cmd *cmd; + struct mrsas_dcmd_frame *dcmd; + uint32_t pd_seq_map_sz; + struct MR_PD_CFG_SEQ_NUM_SYNC *pd_sync; + bus_addr_t pd_seq_h; + + pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + + (sizeof(struct MR_PD_CFG_SEQ) * + (MAX_PHYSICAL_DEVICES - 1)); + + cmd = mrsas_get_mfi_cmd(sc); + if (!cmd) { + device_printf(sc->mrsas_dev, + "Cannot alloc for ld map info cmd.\n"); + return 1; + } + dcmd = &cmd->frame->dcmd; + + pd_sync = (void *)sc->jbodmap_mem[(sc->pd_seq_map_id & 1)]; + pd_seq_h = sc->jbodmap_phys_addr[(sc->pd_seq_map_id & 1)]; + if (!pd_sync) { + device_printf(sc->mrsas_dev, + "Failed to alloc mem for jbod map info.\n"); + mrsas_release_mfi_cmd(cmd); + return (ENOMEM); + } + memset(pd_sync, 0, pd_seq_map_sz); + memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); + dcmd->cmd = MFI_CMD_DCMD; + dcmd->cmd_status = 0xFF; + dcmd->sge_count = 1; + dcmd->timeout = 0; + dcmd->pad_0 = 0; + dcmd->data_xfer_len = (pd_seq_map_sz); + dcmd->opcode = (MR_DCMD_SYSTEM_PD_MAP_GET_INFO); + dcmd->sgl.sge32[0].phys_addr = (pd_seq_h); + dcmd->sgl.sge32[0].length = (pd_seq_map_sz); + + if (pend) { + dcmd->mbox.b[0] = MRSAS_DCMD_MBOX_PEND_FLAG; + dcmd->flags = (MFI_FRAME_DIR_WRITE); + sc->jbod_seq_cmd = cmd; + if (mrsas_issue_dcmd(sc, cmd)) { + device_printf(sc->mrsas_dev, + "Fail to send sync map info command.\n"); + return 1; + } else + return 0; + } else + dcmd->flags = MFI_FRAME_DIR_READ; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Thu May 26 21:32:17 2016 Return-Path: Delivered-To: svn-src-stable-10@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 5EA0FB4C108; Thu, 26 May 2016 21:32:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28A2B1C5C; Thu, 26 May 2016 21:32:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QLWGar031853; Thu, 26 May 2016 21:32:16 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QLWGJv031852; Thu, 26 May 2016 21:32:16 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201605262132.u4QLWGJv031852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 26 May 2016 21:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300778 - stable/10/sys/fs/nfsserver X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2016 21:32:17 -0000 Author: rmacklem Date: Thu May 26 21:32:16 2016 New Revision: 300778 URL: https://svnweb.freebsd.org/changeset/base/300778 Log: MFC: r299514 Fix use-after-free in NFS4 lock test service. Trivial use-after-free where stp was freed too soon in the non-error path. To fix, simply move its release to the end of the routine. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Thu May 26 21:09:07 2016 (r300777) +++ stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Thu May 26 21:32:16 2016 (r300778) @@ -2416,8 +2416,6 @@ nfsrvd_lockt(struct nfsrv_descript *nd, if (!nd->nd_repstat) nd->nd_repstat = nfsrv_lockctrl(vp, &stp, &lop, &cf, clientid, &stateid, exp, nd, p); - if (stp) - FREE((caddr_t)stp, M_NFSDSTATE); if (nd->nd_repstat) { if (nd->nd_repstat == NFSERR_DENIED) { NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); @@ -2439,6 +2437,8 @@ nfsrvd_lockt(struct nfsrv_descript *nd, } } vput(vp); + if (stp) + FREE((caddr_t)stp, M_NFSDSTATE); NFSEXITCODE2(0, nd); return (0); nfsmout: From owner-svn-src-stable-10@freebsd.org Sat May 28 03:33:07 2016 Return-Path: Delivered-To: svn-src-stable-10@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 634F7B4D458; Sat, 28 May 2016 03:33:07 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3091C1D08; Sat, 28 May 2016 03:33:07 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4S3X6ul099381; Sat, 28 May 2016 03:33:06 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4S3X6Tp099380; Sat, 28 May 2016 03:33:06 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201605280333.u4S3X6Tp099380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 28 May 2016 03:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300897 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 May 2016 03:33:07 -0000 Author: cy Date: Sat May 28 03:33:06 2016 New Revision: 300897 URL: https://svnweb.freebsd.org/changeset/base/300897 Log: MFC r300638: Use the expiry date to determine whether to replace the DB copy of leapfile instead of using the leapfile serial number (create timestamp). PR: 209577 Modified: stable/10/etc/rc.d/ntpd Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/ntpd ============================================================================== --- stable/10/etc/rc.d/ntpd Sat May 28 02:14:24 2016 (r300896) +++ stable/10/etc/rc.d/ntpd Sat May 28 03:33:06 2016 (r300897) @@ -107,8 +107,8 @@ ntpd_fetch_leapfile() { $verbose fetching $url fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile $url && break done - ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile) - if [ "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" ]; then + ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile) + if [ "$ntp_expiry_tmp" -gt "$ntp_leap_expiry" ]; then $verbose using $url as $ntp_db_leapfile mv $ntp_tmp_leapfile $ntp_db_leapfile else From owner-svn-src-stable-10@freebsd.org Sat May 28 06:17:38 2016 Return-Path: Delivered-To: svn-src-stable-10@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 5536AB4D9DA; Sat, 28 May 2016 06:17:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D88A91339; Sat, 28 May 2016 06:17:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4S6Hbex058856; Sat, 28 May 2016 06:17:37 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4S6HZcK058842; Sat, 28 May 2016 06:17:35 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201605280617.u4S6HZcK058842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 28 May 2016 06:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300899 - in stable/10: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/python contrib/file/src contrib/file/tests lib/libmagic X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 May 2016 06:17:38 -0000 Author: delphij Date: Sat May 28 06:17:35 2016 New Revision: 300899 URL: https://svnweb.freebsd.org/changeset/base/300899 Log: MFC r298192,299234,299238,299736: file 5.27. Added: stable/10/contrib/file/magic/Magdir/bioinformatics - copied unchanged from r298192, head/contrib/file/magic/Magdir/bioinformatics stable/10/contrib/file/magic/Magdir/coff - copied unchanged from r298192, head/contrib/file/magic/Magdir/coff stable/10/contrib/file/magic/Magdir/der - copied unchanged from r298192, head/contrib/file/magic/Magdir/der stable/10/contrib/file/magic/Magdir/finger - copied unchanged from r298192, head/contrib/file/magic/Magdir/finger stable/10/contrib/file/magic/Magdir/flif - copied unchanged from r298192, head/contrib/file/magic/Magdir/flif stable/10/contrib/file/magic/Magdir/microfocus - copied unchanged from r298192, head/contrib/file/magic/Magdir/microfocus stable/10/contrib/file/magic/Magdir/polyml - copied unchanged from r298192, head/contrib/file/magic/Magdir/polyml stable/10/contrib/file/magic/Magdir/vacuum-cleaner - copied unchanged from r298192, head/contrib/file/magic/Magdir/vacuum-cleaner stable/10/contrib/file/src/der.c - copied, changed from r298192, head/contrib/file/src/der.c stable/10/contrib/file/src/der.h - copied unchanged from r298192, head/contrib/file/src/der.h stable/10/contrib/file/src/dprintf.c - copied unchanged from r298192, head/contrib/file/src/dprintf.c Modified: stable/10/contrib/file/ChangeLog stable/10/contrib/file/README stable/10/contrib/file/config.h.in stable/10/contrib/file/configure stable/10/contrib/file/configure.ac stable/10/contrib/file/doc/file.man stable/10/contrib/file/doc/libmagic.man stable/10/contrib/file/magic/Magdir/android stable/10/contrib/file/magic/Magdir/animation stable/10/contrib/file/magic/Magdir/apple stable/10/contrib/file/magic/Magdir/archive stable/10/contrib/file/magic/Magdir/audio stable/10/contrib/file/magic/Magdir/c-lang stable/10/contrib/file/magic/Magdir/cafebabe stable/10/contrib/file/magic/Magdir/commands stable/10/contrib/file/magic/Magdir/compress stable/10/contrib/file/magic/Magdir/console stable/10/contrib/file/magic/Magdir/database stable/10/contrib/file/magic/Magdir/filesystems stable/10/contrib/file/magic/Magdir/fonts stable/10/contrib/file/magic/Magdir/fortran stable/10/contrib/file/magic/Magdir/hitachi-sh stable/10/contrib/file/magic/Magdir/images stable/10/contrib/file/magic/Magdir/intel stable/10/contrib/file/magic/Magdir/java stable/10/contrib/file/magic/Magdir/lisp stable/10/contrib/file/magic/Magdir/mach stable/10/contrib/file/magic/Magdir/macintosh stable/10/contrib/file/magic/Magdir/misctools stable/10/contrib/file/magic/Magdir/modem stable/10/contrib/file/magic/Magdir/msdos stable/10/contrib/file/magic/Magdir/msvc stable/10/contrib/file/magic/Magdir/msx stable/10/contrib/file/magic/Magdir/netbsd stable/10/contrib/file/magic/Magdir/os2 stable/10/contrib/file/magic/Magdir/psdbms stable/10/contrib/file/magic/Magdir/python stable/10/contrib/file/magic/Magdir/sendmail stable/10/contrib/file/magic/Magdir/sgml stable/10/contrib/file/magic/Magdir/sinclair stable/10/contrib/file/magic/Magdir/sql stable/10/contrib/file/magic/Magdir/terminfo stable/10/contrib/file/magic/Magdir/windows stable/10/contrib/file/magic/Magdir/wordprocessors stable/10/contrib/file/magic/Magdir/xenix stable/10/contrib/file/magic/Makefile.am stable/10/contrib/file/magic/Makefile.in stable/10/contrib/file/python/README stable/10/contrib/file/python/magic.py stable/10/contrib/file/python/setup.py stable/10/contrib/file/src/Makefile.am stable/10/contrib/file/src/Makefile.in stable/10/contrib/file/src/apprentice.c stable/10/contrib/file/src/ascmagic.c stable/10/contrib/file/src/cdf.c stable/10/contrib/file/src/cdf.h stable/10/contrib/file/src/compress.c stable/10/contrib/file/src/file.c stable/10/contrib/file/src/file.h stable/10/contrib/file/src/file_opts.h stable/10/contrib/file/src/fmtcheck.c stable/10/contrib/file/src/funcs.c stable/10/contrib/file/src/magic.c stable/10/contrib/file/src/magic.h stable/10/contrib/file/src/magic.h.in stable/10/contrib/file/src/print.c stable/10/contrib/file/src/readcdf.c stable/10/contrib/file/src/readelf.c stable/10/contrib/file/src/readelf.h stable/10/contrib/file/src/softmagic.c stable/10/contrib/file/tests/Makefile.am stable/10/contrib/file/tests/Makefile.in stable/10/lib/libmagic/Makefile stable/10/lib/libmagic/config.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/file/ChangeLog ============================================================================== --- stable/10/contrib/file/ChangeLog Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/ChangeLog Sat May 28 06:17:35 2016 (r300899) @@ -1,3 +1,62 @@ +2016-05-13 12:00 Christos Zoulas + + * release 5.27 + +2016-04-18 9:35 Christos Zoulas + + * Errors comparing DER entries or computing offsets + are just indications of malformed non-DER files. + Don't print them. + * Offset comparison was off-by-one. + * Fix compression code (Werner Fink) + * Put new bytes constant in the right file (not the generated one) + +2016-04-16 18:34 Christos Zoulas + + * release 5.26 + +2016-03-31 13:50 Christos Zoulas + + * make the number of bytes read from files configurable. + +2016-03-21 13:40 Christos Zoulas + + * Add bounds checks for DER code (discovered by Thomas Jarosch) + * Change indirect recursion limit to indirect use count and + bump from 15 to 50 to prevent abuse. + +2016-03-13 20:39 Christos Zoulas + + * Add -00 which prints filename\0description\0 + +2016-03-01 13:28 Christos Zoulas + + * Fix ID3 indirect parsing + +2016-01-19 10:18 Christos Zoulas + + * add DER parsing capability + +2015-11-13 10:35 Christos Zoulas + + * provide dprintf(3) for the OS's that don't have it. + +2015-11-11 16:25 Christos Zoulas + + * redo the compression code report decompression errors + +2015-11-10 23:25 Christos Zoulas + + * REG_STARTEND code is not working as expected, delete it. + +2015-11-09 16:05 Christos Zoulas + + * Add zlib support if we have it. + +2015-11-05 11:22 Christos Zoulas + + * PR/492: compression forking was broken with magic_buffer. + 2015-09-16 9:50 Christos Zoulas * release 5.25 Modified: stable/10/contrib/file/README ============================================================================== --- stable/10/contrib/file/README Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/README Sat May 28 06:17:35 2016 (r300899) @@ -1,6 +1,6 @@ ## README for file(1) Command ## - @(#) $File: README,v 1.49 2015/01/02 20:23:04 christos Exp $ + @(#) $File: README,v 1.50 2016/04/16 22:40:54 christos Exp $ Mailing List: file@mx.gw.com Mailing List archives: http://mx.gw.com/pipermail/file/ @@ -67,17 +67,41 @@ in magic(5) format please, to the mainta COPYING - read this first. README - read this second (you are currently reading this file). INSTALL - read on how to install +src/localtime_r.c +src/magic.c +src/magic.h +src/mygetopt.h +src/newtest2.c +src/newtest3.c +src/pread.c +src/print.c +src/readcdf.c +src/readelf.c +src/readelf.h +src/regex.c +src/regex2.c +src/softmagic.c +src/strcasestr.c +src/strlcat.c +src/strlcpy.c +src/strndup.c +src/tar.h +src/teststrchr.c +src/vasprintf.c +src/x.c src/apprentice.c - parses /etc/magic to learn magic -src/asctime_r.c - replacement for OS's that don't have it. src/apptype.c - used for OS/2 specific application type magic -src/asprintf.c - replacement for OS's that don't have it. src/ascmagic.c - third & last set of tests, based on hardwired assumptions. src/asctime_r.c - replacement for OS's that don't have it. src/asprintf.c - replacement for OS's that don't have it. +src/asctime_r.c - replacement for OS's that don't have it. +src/asprintf.c - replacement for OS's that don't have it. src/cdf.[ch] - parser for Microsoft Compound Document Files src/cdf_time.c - time converter for CDF. src/compress.c - handles decompressing files to look inside. src/ctime_r.c - replacement for OS's that don't have it. +src/der.[ch] - parser for Distinguished Encoding Rules +src/dprintf.c - replacement for OS's that don't have it. src/elfclass.h - common code for elf 32/64. src/encoding.c - handles unicode encodings src/file.c - the main program @@ -88,10 +112,13 @@ src/fsmagic.c - first set of tests the p src/funcs.c - utilility functions src/getline.c - replacement for OS's that don't have it. src/getopt_long.c - replacement for OS's that don't have it. -src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore). -src/names.h - header file for ascmagic.c +src/gmtime_r.c - replacement for OS's that don't have it. +src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). +src/localtime_r.c - replacement for OS's that don't have it. src/magic.h.in - source file for magic.h +src/mygetopt.h - replacement for OS's that don't have it. src/magic.c - the libmagic api +src/names.h - header file for ascmagic.c src/pread.c - replacement for OS's that don't have it. src/print.c - print results, errors, warnings. src/readcdf.c - CDF wrapper. Modified: stable/10/contrib/file/config.h.in ============================================================================== --- stable/10/contrib/file/config.h.in Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/config.h.in Sat May 28 06:17:35 2016 (r300899) @@ -32,6 +32,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H +/* Define to 1 if you have the `dprintf' function. */ +#undef HAVE_DPRINTF + /* Define to 1 if you have the header file. */ #undef HAVE_ERR_H Modified: stable/10/contrib/file/configure ============================================================================== --- stable/10/contrib/file/configure Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/configure Sat May 28 06:17:35 2016 (r300899) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.25. +# Generated by GNU Autoconf 2.69 for file 5.27. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.25' -PACKAGE_STRING='file 5.25' +PACKAGE_VERSION='5.27' +PACKAGE_STRING='file 5.27' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.25 to adapt to many kinds of systems. +\`configure' configures file 5.27 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1397,7 +1397,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.25:";; + short | recursive ) echo "Configuration of file 5.27:";; esac cat <<\_ACEOF @@ -1507,7 +1507,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.25 +file configure 5.27 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2163,7 +2163,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.25, which was +It was created by file $as_me 5.27, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3029,7 +3029,7 @@ fi # Define the identity of the package. PACKAGE='file' - VERSION='5.25' + VERSION='5.27' cat >>confdefs.h <<_ACEOF @@ -14385,6 +14385,19 @@ esac fi +ac_fn_c_check_func "$LINENO" "dprintf" "ac_cv_func_dprintf" +if test "x$ac_cv_func_dprintf" = xyes; then : + $as_echo "#define HAVE_DPRINTF 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" dprintf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS dprintf.$ac_objext" + ;; +esac + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzopen in -lz" >&5 @@ -15036,7 +15049,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.25, which was +This file was extended by file $as_me 5.27, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15102,7 +15115,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.25 +file config.status 5.27 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/10/contrib/file/configure.ac ============================================================================== --- stable/10/contrib/file/configure.ac Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/configure.ac Sat May 28 06:17:35 2016 (r300899) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.25],[christos@astron.com]) +AC_INIT([file],[5.27],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -145,7 +145,7 @@ dnl Checks for functions AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) dnl Provide implementation of some required functions if necessary -AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck) +AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf) dnl Checks for libraries AC_CHECK_LIB(z,gzopen) Modified: stable/10/contrib/file/doc/file.man ============================================================================== --- stable/10/contrib/file/doc/file.man Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/doc/file.man Sat May 28 06:17:35 2016 (r300899) @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.118 2015/09/11 17:24:09 christos Exp $ -.Dd September 11, 2015 +.\" $File: file.man,v 1.120 2016/03/31 17:51:12 christos Exp $ +.Dd March 13, 2016 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -317,6 +317,7 @@ Set various parameter limits. .It Li elf_phnum Ta 128 Ta max ELF program sections processed .It Li elf_shnum Ta 32768 Ta max ELF sections processed .It Li regex Ta 8192 Ta length limit for regex searches +.It Li bytes Ta 1048576 Ta max number of bytes to read from file .El .It Fl r , Fl Fl raw Don't translate unprintable characters to \eooo. @@ -358,6 +359,11 @@ Nice to .Xr cut 1 the output. This does not affect the separator, which is still printed. +.Pp +If this option is repeated more than once, then +.Nm +prints just the filename followed by a NUL followed by the description +(or ERROR: text) followed by a second NUL for each entry. .It Fl -help Print a help message and exit. .El Modified: stable/10/contrib/file/doc/libmagic.man ============================================================================== --- stable/10/contrib/file/doc/libmagic.man Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/doc/libmagic.man Sat May 28 06:17:35 2016 (r300899) @@ -1,4 +1,4 @@ -.\" $File: libmagic.man,v 1.38 2015/09/11 17:24:09 christos Exp $ +.\" $File: libmagic.man,v 1.40 2016/03/31 17:51:12 christos Exp $ .\" .\" Copyright (c) Christos Zoulas 2003. .\" All Rights Reserved. @@ -225,7 +225,7 @@ It returns 0 on success and \-1 on failu .Pp The .Fn magic_compile -function can be used to compile the the colon +function can be used to compile the colon separated list of database files passed in as .Ar filename , or @@ -251,7 +251,7 @@ for the default database. .Pp The .Fn magic_load -function must be used to load the the colon +function must be used to load the colon separated list of database files passed in as .Ar filename , or @@ -282,7 +282,7 @@ The .Fn magic_getparam and .Fn magic_setparam -allow getting and setting various limits related to the the magic +allow getting and setting various limits related to the magic library. .Bl -column "MAGIC_PARAM_ELF_PHNUM_MAX" "size_t" "Default" -offset indent .It Sy "Parameter" Ta Sy "Type" Ta Sy "Default" @@ -292,6 +292,7 @@ library. .It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128 .It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768 .It Li MAGIC_PARAM_REGEX_MAX Ta size_t Ta 8192 +.It Li MAGIC_PARAM_BYTES_MAX Ta size_t Ta 1048576 .El .Pp The Modified: stable/10/contrib/file/magic/Magdir/android ============================================================================== --- stable/10/contrib/file/magic/Magdir/android Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/magic/Magdir/android Sat May 28 06:17:35 2016 (r300899) @@ -1,6 +1,6 @@ #------------------------------------------------------------ -# $File: android,v 1.8 2015/03/19 18:04:37 christos Exp $ +# $File: android,v 1.9 2016/01/11 21:19:18 christos Exp $ # Various android related magic entries #------------------------------------------------------------ @@ -128,7 +128,7 @@ # partition size in blocks ? #>>>>0x22 ulelong x \b*%d -# Android bootimg format +# Android sparse img format # From https://android.googlesource.com/\ # platform/system/core/+/master/libsparse/sparse_format.h 0 lelong 0xed26ff3a Android sparse image Modified: stable/10/contrib/file/magic/Magdir/animation ============================================================================== --- stable/10/contrib/file/magic/Magdir/animation Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/magic/Magdir/animation Sat May 28 06:17:35 2016 (r300899) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: animation,v 1.56 2014/10/23 23:12:51 christos Exp $ +# $File: animation,v 1.57 2015/11/29 22:11:07 christos Exp $ # animation: file(1) magic for animation/movie formats # # animation formats @@ -76,6 +76,8 @@ >8 string da2b \b, DMB MAF, ext da2a, with 3GPP timed text, DID, TVA, REL, IPMP >8 string da3a \b, DMB MAF aud with HE-AAC aud, JPG/PNG/MNG images >8 string da3b \b, DMB MAF, ext da3a w/ BIFS, 3GPP, DID, TVA, REL, IPMP +>8 string dash \b, MPEG v4 system, Dynamic Adaptive Streaming over HTTP +!:mime video/mp4 >8 string dmb1 \b, DMB MAF supporting all the components defined in the spec >8 string dmpf \b, Digital Media Project >8 string drc1 \b, Dirac (wavelet compression), encap in ISO base media (MP4) Modified: stable/10/contrib/file/magic/Magdir/apple ============================================================================== --- stable/10/contrib/file/magic/Magdir/apple Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/magic/Magdir/apple Sat May 28 06:17:35 2016 (r300899) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: apple,v 1.31 2015/08/29 07:10:35 christos Exp $ +# $File: apple,v 1.32 2015/12/04 20:40:10 christos Exp $ # apple: file(1) magic for Apple file formats # 0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text @@ -65,18 +65,48 @@ # Eric Fischer # AppleWorks word processor: -# -# This matches the standard tab stops for an AppleWorks file, but if -# a file has a tab stop set in the first four columns this will fail. -# +# URL: https://en.wikipedia.org/wiki/AppleWorks +# Reference: http://www.gno.org/pub/apple2/doc/apple/filetypes/ftn.1a.xxxx +# Update: Joerg Jenderek +# NOTE: # The "O" is really the magic number, but that's so common that it's # necessary to check the tab stops that follow it to avoid false positives. - -4 string O==== AppleWorks word processor data ->85 byte&0x01 >0 \b, zoomed ->90 byte&0x01 >0 \b, paginated ->92 byte&0x01 >0 \b, with mail merge -#>91 byte x \b, left margin %d +# and/or look for unused bits of booleans bytes like zoom, paginated, mail merge +# the newer AppleWorks is from claris with extension CWK +4 string O +# test for unused bits of zoom- , paginated-boolean bytes +>84 ubequad ^0x00Fe00000000Fe00 +# look for tabstop definitions "=" no tab, "|" no tab +# "<" left tab,"^" center tab,">" right tab, "." decimal tab, +# unofficial "!" other , "\x8a" other +# official only if SFMinVers is nonzero +>>5 regex/s [=.<>|!^\x8a]{79} AppleWorks Word Processor +# AppleWorks Word Processor File (Apple II) +# ./apple (version 5.25) labeled the entry as "AppleWorks word processor data" +# application/x-appleworks is mime type for claris version with cwk extension +!:mime application/x-appleworks3 +# http://home.earthlink.net/~hughhood/appleiiworksenvoy/ +# ('p' + 1-byte ProDOS File Type + 2-byte ProDOS Aux Type') +# $70 $1A $F8 $FF is this the apple type ? +#:apple pdospøÿ +!:ext awp +# minimum version needed to read this files. SFMinVers (0 , 30~3.0 ) +>>>183 ubyte 30 3.0 +>>>183 ubyte !30 +>>>>183 ubyte !0 0x%x +# usual tabstop start sequence "=====<" +>>>5 string x \b, tabstop ruler "%6.6s" +# tabstop ruler +#>>>5 string >\0 \b, tabstops "%-79s" +# zoom switch +>>>85 byte&0x01 >0 \b, zoomed +# whether paginated +>>>90 byte&0x01 >0 \b, paginated +# contains any mail-merge commands +>>>92 byte&0x01 >0 \b, with mail merge +# left margin in 1/10 inches ( normally 0 or 10 ) +>>>91 ubyte >0 +>>>>91 ubyte x \b, %d/10 inch left margin # AppleWorks database: # Modified: stable/10/contrib/file/magic/Magdir/archive ============================================================================== --- stable/10/contrib/file/magic/Magdir/archive Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/magic/Magdir/archive Sat May 28 06:17:35 2016 (r300899) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: archive,v 1.91 2015/09/16 13:49:33 christos Exp $ +# $File: archive,v 1.103 2016/05/05 17:07:40 christos Exp $ # archive: file(1) magic for archive formats (see also "msdos" for self- # extracting compressed archives) # @@ -246,7 +246,15 @@ # BA # TODO: idarc says "bytes 0-2 == bytes 3-5" # TTComp -0 string \0\6 TTComp archive data +# URL: http://fileformats.archiveteam.org/wiki/TTComp_archive +# Update: Joerg Jenderek +# GRR: line below is too general as it matches also Panorama database "TCDB 2003-10 demo.pan", others +0 string \0\6 +# look for first keyword of Panorama database *.pan +>12 search/261 DESIGN +# skip keyword with low entropy +>12 default x TTComp archive, binary, 4K dictionary +# (version 5.25) labeled the above entry as "TTComp archive data" # ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation? 0 string ESP ESP archive data # ZPack @@ -544,55 +552,212 @@ >>0x36 string >\0 fstype %.8s # LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu) -2 string -lh0- LHarc 1.x/ARX archive data [lh0] -!:mime application/x-lharc -2 string -lh1- LHarc 1.x/ARX archive data [lh1] -!:mime application/x-lharc -2 string -lz4- LHarc 1.x archive data [lz4] -!:mime application/x-lharc -2 string -lz5- LHarc 1.x archive data [lz5] -!:mime application/x-lharc +# Update: Joerg Jenderek +# URL: https://en.wikipedia.org/wiki/LHA_(file_format) +# Reference: http://web.archive.org/web/20021005080911/http://www.osirusoft.com/joejared/lzhformat.html +# +# check and display information of lharc (LHa,PMarc) file +0 name lharc-file +# check 1st character of method id like -lz4- -lh5- or -pm2- +>2 string - +# check 5th character of method id +>>6 string - +# check header level 0 1 2 3 +>>>20 ubyte <4 +# check 2nd, 3th and 4th character of method id +>>>>3 regex \^(lh[0-9a-ex]|lz[s2-8]|pm[012]|pc1) \b +!:mime application/x-lzh-compressed +# creator type "LHA " +!:apple ????LHA +# display archive type name like "LHa/LZS archive data" or "LArc archive" +>>>>>2 string -lz \b +!:ext lzs +# already known -lzs- -lz4- -lz5- with old names +>>>>>>2 string -lzs LHa/LZS archive data +>>>>>>3 regex \^lz[45] LHarc 1.x archive data +# missing -lz?- with wikipedia names +>>>>>>3 regex \^lz[2378] LArc archive +# display archive type name like "LHa (2.x) archive data" +>>>>>2 string -lh \b +# already known -lh0- -lh1- -lh2- -lh3- -lh4- -lh5- -lh6- -lh7- -lhd- variants with old names +>>>>>>3 regex \^lh[01] LHarc 1.x/ARX archive data +# LHice archiver use ".ICE" as name extension instead usual one ".lzh" +# FOOBAR archiver use ".foo" as name extension instead usual one +# "Florain Orjanov's and Olga Bachetska's ARchiver" not found at the moment +>>>>>>>2 string -lh1 \b +!:ext lha/lzh/ice +>>>>>>3 regex \^lh[23d] LHa 2.x? archive data +>>>>>>3 regex \^lh[7] LHa (2.x)/LHark archive data +>>>>>>3 regex \^lh[456] LHa (2.x) archive data +>>>>>>>2 string -lh5 \b +# https://en.wikipedia.org/wiki/BIOS +# Some mainboard BIOS like Award use LHa compression. So archives with unusal extension are found like +# bios.rom , kd7_v14.bin, 1010.004, ... +!:ext lha/lzh/rom/bin +# missing -lh?- variants (Joe Jared) +>>>>>>3 regex \^lh[89a-ce] LHa (Joe Jared) archive +# UNLHA32 2.67a +>>>>>>2 string -lhx LHa (UNLHA32) archive +# lha archives with standard file name extensions ".lha" ".lzh" +>>>>>>3 regex !\^(lh1|lh5) \b +!:ext lha/lzh +# this should not happen if all -lh variants are described +>>>>>>2 default x LHa (unknown) archive +#!:ext lha +# PMarc +>>>>>3 regex \^pm[012] PMarc archive data +!:ext pma +# append method id without leading and trailing minus character +>>>>>3 string x [%3.3s] +>>>>>>0 use lharc-header +# +# check and display information of lharc header +0 name lharc-header +# header size 0x4 , 0x1b-0x61 +>0 ubyte x +# compressed data size != compressed file size +#>7 ulelong x \b, data size %d +# attribute: 0x2~?? 0x10~symlink|target 0x20~normal +#>19 ubyte x \b, 19_0x%x +# level identifier 0 1 2 3 +#>20 ubyte x \b, level %d +# time stamp +#>15 ubelong x DATE 0x%8.8x +# OS ID for level 1 +>20 ubyte 1 +# 0x20 types find for *.rom files +>>(21.b+24) ubyte <0x21 \b, 0x%x OS +# ascii type like M for MSDOS +>>(21.b+24) ubyte >0x20 \b, '%c' OS +# OS ID for level 2 +>20 ubyte 2 +#>>23 ubyte x \b, OS ID 0x%x +>>23 ubyte <0x21 \b, 0x%x OS +>>23 ubyte >0x20 \b, '%c' OS +# filename only for level 0 and 1 +>20 ubyte <2 +# length of filename +>>21 ubyte >0 \b, with +# filename +>>>21 pstring x "%s" +# +#2 string -lh0- LHarc 1.x/ARX archive data [lh0] +#!:mime application/x-lharc +2 string -lh0- +>0 use lharc-file +#2 string -lh1- LHarc 1.x/ARX archive data [lh1] +#!:mime application/x-lharc +2 string -lh1- +>0 use lharc-file +# NEW -lz2- ... -lz8- +2 string -lz2- +>0 use lharc-file +2 string -lz3- +>0 use lharc-file +2 string -lz4- +>0 use lharc-file +2 string -lz5- +>0 use lharc-file +2 string -lz7- +>0 use lharc-file +2 string -lz8- +>0 use lharc-file # [never seen any but the last; -lh4- reported in comp.compression:] -2 string -lzs- LHa/LZS archive data [lzs] -!:mime application/x-lha -2 string -lh\40- LHa 2.x? archive data [lh ] -!:mime application/x-lha -2 string -lhd- LHa 2.x? archive data [lhd] -!:mime application/x-lha -2 string -lh2- LHa 2.x? archive data [lh2] -!:mime application/x-lha -2 string -lh3- LHa 2.x? archive data [lh3] -!:mime application/x-lha -2 string -lh4- LHa (2.x) archive data [lh4] -!:mime application/x-lha -2 string -lh5- LHa (2.x) archive data [lh5] -!:mime application/x-lha -2 string -lh6- LHa (2.x) archive data [lh6] -!:mime application/x-lha -2 string -lh7- LHa (2.x)/LHark archive data [lh7] -!:mime application/x-lha ->20 byte x - header level %d +#2 string -lzs- LHa/LZS archive data [lzs] +2 string -lzs- +>0 use lharc-file +# According to wikipedia and others such a version does not exist +#2 string -lh\40- LHa 2.x? archive data [lh ] +#2 string -lhd- LHa 2.x? archive data [lhd] +2 string -lhd- +>0 use lharc-file +#2 string -lh2- LHa 2.x? archive data [lh2] +2 string -lh2- +>0 use lharc-file +#2 string -lh3- LHa 2.x? archive data [lh3] +2 string -lh3- +>0 use lharc-file +#2 string -lh4- LHa (2.x) archive data [lh4] +2 string -lh4- +>0 use lharc-file +#2 string -lh5- LHa (2.x) archive data [lh5] +2 string -lh5- +>0 use lharc-file +#2 string -lh6- LHa (2.x) archive data [lh6] +2 string -lh6- +>0 use lharc-file +#2 string -lh7- LHa (2.x)/LHark archive data [lh7] +2 string -lh7- +# !:mime application/x-lha +# >20 byte x - header level %d +>0 use lharc-file +# NEW -lh8- ... -lhe- , -lhx- +2 string -lh8- +>0 use lharc-file +2 string -lh9- +>0 use lharc-file +2 string -lha- +>0 use lharc-file +2 string -lhb- +>0 use lharc-file +2 string -lhc- +>0 use lharc-file +2 string -lhe- +>0 use lharc-file +2 string -lhx- +>0 use lharc-file # taken from idarc [JW] 2 string -lZ PUT archive data -2 string -lz LZS archive data +# already done by LHarc magics +# this should never happen if all sub types of LZS archive are identified +#2 string -lz LZS archive data 2 string -sw1- Swag archive data -# RAR archiver (Greg Roelofs, newt@uchicago.edu) -0 string Rar! RAR archive data, +0 name rar-file-header +>24 byte 15 \b, v1.5 +>24 byte 20 \b, v2.0 +>24 byte 29 \b, v4 +>15 byte 0 \b, os: MS-DOS +>15 byte 1 \b, os: OS/2 +>15 byte 2 \b, os: Win32 +>15 byte 3 \b, os: Unix +>15 byte 4 \b, os: Mac OS +>15 byte 5 \b, os: BeOS + +0 name rar-archive-header +>3 leshort&0x1ff >0 \b, flags: +>>3 leshort &0x01 ArchiveVolume +>>3 leshort &0x02 Commented +>>3 leshort &0x04 Locked +>>3 leshort &0x10 NewVolumeNaming +>>3 leshort &0x08 Solid +>>3 leshort &0x20 Authenticated +>>3 leshort &0x40 RecoveryRecordPresent +>>3 leshort &0x80 EncryptedBlockHeader +>>3 leshort &0x100 FirstVolume + +# RAR (Roshal Archive) archive +0 string Rar!\x1a\7\0 RAR archive data +!:mime application/x-rar +!:ext rar/cbr +# file header +>(0xc.l+9) byte 0x74 +>>(0xc.l+7) use rar-file-header +# subblock seems to share information with file header +>(0xc.l+9) byte 0x7a +>>(0xc.l+7) use rar-file-header +>9 byte 0x73 +>>7 use rar-archive-header + +0 string Rar!\x1a\7\1\0 RAR archive data, v5 !:mime application/x-rar ->44 byte x v%0x, ->10 byte >0 flags: ->>10 byte &0x01 Archive volume, ->>10 byte &0x02 Commented, ->>10 byte &0x04 Locked, ->>10 byte &0x08 Solid, ->>10 byte &0x20 Authenticated, ->35 byte 0 os: MS-DOS ->35 byte 1 os: OS/2 ->35 byte 2 os: Win32 ->35 byte 3 os: Unix -# some old version? idarc says: -0 string RE\x7e\x5e RAR archive data +!:ext rar + +# Very old RAR archive +# http://jasonblanks.com/wp-includes/images/papers/KnowyourarchiveRAR.pdf +0 string RE\x7e\x5e RAR archive data ((26.s+30) leshort 0xcafe Java archive data (JAR) !:mime application/java-archive +# iOS App +>(26.s+30) leshort !0xcafe +>>26 string !\x8\0\0\0mimetype +>>>30 string Payload/ +>>>>38 search/64 .app/ iOS App +!:mime application/x-ios-app + + # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu) # Next line excludes specialized formats: >(26.s+30) leshort !0xcafe @@ -764,12 +940,24 @@ 0 string \0\ \ \ \ \ \ \ \ \ \ \ \0\0 LBR archive data # # PMA (CP/M derivative of LHA) +# Update: Joerg Jenderek +# URL: https://en.wikipedia.org/wiki/LHA_(file_format) # -2 string -pm0- PMarc archive data [pm0] -2 string -pm1- PMarc archive data [pm1] -2 string -pm2- PMarc archive data [pm2] +#2 string -pm0- PMarc archive data [pm0] +2 string -pm0- +>0 use lharc-file +#2 string -pm1- PMarc archive data [pm1] +2 string -pm1- +>0 use lharc-file +#2 string -pm2- PMarc archive data [pm2] +2 string -pm2- +>0 use lharc-file 2 string -pms- PMarc SFX archive (CP/M, DOS) +#!:mime application/x-foobar-exec +!:ext com 5 string -pc1- PopCom compressed executable (CP/M) +#!:mime application/x- +#!:ext com # From Rafael Laboissiere # The Project Revision Control System (see @@ -802,6 +990,9 @@ # Felix von Leitner 0 string d8:announce BitTorrent file !:mime application/x-bittorrent +# Durval Menezes, +0 string d13:announce-list BitTorrent file +!:mime application/x-bittorrent # Atari MSA archive - Teemu Hukkanen 0 beshort 0x0e0f Atari MSA archive data @@ -889,19 +1080,16 @@ # From "Nelson A. de Oliveira" 0 string MPQ\032 MoPaQ (MPQ) archive -# From: Dirk Jagdmann -# xar archive format: http://code.google.com/p/xar/ -0 string xar! xar archive ->6 beshort x - version %d - # From: "Nelson A. de Oliveira" # .kgb 0 string KGB_arch KGB Archiver file >10 string x with compression level %.1s # xar (eXtensible ARchiver) archive +# xar archive format: http://code.google.com/p/xar/ # From: "David Remahl" 0 string xar! xar archive +!:mime application/x-xar #>4 beshort x header size %d >6 beshort x version %d, #>8 quad x compressed TOC: %d, @@ -975,3 +1163,9 @@ >0xE08 search/7776 \x55\xAA >>&-512 indirect x \b; contains +# Google Chrome extensions +# https://developer.chrome.com/extensions/crx +# https://developer.chrome.com/extensions/hosting +0 string Cr24 Google Chrome extension +!:mime application/x-chrome-extension +>4 ulong x \b, version %u Modified: stable/10/contrib/file/magic/Magdir/audio ============================================================================== --- stable/10/contrib/file/magic/Magdir/audio Sat May 28 03:34:00 2016 (r300898) +++ stable/10/contrib/file/magic/Magdir/audio Sat May 28 06:17:35 2016 (r300899) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: audio,v 1.73 2015/03/15 23:21:42 christos Exp $ +# $File: audio,v 1.75 2016/02/08 17:30:11 christos Exp $ # audio: file(1) magic for sound formats (see also "iff") # # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com), @@ -585,7 +585,7 @@ 0 string SC68\ Music-file\ /\ (c)\ (BeN)jami sc68 Atari ST music # musepak support From: "Jiri Pejchal" -0 string MP+ Musepack audio +0 string MP+ Musepack audio (MP+) !:mime audio/x-musepack >3 byte 255 \b, SV pre8 >3 byte&0xF 0x6 \b, SV 6 @@ -619,6 +619,9 @@ >>27 byte 114 \b, Beta 1.14 >>27 byte 115 \b, Alpha 1.15 +0 string MPCK Musepack audio (MPCK) +!:mime audio/x-musepack + # IMY # from http://filext.com/detaillist.php?extdetail=IMY # http://cellphones.about.com/od/cellularfaqs/f/rf_imelody.htm @@ -715,3 +718,41 @@ 0 string ZBOT >4 byte 0xc5 GVOX Encore music, version < 5.0 +# Summary: Garmin Voice Processing Module (WAVE audios) +# From: Joerg Jenderek +# URL: http://www.garmin.com/ +# Reference: http://turboccc.wikispaces.com/share/view/28622555 +# NOTE: there exist 2 other Garmin VPM formats +0 string AUDIMG +# skip text files starting with string "AUDIMG" +>13 ubyte <13 Garmin Voice Processing Module +!:mime audio/x-vpm-wav-garmin +!:ext vpm +# 3 bytes indicating the voice version (200,220) +>>6 string x \b, version %3.3s +# day of release (01-31) +>>12 ubyte x \b, %.2d +# month of release (01-12) +>>13 ubyte x \b.%.2d +# year of release (like 2006, 2007, 2008) +>>14 uleshort x \b.%.4d +# hour of release (0-23) +>>11 ubyte x %.2d +# minute of release (0-59) +>>10 ubyte x \b:%.2d +# second of release (0-59) +>>9 ubyte x \b:%.2d +# if you select a language like german on your garmin device +# you can only select voice modules with correponding language byte ID like 1 +>>18 ubyte x \b, language ID %d +# pointer to 1st audio WAV sample +>>16 uleshort >0 +>>>(16.s) ulelong >0 \b, at offset 0x%x +# WAV length +>>>>(16.s+4) ulelong >0 %d Bytes +# look for magic +>>>>>(&-8.l) string RIFF +# determine type by ./riff +>>>>>>&-4 indirect x \b +# 2 - ~ 131 WAV samples following same way + Copied: stable/10/contrib/file/magic/Magdir/bioinformatics (from r298192, head/contrib/file/magic/Magdir/bioinformatics) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/file/magic/Magdir/bioinformatics Sat May 28 06:17:35 2016 (r300899, copy of r298192, head/contrib/file/magic/Magdir/bioinformatics) @@ -0,0 +1,178 @@ + +#------------------------------------------------------------------------------ +# $File: bioinformatics,v 1.2 2016/02/14 15:53:53 christos Exp $ +# bioinfomatics: file(1) magic for Bioinfomatics file formats + +############################################################################### +# BGZF (Blocked GNU Zip Format) - gzip compatible, but also indexable +# used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml) +############################################################################### +0 string \037\213 +>3 byte &0x04 +>>12 string BC +>>>14 leshort &0x02 Blocked GNU Zip Format (BGZF; gzip compatible) +>>>>16 leshort x \b, block length %d +!:mime application/x-gzip + + +############################################################################### +# Tabix index file +# used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml) +############################################################################### +0 string TBI\1 SAMtools TBI (Tabix index format) +>0x04 lelong =1 \b, with %d reference sequence +>0x04 lelong >1 \b, with %d reference sequences +>0x08 lelong &0x10000 \b, using half-closed-half-open coordinates (BED style) +>0x08 lelong ^0x10000 +>>0x08 lelong =0 \b, using closed and one based coordinates (GFF style) +>>0x08 lelong =1 \b, using SAM format +>>0x08 lelong =2 \b, using VCF format +>0x0c lelong x \b, sequence name column: %d +>0x10 lelong x \b, region start column: %d +>0x08 lelong =0 +>>0x14 lelong x \b, region end column: %d +>0x18 byte x \b, comment character: %c +>0x1c lelong x \b, skip line count: %d + + +############################################################################### +# BAM (Binary Sequence Alignment/Map format) +# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) +# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it +############################################################################### +0 string BAM\1 SAMtools BAM (Binary Sequence Alignment/Map) +>0x04 lelong >0 +>>&0x00 regex =^[@]HD\t.*VN: \b, with SAM header +>>>&0 regex =[0-9.]+ \b version %s +>>&(0x04) lelong >0 \b, with %d reference sequences + + +############################################################################### +# BAI (BAM indexing format) +# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) +############################################################################### +0 string BAI\1 SAMtools BAI (BAM indexing format) +>0x04 lelong >0 \b, with %d reference sequences + + +############################################################################### +# CRAM (Binary Sequence Alignment/Map format) +############################################################################### +0 string CRAM CRAM +>0x04 byte >-1 version %d. +>0x05 byte >-1 \b%d +>0x06 string >\0 (identified as %s) + + +############################################################################### +# BCF (Binary Call Format), version 1 +# used by SAMtools & VCFtools (http://vcftools.sourceforge.net/bcf.pdf) +# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it +############################################################################### +0 string BCF\4 +# length of seqnm data in bytes is positive +>&0x00 lelong >0 +# length of smpl data in bytes is positive +>>&(&-0x04) lelong >0 SAMtools BCF (Binary Call Format) +# length of meta in bytes +>>>&(&-0x04) lelong >0 +# have meta text string +>>>>&0x00 search ##samtoolsVersion= +>>>>>&0x00 string x \b, generated by SAMtools version %s + + +############################################################################### +# BCF (Binary Call Format), version 2.1 +# used by SAMtools (http://samtools.github.io/hts-specs/BCFv2_qref.pdf) +# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it +############################################################################### +0 string BCF\2\1 Binary Call Format (BCF) version 2.1 +# length of header text +>&0x00 lelong >0 +# have header string +>>&0x00 search ##samtoolsVersion= +>>>&0x00 string x \b, generated by SAMtools version %s + + +############################################################################### *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Sat May 28 22:42:58 2016 Return-Path: Delivered-To: svn-src-stable-10@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 64DF9B4E659; Sat, 28 May 2016 22:42:58 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08D5914EF; Sat, 28 May 2016 22:42:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4SMgvh4031397; Sat, 28 May 2016 22:42:57 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4SMgvph031395; Sat, 28 May 2016 22:42:57 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201605282242.u4SMgvph031395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 28 May 2016 22:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300916 - stable/10/sys/fs/fuse X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 May 2016 22:42:58 -0000 Author: rmacklem Date: Sat May 28 22:42:56 2016 New Revision: 300916 URL: https://svnweb.freebsd.org/changeset/base/300916 Log: MFC: r299753 Fix fuse to use DIRECT_IO when required. When a file is opened write-only and a partial block was written, buffered I/O would try and read the whole block in. This would result in a hung thread, since there was no open (fuse filehandle) that allowed reading. This patch avoids the problem by forcing DIRECT_IO for this case. It also sets DIRECT_IO when the file system specifies the FN_DIRECTIO flag in its reply to the open. Modified: stable/10/sys/fs/fuse/fuse_file.c stable/10/sys/fs/fuse/fuse_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/fuse/fuse_file.c ============================================================================== --- stable/10/sys/fs/fuse/fuse_file.c Sat May 28 22:27:54 2016 (r300915) +++ stable/10/sys/fs/fuse/fuse_file.c Sat May 28 22:42:56 2016 (r300916) @@ -141,7 +141,17 @@ fuse_filehandle_open(struct vnode *vp, foo = fdi.answ; fuse_filehandle_init(vp, fufh_type, fufhp, foo->fh); - fuse_vnode_open(vp, foo->open_flags, td); + + /* + * For WRONLY opens, force DIRECT_IO. This is necessary + * since writing a partial block through the buffer cache + * will result in a read of the block and that read won't + * be allowed by the WRONLY open. + */ + if (fufh_type == FUFH_WRONLY) + fuse_vnode_open(vp, foo->open_flags | FOPEN_DIRECT_IO, td); + else + fuse_vnode_open(vp, foo->open_flags, td); out: fdisp_destroy(&fdi); Modified: stable/10/sys/fs/fuse/fuse_vnops.c ============================================================================== --- stable/10/sys/fs/fuse/fuse_vnops.c Sat May 28 22:27:54 2016 (r300915) +++ stable/10/sys/fs/fuse/fuse_vnops.c Sat May 28 22:42:56 2016 (r300916) @@ -1125,6 +1125,7 @@ fuse_vnop_open(struct vop_open_args *ap) struct fuse_vnode_data *fvdat; int error, isdir = 0; + int32_t fuse_open_flags; FS_DEBUG2G("inode=%ju mode=0x%x\n", (uintmax_t)VTOI(vp), mode); @@ -1136,14 +1137,24 @@ fuse_vnop_open(struct vop_open_args *ap) if (vnode_isdir(vp)) { isdir = 1; } + fuse_open_flags = 0; if (isdir) { fufh_type = FUFH_RDONLY; } else { fufh_type = fuse_filehandle_xlate_from_fflags(mode); + /* + * For WRONLY opens, force DIRECT_IO. This is necessary + * since writing a partial block through the buffer cache + * will result in a read of the block and that read won't + * be allowed by the WRONLY open. + */ + if (fufh_type == FUFH_WRONLY || + (fvdat->flag & FN_DIRECTIO) != 0) + fuse_open_flags = FOPEN_DIRECT_IO; } if (fuse_filehandle_valid(vp, fufh_type)) { - fuse_vnode_open(vp, 0, td); + fuse_vnode_open(vp, fuse_open_flags, td); return 0; } error = fuse_filehandle_open(vp, fufh_type, NULL, td, cred);