From owner-svn-src-stable-8@FreeBSD.ORG Sun Jul 22 10:21:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9BFE7106566C; Sun, 22 Jul 2012 10:21:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 858B18FC14; Sun, 22 Jul 2012 10:21:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6MALhO1069117; Sun, 22 Jul 2012 10:21:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6MALhRr069114; Sun, 22 Jul 2012 10:21:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207221021.q6MALhRr069114@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 22 Jul 2012 10:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238682 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2012 10:21:43 -0000 Author: kib Date: Sun Jul 22 10:21:42 2012 New Revision: 238682 URL: http://svn.freebsd.org/changeset/base/238682 Log: MFC r238617: Fix several reads beyond the mapped first page of the binary in the ELF parser. Specifically, do not allow note reader and interpreter path comparision in the brandelf code to read past end of the page. This may happen if specially crafter ELF image is activated. Modified: stable/8/sys/kern/imgact_elf.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/imgact_elf.c ============================================================================== --- stable/8/sys/kern/imgact_elf.c Sun Jul 22 09:04:26 2012 (r238681) +++ stable/8/sys/kern/imgact_elf.c Sun Jul 22 10:21:42 2012 (r238682) @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); static int __elfN(check_header)(const Elf_Ehdr *hdr); static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, - const char *interp, int32_t *osrel); + const char *interp, int interp_name_len, int32_t *osrel); static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, u_long *entry, size_t pagesize); static int __elfN(load_section)(struct vmspace *vmspace, vm_object_t object, @@ -221,7 +221,7 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry static Elf_Brandinfo * __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, - int32_t *osrel) + int interp_name_len, int32_t *osrel) { const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; Elf_Brandinfo *bi; @@ -267,7 +267,10 @@ __elfN(get_brandinfo)(struct image_param if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) continue; if (hdr->e_machine == bi->machine && - strcmp(interp, bi->interp_path) == 0) + /* ELF image p_filesz includes terminating zero */ + strlen(bi->interp_path) + 1 == interp_name_len && + strncmp(interp, bi->interp_path, interp_name_len) + == 0) return (bi); } } @@ -680,7 +683,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i u_long seg_size, seg_addr; u_long addr, baddr, et_dyn_addr, entry = 0, proghdr = 0; int32_t osrel = 0; - int error = 0, i, n; + int error = 0, i, n, interp_name_len = 0; const char *interp = NULL, *newinterp = NULL; Elf_Brandinfo *brand_info; char *path; @@ -721,14 +724,17 @@ __CONCAT(exec_, __elfN(imgact))(struct i if (phdr[i].p_type == PT_INTERP) { /* Path to interpreter */ if (phdr[i].p_filesz > MAXPATHLEN || - phdr[i].p_offset + phdr[i].p_filesz > PAGE_SIZE) + phdr[i].p_offset >= PAGE_SIZE || + phdr[i].p_offset + phdr[i].p_filesz >= PAGE_SIZE) return (ENOEXEC); interp = imgp->image_header + phdr[i].p_offset; + interp_name_len = phdr[i].p_filesz; continue; } } - brand_info = __elfN(get_brandinfo)(imgp, interp, &osrel); + brand_info = __elfN(get_brandinfo)(imgp, interp, interp_name_len, + &osrel); if (brand_info == NULL) { uprintf("ELF binary type \"%u\" not known.\n", hdr->e_ident[EI_OSABI]); @@ -1404,6 +1410,7 @@ __elfN(parse_notes)(struct image_params int i; if (pnote == NULL || pnote->p_offset >= PAGE_SIZE || + pnote->p_filesz > PAGE_SIZE || pnote->p_offset + pnote->p_filesz >= PAGE_SIZE) return (FALSE); @@ -1411,15 +1418,17 @@ __elfN(parse_notes)(struct image_params note_end = (const Elf_Note *)(imgp->image_header + pnote->p_offset + pnote->p_filesz); for (i = 0; i < 100 && note >= note0 && note < note_end; i++) { - if (!aligned(note, Elf32_Addr)) + if (!aligned(note, Elf32_Addr) || (const char *)note_end - + (const char *)note < sizeof(Elf_Note)) return (FALSE); if (note->n_namesz != checknote->hdr.n_namesz || note->n_descsz != checknote->hdr.n_descsz || note->n_type != checknote->hdr.n_type) goto nextnote; note_name = (const char *)(note + 1); - if (strncmp(checknote->vendor, note_name, - checknote->hdr.n_namesz) != 0) + if (note_name + checknote->hdr.n_namesz >= + (const char *)note_end || strncmp(checknote->vendor, + note_name, checknote->hdr.n_namesz) != 0) goto nextnote; /* From owner-svn-src-stable-8@FreeBSD.ORG Sun Jul 22 11:22:05 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 84D0C106566C; Sun, 22 Jul 2012 11:22:05 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 549038FC0C; Sun, 22 Jul 2012 11:22:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6MBM5Gl077780; Sun, 22 Jul 2012 11:22:05 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6MBM5eI077777; Sun, 22 Jul 2012 11:22:05 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201207221122.q6MBM5eI077777@svn.freebsd.org> From: Isabell Long Date: Sun, 22 Jul 2012 11:22:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238685 - in stable/8: sbin/ipfw sys/netinet/ipfw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2012 11:22:05 -0000 Author: issyl0 (doc committer) Date: Sun Jul 22 11:22:04 2012 New Revision: 238685 URL: http://svn.freebsd.org/changeset/base/238685 Log: MFC r238063: - Make ipfw's sched rules case insensitive, for user-friendliness. - Add a note to the ipfw(8) man page about the rules no longer being case sensitive. - Fix some typos in the man page. PR: docs/164772 Reviewed by: bz Approved by: gavin Modified: stable/8/sbin/ipfw/ipfw.8 stable/8/sys/netinet/ipfw/ip_dummynet.c Directory Properties: stable/8/sbin/ipfw/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/sbin/ipfw/ipfw.8 ============================================================================== --- stable/8/sbin/ipfw/ipfw.8 Sun Jul 22 11:07:59 2012 (r238684) +++ stable/8/sbin/ipfw/ipfw.8 Sun Jul 22 11:22:04 2012 (r238685) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 9, 2012 +.Dd July 3, 2012 .Dt IPFW 8 .Os .Sh NAME @@ -2209,19 +2209,20 @@ Specifies the weight to be used for flow The weight must be in the range 1..100, and defaults to 1. .El .Pp -The following parameters can be configured for a scheduler: +The following case-insensitive parameters can be configured for a +scheduler: .Pp .Bl -tag -width indent -compact -.It Cm type Ar {fifo | wf2qp | rr | qfq} +.It Cm type Ar {fifo | wf2q+ | rr | qfq} specifies the scheduling algorithm to use. .Bl -tag -width indent -compact -.It cm fifo +.It Cm fifo is just a FIFO scheduler (which means that all packets are stored in the same queue as they arrive to the scheduler). FIFO has O(1) per-packet time complexity, with very low constants (estimate 60-80ns on a 2GHz desktop machine) but gives no service guarantees. -.It Cm wf2qp +.It Cm wf2q+ implements the WF2Q+ algorithm, which is a Weighted Fair Queueing algorithm which permits flows to share bandwidth according to their weights. Note that weights are not priorities; even a flow Modified: stable/8/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_dummynet.c Sun Jul 22 11:07:59 2012 (r238684) +++ stable/8/sys/netinet/ipfw/ip_dummynet.c Sun Jul 22 11:22:04 2012 (r238685) @@ -97,7 +97,7 @@ find_sched_type(int type, char *name) struct dn_alg *d; SLIST_FOREACH(d, &dn_cfg.schedlist, next) { - if (d->type == type || (name && !strcmp(d->name, name))) + if (d->type == type || (name && !strcasecmp(d->name, name))) return d; } return NULL; /* not found */ From owner-svn-src-stable-8@FreeBSD.ORG Sun Jul 22 12:09:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98CBF106564A; Sun, 22 Jul 2012 12:09:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 822BA8FC14; Sun, 22 Jul 2012 12:09:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6MC9hPf082115; Sun, 22 Jul 2012 12:09:43 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6MC9hvI082113; Sun, 22 Jul 2012 12:09:43 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201207221209.q6MC9hvI082113@svn.freebsd.org> From: Robert Watson Date: Sun, 22 Jul 2012 12:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238686 - stable/8/contrib/openbsm/libauditd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2012 12:09:43 -0000 Author: rwatson Date: Sun Jul 22 12:09:42 2012 New Revision: 238686 URL: http://svn.freebsd.org/changeset/base/238686 Log: Merge r234034 from head to stable/8: Merge a local fix to OpenBSM's libauditd to avoid a directory descriptor leak when iterating over possible audit trail directories. This fix will be merged upstream in an identical form, but hasn't yet appeared in an OpenBSM release. Submitted by: guido Obtained from: TrustedBSD Project Modified: stable/8/contrib/openbsm/libauditd/auditd_lib.c Modified: stable/8/contrib/openbsm/libauditd/auditd_lib.c ============================================================================== --- stable/8/contrib/openbsm/libauditd/auditd_lib.c Sun Jul 22 11:22:04 2012 (r238685) +++ stable/8/contrib/openbsm/libauditd/auditd_lib.c Sun Jul 22 12:09:42 2012 (r238686) @@ -520,6 +520,7 @@ auditd_expire_trails(int (*warn_expired) } } + closedir(dirp); } oldest_time = current_time - expire_age; From owner-svn-src-stable-8@FreeBSD.ORG Sun Jul 22 14:33:05 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F03A310656F4; Sun, 22 Jul 2012 14:33:04 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C20318FC1C; Sun, 22 Jul 2012 14:33:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6MEX4sK094450; Sun, 22 Jul 2012 14:33:04 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6MEX4ov094448; Sun, 22 Jul 2012 14:33:04 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201207221433.q6MEX4ov094448@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Jul 2012 14:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238690 - stable/8/sys/dev/sym X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2012 14:33:05 -0000 Author: marius Date: Sun Jul 22 14:33:04 2012 New Revision: 238690 URL: http://svn.freebsd.org/changeset/base/238690 Log: MFC: r238621 Revert the use of BUS_DMA_ALLOCNOW when creating the DMA tag for user data introduced in r236061 (MFC'ed to stable/8 in r237187). Using that flag doesn't make that much sense on this case as the DMA maps using it are also created during sym_pci_attach(). Moreover, due to the maxsegsz parameter used, doing so may exhaust the bounce pages pool on architectures requiring bounce pages. [1] While at it, use a slightly more appropriate maxsegsz parameter. PR: 169526 Submitted by: Mike Watters [1] Modified: stable/8/sys/dev/sym/sym_hipd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/dev/sound/ (props changed) stable/8/sys/dev/sound/pci/ (props changed) Modified: stable/8/sys/dev/sym/sym_hipd.c ============================================================================== --- stable/8/sys/dev/sym/sym_hipd.c Sun Jul 22 14:32:49 2012 (r238689) +++ stable/8/sys/dev/sym/sym_hipd.c Sun Jul 22 14:33:04 2012 (r238690) @@ -8537,8 +8537,8 @@ sym_pci_attach(device_t dev) */ if (bus_dma_tag_create(np->bus_dmat, 1, SYM_CONF_DMA_BOUNDARY, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG, SYM_CONF_DMA_BOUNDARY, - BUS_DMA_ALLOCNOW, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { + BUS_SPACE_MAXSIZE_32BIT, SYM_CONF_MAX_SG, SYM_CONF_DMA_BOUNDARY, + 0, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { device_printf(dev, "failed to create DMA tag.\n"); goto attach_failed; } From owner-svn-src-stable-8@FreeBSD.ORG Sun Jul 22 16:56:59 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B9B38106564A; Sun, 22 Jul 2012 16:56:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A39F88FC19; Sun, 22 Jul 2012 16:56:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6MGuxOt006265; Sun, 22 Jul 2012 16:56:59 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6MGuxw0006263; Sun, 22 Jul 2012 16:56:59 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201207221656.q6MGuxw0006263@svn.freebsd.org> From: Robert Watson Date: Sun, 22 Jul 2012 16:56:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238698 - stable/8/sys/security/mac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2012 16:56:59 -0000 Author: rwatson Date: Sun Jul 22 16:56:59 2012 New Revision: 238698 URL: http://svn.freebsd.org/changeset/base/238698 Log: Merge r234032 from head to stable/8: When allocation of labels on files is implicitly disabled due to MAC policy configuration, avoid leaking resources following failed calls to get and set MAC labels by file descriptor. Reported by: Mateusz Guzik + clang scan-build Modified: stable/8/sys/security/mac/mac_syscalls.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/security/mac/mac_syscalls.c ============================================================================== --- stable/8/sys/security/mac/mac_syscalls.c Sun Jul 22 15:40:31 2012 (r238697) +++ stable/8/sys/security/mac/mac_syscalls.c Sun Jul 22 16:56:59 2012 (r238698) @@ -252,8 +252,10 @@ __mac_get_fd(struct thread *td, struct _ switch (fp->f_type) { case DTYPE_FIFO: case DTYPE_VNODE: - if (!(mac_labeled & MPC_OBJECT_VNODE)) - return (EINVAL); + if (!(mac_labeled & MPC_OBJECT_VNODE)) { + error = EINVAL; + goto out_fdrop; + } vp = fp->f_vnode; intlabel = mac_vnode_label_alloc(); vfslocked = VFS_LOCK_GIANT(vp->v_mount); @@ -267,8 +269,10 @@ __mac_get_fd(struct thread *td, struct _ break; case DTYPE_PIPE: - if (!(mac_labeled & MPC_OBJECT_PIPE)) - return (EINVAL); + if (!(mac_labeled & MPC_OBJECT_PIPE)) { + error = EINVAL; + goto out_fdrop; + } pipe = fp->f_data; intlabel = mac_pipe_label_alloc(); PIPE_LOCK(pipe); @@ -280,8 +284,10 @@ __mac_get_fd(struct thread *td, struct _ break; case DTYPE_SOCKET: - if (!(mac_labeled & MPC_OBJECT_SOCKET)) - return (EINVAL); + if (!(mac_labeled & MPC_OBJECT_SOCKET)) { + error = EINVAL; + goto out_fdrop; + } so = fp->f_data; intlabel = mac_socket_label_alloc(M_WAITOK); SOCK_LOCK(so); @@ -295,10 +301,10 @@ __mac_get_fd(struct thread *td, struct _ default: error = EINVAL; } - fdrop(fp, td); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); - +out_fdrop: + fdrop(fp, td); out: free(buffer, M_MACTEMP); free(elements, M_MACTEMP); @@ -446,8 +452,10 @@ __mac_set_fd(struct thread *td, struct _ switch (fp->f_type) { case DTYPE_FIFO: case DTYPE_VNODE: - if (!(mac_labeled & MPC_OBJECT_VNODE)) - return (EINVAL); + if (!(mac_labeled & MPC_OBJECT_VNODE)) { + error = EINVAL; + goto out_fdrop; + } intlabel = mac_vnode_label_alloc(); error = mac_vnode_internalize_label(intlabel, buffer); if (error) { @@ -471,8 +479,10 @@ __mac_set_fd(struct thread *td, struct _ break; case DTYPE_PIPE: - if (!(mac_labeled & MPC_OBJECT_PIPE)) - return (EINVAL); + if (!(mac_labeled & MPC_OBJECT_PIPE)) { + error = EINVAL; + goto out_fdrop; + } intlabel = mac_pipe_label_alloc(); error = mac_pipe_internalize_label(intlabel, buffer); if (error == 0) { @@ -486,8 +496,10 @@ __mac_set_fd(struct thread *td, struct _ break; case DTYPE_SOCKET: - if (!(mac_labeled & MPC_OBJECT_SOCKET)) - return (EINVAL); + if (!(mac_labeled & MPC_OBJECT_SOCKET)) { + error = EINVAL; + goto out_fdrop; + } intlabel = mac_socket_label_alloc(M_WAITOK); error = mac_socket_internalize_label(intlabel, buffer); if (error == 0) { @@ -501,6 +513,7 @@ __mac_set_fd(struct thread *td, struct _ default: error = EINVAL; } +out_fdrop: fdrop(fp, td); out: free(buffer, M_MACTEMP); From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 23 09:34:20 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CAC01065672; Mon, 23 Jul 2012 09:34:20 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D2F48FC1D; Mon, 23 Jul 2012 09:34:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6N9YKiP089015; Mon, 23 Jul 2012 09:34:20 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6N9YJPv089012; Mon, 23 Jul 2012 09:34:19 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207230934.q6N9YJPv089012@svn.freebsd.org> From: David Xu Date: Mon, 23 Jul 2012 09:34:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238715 - stable/8/lib/libthr/thread X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jul 2012 09:34:20 -0000 Author: davidxu Date: Mon Jul 23 09:34:19 2012 New Revision: 238715 URL: http://svn.freebsd.org/changeset/base/238715 Log: Merge r238637,r238640,r238641,r238642: ------------------------------------------------------------------------ r238637 | davidxu | 2012-07-20 09:56:14 +0800 (Fri, 20 Jul 2012) | 6 lines Don't forget to release a thread reference count, replace _thr_ref_add() with _thr_find_thread(), so reference count is no longer needed. ------------------------------------------------------------------------ r238640 | davidxu | 2012-07-20 11:00:41 +0800 (Fri, 20 Jul 2012) | 2 lines Eliminate duplicated code. ------------------------------------------------------------------------ r238641 | davidxu | 2012-07-20 11:16:52 +0800 (Fri, 20 Jul 2012) | 2 lines Eliminate duplicated code. ------------------------------------------------------------------------ r238642 | davidxu | 2012-07-20 11:22:17 +0800 (Fri, 20 Jul 2012) | 2 lines Don't assign same value. Modified: stable/8/lib/libthr/thread/thr_setprio.c (contents, props changed) stable/8/lib/libthr/thread/thr_setschedparam.c (contents, props changed) Modified: stable/8/lib/libthr/thread/thr_setprio.c ============================================================================== --- stable/8/lib/libthr/thread/thr_setprio.c Mon Jul 23 09:33:31 2012 (r238714) +++ stable/8/lib/libthr/thread/thr_setprio.c Mon Jul 23 09:34:19 2012 (r238715) @@ -45,38 +45,22 @@ _pthread_setprio(pthread_t pthread, int int ret; param.sched_priority = prio; - if (pthread == curthread) { + if (pthread == curthread) THR_LOCK(curthread); - if (curthread->attr.sched_policy == SCHED_OTHER || - curthread->attr.prio == prio) { - curthread->attr.prio = prio; - ret = 0; - } else { - ret = _thr_setscheduler(curthread->tid, - curthread->attr.sched_policy, ¶m); - if (ret == -1) - ret = errno; - else - curthread->attr.prio = prio; - } - THR_UNLOCK(curthread); - } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) - == 0) { - THR_THREAD_LOCK(curthread, pthread); - if (pthread->attr.sched_policy == SCHED_OTHER || - pthread->attr.prio == prio) { + else if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0))) + return (ret); + if (pthread->attr.sched_policy == SCHED_OTHER || + pthread->attr.prio == prio) { + pthread->attr.prio = prio; + ret = 0; + } else { + ret = _thr_setscheduler(pthread->tid, + pthread->attr.sched_policy, ¶m); + if (ret == -1) + ret = errno; + else pthread->attr.prio = prio; - ret = 0; - } else { - ret = _thr_setscheduler(pthread->tid, - curthread->attr.sched_policy, ¶m); - if (ret == -1) - ret = errno; - else - pthread->attr.prio = prio; - } - THR_THREAD_UNLOCK(curthread, pthread); - _thr_ref_delete(curthread, pthread); } + THR_THREAD_UNLOCK(curthread, pthread); return (ret); } Modified: stable/8/lib/libthr/thread/thr_setschedparam.c ============================================================================== --- stable/8/lib/libthr/thread/thr_setschedparam.c Mon Jul 23 09:33:31 2012 (r238714) +++ stable/8/lib/libthr/thread/thr_setschedparam.c Mon Jul 23 09:34:19 2012 (r238715) @@ -53,42 +53,25 @@ _pthread_setschedparam(pthread_t pthread struct pthread *curthread = _get_curthread(); int ret; - if (pthread == curthread) { + if (pthread == curthread) THR_LOCK(curthread); - if (curthread->attr.sched_policy == policy && - (policy == SCHED_OTHER || - curthread->attr.prio == param->sched_priority)) { - pthread->attr.prio = param->sched_priority; - THR_UNLOCK(curthread); - return (0); - } - ret = _thr_setscheduler(curthread->tid, policy, param); - if (ret == -1) - ret = errno; - else { - curthread->attr.sched_policy = policy; - curthread->attr.prio = param->sched_priority; - } - THR_UNLOCK(curthread); - } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) - == 0) { - THR_THREAD_LOCK(curthread, pthread); - if (pthread->attr.sched_policy == policy && - (policy == SCHED_OTHER || - pthread->attr.prio == param->sched_priority)) { - pthread->attr.prio = param->sched_priority; - THR_THREAD_UNLOCK(curthread, pthread); - return (0); - } - ret = _thr_setscheduler(pthread->tid, policy, param); - if (ret == -1) - ret = errno; - else { - pthread->attr.sched_policy = policy; - pthread->attr.prio = param->sched_priority; - } + else if ((ret = _thr_find_thread(curthread, pthread, + /*include dead*/0)) != 0) + return (ret); + if (pthread->attr.sched_policy == policy && + (policy == SCHED_OTHER || + pthread->attr.prio == param->sched_priority)) { + pthread->attr.prio = param->sched_priority; THR_THREAD_UNLOCK(curthread, pthread); - _thr_ref_delete(curthread, pthread); + return (0); } + ret = _thr_setscheduler(pthread->tid, policy, param); + if (ret == -1) + ret = errno; + else { + pthread->attr.sched_policy = policy; + pthread->attr.prio = param->sched_priority; + } + THR_THREAD_UNLOCK(curthread, pthread); return (ret); } From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 23 15:20:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0C861065677; Mon, 23 Jul 2012 15:20:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB6798FC1C; Mon, 23 Jul 2012 15:20:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6NFKqaW021875; Mon, 23 Jul 2012 15:20:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6NFKq9F021873; Mon, 23 Jul 2012 15:20:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207231520.q6NFKq9F021873@svn.freebsd.org> From: Alexander Motin Date: Mon, 23 Jul 2012 15:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238720 - stable/8/sys/dev/ata X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jul 2012 15:20:52 -0000 Author: mav Date: Mon Jul 23 15:20:52 2012 New Revision: 238720 URL: http://svn.freebsd.org/changeset/base/238720 Log: MFC r238666: Fix typo in bzero() length argument during sense fetching. For me it at least fixed CD burning in PIO mode. Modified: stable/8/sys/dev/ata/ata-all.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Mon Jul 23 15:19:21 2012 (r238719) +++ stable/8/sys/dev/ata/ata-all.c Mon Jul 23 15:20:52 2012 (r238720) @@ -1531,7 +1531,7 @@ ata_cam_request_sense(device_t dev, stru ch->requestsense = 1; - bzero(request, sizeof(&request)); + bzero(request, sizeof(*request)); request->dev = NULL; request->parent = dev; request->unit = ccb->ccb_h.target_id; From owner-svn-src-stable-8@FreeBSD.ORG Tue Jul 24 03:47:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28F56106564A; Tue, 24 Jul 2012 03:47:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 132728FC1C; Tue, 24 Jul 2012 03:47:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6O3lnSw083508; Tue, 24 Jul 2012 03:47:49 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6O3ln5W083506; Tue, 24 Jul 2012 03:47:49 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201207240347.q6O3ln5W083506@svn.freebsd.org> From: Eitan Adler Date: Tue, 24 Jul 2012 03:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238736 - stable/8/sys/cddl/compat/opensolaris/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jul 2012 03:47:50 -0000 Author: eadler Date: Tue Jul 24 03:47:49 2012 New Revision: 238736 URL: http://svn.freebsd.org/changeset/base/238736 Log: MFC r230454: Use provided name when allocating ksid domain. It isn't really used on FreeBSD, but should fix a panic when pool is imported from another OS that is using this. Requested by: nox No objections: pjd Approved by: cperciva (implicit) Modified: stable/8/sys/cddl/compat/opensolaris/sys/sid.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/compat/opensolaris/sys/sid.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/sid.h Tue Jul 24 03:46:58 2012 (r238735) +++ stable/8/sys/cddl/compat/opensolaris/sys/sid.h Tue Jul 24 03:47:49 2012 (r238736) @@ -30,7 +30,7 @@ #define _OPENSOLARIS_SYS_SID_H_ typedef struct ksiddomain { - char kd_name[16]; /* Domain part of SID */ + char kd_name[1]; /* Domain part of SID */ } ksiddomain_t; typedef void ksid_t; @@ -39,8 +39,8 @@ ksid_lookupdomain(const char *domain) { ksiddomain_t *kd; - kd = kmem_alloc(sizeof(*kd), KM_SLEEP); - strlcpy(kd->kd_name, "FreeBSD", sizeof(kd->kd_name)); + kd = kmem_alloc(sizeof(*kd) + strlen(domain), KM_SLEEP); + strcpy(kd->kd_name, domain); return (kd); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Jul 24 19:04:36 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 14D9B106564A; Tue, 24 Jul 2012 19:04:36 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E844F8FC15; Tue, 24 Jul 2012 19:04:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6OJ4ZZ4063293; Tue, 24 Jul 2012 19:04:35 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6OJ4ZD0063287; Tue, 24 Jul 2012 19:04:35 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201207241904.q6OJ4ZD0063287@svn.freebsd.org> From: Doug Barton Date: Tue, 24 Jul 2012 19:04:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238749 - in stable/8/contrib/bind9: . lib/dns lib/isc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jul 2012 19:04:36 -0000 Author: dougb Date: Tue Jul 24 19:04:35 2012 New Revision: 238749 URL: http://svn.freebsd.org/changeset/base/238749 Log: Heavy DNSSEC Validation Load Can Cause a "Bad Cache" Assertion Failure in BIND9 High numbers of queries with DNSSEC validation enabled can cause an assertion failure in named, caused by using a "bad cache" data structure before it has been initialized. CVE: CVE-2012-3817 Posting date: 24 July, 2012 Modified: stable/8/contrib/bind9/CHANGES stable/8/contrib/bind9/lib/dns/resolver.c stable/8/contrib/bind9/lib/dns/zone.c stable/8/contrib/bind9/lib/isc/random.c stable/8/contrib/bind9/version Directory Properties: stable/8/contrib/bind9/ (props changed) Modified: stable/8/contrib/bind9/CHANGES ============================================================================== --- stable/8/contrib/bind9/CHANGES Tue Jul 24 19:00:56 2012 (r238748) +++ stable/8/contrib/bind9/CHANGES Tue Jul 24 19:04:35 2012 (r238749) @@ -1,3 +1,14 @@ + --- 9.6-ESV-R7-P2 released --- + +3346. [security] Bad-cache data could be used before it was + initialized, causing an assert. [RT #30025] + +3343. [bug] Relax isc_random_jitter() REQUIRE tests. [RT #29821] + +3342. [bug] Change #3314 broke saving of stub zones to disk + resulting in excessive cpu usage in some cases. + [RT #29952] + --- 9.6-ESV-R7-P1 released --- 3331. [security] dns_rdataslab_fromrdataset could produce bad Modified: stable/8/contrib/bind9/lib/dns/resolver.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/resolver.c Tue Jul 24 19:00:56 2012 (r238748) +++ stable/8/contrib/bind9/lib/dns/resolver.c Tue Jul 24 19:04:35 2012 (r238749) @@ -8124,6 +8124,7 @@ dns_resolver_addbadcache(dns_resolver_t goto cleanup; bad->type = type; bad->hashval = hashval; + bad->expire = *expire; isc_buffer_init(&buffer, bad + 1, name->length); dns_name_init(&bad->name, NULL); dns_name_copy(name, &bad->name, &buffer); @@ -8135,8 +8136,8 @@ dns_resolver_addbadcache(dns_resolver_t if (resolver->badcount < resolver->badhash * 2 && resolver->badhash > DNS_BADCACHE_SIZE) resizehash(resolver, &now, ISC_FALSE); - } - bad->expire = *expire; + } else + bad->expire = *expire; cleanup: UNLOCK(&resolver->lock); } Modified: stable/8/contrib/bind9/lib/dns/zone.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/zone.c Tue Jul 24 19:00:56 2012 (r238748) +++ stable/8/contrib/bind9/lib/dns/zone.c Tue Jul 24 19:04:35 2012 (r238749) @@ -6054,6 +6054,7 @@ zone_maintenance(dns_zone_t *zone) { switch (zone->type) { case dns_zone_master: case dns_zone_slave: + case dns_zone_stub: LOCK_ZONE(zone); if (zone->masterfile != NULL && isc_time_compare(&now, &zone->dumptime) >= 0 && @@ -6395,7 +6396,7 @@ zone_dump(dns_zone_t *zone, isc_boolean_ goto fail; } - if (compact) { + if (compact && zone->type != dns_zone_stub) { dns_zone_t *dummy = NULL; LOCK_ZONE(zone); zone_iattach(zone, &dummy); @@ -7251,7 +7252,7 @@ stub_callback(isc_task_t *task, isc_even dns_zone_t *zone = NULL; char master[ISC_SOCKADDR_FORMATSIZE]; char source[ISC_SOCKADDR_FORMATSIZE]; - isc_uint32_t nscnt, cnamecnt; + isc_uint32_t nscnt, cnamecnt, refresh, retry, expire; isc_result_t result; isc_time_t now; isc_boolean_t exiting = ISC_FALSE; @@ -7399,19 +7400,32 @@ stub_callback(isc_task_t *task, isc_even ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_write); if (zone->db == NULL) zone_attachdb(zone, stub->db); + result = zone_get_from_db(zone, zone->db, NULL, NULL, NULL, &refresh, + &retry, &expire, NULL, NULL); + if (result == ISC_R_SUCCESS) { + zone->refresh = RANGE(refresh, zone->minrefresh, + zone->maxrefresh); + zone->retry = RANGE(retry, zone->minretry, zone->maxretry); + zone->expire = RANGE(expire, zone->refresh + zone->retry, + DNS_MAX_EXPIRE); + DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_HAVETIMERS); + } ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_write); dns_db_detach(&stub->db); - if (zone->masterfile != NULL) - zone_needdump(zone, 0); - dns_message_destroy(&msg); isc_event_free(&event); dns_request_destroy(&zone->request); + DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH); + DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED); DNS_ZONE_JITTER_ADD(&now, zone->refresh, &zone->refreshtime); isc_interval_set(&i, zone->expire, 0); DNS_ZONE_TIME_ADD(&now, zone->expire, &zone->expiretime); + + if (zone->masterfile != NULL) + zone_needdump(zone, 0); + zone_settimer(zone, &now); goto free_stub; Modified: stable/8/contrib/bind9/lib/isc/random.c ============================================================================== --- stable/8/contrib/bind9/lib/isc/random.c Tue Jul 24 19:00:56 2012 (r238748) +++ stable/8/contrib/bind9/lib/isc/random.c Tue Jul 24 19:04:35 2012 (r238749) @@ -103,7 +103,7 @@ isc_uint32_t isc_random_jitter(isc_uint32_t max, isc_uint32_t jitter) { isc_uint32_t rnd; - REQUIRE(jitter < max); + REQUIRE(jitter < max || (jitter == 0 && max == 0)); if (jitter == 0) return (max); Modified: stable/8/contrib/bind9/version ============================================================================== --- stable/8/contrib/bind9/version Tue Jul 24 19:00:56 2012 (r238748) +++ stable/8/contrib/bind9/version Tue Jul 24 19:04:35 2012 (r238749) @@ -7,4 +7,4 @@ MAJORVER=9 MINORVER=6 PATCHVER= RELEASETYPE=-ESV -RELEASEVER=-R7-P1 +RELEASEVER=-R7-P2 From owner-svn-src-stable-8@FreeBSD.ORG Tue Jul 24 19:10:44 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A40981065674; Tue, 24 Jul 2012 19:10:44 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 748798FC1A; Tue, 24 Jul 2012 19:10:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6OJAieV063854; Tue, 24 Jul 2012 19:10:44 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6OJAinu063851; Tue, 24 Jul 2012 19:10:44 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201207241910.q6OJAinu063851@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 24 Jul 2012 19:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238751 - in stable/8/sys: kern sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jul 2012 19:10:44 -0000 Author: trociny Date: Tue Jul 24 19:10:43 2012 New Revision: 238751 URL: http://svn.freebsd.org/changeset/base/238751 Log: MFC r227316: Add KVME_FLAG_SUPER and use it in sysctl_kern_proc_vmmap for marking entries with superpages. Submitted by: Mel Flynn Reviewed by: alc, rwatson Modified: stable/8/sys/kern/kern_proc.c stable/8/sys/sys/user.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_proc.c ============================================================================== --- stable/8/sys/kern/kern_proc.c Tue Jul 24 19:08:12 2012 (r238750) +++ stable/8/sys/kern/kern_proc.c Tue Jul 24 19:10:43 2012 (r238751) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -74,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef COMPAT_FREEBSD32 @@ -1750,7 +1752,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR entry = entry->next) { vm_object_t obj, tobj, lobj; vm_offset_t addr; - int vfslocked; + int vfslocked, mincoreinfo; if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) continue; @@ -1768,8 +1770,11 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR kve->kve_resident = 0; addr = entry->start; while (addr < entry->end) { - if (pmap_extract(map->pmap, addr)) + mincoreinfo = pmap_mincore(map->pmap, addr); + if (mincoreinfo & MINCORE_INCORE) kve->kve_resident++; + if (mincoreinfo & MINCORE_SUPER) + kve->kve_flags |= KVME_FLAG_SUPER; addr += PAGE_SIZE; } Modified: stable/8/sys/sys/user.h ============================================================================== --- stable/8/sys/sys/user.h Tue Jul 24 19:08:12 2012 (r238750) +++ stable/8/sys/sys/user.h Tue Jul 24 19:10:43 2012 (r238751) @@ -338,6 +338,7 @@ struct kinfo_file { #define KVME_FLAG_COW 0x00000001 #define KVME_FLAG_NEEDS_COPY 0x00000002 #define KVME_FLAG_NOCOREDUMP 0x00000004 +#define KVME_FLAG_SUPER 0x00000008 #if defined(__amd64__) #define KINFO_OVMENTRY_SIZE 1168 From owner-svn-src-stable-8@FreeBSD.ORG Tue Jul 24 19:11:51 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B158A106566C; Tue, 24 Jul 2012 19:11:51 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 829C88FC1D; Tue, 24 Jul 2012 19:11:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6OJBptW063992; Tue, 24 Jul 2012 19:11:51 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6OJBpnD063991; Tue, 24 Jul 2012 19:11:51 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201207241911.q6OJBpnD063991@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 24 Jul 2012 19:11:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238752 - stable/8/usr.bin/procstat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jul 2012 19:11:51 -0000 Author: trociny Date: Tue Jul 24 19:11:50 2012 New Revision: 238752 URL: http://svn.freebsd.org/changeset/base/238752 Log: MFC r227317, r227355: When displaying process virtual memory mappings print superpage mapping flag. Submitted by: Mel Flynn Reviewed by: alc, rwatson Modified: stable/8/usr.bin/procstat/procstat.1 stable/8/usr.bin/procstat/procstat_vm.c Directory Properties: stable/8/usr.bin/procstat/ (props changed) Modified: stable/8/usr.bin/procstat/procstat.1 ============================================================================== --- stable/8/usr.bin/procstat/procstat.1 Tue Jul 24 19:10:43 2012 (r238751) +++ stable/8/usr.bin/procstat/procstat.1 Tue Jul 24 19:11:50 2012 (r238752) @@ -391,6 +391,8 @@ The following mapping flags may be displ copy-on-write .It N needs copy +.It S +one or more superpage mappings are used .El .Sh EXIT STATUS .Ex -std Modified: stable/8/usr.bin/procstat/procstat_vm.c ============================================================================== --- stable/8/usr.bin/procstat/procstat_vm.c Tue Jul 24 19:10:43 2012 (r238751) +++ stable/8/usr.bin/procstat/procstat_vm.c Tue Jul 24 19:11:50 2012 (r238752) @@ -49,7 +49,7 @@ procstat_vm(pid_t pid, struct kinfo_proc ptrwidth = 2*sizeof(void *) + 2; if (!hflag) - printf("%5s %*s %*s %3s %4s %4s %3s %3s %2s %-2s %-s\n", + printf("%5s %*s %*s %3s %4s %4s %3s %3s %3s %-2s %-s\n", "PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES", "PRES", "REF", "SHD", "FL", "TP", "PATH"); @@ -69,8 +69,9 @@ procstat_vm(pid_t pid, struct kinfo_proc printf("%3d ", kve->kve_ref_count); printf("%3d ", kve->kve_shadow_count); printf("%-1s", kve->kve_flags & KVME_FLAG_COW ? "C" : "-"); - printf("%-1s ", kve->kve_flags & KVME_FLAG_NEEDS_COPY ? "N" : + printf("%-1s", kve->kve_flags & KVME_FLAG_NEEDS_COPY ? "N" : "-"); + printf("%-1s ", kve->kve_flags & KVME_FLAG_SUPER ? "S" : "-"); switch (kve->kve_type) { case KVME_TYPE_NONE: str = "--"; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 25 01:57:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E22F106564A; Wed, 25 Jul 2012 01:57:54 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07E1B8FC08; Wed, 25 Jul 2012 01:57:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6P1vrnC097711; Wed, 25 Jul 2012 01:57:53 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6P1vrNI097708; Wed, 25 Jul 2012 01:57:53 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207250157.q6P1vrNI097708@svn.freebsd.org> From: David Xu Date: Wed, 25 Jul 2012 01:57:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238760 - stable/8/lib/libthr/thread X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2012 01:57:54 -0000 Author: davidxu Date: Wed Jul 25 01:57:53 2012 New Revision: 238760 URL: http://svn.freebsd.org/changeset/base/238760 Log: Revert r238715, the revision breaks firefox. Reported by: dougb Modified: stable/8/lib/libthr/thread/thr_setprio.c (contents, props changed) stable/8/lib/libthr/thread/thr_setschedparam.c (contents, props changed) Modified: stable/8/lib/libthr/thread/thr_setprio.c ============================================================================== --- stable/8/lib/libthr/thread/thr_setprio.c Wed Jul 25 01:05:49 2012 (r238759) +++ stable/8/lib/libthr/thread/thr_setprio.c Wed Jul 25 01:57:53 2012 (r238760) @@ -45,22 +45,38 @@ _pthread_setprio(pthread_t pthread, int int ret; param.sched_priority = prio; - if (pthread == curthread) + if (pthread == curthread) { THR_LOCK(curthread); - else if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0))) - return (ret); - if (pthread->attr.sched_policy == SCHED_OTHER || - pthread->attr.prio == prio) { - pthread->attr.prio = prio; - ret = 0; - } else { - ret = _thr_setscheduler(pthread->tid, - pthread->attr.sched_policy, ¶m); - if (ret == -1) - ret = errno; - else + if (curthread->attr.sched_policy == SCHED_OTHER || + curthread->attr.prio == prio) { + curthread->attr.prio = prio; + ret = 0; + } else { + ret = _thr_setscheduler(curthread->tid, + curthread->attr.sched_policy, ¶m); + if (ret == -1) + ret = errno; + else + curthread->attr.prio = prio; + } + THR_UNLOCK(curthread); + } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) + == 0) { + THR_THREAD_LOCK(curthread, pthread); + if (pthread->attr.sched_policy == SCHED_OTHER || + pthread->attr.prio == prio) { pthread->attr.prio = prio; + ret = 0; + } else { + ret = _thr_setscheduler(pthread->tid, + curthread->attr.sched_policy, ¶m); + if (ret == -1) + ret = errno; + else + pthread->attr.prio = prio; + } + THR_THREAD_UNLOCK(curthread, pthread); + _thr_ref_delete(curthread, pthread); } - THR_THREAD_UNLOCK(curthread, pthread); return (ret); } Modified: stable/8/lib/libthr/thread/thr_setschedparam.c ============================================================================== --- stable/8/lib/libthr/thread/thr_setschedparam.c Wed Jul 25 01:05:49 2012 (r238759) +++ stable/8/lib/libthr/thread/thr_setschedparam.c Wed Jul 25 01:57:53 2012 (r238760) @@ -53,25 +53,42 @@ _pthread_setschedparam(pthread_t pthread struct pthread *curthread = _get_curthread(); int ret; - if (pthread == curthread) + if (pthread == curthread) { THR_LOCK(curthread); - else if ((ret = _thr_find_thread(curthread, pthread, - /*include dead*/0)) != 0) - return (ret); - if (pthread->attr.sched_policy == policy && - (policy == SCHED_OTHER || - pthread->attr.prio == param->sched_priority)) { - pthread->attr.prio = param->sched_priority; + if (curthread->attr.sched_policy == policy && + (policy == SCHED_OTHER || + curthread->attr.prio == param->sched_priority)) { + pthread->attr.prio = param->sched_priority; + THR_UNLOCK(curthread); + return (0); + } + ret = _thr_setscheduler(curthread->tid, policy, param); + if (ret == -1) + ret = errno; + else { + curthread->attr.sched_policy = policy; + curthread->attr.prio = param->sched_priority; + } + THR_UNLOCK(curthread); + } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) + == 0) { + THR_THREAD_LOCK(curthread, pthread); + if (pthread->attr.sched_policy == policy && + (policy == SCHED_OTHER || + pthread->attr.prio == param->sched_priority)) { + pthread->attr.prio = param->sched_priority; + THR_THREAD_UNLOCK(curthread, pthread); + return (0); + } + ret = _thr_setscheduler(pthread->tid, policy, param); + if (ret == -1) + ret = errno; + else { + pthread->attr.sched_policy = policy; + pthread->attr.prio = param->sched_priority; + } THR_THREAD_UNLOCK(curthread, pthread); - return (0); + _thr_ref_delete(curthread, pthread); } - ret = _thr_setscheduler(pthread->tid, policy, param); - if (ret == -1) - ret = errno; - else { - pthread->attr.sched_policy = policy; - pthread->attr.prio = param->sched_priority; - } - THR_THREAD_UNLOCK(curthread, pthread); return (ret); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 25 02:06:00 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECBCA106566C; Wed, 25 Jul 2012 02:05:59 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D76BB8FC0C; Wed, 25 Jul 2012 02:05:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6P25xe4098382; Wed, 25 Jul 2012 02:05:59 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6P25xHf098381; Wed, 25 Jul 2012 02:05:59 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207250205.q6P25xHf098381@svn.freebsd.org> From: David Xu Date: Wed, 25 Jul 2012 02:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238761 - stable/8/lib/libthr/thread X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2012 02:06:00 -0000 Author: davidxu Date: Wed Jul 25 02:05:59 2012 New Revision: 238761 URL: http://svn.freebsd.org/changeset/base/238761 Log: Release a reference count in case priority needn't to be changed. Modified: stable/8/lib/libthr/thread/thr_setschedparam.c Modified: stable/8/lib/libthr/thread/thr_setschedparam.c ============================================================================== --- stable/8/lib/libthr/thread/thr_setschedparam.c Wed Jul 25 01:57:53 2012 (r238760) +++ stable/8/lib/libthr/thread/thr_setschedparam.c Wed Jul 25 02:05:59 2012 (r238761) @@ -78,6 +78,7 @@ _pthread_setschedparam(pthread_t pthread pthread->attr.prio == param->sched_priority)) { pthread->attr.prio = param->sched_priority; THR_THREAD_UNLOCK(curthread, pthread); + _thr_ref_delete(curthread, pthread); return (0); } ret = _thr_setscheduler(pthread->tid, policy, param); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 25 02:09:07 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7573D106564A; Wed, 25 Jul 2012 02:09:07 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FF458FC08; Wed, 25 Jul 2012 02:09:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6P297I3098663; Wed, 25 Jul 2012 02:09:07 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6P297iY098661; Wed, 25 Jul 2012 02:09:07 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207250209.q6P297iY098661@svn.freebsd.org> From: David Xu Date: Wed, 25 Jul 2012 02:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238762 - stable/8/lib/libthr/thread X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2012 02:09:07 -0000 Author: davidxu Date: Wed Jul 25 02:09:06 2012 New Revision: 238762 URL: http://svn.freebsd.org/changeset/base/238762 Log: Use target thread's scheduling policy not current's. Modified: stable/8/lib/libthr/thread/thr_setprio.c Modified: stable/8/lib/libthr/thread/thr_setprio.c ============================================================================== --- stable/8/lib/libthr/thread/thr_setprio.c Wed Jul 25 02:05:59 2012 (r238761) +++ stable/8/lib/libthr/thread/thr_setprio.c Wed Jul 25 02:09:06 2012 (r238762) @@ -69,7 +69,7 @@ _pthread_setprio(pthread_t pthread, int ret = 0; } else { ret = _thr_setscheduler(pthread->tid, - curthread->attr.sched_policy, ¶m); + pthread->attr.sched_policy, ¶m); if (ret == -1) ret = errno; else From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 25 12:06:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D18571065686; Wed, 25 Jul 2012 12:06:52 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB60C8FC1B; Wed, 25 Jul 2012 12:06:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6PC6qY4055707; Wed, 25 Jul 2012 12:06:52 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6PC6qIx055705; Wed, 25 Jul 2012 12:06:52 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207251206.q6PC6qIx055705@svn.freebsd.org> From: Christian Brueffer Date: Wed, 25 Jul 2012 12:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238768 - stable/8/sys/dev/mps X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2012 12:06:52 -0000 Author: brueffer Date: Wed Jul 25 12:06:52 2012 New Revision: 238768 URL: http://svn.freebsd.org/changeset/base/238768 Log: MFC: r238574 Fix a small memory leak in mpssas_get_sata_identify(). The change has been submitted upstream as well. Modified: stable/8/sys/dev/mps/mps_sas_lsi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) Modified: stable/8/sys/dev/mps/mps_sas_lsi.c ============================================================================== --- stable/8/sys/dev/mps/mps_sas_lsi.c Wed Jul 25 11:50:36 2012 (r238767) +++ stable/8/sys/dev/mps/mps_sas_lsi.c Wed Jul 25 12:06:52 2012 (r238768) @@ -796,8 +796,10 @@ mpssas_get_sata_identify(struct mps_soft if (!buffer) return ENOMEM; - if ((cm = mps_alloc_command(sc)) == NULL) + if ((cm = mps_alloc_command(sc)) == NULL) { + free(buffer, M_MPT2); return (EBUSY); + } mpi_request = (MPI2_SATA_PASSTHROUGH_REQUEST *)cm->cm_req; bzero(mpi_request,sizeof(MPI2_SATA_PASSTHROUGH_REQUEST)); mpi_request->Function = MPI2_FUNCTION_SATA_PASSTHROUGH; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 25 13:11:37 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A3038106566B; Wed, 25 Jul 2012 13:11:37 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8305E8FC14; Wed, 25 Jul 2012 13:11:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6PDBbZ0061182; Wed, 25 Jul 2012 13:11:37 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6PDBb6g061180; Wed, 25 Jul 2012 13:11:37 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201207251311.q6PDBb6g061180@svn.freebsd.org> From: Warren Block Date: Wed, 25 Jul 2012 13:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238772 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2012 13:11:37 -0000 Author: wblock (doc committer) Date: Wed Jul 25 13:11:36 2012 New Revision: 238772 URL: http://svn.freebsd.org/changeset/base/238772 Log: MFC r238705: Correct ugen.4 to show that it has been integrated into usb(4). Also fix some punctuation errors. Approved by: hps Modified: stable/8/share/man/man4/ugen.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ugen.4 ============================================================================== --- stable/8/share/man/man4/ugen.4 Wed Jul 25 13:05:11 2012 (r238771) +++ stable/8/share/man/man4/ugen.4 Wed Jul 25 13:11:36 2012 (r238772) @@ -36,26 +36,17 @@ .\" .\" $FreeBSD$ .\" -.Dd November 22, 2006 +.Dd July 22, 2012 .Dt UGEN 4 .Os .Sh NAME .Nm ugen .Nd USB generic device support .Sh SYNOPSIS -To compile this driver into the kernel, -place the following line in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device ugen" -.Ed -.Pp -Alternatively, to load the driver as a -module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -ugen_load="YES" -.Ed +.Nm +is integrated into the +.Xr usb 4 +kernel module. .Sh DESCRIPTION The .Nm @@ -72,22 +63,22 @@ bulk, or interrupt. Each of the endpoints will have a different device node. The four least significant bits in the minor device -number determines which endpoint the device accesses and the rest -of the bits determines which USB device. +number determine which endpoint the device accesses, and the rest +of the bits determine which USB device. .Pp -If an endpoint address is used both for input and output the device +If an endpoint address is used both for input and output, the device can be opened for both read or write. .Pp -To find out what endpoints that exist there are a series of +To find out which endpoints exist, there are a series of .Xr ioctl 2 -operation on the control endpoint that returns the USB descriptors +operations on the control endpoint that return the USB descriptors of the device, configurations, interfaces, and endpoints. .Pp The control transfer mode can only happen on the control endpoint which is always endpoint 0. -The control endpoint accepts request -and may respond with an answer to such request. -Control request +The control endpoint accepts a request +and may respond with an answer to such a request. +Control requests are issued by .Xr ioctl 2 calls. @@ -136,8 +127,8 @@ Normally a transfer from the device which is shorter than the request specified is reported as an error. .It Dv USB_SET_TIMEOUT Pq Vt int -Set the timeout on the device operations, the time is specified -in milliseconds. +Set the timeout on the device operations +The time is specified in milliseconds. The value 0 is used to indicate that there is no timeout. .El @@ -183,7 +174,7 @@ field. Return the device descriptor. .It Dv USB_GET_CONFIG_DESC Pq Vt "struct usb_config_desc" Return the descriptor for the configuration with the given index. -For convenience the current configuration can be specified by +For convenience, the current configuration can be specified by .Dv USB_CURRENT_CONFIG_INDEX . .Bd -literal struct usb_config_desc { @@ -194,7 +185,7 @@ struct usb_config_desc { .It Dv USB_GET_INTERFACE_DESC Pq Vt "struct usb_interface_desc" Return the interface descriptor for an interface specified by its configuration index, interface index, and alternative index. -For convenience the current alternative can be specified by +For convenience, the current alternative can be specified by .Dv USB_CURRENT_ALT_INDEX . .Bd -literal struct usb_interface_desc { @@ -258,7 +249,7 @@ field is ignored in this call. The .Va ucr_flags field can be used to flag that the request is allowed to -be shorter than the requested size, and the +be shorter than the requested size, and .Va ucr_actlen will contain the actual size on completion. .Bd -literal @@ -277,18 +268,17 @@ Some of the most dangerous (e.g., changi address) are not allowed. .It Dv USB_GET_DEVICEINFO Pq Vt "struct usb_device_info" Get an information summary for the device. -This call will not -issue any USB transactions. +This call will not issue any USB transactions. .El .Pp -Note that there are two different ways of addressing configurations, interfaces, -alternatives, and endpoints: by index or by number. +Note that there are two different ways of addressing configurations, +interfaces, alternatives, and endpoints: by index or by number. The index is the ordinal number (starting from 0) of the descriptor as presented by the device. The number is the respective number of the entity as found in its descriptor. Enumeration of descriptors -use the index, getting and setting typically uses numbers. +uses the index, getting and setting typically uses numbers. .Pp Example: all endpoints (except the control endpoint) for the current configuration @@ -296,13 +286,13 @@ can be found by iterating the .Va interface_index from 0 to .Va config_desc->bNumInterface Ns \-1 -and for each of these iterating the +and for each of these, iterating the .Va endpoint_index from 0 to .Va interface_desc->bNumEndpoints . The .Va config_index -should set to +should be set to .Dv USB_CURRENT_CONFIG_INDEX and .Va alt_index From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 25 17:42:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBC40106564A; Wed, 25 Jul 2012 17:42:57 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C61408FC15; Wed, 25 Jul 2012 17:42:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6PHgvpR083180; Wed, 25 Jul 2012 17:42:57 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6PHgvDj083177; Wed, 25 Jul 2012 17:42:57 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201207251742.q6PHgvDj083177@svn.freebsd.org> From: Max Khon Date: Wed, 25 Jul 2012 17:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238775 - stable/8/sys/dev/puc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2012 17:42:58 -0000 Author: fjoe Date: Wed Jul 25 17:42:57 2012 New Revision: 238775 URL: http://svn.freebsd.org/changeset/base/238775 Log: MFC: r227457, r237350, r237357 Add support for the following Moxa PCIe multiport serial boards: - CP102E - CP102EL - CP104EL-A - CP104JU - CP114EL - CP118EL-A - CP168EL-A Modified: stable/8/sys/dev/puc/puc_cfg.h stable/8/sys/dev/puc/pucdata.c Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) Modified: stable/8/sys/dev/puc/puc_cfg.h ============================================================================== --- stable/8/sys/dev/puc/puc_cfg.h Wed Jul 25 17:25:44 2012 (r238774) +++ stable/8/sys/dev/puc/puc_cfg.h Wed Jul 25 17:42:57 2012 (r238775) @@ -79,7 +79,7 @@ struct puc_cfg { int8_t ports; int8_t rid; /* Rid of first port */ int8_t d_rid; /* Delta rid of next ports */ - int8_t d_ofs; /* Delta offset of next ports */ + int16_t d_ofs; /* Delta offset of next ports */ puc_config_f *config_function; }; Modified: stable/8/sys/dev/puc/pucdata.c ============================================================================== --- stable/8/sys/dev/puc/pucdata.c Wed Jul 25 17:25:44 2012 (r238774) +++ stable/8/sys/dev/puc/pucdata.c Wed Jul 25 17:42:57 2012 (r238775) @@ -51,6 +51,7 @@ static puc_config_f puc_config_amc; static puc_config_f puc_config_diva; static puc_config_f puc_config_exar; static puc_config_f puc_config_icbook; +static puc_config_f puc_config_moxa; static puc_config_f puc_config_oxford_pcie; static puc_config_f puc_config_quatech; static puc_config_f puc_config_syba; @@ -506,6 +507,18 @@ const struct puc_cfg puc_pci_devices[] = .config_function = puc_config_quatech }, + { 0x1393, 0x1024, 0xffff, 0, + "Moxa Technologies, Smartio CP-102E/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x14, 0, 0x200 + }, + + { 0x1393, 0x1025, 0xffff, 0, + "Moxa Technologies, Smartio CP-102EL/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x14, 0, 0x200, + }, + { 0x1393, 0x1040, 0xffff, 0, "Moxa Technologies, Smartio C104H/PCI", DEFAULT_RCLK * 8, @@ -518,12 +531,25 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_4S, 0x18, 0, 8, }, + { 0x1393, 0x1042, 0xffff, 0, + "Moxa Technologies, Smartio CP-104JU/PCI", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x18, 0, 8, + }, + { 0x1393, 0x1043, 0xffff, 0, "Moxa Technologies, Smartio CP-104EL/PCIe", DEFAULT_RCLK * 8, PUC_PORT_4S, 0x18, 0, 8, }, + { 0x1393, 0x1045, 0xffff, 0, + "Moxa Technologies, Smartio CP-104EL-A/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x14, 0, -1, + .config_function = puc_config_moxa + }, + { 0x1393, 0x1120, 0xffff, 0, "Moxa Technologies, CP-112UL", DEFAULT_RCLK * 8, @@ -536,6 +562,19 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_4S, 0x18, 0, 8, }, + { 0x1393, 0x1144, 0xffff, 0, + "Moxa Technologies, Smartio CP-114EL/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x14, 0, -1, + .config_function = puc_config_moxa + }, + + { 0x1393, 0x1182, 0xffff, 0, + "Moxa Technologies, Smartio CP-118EL-A/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x14, 0, 0x200, + }, + { 0x1393, 0x1680, 0xffff, 0, "Moxa Technologies, C168H/PCI", DEFAULT_RCLK * 8, @@ -554,6 +593,12 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_8S, 0x18, 0, 8, }, + { 0x1393, 0x1683, 0xffff, 0, + "Moxa Technologies, Smartio CP-168EL-A/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x14, 0, 0x200, + }, + { 0x13a8, 0x0152, 0xffff, 0, "Exar XR17C/D152", DEFAULT_RCLK * 8, @@ -1104,6 +1149,17 @@ puc_config_icbook(struct puc_softc *sc, } static int +puc_config_moxa(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, + intptr_t *res) +{ + if (cmd == PUC_CFG_GET_OFS) { + *res = ((port == 3) ? 7 : port) * 0x200; + return 0; + } + return (ENXIO); +} + +static int puc_config_quatech(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Jul 26 09:27:01 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C1896106566B; Thu, 26 Jul 2012 09:27:01 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9278A8FC1B; Thu, 26 Jul 2012 09:27:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6Q9R1cZ061701; Thu, 26 Jul 2012 09:27:01 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6Q9R11e061698; Thu, 26 Jul 2012 09:27:01 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207260927.q6Q9R11e061698@svn.freebsd.org> From: Christian Brueffer Date: Thu, 26 Jul 2012 09:27:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238794 - in stable/8/sys: cam/ata sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jul 2012 09:27:01 -0000 Author: brueffer Date: Thu Jul 26 09:27:00 2012 New Revision: 238794 URL: http://svn.freebsd.org/changeset/base/238794 Log: MFC: r238393 Add and utilize defines for the ATA device register. Modified: stable/8/sys/cam/ata/ata_all.c stable/8/sys/sys/ata.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_all.c ============================================================================== --- stable/8/sys/cam/ata/ata_all.c Thu Jul 26 09:13:47 2012 (r238793) +++ stable/8/sys/cam/ata/ata_all.c Thu Jul 26 09:27:00 2012 (r238794) @@ -334,7 +334,7 @@ ata_28bit_cmd(struct ccb_ataio *ataio, u ataio->cmd.lba_low = lba; ataio->cmd.lba_mid = lba >> 8; ataio->cmd.lba_high = lba >> 16; - ataio->cmd.device = 0x40 | ((lba >> 24) & 0x0f); + ataio->cmd.device = ATA_DEV_LBA | ((lba >> 24) & 0x0f); ataio->cmd.sector_count = sector_count; } @@ -359,7 +359,7 @@ ata_48bit_cmd(struct ccb_ataio *ataio, u ataio->cmd.lba_low = lba; ataio->cmd.lba_mid = lba >> 8; ataio->cmd.lba_high = lba >> 16; - ataio->cmd.device = 0x40; + ataio->cmd.device = ATA_DEV_LBA; ataio->cmd.lba_low_exp = lba >> 24; ataio->cmd.lba_mid_exp = lba >> 32; ataio->cmd.lba_high_exp = lba >> 40; @@ -379,7 +379,7 @@ ata_ncq_cmd(struct ccb_ataio *ataio, uin ataio->cmd.lba_low = lba; ataio->cmd.lba_mid = lba >> 8; ataio->cmd.lba_high = lba >> 16; - ataio->cmd.device = 0x40; + ataio->cmd.device = ATA_DEV_LBA; ataio->cmd.lba_low_exp = lba >> 24; ataio->cmd.lba_mid_exp = lba >> 32; ataio->cmd.lba_high_exp = lba >> 40; Modified: stable/8/sys/sys/ata.h ============================================================================== --- stable/8/sys/sys/ata.h Thu Jul 26 09:13:47 2012 (r238793) +++ stable/8/sys/sys/ata.h Thu Jul 26 09:27:00 2012 (r238794) @@ -261,6 +261,20 @@ struct ata_params { /*255*/ u_int16_t integrity; } __packed; +/* + * ATA Device Register + * + * bit 7 Obsolete (was 1 in early ATA specs) + * bit 6 Sets LBA/CHS mode. 1=LBA, 0=CHS + * bit 5 Obsolete (was 1 in early ATA specs) + * bit 4 1 = Slave Drive, 0 = Master Drive + * bit 3-0 In LBA mode, 27-24 of address. In CHS mode, head number +*/ + +#define ATA_DEV_MASTER 0x00 +#define ATA_DEV_SLAVE 0x10 +#define ATA_DEV_LBA 0x40 + /* ATA transfer modes */ #define ATA_MODE_MASK 0x0f