From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 00:11:40 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37D6E1065670; Sun, 7 Aug 2011 00:11:40 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28F368FC0C; Sun, 7 Aug 2011 00:11:40 +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 p770BeM2072892; Sun, 7 Aug 2011 00:11:40 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p770BeaC072890; Sun, 7 Aug 2011 00:11:40 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201108070011.p770BeaC072890@svn.freebsd.org> From: Alan Cox Date: Sun, 7 Aug 2011 00:11:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224689 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 00:11:40 -0000 Author: alc Date: Sun Aug 7 00:11:39 2011 New Revision: 224689 URL: http://svn.freebsd.org/changeset/base/224689 Log: Fix an error in kmem_alloc_attr(). Unless "tries" is updated, kmem_alloc_attr() could get stuck in a loop. Approved by: re (kib) MFC after: 3 days Modified: head/sys/vm/vm_contig.c Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Sat Aug 6 19:20:17 2011 (r224688) +++ head/sys/vm/vm_contig.c Sun Aug 7 00:11:39 2011 (r224689) @@ -265,6 +265,7 @@ retry: vm_contig_grow_cache(tries, low, high); vm_map_lock(map); VM_OBJECT_LOCK(object); + tries++; goto retry; } while (i != 0) { From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 02:35:58 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57745106564A; Sun, 7 Aug 2011 02:35:58 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id 215BF8FC08; Sun, 7 Aug 2011 02:35:57 +0000 (UTC) Received: from dhcp-192-168-2-22.wifi.xcllnt.net (atm.xcllnt.net [70.36.220.6]) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id p772Zn6s008922 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 6 Aug 2011 19:35:56 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii From: Marcel Moolenaar In-Reply-To: <20110806232415.GE48988@alchemy.franken.de> Date: Sat, 6 Aug 2011 19:35:49 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <96C6C36B-E521-4438-9AEF-59D9A922D3B4@xcllnt.net> References: <201108061748.p76HmUbM061259@svn.freebsd.org> <4E3DA560.6020100@yandex.ru> <4E3DBAF8.5040102@FreeBSD.org> <20110806232415.GE48988@alchemy.franken.de> To: Marius Strobl X-Mailer: Apple Mail (2.1244.3) Cc: src-committers@FreeBSD.org, Ruslan Mahmatkhanov , Garrett Cooper , svn-src-all@FreeBSD.org, Andriy Gapon , svn-src-head@FreeBSD.org Subject: Re: svn commit: r224683 - head/lib/libthread_db X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 02:35:58 -0000 On Aug 6, 2011, at 4:24 PM, Marius Strobl wrote: > On Sun, Aug 07, 2011 at 01:06:48AM +0300, Andriy Gapon wrote: >> on 07/08/2011 00:41 Garrett Cooper said the following: >>> It's not just i386. It's other architectures like arm, mips, and = pc98 >>> according to the tinderbox reports (this list is potentially >>> incomplete). >>=20 >> Yeah, confusingly enough thr_pread_long() is declared to take = uint64_t* as its >> third argument, so this commit breaks all platforms where uint64_t is = not >> derived from (unsigned) long. >> Just in case, thr_pread_int() takes uint32_t* as well. >>=20 >=20 > Yes, the type of val is wrong. I'm currently running a fix through a > universe build Ah, euh, ok, I forgot about this particular quirk: uint64_t is deliberate, because it's the width of long on 64-bit architectures and thread_db is to be used as a support library for a cross-tool (i.e. a 32-bit debugger for a 64-bit target). That's why thr_pread_long() takes a pointer to uint64_t and thr_pread_int() takes a pointer to uint32_t... Sorry for missing this in the review. FYI, --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 08:35:16 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27A9C106564A; Sun, 7 Aug 2011 08:35:16 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DE8C8FC12; Sun, 7 Aug 2011 08:35:16 +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 p778ZFLA088088; Sun, 7 Aug 2011 08:35:15 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p778ZFVF088086; Sun, 7 Aug 2011 08:35:15 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108070835.p778ZFVF088086@svn.freebsd.org> From: Martin Matuska Date: Sun, 7 Aug 2011 08:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224690 - head/usr.sbin/makefs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 08:35:16 -0000 Author: mm Date: Sun Aug 7 08:35:15 2011 New Revision: 224690 URL: http://svn.freebsd.org/changeset/base/224690 Log: Fix NetBSD PR bin/44114: makefs with -t cd9660 -o rockridge against directories with deep structure creates a corrupted cd9660 image. http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=44114 Fix NetBSD PR bin/45217: makefs creates ISO9660 images that violate the ECMA-119 (ISO9660) specification. This is caused by erroneously writing 32 bytes with value 0x20 to the volume_set_id field and 128 bytes with value 0x20 to the the following 37-byte fields in the PVD: copyright_file_id, abstract_file_id, bibliographic_file_id This causes, among other unwanted results the reserved4 field to be overwritten with the value 0x20. To comply with the specification, this field muse be zero. As a result, all FreeBSD distribution images created with makefs have not been 100% valid ISO9660 files. http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45217 Reviewed by: kientzle Approved by: re (kib) Obtained from: NetBSD MFC after: 3 days Modified: head/usr.sbin/makefs/cd9660.c Modified: head/usr.sbin/makefs/cd9660.c ============================================================================== --- head/usr.sbin/makefs/cd9660.c Sun Aug 7 00:11:39 2011 (r224689) +++ head/usr.sbin/makefs/cd9660.c Sun Aug 7 08:35:15 2011 (r224690) @@ -223,13 +223,12 @@ cd9660_set_defaults(void) /* Make sure the PVD is clear */ memset(&diskStructure.primaryDescriptor, 0, 2048); - memset(diskStructure.primaryDescriptor.volume_set_id, 0x20,32); memset(diskStructure.primaryDescriptor.publisher_id, 0x20,128); memset(diskStructure.primaryDescriptor.preparer_id, 0x20,128); memset(diskStructure.primaryDescriptor.application_id, 0x20,128); - memset(diskStructure.primaryDescriptor.copyright_file_id, 0x20,128); - memset(diskStructure.primaryDescriptor.abstract_file_id, 0x20,128); - memset(diskStructure.primaryDescriptor.bibliographic_file_id, 0x20,128); + memset(diskStructure.primaryDescriptor.copyright_file_id, 0x20,37); + memset(diskStructure.primaryDescriptor.abstract_file_id, 0x20,37); + memset(diskStructure.primaryDescriptor.bibliographic_file_id, 0x20,37); strcpy(diskStructure.primaryDescriptor.system_id,"NetBSD"); @@ -669,11 +668,11 @@ cd9660_finalize_PVD(void) cd9660_pad_string_spaces(diskStructure.primaryDescriptor.application_id, 128); cd9660_pad_string_spaces( - diskStructure.primaryDescriptor.copyright_file_id, 128); + diskStructure.primaryDescriptor.copyright_file_id, 37); cd9660_pad_string_spaces( - diskStructure.primaryDescriptor.abstract_file_id, 128); + diskStructure.primaryDescriptor.abstract_file_id, 37); cd9660_pad_string_spaces( - diskStructure.primaryDescriptor.bibliographic_file_id, 128); + diskStructure.primaryDescriptor.bibliographic_file_id, 37); /* Setup dates */ time(&tim); @@ -1307,6 +1306,8 @@ cd9660_rrip_move_directory(cd9660node *d /* Set the new name */ memset(dir->isoDirRecord->name, 0, ISO_FILENAME_MAXLENGTH_WITH_PADDING); strncpy(dir->isoDirRecord->name, newname, 8); + dir->isoDirRecord->length[0] = 34 + 8; + dir->isoDirRecord->name_len[0] = 8; return dir; } From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 08:42:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21B53106566B; Sun, 7 Aug 2011 08:42:37 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 108DC8FC08; Sun, 7 Aug 2011 08:42: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 p778gbXg088334; Sun, 7 Aug 2011 08:42:37 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p778gaFI088322; Sun, 7 Aug 2011 08:42:36 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108070842.p778gaFI088322@svn.freebsd.org> From: Martin Matuska Date: Sun, 7 Aug 2011 08:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224691 - in head/lib/libarchive: . test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 08:42:37 -0000 Author: mm Date: Sun Aug 7 08:42:36 2011 New Revision: 224691 URL: http://svn.freebsd.org/changeset/base/224691 Log: Add compatibility for ISO images created with unfixed makefs that violated ECMA-119 (ISO9660): allow reserved4 to be 0x20 in PVD. This allows tar to read FreeBSD distribution ISO images created with makefs prior to NetBSD bin/45217 bugfix (up to 9.0-BETA1). In addition, merge following important bugfixes from libarchive's release/2.8 branch: Revision 2812: Merge 2811 from trunk: Don't try to verify that compression-level=0 produces larger results than the default compression, since this isn't true for all versions of liblzma. Revision 2817: Merge 2814 from trunk: Fix Issue 121 (mtree parser error) http://code.google.com/p/libarchive/issues/detail?id=121 Revision 2820: Fix issue 119. Change the file location check that a file location does not exceed volume block. New one is that a file content does not exceed volume block(end of an ISO image). It is better than previous check even if the issue did not happen. While reading an ISO image generated by an older version of mkisofs utility, a file location indicates the end the ISO image if its file size is zero and it is the last file of all files of the ISO image, so it is possible that the location value is the same as the number of the total block of the ISO image. http://code.google.com/p/libarchive/issues/detail?id=119 Revision 2955: Issue 134: Fix libarchive 2.8 crashing in archive_write_finish() when the open has failed and we're trying to write Zip format. http://code.google.com/p/libarchive/issues/detail?id=134 Revision 2958: Followup on Issue 134: 1) Port test_open_failure to libarchive 2.8 branch to test the problem reported in Issue 134. This test also shows that archive_read_open() sometimes fails to report open errors correctly. 2) Fix the bug in archive_read.c 3) Comment out the tests that close functions are invoked promptly when open fails; that's fully fixed in libarchive 3.0, but I don't think it's worth fixing here. Revision 3484: Use uintmax_t with %ju Revision 3487: Fix issue 163. Correctly allocate enough memory for a input buffer saved. http://code.google.com/p/libarchive/issues/detail?id=163 Revision 3542: Merge 2516, 2536 from trunk: Allow path table offset values of 0 and 18, which are used by some ISO writers. Reviewed by: kientzle Approved by: re (kib) MFC after: 3 days Added: head/lib/libarchive/test/test_open_failure.c (contents, props changed) Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/archive_read_support_compression_uu.c head/lib/libarchive/archive_read_support_format_iso9660.c head/lib/libarchive/archive_read_support_format_mtree.c head/lib/libarchive/archive_write_set_compression_xz.c head/lib/libarchive/archive_write_set_format_zip.c head/lib/libarchive/test/Makefile head/lib/libarchive/test/test_read_format_mtree.c head/lib/libarchive/test/test_write_compress_lzma.c head/lib/libarchive/test/test_write_compress_xz.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/archive_read.c Sun Aug 7 08:42:36 2011 (r224691) @@ -377,6 +377,12 @@ build_stream(struct archive_read *a) /* If no bidder, we're done. */ if (best_bidder == NULL) { + /* Verify the final pipelin by asking it for some data. */ + __archive_read_filter_ahead(a->filter, 1, &avail); + if (avail < 0) { + cleanup_filters(a); + return (ARCHIVE_FATAL); + } a->archive.compression_name = a->filter->name; a->archive.compression_code = a->filter->code; return (ARCHIVE_OK); @@ -389,17 +395,11 @@ build_stream(struct archive_read *a) filter->bidder = best_bidder; filter->archive = a; filter->upstream = a->filter; - r = (best_bidder->init)(filter); - if (r != ARCHIVE_OK) { - free(filter); - return (r); - } a->filter = filter; - /* Verify the filter by asking it for some data. */ - __archive_read_filter_ahead(filter, 1, &avail); - if (avail < 0) { + r = (best_bidder->init)(a->filter); + if (r != ARCHIVE_OK) { cleanup_filters(a); - return (ARCHIVE_FATAL); + return (r); } } } Modified: head/lib/libarchive/archive_read_support_compression_uu.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_uu.c Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/archive_read_support_compression_uu.c Sun Aug 7 08:42:36 2011 (r224691) @@ -381,7 +381,17 @@ ensure_in_buff_size(struct archive_read_ unsigned char *ptr; size_t newsize; - newsize = uudecode->in_allocated << 1; + /* + * Calculate a new buffer size for in_buff. + * Increase its value until it has enough size we need. + */ + newsize = uudecode->in_allocated; + do { + if (newsize < IN_BUFF_SIZE*32) + newsize <<= 1; + else + newsize += IN_BUFF_SIZE; + } while (size > newsize); ptr = malloc(newsize); if (ptr == NULL || newsize < uudecode->in_allocated) { Modified: head/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_iso9660.c Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Sun Aug 7 08:42:36 2011 (r224691) @@ -709,16 +709,18 @@ isSVD(struct iso9660 *iso9660, const uns /* Location of Occurrence of Type L Path Table must be * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_le32dec(h+SVD_type_L_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if (location < SYSTEM_AREA_BLOCK+2 || location >= volume_block) return (0); - /* Location of Occurrence of Type M Path Table must be - * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + /* The Type M Path Table must be at a valid location (WinISO + * and probably other programs omit this, so we allow zero) + * + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_be32dec(h+SVD_type_M_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if ((location > 0 && location < SYSTEM_AREA_BLOCK+2) + || location >= volume_block) return (0); /* Read Root Directory Record in Volume Descriptor. */ @@ -781,16 +783,17 @@ isEVD(struct iso9660 *iso9660, const uns /* Location of Occurrence of Type L Path Table must be * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_le32dec(h+PVD_type_1_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if (location < SYSTEM_AREA_BLOCK+2 || location >= volume_block) return (0); /* Location of Occurrence of Type M Path Table must be * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_be32dec(h+PVD_type_m_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if ((location > 0 && location < SYSTEM_AREA_BLOCK+2) + || location >= volume_block) return (0); /* Reserved field must be 0. */ @@ -862,19 +865,24 @@ isPVD(struct iso9660 *iso9660, const uns * available location, * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_le32dec(h+PVD_type_1_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if (location < SYSTEM_AREA_BLOCK+2 || location >= volume_block) return (0); - /* Location of Occurrence of Type M Path Table must be - * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + /* The Type M Path Table must also be at a valid location + * (although ECMA 119 requires a Type M Path Table, WinISO and + * probably other programs omit it, so we permit a zero here) + * + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_be32dec(h+PVD_type_m_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if ((location > 0 && location < SYSTEM_AREA_BLOCK+2) + || location >= volume_block) return (0); /* Reserved field must be 0. */ + /* FreeBSD: makefs erroneously created images with 0x20 */ for (i = 0; i < PVD_reserved4_size; ++i) - if (h[PVD_reserved4_offset + i] != 0) + if (h[PVD_reserved4_offset + i] != 0 && + h[PVD_reserved4_offset + i] != 32) return (0); /* Reserved field must be 0. */ @@ -1677,6 +1685,7 @@ parse_file_info(struct archive_read *a, const unsigned char *rr_start, *rr_end; const unsigned char *p; size_t dr_len; + uint64_t fsize; int32_t location; int flags; @@ -1685,6 +1694,7 @@ parse_file_info(struct archive_read *a, dr_len = (size_t)isodirrec[DR_length_offset]; name_len = (size_t)isodirrec[DR_name_len_offset]; location = archive_le32dec(isodirrec + DR_extent_offset); + fsize = toi(isodirrec + DR_size_offset, DR_size_size); /* Sanity check that dr_len needs at least 34. */ if (dr_len < 34) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, @@ -1703,7 +1713,10 @@ parse_file_info(struct archive_read *a, * link or file size is zero. As far as I know latest mkisofs * do that. */ - if (location >= iso9660->volume_block) { + if (location > 0 && + (location + ((fsize + iso9660->logical_block_size -1) + / iso9660->logical_block_size)) > + (unsigned int)iso9660->volume_block) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Invalid location of extent of file"); return (NULL); @@ -1719,7 +1732,7 @@ parse_file_info(struct archive_read *a, memset(file, 0, sizeof(*file)); file->parent = parent; file->offset = iso9660->logical_block_size * (uint64_t)location; - file->size = toi(isodirrec + DR_size_offset, DR_size_size); + file->size = fsize; file->mtime = isodate7(isodirrec + DR_date_offset); file->ctime = file->atime = file->mtime; Modified: head/lib/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_mtree.c Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/archive_read_support_format_mtree.c Sun Aug 7 08:42:36 2011 (r224691) @@ -525,6 +525,7 @@ parse_file(struct archive_read *a, struc /* Initialize reasonable defaults. */ mtree->filetype = AE_IFREG; archive_entry_set_size(entry, 0); + archive_string_empty(&mtree->contents_name); /* Parse options from this line. */ parsed_kws = 0; @@ -613,9 +614,8 @@ parse_file(struct archive_read *a, struc } /* - * If there is a contents file on disk, use that size; - * otherwise leave it as-is (it might have been set from - * the mtree size= keyword). + * Check for a mismatch between the type in the specification and + * the type of the contents object on disk. */ if (st != NULL) { mismatched_type = 0; @@ -660,6 +660,11 @@ parse_file(struct archive_read *a, struc } } + /* + * If there is a contents file on disk, pick some of the metadata + * from that file. For most of these, we only set it from the contents + * if it wasn't already parsed from the specification. + */ if (st != NULL) { if ((parsed_kws & MTREE_HAS_DEVICE) == 0 && (archive_entry_filetype(entry) == AE_IFCHR || Modified: head/lib/libarchive/archive_write_set_compression_xz.c ============================================================================== --- head/lib/libarchive/archive_write_set_compression_xz.c Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/archive_write_set_compression_xz.c Sun Aug 7 08:42:36 2011 (r224691) @@ -421,8 +421,8 @@ drive_compressor(struct archive_write *a archive_set_error(&a->archive, ENOMEM, "lzma compression error: " "%ju MiB would have been needed", - (lzma_memusage(&(state->stream)) + 1024 * 1024 -1) - / (1024 * 1024)); + (uintmax_t)((lzma_memusage(&(state->stream)) + 1024 * 1024 -1) + / (1024 * 1024))); return (ARCHIVE_FATAL); default: /* Any other return value indicates an error. */ Modified: head/lib/libarchive/archive_write_set_format_zip.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_zip.c Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/archive_write_set_format_zip.c Sun Aug 7 08:42:36 2011 (r224691) @@ -502,6 +502,9 @@ archive_write_zip_finish(struct archive_ int entries; int ret; + if (a->compressor.write == NULL) + return (ARCHIVE_OK); + zip = a->format_data; l = zip->central_directory; Modified: head/lib/libarchive/test/Makefile ============================================================================== --- head/lib/libarchive/test/Makefile Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/test/Makefile Sun Aug 7 08:42:36 2011 (r224691) @@ -25,6 +25,7 @@ TESTS= \ test_fuzz.c \ test_link_resolver.c \ test_open_fd.c \ + test_open_failure.c \ test_open_file.c \ test_open_filename.c \ test_pax_filename_encoding.c \ Added: head/lib/libarchive/test/test_open_failure.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_open_failure.c Sun Aug 7 08:42:36 2011 (r224691) @@ -0,0 +1,198 @@ +/*- + * Copyright (c) 2003-2010 Tim Kientzle + * 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(S) ``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(S) 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 "test.h" +__FBSDID("$FreeBSD$"); + +#define MAGIC 123456789 +struct my_data { + int magic; + int read_return; + int read_called; + int write_return; + int write_called; + int open_return; + int open_called; + int close_return; + int close_called; +}; + +static ssize_t +my_read(struct archive *a, void *_private, const void **buff) +{ + struct my_data *private = (struct my_data *)_private; + assertEqualInt(MAGIC, private->magic); + ++private->read_called; + return (private->read_return); +} + +static ssize_t +my_write(struct archive *a, void *_private, const void *buff, size_t s) +{ + struct my_data *private = (struct my_data *)_private; + assertEqualInt(MAGIC, private->magic); + ++private->write_called; + return (private->write_return); +} + +static int +my_open(struct archive *a, void *_private) +{ + struct my_data *private = (struct my_data *)_private; + assertEqualInt(MAGIC, private->magic); + ++private->open_called; + return (private->open_return); +} + +static int +my_close(struct archive *a, void *_private) +{ + struct my_data *private = (struct my_data *)_private; + assertEqualInt(MAGIC, private->magic); + ++private->close_called; + return (private->close_return); +} + + +DEFINE_TEST(test_open_failure) +{ + struct archive *a; + struct my_data private; + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FATAL; + a = archive_read_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_FATAL, + archive_read_open(a, &private, my_open, my_read, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FAILED; + a = archive_read_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_FAILED, + archive_read_open(a, &private, my_open, my_read, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_WARN; + a = archive_read_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_WARN, + archive_read_open(a, &private, my_open, my_read, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_OK; + private.read_return = ARCHIVE_FATAL; + a = archive_read_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_OK, + archive_read_support_compression_compress(a)); + assertEqualInt(ARCHIVE_OK, archive_read_support_format_tar(a)); + assertEqualInt(ARCHIVE_FATAL, + archive_read_open(a, &private, my_open, my_read, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(1, private.read_called); + assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(1, private.read_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FATAL; + a = archive_write_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_FATAL, + archive_write_open(a, &private, my_open, my_write, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + // Broken in 2.8, fixed in 3.0 + //assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FATAL; + a = archive_write_new(); + assert(a != NULL); + archive_write_set_compression_compress(a); + archive_write_set_format_zip(a); + assertEqualInt(ARCHIVE_FATAL, + archive_write_open(a, &private, my_open, my_write, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + // Broken in 2.8, fixed in 3.0 + //assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FATAL; + a = archive_write_new(); + assert(a != NULL); + archive_write_set_compression_gzip(a); + assertEqualInt(ARCHIVE_FATAL, + archive_write_open(a, &private, my_open, my_write, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + // Broken in 2.8, fixed in 3.0 + //assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + assertEqualInt(1, private.close_called); + +} Modified: head/lib/libarchive/test/test_read_format_mtree.c ============================================================================== --- head/lib/libarchive/test/test_read_format_mtree.c Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/test/test_read_format_mtree.c Sun Aug 7 08:42:36 2011 (r224691) @@ -134,10 +134,53 @@ test_read_format_mtree2(void) assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); } +/* + * Reported to libarchive.googlecode.com as Issue 121. + */ +static void +test_read_format_mtree3(void) +{ + static char archive[] = + "#mtree\n" + "a type=file contents=file\n" + "b type=link link=a\n" + "c type=file contents=file\n"; + struct archive_entry *ae; + struct archive *a; + + assertMakeDir("mtree3", 0777); + assertChdir("mtree3"); + assertMakeFile("file", 0644, "file contents"); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(archive_entry_pathname(ae), "a"); + assertEqualInt(archive_entry_filetype(ae), AE_IFREG); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(archive_entry_pathname(ae), "b"); + assertEqualInt(archive_entry_filetype(ae), AE_IFLNK); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(archive_entry_pathname(ae), "c"); + assertEqualInt(archive_entry_filetype(ae), AE_IFREG); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + + assertChdir(".."); +} + DEFINE_TEST(test_read_format_mtree) { test_read_format_mtree1(); test_read_format_mtree2(); + test_read_format_mtree3(); } Modified: head/lib/libarchive/test/test_write_compress_lzma.c ============================================================================== --- head/lib/libarchive/test/test_write_compress_lzma.c Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/test/test_write_compress_lzma.c Sun Aug 7 08:42:36 2011 (r224691) @@ -185,10 +185,15 @@ DEFINE_TEST(test_write_compress_lzma) archive_write_close(a); assert(0 == archive_write_finish(a)); - /* Level 0 really does result in larger data. */ + /* It would be nice to assert that compression-level=0 produced + * consistently larger/smaller results than the default compression, + * but the results here vary a lot depending on the version of liblzma + * being used. */ + /* failure("Compression-level=0 wrote %d bytes; default wrote %d bytes", (int)used2, (int)used1); assert(used2 > used1); + */ assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_support_format_all(a)); Modified: head/lib/libarchive/test/test_write_compress_xz.c ============================================================================== --- head/lib/libarchive/test/test_write_compress_xz.c Sun Aug 7 08:35:15 2011 (r224690) +++ head/lib/libarchive/test/test_write_compress_xz.c Sun Aug 7 08:42:36 2011 (r224691) @@ -193,10 +193,14 @@ DEFINE_TEST(test_write_compress_xz) archive_write_close(a); assert(0 == archive_write_finish(a)); - /* Level 0 really does result in larger data. */ + /* I would like to assert that compression-level=0 results in + * larger data than the default compression, but that's not true + * for all versions of liblzma. */ + /* failure("Compression-level=0 wrote %d bytes; default wrote %d bytes", (int)used2, (int)used1); assert(used2 > used1); + */ assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_support_format_all(a)); From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 09:35:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B8051065672; Sun, 7 Aug 2011 09:35:07 +0000 (UTC) (envelope-from ttsestt@gmail.com) Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com [209.85.210.45]) by mx1.freebsd.org (Postfix) with ESMTP id 1E5FD8FC14; Sun, 7 Aug 2011 09:35:06 +0000 (UTC) Received: by pzk33 with SMTP id 33so1976024pzk.18 for ; Sun, 07 Aug 2011 02:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=eZp0RKcLJtBWznPjr8Tu5K6iUlpeaSJKFVQKNvd3BM8=; b=d2o2u90MgSDRPnYO9UkDs3yYy919lUZdguOII2JNz9WVcc5dDmBRn2NT24c1vOzJkC TsOpUYbl24/oEBVZn6BMbZiaYGarvDkdgumIrCbdyza/rHcb1K/AaX7T+znx3IdhhoTE 6NxyH377cdM1LH0DnGcPZ8ZbNmHZJhs3ntONU= Received: by 10.143.60.13 with SMTP id n13mr4352662wfk.373.1312708183279; Sun, 07 Aug 2011 02:09:43 -0700 (PDT) Received: from localhost (tor-exit-router45-readme.formlessnetworking.net [199.48.147.45]) by mx.google.com with ESMTPS id l7sm5049570pbh.74.2011.08.07.02.09.40 (version=SSLv3 cipher=OTHER); Sun, 07 Aug 2011 02:09:42 -0700 (PDT) From: Test Rat To: Martin Matuska References: <201108070842.p778gaFI088322@svn.freebsd.org> Date: Sun, 07 Aug 2011 13:09:33 +0400 In-Reply-To: <201108070842.p778gaFI088322@svn.freebsd.org> (Martin Matuska's message of "Sun, 7 Aug 2011 08:42:36 +0000 (UTC)") Message-ID: <86ei0xio4y.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224691 - in head/lib/libarchive: . test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 09:35:07 -0000 Martin Matuska writes: > Author: mm > Date: Sun Aug 7 08:42:36 2011 > New Revision: 224691 > URL: http://svn.freebsd.org/changeset/base/224691 > > Log: > Add compatibility for ISO images created with unfixed makefs that > violated ECMA-119 (ISO9660): allow reserved4 to be 0x20 in PVD. > This allows tar to read FreeBSD distribution ISO images created > with makefs prior to NetBSD bin/45217 bugfix (up to 9.0-BETA1). > > In addition, merge following important bugfixes from > libarchive's release/2.8 branch: [...] Can you also merge libarchive/trunk@2431? It should fix a bug uncovered by /head@207790 and reported in bin/149409 which is still more easily reproducable on /head than on /stable/8. From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 11:52:58 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAE9D106566B; Sun, 7 Aug 2011 11:52:58 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 42F288FC14; Sun, 7 Aug 2011 11:52:57 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id p77BquK9043998; Sun, 7 Aug 2011 13:52:57 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id p77Bquwt043997; Sun, 7 Aug 2011 13:52:56 +0200 (CEST) (envelope-from marius) Date: Sun, 7 Aug 2011 13:52:56 +0200 From: Marius Strobl To: Marcel Moolenaar Message-ID: <20110807115256.GG48988@alchemy.franken.de> References: <201108061748.p76HmUbM061259@svn.freebsd.org> <4E3DA560.6020100@yandex.ru> <4E3DBAF8.5040102@FreeBSD.org> <20110806232415.GE48988@alchemy.franken.de> <96C6C36B-E521-4438-9AEF-59D9A922D3B4@xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <96C6C36B-E521-4438-9AEF-59D9A922D3B4@xcllnt.net> User-Agent: Mutt/1.4.2.3i Cc: src-committers@FreeBSD.org, Ruslan Mahmatkhanov , Garrett Cooper , svn-src-all@FreeBSD.org, Andriy Gapon , svn-src-head@FreeBSD.org Subject: Re: svn commit: r224683 - head/lib/libthread_db X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 11:52:58 -0000 On Sat, Aug 06, 2011 at 07:35:49PM -0700, Marcel Moolenaar wrote: > > On Aug 6, 2011, at 4:24 PM, Marius Strobl wrote: > > > On Sun, Aug 07, 2011 at 01:06:48AM +0300, Andriy Gapon wrote: > >> on 07/08/2011 00:41 Garrett Cooper said the following: > >>> It's not just i386. It's other architectures like arm, mips, and pc98 > >>> according to the tinderbox reports (this list is potentially > >>> incomplete). > >> > >> Yeah, confusingly enough thr_pread_long() is declared to take uint64_t* as its > >> third argument, so this commit breaks all platforms where uint64_t is not > >> derived from (unsigned) long. > >> Just in case, thr_pread_int() takes uint32_t* as well. > >> > > > > Yes, the type of val is wrong. I'm currently running a fix through a > > universe build > > Ah, euh, ok, I forgot about this particular quirk: > > uint64_t is deliberate, because it's the width of long on 64-bit > architectures and thread_db is to be used as a support library > for a cross-tool (i.e. a 32-bit debugger for a 64-bit target). > > That's why thr_pread_long() takes a pointer to uint64_t and > thr_pread_int() takes a pointer to uint32_t... > > Sorry for missing this in the review. Okay, but then I don't know how to properly fix this given that thr_p{read,write}_long() still seem to do the wrong thing as they supply sizeof(long) rather than the size of a long on the target to thr_p{read,write}() as the size of the value in the target address space. If I change the callers of thr_pread_long() to supply a uint64_t this will compile but it still does the wrong thing in the cross-debugging case and I can't even think of how to fix that without additional information about the target, i.e. just using sizeof(uint64_t) obviously also is the wrong thing. Both thr_p{read,write}_ptr() are similarly confusing as they take a psaddr_t which is defined as uint64_t but use sizeof(void *) which again is specific to the host rather tan the target. Do you have a suggestion how to fix these? Marius From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 12:22:07 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48A7C1065673; Sun, 7 Aug 2011 12:22:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id C97708FC19; Sun, 7 Aug 2011 12:22:06 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id A356125D3888; Sun, 7 Aug 2011 12:22:05 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id B6F16BD3C89; Sun, 7 Aug 2011 12:22:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id x3WCx-OeIQKj; Sun, 7 Aug 2011 12:22:03 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 28E96BD3C3F; Sun, 7 Aug 2011 12:22:03 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <20110807115256.GG48988@alchemy.franken.de> Date: Sun, 7 Aug 2011 12:22:02 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <6949F340-1B6F-4001-9E99-7D6AF2FD5B48@FreeBSD.org> References: <201108061748.p76HmUbM061259@svn.freebsd.org> <4E3DA560.6020100@yandex.ru> <4E3DBAF8.5040102@FreeBSD.org> <20110806232415.GE48988@alchemy.franken.de> <96C6C36B-E521-4438-9AEF-59D9A922D3B4@xcllnt.net> <20110807115256.GG48988@alchemy.franken.de> To: Marius Strobl X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224683 - head/lib/libthread_db X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 12:22:07 -0000 On Aug 7, 2011, at 11:52 AM, Marius Strobl wrote: > On Sat, Aug 06, 2011 at 07:35:49PM -0700, Marcel Moolenaar wrote: >>=20 >> On Aug 6, 2011, at 4:24 PM, Marius Strobl wrote: >>=20 >>> On Sun, Aug 07, 2011 at 01:06:48AM +0300, Andriy Gapon wrote: >>>> on 07/08/2011 00:41 Garrett Cooper said the following: >>>>> It's not just i386. It's other architectures like arm, mips, and = pc98 >>>>> according to the tinderbox reports (this list is potentially >>>>> incomplete). >>>>=20 >>>> Yeah, confusingly enough thr_pread_long() is declared to take = uint64_t* as its >>>> third argument, so this commit breaks all platforms where uint64_t = is not >>>> derived from (unsigned) long. >>>> Just in case, thr_pread_int() takes uint32_t* as well. >>>>=20 >>>=20 >>> Yes, the type of val is wrong. I'm currently running a fix through a >>> universe build >>=20 >> Ah, euh, ok, I forgot about this particular quirk: >>=20 >> uint64_t is deliberate, because it's the width of long on 64-bit >> architectures and thread_db is to be used as a support library >> for a cross-tool (i.e. a 32-bit debugger for a 64-bit target). >>=20 >> That's why thr_pread_long() takes a pointer to uint64_t and >> thr_pread_int() takes a pointer to uint32_t... >>=20 >> Sorry for missing this in the review. >=20 > Okay, but then I don't know how to properly fix this given that > thr_p{read,write}_long() still seem to do the wrong thing as they > supply sizeof(long) rather than the size of a long on the target > to thr_p{read,write}() as the size of the value in the target > address space. If I change the callers of thr_pread_long() to > supply a uint64_t this will compile but it still does the wrong > thing in the cross-debugging case and I can't even think of how > to fix that without additional information about the target, i.e. > just using sizeof(uint64_t) obviously also is the wrong thing. > Both thr_p{read,write}_ptr() are similarly confusing as they take > a psaddr_t which is defined as uint64_t but use sizeof(void *) > which again is specific to the host rather tan the target. > Do you have a suggestion how to fix these? Given this, can you please back it out, find a proper solution together, = test it and re-add that then? Thanks --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family.= From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 12:33:59 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F138C106564A; Sun, 7 Aug 2011 12:33:58 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 69CDD8FC08; Sun, 7 Aug 2011 12:33:58 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id p77CXu0U044233; Sun, 7 Aug 2011 14:33:56 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id p77CXu4C044232; Sun, 7 Aug 2011 14:33:56 +0200 (CEST) (envelope-from marius) Date: Sun, 7 Aug 2011 14:33:56 +0200 From: Marius Strobl To: "Bjoern A. Zeeb" Message-ID: <20110807123356.GH48988@alchemy.franken.de> References: <201108061748.p76HmUbM061259@svn.freebsd.org> <4E3DA560.6020100@yandex.ru> <4E3DBAF8.5040102@FreeBSD.org> <20110806232415.GE48988@alchemy.franken.de> <96C6C36B-E521-4438-9AEF-59D9A922D3B4@xcllnt.net> <20110807115256.GG48988@alchemy.franken.de> <6949F340-1B6F-4001-9E99-7D6AF2FD5B48@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6949F340-1B6F-4001-9E99-7D6AF2FD5B48@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224683 - head/lib/libthread_db X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 12:33:59 -0000 On Sun, Aug 07, 2011 at 12:22:02PM +0000, Bjoern A. Zeeb wrote: > > On Aug 7, 2011, at 11:52 AM, Marius Strobl wrote: > > > On Sat, Aug 06, 2011 at 07:35:49PM -0700, Marcel Moolenaar wrote: > >> > >> On Aug 6, 2011, at 4:24 PM, Marius Strobl wrote: > >> > >>> On Sun, Aug 07, 2011 at 01:06:48AM +0300, Andriy Gapon wrote: > >>>> on 07/08/2011 00:41 Garrett Cooper said the following: > >>>>> It's not just i386. It's other architectures like arm, mips, and pc98 > >>>>> according to the tinderbox reports (this list is potentially > >>>>> incomplete). > >>>> > >>>> Yeah, confusingly enough thr_pread_long() is declared to take uint64_t* as its > >>>> third argument, so this commit breaks all platforms where uint64_t is not > >>>> derived from (unsigned) long. > >>>> Just in case, thr_pread_int() takes uint32_t* as well. > >>>> > >>> > >>> Yes, the type of val is wrong. I'm currently running a fix through a > >>> universe build > >> > >> Ah, euh, ok, I forgot about this particular quirk: > >> > >> uint64_t is deliberate, because it's the width of long on 64-bit > >> architectures and thread_db is to be used as a support library > >> for a cross-tool (i.e. a 32-bit debugger for a 64-bit target). > >> > >> That's why thr_pread_long() takes a pointer to uint64_t and > >> thr_pread_int() takes a pointer to uint32_t... > >> > >> Sorry for missing this in the review. > > > > Okay, but then I don't know how to properly fix this given that > > thr_p{read,write}_long() still seem to do the wrong thing as they > > supply sizeof(long) rather than the size of a long on the target > > to thr_p{read,write}() as the size of the value in the target > > address space. If I change the callers of thr_pread_long() to > > supply a uint64_t this will compile but it still does the wrong > > thing in the cross-debugging case and I can't even think of how > > to fix that without additional information about the target, i.e. > > just using sizeof(uint64_t) obviously also is the wrong thing. > > Both thr_p{read,write}_ptr() are similarly confusing as they take > > a psaddr_t which is defined as uint64_t but use sizeof(void *) > > which again is specific to the host rather tan the target. > > Do you have a suggestion how to fix these? > > Given this, can you please back it out, find a proper solution together, test it and re-add that then? > I'm currently running a universe build with lwp changed from long to int64_t. This should compile and work on all architectures for native-debugging and as such be a step in the right direction. In a second step thr_p{read,write}_{long,ptr}() then can be fixed to also do the right thing when cross-debugging. Marius From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 12:48:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8213F106564A; Sun, 7 Aug 2011 12:48:07 +0000 (UTC) (envelope-from ttsestt@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id B71C28FC08; Sun, 7 Aug 2011 12:48:05 +0000 (UTC) Received: by fxe4 with SMTP id 4so1524027fxe.13 for ; Sun, 07 Aug 2011 05:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=MA7D+QXWMBp1IJdLv+kMLzny5pxCVu/1YiMOGC8Ty/U=; b=RBNlkXljhSEQpXrQU0Ppq8sKvIIfTvqHGJ+daOVBJAfi+BF3tTlZM/DFOhxBflt4/D XhUuRNUP7wI1no1pNHftjDpsQoheEaLofV+tqLCNUnmJOk0oMPukxO3MMtT4ERaESD9x gBYabKRPPypBozVjga7KNWAjVtEn1tDiMA/uM= Received: by 10.223.76.201 with SMTP id d9mr5820936fak.119.1312721285245; Sun, 07 Aug 2011 05:48:05 -0700 (PDT) Received: from localhost (shell.digitalcipher.net [76.10.214.89]) by mx.google.com with ESMTPS id e10sm3396793fak.42.2011.08.07.05.48.03 (version=SSLv3 cipher=OTHER); Sun, 07 Aug 2011 05:48:04 -0700 (PDT) From: Test Rat To: Hans Petter Selasky References: <201105080822.p488MCEV036152@svn.freebsd.org> Date: Sun, 07 Aug 2011 16:48:00 +0400 In-Reply-To: <201105080822.p488MCEV036152@svn.freebsd.org> (Hans Petter Selasky's message of "Sun, 8 May 2011 08:22:12 +0000 (UTC)") Message-ID: <86ei0xcrr3.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221623 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 12:48:07 -0000 Hans Petter Selasky writes: > Author: hselasky > Date: Sun May 8 08:22:11 2011 > New Revision: 221623 > URL: http://svn.freebsd.org/changeset/base/221623 > > Log: > Cleanup usb_notify_addq_compat(). It should not > be needed any more. > > MFC after: 7 days This seems to break existing devd(8) configurations that use attach/detach for ugen(4) devices, e.g. ports/159313. Can you mention the burned bridge in relnotes for 9.0-RELEASE? From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 12:54:08 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AC16106564A; Sun, 7 Aug 2011 12:54:08 +0000 (UTC) (envelope-from ttsestt@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id A97AF8FC12; Sun, 7 Aug 2011 12:54:07 +0000 (UTC) Received: by fxe4 with SMTP id 4so1527793fxe.13 for ; Sun, 07 Aug 2011 05:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=wd9YX7b8RZyG6mss5BZxqsuIq3Dts7Lg8rEeaxg5p3I=; b=SZDgoNA3PV9vS5m2AgynGfBykIZglV9sFSW2F0aLKHtOjX1rqRRbHWtFNZnpkQsCZL pnt8OOq3FcxjzBI/wX8N+QDAG73+3xYBZuUNk6WiekXreGhP4VD6296Dpbyw7/ySDYfG iGJfkSfIpUPvThpjuhpVoC5yIReouW2xtEElo= Received: by 10.223.98.83 with SMTP id p19mr5968048fan.2.1312721646534; Sun, 07 Aug 2011 05:54:06 -0700 (PDT) Received: from localhost (shell.digitalcipher.net [76.10.214.89]) by mx.google.com with ESMTPS id x2sm3405035fal.20.2011.08.07.05.54.05 (version=SSLv3 cipher=OTHER); Sun, 07 Aug 2011 05:54:06 -0700 (PDT) From: Test Rat To: Hans Petter Selasky References: <201105080822.p488MCEV036152@svn.freebsd.org> <86ei0xcrr3.fsf@gmail.com> Date: Sun, 07 Aug 2011 16:54:02 +0400 In-Reply-To: <86ei0xcrr3.fsf@gmail.com> (Test Rat's message of "Sun, 07 Aug 2011 16:48:00 +0400") Message-ID: <861uwxcrh1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221623 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 12:54:08 -0000 Test Rat writes: > Hans Petter Selasky writes: > >> Author: hselasky >> Date: Sun May 8 08:22:11 2011 >> New Revision: 221623 >> URL: http://svn.freebsd.org/changeset/base/221623 >> >> Log: >> Cleanup usb_notify_addq_compat(). It should not >> be needed any more. >> >> MFC after: 7 days > > This seems to break existing devd(8) configurations that use > attach/detach for ugen(4) devices, e.g. ports/159313. Can you mention > the burned bridge in relnotes for 9.0-RELEASE? Oops, it should be in UPDATING, not relnotes. From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 15:52:13 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6AB51065670; Sun, 7 Aug 2011 15:52:13 +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 D639A8FC0C; Sun, 7 Aug 2011 15:52:13 +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 p77FqDTR006579; Sun, 7 Aug 2011 15:52:13 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p77FqDrE006577; Sun, 7 Aug 2011 15:52:13 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108071552.p77FqDrE006577@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Aug 2011 15:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224693 - head/lib/libthread_db X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 15:52:14 -0000 Author: marius Date: Sun Aug 7 15:52:13 2011 New Revision: 224693 URL: http://svn.freebsd.org/changeset/base/224693 Log: Change lwp to int64_t as thr_pread_long() always uses a 64-bit value in order to account for LP64 targets when cross-debugging on ILP32, allowing r224683 to compile on ILP32. Note that thr_p{read,write}_{long,ptr}() still incorrectly use the size of the respective types on the host rather than that on the target when accessing the target address space which still needs to be fixed. This means that r224683 alone may not be sufficient to solve the problem it's intended to fix when cross-debugging. Approved by: re (hrs) Modified: head/lib/libthread_db/libthr_db.c Modified: head/lib/libthread_db/libthr_db.c ============================================================================== --- head/lib/libthread_db/libthr_db.c Sun Aug 7 13:17:35 2011 (r224692) +++ head/lib/libthread_db/libthr_db.c Sun Aug 7 15:52:13 2011 (r224693) @@ -202,7 +202,7 @@ static td_err_e pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th) { psaddr_t pt; - long lwp; + int64_t lwp; int ret; TDBG_FUNC(); @@ -245,7 +245,7 @@ pt_ta_thr_iter(const td_thragent_t *ta, { td_thrhandle_t th; psaddr_t pt; - long lwp; + int64_t lwp; int ret; TDBG_FUNC(); @@ -368,7 +368,7 @@ pt_ta_event_getmsg(const td_thragent_t * psaddr_t pt; td_thr_events_e tmp; - long lwp; + int64_t lwp; int ret; TDBG_FUNC(); @@ -672,7 +672,7 @@ pt_thr_event_getmsg(const td_thrhandle_t static td_thrhandle_t handle; const td_thragent_t *ta = th->th_ta; psaddr_t pt, pt_temp; - long lwp; + int64_t lwp; int ret; td_thr_events_e tmp; From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 18:37:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E634B106564A; Sun, 7 Aug 2011 18:37:05 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D57BC8FC0A; Sun, 7 Aug 2011 18:37: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 p77Ib5t9011698; Sun, 7 Aug 2011 18:37:05 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p77Ib5QB011694; Sun, 7 Aug 2011 18:37:05 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201108071837.p77Ib5QB011694@svn.freebsd.org> From: Attilio Rao Date: Sun, 7 Aug 2011 18:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224698 - head/usr.sbin/pmcstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 18:37:06 -0000 Author: attilio Date: Sun Aug 7 18:37:05 2011 New Revision: 224698 URL: http://svn.freebsd.org/changeset/base/224698 Log: Convert pmcstat about using cpuset_t rather than relying on plain 32 bit ints. That fixes a first bug where pmcstat wasn't using the old cpumask_t interface and now also brings the full support for more than 32 cpus. While here, make the functions pmcstat_clone_event_descriptor() and pmcstat_get_cpumask() private to pmcstat. The problem of assuming cpu dense masks still persists and should be eventually fixed, as reported by avg. Tested by: pluknet Reviewed by: gnn Approved by: re (kib) Modified: head/usr.sbin/pmcstat/pmcstat.c head/usr.sbin/pmcstat/pmcstat.h head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.c Sun Aug 7 17:30:03 2011 (r224697) +++ head/usr.sbin/pmcstat/pmcstat.c Sun Aug 7 18:37:05 2011 (r224698) @@ -31,9 +31,9 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include +#include +#include #include #include #include @@ -114,6 +114,55 @@ kvm_t *pmcstat_kvm; struct kinfo_proc *pmcstat_plist; struct pmcstat_args args; +static void +pmcstat_clone_event_descriptor(struct pmcstat_ev *ev, const cpuset_t *cpumask) +{ + int cpu, mcpu; + struct pmcstat_ev *ev_clone; + + mcpu = sizeof(*cpumask) * NBBY; + for (cpu = 0; cpu < mcpu; cpu++) { + if (!CPU_ISSET(cpu, cpumask)) + continue; + + if ((ev_clone = malloc(sizeof(*ev_clone))) == NULL) + errx(EX_SOFTWARE, "ERROR: Out of memory"); + (void) memset(ev_clone, 0, sizeof(*ev_clone)); + + ev_clone->ev_count = ev->ev_count; + ev_clone->ev_cpu = cpu; + ev_clone->ev_cumulative = ev->ev_cumulative; + ev_clone->ev_flags = ev->ev_flags; + ev_clone->ev_mode = ev->ev_mode; + ev_clone->ev_name = strdup(ev->ev_name); + ev_clone->ev_pmcid = ev->ev_pmcid; + ev_clone->ev_saved = ev->ev_saved; + ev_clone->ev_spec = strdup(ev->ev_spec); + + STAILQ_INSERT_TAIL(&args.pa_events, ev_clone, ev_next); + } +} + +static void +pmcstat_get_cpumask(const char *cpuspec, cpuset_t *cpumask) +{ + int cpu; + const char *s; + char *end; + + CPU_ZERO(cpumask); + s = cpuspec; + + do { + cpu = strtol(s, &end, 0); + if (cpu < 0 || end == s) + errx(EX_USAGE, "ERROR: Illegal CPU specification " + "\"%s\".", cpuspec); + CPU_SET(cpu, cpumask); + s = end + strspn(end, ", \t"); + } while (*s); +} + void pmcstat_attach_pmcs(void) { @@ -173,36 +222,6 @@ pmcstat_cleanup(void) } void -pmcstat_clone_event_descriptor(struct pmcstat_ev *ev, - uint32_t cpumask) -{ - int cpu; - struct pmcstat_ev *ev_clone; - - while ((cpu = ffs(cpumask)) > 0) { - cpu--; - - if ((ev_clone = malloc(sizeof(*ev_clone))) == NULL) - errx(EX_SOFTWARE, "ERROR: Out of memory"); - (void) memset(ev_clone, 0, sizeof(*ev_clone)); - - ev_clone->ev_count = ev->ev_count; - ev_clone->ev_cpu = cpu; - ev_clone->ev_cumulative = ev->ev_cumulative; - ev_clone->ev_flags = ev->ev_flags; - ev_clone->ev_mode = ev->ev_mode; - ev_clone->ev_name = strdup(ev->ev_name); - ev_clone->ev_pmcid = ev->ev_pmcid; - ev_clone->ev_saved = ev->ev_saved; - ev_clone->ev_spec = strdup(ev->ev_spec); - - STAILQ_INSERT_TAIL(&args.pa_events, ev_clone, ev_next); - - cpumask &= ~(1 << cpu); - } -} - -void pmcstat_create_process(void) { char token; @@ -322,29 +341,6 @@ pmcstat_find_targets(const char *spec) /*NOTREACHED*/ } -uint32_t -pmcstat_get_cpumask(const char *cpuspec) -{ - uint32_t cpumask; - int cpu; - const char *s; - char *end; - - s = cpuspec; - cpumask = 0ULL; - - do { - cpu = strtol(s, &end, 0); - if (cpu < 0 || end == s) - errx(EX_USAGE, "ERROR: Illegal CPU specification " - "\"%s\".", cpuspec); - cpumask |= (1 << cpu); - s = end + strspn(end, ", \t"); - } while (*s); - - return (cpumask); -} - void pmcstat_kill_process(void) { @@ -551,8 +547,9 @@ pmcstat_topexit(void) int main(int argc, char **argv) { + cpuset_t cpumask; double interval; - int option, npmc, ncpu; + int hcpu, option, npmc, ncpu; int c, check_driver_stats, current_cpu, current_sampling_count; int do_callchain, do_descendants, do_logproccsw, do_logprocexit; int do_print; @@ -561,7 +558,6 @@ main(int argc, char **argv) int pipefd[2], rfd; int use_cumulative_counts; short cf, cb; - uint32_t cpumask; char *end, *tmp; const char *errmsg, *graphfilename; enum pmcstat_state runstate; @@ -608,6 +604,7 @@ main(int argc, char **argv) bzero(&ds_start, sizeof(ds_start)); bzero(&ds_end, sizeof(ds_end)); ev = NULL; + CPU_ZERO(&cpumask); /* * The initial CPU mask specifies all non-halted CPUS in the @@ -616,7 +613,8 @@ main(int argc, char **argv) dummy = sizeof(int); if (sysctlbyname("hw.ncpu", &ncpu, &dummy, NULL, 0) < 0) err(EX_OSERR, "ERROR: Cannot determine the number of CPUs"); - cpumask = (1 << ncpu) - 1; + for (hcpu = 0; hcpu < ncpu; hcpu++) + CPU_SET(hcpu, &cpumask); while ((option = getopt(argc, argv, "CD:EF:G:M:NO:P:R:S:TWc:df:gk:m:n:o:p:qr:s:t:vw:z:")) != -1) @@ -628,10 +626,11 @@ main(int argc, char **argv) case 'c': /* CPU */ - if (optarg[0] == '*' && optarg[1] == '\0') - cpumask = (1 << ncpu) - 1; - else - cpumask = pmcstat_get_cpumask(optarg); + if (optarg[0] == '*' && optarg[1] == '\0') { + for (hcpu = 0; hcpu < ncpu; hcpu++) + CPU_SET(hcpu, &cpumask); + } else + pmcstat_get_cpumask(optarg, &cpumask); args.pa_flags |= FLAGS_HAS_CPUMASK; args.pa_required |= FLAG_HAS_SYSTEM_PMCS; @@ -745,9 +744,13 @@ main(int argc, char **argv) else ev->ev_count = -1; - if (option == 'S' || option == 's') - ev->ev_cpu = ffs(cpumask) - 1; - else + if (option == 'S' || option == 's') { + hcpu = sizeof(cpumask) * NBBY; + for (hcpu--; hcpu >= 0; hcpu--) + if (CPU_ISSET(hcpu, &cpumask)) + break; + ev->ev_cpu = hcpu; + } else ev->ev_cpu = PMC_CPU_ANY; ev->ev_flags = 0; @@ -773,9 +776,13 @@ main(int argc, char **argv) STAILQ_INSERT_TAIL(&args.pa_events, ev, ev_next); - if (option == 's' || option == 'S') - pmcstat_clone_event_descriptor(ev, - cpumask & ~(1 << ev->ev_cpu)); + if (option == 's' || option == 'S') { + hcpu = CPU_ISSET(ev->ev_cpu, &cpumask); + CPU_CLR(ev->ev_cpu, &cpumask); + pmcstat_clone_event_descriptor(ev, &cpumask); + if (hcpu != 0) + CPU_SET(ev->ev_cpu, &cpumask); + } break; @@ -882,7 +889,7 @@ main(int argc, char **argv) */ if ((args.pa_flags & FLAG_READ_LOGFILE) && (args.pa_flags & FLAGS_HAS_CPUMASK) == 0) - cpumask = 0xffffffff; + CPU_FILL(&cpumask); args.pa_cpumask = cpumask; /* For selecting CPUs using -R. */ Modified: head/usr.sbin/pmcstat/pmcstat.h ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.h Sun Aug 7 17:30:03 2011 (r224697) +++ head/usr.sbin/pmcstat/pmcstat.h Sun Aug 7 18:37:05 2011 (r224698) @@ -33,6 +33,8 @@ #ifndef _PMCSTAT_H_ #define _PMCSTAT_H_ +#include + #define FLAG_HAS_TARGET 0x00000001 /* process target */ #define FLAG_HAS_WAIT_INTERVAL 0x00000002 /* -w secs */ #define FLAG_HAS_OUTPUT_LOGFILE 0x00000004 /* -O file or pipe */ @@ -140,7 +142,7 @@ struct pmcstat_args { FILE *pa_graphfile; /* where to send the callgraph */ int pa_graphdepth; /* print depth for callgraphs */ double pa_interval; /* printing interval in seconds */ - uint32_t pa_cpumask; /* filter for CPUs analysed */ + cpuset_t pa_cpumask; /* filter for CPUs analysed */ int pa_ctdumpinstr; /* dump instructions with calltree */ int pa_topmode; /* delta or accumulative */ int pa_toptty; /* output to tty or file */ @@ -159,8 +161,6 @@ extern struct pmcstat_args args; /* comm /* Function prototypes */ void pmcstat_attach_pmcs(void); void pmcstat_cleanup(void); -void pmcstat_clone_event_descriptor( - struct pmcstat_ev *_ev, uint32_t _cpumask); int pmcstat_close_log(void); void pmcstat_create_process(void); void pmcstat_find_targets(const char *_arg); @@ -178,7 +178,6 @@ int pmcstat_process_log(void); int pmcstat_keypress_log(void); void pmcstat_display_log(void); void pmcstat_pluginconfigure_log(char *_opt); -uint32_t pmcstat_get_cpumask(const char *_a); void pmcstat_topexit(void); #endif /* _PMCSTAT_H_ */ Modified: head/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat_log.c Sun Aug 7 17:30:03 2011 (r224697) +++ head/usr.sbin/pmcstat/pmcstat_log.c Sun Aug 7 18:37:05 2011 (r224698) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1435,7 +1436,7 @@ pmcstat_analyze_log(void) cpu = PMC_CALLCHAIN_CPUFLAGS_TO_CPU(cpuflags); /* Filter on the CPU id. */ - if ((args.pa_cpumask & (1 << cpu)) == 0) { + if (!CPU_ISSET(cpu, &(args.pa_cpumask))) { pmcstat_stats.ps_samples_skipped++; break; } From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 18:41:04 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E88FD1065672; Sun, 7 Aug 2011 18:41:04 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id B22A48FC0A; Sun, 7 Aug 2011 18:41:04 +0000 (UTC) Received: from dhcp-192-168-2-22.wifi.xcllnt.net (atm.xcllnt.net [70.36.220.6]) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id p77Ieu6H012958 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 7 Aug 2011 11:41:03 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii From: Marcel Moolenaar In-Reply-To: <20110807115256.GG48988@alchemy.franken.de> Date: Sun, 7 Aug 2011 11:40:58 -0700 Content-Transfer-Encoding: 7bit Message-Id: <937CC3F7-CA11-4C85-AB45-8EB4431B7FEE@xcllnt.net> References: <201108061748.p76HmUbM061259@svn.freebsd.org> <4E3DA560.6020100@yandex.ru> <4E3DBAF8.5040102@FreeBSD.org> <20110806232415.GE48988@alchemy.franken.de> <96C6C36B-E521-4438-9AEF-59D9A922D3B4@xcllnt.net> <20110807115256.GG48988@alchemy.franken.de> To: Marius Strobl X-Mailer: Apple Mail (2.1244.3) Cc: src-committers@FreeBSD.org, Ruslan Mahmatkhanov , Garrett Cooper , svn-src-all@FreeBSD.org, Andriy Gapon , svn-src-head@FreeBSD.org Subject: Re: svn commit: r224683 - head/lib/libthread_db X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 18:41:05 -0000 On Aug 7, 2011, at 4:52 AM, Marius Strobl wrote: > > Okay, but then I don't know how to properly fix this given that > thr_p{read,write}_long() still seem to do the wrong thing as they > supply sizeof(long) rather than the size of a long on the target > to thr_p{read,write}() as the size of the value in the target > address space. Don't worry about cross use. The implementation isn't quite there yet. That's why you see sizeof(long) in some places even though that's obviously only vid for the native case. FYI, -- Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 20:16:46 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE31A106566B; Sun, 7 Aug 2011 20:16:46 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD1448FC14; Sun, 7 Aug 2011 20:16:46 +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 p77KGkmq014642; Sun, 7 Aug 2011 20:16:46 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p77KGkMe014613; Sun, 7 Aug 2011 20:16:46 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108072016.p77KGkMe014613@svn.freebsd.org> From: Rick Macklem Date: Sun, 7 Aug 2011 20:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224699 - in head/sys: amd64/conf arm/conf i386/conf pc98/conf sparc64/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 20:16:46 -0000 Author: rmacklem Date: Sun Aug 7 20:16:46 2011 New Revision: 224699 URL: http://svn.freebsd.org/changeset/base/224699 Log: Change all the sample kernel configurations to use NFSCL, NFSD instead of NFSCLIENT, NFSSERVER since NFSCL and NFSD are now the defaults. The client change is needed for diskless configurations, so that the root mount works for fstype nfs. Reported by seanbru at yahoo-inc.com for i386/XEN. Approved by: re (hrs) Modified: head/sys/amd64/conf/GENERIC head/sys/arm/conf/AVILA head/sys/arm/conf/BWCT head/sys/arm/conf/CAMBRIA head/sys/arm/conf/CNS11XXNAS head/sys/arm/conf/CRB head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/DOCKSTAR head/sys/arm/conf/EP80219 head/sys/arm/conf/GUMSTIX head/sys/arm/conf/HL200 head/sys/arm/conf/HL201 head/sys/arm/conf/IQ31244 head/sys/arm/conf/KB920X head/sys/arm/conf/LN2410SBC head/sys/arm/conf/NSLU head/sys/arm/conf/QILA9G20 head/sys/arm/conf/SAM9G20EK head/sys/arm/conf/SHEEVAPLUG head/sys/arm/conf/SIMICS head/sys/arm/conf/TS7800 head/sys/i386/conf/GENERIC head/sys/i386/conf/XBOX head/sys/i386/conf/XEN head/sys/pc98/conf/GENERIC head/sys/sparc64/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/amd64/conf/GENERIC Sun Aug 7 20:16:46 2011 (r224699) @@ -37,7 +37,7 @@ options MD_ROOT # MD is a potential r options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager -options NFS_ROOT # NFS usable as /, requires NFSCLIENT +options NFS_ROOT # NFS usable as /, requires NFSCL options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/AVILA Sun Aug 7 20:16:46 2011 (r224699) @@ -50,8 +50,8 @@ options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support -options NFSCLIENT #Network Filesystem Client -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFSCL #New Network Filesystem Client +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 Modified: head/sys/arm/conf/BWCT ============================================================================== --- head/sys/arm/conf/BWCT Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/BWCT Sun Aug 7 20:16:46 2011 (r224699) @@ -46,10 +46,10 @@ options SOFTUPDATES #Enable FFS soft u #options MD_ROOT_SIZE=4096 # 3MB ram disk #options ROOTDEVNAME=\"ufs:md0\" #options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" -options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +#options NFSD #New Network Filesystem Server #options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP_NFSROOT options BOOTP Modified: head/sys/arm/conf/CAMBRIA ============================================================================== --- head/sys/arm/conf/CAMBRIA Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/CAMBRIA Sun Aug 7 20:16:46 2011 (r224699) @@ -51,8 +51,8 @@ options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support -options NFSCLIENT #Network Filesystem Client -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFSCL #New Network Filesystem Client +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 Modified: head/sys/arm/conf/CNS11XXNAS ============================================================================== --- head/sys/arm/conf/CNS11XXNAS Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/CNS11XXNAS Sun Aug 7 20:16:46 2011 (r224699) @@ -66,10 +66,10 @@ options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories -options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +#options NFSD #New Network Filesystem Server #options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options MSDOSFS #MSDOS Filesystem #options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) Modified: head/sys/arm/conf/CRB ============================================================================== --- head/sys/arm/conf/CRB Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/CRB Sun Aug 7 20:16:46 2011 (r224699) @@ -41,10 +41,10 @@ options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories -options NFSCLIENT #Network Filesystem Client -options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL #options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/DB-78XXX Sun Aug 7 20:16:46 2011 (r224699) @@ -17,9 +17,9 @@ options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem -options NFSCLIENT #Network Filesystem Client +options NFSCL #New Network Filesystem Client options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 Modified: head/sys/arm/conf/DB-88F5XXX ============================================================================== --- head/sys/arm/conf/DB-88F5XXX Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/DB-88F5XXX Sun Aug 7 20:16:46 2011 (r224699) @@ -17,9 +17,9 @@ options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem -options NFSCLIENT #Network Filesystem Client +options NFSCL #New Network Filesystem Client options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/DB-88F6XXX Sun Aug 7 20:16:46 2011 (r224699) @@ -17,9 +17,9 @@ options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem -options NFSCLIENT #Network Filesystem Client +options NFSCL #New Network Filesystem Client options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 Modified: head/sys/arm/conf/DOCKSTAR ============================================================================== --- head/sys/arm/conf/DOCKSTAR Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/DOCKSTAR Sun Aug 7 20:16:46 2011 (r224699) @@ -17,9 +17,9 @@ options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem -options NFSCLIENT #Network Filesystem Client +options NFSCL #New Network Filesystem Client options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 Modified: head/sys/arm/conf/EP80219 ============================================================================== --- head/sys/arm/conf/EP80219 Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/EP80219 Sun Aug 7 20:16:46 2011 (r224699) @@ -40,10 +40,10 @@ options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories -options NFSCLIENT #Network Filesystem Client -options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL #options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) Modified: head/sys/arm/conf/GUMSTIX ============================================================================== --- head/sys/arm/conf/GUMSTIX Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/GUMSTIX Sun Aug 7 20:16:46 2011 (r224699) @@ -45,9 +45,9 @@ options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories -options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFSCL #New Network Filesystem Client +#options NFSD #New Network Filesystem Server +options NFS_ROOT #NFS usable as /, requires NFSCL #options MSDOSFS #MSDOS Filesystem #options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) Modified: head/sys/arm/conf/HL200 ============================================================================== --- head/sys/arm/conf/HL200 Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/HL200 Sun Aug 7 20:16:46 2011 (r224699) @@ -39,10 +39,10 @@ options FFS #Berkeley Fast Filesystem #options MD_ROOT #MD is a potential root device #options MD_ROOT_SIZE=4096 # 3MB ram disk #options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" -options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +#options NFSD #New Network Filesystem Server #options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP_NFSROOT options BOOTP options BOOTP_NFSV3 Modified: head/sys/arm/conf/HL201 ============================================================================== --- head/sys/arm/conf/HL201 Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/HL201 Sun Aug 7 20:16:46 2011 (r224699) @@ -39,10 +39,10 @@ options FFS #Berkeley Fast Filesystem #options MD_ROOT #MD is a potential root device #options MD_ROOT_SIZE=4096 # 3MB ram disk #options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" -options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +#options NFSD #New Network Filesystem Server #options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP_NFSROOT options BOOTP options BOOTP_NFSV3 Modified: head/sys/arm/conf/IQ31244 ============================================================================== --- head/sys/arm/conf/IQ31244 Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/IQ31244 Sun Aug 7 20:16:46 2011 (r224699) @@ -41,10 +41,10 @@ options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories -options NFSCLIENT #Network Filesystem Client -options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL #options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) Modified: head/sys/arm/conf/KB920X ============================================================================== --- head/sys/arm/conf/KB920X Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/KB920X Sun Aug 7 20:16:46 2011 (r224699) @@ -40,10 +40,10 @@ options FFS #Berkeley Fast Filesystem #options MD_ROOT #MD is a potential root device #options MD_ROOT_SIZE=4096 # 4MB ram disk options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" -options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +#options NFSD #New Network Filesystem Server #options NFSLOCKD #Network Lock Manager -#options NFS_ROOT #NFS usable as /, requires NFSCLIENT +#options NFS_ROOT #NFS usable as /, requires NFSCL #options BOOTP_NFSROOT #options BOOTP Modified: head/sys/arm/conf/LN2410SBC ============================================================================== --- head/sys/arm/conf/LN2410SBC Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/LN2410SBC Sun Aug 7 20:16:46 2011 (r224699) @@ -45,7 +45,7 @@ options ROOTDEVNAME=\"ufs:da0s1\" #options BOOTP #options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info -#options NFSCLIENT #Network File System client +#options NFSCL #New Network Filesystem Client #options NFS_ROOT #NFS usable as root device options PSEUDOFS #Pseudo-filesystem framework Modified: head/sys/arm/conf/NSLU ============================================================================== --- head/sys/arm/conf/NSLU Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/NSLU Sun Aug 7 20:16:46 2011 (r224699) @@ -58,10 +58,10 @@ options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories -options NFSCLIENT #Network Filesystem Client -options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL #options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) Modified: head/sys/arm/conf/QILA9G20 ============================================================================== --- head/sys/arm/conf/QILA9G20 Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/QILA9G20 Sun Aug 7 20:16:46 2011 (r224699) @@ -39,10 +39,10 @@ options FFS #Berkeley Fast Filesystem #options UFS_DIRHASH #Improve performance on big directories #options MD_ROOT #MD is a potential root device #options MD_ROOT_SIZE=4096 # 3MB ram disk -options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +#options NFSD #New Network Filesystem Server #options NFSLOCKD #Network Lock Manager -#options NFS_ROOT #NFS usable as /, requires NFSCLIENT +#options NFS_ROOT #NFS usable as /, requires NFSCL #options BOOTP_NFSROOT #options BOOTP #options BOOTP_NFSV3 Modified: head/sys/arm/conf/SAM9G20EK ============================================================================== --- head/sys/arm/conf/SAM9G20EK Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/SAM9G20EK Sun Aug 7 20:16:46 2011 (r224699) @@ -38,10 +38,10 @@ options FFS #Berkeley Fast Filesystem #options UFS_DIRHASH #Improve performance on big directories #options MD_ROOT #MD is a potential root device #options MD_ROOT_SIZE=4096 # 3MB ram disk -options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +#options NFSD #New Network Filesystem Server #options NFSLOCKD #Network Lock Manager -#options NFS_ROOT #NFS usable as /, requires NFSCLIENT +#options NFS_ROOT #NFS usable as /, requires NFSCL #options BOOTP_NFSROOT #options BOOTP #options BOOTP_NFSV3 Modified: head/sys/arm/conf/SHEEVAPLUG ============================================================================== --- head/sys/arm/conf/SHEEVAPLUG Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/SHEEVAPLUG Sun Aug 7 20:16:46 2011 (r224699) @@ -17,9 +17,9 @@ options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem -options NFSCLIENT #Network Filesystem Client +options NFSCL #New Network Filesystem Client options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 Modified: head/sys/arm/conf/SIMICS ============================================================================== --- head/sys/arm/conf/SIMICS Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/SIMICS Sun Aug 7 20:16:46 2011 (r224699) @@ -39,10 +39,10 @@ options UFS_ACL #Support for access c options UFS_DIRHASH #Improve performance on big directories options MD_ROOT #MD is a potential root device options ROOTDEVNAME=\"ufs:md0\" -options NFSCLIENT #Network Filesystem Client -options NFSSERVER #Network Filesystem Server +options NFSCL #New Network Filesystem Client +options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL #options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) Modified: head/sys/arm/conf/TS7800 ============================================================================== --- head/sys/arm/conf/TS7800 Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/arm/conf/TS7800 Sun Aug 7 20:16:46 2011 (r224699) @@ -18,9 +18,9 @@ options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support -options NFSCLIENT #Network Filesystem Client +options NFSCL #New Network Filesystem Client options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/i386/conf/GENERIC Sun Aug 7 20:16:46 2011 (r224699) @@ -39,7 +39,7 @@ options MD_ROOT # MD is a potential r options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager -options NFS_ROOT # NFS usable as /, requires NFSCLIENT +options NFS_ROOT # NFS usable as /, requires NFSCL options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) Modified: head/sys/i386/conf/XBOX ============================================================================== --- head/sys/i386/conf/XBOX Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/i386/conf/XBOX Sun Aug 7 20:16:46 2011 (r224699) @@ -27,10 +27,10 @@ options SOFTUPDATES # Enable FFS soft #options UFS_ACL # Support for access control lists #options UFS_DIRHASH # Improve performance on big directories #options MD_ROOT # MD is a potential root device -options NFSCLIENT # Network Filesystem Client -#options NFSSERVER # Network Filesystem Server +options NFSCL # New Network Filesystem Client +#options NFSD # New Network Filesystem Server #options NFSLOCKD # Network Lock Manager -#options NFS_ROOT # NFS usable as /, requires NFSCLIENT +#options NFS_ROOT # NFS usable as /, requires NFSCL #options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem #options PROCFS # Process filesystem (requires PSEUDOFS) Modified: head/sys/i386/conf/XEN ============================================================================== --- head/sys/i386/conf/XEN Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/i386/conf/XEN Sun Aug 7 20:16:46 2011 (r224699) @@ -21,10 +21,10 @@ options SOFTUPDATES # Enable FFS soft options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options UFS_GJOURNAL # Enable gjournal-based UFS journaling -options NFSCLIENT # Network Filesystem Client -options NFSSERVER # Network Filesystem Server +options NFSCL # New Network Filesystem Client +options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager -options NFS_ROOT # NFS usable as /, requires NFSCLIENT +options NFS_ROOT # NFS usable as /, requires NFSCL options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/pc98/conf/GENERIC Sun Aug 7 20:16:46 2011 (r224699) @@ -39,7 +39,7 @@ options MD_ROOT # MD is a potential r options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager -options NFS_ROOT # NFS usable as /, requires NFSCLIENT +options NFS_ROOT # NFS usable as /, requires NFSCL options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Sun Aug 7 18:37:05 2011 (r224698) +++ head/sys/sparc64/conf/GENERIC Sun Aug 7 20:16:46 2011 (r224699) @@ -40,7 +40,7 @@ options MD_ROOT # MD is a potential r options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager -options NFS_ROOT # NFS usable as /, requires NFSCLIENT +options NFS_ROOT # NFS usable as /, requires NFSCL #options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 20:24:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1ECCB106566C; Sun, 7 Aug 2011 20:24:33 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04BB28FC08; Sun, 7 Aug 2011 20:24:33 +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 p77KOWtG014915; Sun, 7 Aug 2011 20:24:32 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p77KOWvk014911; Sun, 7 Aug 2011 20:24:32 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108072024.p77KOWvk014911@svn.freebsd.org> From: Martin Matuska Date: Sun, 7 Aug 2011 20:24:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224700 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 20:24:33 -0000 Author: mm Date: Sun Aug 7 20:24:32 2011 New Revision: 224700 URL: http://svn.freebsd.org/changeset/base/224700 Log: Merge revision 3554 from libarchive's release/2.8 branch: Partial merge of 2431 from trunk: Retry writes on EINTR. This should fix the SIGINT handler in bsdtar. Note: The rest of r2431 can't be merged, since it interacts with a big write-side rearchitecture. PR: bin/149409 Reviewed by: kientzle Approved by: re (kib) MFC after: 3 days Modified: head/lib/libarchive/archive_write_open_fd.c head/lib/libarchive/archive_write_open_file.c head/lib/libarchive/archive_write_open_filename.c Modified: head/lib/libarchive/archive_write_open_fd.c ============================================================================== --- head/lib/libarchive/archive_write_open_fd.c Sun Aug 7 20:16:46 2011 (r224699) +++ head/lib/libarchive/archive_write_open_fd.c Sun Aug 7 20:24:32 2011 (r224700) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include "archive.h" struct write_fd_data { - off_t offset; int fd; }; @@ -122,12 +121,16 @@ file_write(struct archive *a, void *clie ssize_t bytesWritten; mine = (struct write_fd_data *)client_data; - bytesWritten = write(mine->fd, buff, length); - if (bytesWritten <= 0) { - archive_set_error(a, errno, "Write error"); - return (-1); + for (;;) { + bytesWritten = write(mine->fd, buff, length); + if (bytesWritten <= 0) { + if (errno == EINTR) + continue; + archive_set_error(a, errno, "Write error"); + return (-1); + } + return (bytesWritten); } - return (bytesWritten); } static int Modified: head/lib/libarchive/archive_write_open_file.c ============================================================================== --- head/lib/libarchive/archive_write_open_file.c Sun Aug 7 20:16:46 2011 (r224699) +++ head/lib/libarchive/archive_write_open_file.c Sun Aug 7 20:24:32 2011 (r224700) @@ -86,12 +86,16 @@ file_write(struct archive *a, void *clie size_t bytesWritten; mine = client_data; - bytesWritten = fwrite(buff, 1, length, mine->f); - if (bytesWritten < length) { - archive_set_error(a, errno, "Write error"); - return (-1); + for (;;) { + bytesWritten = fwrite(buff, 1, length, mine->f); + if (bytesWritten <= 0) { + if (errno == EINTR) + continue; + archive_set_error(a, errno, "Write error"); + return (-1); + } + return (bytesWritten); } - return (bytesWritten); } static int Modified: head/lib/libarchive/archive_write_open_filename.c ============================================================================== --- head/lib/libarchive/archive_write_open_filename.c Sun Aug 7 20:16:46 2011 (r224699) +++ head/lib/libarchive/archive_write_open_filename.c Sun Aug 7 20:24:32 2011 (r224700) @@ -142,12 +142,16 @@ file_write(struct archive *a, void *clie ssize_t bytesWritten; mine = (struct write_file_data *)client_data; - bytesWritten = write(mine->fd, buff, length); - if (bytesWritten <= 0) { - archive_set_error(a, errno, "Write error"); - return (-1); + for (;;) { + bytesWritten = write(mine->fd, buff, length); + if (bytesWritten <= 0) { + if (errno == EINTR) + continue; + archive_set_error(a, errno, "Write error"); + return (-1); + } + return (bytesWritten); } - return (bytesWritten); } static int From owner-svn-src-head@FreeBSD.ORG Sun Aug 7 20:51:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D93810656D7; Sun, 7 Aug 2011 20:51:33 +0000 (UTC) (envelope-from simon@nitro.dk) Received: from emx.nitro.dk (emx.nitro.dk [IPv6:2a01:4f8:120:7384::102]) by mx1.freebsd.org (Postfix) with ESMTP id BAF128FC14; Sun, 7 Aug 2011 20:51:32 +0000 (UTC) Received: from mailscan.leto.nitro.dk (mailscan.leto.nitro.dk [127.0.1.4]) by emx.nitro.dk (Postfix) with ESMTP id 22233BD292; Sun, 7 Aug 2011 20:51:32 +0000 (UTC) Received: from emx.nitro.dk ([127.0.1.2]) by mailscan.leto.nitro.dk (mailscan.leto.nitro.dk [127.0.1.4]) (amavisd-new, port 10024) with LMTP id uaW8QOFkgYAT; Sun, 7 Aug 2011 20:51:30 +0000 (UTC) Received: from [192.168.4.21] (4304ds2-vlb.1.fullrate.dk [90.184.171.166]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by emx.nitro.dk (Postfix) with ESMTPSA id C6DEABD28A; Sun, 7 Aug 2011 20:51:29 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii From: "Simon L. B. Nielsen" In-Reply-To: <201108060916.p769Gr4A043462@svn.freebsd.org> Date: Sun, 7 Aug 2011 22:51:29 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> References: <201108060916.p769Gr4A043462@svn.freebsd.org> To: Doug Barton X-Mailer: Apple Mail (2.1244.3) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 20:51:33 -0000 On 6 Aug 2011, at 11:16, Doug Barton wrote: > Author: dougb > Date: Sat Aug 6 09:16:53 2011 > New Revision: 224674 > URL: http://svn.freebsd.org/changeset/base/224674 >=20 > Log: > Rather than edit the nsswitch.conf file based on ${MK_NIS} =3D=3D = "no" > comment out the NIS _compat options by default, but leave them in > the file for the convenience of users who want to enable it. >=20 > Update the comment in the file accordingly. This disables NIS by default which is rather surprising considering = there has been no prior (which I have been able to find) discussion of = this. At the _VERY_ least people need to be warned about this loudly. Unless = you can show this really helps non-NIS users this is IMO a bad idea. Yes, if you hand merge all /etc files this won't be a problem... but I = don't since life's to short for that, so this change just broke login on = one of the FreeBSD.org during an upgrade. --=20 Simon L. B. Nielsen From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 01:05:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73CED1065677; Mon, 8 Aug 2011 01:05:14 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id E55018FC1A; Mon, 8 Aug 2011 01:05:13 +0000 (UTC) Received: by vxh11 with SMTP id 11so1397461vxh.13 for ; Sun, 07 Aug 2011 18:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=f4UlpoLIlmY26yoi0Vmzds5+M98rYj514dQA/Ke6Jww=; b=oMWvr6hTwlWkfaNe6VlLYzaEeBItNm5mx0IVM4gd4PCuLveqyS56Hq8J1RPKEliVh5 0kLvxA5O3ibS0rIU8cufRuKZehJA12QLDITic84ZYHmXtHjigdBvKBL248+LP6WZ0gpW /BGzkzi+eaF/fnFodvKYukfMA8kiyj0hEsfDQ= MIME-Version: 1.0 Received: by 10.220.115.6 with SMTP id g6mr1545433vcq.89.1312765512449; Sun, 07 Aug 2011 18:05:12 -0700 (PDT) Received: by 10.220.172.18 with HTTP; Sun, 7 Aug 2011 18:05:12 -0700 (PDT) In-Reply-To: <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> Date: Sun, 7 Aug 2011 18:05:12 -0700 Message-ID: From: Garrett Cooper To: "Simon L. B. Nielsen" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 01:05:14 -0000 On Sun, Aug 7, 2011 at 1:51 PM, Simon L. B. Nielsen wrote: > > On 6 Aug 2011, at 11:16, Doug Barton wrote: > >> Author: dougb >> Date: Sat Aug =A06 09:16:53 2011 >> New Revision: 224674 >> URL: http://svn.freebsd.org/changeset/base/224674 >> >> Log: >> =A0Rather than edit the nsswitch.conf file based on ${MK_NIS} =3D=3D "no= " >> =A0comment out the NIS _compat options by default, but leave them in >> =A0the file for the convenience of users who want to enable it. >> >> =A0Update the comment in the file accordingly. > > This disables NIS by default which is rather surprising considering there= has been no prior (which I have been able to find) discussion of this. > > At the _VERY_ least people need to be warned about this loudly. Unless yo= u can show this really helps non-NIS users this is IMO a bad idea. > > Yes, if you hand merge all /etc files this won't be a problem... but I do= n't since life's to short for that, so this change just broke login on one = of the FreeBSD.org during an upgrade. non-POLA changes are bad, and this _definitely_ deserves an UPDATING entry and/or further discussion. Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 03:09:03 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EDB1106566B; Mon, 8 Aug 2011 03:09:03 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E5138FC08; Mon, 8 Aug 2011 03:09:03 +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 p78393AO028242; Mon, 8 Aug 2011 03:09:03 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78393G7028240; Mon, 8 Aug 2011 03:09:03 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201108080309.p78393G7028240@svn.freebsd.org> From: Hiroki Sato Date: Mon, 8 Aug 2011 03:09:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224701 - head/lib/libc/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 03:09:03 -0000 Author: hrs Date: Mon Aug 8 03:09:03 2011 New Revision: 224701 URL: http://svn.freebsd.org/changeset/base/224701 Log: Fix a pathname (s,netinet/if_ether.h,net/ethernet.h,). PR: docs/159341 Submitted by: Garrett Cooper Approved by: re (kib) Modified: head/lib/libc/net/ethers.3 Modified: head/lib/libc/net/ethers.3 ============================================================================== --- head/lib/libc/net/ethers.3 Sun Aug 7 20:24:32 2011 (r224700) +++ head/lib/libc/net/ethers.3 Mon Aug 8 03:09:03 2011 (r224701) @@ -68,7 +68,7 @@ These functions operate on ethernet addresses using an .Vt ether_addr structure, which is defined in the header file -.In netinet/if_ether.h : +.In net/ethernet.h : .Bd -literal -offset indent /* * The number of bytes in an ethernet (MAC) address. From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 04:12:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id A59A5106566B; Mon, 8 Aug 2011 04:12:05 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 1209614E526; Mon, 8 Aug 2011 04:12:04 +0000 (UTC) Message-ID: <4E3F6216.5080706@FreeBSD.org> Date: Sun, 07 Aug 2011 21:12:06 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Garrett Cooper References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> In-Reply-To: X-Enigmail-Version: 1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, "Simon L. B. Nielsen" , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 04:12:05 -0000 On 8/7/2011 6:05 PM, Garrett Cooper wrote: > On Sun, Aug 7, 2011 at 1:51 PM, Simon L. B. Nielsen wrote: >> >> On 6 Aug 2011, at 11:16, Doug Barton wrote: >> >>> Author: dougb >>> Date: Sat Aug 6 09:16:53 2011 >>> New Revision: 224674 >>> URL: http://svn.freebsd.org/changeset/base/224674 >>> >>> Log: >>> Rather than edit the nsswitch.conf file based on ${MK_NIS} == "no" >>> comment out the NIS _compat options by default, but leave them in >>> the file for the convenience of users who want to enable it. >>> >>> Update the comment in the file accordingly. >> >> This disables NIS by default which is rather surprising considering there has been no prior (which I have been able to find) discussion of this. >> >> At the _VERY_ least people need to be warned about this loudly. Unless you can show this really helps non-NIS users this is IMO a bad idea. >> >> Yes, if you hand merge all /etc files this won't be a problem... but I don't since life's to short for that, so this change just broke login on one of the FreeBSD.org during an upgrade. mergemaster has been in the tree for almost 12 years now. :) In any case, I can't think of a situation where blindly copying new files to /etc is a good idea (with all due respect). > non-POLA changes are bad, and this _definitely_ deserves an UPDATING > entry and/or further discussion. I'm happy to ask for permission to do the UPDATING entry, do you have suggestions for the text? Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 05:22:09 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A34B1065675; Mon, 8 Aug 2011 05:22:09 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59D7D8FC0C; Mon, 8 Aug 2011 05:22:09 +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 p785M9Bt032368; Mon, 8 Aug 2011 05:22:09 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p785M9R8032366; Mon, 8 Aug 2011 05:22:09 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201108080522.p785M9R8032366@svn.freebsd.org> From: Kevin Lo Date: Mon, 8 Aug 2011 05:22:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224702 - head/usr.bin/xlint/lint1 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 05:22:09 -0000 Author: kevlo Date: Mon Aug 8 05:22:09 2011 New Revision: 224702 URL: http://svn.freebsd.org/changeset/base/224702 Log: catstrg() does not set the resulting string length. PR: bin/152549 Submitted by: Henning Petersen Approved by: re (hrs) Modified: head/usr.bin/xlint/lint1/tree.c Modified: head/usr.bin/xlint/lint1/tree.c ============================================================================== --- head/usr.bin/xlint/lint1/tree.c Mon Aug 8 03:09:03 2011 (r224701) +++ head/usr.bin/xlint/lint1/tree.c Mon Aug 8 05:22:09 2011 (r224702) @@ -3786,6 +3786,7 @@ catstrg(strg_t *strg1, strg_t *strg2) (len2 + 1) * sizeof (wchar_t)); free(strg2->st_wcp); } + strg1->st_len = len; free(strg2); return (strg1); From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 05:25:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13BB8106566C; Mon, 8 Aug 2011 05:25:52 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 038338FC13; Mon, 8 Aug 2011 05:25: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 p785Ppl2032507; Mon, 8 Aug 2011 05:25:51 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p785Pplq032505; Mon, 8 Aug 2011 05:25:51 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201108080525.p785Pplq032505@svn.freebsd.org> From: Kevin Lo Date: Mon, 8 Aug 2011 05:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224703 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 05:25:52 -0000 Author: kevlo Date: Mon Aug 8 05:25:51 2011 New Revision: 224703 URL: http://svn.freebsd.org/changeset/base/224703 Log: In rtinit1(), before rtrequest1_fib() is called, info.rti_flags is initialized by flags (function argument) or-ed with ifa->ifa_flags. If both NIC has a loopback route to itself, so IFA_RTSELF is set on ifa(s). As IFA_RTSELF is defined by RTF_HOST, rtrequest1_fib() is called with RTF_HOST flag even if netmask is not NULL. Consequently, netmask is set to zero in rtrequest1_fib(), and request to add network route is changed under hands to request to add host route. Tested by: Andrew Boyer Submitted by: Svatopluk Kraus Approved by: re (hrs) Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Mon Aug 8 05:22:09 2011 (r224702) +++ head/sys/net/route.c Mon Aug 8 05:25:51 2011 (r224703) @@ -1478,7 +1478,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int */ bzero((caddr_t)&info, sizeof(info)); info.rti_ifa = ifa; - info.rti_flags = flags | ifa->ifa_flags; + info.rti_flags = flags | (ifa->ifa_flags & ~IFA_RTSELF); info.rti_info[RTAX_DST] = dst; /* * doing this for compatibility reasons From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 06:42:36 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA879106564A; Mon, 8 Aug 2011 06:42:36 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2A19D8FC0A; Mon, 8 Aug 2011 06:42:35 +0000 (UTC) Received: by vws18 with SMTP id 18so2377590vws.13 for ; Sun, 07 Aug 2011 23:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=TEGsJnLA2AKzf3/pBgLwlCUV6fWm9EvwiWiPQ4Oh+pE=; b=MwAelznUBCmtMlJc+tlkq0ccfNS1PnT0KGPjn1iBpvDxcHHJp1ImKZh7TwTBuWknX0 /byxF0XYdR5mUgYBPaSw0tXuWxkyyn2I01PPZ0uvg3+IoBlJIOxfX+KTMxelDvUA5oi6 qemHTx6u7j3bA9nJggEfsm2UqwI16fWduhU4s= MIME-Version: 1.0 Received: by 10.220.198.135 with SMTP id eo7mr1587151vcb.19.1312785753650; Sun, 07 Aug 2011 23:42:33 -0700 (PDT) Received: by 10.220.172.18 with HTTP; Sun, 7 Aug 2011 23:42:33 -0700 (PDT) In-Reply-To: <4E3F6216.5080706@FreeBSD.org> References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> <4E3F6216.5080706@FreeBSD.org> Date: Sun, 7 Aug 2011 23:42:33 -0700 Message-ID: From: Garrett Cooper To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, "Simon L. B. Nielsen" , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 06:42:36 -0000 On Sun, Aug 7, 2011 at 9:12 PM, Doug Barton wrote: > On 8/7/2011 6:05 PM, Garrett Cooper wrote: >> On Sun, Aug 7, 2011 at 1:51 PM, Simon L. B. Nielsen wro= te: >>> >>> On 6 Aug 2011, at 11:16, Doug Barton wrote: >>> >>>> Author: dougb >>>> Date: Sat Aug =A06 09:16:53 2011 >>>> New Revision: 224674 >>>> URL: http://svn.freebsd.org/changeset/base/224674 >>>> >>>> Log: >>>> =A0Rather than edit the nsswitch.conf file based on ${MK_NIS} =3D=3D "= no" >>>> =A0comment out the NIS _compat options by default, but leave them in >>>> =A0the file for the convenience of users who want to enable it. >>>> >>>> =A0Update the comment in the file accordingly. >>> >>> This disables NIS by default which is rather surprising considering the= re has been no prior (which I have been able to find) discussion of this. >>> >>> At the _VERY_ least people need to be warned about this loudly. Unless = you can show this really helps non-NIS users this is IMO a bad idea. >>> >>> Yes, if you hand merge all /etc files this won't be a problem... but I = don't since life's to short for that, so this change just broke login on on= e of the FreeBSD.org during an upgrade. > > mergemaster has been in the tree for almost 12 years now. :) =A0In any > case, I can't think of a situation where blindly copying new files to > /etc is a good idea (with all due respect). > >> non-POLA changes are bad, and this _definitely_ deserves an UPDATING >> entry and/or further discussion. > > I'm happy to ask for permission to do the UPDATING entry, do you have > suggestions for the text? Maybe this? -Garrett $ svn diff UPDATING Index: UPDATING =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- UPDATING (revision 224699) +++ UPDATING (working copy) @@ -22,6 +22,10 @@ machines to maximize performance. (To disable malloc debugging, ru= n ln -s aj /etc/malloc.conf.) +20110807: + Prior versions of nsswitch.conf explicitly enabled NIS lookup of gr= oup, + passwd, and services information; it is now disabled by default. + 20110628: The packet filter (pf) code has been updated to OpenBSD 4.5. You need to update userland tools to be in sync with kernel. From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 07:07:24 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E818106564A; Mon, 8 Aug 2011 07:07:23 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper-int.allbsd.org [IPv6:2001:2f0:104:e002::2]) by mx1.freebsd.org (Postfix) with ESMTP id AD6C38FC1A; Mon, 8 Aug 2011 07:07:22 +0000 (UTC) Received: from alph.allbsd.org (p3028-ipbf608funabasi.chiba.ocn.ne.jp [125.175.94.28]) (authenticated bits=128) by mail.allbsd.org (8.14.4/8.14.4) with ESMTP id p7876ufP098512; Mon, 8 Aug 2011 16:07:06 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id p7876rLn011174; Mon, 8 Aug 2011 16:06:53 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Mon, 08 Aug 2011 16:06:25 +0900 (JST) Message-Id: <20110808.160625.465966131558285623.hrs@allbsd.org> To: yanegomi@gmail.com From: Hiroki Sato In-Reply-To: References: <4E3F6216.5080706@FreeBSD.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.3 on Emacs 23.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Mon_Aug__8_16_06_25_2011_870)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (mail.allbsd.org [133.31.130.32]); Mon, 08 Aug 2011 16:07:11 +0900 (JST) X-Spam-Status: No, score=-102.0 required=13.0 tests=BAYES_00, CONTENT_TYPE_PRESENT, DIRECTOCNDYN, MIMEQENC, QENCPTR1, QENCPTR2, RCVD_IN_RP_RNBL, SPF_SOFTFAIL,USER_IN_WHITELIST autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on gatekeeper.allbsd.org Cc: svn-src-head@FreeBSD.org, simon@nitro.dk, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 07:07:24 -0000 ----Security_Multipart(Mon_Aug__8_16_06_25_2011_870)-- Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Garrett Cooper wrote in : ya> On Sun, Aug 7, 2011 at 9:12 PM, Doug Barton wro= te: ya> > On 8/7/2011 6:05 PM, Garrett Cooper wrote: ya> >> On Sun, Aug 7, 2011 at 1:51 PM, Simon L. B. Nielsen wrote: ya> >>> ya> >>> On 6 Aug 2011, at 11:16, Doug Barton wrote: ya> >>> ya> >>>> Author: dougb ya> >>>> Date: Sat Aug =A06 09:16:53 2011 ya> >>>> New Revision: 224674 ya> >>>> URL: http://svn.freebsd.org/changeset/base/224674 ya> >>>> ya> >>>> Log: ya> >>>> =A0Rather than edit the nsswitch.conf file based on ${MK_NIS} = =3D=3D "no" ya> >>>> =A0comment out the NIS _compat options by default, but leave t= hem in ya> >>>> =A0the file for the convenience of users who want to enable it= .= ya> >>>> ya> >>>> =A0Update the comment in the file accordingly. ya> >>> ya> >>> This disables NIS by default which is rather surprising conside= ring there has been no prior (which I have been able to find) discussio= n of this. ya> >>> ya> >>> At the _VERY_ least people need to be warned about this loudly.= Unless you can show this really helps non-NIS users this is IMO a bad = idea. ya> >>> ya> >>> Yes, if you hand merge all /etc files this won't be a problem..= . but I don't since life's to short for that, so this change just broke= login on one of the FreeBSD.org during an upgrade. ya> > ya> > mergemaster has been in the tree for almost 12 years now. :) =A0I= n any ya> > case, I can't think of a situation where blindly copying new file= s to ya> > /etc is a good idea (with all due respect). ya> > ya> >> non-POLA changes are bad, and this _definitely_ deserves an UPDA= TING ya> >> entry and/or further discussion. ya> > ya> > I'm happy to ask for permission to do the UPDATING entry, do you = have ya> > suggestions for the text? ya> = ya> Maybe this? ya> -Garrett Could you all please discuss this topic on -current? I was not fully aware of the impact and possible controversy when I approved this change (sorry), but simon@'s comment implies an objection against the change as well as a suggestion to discuss it for a consensus. I think it is better to discuss this on a (more) public mailing list before taking further actions. -- Hiroki ----Security_Multipart(Mon_Aug__8_16_06_25_2011_870)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk4/ivEACgkQTyzT2CeTzy13ZwCgw5dA38Uo6BVJYMMquYr5X/sU ef4An3npKtoj5pxNfv62znqvLjAqtAct =hWYW -----END PGP SIGNATURE----- ----Security_Multipart(Mon_Aug__8_16_06_25_2011_870)---- From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 09:42:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB330106566B; Mon, 8 Aug 2011 09:42:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 6A5158FC16; Mon, 8 Aug 2011 09:42:59 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 564A425D38A5; Mon, 8 Aug 2011 09:42:58 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 6DC8EBD3C2D; Mon, 8 Aug 2011 09:42:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id yCRZDHWdMTEN; Mon, 8 Aug 2011 09:42:55 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 91656BD3C03; Mon, 8 Aug 2011 09:42:55 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> Date: Mon, 8 Aug 2011 09:42:54 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <5A22B4EF-3B5A-497D-8F7C-8D9EED3F1BE3@FreeBSD.org> References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> To: "Simon L. B. Nielsen" X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Doug Barton Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 09:43:00 -0000 On Aug 7, 2011, at 8:51 PM, Simon L. B. Nielsen wrote: >=20 > On 6 Aug 2011, at 11:16, Doug Barton wrote: >=20 >> Author: dougb >> Date: Sat Aug 6 09:16:53 2011 >> New Revision: 224674 >> URL: http://svn.freebsd.org/changeset/base/224674 >>=20 >> Log: >> Rather than edit the nsswitch.conf file based on ${MK_NIS} =3D=3D = "no" >> comment out the NIS _compat options by default, but leave them in >> the file for the convenience of users who want to enable it. >>=20 >> Update the comment in the file accordingly. >=20 > This disables NIS by default which is rather surprising considering = there has been no prior (which I have been able to find) discussion of = this. >=20 > At the _VERY_ least people need to be warned about this loudly. Unless = you can show this really helps non-NIS users this is IMO a bad idea. Back in the days, when I introduced NO_NIS (which was the name back = then), I considered both this and something along Ed's initial change and I am sure some of the discussions can still be found in the archives (from around 2005/-2y). While I could never be bothered enough to do the Ed-kind of change, it was very clear back then that a change like this was a really bad idea as it would break setups left and right. We want to support the default compilation base system by default as well. If people prefer to go non- default (WITHOUT_NIS), it's fine to have them make other adjustments to alter defaults as well or live with the logging. The solution as is now is even more confusing as both Ed and Doug have missed to update the man page to clarify the new behaviour. I also do not like the longerish version of the file now and the new description is only talking about nis but ignoring all other sources, which we do not provide samples for, for the inconvenience of people wanting to use those. I think I'd like to see this reverted to avoid massive breakage of freebsd updated machines and, to be clear, I do not think an UPDATING entry is an adequate solution to mitigate this.=20 /bz --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family.= From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 13:13:23 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F02C106566B; Mon, 8 Aug 2011 13:13:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E15A8FC14; Mon, 8 Aug 2011 13:13:23 +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 p78DDNtS048626; Mon, 8 Aug 2011 13:13:23 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78DDNKV048624; Mon, 8 Aug 2011 13:13:23 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108081313.p78DDNKV048624@svn.freebsd.org> From: Rick Macklem Date: Mon, 8 Aug 2011 13:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224708 - head/share/man/man8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 13:13:23 -0000 Author: rmacklem Date: Mon Aug 8 13:13:22 2011 New Revision: 224708 URL: http://svn.freebsd.org/changeset/base/224708 Log: Change "options NFSCLIENT" to "options NFSCL" in diskless.8, since that is now the default NFS client. This is a content change. Reported by: shuvaev at physik.uni-wuerzburg.de Approved by: re (hrs) Modified: head/share/man/man8/diskless.8 Modified: head/share/man/man8/diskless.8 ============================================================================== --- head/share/man/man8/diskless.8 Mon Aug 8 12:19:20 2011 (r224707) +++ head/share/man/man8/diskless.8 Mon Aug 8 13:13:22 2011 (r224708) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 10, 2005 +.Dd August 7, 2011 .Dt DISKLESS 8 .Os .Sh NAME @@ -417,7 +417,7 @@ or .Tn TFTP , must include support for the NFS client: .Pp -.D1 Cd "options NFSCLIENT" +.D1 Cd "options NFSCL" .D1 Cd "options NFS_ROOT" .Pp If you are using a boot mechanism that does not pass network configuration From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 13:15:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B97B2106566C; Mon, 8 Aug 2011 13:15:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A79208FC15; Mon, 8 Aug 2011 13:15:39 +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 p78DFdPl048758; Mon, 8 Aug 2011 13:15:39 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78DFdCK048749; Mon, 8 Aug 2011 13:15:39 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108081315.p78DFdCK048749@svn.freebsd.org> From: Adrian Chadd Date: Mon, 8 Aug 2011 13:15:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224709 - in head/sys/dev/ath: . ath_hal ath_hal/ar5212 ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 13:15:39 -0000 Author: adrian Date: Mon Aug 8 13:15:39 2011 New Revision: 224709 URL: http://svn.freebsd.org/changeset/base/224709 Log: Add another HAL method - ah_isFastClockEnabled - which returns AH_TRUE if 5ghz fast clock is enabled in the current operating mode. It's slightly dirty, but it's part of the reference HAL and used by the (currently closed-source) radar event code to map radar pulses back to microsecond durations. Obtained from: Atheros Approved by: re (kib, blanket) Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Mon Aug 8 13:13:22 2011 (r224708) +++ head/sys/dev/ath/ath_hal/ah.h Mon Aug 8 13:15:39 2011 (r224709) @@ -958,6 +958,7 @@ struct ath_hal { HAL_BOOL __ahdecl(*ah_procRadarEvent)(struct ath_hal *ah, struct ath_rx_status *rxs, uint64_t fulltsf, const char *buf, HAL_DFS_EVENT *event); + HAL_BOOL __ahdecl(*ah_isFastClockEnabled)(struct ath_hal *ah); /* Key Cache Functions */ uint32_t __ahdecl(*ah_getKeyCacheSize)(struct ath_hal*); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Mon Aug 8 13:13:22 2011 (r224708) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Mon Aug 8 13:15:39 2011 (r224709) @@ -625,5 +625,6 @@ extern void ar5212GetDfsThresh(struct at extern HAL_BOOL ar5212ProcessRadarEvent(struct ath_hal *ah, struct ath_rx_status *rxs, uint64_t fulltsf, const char *buf, HAL_DFS_EVENT *event); +extern HAL_BOOL ar5212IsFastClockEnabled(struct ath_hal *ah); #endif /* _ATH_AR5212_H_ */ Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Mon Aug 8 13:13:22 2011 (r224708) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Mon Aug 8 13:15:39 2011 (r224709) @@ -133,6 +133,7 @@ static const struct ath_hal_private ar52 .ah_enableDfs = ar5212EnableDfs, .ah_getDfsThresh = ar5212GetDfsThresh, .ah_procRadarEvent = ar5212ProcessRadarEvent, + .ah_isFastClockEnabled = ar5212IsFastClockEnabled, /* Key Cache Functions */ .ah_getKeyCacheSize = ar5212GetKeyCacheSize, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Mon Aug 8 13:13:22 2011 (r224708) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Mon Aug 8 13:15:39 2011 (r224709) @@ -1222,3 +1222,13 @@ ar5212ProcessRadarEvent(struct ath_hal * return AH_TRUE; } + +/* + * Return whether 5GHz fast-clock (44MHz) is enabled. + * It's always disabled for AR5212 series NICs. + */ +HAL_BOOL +ar5212IsFastClockEnabled(struct ath_hal *ah) +{ + return AH_FALSE; +} Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Mon Aug 8 13:13:22 2011 (r224708) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Mon Aug 8 13:15:39 2011 (r224709) @@ -208,6 +208,7 @@ extern void ar5416GetDfsThresh(struct at extern HAL_BOOL ar5416ProcessRadarEvent(struct ath_hal *ah, struct ath_rx_status *rxs, uint64_t fulltsf, const char *buf, HAL_DFS_EVENT *event); +extern HAL_BOOL ar5416IsFastClockEnabled(struct ath_hal *ah); extern HAL_BOOL ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Mon Aug 8 13:13:22 2011 (r224708) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Mon Aug 8 13:15:39 2011 (r224709) @@ -150,6 +150,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_enableDfs = ar5416EnableDfs; ah->ah_getDfsThresh = ar5416GetDfsThresh; ah->ah_procRadarEvent = ar5416ProcessRadarEvent; + ah->ah_isFastClockEnabled = ar5416IsFastClockEnabled; /* Power Management Functions */ ah->ah_setPowerMode = ar5416SetPowerMode; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Mon Aug 8 13:13:22 2011 (r224708) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Mon Aug 8 13:15:39 2011 (r224709) @@ -731,3 +731,15 @@ ar5416ProcessRadarEvent(struct ath_hal * */ return AH_FALSE; } + +/* + * Return whether fast-clock is currently enabled for this + * channel. + */ +HAL_BOOL +ar5416IsFastClockEnabled(struct ath_hal *ah) +{ + struct ath_hal_private *ahp = AH_PRIVATE(ah); + + return IS_5GHZ_FAST_CLOCK_EN(ah, ahp->ah_curchan); +} Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Aug 8 13:13:22 2011 (r224708) +++ head/sys/dev/ath/if_athvar.h Mon Aug 8 13:15:39 2011 (r224709) @@ -712,6 +712,8 @@ void ath_intr(void *); ((*(_ah)->ah_getDfsThresh)((_ah), (_param))) #define ath_hal_procradarevent(_ah, _rxs, _fulltsf, _buf, _event) \ ((*(_ah)->ah_procRadarEvent)((_ah), (_rxs), (_fulltsf), (_buf), (_event))) +#define ath_hal_isfastclockenabled(_ah) \ + ((*(_ah)->ah_isFastClockEnabled((_ah)) #define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \ ((*(_ah)->ah_gpioCfgOutput)((_ah), (_gpio), (_type))) From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 14:02:09 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B3791065672; Mon, 8 Aug 2011 14:02:09 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0046C8FC13; Mon, 8 Aug 2011 14:02:09 +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 p78E28NZ050290; Mon, 8 Aug 2011 14:02:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78E287S050288; Mon, 8 Aug 2011 14:02:08 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108081402.p78E287S050288@svn.freebsd.org> From: Martin Matuska Date: Mon, 8 Aug 2011 14:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224712 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 14:02:09 -0000 Author: mm Date: Mon Aug 8 14:02:08 2011 New Revision: 224712 URL: http://svn.freebsd.org/changeset/base/224712 Log: Revert r224655 and r224614 because vn_fullpath* does not always work on nullfs mounts. Change shall be reconsidered after 9.0 is released. Requested by: re (kib) Approved by: re (kib) Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Aug 8 13:58:39 2011 (r224711) +++ head/sys/kern/vfs_mount.c Mon Aug 8 14:02:08 2011 (r224712) @@ -362,60 +362,6 @@ vfs_mergeopts(struct vfsoptlist *toopts, } /* - * Verify vnode's global path - */ -static int -vfs_verify_global_path(struct thread *td, struct vnode *vp, char *fspath) -{ - struct nameidata nd; - struct vnode *vp1; - char *rpath, *fbuf; - int error; - - ASSERT_VOP_ELOCKED(vp, __func__); - - /* Construct global filesystem path from vp. */ - VOP_UNLOCK(vp, 0); - error = vn_fullpath_global(td, vp, &rpath, &fbuf); - if (error != 0) { - vrele(vp); - return (error); - } - if (strlen(rpath) >= MNAMELEN) { - vrele(vp); - error = ENAMETOOLONG; - goto out; - } - - /* - * Re-lookup the vnode by path. As a side effect, the vnode is - * relocked. If vnode was renamed, return ENOENT. - */ - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, - UIO_SYSSPACE, fspath, td); - error = namei(&nd); - if (error != 0) { - vrele(vp); - goto out; - } - if (NDHASGIANT(&nd)) - mtx_unlock(&Giant); - NDFREE(&nd, NDF_ONLY_PNBUF); - vp1 = nd.ni_vp; - vrele(vp); - if (vp1 != vp) { - vput(vp1); - error = ENOENT; - goto out; - } - - strlcpy(fspath,rpath,MNAMELEN); -out: - free(fbuf, M_TEMP); - return (error); -} - -/* * Mount a filesystem. */ int @@ -1124,14 +1070,16 @@ vfs_domount( NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; if ((fsflags & MNT_UPDATE) == 0) { - error = vfs_verify_global_path(td, vp, fspath); - if (error == 0) - error = vfs_domount_first(td, vfsp, fspath, vp, - fsflags, optlist); - } else + error = vfs_domount_first(td, vfsp, fspath, vp, fsflags, + optlist); + } else { error = vfs_domount_update(td, vp, fsflags, optlist); + } mtx_unlock(&Giant); + ASSERT_VI_UNLOCKED(vp, __func__); + ASSERT_VOP_UNLOCKED(vp, __func__); + return (error); } @@ -1157,7 +1105,6 @@ unmount(td, uap) } */ *uap; { struct mount *mp; - struct nameidata nd; char *pathbuf; int error, id0, id1; @@ -1193,25 +1140,6 @@ unmount(td, uap) mtx_unlock(&mountlist_mtx); } else { AUDIT_ARG_UPATH1(td, pathbuf); - /* - * If we are jailed and this is not a root jail try to find - * global path for path argument. - */ - if (jailed(td->td_ucred) && - td->td_ucred->cr_prison->pr_root != rootvnode) { - NDINIT(&nd, LOOKUP, - FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, - UIO_SYSSPACE, pathbuf, td); - if (namei(&nd) == 0) { - if (NDHASGIANT(&nd)) - mtx_unlock(&Giant); - NDFREE(&nd, NDF_ONLY_PNBUF); - error = vfs_verify_global_path(td, nd.ni_vp, - pathbuf); - if (error == 0) - vput(nd.ni_vp); - } - } mtx_lock(&mountlist_mtx); TAILQ_FOREACH_REVERSE(mp, &mountlist, mntlist, mnt_list) { if (strcmp(mp->mnt_stat.f_mntonname, pathbuf) == 0) From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 14:14:47 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F375106566C; Mon, 8 Aug 2011 14:14:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id BE57E8FC15; Mon, 8 Aug 2011 14:14:46 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p78EEYsw093756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 8 Aug 2011 17:14:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p78EEYP6004576; Mon, 8 Aug 2011 17:14:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p78EEYw0004575; Mon, 8 Aug 2011 17:14:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 8 Aug 2011 17:14:34 +0300 From: Kostik Belousov To: Martin Matuska Message-ID: <20110808141434.GX17489@deviant.kiev.zoral.com.ua> References: <201108081402.p78E287S050288@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oiHIG38sQGusYEpV" Content-Disposition: inline In-Reply-To: <201108081402.p78E287S050288@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224712 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 14:14:47 -0000 --oiHIG38sQGusYEpV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 08, 2011 at 02:02:08PM +0000, Martin Matuska wrote: > Author: mm > Date: Mon Aug 8 14:02:08 2011 > New Revision: 224712 > URL: http://svn.freebsd.org/changeset/base/224712 >=20 > Log: > Revert r224655 and r224614 because vn_fullpath* does not always work > on nullfs mounts. > =20 > Change shall be reconsidered after 9.0 is released. > =20 > Requested by: re (kib) > Approved by: re (kib) Thank you. --oiHIG38sQGusYEpV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk4/70kACgkQC3+MBN1Mb4iR4gCgjZCsCl8GNtGshI23oJkh/p7E Qw4AoN1qhJT+WO+POY7LLF8J77gCqISq =JrAc -----END PGP SIGNATURE----- --oiHIG38sQGusYEpV-- From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 15:41:04 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11CB41065672; Mon, 8 Aug 2011 15:41:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01AB18FC1A; Mon, 8 Aug 2011 15:41: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 p78Ff32T053277; Mon, 8 Aug 2011 15:41:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78Ff3Fr053275; Mon, 8 Aug 2011 15:41:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108081541.p78Ff3Fr053275@svn.freebsd.org> From: Adrian Chadd Date: Mon, 8 Aug 2011 15:41:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224714 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 15:41:04 -0000 Author: adrian Date: Mon Aug 8 15:41:03 2011 New Revision: 224714 URL: http://svn.freebsd.org/changeset/base/224714 Log: Fix method naming to match the reference HAL definition. Obtained from: Atheros Approved by: re (kib, blanket) Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Aug 8 14:40:23 2011 (r224713) +++ head/sys/dev/ath/if_athvar.h Mon Aug 8 15:41:03 2011 (r224714) @@ -712,7 +712,7 @@ void ath_intr(void *); ((*(_ah)->ah_getDfsThresh)((_ah), (_param))) #define ath_hal_procradarevent(_ah, _rxs, _fulltsf, _buf, _event) \ ((*(_ah)->ah_procRadarEvent)((_ah), (_rxs), (_fulltsf), (_buf), (_event))) -#define ath_hal_isfastclockenabled(_ah) \ +#define ath_hal_is_fast_clock_enabled(_ah) \ ((*(_ah)->ah_isFastClockEnabled((_ah)) #define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \ From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 15:42:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66D941065675; Mon, 8 Aug 2011 15:42:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56CE78FC1C; Mon, 8 Aug 2011 15:42: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 p78Fgb0M053360; Mon, 8 Aug 2011 15:42:37 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78FgbfD053358; Mon, 8 Aug 2011 15:42:37 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108081542.p78FgbfD053358@svn.freebsd.org> From: Adrian Chadd Date: Mon, 8 Aug 2011 15:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224715 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 15:42:37 -0000 Author: adrian Date: Mon Aug 8 15:42:37 2011 New Revision: 224715 URL: http://svn.freebsd.org/changeset/base/224715 Log: .. and add a missing bracket. Approved by: re (kib, blanket) Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Aug 8 15:41:03 2011 (r224714) +++ head/sys/dev/ath/if_athvar.h Mon Aug 8 15:42:37 2011 (r224715) @@ -713,7 +713,7 @@ void ath_intr(void *); #define ath_hal_procradarevent(_ah, _rxs, _fulltsf, _buf, _event) \ ((*(_ah)->ah_procRadarEvent)((_ah), (_rxs), (_fulltsf), (_buf), (_event))) #define ath_hal_is_fast_clock_enabled(_ah) \ - ((*(_ah)->ah_isFastClockEnabled((_ah)) + ((*(_ah)->ah_isFastClockEnabled)((_ah)) #define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \ ((*(_ah)->ah_gpioCfgOutput)((_ah), (_gpio), (_type))) From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 16:22:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4B4B1065676; Mon, 8 Aug 2011 16:22:42 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3BE08FC12; Mon, 8 Aug 2011 16:22:42 +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 p78GMgT1054701; Mon, 8 Aug 2011 16:22:42 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78GMgk5054693; Mon, 8 Aug 2011 16:22:42 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108081622.p78GMgk5054693@svn.freebsd.org> From: Adrian Chadd Date: Mon, 8 Aug 2011 16:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224716 - in head/sys/dev/ath: . ath_dfs/null ath_hal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 16:22:42 -0000 Author: adrian Date: Mon Aug 8 16:22:42 2011 New Revision: 224716 URL: http://svn.freebsd.org/changeset/base/224716 Log: Introduce some more DFS related hooks, inspired both by local work and the Atheros reference code. The radar detection code needs to know what the current DFS domain is. Since net80211 doesn't currently know this information, it's extracted from the HAL regulatory domain information. The specifics: * add a new ath_dfs API hook, ath_dfs_init_radar_filters(), which updates the radar filters whenever the regulatory domain changes. * add HAL_DFS_DOMAIN which describes the currently configured DFS domain . * add a new HAL internal variable which tracks the currently configured HAL DFS domain. * add a new HAL capability, HAL_CAP_DFS_DMN, which returns the currently configured HAL DFS domain setting. * update the HAL DFS domain setting whenever the channel setting is updated. Since this isn't currently used by any radar code, these should all be no-ops for existing users. Obtained from: Atheros Submitted by: KBC Networks, sibridge Approved by: re (kib, blanket) Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ah_regdomain.c head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athdfs.h Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c ============================================================================== --- head/sys/dev/ath/ath_dfs/null/dfs_null.c Mon Aug 8 15:42:37 2011 (r224715) +++ head/sys/dev/ath/ath_dfs/null/dfs_null.c Mon Aug 8 16:22:42 2011 (r224716) @@ -226,3 +226,13 @@ ath_dfs_get_thresholds(struct ath_softc ath_hal_getdfsthresh(sc->sc_ah, param); return 1; } + +/* + * Update the current radar patterns based on the + * current operating mode/regulatory domain. + */ +int +ath_dfs_init_radar_filters(struct ath_softc *sc) +{ + return 1; +} Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Mon Aug 8 15:42:37 2011 (r224715) +++ head/sys/dev/ath/ath_hal/ah.c Mon Aug 8 16:22:42 2011 (r224716) @@ -522,6 +522,9 @@ ath_hal_getcapability(struct ath_hal *ah case HAL_CAP_REG_DMN: /* regulatory domain */ *result = AH_PRIVATE(ah)->ah_currentRD; return HAL_OK; + case HAL_CAP_DFS_DMN: /* DFS Domain */ + *result = AH_PRIVATE(ah)->ah_dfsDomain; + return HAL_OK; case HAL_CAP_CIPHER: /* cipher handled in hardware */ case HAL_CAP_TKIP_MIC: /* handle TKIP MIC in hardware */ return HAL_ENOTSUPP; Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Mon Aug 8 15:42:37 2011 (r224715) +++ head/sys/dev/ath/ath_hal/ah.h Mon Aug 8 16:22:42 2011 (r224716) @@ -735,6 +735,15 @@ typedef struct { #define HAL_PHYERR_PARAM_NOVAL 65535 #define HAL_PHYERR_PARAM_ENABLE 0x8000 /* Enable/Disable if applicable */ +/* + * DFS operating mode flags. + */ +typedef enum { + HAL_DFS_UNINIT_DOMAIN = 0, /* Uninitialized dfs domain */ + HAL_DFS_FCC_DOMAIN = 1, /* FCC3 dfs domain */ + HAL_DFS_ETSI_DOMAIN = 2, /* ETSI dfs domain */ + HAL_DFS_MKK4_DOMAIN = 3, /* Japan dfs domain */ +} HAL_DFS_DOMAIN; /* * Flag for setting QUIET period Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Mon Aug 8 15:42:37 2011 (r224715) +++ head/sys/dev/ath/ath_hal/ah_internal.h Mon Aug 8 16:22:42 2011 (r224716) @@ -303,6 +303,7 @@ struct ath_hal_private { */ HAL_REG_DOMAIN ah_currentRD; /* EEPROM regulatory domain */ HAL_REG_DOMAIN ah_currentRDext; /* EEPROM extended regdomain flags */ + HAL_DFS_DOMAIN ah_dfsDomain; /* current DFS domain */ HAL_CHANNEL_INTERNAL ah_channels[AH_MAXCHAN]; /* private chan state */ u_int ah_nchan; /* valid items in ah_channels */ const struct regDomain *ah_rd2GHz; /* reg state for 2G band */ Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_regdomain.c Mon Aug 8 15:42:37 2011 (r224715) +++ head/sys/dev/ath/ath_hal/ah_regdomain.c Mon Aug 8 16:22:42 2011 (r224716) @@ -687,8 +687,9 @@ ath_hal_init_channels(struct ath_hal *ah HAL_BOOL enableExtendedChannels) { COUNTRY_CODE_TO_ENUM_RD *country; - REG_DOMAIN *rd5GHz, *rd2GHz; + REG_DOMAIN *rd5GHz = AH_NULL, *rd2GHz; HAL_STATUS status; + HAL_DFS_DOMAIN dfsDomain = HAL_DFS_UNINIT_DOMAIN; status = getchannels(ah, chans, maxchans, nchans, modeSelect, cc, regDmn, enableExtendedChannels, &country, &rd2GHz, &rd5GHz); @@ -702,6 +703,18 @@ ath_hal_init_channels(struct ath_hal *ah __func__, ah->ah_countryCode); } else status = HAL_EINVAL; + + /* Update the DFS setting for the current regulatory domain */ + if (status == HAL_OK && rd5GHz != AH_NULL) { + if (rd5GHz->dfsMask & DFS_FCC3) + dfsDomain = HAL_DFS_FCC_DOMAIN; + if (rd5GHz->dfsMask & DFS_ETSI) + dfsDomain = HAL_DFS_ETSI_DOMAIN; + if (rd5GHz->dfsMask & DFS_MKK4) + dfsDomain = HAL_DFS_MKK4_DOMAIN; + } + AH_PRIVATE(ah)->ah_dfsDomain = dfsDomain; + return status; } Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Aug 8 15:42:37 2011 (r224715) +++ head/sys/dev/ath/if_ath.c Mon Aug 8 16:22:42 2011 (r224716) @@ -5031,6 +5031,13 @@ ath_setregdomain(struct ieee80211com *ic __func__, status); return EINVAL; /* XXX */ } + + /* + * Setting country code might change the DFS domain + * so initialize the DFS Radar filters + */ + ath_dfs_init_radar_filters(sc); + return 0; } Modified: head/sys/dev/ath/if_athdfs.h ============================================================================== --- head/sys/dev/ath/if_athdfs.h Mon Aug 8 15:42:37 2011 (r224715) +++ head/sys/dev/ath/if_athdfs.h Mon Aug 8 16:22:42 2011 (r224716) @@ -42,6 +42,8 @@ extern int ath_dfs_process_radar_event(s extern int ath_dfs_tasklet_needed(struct ath_softc *sc, struct ieee80211_channel *chan); extern int ath_ioctl_phyerr(struct ath_softc *sc, struct ath_diag *ad); -extern int ath_dfs_get_thresholds(struct ath_softc *sc, HAL_PHYERR_PARAM *param); +extern int ath_dfs_get_thresholds(struct ath_softc *sc, + HAL_PHYERR_PARAM *param); +extern int ath_dfs_init_radar_filters(struct ath_softc *sc); #endif /* __IF_ATHDFS_H__ */ From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 16:29:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 980591065672; Mon, 8 Aug 2011 16:29:07 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E5328FC1F; Mon, 8 Aug 2011 16:29: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 p78GT7Ne055342; Mon, 8 Aug 2011 16:29:07 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78GT7dF055340; Mon, 8 Aug 2011 16:29:07 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201108081629.p78GT7dF055340@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 8 Aug 2011 16:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224717 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 16:29:07 -0000 Author: bschmidt Date: Mon Aug 8 16:29:07 2011 New Revision: 224717 URL: http://svn.freebsd.org/changeset/base/224717 Log: When setting a fixed channel on adapters with 11n support the scan channel list ends up with 2 entries, the HT and the legacy channel. The scan itself is currently always done at legacy rates so we end up receiving scan results for legacy networks on the HT channel and erroneously assigning the BSS to the 11n channel. As the channel's capabilities are used to setup the adapter we might end up with non-working settings and/or firmware crashes. Fix this by ensuring that scan results received on a HT channel are only assigned to that channel if the htcap IE is available, else use the legacy channel equivalent. Tested by: Pawel Worach, Raoul Megelas, Maciej Milewski, Andrei Approved by: re (kib) Modified: head/sys/net80211/ieee80211_scan_sta.c Modified: head/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sta.c Mon Aug 8 16:22:42 2011 (r224716) +++ head/sys/net80211/ieee80211_scan_sta.c Mon Aug 8 16:29:07 2011 (r224717) @@ -238,6 +238,7 @@ sta_add(struct ieee80211_scan_state *ss, const uint8_t *macaddr = wh->i_addr2; struct ieee80211vap *vap = ss->ss_vap; struct ieee80211com *ic = vap->iv_ic; + struct ieee80211_channel *c; struct sta_entry *se; struct ieee80211_scan_entry *ise; int hash; @@ -300,7 +301,6 @@ found: * association on the wrong channel. */ if (sp->status & IEEE80211_BPARSE_OFFCHAN) { - struct ieee80211_channel *c; /* * Off-channel, locate the home/bss channel for the sta * using the value broadcast in the DSPARMS ie. We know @@ -317,6 +317,14 @@ found: } } else ise->se_chan = ic->ic_curchan; + if (IEEE80211_IS_CHAN_HT(ise->se_chan) && sp->htcap == NULL) { + /* Demote legacy networks to a non-HT channel. */ + c = ieee80211_find_channel(ic, ise->se_chan->ic_freq, + ise->se_chan->ic_flags & ~IEEE80211_CHAN_HT); + KASSERT(c != NULL, + ("no legacy channel %u", ise->se_chan->ic_ieee)); + ise->se_chan = c; + } ise->se_fhdwell = sp->fhdwell; ise->se_fhindex = sp->fhindex; ise->se_erp = sp->erp; From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 17:33:36 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55E50106566C; Mon, 8 Aug 2011 17:33:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 457CA8FC12; Mon, 8 Aug 2011 17:33:36 +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 p78HXaJv057250; Mon, 8 Aug 2011 17:33:36 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78HXa2p057248; Mon, 8 Aug 2011 17:33:36 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108081733.p78HXa2p057248@svn.freebsd.org> From: Adrian Chadd Date: Mon, 8 Aug 2011 17:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224718 - head/sys/dev/ath/ath_hal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 17:33:36 -0000 Author: adrian Date: Mon Aug 8 17:33:35 2011 New Revision: 224718 URL: http://svn.freebsd.org/changeset/base/224718 Log: The older HAL code sets up the regulatory domain once; FreeBSD/net80211 allows it to be overridden at runtime. Thus, add a function which updates ah_dfsDomain after a channel set call to ath_hal_set_channels(). Approved by: re (kib, blanket) Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_regdomain.c Mon Aug 8 16:29:07 2011 (r224717) +++ head/sys/dev/ath/ath_hal/ah_regdomain.c Mon Aug 8 17:33:35 2011 (r224718) @@ -125,6 +125,8 @@ static const struct cmode modes[] = { IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D }, }; +static void ath_hal_update_dfsdomain(struct ath_hal *ah); + static OS_INLINE uint16_t getEepromRD(struct ath_hal *ah) { @@ -687,9 +689,8 @@ ath_hal_init_channels(struct ath_hal *ah HAL_BOOL enableExtendedChannels) { COUNTRY_CODE_TO_ENUM_RD *country; - REG_DOMAIN *rd5GHz = AH_NULL, *rd2GHz; + REG_DOMAIN *rd5GHz, *rd2GHz; HAL_STATUS status; - HAL_DFS_DOMAIN dfsDomain = HAL_DFS_UNINIT_DOMAIN; status = getchannels(ah, chans, maxchans, nchans, modeSelect, cc, regDmn, enableExtendedChannels, &country, &rd2GHz, &rd5GHz); @@ -701,20 +702,12 @@ ath_hal_init_channels(struct ath_hal *ah ah->ah_countryCode = country->countryCode; HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s: cc %u\n", __func__, ah->ah_countryCode); + + /* Update current DFS domain */ + ath_hal_update_dfsdomain(ah); } else status = HAL_EINVAL; - /* Update the DFS setting for the current regulatory domain */ - if (status == HAL_OK && rd5GHz != AH_NULL) { - if (rd5GHz->dfsMask & DFS_FCC3) - dfsDomain = HAL_DFS_FCC_DOMAIN; - if (rd5GHz->dfsMask & DFS_ETSI) - dfsDomain = HAL_DFS_ETSI_DOMAIN; - if (rd5GHz->dfsMask & DFS_MKK4) - dfsDomain = HAL_DFS_MKK4_DOMAIN; - } - AH_PRIVATE(ah)->ah_dfsDomain = dfsDomain; - return status; } @@ -759,6 +752,11 @@ ath_hal_set_channels(struct ath_hal *ah, __func__, ah->ah_countryCode); } else status = HAL_EINVAL; + + if (status == HAL_OK) { + /* Update current DFS domain */ + (void) ath_hal_update_dfsdomain(ah); + } return status; } @@ -824,6 +822,37 @@ ath_hal_getctl(struct ath_hal *ah, const return ctl; } + +/* + * Update the current dfsDomain setting based on the given + * country code. + * + * Since FreeBSD/net80211 allows the channel set to change + * after the card has been setup (via ath_hal_init_channels()) + * this function method is needed to update ah_dfsDomain. + */ +void +ath_hal_update_dfsdomain(struct ath_hal *ah) +{ + const REG_DOMAIN *rd5GHz = AH_PRIVATE(ah)->ah_rd5GHz; + HAL_CTRY_CODE cc = ah->ah_countryCode; + HAL_DFS_DOMAIN dfsDomain = HAL_DFS_UNINIT_DOMAIN; + HAL_REG_DOMAIN regDmn = AH_PRIVATE(ah)->ah_currentRD; + + HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s CC: %d, RegDmn: %d\n",__func__, + cc, regDmn); + if (rd5GHz->dfsMask & DFS_FCC3) + dfsDomain = HAL_DFS_FCC_DOMAIN; + if (rd5GHz->dfsMask & DFS_ETSI) + dfsDomain = HAL_DFS_ETSI_DOMAIN; + if (rd5GHz->dfsMask & DFS_MKK4) + dfsDomain = HAL_DFS_MKK4_DOMAIN; + AH_PRIVATE(ah)->ah_dfsDomain = dfsDomain; + HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s ah_dfsDomain: %d\n", + __func__, AH_PRIVATE(ah)->ah_dfsDomain); +} + + /* * Return the max allowed antenna gain and apply any regulatory * domain specific changes. From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 18:05:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEB0A106564A; Mon, 8 Aug 2011 18:05:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEC498FC1A; Mon, 8 Aug 2011 18:05:22 +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 p78I5MRw058189; Mon, 8 Aug 2011 18:05:22 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78I5MY8058187; Mon, 8 Aug 2011 18:05:22 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108081805.p78I5MY8058187@svn.freebsd.org> From: Adrian Chadd Date: Mon, 8 Aug 2011 18:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224719 - head/sys/dev/ath/ath_hal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 18:05:23 -0000 Author: adrian Date: Mon Aug 8 18:05:22 2011 New Revision: 224719 URL: http://svn.freebsd.org/changeset/base/224719 Log: Bitten again by the optional HALDEBUG compilation. Remove this debugging, it's not needed anymore and when not enabled, those variables trigger a compiler warning. Approved by: re (kib, blanket) Pointy-hat-to: adrian, for not testing a non-debug compile of this code enough Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_regdomain.c Mon Aug 8 17:33:35 2011 (r224718) +++ head/sys/dev/ath/ath_hal/ah_regdomain.c Mon Aug 8 18:05:22 2011 (r224719) @@ -835,12 +835,8 @@ void ath_hal_update_dfsdomain(struct ath_hal *ah) { const REG_DOMAIN *rd5GHz = AH_PRIVATE(ah)->ah_rd5GHz; - HAL_CTRY_CODE cc = ah->ah_countryCode; HAL_DFS_DOMAIN dfsDomain = HAL_DFS_UNINIT_DOMAIN; - HAL_REG_DOMAIN regDmn = AH_PRIVATE(ah)->ah_currentRD; - HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s CC: %d, RegDmn: %d\n",__func__, - cc, regDmn); if (rd5GHz->dfsMask & DFS_FCC3) dfsDomain = HAL_DFS_FCC_DOMAIN; if (rd5GHz->dfsMask & DFS_ETSI) From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 19:03:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14AD1106564A; Mon, 8 Aug 2011 19:03:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFBD98FC19; Mon, 8 Aug 2011 19:03:26 +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 p78J3QWB059997; Mon, 8 Aug 2011 19:03:26 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78J3QKb059995; Mon, 8 Aug 2011 19:03:26 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108081903.p78J3QKb059995@svn.freebsd.org> From: Adrian Chadd Date: Mon, 8 Aug 2011 19:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224720 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 19:03:27 -0000 Author: adrian Date: Mon Aug 8 19:03:26 2011 New Revision: 224720 URL: http://svn.freebsd.org/changeset/base/224720 Log: And add another missing brace. Another pointy hat moment. This one however isn't used by any public code yet, so it didn't break the build. Approved by: re (kib, blanket) Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Aug 8 18:05:22 2011 (r224719) +++ head/sys/dev/ath/if_athvar.h Mon Aug 8 19:03:26 2011 (r224720) @@ -713,7 +713,7 @@ void ath_intr(void *); #define ath_hal_procradarevent(_ah, _rxs, _fulltsf, _buf, _event) \ ((*(_ah)->ah_procRadarEvent)((_ah), (_rxs), (_fulltsf), (_buf), (_event))) #define ath_hal_is_fast_clock_enabled(_ah) \ - ((*(_ah)->ah_isFastClockEnabled)((_ah)) + ((*(_ah)->ah_isFastClockEnabled)((_ah))) #define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \ ((*(_ah)->ah_gpioCfgOutput)((_ah), (_gpio), (_type))) From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 20:36:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B673106564A; Mon, 8 Aug 2011 20:36:53 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B0EF8FC13; Mon, 8 Aug 2011 20:36:53 +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 p78KarnO062812; Mon, 8 Aug 2011 20:36:53 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78KarlR062810; Mon, 8 Aug 2011 20:36:53 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108082036.p78KarlR062810@svn.freebsd.org> From: Jonathan Anderson Date: Mon, 8 Aug 2011 20:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 20:36:53 -0000 Author: jonathan Date: Mon Aug 8 20:36:52 2011 New Revision: 224721 URL: http://svn.freebsd.org/changeset/base/224721 Log: Create timeval2timespec() and timespec2timeval(). These functions will be used by process descriptors to convert process creation time into process descriptor [acm]time. Approved by: re (kib), mentor (rwatson) Suggested by: jhb Sponsored by: Google Inc Modified: head/sys/sys/time.h Modified: head/sys/sys/time.h ============================================================================== --- head/sys/sys/time.h Mon Aug 8 19:03:26 2011 (r224720) +++ head/sys/sys/time.h Mon Aug 8 20:36:52 2011 (r224721) @@ -195,6 +195,24 @@ timeval2bintime(const struct timeval *tv ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ ((tvp)->tv_sec cmp (uvp)->tv_sec)) +/* Conversion between timespec and timeval. */ + +static __inline void +timeval2timespec(const struct timeval *tv, struct timespec *ts) +{ + + ts->tv_sec = tv->tv_sec; + ts->tv_nsec = 1000 * tv->tv_usec; +} + +static __inline void +timespec2timeval(const struct timespec *ts, struct timeval *tv) +{ + + tv->tv_sec = ts->tv_sec; + tv->tv_usec = ts->tv_nsec / 1000; +} + /* timevaladd and timevalsub are not inlined */ #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Mon Aug 8 20:53:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06F8B106568D; Mon, 8 Aug 2011 20:53:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB0118FC0C; Mon, 8 Aug 2011 20:53: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 p78Kr4No063299; Mon, 8 Aug 2011 20:53:04 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78Kr4Ro063297; Mon, 8 Aug 2011 20:53:04 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201108082053.p78Kr4Ro063297@svn.freebsd.org> From: Dimitry Andric Date: Mon, 8 Aug 2011 20:53:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224722 - head/sys/boot/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 20:53:05 -0000 Author: dim Date: Mon Aug 8 20:53:04 2011 New Revision: 224722 URL: http://svn.freebsd.org/changeset/base/224722 Log: Fix buffer overflow in sys/boot/common/util.c's printf(), when printing large (>= 10^10) numbers. In theory, 20 characaters should be enough, but bump the buffer to 32 characters, so we have some room for the future. Reviewed by: pjd Approved by: re (kib) Modified: head/sys/boot/common/util.c Modified: head/sys/boot/common/util.c ============================================================================== --- head/sys/boot/common/util.c Mon Aug 8 20:36:52 2011 (r224721) +++ head/sys/boot/common/util.c Mon Aug 8 20:53:04 2011 (r224722) @@ -119,7 +119,7 @@ printf(const char *fmt, ...) { va_list ap; const char *hex = "0123456789abcdef"; - char buf[10], *s; + char buf[32], *s; unsigned long long u; int c, l; From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 02:16:15 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8FFD106566C; Tue, 9 Aug 2011 02:16:15 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 5A4F08FC08; Tue, 9 Aug 2011 02:16:14 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p792GBhv028832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Aug 2011 12:16:12 +1000 Date: Tue, 9 Aug 2011 12:16:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jonathan Anderson In-Reply-To: <201108082036.p78KarlR062810@svn.freebsd.org> Message-ID: <20110809105824.P896@besplex.bde.org> References: <201108082036.p78KarlR062810@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 02:16:15 -0000 On Mon, 8 Aug 2011, Jonathan Anderson wrote: > Log: > Create timeval2timespec() and timespec2timeval(). > > These functions will be used by process descriptors to convert process > creation time into process descriptor [acm]time. These were intentionally left out. What is wrong with the existing APIs TIMEVAL_TO_TIMESPEC() and TIMESPEC_TO_TIMEVAL(), which are used for these conversions by almost everything now? Well, quite a bit is wrong with them, starting with the loudness of their names, but not including a twee spelling of "to" in their names. The main bugs in them is that they give undocumented APIs and namespace pollution in userland and undocumented APIs in the kernel. > Approved by: re (kib), mentor (rwatson) > Suggested by: jhb Should know better. > Modified: head/sys/sys/time.h > ============================================================================== > --- head/sys/sys/time.h Mon Aug 8 19:03:26 2011 (r224720) > +++ head/sys/sys/time.h Mon Aug 8 20:36:52 2011 (r224721) > @@ -195,6 +195,24 @@ timeval2bintime(const struct timeval *tv > ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ > ((tvp)->tv_sec cmp (uvp)->tv_sec)) > > +/* Conversion between timespec and timeval. */ > + > +static __inline void > +timeval2timespec(const struct timeval *tv, struct timespec *ts) > +{ > + > + ts->tv_sec = tv->tv_sec; > + ts->tv_nsec = 1000 * tv->tv_usec; > +} > + > +static __inline void > +timespec2timeval(const struct timespec *ts, struct timeval *tv) > +{ > + > + tv->tv_sec = ts->tv_sec; > + tv->tv_usec = ts->tv_nsec / 1000; > +} > + > /* timevaladd and timevalsub are not inlined */ > > #endif /* _KERNEL */ These are in the _KERNEL section, so they don't pollute userland. Otherwise, the pollution would consist of 2 function names, 2 parameter names and possibly 1 struct member names (I think tv_sec and tv_usec are reserved in , but perhaps timespecs and tv_nsec are not, since is mainly for old timeval interfaces. This is another reason why the implementation of timespec conversions belongs in where they already are and not in ). Style bugs in these include: - use of inline functions instead of macros. Macros are used for all the other APIs in this section. Using macros would limit the namespace pollution. E.g., it keeps parameter names out of other namespaces. - not using Hungrarian notation for pointers. Names of pointers are spelled with a trailing p in all other APIs in this section. sys/time.h has mounds of older implementation bugs. The bintime section is especially bad. The following is mostly about buigs in the non-_KERNEL sections. 1) Userland pollution in starts with everything in . 2) Then there is everything in . The only pollution is the undocumented TIMEPSEC conversion macros mentioned above (these are conditional on __BSD_VISIBLE). 4) Then there is struct timezone and its members. 5) Then there is DST_* for using tz_dsttime. 6) Then there is mounds of pollution from struct bintime and its APIs. This is conditional on __BSD_VISIBLE. Most of the bintime APIs are undocumented. (zgrep -r bintime in /usr/share/man gives many hits, while zgrep -r TIMESPEC in /usr/share/man gives zero hits, but most of the hits for bintime are in peripheral man pages and bintime(9); bintime(9) only documents the highest level of bintime APIs, leaving all of the arithmetic and conversion APIs undocumented.) Inlines instead of macros are used to implement most of the bintime APIs. This gives the following undocumented pollution: - bintime struct tag name 'bintime' - bintime struct member names 'sec' and 'frac'. These are especially bad since they are missing a prefix. - all the API names - all the parameter names: bt, x, bt2, ts, tv. Of course, these are also missing Hungrarian notation. - all the local variable names: u. 7) Then there is mounds of documented pollution for the NetBSD/OpenBSD compatibility APIs. These are not under __BSD_VISIBLE, so they are pure pollution. These were obsolete before they were born, since they are only for timevals. The kernel has always had equivalent interfaces, but they were intentionally left out of userland. Then they came back :-(. But they are documented, and they implemented using macros so they are missing the namespace pollution for parameter and local variable names, and their parameter names are spelled in Hungrarian notations, so they are missing most of the bugs described in this mail. FreeBSD still doesn't have the corresponding mistakes for manipulating timespecs. You just have to manipulate timespecs for yourself, like you should have to do for timevals too. I prefer to convert everything to floating point (int64_t has been usable too, ever since C99 standardized it). It is easier to multiply by 1e-6 to convert seconds to microseconds than to remember the nonstandard APIs that manipulate timespecs as timespecs. The timespec manipulation APIs may or may not be faster than floating point calculations, depending on whether the branches in them are faster than non-branchy FP code, but it is hard to think if situations where the efficiency matters. Most uses of the NetBSD APIs are for manipulating timeouts for things like setitimer(2) where the syscall overcall dominates. 8) Then there is the itimer section. This is POSIX, so it is actually permitted in this file! 9) Then there is the clockinfo section. This is pure nonstandard pollution. It is only partially documented (in sysctl(3)). 10) Then there is the POSIX timer section (CLOCK_REALTIME... and TIMER_ABSTIME...). This is POSIX, but is not properly ifdefed for the versions of POSIX that support it. 11) Then there is everything in . The structure of vs is still sort of backwards. This bug became more serious when POSIX started specifying in 2001 (old versions of POSIX didn't have timevals. Then in 2001, POSIX specified all the old timeval APIs that it had intentionally left out in 1988, and is the home for them in POSIX. But POSIX doesn't specifiy all of the other pollution that is traditional or has accrufted in ). 12) Finally, there is a section that declares prototypes of user APIs. This is mostly correct (properly ifdefed). Bruce From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 02:40:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 109891065672; Tue, 9 Aug 2011 02:40:22 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 12-207-105-211.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 937B114F0F1; Tue, 9 Aug 2011 02:40:21 +0000 (UTC) Message-ID: <4E409E15.2080708@FreeBSD.org> Date: Mon, 08 Aug 2011 19:40:21 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110706 Thunderbird/5.0 MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> <5A22B4EF-3B5A-497D-8F7C-8D9EED3F1BE3@FreeBSD.org> In-Reply-To: <5A22B4EF-3B5A-497D-8F7C-8D9EED3F1BE3@FreeBSD.org> X-Enigmail-Version: 1.2pre OpenPGP: id=1A1ABC84 Content-Type: multipart/mixed; boundary="------------000400010700050905030004" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 02:40:22 -0000 This is a multi-part message in MIME format. --------------000400010700050905030004 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 08/08/2011 02:42, Bjoern A. Zeeb wrote: > Back in the days, when I introduced NO_NIS (which was the name back > then), I considered both this and something along Ed's initial change > and I am sure some of the discussions can still be found in the > archives (from around 2005/-2y). > > While I could never be bothered enough to do the Ed-kind of change, > it was very clear back then that a change like this was a really bad > idea as it would break setups left and right. Ed's change was perfectly safe since if you're defining WITHOUT_NIS not having the system depend on NIS is a feature. > We want to support the > default compilation base system by default as well. If people prefer > to go non- default (WITHOUT_NIS), it's fine to have them make other > adjustments to alter defaults as well or live with the logging. A) Your argument is a red herring to start with. Out of the box we don't support NIS. At minimum you have to enable rpcbind_ and nis_client_, and set nisdomain. So no matter how you cut it, the system as it shipped by default prior to my change was broken. Ed's change was an incremental improvement. B) The argument that we should ship something broken by default is just plain stupid. The fact that we've been doing it for a long time isn't an excuse. So users who wish to use NIS (of which I am one, btw) already have to configure it. Asking them to configure one more file out of a default install is not a huge burden, and will prevent us shipping the system broken-by-default. However, to make things more clear I'm suggesting the attached, which has the UPDATING entry and a note for etc/defaults/rc.conf so that users who need to configure NIS will know that they need to make this change too. For those who are upgrading an existing installation I have no sympathy for blindly installing new files into /etc. > The solution as is now is even more confusing as both Ed and Doug > have missed to update the man page to clarify the new behaviour. It's not clear to me exactly what needs changing (and I did review the man page several times before making my patch). It describes the default behavior if the file does not exist, but I'm not sure how that's relevant? If you have suggestions for changes I'd be glad to take a look. > I also do not like the longerish version of the file now Seriously? > and the new > description is only talking about nis but ignoring all other > sources, which we do not provide samples for, for the inconvenience > of people wanting to use those. NIS is already a minority of our users. I'm sure anyone who is using anything else that's relevant to nsswitch.conf is already well aware of how to configure it. However, if you have suggestions for improving that comment that's fine. It might make the file longer though. :) Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ --------------000400010700050905030004 Content-Type: text/plain; name="nis.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="nis.diff" Index: UPDATING =================================================================== --- UPDATING (revision 224688) +++ UPDATING (working copy) @@ -22,6 +22,10 @@ machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20110806: + Prior versions of nsswitch.conf explicitly enabled NIS lookup of group, + passwd, and services information. It is now disabled by default. + 20110628: The packet filter (pf) code has been updated to OpenBSD 4.5. You need to update userland tools to be in sync with kernel. Index: etc/defaults/rc.conf =================================================================== --- etc/defaults/rc.conf (revision 224688) +++ etc/defaults/rc.conf (working copy) @@ -363,6 +363,7 @@ # Flags to ntpd (if enabled). # Network Information Services (NIS) options: All need rpcbind_enable="YES" ### +# Adust /etc/nsswitch.conf appropriately as well nis_client_enable="NO" # We're an NIS client (or NO). nis_client_flags="" # Flags to ypbind (if enabled). nis_ypset_enable="NO" # Run ypset at boot time (or NO). --------------000400010700050905030004-- From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 04:24:57 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 240191065673; Tue, 9 Aug 2011 04:24:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 132E88FC12; Tue, 9 Aug 2011 04:24: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 p794Ouex076685; Tue, 9 Aug 2011 04:24:56 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p794OufP076683; Tue, 9 Aug 2011 04:24:56 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108090424.p794OufP076683@svn.freebsd.org> From: Adrian Chadd Date: Tue, 9 Aug 2011 04:24:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224724 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 04:24:57 -0000 Author: adrian Date: Tue Aug 9 04:24:56 2011 New Revision: 224724 URL: http://svn.freebsd.org/changeset/base/224724 Log: Remove this call, now that I've solved the radar module problem without needing this particular modification. It can be called during ath_dfs_radar_enable() and still achieve the same functionality, so I am. Approved by: re (kib, blanket) Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Aug 8 22:16:07 2011 (r224723) +++ head/sys/dev/ath/if_ath.c Tue Aug 9 04:24:56 2011 (r224724) @@ -5032,12 +5032,6 @@ ath_setregdomain(struct ieee80211com *ic return EINVAL; /* XXX */ } - /* - * Setting country code might change the DFS domain - * so initialize the DFS Radar filters - */ - ath_dfs_init_radar_filters(sc); - return 0; } From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 06:36:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id EB55C106564A; Tue, 9 Aug 2011 06:36:44 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 12-207-105-211.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 5D3F2152317; Tue, 9 Aug 2011 06:36:44 +0000 (UTC) Message-ID: <4E40D57C.3070705@FreeBSD.org> Date: Mon, 08 Aug 2011 23:36:44 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110706 Thunderbird/5.0 MIME-Version: 1.0 To: Peter Wemm References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> <4E3F6216.5080706@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.2pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Garrett Cooper , "Simon L. B. Nielsen" , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 06:36:45 -0000 On 08/08/2011 23:31, Peter Wemm wrote: > No, if people use mergemaster in this mode: > -U Attempt to auto upgrade files that have not been user modified. > .. then mergemaster will silently turn off NIS for you. > > If it is considered bad practice to use -U, then people should be > directed away from it. I've been telling people that this is a bad idea since day 1. It's also the reason I refuse to make it the default. Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 06:41:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0664106564A; Tue, 9 Aug 2011 06:41:21 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4D2778FC13; Tue, 9 Aug 2011 06:41:21 +0000 (UTC) Received: by vxh11 with SMTP id 11so2660201vxh.13 for ; Mon, 08 Aug 2011 23:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=/fnBFHvW4UpuBT1bPCkc4dpBQUhrUZwdh5DHEsXlToo=; b=iENktaGXFs9+V4lQ1oMOmQWr5De0ApPTbhtdYPGi1RiYemqDuf4KV5DyA8o9q/7ZQn DhLSJuGEu8GRIFLG7UnGjxztnLFg3zY2ltogeF3B4LS2i5c9ITdbcNfiv2DR+RWqh14C Q540I/hHPeQOfQXriCyTzxoJZMAeSGrB6O0aY= MIME-Version: 1.0 Received: by 10.220.9.5 with SMTP id j5mr1790157vcj.203.1312872080532; Mon, 08 Aug 2011 23:41:20 -0700 (PDT) Received: by 10.220.93.75 with HTTP; Mon, 8 Aug 2011 23:41:20 -0700 (PDT) In-Reply-To: <4E40D57C.3070705@FreeBSD.org> References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> <4E3F6216.5080706@FreeBSD.org> <4E40D57C.3070705@FreeBSD.org> Date: Mon, 8 Aug 2011 23:41:20 -0700 Message-ID: From: Peter Wemm To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Garrett Cooper , "Simon L. B. Nielsen" , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 06:41:21 -0000 On Mon, Aug 8, 2011 at 11:36 PM, Doug Barton wrote: > On 08/08/2011 23:31, Peter Wemm wrote: >> No, if people use mergemaster in this mode: >> =A0 =A0 =A0-U =A0 =A0 =A0 =A0 =A0Attempt to auto upgrade files that have= not been user modified. >> .. then mergemaster will silently turn off NIS for you. >> >> If it is considered bad practice to use -U, then people should be >> directed away from it. > > I've been telling people that this is a bad idea since day 1. It's also > the reason I refuse to make it the default. It should say so in the documentation. As it stands now, it gives no hints of the danger and that it should not be used. "Attempt to auto upgrade files that have not been user modied." certainly looks like something that a random person would want. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 07:00:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6BF51065672; Tue, 9 Aug 2011 07:00:55 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6103E8FC0C; Tue, 9 Aug 2011 07:00:55 +0000 (UTC) Received: by vxh11 with SMTP id 11so2670627vxh.13 for ; Tue, 09 Aug 2011 00:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=nuGUODPlO/Ji8n53x/C698sk4iyHO+uz0SlJXAcuH+Y=; b=HlvlFhOcwPNhPmYOa1lL822Tx6vmmTHTi5UJK4VPqK9ZJsFvRUP69MJbn13XnUWADG 5Kn8huI0T+NPKAtW0Rz5wHK5ge1QNMBVPoQEsdQQhWeqkkDRR6t1UMZnVd+aPkiBnJar FG+Q41t2AWVP5CkNQgs+RmkdmLcKPP1FmrAaE= MIME-Version: 1.0 Received: by 10.52.74.74 with SMTP id r10mr6608255vdv.374.1312871460141; Mon, 08 Aug 2011 23:31:00 -0700 (PDT) Received: by 10.220.93.75 with HTTP; Mon, 8 Aug 2011 23:31:00 -0700 (PDT) In-Reply-To: <4E3F6216.5080706@FreeBSD.org> References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> <4E3F6216.5080706@FreeBSD.org> Date: Mon, 8 Aug 2011 23:31:00 -0700 Message-ID: From: Peter Wemm To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Garrett Cooper , "Simon L. B. Nielsen" , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 07:00:55 -0000 On Sun, Aug 7, 2011 at 9:12 PM, Doug Barton wrote: > On 8/7/2011 6:05 PM, Garrett Cooper wrote: >> On Sun, Aug 7, 2011 at 1:51 PM, Simon L. B. Nielsen wro= te: >>> >>> On 6 Aug 2011, at 11:16, Doug Barton wrote: >>> >>>> Author: dougb >>>> Date: Sat Aug =A06 09:16:53 2011 >>>> New Revision: 224674 >>>> URL: http://svn.freebsd.org/changeset/base/224674 >>>> >>>> Log: >>>> =A0Rather than edit the nsswitch.conf file based on ${MK_NIS} =3D=3D "= no" >>>> =A0comment out the NIS _compat options by default, but leave them in >>>> =A0the file for the convenience of users who want to enable it. >>>> >>>> =A0Update the comment in the file accordingly. >>> >>> This disables NIS by default which is rather surprising considering the= re has been no prior (which I have been able to find) discussion of this. >>> >>> At the _VERY_ least people need to be warned about this loudly. Unless = you can show this really helps non-NIS users this is IMO a bad idea. >>> >>> Yes, if you hand merge all /etc files this won't be a problem... but I = don't since life's to short for that, so this change just broke login on on= e of the FreeBSD.org during an upgrade. > > mergemaster has been in the tree for almost 12 years now. :) =A0In any > case, I can't think of a situation where blindly copying new files to > /etc is a good idea (with all due respect). No, if people use mergemaster in this mode: -U Attempt to auto upgrade files that have not been user modi= fied. .. then mergemaster will silently turn off NIS for you. If it is considered bad practice to use -U, then people should be directed away from it. I think this is what killed the freebsd.org machine. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 07:07:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15340106566C; Tue, 9 Aug 2011 07:07:55 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 79DC98FC08; Tue, 9 Aug 2011 07:07:54 +0000 (UTC) Received: by vxh11 with SMTP id 11so2674800vxh.13 for ; Tue, 09 Aug 2011 00:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Cs/w45qu2X4vkHDFom8l/MhnPSgRbmKAUwP8l8uCAck=; b=TGxG9Re0ZIpndZOHdcEGxvNQiUe0CYGkcPY/tlBvRcpNaHAvMiBeSoYfnw0o4FH5Q8 xVRnrLcRvZ5+NelZOCShS2PU6eFKvJGC/CpldhXwJ50j6W15+VkHN10QnL3R9lIvgBfZ lmN9bo5FM3MsN3id0gf4yUZ3LIzv0IhB57d+w= MIME-Version: 1.0 Received: by 10.220.199.69 with SMTP id er5mr1787880vcb.238.1312873672793; Tue, 09 Aug 2011 00:07:52 -0700 (PDT) Received: by 10.220.93.75 with HTTP; Tue, 9 Aug 2011 00:07:52 -0700 (PDT) In-Reply-To: <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> Date: Tue, 9 Aug 2011 00:07:52 -0700 Message-ID: From: Peter Wemm To: "Simon L. B. Nielsen" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, re@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 07:07:55 -0000 On Sun, Aug 7, 2011 at 1:51 PM, Simon L. B. Nielsen wrote: > > On 6 Aug 2011, at 11:16, Doug Barton wrote: > >> Author: dougb >> Date: Sat Aug =A06 09:16:53 2011 >> New Revision: 224674 >> URL: http://svn.freebsd.org/changeset/base/224674 >> >> Log: >> =A0Rather than edit the nsswitch.conf file based on ${MK_NIS} =3D=3D "no= " >> =A0comment out the NIS _compat options by default, but leave them in >> =A0the file for the convenience of users who want to enable it. >> >> =A0Update the comment in the file accordingly. > > This disables NIS by default which is rather surprising considering there= has been no prior (which I have been able to find) discussion of this. > > At the _VERY_ least people need to be warned about this loudly. Unless yo= u can show this really helps non-NIS users this is IMO a bad idea. As much as I'd like to see NIS die a painful death, the answer to the question of helping non-NIS users is "not much" as things stand. The nis, files and dns components are statically compiled into libc. There is no expensive dlopen("/usr/lib/nss_nis.so") to optimize out, unlike some other systems. The runtime overheads are negligible. The compiled-in routines check if nis activated with one syscall and immediately return NS_UNAVAIL if nis is not configured. As much as I hate NIS, I suspect this will break every single user of NIS who happens to also use mergemaster -U. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 07:26:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 77C1D1065687; Tue, 9 Aug 2011 07:26:02 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 12-207-105-211.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 674AF155A11; Tue, 9 Aug 2011 07:26:00 +0000 (UTC) Message-ID: <4E40E108.700@FreeBSD.org> Date: Tue, 09 Aug 2011 00:26:00 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110706 Thunderbird/5.0 MIME-Version: 1.0 To: Peter Wemm References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> <4E3F6216.5080706@FreeBSD.org> <4E40D57C.3070705@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.2pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Garrett Cooper , "Simon L. B. Nielsen" , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 07:26:02 -0000 On 08/08/2011 23:41, Peter Wemm wrote: > On Mon, Aug 8, 2011 at 11:36 PM, Doug Barton wrote: >> On 08/08/2011 23:31, Peter Wemm wrote: >>> No, if people use mergemaster in this mode: >>> -U Attempt to auto upgrade files that have not been user modified. >>> .. then mergemaster will silently turn off NIS for you. >>> >>> If it is considered bad practice to use -U, then people should be >>> directed away from it. >> >> I've been telling people that this is a bad idea since day 1. It's also >> the reason I refuse to make it the default. > > It should say so in the documentation. Patch sent to re@. Thanks. -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 07:30:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id C8623106566B; Tue, 9 Aug 2011 07:30:32 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 12-207-105-211.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 642371572A9; Tue, 9 Aug 2011 07:30:23 +0000 (UTC) Message-ID: <4E40E20E.5050804@FreeBSD.org> Date: Tue, 09 Aug 2011 00:30:22 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110706 Thunderbird/5.0 MIME-Version: 1.0 To: Peter Wemm References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> In-Reply-To: X-Enigmail-Version: 1.2pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, "Simon L. B. Nielsen" , svn-src-all@freebsd.org, src-committers@freebsd.org, re@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 07:30:32 -0000 On 08/09/2011 00:07, Peter Wemm wrote: > As much as I'd like to see NIS die a painful death, the answer to the > question of helping non-NIS users is "not much" as things stand. > > The nis, files and dns components are statically compiled into libc. > There is no expensive dlopen("/usr/lib/nss_nis.so") to optimize out, > unlike some other systems. > > The runtime overheads are negligible. The compiled-in routines check > if nis activated with one syscall and immediately return NS_UNAVAIL if > nis is not configured. None of this is relevant. The problem is that when you install the system, by default it generates errors for every access to /etc/passwd, /etc/group, or /etc/services. This is a silly way to ship a system. Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 07:42:19 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81F8C106568A; Tue, 9 Aug 2011 07:42:19 +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 714D18FC08; Tue, 9 Aug 2011 07:42:19 +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 p797gJYK082510; Tue, 9 Aug 2011 07:42:19 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p797gJ7i082507; Tue, 9 Aug 2011 07:42:19 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201108090742.p797gJ7i082507@svn.freebsd.org> From: Doug Barton Date: Tue, 9 Aug 2011 07:42:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224726 - head/usr.sbin/mergemaster X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 07:42:19 -0000 Author: dougb Date: Tue Aug 9 07:42:19 2011 New Revision: 224726 URL: http://svn.freebsd.org/changeset/base/224726 Log: Make clear that the -U option can be dangerous. [1] In -p mode install the group file with the same permissions as normally done in etc/Makefile. Update the copyright. Requested by: peter [1] Approved by: re (kib) Modified: head/usr.sbin/mergemaster/mergemaster.8 head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.8 Tue Aug 9 07:35:56 2011 (r224725) +++ head/usr.sbin/mergemaster/mergemaster.8 Tue Aug 9 07:42:19 2011 (r224726) @@ -1,4 +1,4 @@ -.\" Copyright (c) 1998-2010 Douglas Barton +.\" Copyright (c) 1998-2011 Douglas Barton .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 13, 2010 +.Dd August 9, 2011 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -244,6 +244,8 @@ or another directory you specify in your rc file. .It Fl U Attempt to auto upgrade files that have not been user modified. +This option can be dangerous when there are critical changes +in the new versions that affect your running system. .It Fl m Ar /path/to/sources Specify the path to the directory where you want to do the .Xr make 1 . @@ -360,6 +362,7 @@ with all values commented out: #AUTO_INSTALL= # # Automatically upgrade files that have not been user modified (-U) +# ***DANGEROUS*** #AUTO_UPGRADE= # # Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf (-C) @@ -461,7 +464,7 @@ temporary root environment comes from Ni make world tutorial which is referenced above. .Sh AUTHORS This manual page and the script itself were written by -.An Douglas Barton Aq DougB@FreeBSD.org . +.An Douglas Barton Aq dougb@FreeBSD.org . .Sh BUGS There are no known bugs. Please report any problems, Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Tue Aug 9 07:35:56 2011 (r224725) +++ head/usr.sbin/mergemaster/mergemaster.sh Tue Aug 9 07:42:19 2011 (r224726) @@ -5,8 +5,8 @@ # Compare files created by /usr/src/etc/Makefile (or the directory # the user specifies) with the currently installed copies. -# Copyright 1998-2010 Douglas Barton -# DougB@FreeBSD.org +# Copyright 1998-2011 Douglas Barton +# dougb@FreeBSD.org # $FreeBSD$ @@ -30,6 +30,7 @@ display_usage () { echo ' -C Compare local rc.conf variables to the defaults' echo ' -P Preserve files that are overwritten' echo " -U Attempt to auto upgrade files that have not been user modified" + echo ' ***DANGEROUS***' echo '' echo " -m /path/directory Specify location of source to do the make in" echo " -t /path/directory Specify temp root directory" @@ -635,7 +636,7 @@ case "${RERUN}" in # Only set up files that are crucial to {build|install}world { mkdir -p ${TEMPROOT}/etc && cp -p ${SOURCEDIR}/etc/master.passwd ${TEMPROOT}/etc && - cp -p ${SOURCEDIR}/etc/group ${TEMPROOT}/etc;} || + install -p -o root -g wheel -m 0644 ${SOURCEDIR}/etc/group ${TEMPROOT}/etc;} || { echo ''; echo ' *** FATAL ERROR: Cannot copy files to the temproot environment'; echo ''; From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 08:11:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 546D3106564A; Tue, 9 Aug 2011 08:11:27 +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 442808FC1E; Tue, 9 Aug 2011 08:11:27 +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 p798BRhv083515; Tue, 9 Aug 2011 08:11:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p798BRgS083513; Tue, 9 Aug 2011 08:11:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108090811.p798BRgS083513@svn.freebsd.org> From: Alexander Motin Date: Tue, 9 Aug 2011 08:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224728 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 08:11:27 -0000 Author: mav Date: Tue Aug 9 08:11:26 2011 New Revision: 224728 URL: http://svn.freebsd.org/changeset/base/224728 Log: Do not block zero report ID. It is correct value for devices with single ID. This fixes USB_SET_IMMED call (synchronous operation) of the uhid(4) driver on devices with single report ID. Reviewed by: hselasky Approved by: re (kib) MFC after: 1 week Modified: head/sys/dev/usb/usb_request.c Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Tue Aug 9 08:09:32 2011 (r224727) +++ head/sys/dev/usb/usb_request.c Tue Aug 9 08:11:26 2011 (r224728) @@ -1769,7 +1769,7 @@ usbd_req_get_report(struct usb_device *u struct usb_interface *iface = usbd_get_iface(udev, iface_index); struct usb_device_request req; - if ((iface == NULL) || (iface->idesc == NULL) || (id == 0)) { + if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); } DPRINTFN(5, "len=%d\n", len); From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 12:54:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3716A1065670; Tue, 9 Aug 2011 12:54:44 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2509D8FC1D; Tue, 9 Aug 2011 12:54: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 p79CsiVJ096545; Tue, 9 Aug 2011 12:54:44 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79Csi4e096534; Tue, 9 Aug 2011 12:54:44 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201108091254.p79Csi4e096534@svn.freebsd.org> From: Ruslan Ermilov Date: Tue, 9 Aug 2011 12:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224731 - head/contrib/one-true-awk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 12:54:44 -0000 Author: ru Date: Tue Aug 9 12:54:43 2011 New Revision: 224731 URL: http://svn.freebsd.org/changeset/base/224731 Log: Update to a 7-Aug-2011 release. Approved by: re (kib) Modified: head/contrib/one-true-awk/FIXES head/contrib/one-true-awk/awkgram.y head/contrib/one-true-awk/b.c head/contrib/one-true-awk/lex.c head/contrib/one-true-awk/lib.c head/contrib/one-true-awk/main.c head/contrib/one-true-awk/makefile head/contrib/one-true-awk/proto.h head/contrib/one-true-awk/run.c head/contrib/one-true-awk/tran.c Directory Properties: head/contrib/one-true-awk/ (props changed) Modified: head/contrib/one-true-awk/FIXES ============================================================================== --- head/contrib/one-true-awk/FIXES Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/FIXES Tue Aug 9 12:54:43 2011 (r224731) @@ -25,6 +25,24 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +Aug 7, 2011: + split(s, a, //) now behaves the same as split(s, a, "") + +Jun 12, 2011: + /pat/, \n /pat/ {...} is now legal, though bad style to use. + + added checks to new -v code that permits -vnospace; thanks to + ruslan ermilov for spotting this and providing the patch. + + removed fixed limit on number of open files; thanks to aleksey + cheusov and christos zoulos. + + fixed day 1 bug that resurrected deleted elements of ARGV when + used as filenames (in lib.c). + + minor type fiddles to make gcc -Wall -pedantic happier (but not + totally so); turned on -fno-strict-aliasing in makefile. + May 6, 2011: added #ifdef for isblank. now allows -ffoo as well as -f foo arguments. Modified: head/contrib/one-true-awk/awkgram.y ============================================================================== --- head/contrib/one-true-awk/awkgram.y Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/awkgram.y Tue Aug 9 12:54:43 2011 (r224731) @@ -174,8 +174,8 @@ pa_pat: pa_stat: pa_pat { $$ = stat2(PASTAT, $1, stat2(PRINT, rectonode(), NIL)); } | pa_pat lbrace stmtlist '}' { $$ = stat2(PASTAT, $1, $3); } - | pa_pat ',' pa_pat { $$ = pa2stat($1, $3, stat2(PRINT, rectonode(), NIL)); } - | pa_pat ',' pa_pat lbrace stmtlist '}' { $$ = pa2stat($1, $3, $5); } + | pa_pat ',' opt_nl pa_pat { $$ = pa2stat($1, $4, stat2(PRINT, rectonode(), NIL)); } + | pa_pat ',' opt_nl pa_pat lbrace stmtlist '}' { $$ = pa2stat($1, $4, $6); } | lbrace stmtlist '}' { $$ = stat2(PASTAT, NIL, $2); } | XBEGIN lbrace stmtlist '}' { beginloc = linkum(beginloc, $3); $$ = 0; } Modified: head/contrib/one-true-awk/b.c ============================================================================== --- head/contrib/one-true-awk/b.c Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/b.c Tue Aug 9 12:54:43 2011 (r224731) @@ -234,7 +234,7 @@ void freetr(Node *p) /* free parse tree /* in the parsing of regular expressions, metacharacters like . have */ /* to be seen literally; \056 is not a metacharacter. */ -int hexstr(char **pp) /* find and eval hex string at pp, return new p */ +int hexstr(uschar **pp) /* find and eval hex string at pp, return new p */ { /* only pick up one 8-bit byte (2 chars) */ uschar *p; int n = 0; @@ -248,16 +248,16 @@ int hexstr(char **pp) /* find and eval h else if (*p >= 'A' && *p <= 'F') n = 16 * n + *p - 'A' + 10; } - *pp = (char *) p; + *pp = (uschar *) p; return n; } #define isoctdigit(c) ((c) >= '0' && (c) <= '7') /* multiple use of arg */ -int quoted(char **pp) /* pick up next thing after a \\ */ +int quoted(uschar **pp) /* pick up next thing after a \\ */ /* and increment *pp */ { - char *p = *pp; + uschar *p = *pp; int c; if ((c = *p++) == 't') @@ -314,13 +314,13 @@ char *cclenter(const char *argp) /* add bp = buf; for (i = 0; (c = *p++) != 0; ) { if (c == '\\') { - c = quoted((char **) &p); + c = quoted(&p); } else if (c == '-' && i > 0 && bp[-1] != 0) { if (*p != 0) { c = bp[-1]; c2 = *p++; if (c2 == '\\') - c2 = quoted((char **) &p); + c2 = quoted(&p); if (collate_range_cmp(c, c2) > 0) { bp--; i--; @@ -807,7 +807,7 @@ int relex(void) /* lexical analyzer for case ')': return c; case '\\': - rlxval = quoted((char **) &prestr); + rlxval = quoted(&prestr); return CHAR; default: rlxval = c; Modified: head/contrib/one-true-awk/lex.c ============================================================================== --- head/contrib/one-true-awk/lex.c Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/lex.c Tue Aug 9 12:54:43 2011 (r224731) @@ -411,7 +411,7 @@ int string(void) } *px = 0; unput(c); - sscanf(xbuf, "%x", &n); + sscanf(xbuf, "%x", (unsigned int *) &n); *bp++ = n; break; } Modified: head/contrib/one-true-awk/lib.c ============================================================================== --- head/contrib/one-true-awk/lib.c Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/lib.c Tue Aug 9 12:54:43 2011 (r224731) @@ -124,7 +124,7 @@ int getrec(char **pbuf, int *pbufsize, i dprintf( ("argno=%d, file=|%s|\n", argno, file) ); if (infile == NULL) { /* have to open a new file */ file = getargv(argno); - if (*file == '\0') { /* it's been zapped */ + if (file == NULL || *file == '\0') { /* deleted or zapped */ argno++; continue; } @@ -187,6 +187,7 @@ int readrec(char **pbuf, int *pbufsize, if (strlen(*FS) >= sizeof(inputFS)) FATAL("field separator %.10s... is too long", *FS); + /*fflush(stdout); avoids some buffering problem but makes it 25% slower*/ strcpy(inputFS, *FS); /* for subsequent field splitting */ if ((sep = **RS) == 0) { sep = '\n'; @@ -227,6 +228,8 @@ char *getargv(int n) /* get ARGV[n] */ extern Array *ARGVtab; sprintf(temp, "%d", n); + if (lookup(temp, ARGVtab) == NULL) + return NULL; x = setsymtab(temp, "", 0.0, STR, ARGVtab); s = getsval(x); dprintf( ("getargv(%d) returns |%s|\n", n, s) ); @@ -477,14 +480,14 @@ void recbld(void) /* create $0 from $1.. if (!adjbuf(&record, &recsize, 2+r-record, recsize, &r, "recbld 3")) FATAL("built giant record `%.30s...'", record); *r = '\0'; - dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, fldtab[0]) ); + dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); if (freeable(fldtab[0])) xfree(fldtab[0]->sval); fldtab[0]->tval = REC | STR | DONTFREE; fldtab[0]->sval = record; - dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, fldtab[0]) ); + dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); dprintf( ("recbld = |%s|\n", record) ); donerec = 1; } Modified: head/contrib/one-true-awk/main.c ============================================================================== --- head/contrib/one-true-awk/main.c Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/main.c Tue Aug 9 12:54:43 2011 (r224731) @@ -25,7 +25,7 @@ THIS SOFTWARE. #include __FBSDID("$FreeBSD$"); -const char *version = "version 20110506 (FreeBSD)"; +const char *version = "version 20110807 (FreeBSD)"; #define DEBUG #include @@ -125,10 +125,20 @@ int main(int argc, char *argv[]) WARNING("field separator FS is empty"); break; case 'v': /* -v a=1 to be done NOW. one -v for each */ - if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1])) - setclvar(argv[1]); - else if (argv[1][2] != '\0') - setclvar(&argv[1][2]); + if (argv[1][2] != 0) { /* arg is -vsomething */ + if (isclvar(&argv[1][2])) + setclvar(&argv[1][2]); + else + FATAL("invalid -v option argument: %s", &argv[1][2]); + } else { /* arg is -v something */ + argc--; argv++; + if (argc <= 1) + FATAL("no variable name"); + if (isclvar(argv[1])) + setclvar(argv[1]); + else + FATAL("invalid -v option argument: %s", argv[1]); + } break; case 'd': dbg = atoi(&argv[1][2]); Modified: head/contrib/one-true-awk/makefile ============================================================================== --- head/contrib/one-true-awk/makefile Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/makefile Tue Aug 9 12:54:43 2011 (r224731) @@ -30,7 +30,7 @@ CC = gcc -Wall -g CC = cc CC = gcc -Wall -g -Wwrite-strings CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov -CC = gcc -O4 +CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing YACC = bison -y YACC = yacc Modified: head/contrib/one-true-awk/proto.h ============================================================================== --- head/contrib/one-true-awk/proto.h Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/proto.h Tue Aug 9 12:54:43 2011 (r224731) @@ -43,8 +43,8 @@ extern fa *mkdfa(const char *, int); extern int makeinit(fa *, int); extern void penter(Node *); extern void freetr(Node *); -extern int hexstr(char **); -extern int quoted(char **); +extern int hexstr(uschar **); +extern int quoted(uschar **); extern char *cclenter(const char *); extern void overflo(const char *); extern void cfoll(fa *, Node *); Modified: head/contrib/one-true-awk/run.c ============================================================================== --- head/contrib/one-true-awk/run.c Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/run.c Tue Aug 9 12:54:43 2011 (r224731) @@ -1239,6 +1239,12 @@ Cell *split(Node **a, int nnn) /* split( ap->sval = (char *) makesymtab(NSYMTAB); n = 0; + if (arg3type == REGEXPR && strlen((char*)((fa*)a[2])->restr) == 0) { + /* split(s, a, //); have to arrange that it looks like empty sep */ + arg3type = 0; + fs = ""; + sep = 0; + } if (*s != '\0' && (strlen(fs) > 1 || arg3type == REGEXPR)) { /* reg expr */ fa *pfa; if (arg3type == REGEXPR) { /* it's ready already */ @@ -1621,17 +1627,25 @@ struct files { FILE *fp; const char *fname; int mode; /* '|', 'a', 'w' => LE/LT, GT */ -} files[FOPEN_MAX] ={ - { NULL, "/dev/stdin", LT }, /* watch out: don't free this! */ - { NULL, "/dev/stdout", GT }, - { NULL, "/dev/stderr", GT } -}; +} *files; + +int nfiles; void stdinit(void) /* in case stdin, etc., are not constants */ { - files[0].fp = stdin; - files[1].fp = stdout; - files[2].fp = stderr; + nfiles = FOPEN_MAX; + files = calloc(nfiles, sizeof(*files)); + if (files == NULL) + FATAL("can't allocate file memory for %u files", nfiles); + files[0].fp = stdin; + files[0].fname = "/dev/stdin"; + files[0].mode = LT; + files[1].fp = stdout; + files[1].fname = "/dev/stdout"; + files[1].mode = GT; + files[2].fp = stderr; + files[2].fname = "/dev/stderr"; + files[2].mode = GT; } FILE *openfile(int a, const char *us) @@ -1642,7 +1656,7 @@ FILE *openfile(int a, const char *us) if (*s == '\0') FATAL("null file name in print or getline"); - for (i=0; i < FOPEN_MAX; i++) + for (i=0; i < nfiles; i++) if (files[i].fname && strcmp(s, files[i].fname) == 0) { if (a == files[i].mode || (a==APPEND && files[i].mode==GT)) return files[i].fp; @@ -1652,11 +1666,19 @@ FILE *openfile(int a, const char *us) if (a == FFLUSH) /* didn't find it, so don't create it! */ return NULL; - for (i=0; i < FOPEN_MAX; i++) + for (i=0; i < nfiles; i++) if (files[i].fp == 0) break; - if (i >= FOPEN_MAX) - FATAL("%s makes too many open files", s); + if (i >= nfiles) { + struct files *nf; + int nnf = nfiles + FOPEN_MAX; + nf = realloc(files, nnf * sizeof(*nf)); + if (nf == NULL) + FATAL("cannot grow files for %s and %d files", s, nnf); + memset(&nf[nfiles], 0, FOPEN_MAX * sizeof(*nf)); + nfiles = nnf; + files = nf; + } fflush(stdout); /* force a semblance of order */ m = a; if (a == GT) { @@ -1684,7 +1706,7 @@ const char *filename(FILE *fp) { int i; - for (i = 0; i < FOPEN_MAX; i++) + for (i = 0; i < nfiles; i++) if (fp == files[i].fp) return files[i].fname; return "???"; @@ -1699,7 +1721,7 @@ Cell *closefile(Node **a, int n) x = execute(a[0]); getsval(x); stat = -1; - for (i = 0; i < FOPEN_MAX; i++) { + for (i = 0; i < nfiles; i++) { if (files[i].fname && strcmp(x->sval, files[i].fname) == 0) { if (ferror(files[i].fp)) WARNING( "i/o error occurred on %s", files[i].fname ); @@ -1743,7 +1765,7 @@ void flush_all(void) { int i; - for (i = 0; i < FOPEN_MAX; i++) + for (i = 0; i < nfiles; i++) if (files[i].fp) fflush(files[i].fp); } Modified: head/contrib/one-true-awk/tran.c ============================================================================== --- head/contrib/one-true-awk/tran.c Tue Aug 9 12:24:33 2011 (r224730) +++ head/contrib/one-true-awk/tran.c Tue Aug 9 12:54:43 2011 (r224731) @@ -212,7 +212,7 @@ Cell *setsymtab(const char *n, const cha if (n != NULL && (p = lookup(n, tp)) != NULL) { dprintf( ("setsymtab found %p: n=%s s=\"%s\" f=%g t=%o\n", - p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); + (void*)p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); return(p); } p = (Cell *) malloc(sizeof(Cell)); @@ -231,7 +231,7 @@ Cell *setsymtab(const char *n, const cha p->cnext = tp->tab[h]; tp->tab[h] = p; dprintf( ("setsymtab set %p: n=%s s=\"%s\" f=%g t=%o\n", - p, p->nval, p->sval, p->fval, p->tval) ); + (void*)p, p->nval, p->sval, p->fval, p->tval) ); return(p); } @@ -298,7 +298,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f) / xfree(vp->sval); /* free any previous string */ vp->tval &= ~STR; /* mark string invalid */ vp->tval |= NUM; /* mark number ok */ - dprintf( ("setfval %p: %s = %g, t=%o\n", vp, NN(vp->nval), f, vp->tval) ); + dprintf( ("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, vp->tval) ); return vp->fval = f; } @@ -318,7 +318,7 @@ char *setsval(Cell *vp, const char *s) / int fldno; dprintf( ("starting setsval %p: %s = \"%s\", t=%o, r,f=%d,%d\n", - vp, NN(vp->nval), s, vp->tval, donerec, donefld) ); + (void*)vp, NN(vp->nval), s, vp->tval, donerec, donefld) ); if ((vp->tval & (NUM | STR)) == 0) funnyvar(vp, "assign to"); if (isfld(vp)) { @@ -338,7 +338,7 @@ char *setsval(Cell *vp, const char *s) / vp->tval |= STR; vp->tval &= ~DONTFREE; dprintf( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n", - vp, NN(vp->nval), t,t, vp->tval, donerec, donefld) ); + (void*)vp, NN(vp->nval), t,t, vp->tval, donerec, donefld) ); return(vp->sval = t); } @@ -355,7 +355,8 @@ Awkfloat getfval(Cell *vp) /* get float if (is_number(vp->sval) && !(vp->tval&CON)) vp->tval |= NUM; /* make NUM only sparingly */ } - dprintf( ("getfval %p: %s = %g, t=%o\n", vp, NN(vp->nval), vp->fval, vp->tval) ); + dprintf( ("getfval %p: %s = %g, t=%o\n", + (void*)vp, NN(vp->nval), vp->fval, vp->tval) ); return(vp->fval); } @@ -381,7 +382,8 @@ static char *get_str_val(Cell *vp, char vp->tval &= ~DONTFREE; vp->tval |= STR; } - dprintf( ("getsval %p: %s = \"%s (%p)\", t=%o\n", vp, NN(vp->nval), vp->sval, vp->sval, vp->tval) ); + dprintf( ("getsval %p: %s = \"%s (%p)\", t=%o\n", + (void*)vp, NN(vp->nval), vp->sval, vp->sval, vp->tval) ); return(vp->sval); } From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 14:06:51 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D4281065673; Tue, 9 Aug 2011 14:06:51 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C9128FC12; Tue, 9 Aug 2011 14:06: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 p79E6pKL098662; Tue, 9 Aug 2011 14:06:51 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79E6oRf098660; Tue, 9 Aug 2011 14:06:51 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108091406.p79E6oRf098660@svn.freebsd.org> From: Jonathan Anderson Date: Tue, 9 Aug 2011 14:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224732 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 14:06:51 -0000 Author: jonathan Date: Tue Aug 9 14:06:50 2011 New Revision: 224732 URL: http://svn.freebsd.org/changeset/base/224732 Log: Remove timeval2timespec and its converse, since we already have TIMEVAL_TO_TIMESPEC() in . Spotted by: bde Approved by: re (kib), mentor (rwatson) Modified: head/sys/sys/time.h Modified: head/sys/sys/time.h ============================================================================== --- head/sys/sys/time.h Tue Aug 9 12:54:43 2011 (r224731) +++ head/sys/sys/time.h Tue Aug 9 14:06:50 2011 (r224732) @@ -195,24 +195,6 @@ timeval2bintime(const struct timeval *tv ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ ((tvp)->tv_sec cmp (uvp)->tv_sec)) -/* Conversion between timespec and timeval. */ - -static __inline void -timeval2timespec(const struct timeval *tv, struct timespec *ts) -{ - - ts->tv_sec = tv->tv_sec; - ts->tv_nsec = 1000 * tv->tv_usec; -} - -static __inline void -timespec2timeval(const struct timespec *ts, struct timeval *tv) -{ - - tv->tv_sec = ts->tv_sec; - tv->tv_usec = ts->tv_nsec / 1000; -} - /* timevaladd and timevalsub are not inlined */ #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 15:29:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 164CB106566B; Tue, 9 Aug 2011 15:29:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05B638FC13; Tue, 9 Aug 2011 15:29: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 p79FTw1f001421; Tue, 9 Aug 2011 15:29:58 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79FTwZJ001417; Tue, 9 Aug 2011 15:29:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201108091529.p79FTwZJ001417@svn.freebsd.org> From: John Baldwin Date: Tue, 9 Aug 2011 15:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224733 - head/sys/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 15:29:59 -0000 Author: jhb Date: Tue Aug 9 15:29:58 2011 New Revision: 224733 URL: http://svn.freebsd.org/changeset/base/224733 Log: Merge 220876, 220877, and 221537 from the new NFS client to the old: Allow the NFS client to use a max file size larger than 1TB for v3 mounts. It now allows files up to OFF_MAX subject to whatever limit the server advertises. Reviewed by: rmacklem Approved by: re (kib) MFC after: 1 week Modified: head/sys/nfsclient/nfs_bio.c head/sys/nfsclient/nfs_vfsops.c head/sys/nfsclient/nfs_vnops.c Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Tue Aug 9 14:06:50 2011 (r224732) +++ head/sys/nfsclient/nfs_bio.c Tue Aug 9 15:29:58 2011 (r224733) @@ -445,6 +445,7 @@ nfs_bioread(struct vnode *vp, struct uio struct thread *td; struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn, rabn; + off_t end; int bcount; int seqcount; int nra, error = 0, n = 0, on = 0; @@ -464,8 +465,9 @@ nfs_bioread(struct vnode *vp, struct uio } else mtx_unlock(&nmp->nm_mtx); + end = uio->uio_offset + uio->uio_resid; if (vp->v_type != VDIR && - (uio->uio_offset + uio->uio_resid) > nmp->nm_maxfilesize) + (end > nmp->nm_maxfilesize || end < uio->uio_offset)) return (EFBIG); if (nfs_directio_enable && (ioflag & IO_DIRECT) && (vp->v_type == VREG)) @@ -865,6 +867,7 @@ nfs_write(struct vop_write_args *ap) struct vattr vattr; struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn; + off_t end; int bcount; int n, on, error = 0; @@ -932,7 +935,8 @@ flush_and_restart: if (uio->uio_offset < 0) return (EINVAL); - if ((uio->uio_offset + uio->uio_resid) > nmp->nm_maxfilesize) + end = uio->uio_offset + uio->uio_resid; + if (end > nmp->nm_maxfilesize || end < uio->uio_offset) return (EFBIG); if (uio->uio_resid == 0) return (0); Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Tue Aug 9 14:06:50 2011 (r224732) +++ head/sys/nfsclient/nfs_vfsops.c Tue Aug 9 15:29:58 2011 (r224733) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1228,13 +1229,11 @@ mountnfs(struct nfs_args *argp, struct m * * For V3, nfs_fsinfo will adjust this as necessary. Assume maximum * that we can handle until we find out otherwise. - * XXX Our "safe" limit on the client is what we can store in our - * buffer cache using signed(!) block numbers. */ if ((argp->flags & NFSMNT_NFSV3) == 0) nmp->nm_maxfilesize = 0xffffffffLL; else - nmp->nm_maxfilesize = (u_int64_t)0x80000000 * DEV_BSIZE - 1; + nmp->nm_maxfilesize = OFF_MAX; nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Tue Aug 9 14:06:50 2011 (r224732) +++ head/sys/nfsclient/nfs_vnops.c Tue Aug 9 15:29:58 2011 (r224733) @@ -1276,6 +1276,7 @@ nfs_readrpc(struct vnode *vp, struct uio caddr_t bpos, dpos; struct mbuf *mreq, *mrep, *md, *mb; struct nfsmount *nmp; + off_t end; int error = 0, len, retlen, tsiz, eof, attrflag; int v3 = NFS_ISV3(vp); int rsize; @@ -1286,7 +1287,8 @@ nfs_readrpc(struct vnode *vp, struct uio nmp = VFSTONFS(vp->v_mount); tsiz = uiop->uio_resid; mtx_lock(&nmp->nm_mtx); - if (uiop->uio_offset + tsiz > nmp->nm_maxfilesize) { + end = uiop->uio_offset + tsiz; + if (end > nmp->nm_maxfilesize || end < uiop->uio_offset) { mtx_unlock(&nmp->nm_mtx); return (EFBIG); } @@ -1348,6 +1350,7 @@ nfs_writerpc(struct vnode *vp, struct ui caddr_t bpos, dpos; struct mbuf *mreq, *mrep, *md, *mb; struct nfsmount *nmp = VFSTONFS(vp->v_mount); + off_t end; int error = 0, len, tsiz, wccflag = NFSV3_WCCRATTR, rlen, commit; int v3 = NFS_ISV3(vp), committed = NFSV3WRITE_FILESYNC; int wsize; @@ -1356,7 +1359,8 @@ nfs_writerpc(struct vnode *vp, struct ui *must_commit = 0; tsiz = uiop->uio_resid; mtx_lock(&nmp->nm_mtx); - if (uiop->uio_offset + tsiz > nmp->nm_maxfilesize) { + end = uiop->uio_offset + tsiz; + if (end > nmp->nm_maxfilesize || end < uiop->uio_offset) { mtx_unlock(&nmp->nm_mtx); return (EFBIG); } From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 15:46:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4610B1065678; Tue, 9 Aug 2011 15:46:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3589E8FC20; Tue, 9 Aug 2011 15:46:53 +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 p79Fkrj3001957; Tue, 9 Aug 2011 15:46:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79FkrIc001954; Tue, 9 Aug 2011 15:46:53 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108091546.p79FkrIc001954@svn.freebsd.org> From: Adrian Chadd Date: Tue, 9 Aug 2011 15:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224734 - in head/sys/dev/ath: . ath_dfs/null X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 15:46:53 -0000 Author: adrian Date: Tue Aug 9 15:46:52 2011 New Revision: 224734 URL: http://svn.freebsd.org/changeset/base/224734 Log: Remove the now unneeded references to these DFS methods. Sorry for the noise everyone. Approved by: re (kib, blanket) Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c head/sys/dev/ath/if_athdfs.h Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c ============================================================================== --- head/sys/dev/ath/ath_dfs/null/dfs_null.c Tue Aug 9 15:29:58 2011 (r224733) +++ head/sys/dev/ath/ath_dfs/null/dfs_null.c Tue Aug 9 15:46:52 2011 (r224734) @@ -226,13 +226,3 @@ ath_dfs_get_thresholds(struct ath_softc ath_hal_getdfsthresh(sc->sc_ah, param); return 1; } - -/* - * Update the current radar patterns based on the - * current operating mode/regulatory domain. - */ -int -ath_dfs_init_radar_filters(struct ath_softc *sc) -{ - return 1; -} Modified: head/sys/dev/ath/if_athdfs.h ============================================================================== --- head/sys/dev/ath/if_athdfs.h Tue Aug 9 15:29:58 2011 (r224733) +++ head/sys/dev/ath/if_athdfs.h Tue Aug 9 15:46:52 2011 (r224734) @@ -44,6 +44,5 @@ extern int ath_dfs_tasklet_needed(struct extern int ath_ioctl_phyerr(struct ath_softc *sc, struct ath_diag *ad); extern int ath_dfs_get_thresholds(struct ath_softc *sc, HAL_PHYERR_PARAM *param); -extern int ath_dfs_init_radar_filters(struct ath_softc *sc); #endif /* __IF_ATHDFS_H__ */ From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 16:42:31 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3E8C106564A; Tue, 9 Aug 2011 16:42:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93BD18FC12; Tue, 9 Aug 2011 16:42:31 +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 p79GgVv9003770; Tue, 9 Aug 2011 16:42:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79GgVNo003768; Tue, 9 Aug 2011 16:42:31 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201108091642.p79GgVNo003768@svn.freebsd.org> From: Attilio Rao Date: Tue, 9 Aug 2011 16:42:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224736 - head/sys/dev/ichsmb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 16:42:31 -0000 Author: attilio Date: Tue Aug 9 16:42:31 2011 New Revision: 224736 URL: http://svn.freebsd.org/changeset/base/224736 Log: Add the PCI ID for the PCH DH89xxCC on ichsmb as got from Linux counterpart. Sponsored by: Sandvine Incorporated Reviewed by: emaste, rstone Approved by: re (bz) MFC after: 3 days Modified: head/sys/dev/ichsmb/ichsmb_pci.c Modified: head/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- head/sys/dev/ichsmb/ichsmb_pci.c Tue Aug 9 15:47:54 2011 (r224735) +++ head/sys/dev/ichsmb/ichsmb_pci.c Tue Aug 9 16:42:31 2011 (r224736) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include /* PCI unique identifiers */ +#define ID_PCH_DH89XXCC 0x23308086 #define ID_82801AA 0x24138086 #define ID_82801AB 0x24238086 #define ID_82801BA 0x24438086 @@ -169,6 +170,7 @@ ichsmb_pci_probe(device_t dev) case ID_82801JI: device_set_desc(dev, "Intel 82801JI (ICH10) SMBus controller"); break; + case ID_PCH_DH89XXCC: case ID_PCH: device_set_desc(dev, "Intel PCH SMBus controller"); break; From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 17:05:00 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70035106566C; Tue, 9 Aug 2011 17:05:00 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id D7AE38FC14; Tue, 9 Aug 2011 17:04:59 +0000 (UTC) Received: by vws18 with SMTP id 18so229821vws.13 for ; Tue, 09 Aug 2011 10:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=BfMMtCWpp5gLLpVgwFO6kZhcuMe07QDZyvA1mGn0NGY=; b=BIHsrMTzFTYYUShv5mw0kWOjCM6mYvIYmHUl9h+pKILxbHjhmi7oz7VWcyEm+JGPA4 zQqbKLZZXcdAbzOozhpHp0Lk5/rtdiaS7wWWQk8td94zHSd+bFsfV6+3YFlA84nNMkae wpAbHeTpqO9pUWLKvUBtYrqTUyGmRNo8zBHpE= MIME-Version: 1.0 Received: by 10.220.199.69 with SMTP id er5mr1960594vcb.238.1312909498710; Tue, 09 Aug 2011 10:04:58 -0700 (PDT) Received: by 10.220.93.75 with HTTP; Tue, 9 Aug 2011 10:04:58 -0700 (PDT) In-Reply-To: <4E40E20E.5050804@FreeBSD.org> References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> <4E40E20E.5050804@FreeBSD.org> Date: Tue, 9 Aug 2011 10:04:58 -0700 Message-ID: From: Peter Wemm To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, "Simon L. B. Nielsen" , svn-src-all@freebsd.org, src-committers@freebsd.org, re@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 17:05:00 -0000 On Tue, Aug 9, 2011 at 12:30 AM, Doug Barton wrote: > On 08/09/2011 00:07, Peter Wemm wrote: >> As much as I'd like to see NIS die a painful death, the answer to the >> question of helping non-NIS users is "not much" as things stand. >> >> The nis, files and dns components are statically compiled into libc. >> There is no expensive dlopen("/usr/lib/nss_nis.so") to optimize out, >> unlike some other systems. >> >> The runtime overheads are negligible. =A0The compiled-in routines check >> if nis activated with one syscall and immediately return NS_UNAVAIL if >> nis is not configured. > > None of this is relevant. The problem is that when you install the > system, by default it generates errors for every access to /etc/passwd, > /etc/group, or /etc/services. This is a silly way to ship a system. It does what?? The code is completely passive unless NIS is configured. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 18:11:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id BE6241065670; Tue, 9 Aug 2011 18:11:48 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 12-207-105-211.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 54068150B0E; Tue, 9 Aug 2011 18:11:48 +0000 (UTC) Message-ID: <4E417863.2010909@FreeBSD.org> Date: Tue, 09 Aug 2011 11:11:47 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110706 Thunderbird/5.0 MIME-Version: 1.0 To: Peter Wemm References: <201108060916.p769Gr4A043462@svn.freebsd.org> <9DDF0DAB-9056-45CD-8CE9-81B621A35B13@nitro.dk> <4E40E20E.5050804@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.2pre OpenPGP: id=1A1ABC84 Content-Type: multipart/mixed; boundary="------------030606070107020804080600" Cc: svn-src-head@freebsd.org, "Simon L. B. Nielsen" , svn-src-all@freebsd.org, src-committers@freebsd.org, re@freebsd.org Subject: Re: svn commit: r224674 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 18:11:48 -0000 This is a multi-part message in MIME format. --------------030606070107020804080600 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 08/09/2011 10:04, Peter Wemm wrote: > On Tue, Aug 9, 2011 at 12:30 AM, Doug Barton wrote: >> On 08/09/2011 00:07, Peter Wemm wrote: >>> As much as I'd like to see NIS die a painful death, the answer to the >>> question of helping non-NIS users is "not much" as things stand. >>> >>> The nis, files and dns components are statically compiled into libc. >>> There is no expensive dlopen("/usr/lib/nss_nis.so") to optimize out, >>> unlike some other systems. >>> >>> The runtime overheads are negligible. The compiled-in routines check >>> if nis activated with one syscall and immediately return NS_UNAVAIL if >>> nis is not configured. >> >> None of this is relevant. The problem is that when you install the >> system, by default it generates errors for every access to /etc/passwd, >> /etc/group, or /etc/services. This is a silly way to ship a system. > > It does what?? The code is completely passive unless NIS is configured. Well I feel stupid. What I was remembering as the default state (errors produced by default) was incorrect. I had recently installed a new system and thought that I was seeing what I remembered, but it turns out that was a different issue. As a result I failed to check my facts, and it turns out that I was 100% wrong. My sincere apologies to all involved for the time-suck, as well as the breakage I caused. Meanwhile, here is a patch which restores the old nsswitch.conf, and restores Ed's change with a slightly improved sed filter which produces this output instead of removing the _compat lines altogether: group: files # group_compat: nis hosts: files dns networks: files passwd: files # passwd_compat: nis shells: files services: files # services_compat: nis protocols: files rpc: files IMO that will make it easier if users want to go back and enable NIS down the road. However if the prevailing wisdom is to just back out my change and go back to Ed's previous version I'm Ok with that. Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ --------------030606070107020804080600 Content-Type: text/plain; name="fix-nsswitch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-nsswitch.diff" Index: Makefile =================================================================== --- Makefile (revision 224688) +++ Makefile (working copy) @@ -256,6 +256,10 @@ ${DESTDIR}/boot/device.hints .endif .endif +.if ${MK_NIS} == "no" + sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \ + ${DESTDIR}/etc/nsswitch.conf +.endif distrib-dirs: mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/ Index: nsswitch.conf =================================================================== --- nsswitch.conf (revision 224688) +++ nsswitch.conf (working copy) @@ -1,23 +1,15 @@ # +# nsswitch.conf(5) - name service switch configuration file # $FreeBSD$ # -# To enable NIS the commented entries should replace their uncommented -# equivalents. See nsswitch.conf(5) for more information. -# -group: files -#group_compat: nis -#group: compat - -passwd: files -#passwd_compat: nis -#passwd: compat - -services: files -#services_compat: nis -#services: compat - +group: compat +group_compat: nis hosts: files dns networks: files +passwd: compat +passwd_compat: nis shells: files +services: compat +services_compat: nis protocols: files rpc: files --------------030606070107020804080600-- From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 20:53:34 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BB39106564A; Tue, 9 Aug 2011 20:53:34 +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 3C12D8FC17; Tue, 9 Aug 2011 20:53:34 +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 p79KrYKe011538; Tue, 9 Aug 2011 20:53:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79KrYt3011536; Tue, 9 Aug 2011 20:53:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108092053.p79KrYt3011536@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 9 Aug 2011 20:53:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224743 - head/sys/fs/devfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 20:53:34 -0000 Author: kib Date: Tue Aug 9 20:53:33 2011 New Revision: 224743 URL: http://svn.freebsd.org/changeset/base/224743 Log: Do not update mountpoint generation counter to the value which was not yet acted upon by devfs_populate(). Submitted by: Kohji Okuno Approved by: re (bz) MFC after: 1 week Modified: head/sys/fs/devfs/devfs_devs.c Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Tue Aug 9 20:52:12 2011 (r224742) +++ head/sys/fs/devfs/devfs_devs.c Tue Aug 9 20:53:33 2011 (r224743) @@ -630,13 +630,15 @@ devfs_populate_loop(struct devfs_mount * void devfs_populate(struct devfs_mount *dm) { + unsigned gen; sx_assert(&dm->dm_lock, SX_XLOCKED); - if (dm->dm_generation == devfs_generation) + gen = devfs_generation; + if (dm->dm_generation == gen) return; while (devfs_populate_loop(dm, 0)) continue; - dm->dm_generation = devfs_generation; + dm->dm_generation = gen; } /* From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 20:55:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77CE6106566B; Tue, 9 Aug 2011 20:55:54 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 683A98FC0A; Tue, 9 Aug 2011 20:55: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 p79Kts3k011700; Tue, 9 Aug 2011 20:55:54 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79KtsSf011698; Tue, 9 Aug 2011 20:55:54 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201108092055.p79KtsSf011698@svn.freebsd.org> From: Attilio Rao Date: Tue, 9 Aug 2011 20:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224745 - head/sys/dev/ichsmb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 20:55:54 -0000 Author: attilio Date: Tue Aug 9 20:55:54 2011 New Revision: 224745 URL: http://svn.freebsd.org/changeset/base/224745 Log: Revert r224736 as the introduced value was already present. Reported by: tinderbox, pluknet Approved by: re (kib) Modified: head/sys/dev/ichsmb/ichsmb_pci.c Modified: head/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- head/sys/dev/ichsmb/ichsmb_pci.c Tue Aug 9 20:54:00 2011 (r224744) +++ head/sys/dev/ichsmb/ichsmb_pci.c Tue Aug 9 20:55:54 2011 (r224745) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include /* PCI unique identifiers */ -#define ID_PCH_DH89XXCC 0x23308086 #define ID_82801AA 0x24138086 #define ID_82801AB 0x24238086 #define ID_82801BA 0x24438086 @@ -170,7 +169,6 @@ ichsmb_pci_probe(device_t dev) case ID_82801JI: device_set_desc(dev, "Intel 82801JI (ICH10) SMBus controller"); break; - case ID_PCH_DH89XXCC: case ID_PCH: device_set_desc(dev, "Intel PCH SMBus controller"); break; From owner-svn-src-head@FreeBSD.ORG Tue Aug 9 21:01:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B35B106564A; Tue, 9 Aug 2011 21:01:37 +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 486F58FC16; Tue, 9 Aug 2011 21:01: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 p79L1bQT011932; Tue, 9 Aug 2011 21:01:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79L1b2R011923; Tue, 9 Aug 2011 21:01:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108092101.p79L1b2R011923@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 9 Aug 2011 21:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224746 - in head/sys: amd64/amd64 arm/arm i386/i386 i386/xen ia64/ia64 mips/mips powerpc/aim powerpc/booke powerpc/include sparc64/sparc64 vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 21:01:37 -0000 Author: kib Date: Tue Aug 9 21:01:36 2011 New Revision: 224746 URL: http://svn.freebsd.org/changeset/base/224746 Log: - Move the PG_UNMANAGED flag from m->flags to m->oflags, renaming the flag to VPO_UNMANAGED (and also making the flag protected by the vm object lock, instead of vm page queue lock). - Mark the fake pages with both PG_FICTITIOUS (as it is now) and VPO_UNMANAGED. As a consequence, pmap code now can use use just VPO_UNMANAGED to decide whether the page is unmanaged. Reviewed by: alc Tested by: pho (x86, previous version), marius (sparc64), marcel (arm, ia64, powerpc), ray (mips) Sponsored by: The FreeBSD Foundation Approved by: re (bz) Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/ia64/ia64/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/include/pmap.h head/sys/sparc64/sparc64/pmap.c head/sys/sparc64/sparc64/tsb.c head/sys/vm/vm_kern.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Aug 9 20:55:54 2011 (r224745) +++ head/sys/amd64/amd64/pmap.c Tue Aug 9 21:01:36 2011 (r224746) @@ -2320,7 +2320,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse va_last = va + NBPDR - PAGE_SIZE; do { m++; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_pv_demote_pde: page %p is not managed", m)); va += PAGE_SIZE; pmap_insert_entry(pmap, va, m); @@ -2847,7 +2847,7 @@ pmap_remove_all(vm_page_t m) vm_offset_t va; vm_page_t free; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); free = NULL; vm_page_lock_queues(); @@ -3194,8 +3194,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%lx)", va)); - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || - (m->oflags & VPO_BUSY) != 0, + KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 || + VM_OBJECT_LOCKED(m->object), ("pmap_enter: page %p is not busy", m)); mpte = NULL; @@ -3276,7 +3276,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, /* * Enter on the PV list if part of our managed memory. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); if (pv == NULL) @@ -3389,7 +3389,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t } newpde = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 1) | PG_PS | PG_V; - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) { newpde |= PG_MANAGED; /* @@ -3498,7 +3498,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ vm_paddr_t pa; KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || - (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0, + (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); mtx_assert(&vm_page_queue_mtx, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -3556,7 +3556,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ /* * Enter on the PV list if part of our managed memory. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0 && + if ((m->oflags & VPO_UNMANAGED) == 0 && !pmap_try_insert_pv_entry(pmap, va, m)) { if (mpte != NULL) { free = NULL; @@ -3581,7 +3581,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ /* * Now validate mapping with RO protection */ - if (m->flags & (PG_FICTITIOUS|PG_UNMANAGED)) + if ((m->oflags & VPO_UNMANAGED) != 0) pte_store(pte, pa | PG_V | PG_U); else pte_store(pte, pa | PG_V | PG_U | PG_MANAGED); @@ -3958,7 +3958,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p int loops = 0; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; vm_page_lock_queues(); @@ -3999,7 +3999,7 @@ pmap_page_wired_mappings(vm_page_t m) int count; count = 0; - if ((m->flags & PG_FICTITIOUS) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0) return (count); vm_page_lock_queues(); count = pmap_pvh_wired_mappings(&m->md, count); @@ -4041,7 +4041,7 @@ pmap_page_is_mapped(vm_page_t m) { boolean_t rv; - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0) return (FALSE); vm_page_lock_queues(); rv = !TAILQ_EMPTY(&m->md.pv_list) || @@ -4199,7 +4199,7 @@ pmap_is_modified(vm_page_t m) { boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_modified: page %p is not managed", m)); /* @@ -4280,7 +4280,7 @@ pmap_is_referenced(vm_page_t m) { boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_referenced: page %p is not managed", m)); vm_page_lock_queues(); rv = pmap_is_referenced_pvh(&m->md) || @@ -4328,7 +4328,7 @@ pmap_remove_write(vm_page_t m) pt_entry_t oldpte, *pte; vm_offset_t va; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); /* @@ -4397,7 +4397,7 @@ pmap_ts_referenced(vm_page_t m) vm_offset_t va; int rtval = 0; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_ts_referenced: page %p is not managed", m)); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); vm_page_lock_queues(); @@ -4471,7 +4471,7 @@ pmap_clear_modify(vm_page_t m) pt_entry_t oldpte, *pte; vm_offset_t va; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); KASSERT((m->oflags & VPO_BUSY) == 0, @@ -4548,7 +4548,7 @@ pmap_clear_reference(vm_page_t m) pt_entry_t *pte; vm_offset_t va; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_reference: page %p is not managed", m)); vm_page_lock_queues(); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Tue Aug 9 20:55:54 2011 (r224745) +++ head/sys/arm/arm/pmap.c Tue Aug 9 21:01:36 2011 (r224746) @@ -3120,7 +3120,7 @@ pmap_remove_all(vm_page_t m) pmap_t curpm; int flags = 0; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); if (TAILQ_EMPTY(&m->md.pv_list)) return; @@ -3242,7 +3242,7 @@ pmap_protect(pmap_t pm, vm_offset_t sva, PTE_SYNC(ptep); if (pg != NULL) { - if (!(pg->flags & PG_UNMANAGED)) { + if (!(pg->oflags & VPO_UNMANAGED)) { f = pmap_modify_pv(pg, pm, sva, PVF_WRITE, 0); vm_page_dirty(pg); @@ -3327,8 +3327,8 @@ pmap_enter_locked(pmap_t pmap, vm_offset pa = systempage.pv_pa; m = NULL; } else { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || - (m->oflags & VPO_BUSY) != 0 || (flags & M_NOWAIT) != 0, + KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 || + (flags & M_NOWAIT) != 0, ("pmap_enter_locked: page %p is not busy", m)); pa = VM_PAGE_TO_PHYS(m); } @@ -3417,7 +3417,7 @@ do_l2b_alloc: if (prot & VM_PROT_WRITE) { npte |= L2_S_PROT_W; if (m != NULL && - (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) + (m->oflags & VPO_UNMANAGED) == 0) vm_page_flag_set(m, PG_WRITEABLE); } npte |= pte_l2_s_cache_mode; @@ -3480,36 +3480,36 @@ do_l2b_alloc: * this physical page is not/is already mapped. */ - if (m && ((m->flags & PG_FICTITIOUS) || - ((m->flags & PG_UNMANAGED) && + if (m && (m->oflags & VPO_UNMANAGED) && !m->md.pv_kva && - TAILQ_EMPTY(&m->md.pv_list)))) { + TAILQ_EMPTY(&m->md.pv_list)) { pmap_free_pv_entry(pve); pve = NULL; } - } else if (m && !(m->flags & PG_FICTITIOUS) && - (!(m->flags & PG_UNMANAGED) || m->md.pv_kva || + } else if (m && + (!(m->oflags & VPO_UNMANAGED) || m->md.pv_kva || !TAILQ_EMPTY(&m->md.pv_list))) pve = pmap_get_pv_entry(); - } else if (m && !(m->flags & PG_FICTITIOUS) && - (!(m->flags & PG_UNMANAGED) || m->md.pv_kva || + } else if (m && + (!(m->oflags & VPO_UNMANAGED) || m->md.pv_kva || !TAILQ_EMPTY(&m->md.pv_list))) pve = pmap_get_pv_entry(); - if (m && !(m->flags & PG_FICTITIOUS)) { - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, - ("pmap_enter: managed mapping within the clean submap")); - if (m->flags & PG_UNMANAGED) { + if (m) { + if ((m->oflags & VPO_UNMANAGED)) { if (!TAILQ_EMPTY(&m->md.pv_list) || - m->md.pv_kva) { + m->md.pv_kva) { KASSERT(pve != NULL, ("No pv")); nflags |= PVF_UNMAN; pmap_enter_pv(m, pve, pmap, va, nflags); } else m->md.pv_kva = va; } else { - KASSERT(pve != NULL, ("No pv")); - pmap_enter_pv(m, pve, pmap, va, nflags); + KASSERT(va < kmi.clean_sva || + va >= kmi.clean_eva, + ("pmap_enter: managed mapping within the clean submap")); + KASSERT(pve != NULL, ("No pv")); + pmap_enter_pv(m, pve, pmap, va, nflags); } } } @@ -4423,7 +4423,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p int loops = 0; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; vm_page_lock_queues(); @@ -4453,7 +4453,7 @@ pmap_page_wired_mappings(vm_page_t m) int count; count = 0; - if ((m->flags & PG_FICTITIOUS) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0) return (count); vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) @@ -4472,7 +4472,7 @@ int pmap_ts_referenced(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_ts_referenced: page %p is not managed", m)); return (pmap_clearbit(m, PVF_REF)); } @@ -4482,7 +4482,7 @@ boolean_t pmap_is_modified(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_modified: page %p is not managed", m)); if (m->md.pvh_attrs & PVF_MOD) return (TRUE); @@ -4498,7 +4498,7 @@ void pmap_clear_modify(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); KASSERT((m->oflags & VPO_BUSY) == 0, @@ -4526,7 +4526,7 @@ boolean_t pmap_is_referenced(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_referenced: page %p is not managed", m)); return ((m->md.pvh_attrs & PVF_REF) != 0); } @@ -4540,7 +4540,7 @@ void pmap_clear_reference(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_reference: page %p is not managed", m)); if (m->md.pvh_attrs & PVF_REF) pmap_clearbit(m, PVF_REF); @@ -4554,7 +4554,7 @@ void pmap_remove_write(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); /* Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Aug 9 20:55:54 2011 (r224745) +++ head/sys/i386/i386/pmap.c Tue Aug 9 21:01:36 2011 (r224746) @@ -2400,7 +2400,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse va_last = va + NBPDR - PAGE_SIZE; do { m++; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_pv_demote_pde: page %p is not managed", m)); va += PAGE_SIZE; pmap_insert_entry(pmap, va, m); @@ -2927,7 +2927,7 @@ pmap_remove_all(vm_page_t m) vm_offset_t va; vm_page_t free; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); free = NULL; vm_page_lock_queues(); @@ -3299,8 +3299,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)", va)); - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || - (m->oflags & VPO_BUSY) != 0, + KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 || + VM_OBJECT_LOCKED(m->object), ("pmap_enter: page %p is not busy", m)); mpte = NULL; @@ -3388,7 +3388,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, /* * Enter on the PV list if part of our managed memory. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); if (pv == NULL) @@ -3498,7 +3498,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t } newpde = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 1) | PG_PS | PG_V; - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) { newpde |= PG_MANAGED; /* @@ -3604,7 +3604,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ vm_page_t free; KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || - (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0, + (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); mtx_assert(&vm_page_queue_mtx, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -3667,7 +3667,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ /* * Enter on the PV list if part of our managed memory. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0 && + if ((m->oflags & VPO_UNMANAGED) == 0 && !pmap_try_insert_pv_entry(pmap, va, m)) { if (mpte != NULL) { free = NULL; @@ -3695,7 +3695,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ /* * Now validate mapping with RO protection */ - if (m->flags & (PG_FICTITIOUS|PG_UNMANAGED)) + if ((m->oflags & VPO_UNMANAGED) != 0) pte_store(pte, pa | PG_V | PG_U); else pte_store(pte, pa | PG_V | PG_U | PG_MANAGED); @@ -4096,7 +4096,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p int loops = 0; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; vm_page_lock_queues(); @@ -4137,7 +4137,7 @@ pmap_page_wired_mappings(vm_page_t m) int count; count = 0; - if ((m->flags & PG_FICTITIOUS) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0) return (count); vm_page_lock_queues(); count = pmap_pvh_wired_mappings(&m->md, count); @@ -4181,7 +4181,7 @@ pmap_page_is_mapped(vm_page_t m) { boolean_t rv; - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0) return (FALSE); vm_page_lock_queues(); rv = !TAILQ_EMPTY(&m->md.pv_list) || @@ -4341,7 +4341,7 @@ pmap_is_modified(vm_page_t m) { boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_modified: page %p is not managed", m)); /* @@ -4424,7 +4424,7 @@ pmap_is_referenced(vm_page_t m) { boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_referenced: page %p is not managed", m)); vm_page_lock_queues(); rv = pmap_is_referenced_pvh(&m->md) || @@ -4474,7 +4474,7 @@ pmap_remove_write(vm_page_t m) pt_entry_t oldpte, *pte; vm_offset_t va; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); /* @@ -4550,7 +4550,7 @@ pmap_ts_referenced(vm_page_t m) vm_offset_t va; int rtval = 0; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_ts_referenced: page %p is not managed", m)); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); vm_page_lock_queues(); @@ -4626,7 +4626,7 @@ pmap_clear_modify(vm_page_t m) pt_entry_t oldpte, *pte; vm_offset_t va; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); KASSERT((m->oflags & VPO_BUSY) == 0, @@ -4715,7 +4715,7 @@ pmap_clear_reference(vm_page_t m) pt_entry_t *pte; vm_offset_t va; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_reference: page %p is not managed", m)); vm_page_lock_queues(); sched_pin(); Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Tue Aug 9 20:55:54 2011 (r224745) +++ head/sys/i386/xen/pmap.c Tue Aug 9 21:01:36 2011 (r224746) @@ -2430,7 +2430,7 @@ pmap_remove_all(vm_page_t m) pt_entry_t *pte, tpte; vm_page_t free; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); free = NULL; vm_page_lock_queues(); @@ -2616,8 +2616,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)", va)); - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || - (m->oflags & VPO_BUSY) != 0, + KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0, ("pmap_enter: page %p is not busy", m)); mpte = NULL; @@ -2715,7 +2714,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, /* * Enter on the PV list if part of our managed memory. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); if (pv == NULL) @@ -2915,7 +2914,7 @@ pmap_enter_quick_locked(multicall_entry_ multicall_entry_t *mcl = *mclpp; KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || - (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0, + (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); mtx_assert(&vm_page_queue_mtx, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -2979,7 +2978,7 @@ pmap_enter_quick_locked(multicall_entry_ /* * Enter on the PV list if part of our managed memory. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0 && + if ((m->oflags & VPO_UNMANAGED) == 0 && !pmap_try_insert_pv_entry(pmap, va, m)) { if (mpte != NULL) { free = NULL; @@ -3008,7 +3007,7 @@ pmap_enter_quick_locked(multicall_entry_ /* * Now validate mapping with RO protection */ - if (m->flags & (PG_FICTITIOUS|PG_UNMANAGED)) + if ((m->oflags & VPO_UNMANAGED) != 0) pte_store(pte, pa | PG_V | PG_U); else pte_store(pte, pa | PG_V | PG_U | PG_MANAGED); @@ -3016,7 +3015,7 @@ pmap_enter_quick_locked(multicall_entry_ /* * Now validate mapping with RO protection */ - if (m->flags & (PG_FICTITIOUS|PG_UNMANAGED)) + if ((m->oflags & VPO_UNMANAGED) != 0) pa = xpmap_ptom(pa | PG_V | PG_U); else pa = xpmap_ptom(pa | PG_V | PG_U | PG_MANAGED); @@ -3403,7 +3402,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p int loops = 0; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; vm_page_lock_queues(); @@ -3435,7 +3434,7 @@ pmap_page_wired_mappings(vm_page_t m) int count; count = 0; - if ((m->flags & PG_FICTITIOUS) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0) return (count); vm_page_lock_queues(); sched_pin(); @@ -3461,7 +3460,7 @@ pmap_page_is_mapped(vm_page_t m) { boolean_t rv; - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0) return (FALSE); vm_page_lock_queues(); rv = !TAILQ_EMPTY(&m->md.pv_list) || @@ -3600,7 +3599,7 @@ pmap_is_modified(vm_page_t m) pmap_t pmap; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_modified: page %p is not managed", m)); rv = FALSE; @@ -3671,7 +3670,7 @@ pmap_is_referenced(vm_page_t m) pmap_t pmap; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_referenced: page %p is not managed", m)); rv = FALSE; vm_page_lock_queues(); @@ -3732,7 +3731,7 @@ pmap_remove_write(vm_page_t m) pmap_t pmap; pt_entry_t oldpte, *pte; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); /* @@ -3798,7 +3797,7 @@ pmap_ts_referenced(vm_page_t m) pt_entry_t *pte; int rtval = 0; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_ts_referenced: page %p is not managed", m)); vm_page_lock_queues(); sched_pin(); @@ -3840,7 +3839,7 @@ pmap_clear_modify(vm_page_t m) pmap_t pmap; pt_entry_t *pte; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); KASSERT((m->oflags & VPO_BUSY) == 0, @@ -3886,7 +3885,7 @@ pmap_clear_reference(vm_page_t m) pmap_t pmap; pt_entry_t *pte; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_reference: page %p is not managed", m)); vm_page_lock_queues(); sched_pin(); Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Tue Aug 9 20:55:54 2011 (r224745) +++ head/sys/ia64/ia64/pmap.c Tue Aug 9 21:01:36 2011 (r224746) @@ -1442,7 +1442,7 @@ pmap_remove_all(vm_page_t m) pmap_t oldpmap; pv_entry_t pv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); vm_page_lock_queues(); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { @@ -1548,8 +1548,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, va &= ~PAGE_MASK; KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || - (m->oflags & VPO_BUSY) != 0, + KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0, ("pmap_enter: page %p is not busy", m)); /* @@ -1619,7 +1618,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, /* * Enter on the PV list if part of our managed memory. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); pmap_insert_entry(pmap, va, m); @@ -1720,7 +1719,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ boolean_t managed; KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || - (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0, + (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); mtx_assert(&vm_page_queue_mtx, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -1730,7 +1729,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ if (!pmap_present(pte)) { /* Enter on the PV list if the page is managed. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) { if (!pmap_try_insert_pv_entry(pmap, va, m)) { pmap_free_pte(pte, va); return; @@ -1900,7 +1899,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p int loops = 0; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; vm_page_lock_queues(); @@ -1932,7 +1931,7 @@ pmap_page_wired_mappings(vm_page_t m) int count; count = 0; - if ((m->flags & PG_FICTITIOUS) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0) return (count); vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2010,7 +2009,7 @@ pmap_ts_referenced(vm_page_t m) pv_entry_t pv; int count = 0; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_ts_referenced: page %p is not managed", m)); vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2044,7 +2043,7 @@ pmap_is_modified(vm_page_t m) pv_entry_t pv; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_modified: page %p is not managed", m)); rv = FALSE; @@ -2104,7 +2103,7 @@ pmap_is_referenced(vm_page_t m) pv_entry_t pv; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_referenced: page %p is not managed", m)); rv = FALSE; vm_page_lock_queues(); @@ -2133,7 +2132,7 @@ pmap_clear_modify(vm_page_t m) pmap_t oldpmap; pv_entry_t pv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); KASSERT((m->oflags & VPO_BUSY) == 0, @@ -2174,7 +2173,7 @@ pmap_clear_reference(vm_page_t m) pmap_t oldpmap; pv_entry_t pv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_reference: page %p is not managed", m)); vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2203,7 +2202,7 @@ pmap_remove_write(vm_page_t m) pv_entry_t pv; vm_prot_t prot; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); /* Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Aug 9 20:55:54 2011 (r224745) +++ head/sys/mips/mips/pmap.c Tue Aug 9 21:01:36 2011 (r224746) @@ -1708,7 +1708,7 @@ pmap_remove_all(vm_page_t m) pv_entry_t pv; pt_entry_t *pte, tpte; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); vm_page_lock_queues(); @@ -1863,8 +1863,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, va &= ~PAGE_MASK; KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || - (m->oflags & VPO_BUSY) != 0, + KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0, ("pmap_enter: page %p is not busy", m)); mpte = NULL; @@ -1952,7 +1951,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, * raise IPL while manipulating pv_table since pmap_enter can be * called at interrupt time. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); if (pv == NULL) @@ -2067,7 +2066,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ vm_paddr_t pa; KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || - (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0, + (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); mtx_assert(&vm_page_queue_mtx, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -2129,7 +2128,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ /* * Enter on the PV list if part of our managed memory. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0 && + if ((m->oflags & VPO_UNMANAGED) == 0 && !pmap_try_insert_pv_entry(pmap, mpte, va, m)) { if (mpte != NULL) { pmap_unwire_pte_hold(pmap, va, mpte); @@ -2464,7 +2463,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p int loops = 0; boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; vm_page_lock_queues(); @@ -2558,7 +2557,7 @@ pmap_testbit(vm_page_t m, int bit) pt_entry_t *pte; boolean_t rv = FALSE; - if (m->flags & PG_FICTITIOUS) + if (m->oflags & VPO_UNMANAGED) return (rv); if (TAILQ_FIRST(&m->md.pv_list) == NULL) @@ -2585,7 +2584,7 @@ pmap_changebit(vm_page_t m, int bit, boo pv_entry_t pv; pt_entry_t *pte; - if (m->flags & PG_FICTITIOUS) + if (m->oflags & VPO_UNMANAGED) return; mtx_assert(&vm_page_queue_mtx, MA_OWNED); @@ -2634,7 +2633,7 @@ pmap_page_wired_mappings(vm_page_t m) int count; count = 0; - if ((m->flags & PG_FICTITIOUS) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0) return (count); vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2659,7 +2658,7 @@ pmap_remove_write(vm_page_t m) vm_offset_t va; pt_entry_t *pte; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); /* @@ -2699,7 +2698,7 @@ int pmap_ts_referenced(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_ts_referenced: page %p is not managed", m)); if (m->md.pv_flags & PV_TABLE_REF) { vm_page_lock_queues(); @@ -2721,7 +2720,7 @@ pmap_is_modified(vm_page_t m) { boolean_t rv; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_modified: page %p is not managed", m)); /* @@ -2775,7 +2774,7 @@ void pmap_clear_modify(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); KASSERT((m->oflags & VPO_BUSY) == 0, @@ -2806,7 +2805,7 @@ boolean_t pmap_is_referenced(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_referenced: page %p is not managed", m)); return ((m->md.pv_flags & PV_TABLE_REF) != 0); } @@ -2820,7 +2819,7 @@ void pmap_clear_reference(vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_reference: page %p is not managed", m)); vm_page_lock_queues(); if (m->md.pv_flags & PV_TABLE_REF) { @@ -3168,7 +3167,7 @@ page_is_managed(vm_paddr_t pa) m = PHYS_TO_VM_PAGE(pa); if (m == NULL) return (0); - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) + if ((m->oflags & VPO_UNMANAGED) == 0) return (1); } return (0); @@ -3181,7 +3180,7 @@ init_pte_prot(vm_offset_t va, vm_page_t if (!(prot & VM_PROT_WRITE)) rw = PTE_V | PTE_RO | PTE_C_CACHE; - else if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + else if ((m->oflags & VPO_UNMANAGED) == 0) { if ((m->md.pv_flags & PV_TABLE_MOD) != 0) rw = PTE_V | PTE_D | PTE_C_CACHE; else Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Tue Aug 9 20:55:54 2011 (r224745) +++ head/sys/powerpc/aim/mmu_oea.c Tue Aug 9 21:01:36 2011 (r224746) @@ -1073,12 +1073,12 @@ moea_enter_locked(pmap_t pmap, vm_offset if (pmap_bootstrapped) mtx_assert(&vm_page_queue_mtx, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || - (m->oflags & VPO_BUSY) != 0 || VM_OBJECT_LOCKED(m->object), + KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 || + VM_OBJECT_LOCKED(m->object), ("moea_enter_locked: page %p is not busy", m)); /* XXX change the pvo head for fake pages */ - if ((m->flags & PG_FICTITIOUS) == PG_FICTITIOUS) { + if ((m->oflags & VPO_UNMANAGED) != 0) { pvo_flags &= ~PVO_MANAGED; pvo_head = &moea_pvo_kunmanaged; zone = moea_upvo_zone; @@ -1088,7 +1088,7 @@ moea_enter_locked(pmap_t pmap, vm_offset * If this is a managed page, and it's the first reference to the page, * clear the execness of the page. Otherwise fetch the execness. */ - if ((pg != NULL) && ((m->flags & PG_FICTITIOUS) == 0)) { + if ((pg != NULL) && ((m->oflags & VPO_UNMANAGED) == 0)) { if (LIST_EMPTY(pvo_head)) { moea_attr_clear(pg, PTE_EXEC); } else { @@ -1101,7 +1101,7 @@ moea_enter_locked(pmap_t pmap, vm_offset if (prot & VM_PROT_WRITE) { pte_lo |= PTE_BW; if (pmap_bootstrapped && - (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) + (m->oflags & VPO_UNMANAGED) == 0) vm_page_flag_set(m, PG_WRITEABLE); } else pte_lo |= PTE_BR; @@ -1112,9 +1112,6 @@ moea_enter_locked(pmap_t pmap, vm_offset if (wired) pvo_flags |= PVO_WIRED; - if ((m->flags & PG_FICTITIOUS) != 0) - pvo_flags |= PVO_FAKE; - error = moea_pvo_enter(pmap, zone, pvo_head, va, VM_PAGE_TO_PHYS(m), pte_lo, pvo_flags); @@ -1245,7 +1242,7 @@ boolean_t moea_is_referenced(mmu_t mmu, vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea_is_referenced: page %p is not managed", m)); return (moea_query_bit(m, PTE_REF)); } @@ -1254,7 +1251,7 @@ boolean_t moea_is_modified(mmu_t mmu, vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea_is_modified: page %p is not managed", m)); /* @@ -1286,7 +1283,7 @@ void moea_clear_reference(mmu_t mmu, vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea_clear_reference: page %p is not managed", m)); moea_clear_bit(m, PTE_REF); } @@ -1295,7 +1292,7 @@ void moea_clear_modify(mmu_t mmu, vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea_clear_modify: page %p is not managed", m)); VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); KASSERT((m->oflags & VPO_BUSY) == 0, @@ -1322,7 +1319,7 @@ moea_remove_write(mmu_t mmu, vm_page_t m pmap_t pmap; u_int lo; - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea_remove_write: page %p is not managed", m)); /* @@ -1379,7 +1376,7 @@ boolean_t moea_ts_referenced(mmu_t mmu, vm_page_t m) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0, + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("moea_ts_referenced: page %p is not managed", m)); return (moea_clear_bit(m, PTE_REF)); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 06:17:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B7331065673; Wed, 10 Aug 2011 06:17:06 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C2BB8FC1B; Wed, 10 Aug 2011 06:17:06 +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 p7A6H6Fs028272; Wed, 10 Aug 2011 06:17:06 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7A6H68p028270; Wed, 10 Aug 2011 06:17:06 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201108100617.p7A6H68p028270@svn.freebsd.org> From: Kevin Lo Date: Wed, 10 Aug 2011 06:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224747 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 06:17:06 -0000 Author: kevlo Date: Wed Aug 10 06:17:06 2011 New Revision: 224747 URL: http://svn.freebsd.org/changeset/base/224747 Log: If RTF_HOST flag is specified, then we are interested in destination address. PR: kern/159600 Submitted by: Svatopluk Kraus Approved by: re (hrs) Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Aug 9 21:01:36 2011 (r224746) +++ head/sys/netinet/in.c Wed Aug 10 06:17:06 2011 (r224747) @@ -1037,7 +1037,7 @@ in_addprefix(struct in_ifaddr *target, i IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (rtinitflags(ia)) { - p = ia->ia_addr.sin_addr; + p = ia->ia_dstaddr.sin_addr; if (prefix.s_addr != p.s_addr) continue; From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 10:38:31 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 95CD41065672; Wed, 10 Aug 2011 10:38:31 +0000 (UTC) Date: Wed, 10 Aug 2011 10:38:31 +0000 From: Alexander Best To: Bruce Evans Message-ID: <20110810103831.GA60858@freebsd.org> References: <201108082036.p78KarlR062810@svn.freebsd.org> <20110809105824.P896@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110809105824.P896@besplex.bde.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Jonathan Anderson Subject: Re: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 10:38:31 -0000 On Tue Aug 9 11, Bruce Evans wrote: > On Mon, 8 Aug 2011, Jonathan Anderson wrote: > > >Log: > > Create timeval2timespec() and timespec2timeval(). > > > > These functions will be used by process descriptors to convert process > > creation time into process descriptor [acm]time. > > These were intentionally left out. > > What is wrong with the existing APIs TIMEVAL_TO_TIMESPEC() and > TIMESPEC_TO_TIMEVAL(), which are used for these conversions by almost > everything now? Well, quite a bit is wrong with them, starting with > the loudness of their names, but not including a twee spelling of "to" > in their names. The main bugs in them is that they give undocumented > APIs and namespace pollution in userland and undocumented APIs in the > kernel. any reason {TIMEVAL,TIMESPEC}_TO_{TIMESPEC,TIMEVAL}()s code is being executed in a do { ... } while (0) conditional loop? both macros are also defined in crypto/openssh/defines.h and don't seem to need that extra one-time-loop. cheers. alex > > > Approved by: re (kib), mentor (rwatson) > > Suggested by: jhb > > Should know better. > > >Modified: head/sys/sys/time.h > >============================================================================== > >--- head/sys/sys/time.h Mon Aug 8 19:03:26 2011 (r224720) > >+++ head/sys/sys/time.h Mon Aug 8 20:36:52 2011 (r224721) > >@@ -195,6 +195,24 @@ timeval2bintime(const struct timeval *tv > > ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ > > ((tvp)->tv_sec cmp (uvp)->tv_sec)) > > > >+/* Conversion between timespec and timeval. */ > >+ > >+static __inline void > >+timeval2timespec(const struct timeval *tv, struct timespec *ts) > >+{ > >+ > >+ ts->tv_sec = tv->tv_sec; > >+ ts->tv_nsec = 1000 * tv->tv_usec; > >+} > >+ > >+static __inline void > >+timespec2timeval(const struct timespec *ts, struct timeval *tv) > >+{ > >+ > >+ tv->tv_sec = ts->tv_sec; > >+ tv->tv_usec = ts->tv_nsec / 1000; > >+} > >+ > >/* timevaladd and timevalsub are not inlined */ > > > >#endif /* _KERNEL */ > > These are in the _KERNEL section, so they don't pollute userland. > Otherwise, the pollution would consist of 2 function names, 2 parameter > names and possibly 1 struct member names (I think tv_sec and tv_usec > are reserved in , but perhaps timespecs and tv_nsec are > not, since is mainly for old timeval interfaces. This > is another reason why the implementation of timespec conversions belongs > in where they already are and not in ). > > Style bugs in these include: > - use of inline functions instead of macros. Macros are used for all the > other APIs in this section. Using macros would limit the namespace > pollution. E.g., it keeps parameter names out of other namespaces. > - not using Hungrarian notation for pointers. Names of pointers are spelled > with a trailing p in all other APIs in this section. > > sys/time.h has mounds of older implementation bugs. The bintime section > is especially bad. The following is mostly about buigs in the non-_KERNEL > sections. > > 1) Userland pollution in starts with everything in > . > 2) Then there is everything in . The only pollution is > the undocumented TIMEPSEC conversion macros mentioned above (these > are conditional on __BSD_VISIBLE). > 4) Then there is struct timezone and its members. > 5) Then there is DST_* for using tz_dsttime. > 6) Then there is mounds of pollution from struct bintime and its APIs. > This is conditional on __BSD_VISIBLE. Most of the bintime APIs are > undocumented. (zgrep -r bintime in /usr/share/man gives many hits, > while zgrep -r TIMESPEC in /usr/share/man gives zero hits, but most > of the hits for bintime are in peripheral man pages and bintime(9); > bintime(9) only documents the highest level of bintime APIs, leaving > all of the arithmetic and conversion APIs undocumented.) > > Inlines instead of macros are used to implement most of the bintime > APIs. This gives the following undocumented pollution: > - bintime struct tag name 'bintime' > - bintime struct member names 'sec' and 'frac'. These are especially > bad since they are missing a prefix. > - all the API names > - all the parameter names: bt, x, bt2, ts, tv. Of course, these are > also missing Hungrarian notation. > - all the local variable names: u. > 7) Then there is mounds of documented pollution for the NetBSD/OpenBSD > compatibility APIs. These are not under __BSD_VISIBLE, so they are > pure pollution. These were obsolete before they were born, since they > are only for timevals. The kernel has always had equivalent interfaces, > but they were intentionally left out of userland. Then they came back > :-(. > But they are documented, and they implemented using macros so they are > missing the namespace pollution for parameter and local variable names, > and their parameter names are spelled in Hungrarian notations, so they > are missing most of the bugs described in this mail. > > FreeBSD still doesn't have the corresponding mistakes for manipulating > timespecs. You just have to manipulate timespecs for yourself, like > you should have to do for timevals too. I prefer to convert everything > to floating point (int64_t has been usable too, ever since C99 > standardized it). It is easier to multiply by 1e-6 to convert seconds > to microseconds than to remember the nonstandard APIs that manipulate > timespecs as timespecs. The timespec manipulation APIs may or may > not be faster than floating point calculations, depending on whether > the branches in them are faster than non-branchy FP code, but it is > hard to think if situations where the efficiency matters. Most uses > of the NetBSD APIs are for manipulating timeouts for things like > setitimer(2) where the syscall overcall dominates. > 8) Then there is the itimer section. This is POSIX, so it is actually > permitted in this file! > 9) Then there is the clockinfo section. This is pure nonstandard pollution. > It is only partially documented (in sysctl(3)). > 10) Then there is the POSIX timer section (CLOCK_REALTIME... and > TIMER_ABSTIME...). This is POSIX, but is not properly ifdefed for the > versions of POSIX that support it. > 11) Then there is everything in . The structure of vs > is still sort of backwards. This bug became more serious when > POSIX started specifying in 2001 (old versions of POSIX > didn't have timevals. Then in 2001, POSIX specified all the old timeval > APIs that it had intentionally left out in 1988, and is the > home for them in POSIX. But POSIX doesn't specifiy all of the other > pollution that is traditional or has accrufted in ). > 12) Finally, there is a section that declares prototypes of user APIs. This > is mostly correct (properly ifdefed). > > Bruce From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 13:19:53 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E474B106566B; Wed, 10 Aug 2011 13:19:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id A3C078FC0C; Wed, 10 Aug 2011 13:19:53 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:4cdf:3c74:f81e:a1a7] (unknown [IPv6:2001:7b8:3a7:0:4cdf:3c74:f81e:a1a7]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 96B965C59; Wed, 10 Aug 2011 15:19:52 +0200 (CEST) Message-ID: <4E428581.4050803@FreeBSD.org> Date: Wed, 10 Aug 2011 15:20:01 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Alexander Best References: <201108082036.p78KarlR062810@svn.freebsd.org> <20110809105824.P896@besplex.bde.org> <20110810103831.GA60858@freebsd.org> In-Reply-To: <20110810103831.GA60858@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Jonathan Anderson , Bruce Evans Subject: Re: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 13:19:54 -0000 On 2011-08-10 12:38, Alexander Best wrote: ... > any reason {TIMEVAL,TIMESPEC}_TO_{TIMESPEC,TIMEVAL}()s code is being executed > in a > > do { ... } while (0) > > conditional loop? both macros are also defined in crypto/openssh/defines.h and > don't seem to need that extra one-time-loop. It's a very common C idiom. See: http://stackoverflow.com/questions/154136/why-are-there-sometimes-meaningless-do-while-and-if-else-statements-in-c-c-macr From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 13:37:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0544106564A; Wed, 10 Aug 2011 13:37:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail13.syd.optusnet.com.au (mail13.syd.optusnet.com.au [211.29.132.194]) by mx1.freebsd.org (Postfix) with ESMTP id 546498FC18; Wed, 10 Aug 2011 13:37:37 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail13.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p7ADbZRW007809 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 10 Aug 2011 23:37:35 +1000 Date: Wed, 10 Aug 2011 23:37:35 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexander Best In-Reply-To: <20110810103831.GA60858@freebsd.org> Message-ID: <20110810230856.M2222@besplex.bde.org> References: <201108082036.p78KarlR062810@svn.freebsd.org> <20110809105824.P896@besplex.bde.org> <20110810103831.GA60858@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jonathan Anderson , Bruce Evans Subject: Re: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 13:37:38 -0000 On Wed, 10 Aug 2011, Alexander Best wrote: > On Tue Aug 9 11, Bruce Evans wrote: >> ... >> What is wrong with the existing APIs TIMEVAL_TO_TIMESPEC() and >> TIMESPEC_TO_TIMEVAL(), which are used for these conversions by almost >> everything now? Well, quite a bit is wrong with them, starting with >> ... > > any reason {TIMEVAL,TIMESPEC}_TO_{TIMESPEC,TIMEVAL}()s code is being executed > in a > > do { ... } while (0) > > conditional loop? Just the usual syntactical trick for making large macros that look like function calls almost usable like function calls. Without the do-while trick, code like if (foo) TIMEVAL_TO_TIMESPEC(&tv, &ts); would be fragile at best. With an else clause added to it, it would expand to either if (foo) first_statement_of_macro; second_statement_of_macro; ; else ... which is obviously broken (3 statements between the 'if' and the 'else' give a syntax error). We partially fix this by putting outer braces in the macro: if (foo) /* * Here I attempt to duplicate the ugly indentation, * that tends to be preserved on expansion, which is * given by style bugs in the macro definition. See * sys/queue.h for similar definitions without these * style bugs. */ { first_statement_of_macro; second_statement_of_macro; } ; else ... This might work without the else clause, but with the else clause it is still a syntax error, since there are still too many statements between the 'if' and the 'else' -- we want to add the semicolon after the macro invocation, since the macro invocation looks like a function call, but this semicolon gives an extra statement and thus defeats the reduction to a single statement in the macro be using braces. With the trick, and without the style bugs, the above expands to: if (foo) do { first_statement_of_macro; second_statement_of_macro; } while (0) ; else ... Now there is only 1 statement between the 'if' and the 'else', since we trickily made the macro a non-statement that works after adding a semicolon to it -- the semicolon completes the statement, and the do-while is a trick that works (I don't know of any other). > both macros are also defined in crypto/openssh/defines.h and > don't seem to need that extra one-time-loop. Macros that are only used locally can be sloppier, but shouldn't be. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 15:49:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCD591065673; Wed, 10 Aug 2011 15:49:24 +0000 (UTC) (envelope-from rafan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD3A38FC0A; Wed, 10 Aug 2011 15:49:24 +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 p7AFnOFd051612; Wed, 10 Aug 2011 15:49:24 GMT (envelope-from rafan@svn.freebsd.org) Received: (from rafan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7AFnOS5051610; Wed, 10 Aug 2011 15:49:24 GMT (envelope-from rafan@svn.freebsd.org) Message-Id: <201108101549.p7AFnOS5051610@svn.freebsd.org> From: Rong-En Fan Date: Wed, 10 Aug 2011 15:49:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224759 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 15:49:25 -0000 Author: rafan Date: Wed Aug 10 15:49:24 2011 New Revision: 224759 URL: http://svn.freebsd.org/changeset/base/224759 Log: - Remove myself from ncurses maintainer due to ENOTIME Approved by: re (kib@) Modified: head/MAINTAINERS Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Wed Aug 10 15:19:14 2011 (r224758) +++ head/MAINTAINERS Wed Aug 10 15:49:24 2011 (r224759) @@ -115,7 +115,6 @@ lib/libsdp emax Pre-commit review prefe usr.bin/bluetooth emax Pre-commit review preferred. usr.sbin/bluetooth emax Pre-commit review preferred. gnu/usr.bin/send-pr bugmaster Pre-commit review requested. -ncurses rafan Heads-up appreciated, try not to break it. *env(3) secteam Due to the problematic security history of this code, please have patches reviewed by secteam. share/zoneinfo edwin Heads-up appreciated, since our data is coming From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 15:49:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 9D70D1065693; Wed, 10 Aug 2011 15:49:56 +0000 (UTC) Date: Wed, 10 Aug 2011 15:49:56 +0000 From: Alexander Best To: Bruce Evans Message-ID: <20110810154956.GA4034@freebsd.org> References: <201108082036.p78KarlR062810@svn.freebsd.org> <20110809105824.P896@besplex.bde.org> <20110810103831.GA60858@freebsd.org> <20110810230856.M2222@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110810230856.M2222@besplex.bde.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric , Jonathan Anderson Subject: Re: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 15:49:56 -0000 On Wed Aug 10 11, Bruce Evans wrote: > On Wed, 10 Aug 2011, Alexander Best wrote: > > >On Tue Aug 9 11, Bruce Evans wrote: > >>... > >>What is wrong with the existing APIs TIMEVAL_TO_TIMESPEC() and > >>TIMESPEC_TO_TIMEVAL(), which are used for these conversions by almost > >>everything now? Well, quite a bit is wrong with them, starting with > >>... > > > >any reason {TIMEVAL,TIMESPEC}_TO_{TIMESPEC,TIMEVAL}()s code is being > >executed > >in a > > > >do { ... } while (0) > > > >conditional loop? > > Just the usual syntactical trick for making large macros that look > like function calls almost usable like function calls. Without the > do-while trick, code like > > if (foo) > TIMEVAL_TO_TIMESPEC(&tv, &ts); > > would be fragile at best. With an else clause added to it, it would expand > to either > > if (foo) > first_statement_of_macro; > second_statement_of_macro; ; > else > ... > > which is obviously broken (3 statements between the 'if' and the 'else' > give a syntax error). We partially fix this by putting outer braces in > the macro: > > if (foo) > /* > * Here I attempt to duplicate the ugly indentation, > * that tends to be preserved on expansion, which is > * given by style bugs in the macro definition. See > * sys/queue.h for similar definitions without these > * style bugs. > */ > { > first_statement_of_macro; > second_statement_of_macro; > } ; > else > ... > > This might work without the else clause, but with the else clause it > is still a syntax error, since there are still too many statements > between the 'if' and the 'else' -- we want to add the semicolon after > the macro invocation, since the macro invocation looks like a function > call, but this semicolon gives an extra statement and thus defeats the > reduction to a single statement in the macro be using braces. > > With the trick, and without the style bugs, the above expands to: > > if (foo) > do { > first_statement_of_macro; > second_statement_of_macro; > } while (0) ; > else > ... > > Now there is only 1 statement between the 'if' and the 'else', since we > trickily made the macro a non-statement that works after adding a semicolon > to it -- the semicolon completes the statement, and the do-while is a > trick that works (I don't know of any other). > > >both macros are also defined in crypto/openssh/defines.h and > >don't seem to need that extra one-time-loop. > > Macros that are only used locally can be sloppier, but shouldn't be. thanks a lot for the in depth information. :) any reason, back in the days, it was decided that the functionality of converting a timespec to a timeval and vice versa should be implemented as a macro and not a function? cheers. alex > > Bruce From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 19:05:23 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F227106564A; Wed, 10 Aug 2011 19:05:23 +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 1FB7A8FC0C; Wed, 10 Aug 2011 19:05:23 +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 p7AJ5NVv057562; Wed, 10 Aug 2011 19:05:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7AJ5Mbp057559; Wed, 10 Aug 2011 19:05:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108101905.p7AJ5Mbp057559@svn.freebsd.org> From: Marius Strobl Date: Wed, 10 Aug 2011 19:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224761 - in head/sys/dev/mpt: . mpilib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 19:05:23 -0000 Author: marius Date: Wed Aug 10 19:05:22 2011 New Revision: 224761 URL: http://svn.freebsd.org/changeset/base/224761 Log: o Improve 224494: - Ignore some more internal SAS device status change events. - Correct inverted Bus and TargetID arguments in a warning. o Add a warning for MPI_EVENT_SAS_DISCOVERY_ERROR events, which can help identifying broken disks. Submitted by: Andrew Boyer Approved by: re (kib) Committed from: Chaos Communication Camp 2011 Modified: head/sys/dev/mpt/mpilib/mpi_ioc.h head/sys/dev/mpt/mpt_cam.c Modified: head/sys/dev/mpt/mpilib/mpi_ioc.h ============================================================================== --- head/sys/dev/mpt/mpilib/mpi_ioc.h Wed Aug 10 16:13:43 2011 (r224760) +++ head/sys/dev/mpt/mpilib/mpi_ioc.h Wed Aug 10 19:05:22 2011 (r224761) @@ -33,7 +33,7 @@ * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages * Creation Date: August 11, 2000 * - * mpi_ioc.h Version: 01.05.14 + * mpi_ioc.h Version: 01.05.16 * * Version History * --------------- @@ -140,6 +140,16 @@ * added _MULTI_PORT_DOMAIN. * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. * Added Common Boot Block type to FWUpload Request. + * 08-07-07 01.05.15 Added MPI_EVENT_SAS_INIT_RC_REMOVED define. + * Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and + * MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data. + * Added SASAddress field to SAS Initiator Device Table + * Overflow event data structure. + * 03-28-08 01.05.16 Added two new ReasonCode values to SAS Device Status + * Change Event data to indicate completion of internally + * generated task management. + * Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define. + * Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define. * -------------------------------------------------------------------------- */ @@ -639,6 +649,8 @@ typedef struct _EVENT_DATA_SAS_DEVICE_ST #define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B) #define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C) #define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION (0x0D) +#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET (0x0E) +#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL (0x0F) /* SCSI Event data for Queue Full event */ @@ -735,6 +747,8 @@ typedef struct _MPI_EVENT_DATA_IR2 #define MPI_EVENT_IR2_RC_PD_REMOVED (0x05) #define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED (0x06) #define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR (0x07) +#define MPI_EVENT_IR2_RC_DUAL_PORT_ADDED (0x08) +#define MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED (0x09) /* defines for logical disk states */ #define MPI_LD_STATE_OPTIMAL (0x00) @@ -894,6 +908,7 @@ typedef struct _EVENT_DATA_DISCOVERY_ERR #define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE (0x00000800) #define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000) #define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN (0x00002000) +#define MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE (0x00004000) /* SAS SMP Error Event data */ @@ -929,6 +944,8 @@ typedef struct _EVENT_DATA_SAS_INIT_DEV_ /* defines for the ReasonCode field of the SAS Initiator Device Status Change event */ #define MPI_EVENT_SAS_INIT_RC_ADDED (0x01) +#define MPI_EVENT_SAS_INIT_RC_REMOVED (0x02) +#define MPI_EVENT_SAS_INIT_RC_INACCESSIBLE (0x03) /* SAS Initiator Device Table Overflow Event data */ @@ -937,6 +954,7 @@ typedef struct _EVENT_DATA_SAS_INIT_TABL U8 MaxInit; /* 00h */ U8 CurrentInit; /* 01h */ U16 Reserved1; /* 02h */ + U64 SASAddress; /* 04h */ } EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, MpiEventDataSasInitTableOverflow_t, Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Wed Aug 10 16:13:43 2011 (r224760) +++ head/sys/dev/mpt/mpt_cam.c Wed Aug 10 19:05:22 2011 (r224761) @@ -2620,17 +2620,30 @@ mpt_cam_event(struct mpt_softc *mpt, req xpt_free_path(tmppath); CAMLOCK_2_MPTLOCK(mpt); break; + case MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET: + case MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL: case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET: break; default: mpt_lprt(mpt, MPT_PRT_WARN, "SAS device status change: Bus: 0x%02x TargetID: " - "0x%02x ReasonCode: 0x%02x\n", psdsc->TargetID, - psdsc->Bus, psdsc->ReasonCode); + "0x%02x ReasonCode: 0x%02x\n", psdsc->Bus, + psdsc->TargetID, psdsc->ReasonCode); break; } break; } + case MPI_EVENT_SAS_DISCOVERY_ERROR: + { + PTR_EVENT_DATA_DISCOVERY_ERROR pde; + + pde = (PTR_EVENT_DATA_DISCOVERY_ERROR)msg->Data; + pde->DiscoveryStatus = le32toh(pde->DiscoveryStatus); + mpt_lprt(mpt, MPT_PRT_WARN, + "SAS discovery error: Port: 0x%02x Status: 0x%08x\n", + pde->Port, pde->DiscoveryStatus); + break; + } case MPI_EVENT_EVENT_CHANGE: case MPI_EVENT_INTEGRATED_RAID: case MPI_EVENT_IR2: From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 19:12:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D68D01065672; Wed, 10 Aug 2011 19:12:21 +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 C492E8FC15; Wed, 10 Aug 2011 19:12:21 +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 p7AJCL0h057817; Wed, 10 Aug 2011 19:12:21 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7AJCLhZ057810; Wed, 10 Aug 2011 19:12:21 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108101912.p7AJCLhZ057810@svn.freebsd.org> From: Marius Strobl Date: Wed, 10 Aug 2011 19:12:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224762 - in head/usr.sbin/makefs: . cd9660 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 19:12:22 -0000 Author: marius Date: Wed Aug 10 19:12:21 2011 New Revision: 224762 URL: http://svn.freebsd.org/changeset/base/224762 Log: Sync makefs(8) ISO 9660 support with NetBSD: o cd9960 -> cd9660 o Move inclusion of sys/endian.h from cd9660_eltorito.c to cd9660.h since actual user is not cd9660_eltorito.c but iso.h and cd9660_eltorito.h. Actually, include order/place of sys/endian.h doesn't matter on netbsd since it is always included by sys/types.h but it's not true on other system. This should fix cross build breakage on freebsd introduced by rev. 1.16 of cd9660_eltorito.c. Problem reported and fix suggested on twitter. o Fix fd leaks in error cases. Found by cppcheck. o RRIP RE length should be 4, not 0 o Apply fixes for PR bin/44114 (makefs(8) -t cd9660 -o rockridge creates corrupted cd9660fs), iso9660_rrip.c part: - cd9660_rrip_finalize_node() should check rr_real_parent in node->parent, not in node itself in RRIP_PL case - cd9660_rrip_initialize_node() should update only node passed as arg so handle RRIP_PL in DOTDOT case Fixes malformed dotdot entries in deep (more than 8 level) directories moved into .rr_moved dir. Should be pulled up to netbsd-5. (no official ISO has such deep dirs, but cobalt restorecd is affected) Reviewed by: mm Approved by: re (kib) Obtained from: NetBSD MFC after: 3 days Modified: head/usr.sbin/makefs/cd9660.c head/usr.sbin/makefs/cd9660.h head/usr.sbin/makefs/cd9660/cd9660_conversion.c head/usr.sbin/makefs/cd9660/cd9660_eltorito.c head/usr.sbin/makefs/cd9660/cd9660_write.c head/usr.sbin/makefs/cd9660/iso9660_rrip.c Modified: head/usr.sbin/makefs/cd9660.c ============================================================================== --- head/usr.sbin/makefs/cd9660.c Wed Aug 10 19:05:22 2011 (r224761) +++ head/usr.sbin/makefs/cd9660.c Wed Aug 10 19:12:21 2011 (r224762) @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.c,v 1.27 2010/10/27 18:51:34 christos Exp $ */ +/* $NetBSD: cd9660.c,v 1.31 2011/08/06 23:25:19 christos Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -127,7 +127,7 @@ static int cd9660_setup_volume_descripto static int cd9660_fill_extended_attribute_record(cd9660node *); #endif static void cd9660_sort_nodes(cd9660node *); -static int cd9960_translate_node_common(cd9660node *); +static int cd9660_translate_node_common(cd9660node *); static int cd9660_translate_node(fsnode *, cd9660node *); static int cd9660_compare_filename(const char *, const char *); static void cd9660_sorted_child_insert(cd9660node *, cd9660node *); @@ -809,7 +809,7 @@ cd9660_fill_extended_attribute_record(cd #endif static int -cd9960_translate_node_common(cd9660node *newnode) +cd9660_translate_node_common(cd9660node *newnode) { time_t tim; int test; @@ -846,7 +846,7 @@ cd9960_translate_node_common(cd9660node } /* - * Translate fsnode to cd9960node + * Translate fsnode to cd9660node * Translate filenames and other metadata, including dates, sizes, * permissions, etc * @param struct fsnode * The node generated by makefs @@ -875,7 +875,7 @@ cd9660_translate_node(fsnode *node, cd96 if (!(S_ISDIR(node->type))) newnode->fileDataLength = node->inode->st.st_size; - if (cd9960_translate_node_common(newnode) == 0) + if (cd9660_translate_node_common(newnode) == 0) return 0; /* Finally, overwrite some of the values that are set by default */ @@ -2042,7 +2042,7 @@ cd9660_create_file(const char * name, cd return NULL; *temp->node->inode = *me->node->inode; - if (cd9960_translate_node_common(temp) == 0) + if (cd9660_translate_node_common(temp) == 0) return NULL; return temp; } @@ -2069,7 +2069,7 @@ cd9660_create_directory(const char *name return NULL; *temp->node->inode = *me->node->inode; - if (cd9960_translate_node_common(temp) == 0) + if (cd9660_translate_node_common(temp) == 0) return NULL; return temp; } Modified: head/usr.sbin/makefs/cd9660.h ============================================================================== --- head/usr.sbin/makefs/cd9660.h Wed Aug 10 19:05:22 2011 (r224761) +++ head/usr.sbin/makefs/cd9660.h Wed Aug 10 19:12:21 2011 (r224762) @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.h,v 1.15 2010/10/27 18:51:34 christos Exp $ */ +/* $NetBSD: cd9660.h,v 1.17 2011/06/23 02:35:56 enami Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -50,6 +50,7 @@ #include #include #include +#include #include "makefs.h" #include "iso.h" Modified: head/usr.sbin/makefs/cd9660/cd9660_conversion.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_conversion.c Wed Aug 10 19:05:22 2011 (r224761) +++ head/usr.sbin/makefs/cd9660/cd9660_conversion.c Wed Aug 10 19:12:21 2011 (r224762) @@ -36,8 +36,6 @@ #include __FBSDID("$FreeBSD$"); -#include - static char cd9660_compute_gm_offset(time_t); #if 0 Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Wed Aug 10 19:05:22 2011 (r224761) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Wed Aug 10 19:12:21 2011 (r224762) @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_eltorito.c,v 1.14 2010/10/27 18:51:35 christos Exp $ */ +/* $NetBSD: cd9660_eltorito.c,v 1.17 2011/06/23 02:35:56 enami Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -32,8 +32,6 @@ * OF SUCH DAMAGE. */ -#include - #include "cd9660.h" #include "cd9660_eltorito.h" @@ -501,13 +499,14 @@ cd9660_setup_boot_volume_descriptor(volu } static int -cd9660_write_mbr_partition_entry(FILE *fd, int index, off_t sector_start, +cd9660_write_mbr_partition_entry(FILE *fd, int idx, off_t sector_start, off_t nsectors, int type) { uint8_t val; uint32_t lba; - fseeko(fd, (off_t)(index) * 16 + 0x1be, SEEK_SET); + if (fseeko(fd, (off_t)(idx) * 16 + 0x1be, SEEK_SET) == -1) + err(1, "fseeko"); val = 0x80; /* Bootable */ fwrite(&val, sizeof(val), 1, fd); @@ -531,18 +530,19 @@ cd9660_write_mbr_partition_entry(FILE *f lba = htole32(nsectors); fwrite(&lba, sizeof(lba), 1, fd); - return (0); + return 0; } static int -cd9660_write_apm_partition_entry(FILE *fd, int index, int total_partitions, +cd9660_write_apm_partition_entry(FILE *fd, int idx, int total_partitions, off_t sector_start, off_t nsectors, off_t sector_size, const char *part_name, const char *part_type) { uint32_t apm32; uint16_t apm16; - fseeko(fd, (off_t)(index + 1) * sector_size, SEEK_SET); + if (fseeko(fd, (off_t)(idx + 1) * sector_size, SEEK_SET) == -1) + err(1, "fseeko"); /* Signature */ apm16 = htobe16(0x504d); Modified: head/usr.sbin/makefs/cd9660/cd9660_write.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_write.c Wed Aug 10 19:05:22 2011 (r224761) +++ head/usr.sbin/makefs/cd9660/cd9660_write.c Wed Aug 10 19:12:21 2011 (r224762) @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_write.c,v 1.13 2010/10/22 00:49:15 christos Exp $ */ +/* $NetBSD: cd9660_write.c,v 1.14 2011/01/04 09:48:21 wiz Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -460,6 +460,7 @@ cd9660_copy_file(FILE *fd, off_t start_s if (ferror(rf)) { warn("%s: fread", __func__); free(buf); + (void)fclose(rf); return 0; } @@ -467,6 +468,7 @@ cd9660_copy_file(FILE *fd, off_t start_s if (ferror(fd)) { warn("%s: fwrite", __func__); free(buf); + (void)fclose(rf); return 0; } sector++; Modified: head/usr.sbin/makefs/cd9660/iso9660_rrip.c ============================================================================== --- head/usr.sbin/makefs/cd9660/iso9660_rrip.c Wed Aug 10 19:05:22 2011 (r224761) +++ head/usr.sbin/makefs/cd9660/iso9660_rrip.c Wed Aug 10 19:12:21 2011 (r224762) @@ -1,4 +1,4 @@ -/* $NetBSD: iso9660_rrip.c,v 1.8 2009/01/10 22:06:29 bjh21 Exp $ */ +/* $NetBSD: iso9660_rrip.c,v 1.10 2011/05/29 17:07:58 tsutsui Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -183,10 +183,11 @@ cd9660_rrip_finalize_node(cd9660node *no break; case SUSP_ENTRY_RRIP_PL: /* Look at rr_real_parent */ - if (node->rr_real_parent == NULL) + if (node->parent == NULL || + node->parent->rr_real_parent == NULL) return -1; cd9660_bothendian_dword( - node->rr_real_parent->fileDataSector, + node->parent->rr_real_parent->fileDataSector, (unsigned char *) t->attr.rr_entry.PL.dir_loc); break; @@ -396,6 +397,13 @@ cd9660_rrip_initialize_node(cd9660node * cd9660node_rrip_px(current, grandparent->node); TAILQ_INSERT_TAIL(&node->head, current, rr_ll); } + /* Handle PL */ + if (parent != NULL && parent->rr_real_parent != NULL) { + current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, + SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT); + cd9660_rrip_PL(current,node); + TAILQ_INSERT_TAIL(&node->head, current, rr_ll); + } } else { cd9660_rrip_initialize_inode(node); @@ -435,14 +443,6 @@ cd9660_rrip_initialize_node(cd9660node * SUSP_ENTRY_RRIP_RE, "RE", SUSP_LOC_ENTRY); cd9660_rrip_RE(current,node); TAILQ_INSERT_TAIL(&node->head, current, rr_ll); - - /* Handle PL */ - current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, - SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT); - cd9660_rrip_PL(current,node->dot_dot_record); - TAILQ_INSERT_TAIL(&node->dot_dot_record->head, current, - rr_ll); - TAILQ_INSERT_TAIL(&node->head, current, rr_ll); } } return 1; @@ -496,7 +496,7 @@ cd9660_rrip_CL(struct ISO_SUSP_ATTRIBUTE int cd9660_rrip_RE(struct ISO_SUSP_ATTRIBUTES *p, cd9660node *node __unused) { - p->attr.rr_entry.RE.h.length[0] = 0; + p->attr.rr_entry.RE.h.length[0] = 4; p->attr.rr_entry.RE.h.version[0] = 1; return 1; } From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 20:52:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 733371065673; Wed, 10 Aug 2011 20:52:02 +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 6342F8FC15; Wed, 10 Aug 2011 20:52:02 +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 p7AKq2vQ060988; Wed, 10 Aug 2011 20:52:02 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7AKq2XS060985; Wed, 10 Aug 2011 20:52:02 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201108102052.p7AKq2XS060985@svn.freebsd.org> From: Doug Barton Date: Wed, 10 Aug 2011 20:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224765 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 20:52:02 -0000 Author: dougb Date: Wed Aug 10 20:52:02 2011 New Revision: 224765 URL: http://svn.freebsd.org/changeset/base/224765 Log: Revert r224760, and enhance the sed patterns from r224659 to comment out the _compat entries in the WITHOUT_NIS case rather then delete them. Approved by: re (kib) Modified: head/etc/Makefile head/etc/nsswitch.conf Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Wed Aug 10 19:40:23 2011 (r224764) +++ head/etc/Makefile Wed Aug 10 20:52:02 2011 (r224765) @@ -256,6 +256,10 @@ distribution: ${DESTDIR}/boot/device.hints .endif .endif +.if ${MK_NIS} == "no" + sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \ + ${DESTDIR}/etc/nsswitch.conf +.endif distrib-dirs: mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/ Modified: head/etc/nsswitch.conf ============================================================================== --- head/etc/nsswitch.conf Wed Aug 10 19:40:23 2011 (r224764) +++ head/etc/nsswitch.conf Wed Aug 10 20:52:02 2011 (r224765) @@ -1,23 +1,15 @@ # +# nsswitch.conf(5) - name service switch configuration file # $FreeBSD$ # -# To enable NIS the commented entries should replace their uncommented -# equivalents. See nsswitch.conf(5) for more information. -# -group: files -#group_compat: nis -#group: compat - -passwd: files -#passwd_compat: nis -#passwd: compat - -services: files -#services_compat: nis -#services: compat - +group: compat +group_compat: nis hosts: files dns networks: files +passwd: compat +passwd_compat: nis shells: files +services: compat +services_compat: nis protocols: files rpc: files From owner-svn-src-head@FreeBSD.ORG Wed Aug 10 22:03:34 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB9E4106566C; Wed, 10 Aug 2011 22:03:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA8DF8FC1B; Wed, 10 Aug 2011 22:03:34 +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 p7AM3Y3a063210; Wed, 10 Aug 2011 22:03:34 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7AM3YhV063207; Wed, 10 Aug 2011 22:03:34 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201108102203.p7AM3YhV063207@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 10 Aug 2011 22:03:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224768 - in head: tools/tools tools/tools/cxgbtool usr.sbin/cxgbtool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 22:03:35 -0000 Author: np Date: Wed Aug 10 22:03:34 2011 New Revision: 224768 URL: http://svn.freebsd.org/changeset/base/224768 Log: Move cxgbtool from usr.sbin to tools/tools. Approved by: re (kib) MFC after: 1 month Added: head/tools/tools/cxgbtool/ - copied from r224760, head/usr.sbin/cxgbtool/ Deleted: head/usr.sbin/cxgbtool/ Modified: head/tools/tools/README head/tools/tools/cxgbtool/Makefile Modified: head/tools/tools/README ============================================================================== --- head/tools/tools/README Wed Aug 10 21:39:47 2011 (r224767) +++ head/tools/tools/README Wed Aug 10 22:03:34 2011 (r224768) @@ -17,6 +17,7 @@ commitsdb A tool for reconstructing comm checksums of the commit logs. crypto Test and exercise tools related to the crypto framework cxgbetool A tool for the cxgbe(4) driver. +cxgbtool A tool for the cxgb(4) driver. diffburst OBSOLETE: equivalent functionality is available via split -p. For example: "split -p ^diff < patchfile". See split(1). editing Editor modes and the like to help editing FreeBSD code. Modified: head/tools/tools/cxgbtool/Makefile ============================================================================== --- head/usr.sbin/cxgbtool/Makefile Wed Aug 10 16:13:43 2011 (r224760) +++ head/tools/tools/cxgbtool/Makefile Wed Aug 10 22:03:34 2011 (r224768) @@ -3,9 +3,8 @@ PROG= cxgbtool SRCS= cxgbtool.c NO_MAN= -CFLAGS+= -I${.CURDIR}/../../sys/dev/cxgb -I. +CFLAGS+= -I${.CURDIR}/../../../sys/dev/cxgb -I. CFLAGS+= -DCONFIG_T3_REGS -DCHELSIO_INTERNAL - -install: +BINDIR?= /usr/sbin .include From owner-svn-src-head@FreeBSD.ORG Thu Aug 11 10:29:11 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08950106566C; Thu, 11 Aug 2011 10:29:11 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D280D8FC08; Thu, 11 Aug 2011 10:29:10 +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 p7BATA5t089131; Thu, 11 Aug 2011 10:29:10 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7BATA72089126; Thu, 11 Aug 2011 10:29:10 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201108111029.p7BATA72089126@svn.freebsd.org> From: Ruslan Ermilov Date: Thu, 11 Aug 2011 10:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224776 - in head: . contrib/one-true-awk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2011 10:29:11 -0000 Author: ru Date: Thu Aug 11 10:29:10 2011 New Revision: 224776 URL: http://svn.freebsd.org/changeset/base/224776 Log: - Merged awk upstream that includes a fix for a bug exposed by kmod_syms.mk. - Provide a build aid for those who already have a buggy awk(1) installed. Approved by: re (kib) Modified: head/Makefile.inc1 head/contrib/one-true-awk/FIXES head/contrib/one-true-awk/lib.c head/contrib/one-true-awk/main.c Directory Properties: head/contrib/one-true-awk/ (props changed) Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Aug 11 10:24:09 2011 (r224775) +++ head/Makefile.inc1 Thu Aug 11 10:29:10 2011 (r224776) @@ -1014,6 +1014,10 @@ _lex= usr.bin/lex _yacc= usr.bin/yacc .endif +.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 +_awk= usr.bin/awk +.endif + .if ${BOOTSTRAPPING} < 700018 _gensnmptree= usr.sbin/bsnmpd/gensnmptree .endif @@ -1052,6 +1056,7 @@ bootstrap-tools: ${_groff} \ ${_ar} \ ${_dtc} \ + ${_awk} \ usr.bin/lorder \ usr.bin/makewhatis \ ${_mklocale} \ Modified: head/contrib/one-true-awk/FIXES ============================================================================== --- head/contrib/one-true-awk/FIXES Thu Aug 11 10:24:09 2011 (r224775) +++ head/contrib/one-true-awk/FIXES Thu Aug 11 10:29:10 2011 (r224776) @@ -25,6 +25,10 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +Aug 10, 2011: + another fix to avoid core dump with delete(ARGV); again, many thanks + to ruslan ermilov. + Aug 7, 2011: split(s, a, //) now behaves the same as split(s, a, "") Modified: head/contrib/one-true-awk/lib.c ============================================================================== --- head/contrib/one-true-awk/lib.c Thu Aug 11 10:24:09 2011 (r224775) +++ head/contrib/one-true-awk/lib.c Thu Aug 11 10:29:10 2011 (r224776) @@ -89,8 +89,13 @@ void initgetrec(void) char *p; for (i = 1; i < *ARGC; i++) { - if (!isclvar(p = getargv(i))) { /* find 1st real filename */ - setsval(lookup("FILENAME", symtab), getargv(i)); + p = getargv(i); /* find 1st real filename */ + if (p == NULL || *p == '\0') { /* deleted or zapped */ + argno++; + continue; + } + if (!isclvar(p)) { + setsval(lookup("FILENAME", symtab), p); return; } setclvar(p); /* a commandline assignment before filename */ Modified: head/contrib/one-true-awk/main.c ============================================================================== --- head/contrib/one-true-awk/main.c Thu Aug 11 10:24:09 2011 (r224775) +++ head/contrib/one-true-awk/main.c Thu Aug 11 10:29:10 2011 (r224776) @@ -25,7 +25,7 @@ THIS SOFTWARE. #include __FBSDID("$FreeBSD$"); -const char *version = "version 20110807 (FreeBSD)"; +const char *version = "version 20110810 (FreeBSD)"; #define DEBUG #include From owner-svn-src-head@FreeBSD.ORG Thu Aug 11 11:30:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02B1D1065672; Thu, 11 Aug 2011 11:30:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E52298FC1A; Thu, 11 Aug 2011 11:30:21 +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 p7BBULad091006; Thu, 11 Aug 2011 11:30:21 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7BBULUb091001; Thu, 11 Aug 2011 11:30:21 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108111130.p7BBULUb091001@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 11 Aug 2011 11:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224777 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2011 11:30:22 -0000 Author: hselasky Date: Thu Aug 11 11:30:21 2011 New Revision: 224777 URL: http://svn.freebsd.org/changeset/base/224777 Log: Use synchronous device destruction instead of asynchronous, so that a new device having the same name like a previous one is not created before the old one is gone. This fixes some panics due to asserts in the devfs code which were added recently. Approved by: re (kib) MFC after: 1 week Modified: head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usbdi.h Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Thu Aug 11 10:29:10 2011 (r224776) +++ head/sys/dev/usb/usb_dev.c Thu Aug 11 11:30:21 2011 (r224777) @@ -1648,7 +1648,6 @@ usb_fifo_attach(struct usb_device *udev, struct usb_fifo *f_rx; char devname[32]; uint8_t n; - struct usb_fs_privdata* pd; f_sc->fp[USB_FIFO_TX] = NULL; f_sc->fp[USB_FIFO_RX] = NULL; @@ -1746,22 +1745,10 @@ usb_fifo_attach(struct usb_device *udev, usb_alloc_symlink(devname); } - /* - * Initialize device private data - this is used to find the - * actual USB device itself. - */ - pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, M_WAITOK | M_ZERO); - pd->bus_index = device_get_unit(udev->bus->bdev); - pd->dev_index = udev->device_index; - pd->ep_addr = -1; /* not an endpoint */ - pd->fifo_index = f_tx->fifo_index & f_rx->fifo_index; - pd->mode = FREAD|FWRITE; - - /* Now, create the device itself */ - f_sc->dev = make_dev(&usb_devsw, 0, uid, gid, mode, - "%s", devname); - /* XXX setting si_drv1 and creating the device is not atomic! */ - f_sc->dev->si_drv1 = pd; + /* Create the device */ + f_sc->dev = usb_make_dev(udev, devname, -1, + f_tx->fifo_index & f_rx->fifo_index, + FREAD|FWRITE, uid, gid, mode); } DPRINTFN(2, "attached %p/%p\n", f_tx, f_rx); @@ -1814,12 +1801,6 @@ usb_fifo_free_buffer(struct usb_fifo *f) bzero(&f->used_q, sizeof(f->used_q)); } -static void -usb_fifo_cleanup(void* ptr) -{ - free(ptr, M_USBDEV); -} - void usb_fifo_detach(struct usb_fifo_sc *f_sc) { @@ -1832,11 +1813,9 @@ usb_fifo_detach(struct usb_fifo_sc *f_sc f_sc->fp[USB_FIFO_TX] = NULL; f_sc->fp[USB_FIFO_RX] = NULL; - if (f_sc->dev != NULL) { - destroy_dev_sched_cb(f_sc->dev, - usb_fifo_cleanup, f_sc->dev->si_drv1); - f_sc->dev = NULL; - } + usb_destroy_dev(f_sc->dev); + + f_sc->dev = NULL; DPRINTFN(2, "detached %p\n", f_sc); } Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Thu Aug 11 10:29:10 2011 (r224776) +++ head/sys/dev/usb/usb_device.c Thu Aug 11 11:30:21 2011 (r224777) @@ -102,10 +102,8 @@ static void usb_notify_addq(const char * #endif #if USB_HAVE_UGEN static void usb_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t); -static struct cdev *usb_make_dev(struct usb_device *, int, int); static void usb_cdev_create(struct usb_device *); static void usb_cdev_free(struct usb_device *); -static void usb_cdev_cleanup(void *); #endif /* This variable is global to allow easy access to it: */ @@ -1626,10 +1624,12 @@ usb_alloc_device(device_t parent_dev, st LIST_INIT(&udev->pd_list); /* Create the control endpoint device */ - udev->ctrl_dev = usb_make_dev(udev, 0, FREAD|FWRITE); + udev->ctrl_dev = usb_make_dev(udev, NULL, 0, 0, + FREAD|FWRITE, UID_ROOT, GID_OPERATOR, 0600); /* Create a link from /dev/ugenX.X to the default endpoint */ - make_dev_alias(udev->ctrl_dev, "%s", udev->ugen_name); + if (udev->ctrl_dev != NULL) + make_dev_alias(udev->ctrl_dev->cdev, "%s", udev->ugen_name); #endif /* Initialise device */ if (bus->methods->device_init != NULL) { @@ -1884,11 +1884,12 @@ done: } #if USB_HAVE_UGEN -static struct cdev * -usb_make_dev(struct usb_device *udev, int ep, int mode) +struct usb_fs_privdata * +usb_make_dev(struct usb_device *udev, const char *devname, int ep, + int fi, int rwmode, uid_t uid, gid_t gid, int mode) { struct usb_fs_privdata* pd; - char devname[20]; + char buffer[32]; /* Store information to locate ourselves again later */ pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, @@ -1896,16 +1897,39 @@ usb_make_dev(struct usb_device *udev, in pd->bus_index = device_get_unit(udev->bus->bdev); pd->dev_index = udev->device_index; pd->ep_addr = ep; - pd->mode = mode; + pd->fifo_index = fi; + pd->mode = rwmode; /* Now, create the device itself */ - snprintf(devname, sizeof(devname), "%u.%u.%u", - pd->bus_index, pd->dev_index, pd->ep_addr); - pd->cdev = make_dev(&usb_devsw, 0, UID_ROOT, - GID_OPERATOR, 0600, USB_DEVICE_DIR "/%s", devname); + if (devname == NULL) { + devname = buffer; + snprintf(buffer, sizeof(buffer), USB_DEVICE_DIR "/%u.%u.%u", + pd->bus_index, pd->dev_index, pd->ep_addr); + } + + pd->cdev = make_dev(&usb_devsw, 0, uid, gid, mode, "%s", devname); + + if (pd->cdev == NULL) { + DPRINTFN(0, "Failed to create device %s\n", devname); + free(pd, M_USBDEV); + return (NULL); + } + + /* XXX setting si_drv1 and creating the device is not atomic! */ pd->cdev->si_drv1 = pd; - return (pd->cdev); + return (pd); +} + +void +usb_destroy_dev(struct usb_fs_privdata *pd) +{ + if (pd == NULL) + return; + + destroy_dev(pd->cdev); + + free(pd, M_USBDEV); } static void @@ -1915,7 +1939,6 @@ usb_cdev_create(struct usb_device *udev) struct usb_endpoint_descriptor *ed; struct usb_descriptor *desc; struct usb_fs_privdata* pd; - struct cdev *dev; int inmode, outmode, inmask, outmask, mode; uint8_t ep; @@ -1957,14 +1980,16 @@ usb_cdev_create(struct usb_device *udev) /* Create all available endpoints except EP0 */ for (ep = 1; ep < 16; ep++) { - mode = inmask & (1 << ep) ? inmode : 0; - mode |= outmask & (1 << ep) ? outmode : 0; + mode = (inmask & (1 << ep)) ? inmode : 0; + mode |= (outmask & (1 << ep)) ? outmode : 0; if (mode == 0) continue; /* no IN or OUT endpoint */ - dev = usb_make_dev(udev, ep, mode); - pd = dev->si_drv1; - LIST_INSERT_HEAD(&udev->pd_list, pd, pd_next); + pd = usb_make_dev(udev, NULL, ep, 0, + mode, UID_ROOT, GID_OPERATOR, 0600); + + if (pd != NULL) + LIST_INSERT_HEAD(&udev->pd_list, pd, pd_next); } } @@ -1972,25 +1997,16 @@ static void usb_cdev_free(struct usb_device *udev) { struct usb_fs_privdata* pd; - struct cdev* pcdev; DPRINTFN(2, "Freeing device nodes\n"); while ((pd = LIST_FIRST(&udev->pd_list)) != NULL) { KASSERT(pd->cdev->si_drv1 == pd, ("privdata corrupt")); - pcdev = pd->cdev; - pd->cdev = NULL; LIST_REMOVE(pd, pd_next); - if (pcdev != NULL) - destroy_dev_sched_cb(pcdev, usb_cdev_cleanup, pd); - } -} -static void -usb_cdev_cleanup(void* arg) -{ - free(arg, M_USBDEV); + usb_destroy_dev(pd); + } } #endif @@ -2046,8 +2062,7 @@ usb_free_device(struct usb_device *udev, } mtx_unlock(&usb_ref_lock); - destroy_dev_sched_cb(udev->ctrl_dev, usb_cdev_cleanup, - udev->ctrl_dev->si_drv1); + usb_destroy_dev(udev->ctrl_dev); #endif if (udev->flags.usb_mode == USB_MODE_DEVICE) { Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Thu Aug 11 10:29:10 2011 (r224776) +++ head/sys/dev/usb/usb_device.h Thu Aug 11 11:30:21 2011 (r224777) @@ -29,6 +29,7 @@ struct usb_symlink; /* UGEN */ struct usb_device; /* linux compat */ +struct usb_fs_privdata; #define USB_CTRL_XFER_MAX 2 @@ -135,7 +136,7 @@ struct usb_device { #if USB_HAVE_UGEN struct usb_fifo *fifo[USB_FIFO_MAX]; struct usb_symlink *ugen_symlink; /* our generic symlink */ - struct cdev *ctrl_dev; /* Control Endpoint 0 device node */ + struct usb_fs_privdata *ctrl_dev; /* Control Endpoint 0 device node */ LIST_HEAD(,usb_fs_privdata) pd_list; char ugen_name[20]; /* name of ugenX.X device */ #endif @@ -202,6 +203,11 @@ struct usb_device *usb_alloc_device(devi struct usb_device *parent_hub, uint8_t depth, uint8_t port_index, uint8_t port_no, enum usb_dev_speed speed, enum usb_hc_mode mode); +#if USB_HAVE_UGEN +struct usb_fs_privdata *usb_make_dev(struct usb_device *, const char *, + int, int, int, uid_t, gid_t, int); +void usb_destroy_dev(struct usb_fs_privdata *); +#endif usb_error_t usb_probe_and_attach(struct usb_device *udev, uint8_t iface_index); void usb_detach_device(struct usb_device *, uint8_t, uint8_t); Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Thu Aug 11 10:29:10 2011 (r224776) +++ head/sys/dev/usb/usbdi.h Thu Aug 11 11:30:21 2011 (r224777) @@ -37,6 +37,7 @@ struct usb_page_search; struct usb_process; struct usb_proc_msg; struct usb_mbuf; +struct usb_fs_privdata; struct mbuf; typedef enum { /* keep in sync with usb_errstr_table */ @@ -449,7 +450,7 @@ struct usb_fifo_methods { struct usb_fifo_sc { struct usb_fifo *fp[2]; - struct cdev* dev; + struct usb_fs_privdata *dev; }; const char *usbd_errstr(usb_error_t error); From owner-svn-src-head@FreeBSD.ORG Thu Aug 11 12:30:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29E7E106568C; Thu, 11 Aug 2011 12:30:24 +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 152118FC0C; Thu, 11 Aug 2011 12:30:24 +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 p7BCUOY2092865; Thu, 11 Aug 2011 12:30:24 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7BCUNnS092831; Thu, 11 Aug 2011 12:30:23 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108111230.p7BCUNnS092831@svn.freebsd.org> From: Robert Watson Date: Thu, 11 Aug 2011 12:30:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224778 - in head: sys/amd64/linux32 sys/cddl/compat/opensolaris/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/dev/aac sys/dev/amr sys/dev/hwpmc sys/dev/ipmi sys/dev/isc... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2011 12:30:24 -0000 Author: rwatson Date: Thu Aug 11 12:30:23 2011 New Revision: 224778 URL: http://svn.freebsd.org/changeset/base/224778 Log: Second-to-last commit implementing Capsicum capabilities in the FreeBSD kernel for FreeBSD 9.0: Add a new capability mask argument to fget(9) and friends, allowing system call code to declare what capabilities are required when an integer file descriptor is converted into an in-kernel struct file *. With options CAPABILITIES compiled into the kernel, this enforces capability protection; without, this change is effectively a no-op. Some cases require special handling, such as mmap(2), which must preserve information about the maximum rights at the time of mapping in the memory map so that they can later be enforced in mprotect(2) -- this is done by narrowing the rights in the existing max_protection field used for similar purposes with file permissions. In namei(9), we assert that the code is not reached from within capability mode, as we're not yet ready to enforce namespace capabilities there. This will follow in a later commit. Update two capability names: CAP_EVENT and CAP_KEVENT become CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they represent. Approved by: re (bz) Submitted by: jonathan Sponsored by: Google Inc Modified: head/sys/amd64/linux32/linux32_machdep.c head/sys/cddl/compat/opensolaris/sys/file.h head/sys/compat/freebsd32/freebsd32_ioctl.c head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_stats.c head/sys/compat/svr4/svr4_fcntl.c head/sys/compat/svr4/svr4_filio.c head/sys/compat/svr4/svr4_ioctl.c head/sys/compat/svr4/svr4_misc.c head/sys/compat/svr4/svr4_stream.c head/sys/dev/aac/aac_linux.c head/sys/dev/amr/amr_linux.c head/sys/dev/hwpmc/hwpmc_logging.c head/sys/dev/ipmi/ipmi_linux.c head/sys/dev/iscsi/initiator/iscsi.c head/sys/dev/mfi/mfi_linux.c head/sys/dev/snp/snp.c head/sys/dev/tdfx/tdfx_linux.c head/sys/fs/coda/coda_psdev.c head/sys/fs/fdescfs/fdesc_vnops.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/portalfs/portal_vfsops.c head/sys/fs/portalfs/portal_vnops.c head/sys/gnu/fs/xfs/xfs_dfrag.c head/sys/i386/ibcs2/ibcs2_fcntl.c head/sys/i386/ibcs2/ibcs2_ioctl.c head/sys/i386/ibcs2/ibcs2_misc.c head/sys/i386/linux/linux_machdep.c head/sys/kern/kern_descrip.c head/sys/kern/kern_event.c head/sys/kern/kern_exec.c head/sys/kern/sys_capability.c head/sys/kern/sys_generic.c head/sys/kern/tty.c head/sys/kern/uipc_mqueue.c head/sys/kern/uipc_sem.c head/sys/kern/uipc_syscalls.c head/sys/kern/vfs_acl.c head/sys/kern/vfs_aio.c head/sys/kern/vfs_extattr.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_syscalls.c head/sys/netgraph/ng_socket.c head/sys/nfsserver/nfs_srvkrpc.c head/sys/security/audit/audit_arg.c head/sys/security/mac/mac_syscalls.c head/sys/sys/capability.h head/sys/sys/file.h head/sys/sys/filedesc.h head/sys/ufs/ffs/ffs_alloc.c head/sys/vm/vm_mmap.c head/tools/regression/security/cap_test/cap_test.c head/tools/regression/security/cap_test/cap_test_capabilities.c Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/amd64/linux32/linux32_machdep.c Thu Aug 11 12:30:23 2011 (r224778) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -566,7 +567,7 @@ linux_mmap_common(struct thread *td, l_u * protection options specified. */ - if ((error = fget(td, bsd_args.fd, &fp)) != 0) + if ((error = fget(td, bsd_args.fd, CAP_MMAP, &fp)) != 0) return (error); if (fp->f_type != DTYPE_VNODE) { fdrop(fp, td); Modified: head/sys/cddl/compat/opensolaris/sys/file.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/file.h Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/cddl/compat/opensolaris/sys/file.h Thu Aug 11 12:30:23 2011 (r224778) @@ -36,12 +36,18 @@ #ifdef _KERNEL typedef struct file file_t; +#include + static __inline file_t * getf(int fd) { struct file *fp; - if (fget(curthread, fd, &fp) == 0) + /* + * We wouldn't need all of these rights on every invocation + * if we had more information about intent. + */ + if (fget(curthread, fd, CAP_READ | CAP_WRITE | CAP_SEEK, &fp) == 0) return (fp); return (NULL); } @@ -51,7 +57,8 @@ releasef(int fd) { struct file *fp; - if (fget(curthread, fd, &fp) == 0) { + /* No CAP_ rights required, as we're only releasing. */ + if (fget(curthread, fd, 0, &fp) == 0) { fdrop(fp, curthread); fdrop(fp, curthread); } Modified: head/sys/compat/freebsd32/freebsd32_ioctl.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_ioctl.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/freebsd32/freebsd32_ioctl.c Thu Aug 11 12:30:23 2011 (r224778) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include +#include #include #include #include @@ -354,7 +355,7 @@ freebsd32_ioctl(struct thread *td, struc struct file *fp; int error; - if ((error = fget(td, uap->fd, &fp)) != 0) + if ((error = fget(td, uap->fd, CAP_IOCTL, &fp)) != 0) return (error); if ((fp->f_flag & (FREAD | FWRITE)) == 0) { fdrop(fp, td); Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/linux/linux_file.c Thu Aug 11 12:30:23 2011 (r224778) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -141,7 +142,7 @@ linux_common_open(struct thread *td, int * having the same filedesc could use that fd without * checking below. */ - error = fget(td, fd, &fp); + error = fget(td, fd, CAP_IOCTL, &fp); if (!error) { sx_slock(&proctree_lock); PROC_LOCK(p); @@ -345,7 +346,7 @@ getdents_common(struct thread *td, struc } else justone = 0; - if ((error = getvnode(td->td_proc->p_fd, args->fd, &fp)) != 0) + if ((error = getvnode(td->td_proc->p_fd, args->fd, CAP_READ, &fp)) != 0) return (error); if ((fp->f_flag & FREAD) == 0) { @@ -1041,7 +1042,7 @@ linux_pread(td, uap) if (error == 0) { /* This seems to violate POSIX but linux does it */ - if ((error = fgetvp(td, uap->fd, &vp)) != 0) + if ((error = fgetvp(td, uap->fd, CAP_READ, &vp)) != 0) return (error); if (vp->v_type == VDIR) { vrele(vp); @@ -1390,7 +1391,7 @@ fcntl_common(struct thread *td, struct l * significant effect for pipes (SIGIO is not delivered for * pipes under Linux-2.2.35 at least). */ - error = fget(td, args->fd, &fp); + error = fget(td, args->fd, CAP_FCNTL, &fp); if (error) return (error); if (fp->f_type == DTYPE_PIPE) { Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/linux/linux_ioctl.c Thu Aug 11 12:30:23 2011 (r224778) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -193,7 +194,7 @@ linux_ioctl_hdio(struct thread *td, stru u_int sectorsize, fwcylinders, fwheads, fwsectors; off_t mediasize, bytespercyl; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); switch (args->cmd & 0xffff) { case LINUX_HDIO_GET_GEO: @@ -274,7 +275,7 @@ linux_ioctl_disk(struct thread *td, stru u_int sectorsize; off_t mediasize; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); switch (args->cmd & 0xffff) { case LINUX_BLKGETSIZE: @@ -700,7 +701,7 @@ linux_ioctl_termio(struct thread *td, st struct file *fp; int error; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); switch (args->cmd & 0xffff) { @@ -1440,7 +1441,7 @@ linux_ioctl_cdrom(struct thread *td, str struct file *fp; int error; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); switch (args->cmd & 0xffff) { @@ -1965,7 +1966,7 @@ linux_ioctl_console(struct thread *td, s struct file *fp; int error; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); switch (args->cmd & 0xffff) { @@ -2356,7 +2357,7 @@ linux_ioctl_socket(struct thread *td, st ifp = NULL; error = 0; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); type = fp->f_type; fdrop(fp, td); @@ -2582,7 +2583,7 @@ linux_ioctl_private(struct thread *td, s struct file *fp; int error, type; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); type = fp->f_type; fdrop(fp, td); @@ -2608,7 +2609,7 @@ linux_ioctl_sg(struct thread *td, struct u_long cmd; int error; - if ((error = fget(td, args->fd, &fp)) != 0) { + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) { printf("sg_linux_ioctl: fget returned %d\n", error); return (error); } @@ -2843,7 +2844,7 @@ linux_ioctl_v4l(struct thread *td, struc case LINUX_VIDIOCSCHAN: args->cmd = VIDIOCSCHAN; break; case LINUX_VIDIOCGTUNER: - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = copyin((void *) args->arg, &l_vtun, sizeof(l_vtun)); if (error) { @@ -2861,7 +2862,7 @@ linux_ioctl_v4l(struct thread *td, struc return (error); case LINUX_VIDIOCSTUNER: - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = copyin((void *) args->arg, &l_vtun, sizeof(l_vtun)); if (error) { @@ -2878,7 +2879,7 @@ linux_ioctl_v4l(struct thread *td, struc case LINUX_VIDIOCCAPTURE: args->cmd = VIDIOCCAPTURE; break; case LINUX_VIDIOCGWIN: - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = fo_ioctl(fp, VIDIOCGWIN, &vwin, td->td_ucred, td); if (!error) { @@ -2890,7 +2891,7 @@ linux_ioctl_v4l(struct thread *td, struc return (error); case LINUX_VIDIOCSWIN: - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = copyin((void *) args->arg, &l_vwin, sizeof(l_vwin)); if (error) { @@ -2913,7 +2914,7 @@ linux_ioctl_v4l(struct thread *td, struc return (error); case LINUX_VIDIOCGFBUF: - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = fo_ioctl(fp, VIDIOCGFBUF, &vbuf, td->td_ucred, td); if (!error) { @@ -2925,7 +2926,7 @@ linux_ioctl_v4l(struct thread *td, struc return (error); case LINUX_VIDIOCSFBUF: - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = copyin((void *) args->arg, &l_vbuf, sizeof(l_vbuf)); if (error) { @@ -2953,7 +2954,7 @@ linux_ioctl_v4l(struct thread *td, struc case LINUX_VIDIOCGPLAYINFO: args->cmd = VIDIOCGPLAYINFO; break; case LINUX_VIDIOCSMICROCODE: - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = copyin((void *) args->arg, &l_vcode, sizeof(l_vcode)); if (error) { @@ -3197,7 +3198,7 @@ linux_ioctl_v4l2(struct thread *td, stru error = copyin((void *)args->arg, &l_vformat, sizeof(l_vformat)); if (error) return (error); - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); if (linux_to_bsd_v4l2_format(&l_vformat, &vformat) != 0) error = EINVAL; @@ -3220,7 +3221,7 @@ linux_ioctl_v4l2(struct thread *td, stru if (error) return (error); linux_to_bsd_v4l2_standard(&l_vstd, &vstd); - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = fo_ioctl(fp, VIDIOC_ENUMSTD, (caddr_t)&vstd, td->td_ucred, td); @@ -3242,7 +3243,7 @@ linux_ioctl_v4l2(struct thread *td, stru sizeof(struct l_v4l2_input)); if (error != 0) return (error); - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = fo_ioctl(fp, VIDIOC_ENUMINPUT, (caddr_t)&vinp, td->td_ucred, td); @@ -3261,7 +3262,7 @@ linux_ioctl_v4l2(struct thread *td, stru error = copyin((void *)args->arg, &l_vbuf, sizeof(l_vbuf)); if (error) return (error); - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); linux_to_bsd_v4l2_buffer(&l_vbuf, &vbuf); if ((args->cmd & 0xffff) == LINUX_VIDIOC_QUERYBUF) @@ -3431,7 +3432,7 @@ linux_ioctl(struct thread *td, struct li (unsigned long)args->cmd); #endif - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); if ((fp->f_flag & (FREAD|FWRITE)) == 0) { fdrop(fp, td); Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/linux/linux_socket.c Thu Aug 11 12:30:23 2011 (r224778) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -743,7 +744,7 @@ linux_connect(struct thread *td, struct * socket and use the file descriptor reference instead of * creating a new one. */ - error = fgetsock(td, args->s, &so, &fflag); + error = fgetsock(td, args->s, CAP_CONNECT, &so, &fflag); if (error == 0) { error = EISCONN; if (fflag & FNONBLOCK) { Modified: head/sys/compat/linux/linux_stats.c ============================================================================== --- head/sys/compat/linux/linux_stats.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/linux/linux_stats.c Thu Aug 11 12:30:23 2011 (r224778) @@ -141,8 +141,11 @@ translate_fd_major_minor(struct thread * struct vnode *vp; int major, minor; + /* + * No capability rights required here. + */ if ((!S_ISCHR(buf->st_mode) && !S_ISBLK(buf->st_mode)) || - fget(td, fd, &fp) != 0) + fget(td, fd, 0, &fp) != 0) return; vp = fp->f_vnode; if (vp != NULL && vp->v_rdev != NULL && Modified: head/sys/compat/svr4/svr4_fcntl.c ============================================================================== --- head/sys/compat/svr4/svr4_fcntl.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/svr4/svr4_fcntl.c Thu Aug 11 12:30:23 2011 (r224778) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -261,7 +262,17 @@ fd_revoke(td, fd) int error, *retval; retval = td->td_retval; - if ((error = fgetvp(td, fd, &vp)) != 0) + /* + * If we ever want to support Capsicum on SVR4 processes (unlikely) + * or FreeBSD grows a native frevoke() (more likely), we will need a + * CAP_REVOKE here. + * + * In the meantime, use CAP_MASK_VALID: if a SVR4 process wants to + * do an frevoke(), it needs to do it on either a regular file + * descriptor or a fully-privileged capability (which is effectively + * the same as a non-capability-restricted file descriptor). + */ + if ((error = fgetvp(td, fd, CAP_MASK_VALID, &vp)) != 0) return (error); if (vp->v_type != VCHR && vp->v_type != VBLK) { @@ -313,7 +324,7 @@ fd_truncate(td, fd, flp) /* * We only support truncating the file. */ - if ((error = fget(td, fd, &fp)) != 0) + if ((error = fget(td, fd, CAP_FTRUNCATE, &fp)) != 0) return (error); vp = fp->f_vnode; @@ -392,7 +403,7 @@ svr4_sys_open(td, uap) #if defined(NOTYET) struct file *fp; - error = fget(td, retval, &fp); + error = fget(td, retval, CAP_IOCTL, &fp); PROC_UNLOCK(p); /* * we may have lost a race the above open() and Modified: head/sys/compat/svr4/svr4_filio.c ============================================================================== --- head/sys/compat/svr4/svr4_filio.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/svr4/svr4_filio.c Thu Aug 11 12:30:23 2011 (r224778) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -113,7 +114,7 @@ svr4_sys_read(td, uap) ra.buf = uap->buf; ra.nbyte = uap->nbyte; - if (fget(td, uap->fd, &fp) != 0) { + if (fget(td, uap->fd, CAP_READ, &fp) != 0) { DPRINTF(("Something fishy with the user-supplied file descriptor...\n")); return EBADF; } Modified: head/sys/compat/svr4/svr4_ioctl.c ============================================================================== --- head/sys/compat/svr4/svr4_ioctl.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/svr4/svr4_ioctl.c Thu Aug 11 12:30:23 2011 (r224778) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -102,7 +103,7 @@ svr4_sys_ioctl(td, uap) retval = td->td_retval; cmd = uap->com; - if ((error = fget(td, uap->fd, &fp)) != 0) + if ((error = fget(td, uap->fd, CAP_IOCTL, &fp)) != 0) return (error); if ((fp->f_flag & (FREAD | FWRITE)) == 0) { Modified: head/sys/compat/svr4/svr4_misc.c ============================================================================== --- head/sys/compat/svr4/svr4_misc.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/svr4/svr4_misc.c Thu Aug 11 12:30:23 2011 (r224778) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -246,7 +247,8 @@ svr4_sys_getdents64(td, uap) DPRINTF(("svr4_sys_getdents64(%d, *, %d)\n", uap->fd, uap->nbytes)); - if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) { + if ((error = getvnode(td->td_proc->p_fd, uap->fd, + CAP_READ | CAP_SEEK, &fp)) != 0) { return (error); } @@ -427,7 +429,8 @@ svr4_sys_getdents(td, uap) if (uap->nbytes < 0) return (EINVAL); - if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) + if ((error = getvnode(td->td_proc->p_fd, uap->fd, + CAP_READ | CAP_SEEK, &fp)) != 0) return (error); if ((fp->f_flag & FREAD) == 0) { @@ -615,7 +618,8 @@ svr4_sys_fchroot(td, uap) if ((error = priv_check(td, PRIV_VFS_FCHROOT)) != 0) return error; - if ((error = getvnode(fdp, uap->fd, &fp)) != 0) + /* XXX: we have the chroot priv... what cap might we need? all? */ + if ((error = getvnode(fdp, uap->fd, 0, &fp)) != 0) return error; vp = fp->f_vnode; VREF(vp); Modified: head/sys/compat/svr4/svr4_stream.c ============================================================================== --- head/sys/compat/svr4/svr4_stream.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/compat/svr4/svr4_stream.c Thu Aug 11 12:30:23 2011 (r224778) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1448,7 +1449,7 @@ svr4_sys_putmsg(td, uap) struct file *fp; int error; - if ((error = fget(td, uap->fd, &fp)) != 0) { + if ((error = fget(td, uap->fd, CAP_WRITE, &fp)) != 0) { #ifdef DEBUG_SVR4 uprintf("putmsg: bad fp\n"); #endif @@ -1620,7 +1621,7 @@ svr4_sys_getmsg(td, uap) struct file *fp; int error; - if ((error = fget(td, uap->fd, &fp)) != 0) { + if ((error = fget(td, uap->fd, CAP_READ, &fp)) != 0) { #ifdef DEBUG_SVR4 uprintf("getmsg: bad fp\n"); #endif Modified: head/sys/dev/aac/aac_linux.c ============================================================================== --- head/sys/dev/aac/aac_linux.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/dev/aac/aac_linux.c Thu Aug 11 12:30:23 2011 (r224778) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -78,7 +79,7 @@ aac_linux_ioctl(struct thread *td, struc u_long cmd; int error; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); cmd = args->cmd; Modified: head/sys/dev/amr/amr_linux.c ============================================================================== --- head/sys/dev/amr/amr_linux.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/dev/amr/amr_linux.c Thu Aug 11 12:30:23 2011 (r224778) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -74,7 +75,7 @@ amr_linux_ioctl(struct thread *p, struct struct file *fp; int error; - if ((error = fget(p, args->fd, &fp)) != 0) + if ((error = fget(p, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = fo_ioctl(fp, args->cmd, (caddr_t)args->arg, p->td_ucred, p); fdrop(fp, p); Modified: head/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_logging.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/dev/hwpmc/hwpmc_logging.c Thu Aug 11 12:30:23 2011 (r224778) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -589,7 +590,7 @@ pmclog_configure_log(struct pmc_mdep *md po->po_file)); /* get a reference to the file state */ - error = fget_write(curthread, logfd, &po->po_file); + error = fget_write(curthread, logfd, CAP_WRITE, &po->po_file); if (error) goto error; Modified: head/sys/dev/ipmi/ipmi_linux.c ============================================================================== --- head/sys/dev/ipmi/ipmi_linux.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/dev/ipmi/ipmi_linux.c Thu Aug 11 12:30:23 2011 (r224778) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -92,7 +93,7 @@ ipmi_linux_ioctl(struct thread *td, stru u_long cmd; int error; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); cmd = args->cmd; Modified: head/sys/dev/iscsi/initiator/iscsi.c ============================================================================== --- head/sys/dev/iscsi/initiator/iscsi.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/dev/iscsi/initiator/iscsi.c Thu Aug 11 12:30:23 2011 (r224778) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include "opt_iscsi_initiator.h" #include +#include #include #include #include @@ -387,11 +388,11 @@ i_setsoc(isc_session_t *sp, int fd, stru if(sp->soc != NULL) isc_stop_receiver(sp); - error = fget(td, fd, &sp->fp); + error = fget(td, fd, CAP_SOCK_ALL, &sp->fp); if(error) return error; - if((error = fgetsock(td, fd, &sp->soc, 0)) == 0) { + if((error = fgetsock(td, fd, CAP_SOCK_ALL, &sp->soc, 0)) == 0) { sp->td = td; isc_start_receiver(sp); } Modified: head/sys/dev/mfi/mfi_linux.c ============================================================================== --- head/sys/dev/mfi/mfi_linux.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/dev/mfi/mfi_linux.c Thu Aug 11 12:30:23 2011 (r224778) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -95,7 +96,7 @@ mfi_linux_ioctl(struct thread *p, struct break; } - if ((error = fget(p, args->fd, &fp)) != 0) + if ((error = fget(p, args->fd, CAP_IOCTL, &fp)) != 0) return (error); error = fo_ioctl(fp, cmd, (caddr_t)args->arg, p->td_ucred, p); fdrop(fp, p); Modified: head/sys/dev/snp/snp.c ============================================================================== --- head/sys/dev/snp/snp.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/dev/snp/snp.c Thu Aug 11 12:30:23 2011 (r224778) @@ -252,6 +252,9 @@ snp_ioctl(struct cdev *dev, u_long cmd, SNP_UNLOCK(); return (EBUSY); } + /* + * XXXRW / XXXJA: no capability check here. + */ error = ttyhook_register(&ss->snp_tty, td->td_proc, *(int *)data, &snp_hook, ss); SNP_UNLOCK(); Modified: head/sys/dev/tdfx/tdfx_linux.c ============================================================================== --- head/sys/dev/tdfx/tdfx_linux.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/dev/tdfx/tdfx_linux.c Thu Aug 11 12:30:23 2011 (r224778) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -53,7 +54,7 @@ linux_ioctl_tdfx(struct thread *td, stru struct file *fp; - if ((error = fget(td, args->fd, &fp)) != 0) + if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0) return (error); /* We simply copy the data and send it right to ioctl */ copyin((caddr_t)args->arg, &d_pio, sizeof(d_pio)); Modified: head/sys/fs/coda/coda_psdev.c ============================================================================== --- head/sys/fs/coda/coda_psdev.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/fs/coda/coda_psdev.c Thu Aug 11 12:30:23 2011 (r224778) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -371,7 +372,7 @@ vc_write(struct cdev *dev, struct uio *u struct vnode *vp = NULL; if (tmp->oh.result == 0) { - error = getvnode(uiop->uio_td->td_proc->p_fd, + error = getvnode(uiop->uio_td->td_proc->p_fd, CAP_WRITE, tmp->fd, &fp); if (!error) { /* Modified: head/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vnops.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/fs/fdescfs/fdesc_vnops.c Thu Aug 11 12:30:23 2011 (r224778) @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -305,7 +306,10 @@ fdesc_lookup(ap) fd = fd1; } - if ((error = fget(td, fd, &fp)) != 0) + /* + * No rights to check since 'fp' isn't actually used. + */ + if ((error = fget(td, fd, 0, &fp)) != 0) goto bad; /* Check if we're looking up ourselves. */ @@ -455,7 +459,7 @@ fdesc_setattr(ap) /* * Allow setattr where there is an underlying vnode. */ - error = getvnode(td->td_proc->p_fd, fd, &fp); + error = getvnode(td->td_proc->p_fd, fd, CAP_EXTATTR_SET, &fp); if (error) { /* * getvnode() returns EINVAL if the file descriptor is not Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/fs/nfsclient/nfs_clport.c Thu Aug 11 12:30:23 2011 (r224778) @@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$"); #include "opt_kdtrace.h" +#include + /* * generally, I don't like #includes inside .h files, but it seems to * be the easiest way to handle the port. @@ -1231,7 +1233,13 @@ nfssvc_nfscl(struct thread *td, struct n error = copyin(uap->argp, (caddr_t)&nfscbdarg, sizeof(nfscbdarg)); if (error) return (error); - if ((error = fget(td, nfscbdarg.sock, &fp)) != 0) { + /* + * Since we don't know what rights might be required, + * pretend that we need them all. It is better to be too + * careful than too reckless. + */ + if ((error = fget(td, nfscbdarg.sock, CAP_SOCK_ALL, &fp)) + != 0) { return (error); } if (fp->f_type != DTYPE_SOCKET) { Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Thu Aug 11 12:30:23 2011 (r224778) @@ -34,6 +34,8 @@ #include __FBSDID("$FreeBSD$"); +#include + /* * Functions that perform the vfs operations required by the routines in * nfsd_serv.c. It is hoped that this change will make the server more @@ -3027,8 +3029,14 @@ nfssvc_nfsd(struct thread *td, struct nf error = copyin(uap->argp, (caddr_t)&sockarg, sizeof (sockarg)); if (error) goto out; - if ((error = fget(td, sockarg.sock, &fp)) != 0) + /* + * Since we don't know what rights might be required, + * pretend that we need them all. It is better to be too + * careful than too reckless. + */ + if ((error = fget(td, sockarg.sock, CAP_SOCK_ALL, &fp)) != 0) goto out; + return (error); if (fp->f_type != DTYPE_SOCKET) { fdrop(fp, td); error = EPERM; Modified: head/sys/fs/portalfs/portal_vfsops.c ============================================================================== --- head/sys/fs/portalfs/portal_vfsops.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/fs/portalfs/portal_vfsops.c Thu Aug 11 12:30:23 2011 (r224778) @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -112,7 +113,12 @@ portal_mount(struct mount *mp) if (error) return (error); - if ((error = fget(td, v, &fp)) != 0) + /* + * Capsicum is not incompatible with portalfs, but we don't really + * know what rights are required. In the spirit of "better safe than + * sorry", pretend that all rights are required for now. + */ + if ((error = fget(td, v, CAP_MASK_VALID, &fp)) != 0) return (error); if (fp->f_type != DTYPE_SOCKET) { fdrop(fp, td); Modified: head/sys/fs/portalfs/portal_vnops.c ============================================================================== --- head/sys/fs/portalfs/portal_vnops.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/fs/portalfs/portal_vnops.c Thu Aug 11 12:30:23 2011 (r224778) @@ -38,7 +38,10 @@ * Portal Filesystem */ +#include "opt_capsicum.h" + #include +#include #include #include #include @@ -232,6 +235,15 @@ portal_open(ap) struct file *fp; struct portal_cred pcred; +#ifdef CAPABILITY_MODE + /* + * This may require access to a global namespace (e.g. an IP address); + * disallow it entirely, as we do open(2). + */ + if (IN_CAPABILITY_MODE(td)) + return (ECAPMODE); +#endif + /* * Nothing to do when opening the root node. */ @@ -414,7 +426,7 @@ portal_open(ap) * Check that the mode the file is being opened for is a subset * of the mode of the existing descriptor. */ - if ((error = fget(td, fd, &fp)) != 0) + if ((error = fget(td, fd, 0, &fp)) != 0) goto bad; if (((ap->a_mode & (FREAD|FWRITE)) | fp->f_flag) != fp->f_flag) { fdrop(fp, td); Modified: head/sys/gnu/fs/xfs/xfs_dfrag.c ============================================================================== --- head/sys/gnu/fs/xfs/xfs_dfrag.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/gnu/fs/xfs/xfs_dfrag.c Thu Aug 11 12:30:23 2011 (r224778) @@ -46,6 +46,7 @@ #include "xfs_mac.h" #include "xfs_rw.h" +#include #include /* @@ -79,7 +80,8 @@ xfs_swapext( } /* Pull information for the target fd */ - if (fgetvp(td, (int)sxp->sx_fdtarget, &bvp) != 0) { + if (fgetvp(td, (int)sxp->sx_fdtarget, CAP_READ | CAP_WRITE, &bvp) + != 0) { error = XFS_ERROR(EINVAL); goto error0; } @@ -91,7 +93,7 @@ xfs_swapext( goto error0; } - if (fgetvp(td, (int)sxp->sx_fdtmp, &btvp) != 0) { + if (fgetvp(td, (int)sxp->sx_fdtmp, CAP_READ | CAP_WRITE, &btvp) != 0) { error = XFS_ERROR(EINVAL); goto error0; } Modified: head/sys/i386/ibcs2/ibcs2_fcntl.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_fcntl.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/i386/ibcs2/ibcs2_fcntl.c Thu Aug 11 12:30:23 2011 (r224778) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -203,7 +204,7 @@ ibcs2_open(td, uap) struct file *fp; int error; - error = fget(td, td->td_retval[0], &fp); + error = fget(td, td->td_retval[0], CAP_IOCTL, &fp); PROC_UNLOCK(p); if (error) return (EBADF); Modified: head/sys/i386/ibcs2/ibcs2_ioctl.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_ioctl.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/i386/ibcs2/ibcs2_ioctl.c Thu Aug 11 12:30:23 2011 (r224778) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -333,7 +334,7 @@ ibcs2_ioctl(td, uap) struct file *fp; int error; - if ((error = fget(td, uap->fd, &fp)) != 0) { + if ((error = fget(td, uap->fd, CAP_IOCTL, &fp)) != 0) { DPRINTF(("ibcs2_ioctl(%d): bad fd %d ", p->p_pid, uap->fd)); return EBADF; Modified: head/sys/i386/ibcs2/ibcs2_misc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_misc.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/i386/ibcs2/ibcs2_misc.c Thu Aug 11 12:30:23 2011 (r224778) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); */ #include #include +#include #include #include #include @@ -336,7 +337,8 @@ ibcs2_getdents(td, uap) #define BSD_DIRENT(cp) ((struct dirent *)(cp)) #define IBCS2_RECLEN(reclen) (reclen + sizeof(u_short)) - if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) + if ((error = getvnode(td->td_proc->p_fd, uap->fd, + CAP_READ | CAP_SEEK, &fp)) != 0) return (error); if ((fp->f_flag & FREAD) == 0) { fdrop(fp, td); @@ -492,7 +494,8 @@ ibcs2_read(td, uap) u_long *cookies = NULL, *cookiep; int ncookies; - if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) { + if ((error = getvnode(td->td_proc->p_fd, uap->fd, + CAP_READ | CAP_SEEK, &fp)) != 0) { if (error == EINVAL) return read(td, (struct read_args *)uap); else Modified: head/sys/i386/linux/linux_machdep.c ============================================================================== --- head/sys/i386/linux/linux_machdep.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/i386/linux/linux_machdep.c Thu Aug 11 12:30:23 2011 (r224778) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -467,9 +468,12 @@ linux_mmap_common(struct thread *td, l_u * The file descriptor fildes is opened with * read permission, regardless of the * protection options specified. + * + * Checking just CAP_MMAP is fine here, since the real work + * is done in the FreeBSD mmap(). */ - if ((error = fget(td, bsd_args.fd, &fp)) != 0) + if ((error = fget(td, bsd_args.fd, CAP_MMAP, &fp)) != 0) return (error); if (fp->f_type != DTYPE_VNODE) { fdrop(fp, td); Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Aug 11 11:30:21 2011 (r224777) +++ head/sys/kern/kern_descrip.c Thu Aug 11 12:30:23 2011 (r224778) @@ -431,6 +431,26 @@ fdtofp(int fd, struct filedesc *fdp) return (fp); } +static inline int +fdunwrap(int fd, cap_rights_t rights, struct filedesc *fdp, struct file **fpp) +{ + + *fpp = fdtofp(fd, fdp); + if (*fpp == NULL) + return (EBADF); + +#ifdef CAPABILITIES + if ((*fpp)->f_type == DTYPE_CAPABILITY) { + int err = cap_funwrap(*fpp, rights, fpp); + if (err != 0) { + *fpp = NULL; + return (err); + } + } +#endif /* CAPABILITIES */ + return (0); +} + int kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) { @@ -489,9 +509,9 @@ kern_fcntl(struct thread *td, int fd, in case F_GETFL: FILEDESC_SLOCK(fdp); - if ((fp = fdtofp(fd, fdp)) == NULL) { + error = fdunwrap(fd, CAP_FCNTL, fdp, &fp); + if (error != 0) { FILEDESC_SUNLOCK(fdp); - error = EBADF; break; } td->td_retval[0] = OFLAGS(fp->f_flag); @@ -500,9 +520,9 @@ kern_fcntl(struct thread *td, int fd, in case F_SETFL: FILEDESC_SLOCK(fdp); - if ((fp = fdtofp(fd, fdp)) == NULL) { + error = fdunwrap(fd, CAP_FCNTL, fdp, &fp); + if (error != 0) { FILEDESC_SUNLOCK(fdp); - error = EBADF; break; } fhold(fp); @@ -532,9 +552,9 @@ kern_fcntl(struct thread *td, int fd, in case F_GETOWN: FILEDESC_SLOCK(fdp); - if ((fp = fdtofp(fd, fdp)) == NULL) { + error = fdunwrap(fd, CAP_FCNTL, fdp, &fp); + if (error != 0) { FILEDESC_SUNLOCK(fdp); - error = EBADF; break; } fhold(fp); @@ -547,9 +567,9 @@ kern_fcntl(struct thread *td, int fd, in case F_SETOWN: FILEDESC_SLOCK(fdp); - if ((fp = fdtofp(fd, fdp)) == NULL) { + error = fdunwrap(fd, CAP_FCNTL, fdp, &fp); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Aug 11 13:13:08 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EA03106564A; Thu, 11 Aug 2011 13:13:08 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DBB28FC1B; Thu, 11 Aug 2011 13:13:08 +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 p7BDD8QH094156; Thu, 11 Aug 2011 13:13:08 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7BDD8q7094154; Thu, 11 Aug 2011 13:13:08 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201108111313.p7BDD8q7094154@svn.freebsd.org> From: Takahashi Yoshihiro Date: Thu, 11 Aug 2011 13:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224779 - head/release X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2011 13:13:08 -0000 Author: nyan Date: Thu Aug 11 13:13:08 2011 New Revision: 224779 URL: http://svn.freebsd.org/changeset/base/224779 Log: Fix building a release with old release scheme. This catches up with renaming from Makefile to Makefile.sysinstall. Approved by: re (hrs) Modified: head/release/Makefile.sysinstall Modified: head/release/Makefile.sysinstall ============================================================================== --- head/release/Makefile.sysinstall Thu Aug 11 12:30:23 2011 (r224778) +++ head/release/Makefile.sysinstall Thu Aug 11 13:13:08 2011 (r224779) @@ -363,6 +363,8 @@ WMAKEENV!= cd ${.CURDIR}/..; \ WMAKE= ${WMAKEENV} ${BINMAKE} .endif +SMAKE= ${MAKE} -f ${MAKEFILE} + CVS_SRCARGS= -P .if defined(RELEASETAG) CVS_SRCARGS+= -r ${RELEASETAG} @@ -479,7 +481,7 @@ release rerelease: mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \ fi .if !defined(NO_PREFETCHDISTFILES) - @cd ${.CURDIR} && ${MAKE} fetch-distfiles + @cd ${.CURDIR} && ${SMAKE} fetch-distfiles .endif .endif .endif @@ -719,7 +721,7 @@ release.6: @for i in ${DISTRIBUTIONS} ; \ do \ if [ -d ${RD}/trees/$${i} ] ; then \ - cd ${.CURDIR} && $(MAKE) doTARBALL \ + cd ${.CURDIR} && $(SMAKE) doTARBALL \ SD=${RD}/trees/$${i} \ TN=$$i TD=$$i ARG="." && \ echo "$${i} distribution is finished."; \ @@ -728,7 +730,7 @@ release.6: @for i in ${KERNELS_BASE} ${KERNELS} ; \ do \ if [ -d ${RD}/kernels/$${i} ] ; then \ - cd ${.CURDIR} && $(MAKE) doTARBALL \ + cd ${.CURDIR} && $(SMAKE) doTARBALL \ SD=${RD}/kernels \ TN=$$i TD=kernels ARG="$$i" && \ echo "$${i} distribution is finished."; \ @@ -758,11 +760,11 @@ release.6: # release.7: .if !defined(NOSRC) - @cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \ + @cd ${.CURDIR} && $(SMAKE) doTARBALL SD=/usr/src \ TD=src TN=sbase ARG="[A-Z]*" @for i in `cd /usr/src && echo [a-z]*` ; do \ if [ -d /usr/src/$$i ] ; then \ - cd ${.CURDIR} && $(MAKE) doTARBALL \ + cd ${.CURDIR} && $(SMAKE) doTARBALL \ TN=`echo s$$i | tr -d '.' | \ sed -e 's/usr/u/' \ -e 's/kerberos5/krb5/'` \ @@ -773,7 +775,7 @@ release.7: @set ${EXTRA_SRC} && \ while [ $$# -ge 2 ] ; do \ if [ -d /usr/src/$$1 ] ; then \ - cd ${.CURDIR} && $(MAKE) doTARBALL \ + cd ${.CURDIR} && $(SMAKE) doTARBALL \ SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \ fi && shift && shift ; \ done @@ -796,7 +798,7 @@ release.8: cd ${RD}/mfsfd && \ mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help \ var/empty - @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \ + @cd ${.CURDIR} && $(SMAKE) installCRUNCH CRUNCH=boot \ DIR=${RD}/mfsfd/stand ZIP=false ( cd ${RD}/mfsfd && \ for dir in bin sbin ; do \ @@ -862,39 +864,39 @@ SMALLMFSROOTFLOPPYSET= ${RD}/floppyset/m floppies.1: @${ZIPPER} -c ${RD}/kernels/${KERN_GENERIC}/kernel > ${RD}/kernels/kernel.gz @echo "Making the kernel boot floppies..." - @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern \ + @cd ${.CURDIR} && ${SMAKE} makeFloppySet FLOPPYBASE=kern \ FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz .if defined(SMALLFLOPPYSIZE) @echo "Making the small kernel boot floppies..." - @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern-small \ + @cd ${.CURDIR} && ${SMAKE} makeFloppySet FLOPPYBASE=kern-small \ FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz \ FDSIZE="SMALL" .endif .if defined(SPLIT_MFSROOT) @echo "Making the mfsroot boot floppies..." - @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot \ + @cd ${.CURDIR} && ${SMAKE} makeFloppySet FLOPPYBASE=mfsroot \ FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz .if defined(SMALLFLOPPYSIZE) @echo "Making the small mfsroot boot floppies..." - @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot-small \ + @cd ${.CURDIR} && ${SMAKE} makeFloppySet FLOPPYBASE=mfsroot-small \ FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz \ FDSIZE="SMALL" .endif - @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \ + @cd ${.CURDIR} && ${SMAKE} buildBootFloppy FSIMAGE="boot" \ KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \ MFSROOTFILE="${MFSROOTFLOPPYSET}.split ${MFSROOTFLOPPYSET}.boot" .if defined(SMALLFLOPPYSIZE) - @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \ + @cd ${.CURDIR} && ${SMAKE} buildBootFloppy FSIMAGE="boot-small" \ KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \ MFSROOTFILE="${SMALLMFSROOTFLOPPYSET}.split ${SMALLMFSROOTFLOPPYSET}.boot" \ FDSIZE="SMALL" .endif .else # !SPLIT_MFSROOT - @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \ + @cd ${.CURDIR} && ${SMAKE} buildBootFloppy FSIMAGE="boot" \ KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \ MFSROOTFILE=${RD}/mfsroot/mfsroot.gz .if defined(SMALLFLOPPYSIZE) - @cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \ + @cd ${.CURDIR} && ${SMAKE} buildBootFloppy FSIMAGE="boot-small" \ KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \ MFSROOTFILE=${RD}/mfsroot/mfsroot.gz \ FDSIZE="SMALL" @@ -921,14 +923,14 @@ floppies.2: @cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar @chmod 555 ${RD}/fixitfd/stand/tar .if defined(SMALLFLOPPYSIZE) - @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \ + @cd ${.CURDIR} && ${SMAKE} installCRUNCH CRUNCH=fixit-small \ DIR=${RD}/fixitfd/stand ZIP=false @sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \ ${SMALLFLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${SMALLFLOPPYLABEL} @rm -rf ${RD}/fixitfd/stand @mkdir ${RD}/fixitfd/stand .endif - @cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \ + @cd ${.CURDIR} && ${SMAKE} installCRUNCH CRUNCH=fixit \ DIR=${RD}/fixitfd/stand ZIP=false @sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} ${MNT} \ ${FLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${FLOPPYLABEL} @@ -1245,7 +1247,7 @@ doRELEASE: release.1 release.2 ${DOCREL} floppies: @rm -f release.4 release.8 floppies.[123] - @cd ${.CURDIR} && ${MAKE} release.4 release.8 floppies.1 floppies.2 \ + @cd ${.CURDIR} && ${SMAKE} release.4 release.8 floppies.1 floppies.2 \ floppies.3 @cd ${RD} && find floppies -print | cpio -dumpl ${FD} From owner-svn-src-head@FreeBSD.ORG Thu Aug 11 13:15:12 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03DF5106564A; Thu, 11 Aug 2011 13:15:12 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E81838FC1A; Thu, 11 Aug 2011 13:15:11 +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 p7BDFBKF094259; Thu, 11 Aug 2011 13:15:11 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7BDFBfv094257; Thu, 11 Aug 2011 13:15:11 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201108111315.p7BDFBfv094257@svn.freebsd.org> From: Takahashi Yoshihiro Date: Thu, 11 Aug 2011 13:15:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224780 - head/release X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2011 13:15:12 -0000 Author: nyan Date: Thu Aug 11 13:15:11 2011 New Revision: 224780 URL: http://svn.freebsd.org/changeset/base/224780 Log: Allow to build a release for stable/[78] on a current box and vise versa. Approved by: re (hrs) MFC after: 1 week Modified: head/release/Makefile.sysinstall Modified: head/release/Makefile.sysinstall ============================================================================== --- head/release/Makefile.sysinstall Thu Aug 11 13:13:08 2011 (r224779) +++ head/release/Makefile.sysinstall Thu Aug 11 13:15:11 2011 (r224780) @@ -600,7 +600,11 @@ release rerelease: echo "fi" >> ${_MK} echo "cd /usr/src/release" >> ${_MK} echo "make obj" >> ${_MK} - echo "make -f Makefile.sysinstall \$${_RELTARGET}" >> ${_MK} + echo "if [ -f Makefile.sysinstall ]; then" >> ${_MK} + echo " make -f Makefile.sysinstall \$${_RELTARGET}" >> ${_MK} + echo "else" >> ${_MK} + echo " make \$${_RELTARGET}" >> ${_MK} + echo "fi" >> ${_MK} echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK} chmod 755 ${_MK} .if defined(NOPORTS) From owner-svn-src-head@FreeBSD.ORG Thu Aug 11 13:30:00 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A4D41065673; Thu, 11 Aug 2011 13:30:00 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0995C8FC14; Thu, 11 Aug 2011 13:30:00 +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 p7BDTxxb094721; Thu, 11 Aug 2011 13:29:59 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7BDTxVN094719; Thu, 11 Aug 2011 13:29:59 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108111329.p7BDTxVN094719@svn.freebsd.org> From: Jonathan Anderson Date: Thu, 11 Aug 2011 13:29:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224781 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2011 13:30:00 -0000 Author: jonathan Date: Thu Aug 11 13:29:59 2011 New Revision: 224781 URL: http://svn.freebsd.org/changeset/base/224781 Log: Only call fdclose() on successfully-opened FDs. Since kern_openat() now uses falloc_noinstall() and finstall() separately, there are cases where we could get to cleanup code without ever creating a file descriptor. In those cases, we should not call fdclose() on FD -1. Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Thu Aug 11 13:15:11 2011 (r224780) +++ head/sys/kern/vfs_syscalls.c Thu Aug 11 13:29:59 2011 (r224781) @@ -1116,7 +1116,8 @@ kern_openat(struct thread *td, int fd, c * Clean up the descriptor, but only if another thread hadn't * replaced or closed it. */ - fdclose(fdp, fp, indx, td); + if (indx != -1) + fdclose(fdp, fp, indx, td); fdrop(fp, td); if (error == ERESTART) @@ -1185,7 +1186,8 @@ success: bad: VFS_UNLOCK_GIANT(vfslocked); bad_unlocked: - fdclose(fdp, fp, indx, td); + if (indx != -1) + fdclose(fdp, fp, indx, td); fdrop(fp, td); td->td_retval[0] = -1; return (error); From owner-svn-src-head@FreeBSD.ORG Thu Aug 11 15:52:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CA04106566C; Thu, 11 Aug 2011 15:52:07 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BE0F8FC13; Thu, 11 Aug 2011 15:52: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 p7BFq7hv099067; Thu, 11 Aug 2011 15:52:07 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7BFq73l099065; Thu, 11 Aug 2011 15:52:07 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108111552.p7BFq73l099065@svn.freebsd.org> From: Jonathan Anderson Date: Thu, 11 Aug 2011 15:52:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224784 - head/tools/regression/security/cap_test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2011 15:52:07 -0000 Author: jonathan Date: Thu Aug 11 15:52:06 2011 New Revision: 224784 URL: http://svn.freebsd.org/changeset/base/224784 Log: Use the right printf() format string without a cast to maxint_t. As per kib's suggestion, we also change test_count from a size_t to an int; its value at the moment is 4, and we only expect it to go up to 7. Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Modified: head/tools/regression/security/cap_test/cap_test.c Modified: head/tools/regression/security/cap_test/cap_test.c ============================================================================== --- head/tools/regression/security/cap_test/cap_test.c Thu Aug 11 15:22:46 2011 (r224783) +++ head/tools/regression/security/cap_test/cap_test.c Thu Aug 11 15:52:06 2011 (r224784) @@ -51,7 +51,7 @@ struct test all_tests[] = { TEST_INIT(fcntl), TEST_INIT(sysctl), }; -size_t test_count = sizeof(all_tests) / sizeof(struct test); +int test_count = sizeof(all_tests) / sizeof(struct test); int main(int argc, char *argv[]) @@ -61,9 +61,9 @@ main(int argc, char *argv[]) * If no tests have been specified at the command line, run them all. */ if (argc == 1) { - printf("1..%ju\n", (uintmax_t)test_count); + printf("1..%d\n", test_count); - for (size_t i = 0; i < test_count; i++) + for (int i = 0; i < test_count; i++) execute(i + 1, all_tests + i); return (0); } @@ -75,7 +75,7 @@ main(int argc, char *argv[]) for (int i = 1; i < argc; i++) { int found = 0; - for (size_t j = 0; j < test_count; j++) { + for (int j = 0; j < test_count; j++) { if (strncmp(argv[i], all_tests[j].t_name, strlen(argv[i])) == 0) { found = 1; From owner-svn-src-head@FreeBSD.ORG Thu Aug 11 21:01:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F406106564A; Thu, 11 Aug 2011 21:01:25 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id D0D128FC08; Thu, 11 Aug 2011 21:01:24 +0000 (UTC) Received: by ewy1 with SMTP id 1so1408719ewy.13 for ; Thu, 11 Aug 2011 14:01:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=6xZoOTu4EEKWHmwmk0mr3hdXN3SAFiNYov7SELzsKy0=; b=dXo1HU+IBkpaKBLDcuWJsDUZ7ka0YMUull3jpnrhlg1S4VozKiNzmagh1TsLeJEs3y B5/+Hga8dOb1qsjIR3FQyVtNuwgHUv4ZuAPNvKsqvOAb1KLyJnE8iOYbMvQacly+L7yS up1a+Q2YpAiWjkC5PFGrGbCdIv0Qsmij5VPS8= MIME-Version: 1.0 Received: by 10.213.16.77 with SMTP id n13mr310167eba.135.1313096483583; Thu, 11 Aug 2011 14:01:23 -0700 (PDT) Received: by 10.213.2.148 with HTTP; Thu, 11 Aug 2011 14:01:23 -0700 (PDT) In-Reply-To: <201106080812.p588CFjb021267@svn.freebsd.org> References: <201106080812.p588CFjb021267@svn.freebsd.org> Date: Thu, 11 Aug 2011 17:01:23 -0400 Message-ID: From: Ryan Stone To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222853 - in head: . sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/i386/include sys/pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2011 21:01:26 -0000 On Wed, Jun 8, 2011 at 4:12 AM, Andriy Gapon wrote: > Author: avg > Date: Wed Jun =A08 08:12:15 2011 > New Revision: 222853 > URL: http://svn.freebsd.org/changeset/base/222853 > > Log: > =A0remove code for dynamic offlining/onlining of CPUs on x86 > > =A0The code has definitely been broken for SCHED_ULE, which is a default > =A0scheduler. =A0It may have been broken for SCHED_4BSD in more subtle wa= ys, > =A0e.g. with manually configured CPU affinities and for interrupt deviler= y > =A0purposes. I can confirm that this was very broken for SCHED_4BSD. The softclock threads are kicked off from hardclock_cpu(). When you offline a CPU, hardclock_cpu() never runs for that CPU so its softclock thread is never run. If you happen to have any callouts scheduled on that softclock thread they will never run unless the corresponding CPU is brought online again. In a particular case that I've been looking at, the hyperthreading_allowed tunable was set to 0 on a system running a derivative of 8.2-RELEASE. Unfortunately it seems that there is a window in SCHED_4BSD during which the hyperthreads run even if you disable them via tunable. It seems that bufdaemon ran on one of the hyperthreads and then went to sleep. It's thread's td_slpcallout was scheduled on the hyperthread's softclock thread, and then 4BSD finally got around to disabling the hyperthreads. Hilarity ensues as bufdaemon never wakes up. In short, there's currently no safe way to disable hyperthreading on stable/8. I know that you and Attilio originally decided not to MFC this as these sysctls were considered a part of the ABI, but seeing as the functionality that this ABI is intended to present is completely broken, I'm wondering if an MFC is the lesser evil. From owner-svn-src-head@FreeBSD.ORG Fri Aug 12 07:04:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 064031065670; Fri, 12 Aug 2011 07:04:17 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9ABF8FC0C; Fri, 12 Aug 2011 07:04:16 +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 p7C74GTU026748; Fri, 12 Aug 2011 07:04:16 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7C74GTR026743; Fri, 12 Aug 2011 07:04:16 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201108120704.p7C74GTR026743@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 12 Aug 2011 07:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224791 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2011 07:04:17 -0000 Author: pjd Date: Fri Aug 12 07:04:16 2011 New Revision: 224791 URL: http://svn.freebsd.org/changeset/base/224791 Log: Eliminate the zfsdev_state_lock entirely and replace it with the spa_namespace_lock. This fixes LOR between the spa_namespace_lock and spa_config lock. LOR can cause deadlock on vdevs removal/insertion. Reported by: gibbs, delphij Tested by: delphij Approved by: re (kib) MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Fri Aug 12 04:06:43 2011 (r224790) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Fri Aug 12 07:04:16 2011 (r224791) @@ -353,7 +353,6 @@ extern void *zfsdev_get_soft_state(minor extern minor_t zfsdev_minor_alloc(void); extern void *zfsdev_state; -extern kmutex_t zfsdev_state_lock; #endif /* _KERNEL */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Aug 12 04:06:43 2011 (r224790) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Aug 12 07:04:16 2011 (r224791) @@ -410,7 +410,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi struct g_provider *pp; struct g_consumer *cp; size_t bufsize; - int error, lock; + int error; /* * We must have a pathname, and it must be absolute. @@ -422,12 +422,6 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_tsd = NULL; - if (mutex_owned(&spa_namespace_lock)) { - mutex_exit(&spa_namespace_lock); - lock = 1; - } else { - lock = 0; - } DROP_GIANT(); g_topology_lock(); error = 0; @@ -459,11 +453,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi !ISP2(cp->provider->sectorsize)) { ZFS_LOG(1, "Provider %s has unsupported sectorsize.", vd->vdev_path); - - g_topology_lock(); vdev_geom_detach(cp, 0); - g_topology_unlock(); - error = EINVAL; cp = NULL; } else if (cp->acw == 0 && (spa_mode(vd->vdev_spa) & FWRITE) != 0) { @@ -486,8 +476,6 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi } g_topology_unlock(); PICKUP_GIANT(); - if (lock) - mutex_enter(&spa_namespace_lock); if (cp == NULL) { vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; return (error); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Aug 12 04:06:43 2011 (r224790) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Aug 12 07:04:16 2011 (r224791) @@ -4813,7 +4813,7 @@ zfsdev_minor_alloc(void) static minor_t last_minor; minor_t m; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); for (m = last_minor + 1; m != last_minor; m++) { if (m > ZFSDEV_MAX_MINOR) @@ -4833,7 +4833,7 @@ zfs_ctldev_init(struct cdev *devp) minor_t minor; zfs_soft_state_t *zs; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); minor = zfsdev_minor_alloc(); if (minor == 0) @@ -4854,7 +4854,7 @@ zfs_ctldev_init(struct cdev *devp) static void zfs_ctldev_destroy(zfs_onexit_t *zo, minor_t minor) { - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); zfs_onexit_destroy(zo); ddi_soft_state_free(zfsdev_state, minor); @@ -4884,9 +4884,9 @@ zfsdev_open(struct cdev *devp, int flag, /* This is the control device. Allocate a new minor if requested. */ if (flag & FEXCL) { - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); error = zfs_ctldev_init(devp); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); } return (error); @@ -4901,14 +4901,14 @@ zfsdev_close(void *data) if (minor == 0) return; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zo = zfsdev_get_soft_state(minor, ZSST_CTLDEV); if (zo == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return; } zfs_ctldev_destroy(zo, minor); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); } static int Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Aug 12 04:06:43 2011 (r224790) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Aug 12 07:04:16 2011 (r224791) @@ -94,12 +94,11 @@ static char *zvol_tag = "zvol_tag"; #define ZVOL_DUMPSIZE "dumpsize" /* - * This lock protects the zfsdev_state structure from being modified - * while it's being used, e.g. an open that comes in before a create - * finishes. It also protects temporary opens of the dataset so that, + * The spa_namespace_lock protects the zfsdev_state structure from being + * modified while it's being used, e.g. an open that comes in before a + * create finishes. It also protects temporary opens of the dataset so that, * e.g., an open doesn't get a spurious EBUSY. */ -kmutex_t zfsdev_state_lock; static uint32_t zvol_minors; typedef struct zvol_extent { @@ -246,7 +245,7 @@ zvol_minor_lookup(const char *name) struct g_geom *gp; zvol_state_t *zv = NULL; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); g_topology_lock(); LIST_FOREACH(gp, &zfs_zvol_class.geom, geom) { @@ -462,11 +461,11 @@ zvol_name2minor(const char *name, minor_ { zvol_state_t *zv; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = zvol_minor_lookup(name); if (minor && zv) *minor = zv->zv_minor; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (zv ? 0 : -1); } #endif /* sun */ @@ -485,10 +484,10 @@ zvol_create_minor(const char *name) ZFS_LOG(1, "Creating ZVOL %s...", name); - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); if (zvol_minor_lookup(name) != NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (EEXIST); } @@ -496,20 +495,20 @@ zvol_create_minor(const char *name) error = dmu_objset_own(name, DMU_OST_ZVOL, B_TRUE, FTAG, &os); if (error) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } #ifdef sun if ((minor = zfsdev_minor_alloc()) == 0) { dmu_objset_disown(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } if (ddi_soft_state_zalloc(zfsdev_state, minor) != DDI_SUCCESS) { dmu_objset_disown(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (EAGAIN); } (void) ddi_prop_update_string(minor, zfs_dip, ZVOL_PROP_NAME, @@ -521,7 +520,7 @@ zvol_create_minor(const char *name) minor, DDI_PSEUDO, 0) == DDI_FAILURE) { ddi_soft_state_free(zfsdev_state, minor); dmu_objset_disown(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (EAGAIN); } @@ -532,7 +531,7 @@ zvol_create_minor(const char *name) ddi_remove_minor_node(zfs_dip, chrbuf); ddi_soft_state_free(zfsdev_state, minor); dmu_objset_disown(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (EAGAIN); } @@ -572,7 +571,7 @@ zvol_create_minor(const char *name) zvol_minors++; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); zvol_geom_run(zv); @@ -594,7 +593,7 @@ zvol_remove_zv(zvol_state_t *zv) minor_t minor = zv->zv_minor; #endif - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); if (zv->zv_total_opens != 0) return (EBUSY); @@ -620,15 +619,15 @@ zvol_remove_minor(const char *name) zvol_state_t *zv; int rc; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); if ((zv = zvol_minor_lookup(name)) == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } g_topology_lock(); rc = zvol_remove_zv(zv); g_topology_unlock(); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (rc); } @@ -730,7 +729,7 @@ zvol_update_volsize(objset_t *os, uint64 dmu_tx_t *tx; int error; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); tx = dmu_tx_create(os); dmu_tx_hold_zap(tx, ZVOL_ZAP_OBJ, TRUE, NULL); @@ -761,7 +760,7 @@ zvol_remove_minors(const char *name) namelen = strlen(name); DROP_GIANT(); - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); g_topology_lock(); LIST_FOREACH_SAFE(gp, &zfs_zvol_class.geom, geom, gptmp) { @@ -779,7 +778,7 @@ zvol_remove_minors(const char *name) } g_topology_unlock(); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); PICKUP_GIANT(); } @@ -793,10 +792,10 @@ zvol_set_volsize(const char *name, major uint64_t old_volsize = 0ULL; uint64_t readonly; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = zvol_minor_lookup(name); if ((error = dmu_objset_hold(name, FTAG, &os)) != 0) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } @@ -863,7 +862,7 @@ zvol_set_volsize(const char *name, major out: dmu_objset_rele(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } @@ -875,18 +874,18 @@ zvol_open(struct g_provider *pp, int fla zvol_state_t *zv; int err = 0; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = pp->private; if (zv == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } if (zv->zv_total_opens == 0) err = zvol_first_open(zv); if (err) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (err); } if ((flag & FWRITE) && (zv->zv_flags & ZVOL_RDONLY)) { @@ -908,13 +907,13 @@ zvol_open(struct g_provider *pp, int fla #endif zv->zv_total_opens += count; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (err); out: if (zv->zv_total_opens == 0) zvol_last_close(zv); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (err); } @@ -925,11 +924,11 @@ zvol_close(struct g_provider *pp, int fl zvol_state_t *zv; int error = 0; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = pp->private; if (zv == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } @@ -952,7 +951,7 @@ zvol_close(struct g_provider *pp, int fl if (zv->zv_total_opens == 0) zvol_last_close(zv); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } @@ -1571,12 +1570,12 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t int error = 0; rl_t *rl; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = zfsdev_get_soft_state(getminor(dev), ZSST_ZVOL); if (zv == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } ASSERT(zv->zv_total_opens > 0); @@ -1590,7 +1589,7 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t dki.dki_ctype = DKC_UNKNOWN; dki.dki_unit = getminor(dev); dki.dki_maxtransfer = 1 << (SPA_MAXBLOCKSHIFT - zv->zv_min_bs); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); if (ddi_copyout(&dki, (void *)arg, sizeof (dki), flag)) error = EFAULT; return (error); @@ -1600,7 +1599,7 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t dkm.dki_lbsize = 1U << zv->zv_min_bs; dkm.dki_capacity = zv->zv_volsize >> zv->zv_min_bs; dkm.dki_media_type = DK_UNKNOWN; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); if (ddi_copyout(&dkm, (void *)arg, sizeof (dkm), flag)) error = EFAULT; return (error); @@ -1610,14 +1609,14 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t uint64_t vs = zv->zv_volsize; uint8_t bs = zv->zv_min_bs; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); error = zvol_getefi((void *)arg, flag, vs, bs); return (error); } case DKIOCFLUSHWRITECACHE: dkc = (struct dk_callback *)arg; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); zil_commit(zv->zv_zilog, ZVOL_OBJ); if ((flag & FKIOCTL) && dkc != NULL && dkc->dkc_callback) { (*dkc->dkc_callback)(dkc->dkc_cookie, error); @@ -1643,10 +1642,10 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t } if (wce) { zv->zv_flags |= ZVOL_WCE; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); } else { zv->zv_flags &= ~ZVOL_WCE; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); zil_commit(zv->zv_zilog, ZVOL_OBJ); } return (0); @@ -1682,7 +1681,7 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t break; } - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } #endif /* sun */ @@ -1698,14 +1697,12 @@ zvol_init(void) { VERIFY(ddi_soft_state_init(&zfsdev_state, sizeof (zfs_soft_state_t), 1) == 0); - mutex_init(&zfsdev_state_lock, NULL, MUTEX_DEFAULT, NULL); ZFS_LOG(1, "ZVOL Initialized."); } void zvol_fini(void) { - mutex_destroy(&zfsdev_state_lock); ddi_soft_state_fini(&zfsdev_state); ZFS_LOG(1, "ZVOL Deinitialized."); } @@ -1720,7 +1717,7 @@ zvol_dump_init(zvol_state_t *zv, boolean nvlist_t *nv = NULL; uint64_t version = spa_version(dmu_objset_spa(zv->zv_objset)); - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ, 0, DMU_OBJECT_END); /* wait for dmu_free_long_range to actually free the blocks */ @@ -2230,7 +2227,7 @@ zvol_rename_minor(struct g_geom *gp, con struct g_provider *pp; zvol_state_t *zv; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); g_topology_assert(); pp = LIST_FIRST(&gp->provider); @@ -2264,7 +2261,7 @@ zvol_rename_minors(const char *oldname, newnamelen = strlen(newname); DROP_GIANT(); - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); g_topology_lock(); LIST_FOREACH(gp, &zfs_zvol_class.geom, geom) { @@ -2287,6 +2284,6 @@ zvol_rename_minors(const char *oldname, } g_topology_unlock(); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); PICKUP_GIANT(); } From owner-svn-src-head@FreeBSD.ORG Fri Aug 12 10:52:47 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 204261065670; Fri, 12 Aug 2011 10:52:47 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DDBE8FC0C; Fri, 12 Aug 2011 10:52:47 +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 p7CAqkva033649; Fri, 12 Aug 2011 10:52:46 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7CAqkoe033644; Fri, 12 Aug 2011 10:52:46 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108121052.p7CAqkoe033644@svn.freebsd.org> From: Jonathan Anderson Date: Fri, 12 Aug 2011 10:52:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224793 - head/tools/regression/security/cap_test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2011 10:52:47 -0000 Author: jonathan Date: Fri Aug 12 10:52:46 2011 New Revision: 224793 URL: http://svn.freebsd.org/changeset/base/224793 Log: Test *at(2) calls with capability-mode lookup. This commit adds regression testing for openat(), fstatat(), etc. with capability scoping ("strict relative" lookup), which applies: - in capability mode - when performing any *at() lookup relative to a capability These tests will fail until the *at() code is committed; on my local instance, with the *at() changes, they all pass. Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Added: head/tools/regression/security/cap_test/cap_test_relative.c (contents, props changed) Modified: head/tools/regression/security/cap_test/Makefile head/tools/regression/security/cap_test/cap_test.c head/tools/regression/security/cap_test/cap_test.h Modified: head/tools/regression/security/cap_test/Makefile ============================================================================== --- head/tools/regression/security/cap_test/Makefile Fri Aug 12 09:18:02 2011 (r224792) +++ head/tools/regression/security/cap_test/Makefile Fri Aug 12 10:52:46 2011 (r224793) @@ -5,7 +5,9 @@ SRCS= cap_test.c \ cap_test_capmode.c \ cap_test_capabilities.c \ cap_test_fcntl.c \ - cap_test_sysctl.c + cap_test_relative.c \ + cap_test_sysctl.c \ + WARNS= 3 NO_MAN= Modified: head/tools/regression/security/cap_test/cap_test.c ============================================================================== --- head/tools/regression/security/cap_test/cap_test.c Fri Aug 12 09:18:02 2011 (r224792) +++ head/tools/regression/security/cap_test/cap_test.c Fri Aug 12 10:52:46 2011 (r224793) @@ -49,6 +49,7 @@ struct test all_tests[] = { TEST_INIT(capmode), TEST_INIT(capabilities), TEST_INIT(fcntl), + TEST_INIT(relative), TEST_INIT(sysctl), }; int test_count = sizeof(all_tests) / sizeof(struct test); Modified: head/tools/regression/security/cap_test/cap_test.h ============================================================================== --- head/tools/regression/security/cap_test/cap_test.h Fri Aug 12 09:18:02 2011 (r224792) +++ head/tools/regression/security/cap_test/cap_test.h Fri Aug 12 10:52:46 2011 (r224793) @@ -148,8 +148,8 @@ int execute(int id, struct test*); int test_capmode(void); int test_capabilities(void); -int test_syscalls(void); -int test_sysctl(void); int test_fcntl(void); +int test_relative(void); +int test_sysctl(void); #endif /* CAP_TEST_H */ Added: head/tools/regression/security/cap_test/cap_test_relative.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/security/cap_test/cap_test_relative.c Fri Aug 12 10:52:46 2011 (r224793) @@ -0,0 +1,151 @@ +/*- + * Copyright (c) 2009-2011 Robert N. M. Watson + * Copyright (c) 2011 Jonathan Anderson + * 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. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "cap_test.h" + +/* + * Test openat(2) in a variety of sitations to ensure that it obeys Capsicum + * "strict relative" rules: + * + * 1. Use strict relative lookups in capability mode or when operating + * relative to a capability. + * 2. When performing strict relative lookups, absolute paths (including + * symlinks to absolute paths) are not allowed, nor are paths containing + * '..' components. + */ +int +test_relative(void) +{ + int success = PASSED; + int fd, etc, etc_cap, etc_cap_ro, etc_cap_base, etc_cap_all; + cap_rights_t baserights = CAP_READ | CAP_WRITE | CAP_SEEK | CAP_LOOKUP; + cap_rights_t rights; + + REQUIRE(etc = open("/etc/", O_RDONLY)); + CHECK_SYSCALL_FAILS(EINVAL, cap_getrights, etc, &rights); + + MAKE_CAPABILITY(etc_cap, etc, CAP_READ); + MAKE_CAPABILITY(etc_cap_ro, etc, CAP_READ | CAP_LOOKUP); + MAKE_CAPABILITY(etc_cap_base, etc, baserights); + MAKE_CAPABILITY(etc_cap_all, etc, CAP_MASK_VALID); + + /* + * openat(2) with regular file descriptors in non-capability mode + * should Just Work (tm). + */ + CHECK_SYSCALL_SUCCEEDS(openat, etc, "/etc/passwd", O_RDONLY); + CHECK_SYSCALL_SUCCEEDS(openat, AT_FDCWD, "/etc/passwd", O_RDONLY); + CHECK_SYSCALL_SUCCEEDS(openat, etc, "passwd", O_RDONLY); + CHECK_SYSCALL_SUCCEEDS(openat, etc, "../etc/passwd", O_RDONLY); + + /* + * Lookups relative to capabilities should be strictly relative. + * + * When not in capability mode, we don't actually require CAP_LOOKUP. + */ + CHECK_SYSCALL_SUCCEEDS(openat, etc_cap_ro, "passwd", O_RDONLY); + CHECK_SYSCALL_SUCCEEDS(openat, etc_cap_base, "passwd", O_RDONLY); + CHECK_SYSCALL_SUCCEEDS(openat, etc_cap_all, "passwd", O_RDONLY); + + CHECK_NOTCAPABLE(openat, etc_cap_ro, "../etc/passwd", O_RDONLY); + CHECK_NOTCAPABLE(openat, etc_cap_base, "../etc/passwd", O_RDONLY); + + /* + * This requires discussion: do we treat a capability with + * CAP_MASK_VALID *exactly* like a non-capability file descriptor + * (currently, the implementation says yes)? + */ + CHECK_SYSCALL_SUCCEEDS(openat, etc_cap_all, "../etc/passwd", O_RDONLY); + + /* + * A file opened relative to a capability should itself be a capability. + */ + CHECK_SYSCALL_SUCCEEDS(cap_getrights, etc_cap_base, &rights); + + REQUIRE(fd = openat(etc_cap_base, "passwd", O_RDONLY)); + CHECK_SYSCALL_SUCCEEDS(cap_getrights, fd, &rights); + CHECK_RIGHTS(rights, baserights); + + /* + * Enter capability mode; now ALL lookups are strictly relative. + */ + REQUIRE(cap_enter()); + + /* + * Relative lookups on regular files or capabilities with CAP_LOOKUP + * ought to succeed. + */ + CHECK_SYSCALL_SUCCEEDS(openat, etc, "passwd", O_RDONLY); + CHECK_SYSCALL_SUCCEEDS(openat, etc_cap_ro, "passwd", O_RDONLY); + CHECK_SYSCALL_SUCCEEDS(openat, etc_cap_base, "passwd", O_RDONLY); + CHECK_SYSCALL_SUCCEEDS(openat, etc_cap_all, "passwd", O_RDONLY); + + /* + * Lookup relative to capabilities without CAP_LOOKUP should fail. + */ + CHECK_NOTCAPABLE(openat, etc_cap, "passwd", O_RDONLY); + + /* + * Absolute lookups should fail. + */ + CHECK_CAPMODE(openat, AT_FDCWD, "/etc/passwd", O_RDONLY); + CHECK_NOTCAPABLE(openat, etc, "/etc/passwd", O_RDONLY); + + /* + * Lookups containing '..' should fail in capability mode. + */ + CHECK_NOTCAPABLE(openat, etc, "../etc/passwd", O_RDONLY); + CHECK_NOTCAPABLE(openat, etc_cap_ro, "../etc/passwd", O_RDONLY); + CHECK_NOTCAPABLE(openat, etc_cap_base, "../etc/passwd", O_RDONLY); + + REQUIRE(fd = openat(etc, "passwd", O_RDONLY)); + CHECK_SYSCALL_SUCCEEDS(cap_getrights, fd, &rights); + + /* + * A file opened relative to a capability should itself be a capability. + */ + REQUIRE(fd = openat(etc_cap_base, "passwd", O_RDONLY)); + CHECK_SYSCALL_SUCCEEDS(cap_getrights, fd, &rights); + CHECK_RIGHTS(rights, baserights); + + return success; +} From owner-svn-src-head@FreeBSD.ORG Fri Aug 12 11:43:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A43D210656D3; Fri, 12 Aug 2011 11:43:56 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8927F8FC1F; Fri, 12 Aug 2011 11:43:56 +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 p7CBhutW052059; Fri, 12 Aug 2011 11:43:56 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7CBhudc052057; Fri, 12 Aug 2011 11:43:56 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108121143.p7CBhudc052057@svn.freebsd.org> From: Jonathan Anderson Date: Fri, 12 Aug 2011 11:43:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224794 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2011 11:43:56 -0000 Author: jonathan Date: Fri Aug 12 11:43:56 2011 New Revision: 224794 URL: http://svn.freebsd.org/changeset/base/224794 Log: Reorder and renumber capability rights. This patch does three things: - puts capability rights in a more pleasing declaration order - changes mask values to match the new declaration order - declare new rights which will be used soon (e.g. CAP_LOOKUP, CAP_MKDIR) Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Modified: head/sys/sys/capability.h Modified: head/sys/sys/capability.h ============================================================================== --- head/sys/sys/capability.h Fri Aug 12 10:52:46 2011 (r224793) +++ head/sys/sys/capability.h Fri Aug 12 11:43:56 2011 (r224794) @@ -76,30 +76,38 @@ #define CAP_FSTAT 0x0000000000010000ULL #define CAP_FSTATFS 0x0000000000020000ULL #define CAP_FUTIMES 0x0000000000040000ULL +#define CAP_CREATE 0x0000000000080000ULL +#define CAP_DELETE 0x0000000000100000ULL +#define CAP_MKDIR 0x0000000000200000ULL +#define CAP_RMDIR 0x0000000000400000ULL +#define CAP_MKFIFO 0x0000000000800000ULL + +/* Lookups - used to constrain *at() calls. */ +#define CAP_LOOKUP 0x0000000001000000ULL /* Extended attributes. */ -#define CAP_EXTATTR_DELETE 0x0000000000080000ULL -#define CAP_EXTATTR_GET 0x0000000000100000ULL -#define CAP_EXTATTR_LIST 0x0000000000200000ULL -#define CAP_EXTATTR_SET 0x0000000000400000ULL +#define CAP_EXTATTR_DELETE 0x0000000002000000ULL +#define CAP_EXTATTR_GET 0x0000000004000000ULL +#define CAP_EXTATTR_LIST 0x0000000008000000ULL +#define CAP_EXTATTR_SET 0x0000000010000000ULL /* Access Control Lists. */ -#define CAP_ACL_CHECK 0x0000000000800000ULL -#define CAP_ACL_DELETE 0x0000000001000000ULL -#define CAP_ACL_GET 0x0000000002000000ULL -#define CAP_ACL_SET 0x0000000004000000ULL +#define CAP_ACL_CHECK 0x0000000020000000ULL +#define CAP_ACL_DELETE 0x0000000040000000ULL +#define CAP_ACL_GET 0x0000000080000000ULL +#define CAP_ACL_SET 0x0000000100000000ULL /* Socket operations. */ -#define CAP_ACCEPT 0x0000000008000000ULL -#define CAP_BIND 0x0000000010000000ULL -#define CAP_CONNECT 0x0000000020000000ULL -#define CAP_GETPEERNAME 0x0000000040000000ULL -#define CAP_GETSOCKNAME 0x0000000080000000ULL -#define CAP_GETSOCKOPT 0x0000000100000000ULL -#define CAP_LISTEN 0x0000000200000000ULL -#define CAP_PEELOFF 0x0000000400000000ULL -#define CAP_SETSOCKOPT 0x0000000800000000ULL -#define CAP_SHUTDOWN 0x0000001000000000ULL +#define CAP_ACCEPT 0x0000000200000000ULL +#define CAP_BIND 0x0000000400000000ULL +#define CAP_CONNECT 0x0000000800000000ULL +#define CAP_GETPEERNAME 0x0000001000000000ULL +#define CAP_GETSOCKNAME 0x0000002000000000ULL +#define CAP_GETSOCKOPT 0x0000004000000000ULL +#define CAP_LISTEN 0x0000008000000000ULL +#define CAP_PEELOFF 0x0000010000000000ULL +#define CAP_SETSOCKOPT 0x0000020000000000ULL +#define CAP_SHUTDOWN 0x0000040000000000ULL #define CAP_SOCK_ALL \ (CAP_ACCEPT | CAP_BIND | CAP_CONNECT \ @@ -107,24 +115,24 @@ | CAP_LISTEN | CAP_PEELOFF | CAP_SETSOCKOPT | CAP_SHUTDOWN) /* Mandatory Access Control. */ -#define CAP_MAC_GET 0x0000002000000000ULL -#define CAP_MAC_SET 0x0000004000000000ULL +#define CAP_MAC_GET 0x0000080000000000ULL +#define CAP_MAC_SET 0x0000100000000000ULL /* Methods on semaphores. */ -#define CAP_SEM_GETVALUE 0x0000008000000000ULL -#define CAP_SEM_POST 0x0000010000000000ULL -#define CAP_SEM_WAIT 0x0000020000000000ULL +#define CAP_SEM_GETVALUE 0x0000200000000000ULL +#define CAP_SEM_POST 0x0000400000000000ULL +#define CAP_SEM_WAIT 0x0000800000000000ULL /* kqueue events. */ -#define CAP_POLL_KEVENT 0x0000040000000000ULL -#define CAP_POST_KEVENT 0x0000080000000000ULL +#define CAP_POLL_KEVENT 0x0001000000000000ULL +#define CAP_POST_KEVENT 0x0002000000000000ULL /* Strange and powerful rights that should not be given lightly. */ -#define CAP_IOCTL 0x0000100000000000ULL -#define CAP_TTYHOOK 0x0000200000000000ULL +#define CAP_IOCTL 0x0004000000000000ULL +#define CAP_TTYHOOK 0x0008000000000000ULL /* The mask of all valid method rights. */ -#define CAP_MASK_VALID 0x00003fffffffffffULL +#define CAP_MASK_VALID 0x000fffffffffffffULL #ifdef _KERNEL From owner-svn-src-head@FreeBSD.ORG Fri Aug 12 14:26:47 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83FC9106566B; Fri, 12 Aug 2011 14:26:47 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6890A8FC19; Fri, 12 Aug 2011 14:26:47 +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 p7CEQltS067454; Fri, 12 Aug 2011 14:26:47 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7CEQlEm067448; Fri, 12 Aug 2011 14:26:47 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108121426.p7CEQlEm067448@svn.freebsd.org> From: Jonathan Anderson Date: Fri, 12 Aug 2011 14:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224797 - in head: sys/kern sys/sys tools/regression/security/cap_test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2011 14:26:47 -0000 Author: jonathan Date: Fri Aug 12 14:26:47 2011 New Revision: 224797 URL: http://svn.freebsd.org/changeset/base/224797 Log: Rename CAP_*_KEVENT to CAP_*_EVENT. Change the names of a couple of capability rights to be less FreeBSD-specific. Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Modified: head/sys/kern/kern_event.c head/sys/kern/sys_generic.c head/sys/kern/uipc_mqueue.c head/sys/sys/capability.h head/tools/regression/security/cap_test/cap_test_capabilities.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Fri Aug 12 14:16:45 2011 (r224796) +++ head/sys/kern/kern_event.c Fri Aug 12 14:26:47 2011 (r224797) @@ -817,7 +817,7 @@ kern_kevent(struct thread *td, int fd, i struct file *fp; int i, n, nerrors, error; - if ((error = fget(td, fd, CAP_POST_KEVENT, &fp)) != 0) + if ((error = fget(td, fd, CAP_POST_EVENT, &fp)) != 0) return (error); if ((error = kqueue_acquire(fp, &kq)) != 0) goto done_norel; @@ -973,7 +973,7 @@ kqueue_register(struct kqueue *kq, struc findkn: if (fops->f_isfd) { KASSERT(td != NULL, ("td is NULL")); - error = fget(td, kev->ident, CAP_POLL_KEVENT, &fp); + error = fget(td, kev->ident, CAP_POLL_EVENT, &fp); if (error) goto done; @@ -2182,7 +2182,7 @@ kqfd_register(int fd, struct kevent *kev struct file *fp; int error; - if ((error = fget(td, fd, CAP_POST_KEVENT, &fp)) != 0) + if ((error = fget(td, fd, CAP_POST_EVENT, &fp)) != 0) return (error); if ((error = kqueue_acquire(fp, &kq)) != 0) goto noacquire; Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Fri Aug 12 14:16:45 2011 (r224796) +++ head/sys/kern/sys_generic.c Fri Aug 12 14:26:47 2011 (r224797) @@ -1072,7 +1072,7 @@ getselfd_cap(struct filedesc *fdp, int f * If the file descriptor is for a capability, test rights and use * the file descriptor references by the capability. */ - error = cap_funwrap(fp, CAP_POLL_KEVENT, &fp_fromcap); + error = cap_funwrap(fp, CAP_POLL_EVENT, &fp_fromcap); if (error) { fdrop(fp, curthread); return (error); Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Fri Aug 12 14:16:45 2011 (r224796) +++ head/sys/kern/uipc_mqueue.c Fri Aug 12 14:26:47 2011 (r224797) @@ -2119,7 +2119,7 @@ static __inline int getmq(struct thread *td, int fd, struct file **fpp, struct mqfs_node **ppn, struct mqueue **pmq) { - return _getmq(td, fd, CAP_POLL_KEVENT, fget, fpp, ppn, pmq); + return _getmq(td, fd, CAP_POLL_EVENT, fget, fpp, ppn, pmq); } static __inline int @@ -2274,7 +2274,7 @@ again: error = EBADF; goto out; } - error = cap_funwrap(fp2, CAP_POLL_KEVENT, &fp2); + error = cap_funwrap(fp2, CAP_POLL_EVENT, &fp2); if (error) { FILEDESC_SUNLOCK(fdp); goto out; Modified: head/sys/sys/capability.h ============================================================================== --- head/sys/sys/capability.h Fri Aug 12 14:16:45 2011 (r224796) +++ head/sys/sys/capability.h Fri Aug 12 14:26:47 2011 (r224797) @@ -124,8 +124,8 @@ #define CAP_SEM_WAIT 0x0000800000000000ULL /* kqueue events. */ -#define CAP_POLL_KEVENT 0x0001000000000000ULL -#define CAP_POST_KEVENT 0x0002000000000000ULL +#define CAP_POLL_EVENT 0x0001000000000000ULL +#define CAP_POST_EVENT 0x0002000000000000ULL /* Strange and powerful rights that should not be given lightly. */ #define CAP_IOCTL 0x0004000000000000ULL Modified: head/tools/regression/security/cap_test/cap_test_capabilities.c ============================================================================== --- head/tools/regression/security/cap_test/cap_test_capabilities.c Fri Aug 12 14:16:45 2011 (r224796) +++ head/tools/regression/security/cap_test/cap_test_capabilities.c Fri Aug 12 14:26:47 2011 (r224797) @@ -237,8 +237,8 @@ test_capabilities(void) TRY(fd, CAP_MMAP | CAP_MAPEXEC | CAP_WRITE); TRY(fd, CAP_MMAP | CAP_READ | CAP_WRITE | CAP_MAPEXEC); TRY(fd, CAP_FCNTL); - TRY(fd, CAP_POST_KEVENT); - TRY(fd, CAP_POLL_KEVENT); + TRY(fd, CAP_POST_EVENT); + TRY(fd, CAP_POLL_EVENT); TRY(fd, CAP_FSYNC); TRY(fd, CAP_FCHOWN); TRY(fd, CAP_FCHMOD); From owner-svn-src-head@FreeBSD.ORG Fri Aug 12 19:51:28 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAD981065673; Fri, 12 Aug 2011 19:51:28 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F2AD8FC0C; Fri, 12 Aug 2011 19:51:28 +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 p7CJpSAv080376; Fri, 12 Aug 2011 19:51:28 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7CJpSnn080373; Fri, 12 Aug 2011 19:51:28 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201108121951.p7CJpSnn080373@svn.freebsd.org> From: Matt Jacob Date: Fri, 12 Aug 2011 19:51:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224804 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2011 19:51:28 -0000 Author: mjacob Date: Fri Aug 12 19:51:28 2011 New Revision: 224804 URL: http://svn.freebsd.org/changeset/base/224804 Log: Fixes zombie device and loop down timers so that they work more than once. Use taskqueues to do the actual work. Fix an offset line. Fix isp_prt so that prints from just one buffer, which makes it appear cleanly cleanly in logs on SMP systems. Approved by: re (kib) MFC after: 1 month Modified: head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/isp_freebsd.h Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Fri Aug 12 16:21:05 2011 (r224803) +++ head/sys/dev/isp/isp_freebsd.c Fri Aug 12 19:51:28 2011 (r224804) @@ -67,7 +67,10 @@ static void isp_intr_enable(void *); static void isp_cam_async(void *, uint32_t, struct cam_path *, void *); static void isp_poll(struct cam_sim *); static timeout_t isp_watchdog; +static timeout_t isp_gdt; +static task_fn_t isp_gdt_task; static timeout_t isp_ldt; +static task_fn_t isp_ldt_task; static void isp_kthread(void *); static void isp_action(struct cam_sim *, union ccb *); #ifdef ISP_INTERNAL_TARGET @@ -141,8 +144,11 @@ isp_attach_chan(ispsoftc_t *isp, struct fc->path = path; fc->isp = isp; fc->ready = 1; + callout_init_mtx(&fc->ldt, &isp->isp_osinfo.lock, 0); callout_init_mtx(&fc->gdt, &isp->isp_osinfo.lock, 0); + TASK_INIT(&fc->ltask, 1, isp_ldt_task, fc); + TASK_INIT(&fc->gtask, 1, isp_gdt_task, fc); /* * We start by being "loop down" if we have an initiator role @@ -3937,12 +3943,20 @@ static void isp_gdt(void *arg) { struct isp_fc *fc = arg; + taskqueue_enqueue(taskqueue_thread, &fc->gtask); +} + +static void +isp_gdt_task(void *arg, int pending) +{ + struct isp_fc *fc = arg; ispsoftc_t *isp = fc->isp; int chan = fc - isp->isp_osinfo.pc.fc; fcportdb_t *lp; int dbidx, tgt, more_to_do = 0; - isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d GDT timer expired @ %lu", chan, (unsigned long) time_uptime); + ISP_LOCK(isp); + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d GDT timer expired", chan); for (dbidx = 0; dbidx < MAX_FC_TARG; dbidx++) { lp = &FCPARAM(isp, chan)->portdb[dbidx]; @@ -3953,6 +3967,7 @@ isp_gdt(void *arg) continue; } if (lp->gone_timer != 0) { + isp_prt(isp, ISP_LOGSANCFG, "%s: Chan %d more to do for target %u (timer=%u)", __func__, chan, lp->dev_map_idx - 1, lp->gone_timer); lp->gone_timer -= 1; more_to_do++; continue; @@ -3968,9 +3983,11 @@ isp_gdt(void *arg) if (more_to_do) { callout_reset(&fc->gdt, hz, isp_gdt, fc); } else { - isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d Stopping Gone Device Timer", chan); + callout_deactivate(&fc->gdt); + isp_prt(isp, ISP_LOGSANCFG, "Chan %d Stopping Gone Device Timer @ %lu", chan, (unsigned long) time_uptime); } } + ISP_UNLOCK(isp); } /* @@ -3986,12 +4003,21 @@ static void isp_ldt(void *arg) { struct isp_fc *fc = arg; + taskqueue_enqueue(taskqueue_thread, &fc->ltask); +} + +static void +isp_ldt_task(void *arg, int pending) +{ + struct isp_fc *fc = arg; ispsoftc_t *isp = fc->isp; int chan = fc - isp->isp_osinfo.pc.fc; fcportdb_t *lp; int dbidx, tgt; + ISP_LOCK(isp); isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d Loop Down Timer expired @ %lu", chan, (unsigned long) time_uptime); + callout_deactivate(&fc->ldt); /* * Notify to the OS all targets who we now consider have departed. @@ -4631,7 +4657,7 @@ isp_action(struct cam_sim *sim, union cc if (kp->xport_specific.fc.valid & KNOB_VALID_ADDRESS) { fcp->isp_wwnn = ISP_FC_PC(isp, bus)->def_wwnn = kp->xport_specific.fc.wwnn; fcp->isp_wwpn = ISP_FC_PC(isp, bus)->def_wwpn = kp->xport_specific.fc.wwpn; -isp_prt(isp, ISP_LOGALL, "Setting Channel %d wwns to 0x%jx 0x%jx", bus, fcp->isp_wwnn, fcp->isp_wwpn); + isp_prt(isp, ISP_LOGALL, "Setting Channel %d wwns to 0x%jx 0x%jx", bus, fcp->isp_wwnn, fcp->isp_wwpn); } ccb->ccb_h.status = CAM_REQ_CMP; if (kp->xport_specific.fc.valid & KNOB_VALID_ROLE) { @@ -5423,15 +5449,19 @@ isp_default_wwn(ispsoftc_t * isp, int ch void isp_prt(ispsoftc_t *isp, int level, const char *fmt, ...) { + int loc; + char lbuf[128]; va_list ap; + if (level != ISP_LOGALL && (level & isp->isp_dblev) == 0) { return; } - printf("%s: ", device_get_nameunit(isp->isp_dev)); + sprintf(lbuf, "%s: ", device_get_nameunit(isp->isp_dev)); + loc = strlen(lbuf); va_start(ap, fmt); - vprintf(fmt, ap); + vsnprintf(&lbuf[loc], sizeof (lbuf) - loc - 1, fmt, ap); va_end(ap); - printf("\n"); + printf("%s\n", lbuf); } void Modified: head/sys/dev/isp/isp_freebsd.h ============================================================================== --- head/sys/dev/isp/isp_freebsd.h Fri Aug 12 16:21:05 2011 (r224803) +++ head/sys/dev/isp/isp_freebsd.h Fri Aug 12 19:51:28 2011 (r224804) @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -182,6 +183,8 @@ struct isp_fc { ready : 1; struct callout ldt; /* loop down timer */ struct callout gdt; /* gone device timer */ + struct task ltask; + struct task gtask; #ifdef ISP_TARGET_MODE struct tslist lun_hash[LUN_HASH_SIZE]; #ifdef ISP_INTERNAL_TARGET From owner-svn-src-head@FreeBSD.ORG Fri Aug 12 20:09:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A157F1065672; Fri, 12 Aug 2011 20:09:38 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90BAA8FC19; Fri, 12 Aug 2011 20:09:38 +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 p7CK9cEg081054; Fri, 12 Aug 2011 20:09:38 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7CK9cgo081051; Fri, 12 Aug 2011 20:09:38 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201108122009.p7CK9cgo081051@svn.freebsd.org> From: Matt Jacob Date: Fri, 12 Aug 2011 20:09:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224806 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2011 20:09:38 -0000 Author: mjacob Date: Fri Aug 12 20:09:38 2011 New Revision: 224806 URL: http://svn.freebsd.org/changeset/base/224806 Log: Fixes for sure bus reference miscounting and potential device and target reference miscounts. It also adds a helper function to get the current reference counts for components of cam_path for debug aid. One minor style(9) change. Partially Obtained from: Chuck Tuffli (Emulex) Reviewed by: scsi@ (ken) Approved by: re (kib) MFC after: 1 month Modified: head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt.h Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Fri Aug 12 20:02:47 2011 (r224805) +++ head/sys/cam/cam_xpt.c Fri Aug 12 20:09:38 2011 (r224806) @@ -3336,8 +3336,10 @@ xpt_create_path_unlocked(struct cam_path } } status = xpt_compile_path(path, periph, path_id, target_id, lun_id); - if (need_unlock) + if (need_unlock) { CAM_SIM_UNLOCK(bus->sim); + xpt_release_bus(bus); + } if (status != CAM_REQ_CMP) { free(path, M_CAMXPT); path = NULL; @@ -3445,6 +3447,38 @@ xpt_free_path(struct cam_path *path) free(path, M_CAMXPT); } +void +xpt_path_counts(struct cam_path *path, uint32_t *bus_ref, + uint32_t *periph_ref, uint32_t *target_ref, uint32_t *device_ref) +{ + + mtx_lock(&xsoftc.xpt_topo_lock); + if (bus_ref) { + if (path->bus) + *bus_ref = path->bus->refcount; + else + *bus_ref = 0; + } + mtx_unlock(&xsoftc.xpt_topo_lock); + if (periph_ref) { + if (path->periph) + *periph_ref = path->periph->refcount; + else + *periph_ref = 0; + } + if (target_ref) { + if (path->target) + *target_ref = path->target->refcount; + else + *target_ref = 0; + } + if (device_ref) { + if (path->device) + *device_ref = path->device->refcount; + else + *device_ref = 0; + } +} /* * Return -1 for failure, 0 for exact match, 1 for match with wildcards @@ -4264,15 +4298,17 @@ static void xpt_release_bus(struct cam_eb *bus) { + mtx_lock(&xsoftc.xpt_topo_lock); + KASSERT(bus->refcount >= 1, ("bus->refcount >= 1")); if ((--bus->refcount == 0) && (TAILQ_FIRST(&bus->et_entries) == NULL)) { - mtx_lock(&xsoftc.xpt_topo_lock); TAILQ_REMOVE(&xsoftc.xpt_busses, bus, links); xsoftc.bus_generation++; mtx_unlock(&xsoftc.xpt_topo_lock); cam_sim_release(bus->sim); free(bus, M_CAMXPT); - } + } else + mtx_unlock(&xsoftc.xpt_topo_lock); } static struct cam_et * @@ -4296,7 +4332,9 @@ xpt_alloc_target(struct cam_eb *bus, tar * Hold a reference to our parent bus so it * will not go away before we do. */ + mtx_lock(&xsoftc.xpt_topo_lock); bus->refcount++; + mtx_unlock(&xsoftc.xpt_topo_lock); /* Insertion sort into our bus's target list */ cur_target = TAILQ_FIRST(&bus->et_entries); @@ -4317,15 +4355,17 @@ static void xpt_release_target(struct cam_et *target) { - if ((--target->refcount == 0) - && (TAILQ_FIRST(&target->ed_entries) == NULL)) { - TAILQ_REMOVE(&target->bus->et_entries, target, links); - target->bus->generation++; - xpt_release_bus(target->bus); - if (target->luns) - free(target->luns, M_CAMXPT); - free(target, M_CAMXPT); - } + if (target->refcount == 1) { + if (TAILQ_FIRST(&target->ed_entries) == NULL) { + TAILQ_REMOVE(&target->bus->et_entries, target, links); + target->bus->generation++; + xpt_release_bus(target->bus); + if (target->luns) + free(target->luns, M_CAMXPT); + free(target, M_CAMXPT); + } + } else + target->refcount--; } static struct cam_ed * @@ -4422,7 +4462,7 @@ void xpt_release_device(struct cam_ed *device) { - if (--device->refcount == 0) { + if (device->refcount == 1) { struct cam_devq *devq; if (device->alloc_ccb_entry.pinfo.index != CAM_UNQUEUED_INDEX @@ -4430,7 +4470,7 @@ xpt_release_device(struct cam_ed *device panic("Removing device while still queued for ccbs"); if ((device->flags & CAM_DEV_REL_TIMEOUT_PENDING) != 0) - callout_stop(&device->callout); + callout_stop(&device->callout); TAILQ_REMOVE(&device->target->ed_entries, device,links); device->target->generation++; @@ -4442,7 +4482,8 @@ xpt_release_device(struct cam_ed *device cam_ccbq_fini(&device->ccbq); xpt_release_target(device->target); free(device, M_CAMXPT); - } + } else + device->refcount--; } u_int32_t Modified: head/sys/cam/cam_xpt.h ============================================================================== --- head/sys/cam/cam_xpt.h Fri Aug 12 20:02:47 2011 (r224805) +++ head/sys/cam/cam_xpt.h Fri Aug 12 20:09:38 2011 (r224806) @@ -106,6 +106,9 @@ cam_status xpt_create_path_unlocked(str int xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path); void xpt_free_path(struct cam_path *path); +void xpt_path_counts(struct cam_path *path, uint32_t *bus_ref, + uint32_t *periph_ref, uint32_t *target_ref, + uint32_t *device_ref); int xpt_path_comp(struct cam_path *path1, struct cam_path *path2); void xpt_print_path(struct cam_path *path); @@ -138,4 +141,3 @@ void xpt_release_path(struct cam_path #endif /* _KERNEL */ #endif /* _CAM_CAM_XPT_H */ - From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 09:21:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12F15106566C; Sat, 13 Aug 2011 09:21:17 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 002CD8FC13; Sat, 13 Aug 2011 09:21:16 +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 p7D9LGPx005251; Sat, 13 Aug 2011 09:21:16 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7D9LGIK005244; Sat, 13 Aug 2011 09:21:16 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108130921.p7D9LGIK005244@svn.freebsd.org> From: Jonathan Anderson Date: Sat, 13 Aug 2011 09:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224810 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 09:21:17 -0000 Author: jonathan Date: Sat Aug 13 09:21:16 2011 New Revision: 224810 URL: http://svn.freebsd.org/changeset/base/224810 Log: Allow Capsicum capabilities to delegate constrained access to file system subtrees to sandboxed processes. - Use of absolute paths and '..' are limited in capability mode. - Use of absolute paths and '..' are limited when looking up relative to a capability. - When a name lookup is performed, identify what operation is to be performed (such as CAP_MKDIR) as well as check for CAP_LOOKUP. With these constraints, openat() and friends are now safe in capability mode, and can then be used by code such as the capability-mode runtime linker. Approved by: re (bz), mentor (rwatson) Sponsored by: Google Inc Modified: head/sys/kern/kern_descrip.c head/sys/kern/sys_capability.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_syscalls.c head/sys/sys/capability.h head/sys/sys/namei.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sat Aug 13 00:56:42 2011 (r224809) +++ head/sys/kern/kern_descrip.c Sat Aug 13 09:21:16 2011 (r224810) @@ -2336,6 +2336,16 @@ _fget(struct thread *td, int fd, struct #ifdef CAPABILITIES /* + * If this is a capability, what rights does it have? + */ + if (haverightsp != NULL) { + if (fp->f_type == DTYPE_CAPABILITY) + *haverightsp = cap_rights(fp); + else + *haverightsp = CAP_MASK_VALID; + } + + /* * If a capability has been requested, return the capability directly. * Otherwise, check capability rights, extract the underlying object, * and check its access flags. Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Sat Aug 13 00:56:42 2011 (r224809) +++ head/sys/kern/sys_capability.c Sat Aug 13 09:21:16 2011 (r224810) @@ -220,7 +220,7 @@ cap_new(struct thread *td, struct cap_ne { int error, capfd; int fd = uap->fd; - struct file *fp, *fcapp; + struct file *fp; cap_rights_t rights = uap->rights; AUDIT_ARG_FD(fd); @@ -229,7 +229,7 @@ cap_new(struct thread *td, struct cap_ne if (error) return (error); AUDIT_ARG_FILE(td->td_proc, fp); - error = kern_capwrap(td, fp, rights, &fcapp, &capfd); + error = kern_capwrap(td, fp, rights, &capfd); if (error) return (error); @@ -267,10 +267,10 @@ cap_getrights(struct thread *td, struct */ int kern_capwrap(struct thread *td, struct file *fp, cap_rights_t rights, - struct file **fcappp, int *capfdp) + int *capfdp) { struct capability *cp, *cp_old; - struct file *fp_object; + struct file *fp_object, *fcapp; int error; if ((rights | CAP_MASK_VALID) != CAP_MASK_VALID) @@ -290,7 +290,7 @@ kern_capwrap(struct thread *td, struct f /* * Allocate a new file descriptor to hang the capability off of. */ - error = falloc(td, fcappp, capfdp, fp->f_flag); + error = falloc(td, &fcapp, capfdp, fp->f_flag); if (error) return (error); @@ -309,18 +309,18 @@ kern_capwrap(struct thread *td, struct f cp = uma_zalloc(capability_zone, M_WAITOK | M_ZERO); cp->cap_rights = rights; cp->cap_object = fp_object; - cp->cap_file = *fcappp; + cp->cap_file = fcapp; if (fp->f_flag & DFLAG_PASSABLE) - finit(*fcappp, fp->f_flag, DTYPE_CAPABILITY, cp, + finit(fcapp, fp->f_flag, DTYPE_CAPABILITY, cp, &capability_ops); else - finit(*fcappp, fp->f_flag, DTYPE_CAPABILITY, cp, + finit(fcapp, fp->f_flag, DTYPE_CAPABILITY, cp, &capability_ops_unpassable); /* * Release our private reference (the proc filedesc still has one). */ - fdrop(*fcappp, td); + fdrop(fcapp, td); return (0); } Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Sat Aug 13 00:56:42 2011 (r224809) +++ head/sys/kern/vfs_lookup.c Sat Aug 13 09:21:16 2011 (r224810) @@ -180,6 +180,18 @@ namei(struct nameidata *ndp) if (!error && *cnp->cn_pnbuf == '\0') error = ENOENT; +#ifdef CAPABILITY_MODE + /* + * In capability mode, lookups must be "strictly relative" (i.e. + * not an absolute path, and not containing '..' components) to + * a real file descriptor, not the pseudo-descriptor AT_FDCWD. + */ + if (IN_CAPABILITY_MODE(td)) { + ndp->ni_strictrelative = 1; + if (ndp->ni_dirfd == AT_FDCWD) + error = ECAPMODE; + } +#endif if (error) { uma_zfree(namei_zone, cnp->cn_pnbuf); #ifdef DIAGNOSTIC @@ -214,12 +226,20 @@ namei(struct nameidata *ndp) AUDIT_ARG_ATFD1(ndp->ni_dirfd); if (cnp->cn_flags & AUDITVNODE2) AUDIT_ARG_ATFD2(ndp->ni_dirfd); -#ifdef CAPABILITY_MODE - KASSERT(!IN_CAPABILITY_MODE(td), - ("%s: reached %s:%d in capability mode", - __func__, __FILE__, __LINE__)); + error = fgetvp_rights(td, ndp->ni_dirfd, + ndp->ni_rightsneeded | CAP_LOOKUP, + &(ndp->ni_baserights), &dp); +#ifdef CAPABILITIES + /* + * Lookups relative to a capability must also be + * strictly relative. + * + * Note that a capability with rights CAP_MASK_VALID + * is treated exactly like a regular file descriptor. + */ + if (ndp->ni_baserights != CAP_MASK_VALID) + ndp->ni_strictrelative = 1; #endif - error = fgetvp(td, ndp->ni_dirfd, 0, &dp); } if (error != 0 || dp != NULL) { FILEDESC_SUNLOCK(fdp); @@ -261,6 +281,8 @@ namei(struct nameidata *ndp) if (*(cnp->cn_nameptr) == '/') { vrele(dp); VFS_UNLOCK_GIANT(vfslocked); + if (ndp->ni_strictrelative != 0) + return (ENOTCAPABLE); while (*(cnp->cn_nameptr) == '/') { cnp->cn_nameptr++; ndp->ni_pathlen--; @@ -604,7 +626,10 @@ dirloop: } /* - * Handle "..": four special cases. + * Handle "..": five special cases. + * 0. If doing a capability lookup, return ENOTCAPABLE (this is a + * fairly conservative design choice, but it's the only one that we + * are satisfied guarantees the property we're looking for). * 1. Return an error if this is the last component of * the name and the operation is DELETE or RENAME. * 2. If at root directory (e.g. after chroot) @@ -618,6 +643,10 @@ dirloop: * the jail or chroot, don't let them out. */ if (cnp->cn_flags & ISDOTDOT) { + if (ndp->ni_strictrelative != 0) { + error = ENOTCAPABLE; + goto bad; + } if ((cnp->cn_flags & ISLASTCN) != 0 && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { error = EINVAL; Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Aug 13 00:56:42 2011 (r224809) +++ head/sys/kern/vfs_syscalls.c Sat Aug 13 09:21:16 2011 (r224810) @@ -993,6 +993,41 @@ change_root(vp, td) return (0); } +static __inline cap_rights_t +flags_to_rights(int flags) +{ + cap_rights_t rights = 0; + + switch ((flags & O_ACCMODE)) { + case O_RDONLY: + rights |= CAP_READ; + break; + + case O_RDWR: + rights |= CAP_READ; + /* fall through */ + + case O_WRONLY: + rights |= CAP_WRITE; + break; + + case O_EXEC: + rights |= CAP_FEXECVE; + break; + } + + if (flags & O_CREAT) + rights |= CAP_CREATE; + + if (flags & O_TRUNC) + rights |= CAP_FTRUNCATE; + + if ((flags & O_EXLOCK) || (flags & O_SHLOCK)) + rights |= CAP_FLOCK; + + return (rights); +} + /* * Check permissions, allocate an open file structure, and call the device * open routine if any. @@ -1055,10 +1090,12 @@ kern_openat(struct thread *td, int fd, c struct flock lf; struct nameidata nd; int vfslocked; + cap_rights_t rights_needed = CAP_LOOKUP; AUDIT_ARG_FFLAGS(flags); AUDIT_ARG_MODE(mode); /* XXX: audit dirfd */ + rights_needed |= flags_to_rights(flags); /* * Only one of the O_EXEC, O_RDONLY, O_WRONLY and O_RDWR flags * may be specified. @@ -1082,8 +1119,8 @@ kern_openat(struct thread *td, int fd, c /* Set the flags early so the finit in devfs can pick them up. */ fp->f_flag = flags & FMASK; cmode = ((mode &~ fdp->fd_cmask) & ALLPERMS) &~ S_ISTXT; - NDINIT_AT(&nd, LOOKUP, FOLLOW | AUDITVNODE1 | MPSAFE, pathseg, path, fd, - td); + NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1 | MPSAFE, pathseg, + path, fd, rights_needed, td); td->td_dupfd = -1; /* XXX check for fdopen */ error = vn_open(&nd, &flags, cmode, fp); if (error) { @@ -1092,18 +1129,20 @@ kern_openat(struct thread *td, int fd, c * wonderous happened deep below and we just pass it up * pretending we know what we do. */ - if (error == ENXIO && fp->f_ops != &badfileops) { - fdrop(fp, td); - td->td_retval[0] = indx; - return (0); - } + if (error == ENXIO && fp->f_ops != &badfileops) + goto success; /* * handle special fdopen() case. bleh. dupfdopen() is * responsible for dropping the old contents of ofiles[indx] * if it succeeds. + * + * Don't do this for relative (capability) lookups; we don't + * understand exactly what would happen, and we don't think + * that it ever should. */ - if ((error == ENODEV || error == ENXIO) && + if ((nd.ni_strictrelative == 0) && + (error == ENODEV || error == ENXIO) && (td->td_dupfd >= 0)) { /* XXX from fdopen */ if ((error = finstall(td, fp, &indx, flags)) != 0) @@ -1172,9 +1211,22 @@ success: /* * If we haven't already installed the FD (for dupfdopen), do so now. */ - if (indx == -1) - if ((error = finstall(td, fp, &indx, flags)) != 0) - goto bad_unlocked; + if (indx == -1) { +#ifdef CAPABILITIES + if (nd.ni_strictrelative == 1) { + /* + * We are doing a strict relative lookup; wrap the + * result in a capability. + */ + if ((error = kern_capwrap(td, fp, nd.ni_baserights, + &indx)) != 0) + goto bad_unlocked; + } else +#endif + if ((error = finstall(td, fp, &indx, flags)) != 0) + goto bad_unlocked; + + } /* * Release our private reference, leaving the one associated with @@ -1301,8 +1353,9 @@ kern_mknodat(struct thread *td, int fd, return (error); restart: bwillwrite(); - NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, - pathseg, path, fd, td); + NDINIT_ATRIGHTS(&nd, CREATE, + LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, pathseg, path, fd, + CAP_MKFIFO, td); if ((error = namei(&nd)) != 0) return (error); vfslocked = NDHASGIANT(&nd); @@ -2153,8 +2206,8 @@ kern_accessat(struct thread *td, int fd, } else cred = tmpcred = td->td_ucred; AUDIT_ARG_VALUE(mode); - NDINIT_AT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | - AUDITVNODE1, pathseg, path, fd, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | + AUDITVNODE1, pathseg, path, fd, CAP_FSTAT, td); if ((error = namei(&nd)) != 0) goto out1; vfslocked = NDHASGIANT(&nd); @@ -2363,9 +2416,9 @@ kern_statat_vnhook(struct thread *td, in if (flag & ~AT_SYMLINK_NOFOLLOW) return (EINVAL); - NDINIT_AT(&nd, LOOKUP, ((flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : + NDINIT_ATRIGHTS(&nd, LOOKUP, ((flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW) | LOCKSHARED | LOCKLEAF | AUDITVNODE1 | MPSAFE, pathseg, - path, fd, td); + path, fd, CAP_FSTAT, td); if ((error = namei(&nd)) != 0) return (error); @@ -2920,8 +2973,8 @@ kern_fchmodat(struct thread *td, int fd, AUDIT_ARG_MODE(mode); follow = (flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW; - NDINIT_AT(&nd, LOOKUP, follow | MPSAFE | AUDITVNODE1, pathseg, path, - fd, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, follow | MPSAFE | AUDITVNODE1, pathseg, + path, fd, CAP_FCHMOD, td); if ((error = namei(&nd)) != 0) return (error); vfslocked = NDHASGIANT(&nd); @@ -3063,8 +3116,8 @@ kern_fchownat(struct thread *td, int fd, AUDIT_ARG_OWNER(uid, gid); follow = (flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW; - NDINIT_AT(&nd, LOOKUP, follow | MPSAFE | AUDITVNODE1, pathseg, path, - fd, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, follow | MPSAFE | AUDITVNODE1, pathseg, + path, fd, CAP_FCHOWN, td); if ((error = namei(&nd)) != 0) return (error); @@ -3279,8 +3332,8 @@ kern_utimesat(struct thread *td, int fd, if ((error = getutimes(tptr, tptrseg, ts)) != 0) return (error); - NDINIT_AT(&nd, LOOKUP, FOLLOW | MPSAFE | AUDITVNODE1, pathseg, path, - fd, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | MPSAFE | AUDITVNODE1, pathseg, + path, fd, CAP_FUTIMES, td); if ((error = namei(&nd)) != 0) return (error); @@ -3610,11 +3663,11 @@ kern_renameat(struct thread *td, int old bwillwrite(); #ifdef MAC - NDINIT_AT(&fromnd, DELETE, LOCKPARENT | LOCKLEAF | SAVESTART | MPSAFE | - AUDITVNODE1, pathseg, old, oldfd, td); + NDINIT_ATRIGHTS(&fromnd, DELETE, LOCKPARENT | LOCKLEAF | SAVESTART | + MPSAFE | AUDITVNODE1, pathseg, old, oldfd, CAP_DELETE, td); #else - NDINIT_AT(&fromnd, DELETE, WANTPARENT | SAVESTART | MPSAFE | - AUDITVNODE1, pathseg, old, oldfd, td); + NDINIT_ATRIGHTS(&fromnd, DELETE, WANTPARENT | SAVESTART | MPSAFE | + AUDITVNODE1, pathseg, old, oldfd, CAP_DELETE, td); #endif if ((error = namei(&fromnd)) != 0) @@ -3637,8 +3690,9 @@ kern_renameat(struct thread *td, int old vrele(fvp); goto out1; } - NDINIT_AT(&tond, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART | - MPSAFE | AUDITVNODE2, pathseg, new, newfd, td); + NDINIT_ATRIGHTS(&tond, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | + SAVESTART | MPSAFE | AUDITVNODE2, pathseg, new, newfd, CAP_CREATE, + td); if (fromnd.ni_vp->v_type == VDIR) tond.ni_cnd.cn_flags |= WILLBEDIR; if ((error = namei(&tond)) != 0) { @@ -3764,8 +3818,8 @@ kern_mkdirat(struct thread *td, int fd, AUDIT_ARG_MODE(mode); restart: bwillwrite(); - NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, - segflg, path, fd, td); + NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | + AUDITVNODE1, segflg, path, fd, CAP_MKDIR, td); nd.ni_cnd.cn_flags |= WILLBEDIR; if ((error = namei(&nd)) != 0) return (error); @@ -3853,8 +3907,8 @@ kern_rmdirat(struct thread *td, int fd, restart: bwillwrite(); - NDINIT_AT(&nd, DELETE, LOCKPARENT | LOCKLEAF | MPSAFE | AUDITVNODE1, - pathseg, path, fd, td); + NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | MPSAFE | + AUDITVNODE1, pathseg, path, fd, CAP_RMDIR, td); if ((error = namei(&nd)) != 0) return (error); vfslocked = NDHASGIANT(&nd); Modified: head/sys/sys/capability.h ============================================================================== --- head/sys/sys/capability.h Sat Aug 13 00:56:42 2011 (r224809) +++ head/sys/sys/capability.h Sat Aug 13 09:21:16 2011 (r224810) @@ -142,7 +142,7 @@ * Create a capability to wrap a file object. */ int kern_capwrap(struct thread *td, struct file *fp, cap_rights_t rights, - struct file **cap, int *capfd); + int *capfd); /* * Unwrap a capability if its rights mask is a superset of 'rights'. Modified: head/sys/sys/namei.h ============================================================================== --- head/sys/sys/namei.h Sat Aug 13 00:56:42 2011 (r224809) +++ head/sys/sys/namei.h Sat Aug 13 09:21:16 2011 (r224810) @@ -63,6 +63,7 @@ struct nameidata { */ const char *ni_dirp; /* pathname pointer */ enum uio_seg ni_segflg; /* location of pathname */ + cap_rights_t ni_rightsneeded; /* rights required to look up vnode */ /* * Arguments to lookup. */ @@ -70,6 +71,11 @@ struct nameidata { struct vnode *ni_rootdir; /* logical root directory */ struct vnode *ni_topdir; /* logical top directory */ int ni_dirfd; /* starting directory for *at functions */ + int ni_strictrelative; /* relative lookup only; no '..' */ + /* + * Results: returned from namei + */ + cap_rights_t ni_baserights; /* rights the *at base has (or -1) */ /* * Results: returned from/manipulated by lookup */ @@ -151,11 +157,13 @@ struct nameidata { * Initialization of a nameidata structure. */ #define NDINIT(ndp, op, flags, segflg, namep, td) \ - NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, td) + NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, 0, td) #define NDINIT_AT(ndp, op, flags, segflg, namep, dirfd, td) \ - NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, td) + NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, 0, td) +#define NDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rights, td) \ + NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rights, td) #define NDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td) \ - NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, td) + NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, 0, td) static __inline void NDINIT_ALL(struct nameidata *ndp, @@ -164,6 +172,7 @@ NDINIT_ALL(struct nameidata *ndp, const char *namep, int dirfd, struct vnode *startdir, + cap_rights_t rights, struct thread *td) { ndp->ni_cnd.cn_nameiop = op; @@ -172,6 +181,9 @@ NDINIT_ALL(struct nameidata *ndp, ndp->ni_dirp = namep; ndp->ni_dirfd = dirfd; ndp->ni_startdir = startdir; + ndp->ni_strictrelative = 0; + ndp->ni_rightsneeded = rights; + ndp->ni_baserights = 0; ndp->ni_cnd.cn_thread = td; } From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 10:43:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF204106566C; Sat, 13 Aug 2011 10:43:21 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3D1B8FC20; Sat, 13 Aug 2011 10:43:21 +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 p7DAhLho010293; Sat, 13 Aug 2011 10:43:21 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DAhLtP010291; Sat, 13 Aug 2011 10:43:21 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108131043.p7DAhLtP010291@svn.freebsd.org> From: Jonathan Anderson Date: Sat, 13 Aug 2011 10:43:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224812 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 10:43:22 -0000 Author: jonathan Date: Sat Aug 13 10:43:21 2011 New Revision: 224812 URL: http://svn.freebsd.org/changeset/base/224812 Log: Allow openat(2), fstatat(2), etc. in capability mode. namei() and lookup() can now perform "strictly relative" lookups. Such lookups, performed when in capability mode or when looking up relative to a directory capability, enforce two policies: - absolute paths are disallowed (including symlinks to absolute paths) - paths containing '..' components are disallowed These constraints make it safe to enable openat() and friends. These system calls are instrumental in supporting Capsicum components such as the capability-mode-aware runtime linker. Finally, adjust comments in capabilities.conf to reflect the actual state of the world (e.g. shm_open(2) already has the appropriate constraints, getdents(2) already requires CAP_SEEK). Approved by: re (bz), mentor (rwatson) Sponsored by: Google Inc. Modified: head/sys/kern/capabilities.conf Modified: head/sys/kern/capabilities.conf ============================================================================== --- head/sys/kern/capabilities.conf Sat Aug 13 10:23:52 2011 (r224811) +++ head/sys/kern/capabilities.conf Sat Aug 13 10:43:21 2011 (r224812) @@ -239,9 +239,7 @@ getcontext ## Allow directory I/O on a file descriptor, subject to capability rights. ## Originally we had separate capabilities for directory-specific read ## operations, but on BSD we allow reading the raw directory data, so we just -## rely on CAP_READ (etc) now. -## -## XXXRW: Possibly these should also use CAP_SEEK. +## rely on CAP_READ and CAP_SEEK now. ## getdents getdirentries @@ -447,28 +445,26 @@ obreak olio_listio ## -## Once Capsicum is fully merged, some of the *at(2) calls which can be -## semantically constrained will be permitted in capability mode. For now, -## we will simply not allow them to be called. -## -#faccessat -#fstatat -#fchmodat -#futimesat -#mkdirat -#rmdirat -#mkfifoat -#mknodat -#openat -#renameat - -## -## ONCE CAPSICUM IS FULLY MERGED: -## Allow entry into open(2). This system call will fail, since access to the global -## file namespace has been disallowed, but allowing entry into the syscall means -## that an audit trail will be generated (which is also very useful for debugging), +## Operations relative to directory capabilities. +## +faccessat +fstatat +fchmodat +futimesat +mkdirat +rmdirat +mkfifoat +mknodat +openat +renameat + +## +## Allow entry into open(2). This system call will fail, since access to the +## global file namespace has been disallowed, but allowing entry into the +## syscall means that an audit trail will be generated (which is also very +## useful for debugging). ## -#open +open ## ## Allow poll(2), which will be scoped by capability rights. @@ -648,11 +644,9 @@ setsockopt setuid ## -## ONCE CAPSICUM IS FULLY MERGED: -## Allow shm_open(2), which is scoped so as to allow only access to new -## anonymous objects. +## shm_open(2) is scoped so as to allow only access to new anonymous objects. ## -#shm_open +shm_open ## ## Allow I/O-related file descriptors, subject to capability rights. From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 10:58:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 935A9106566C; Sat, 13 Aug 2011 10:58:53 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81F548FC16; Sat, 13 Aug 2011 10:58:53 +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 p7DAwrlX010961; Sat, 13 Aug 2011 10:58:53 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DAwrUU010959; Sat, 13 Aug 2011 10:58:53 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108131058.p7DAwrUU010959@svn.freebsd.org> From: Martin Matuska Date: Sat, 13 Aug 2011 10:58:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224814 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 10:58:53 -0000 Author: mm Date: Sat Aug 13 10:58:53 2011 New Revision: 224814 URL: http://svn.freebsd.org/changeset/base/224814 Log: Fix race between dmu_objset_prefetch() invoked from zfs_ioc_dataset_list_next() and dsl_dir_destroy_check() indirectly invoked from dmu_recv_existing_end() via dsl_dataset_destroy() by not prefetching temporary clones, as these count as always inconsistent. In addition, do not prefetch hidden datasets at all as we are not going to process these later. Filed as Illumos Bug #1346 PR: kern/157728 Tested by: Borja Marcos , mm Reviewed by: pjd Approved by: re (kib) MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 13 10:43:56 2011 (r224813) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 13 10:58:53 2011 (r224814) @@ -1964,7 +1964,8 @@ top: int len = sizeof (zc->zc_name) - (p - zc->zc_name); while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) - (void) dmu_objset_prefetch(zc->zc_name, NULL); + if (dataset_name_hidden(zc->zc_name) == B_FALSE) + (void) dmu_objset_prefetch(zc->zc_name, NULL); } do { From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 12:14:41 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 331701065670; Sat, 13 Aug 2011 12:14:41 +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 184DC8FC0A; Sat, 13 Aug 2011 12:14:41 +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 p7DCEe85014786; Sat, 13 Aug 2011 12:14:40 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DCEe38014780; Sat, 13 Aug 2011 12:14:40 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108131214.p7DCEe38014780@svn.freebsd.org> From: Robert Watson Date: Sat, 13 Aug 2011 12:14:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224815 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 12:14:41 -0000 Author: rwatson Date: Sat Aug 13 12:14:40 2011 New Revision: 224815 URL: http://svn.freebsd.org/changeset/base/224815 Log: Regenerate system call files following r224812 changes to capabilities.conf. A no-op for non-Capsicum kernels; for Capsicum kernels, completes the enabling of fooat(2) system calls using capabilities. With this change, and subject to bug fixes, Capsicum capability support is now complete for 9.0. Approved by: re (kib) Submitted by: jonathan Sponsored by: Google Inc Modified: head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Sat Aug 13 10:58:53 2011 (r224814) +++ head/sys/kern/init_sysent.c Sat Aug 13 12:14:40 2011 (r224815) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD + * created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan */ #include "opt_compat.h" @@ -39,7 +39,7 @@ struct sysent sysent[] = { { 0, (sy_call_t *)fork, AUE_FORK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 2 = fork */ { AS(read_args), (sy_call_t *)read, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 3 = read */ { AS(write_args), (sy_call_t *)write, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 4 = write */ - { AS(open_args), (sy_call_t *)open, AUE_OPEN_RWTC, NULL, 0, 0, 0, SY_THR_STATIC }, /* 5 = open */ + { AS(open_args), (sy_call_t *)open, AUE_OPEN_RWTC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = open */ { AS(close_args), (sy_call_t *)close, AUE_CLOSE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 6 = close */ { AS(wait_args), (sy_call_t *)wait4, AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC }, /* 7 = wait4 */ { compat(AS(ocreat_args),creat), AUE_CREAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 8 = old creat */ @@ -516,26 +516,26 @@ struct sysent sysent[] = { { AS(truncate_args), (sy_call_t *)truncate, AUE_TRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 479 = truncate */ { AS(ftruncate_args), (sy_call_t *)ftruncate, AUE_FTRUNCATE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 480 = ftruncate */ { AS(thr_kill2_args), (sy_call_t *)thr_kill2, AUE_KILL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 481 = thr_kill2 */ - { AS(shm_open_args), (sy_call_t *)shm_open, AUE_SHMOPEN, NULL, 0, 0, 0, SY_THR_STATIC }, /* 482 = shm_open */ + { AS(shm_open_args), (sy_call_t *)shm_open, AUE_SHMOPEN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 482 = shm_open */ { AS(shm_unlink_args), (sy_call_t *)shm_unlink, AUE_SHMUNLINK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 483 = shm_unlink */ { AS(cpuset_args), (sy_call_t *)cpuset, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 484 = cpuset */ { AS(cpuset_setid_args), (sy_call_t *)cpuset_setid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 485 = cpuset_setid */ { AS(cpuset_getid_args), (sy_call_t *)cpuset_getid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 486 = cpuset_getid */ { AS(cpuset_getaffinity_args), (sy_call_t *)cpuset_getaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 487 = cpuset_getaffinity */ { AS(cpuset_setaffinity_args), (sy_call_t *)cpuset_setaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 488 = cpuset_setaffinity */ - { AS(faccessat_args), (sy_call_t *)faccessat, AUE_FACCESSAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 489 = faccessat */ - { AS(fchmodat_args), (sy_call_t *)fchmodat, AUE_FCHMODAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 490 = fchmodat */ + { AS(faccessat_args), (sy_call_t *)faccessat, AUE_FACCESSAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 489 = faccessat */ + { AS(fchmodat_args), (sy_call_t *)fchmodat, AUE_FCHMODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 490 = fchmodat */ { AS(fchownat_args), (sy_call_t *)fchownat, AUE_FCHOWNAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 491 = fchownat */ { AS(fexecve_args), (sy_call_t *)fexecve, AUE_FEXECVE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 492 = fexecve */ - { AS(fstatat_args), (sy_call_t *)fstatat, AUE_FSTATAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 493 = fstatat */ - { AS(futimesat_args), (sy_call_t *)futimesat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 494 = futimesat */ + { AS(fstatat_args), (sy_call_t *)fstatat, AUE_FSTATAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 493 = fstatat */ + { AS(futimesat_args), (sy_call_t *)futimesat, AUE_FUTIMESAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 494 = futimesat */ { AS(linkat_args), (sy_call_t *)linkat, AUE_LINKAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 495 = linkat */ - { AS(mkdirat_args), (sy_call_t *)mkdirat, AUE_MKDIRAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 496 = mkdirat */ - { AS(mkfifoat_args), (sy_call_t *)mkfifoat, AUE_MKFIFOAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 497 = mkfifoat */ - { AS(mknodat_args), (sy_call_t *)mknodat, AUE_MKNODAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 498 = mknodat */ - { AS(openat_args), (sy_call_t *)openat, AUE_OPENAT_RWTC, NULL, 0, 0, 0, SY_THR_STATIC }, /* 499 = openat */ + { AS(mkdirat_args), (sy_call_t *)mkdirat, AUE_MKDIRAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 496 = mkdirat */ + { AS(mkfifoat_args), (sy_call_t *)mkfifoat, AUE_MKFIFOAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 497 = mkfifoat */ + { AS(mknodat_args), (sy_call_t *)mknodat, AUE_MKNODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 498 = mknodat */ + { AS(openat_args), (sy_call_t *)openat, AUE_OPENAT_RWTC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 499 = openat */ { AS(readlinkat_args), (sy_call_t *)readlinkat, AUE_READLINKAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 500 = readlinkat */ - { AS(renameat_args), (sy_call_t *)renameat, AUE_RENAMEAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 501 = renameat */ + { AS(renameat_args), (sy_call_t *)renameat, AUE_RENAMEAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 501 = renameat */ { AS(symlinkat_args), (sy_call_t *)symlinkat, AUE_SYMLINKAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 502 = symlinkat */ { AS(unlinkat_args), (sy_call_t *)unlinkat, AUE_UNLINKAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 503 = unlinkat */ { AS(posix_openpt_args), (sy_call_t *)posix_openpt, AUE_POSIX_OPENPT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 504 = posix_openpt */ Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Sat Aug 13 10:58:53 2011 (r224814) +++ head/sys/kern/syscalls.c Sat Aug 13 12:14:40 2011 (r224815) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD + * created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan */ const char *syscallnames[] = { Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Sat Aug 13 10:58:53 2011 (r224814) +++ head/sys/sys/syscall.h Sat Aug 13 12:14:40 2011 (r224815) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD + * created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan */ #define SYS_syscall 0 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Sat Aug 13 10:58:53 2011 (r224814) +++ head/sys/sys/syscall.mk Sat Aug 13 12:14:40 2011 (r224815) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD +# created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan MIASM = \ syscall.o \ exit.o \ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Sat Aug 13 10:58:53 2011 (r224814) +++ head/sys/sys/sysproto.h Sat Aug 13 12:14:40 2011 (r224815) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD + * created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan */ #ifndef _SYS_SYSPROTO_H_ From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 13:11:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23CF7106566C; Sat, 13 Aug 2011 13:11:29 +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 134848FC1A; Sat, 13 Aug 2011 13:11:29 +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 p7DDBSUq017600; Sat, 13 Aug 2011 13:11:28 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DDBSCW017598; Sat, 13 Aug 2011 13:11:28 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108131311.p7DDBSCW017598@svn.freebsd.org> From: Robert Watson Date: Sat, 13 Aug 2011 13:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224834 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 13:11:29 -0000 Author: rwatson Date: Sat Aug 13 13:11:28 2011 New Revision: 224834 URL: http://svn.freebsd.org/changeset/base/224834 Log: Bump __FreeBSD_version to reflect the availability of capabilities, but also capability-related changes to fget(9). This is likely not part of a formal KPI, but the nvidia driver (at least) uses it. Approved by: re (bz, kib) Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Aug 13 13:09:46 2011 (r224833) +++ head/sys/sys/param.h Sat Aug 13 13:11:28 2011 (r224834) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900040 /* Master, propagated to newvers */ +#define __FreeBSD_version 900041 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGSEGV 700004 From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 13:26:41 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69E68106564A; Sat, 13 Aug 2011 13:26:41 +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 3FE3A8FC0A; Sat, 13 Aug 2011 13:26:41 +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 p7DDQfAC018326; Sat, 13 Aug 2011 13:26:41 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DDQfmC018324; Sat, 13 Aug 2011 13:26:41 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108131326.p7DDQfmC018324@svn.freebsd.org> From: Robert Watson Date: Sat, 13 Aug 2011 13:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224839 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 13:26:41 -0000 Author: rwatson Date: Sat Aug 13 13:26:40 2011 New Revision: 224839 URL: http://svn.freebsd.org/changeset/base/224839 Log: Now that capability support has been committed, update and expand the comment at the type of sys_capability.c to describe its new contents. Approved by: re (xxx) Modified: head/sys/kern/sys_capability.c Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Sat Aug 13 13:18:54 2011 (r224838) +++ head/sys/kern/sys_capability.c Sat Aug 13 13:26:40 2011 (r224839) @@ -31,9 +31,24 @@ /* * FreeBSD kernel capability facility. * - * Currently, this file implements only capability mode; capabilities - * (rights-refined file descriptors) will follow. + * Two kernel features are implemented here: capability mode, a sandboxed mode + * of execution for processes, and capabilities, a refinement on file + * descriptors that allows fine-grained control over operations on the file + * descriptor. Collectively, these allow processes to run in the style of a + * historic "capability system" in which they can use only resources + * explicitly delegated to them. This model is enforced by restricting access + * to global namespaces in capability mode. * + * Capabilities wrap other file descriptor types, binding them to a constant + * rights mask set when the capability is created. New capabilities may be + * derived from existing capabilities, but only if they have the same or a + * strict subset of the rights on the original capability. + * + * System calls permitted in capability mode are defined in capabilities.conf; + * calls must be carefully audited for safety to ensure that they don't allow + * escape from a sandbox. Some calls permit only a subset of operations in + * capability mode -- for example, shm_open(2) is limited to creating + * anonymous, rather than named, POSIX shared memory objects. */ #include "opt_capsicum.h" @@ -512,4 +527,3 @@ cap_funwrap_mmap(struct file *fp_cap, ca } #endif /* CAPABILITIES */ - From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 13:34:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EAE0106564A; Sat, 13 Aug 2011 13:34:02 +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 2E9638FC18; Sat, 13 Aug 2011 13:34:02 +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 p7DDY2hq018582; Sat, 13 Aug 2011 13:34:02 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DDY2uV018580; Sat, 13 Aug 2011 13:34:02 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108131334.p7DDY2uV018580@svn.freebsd.org> From: Robert Watson Date: Sat, 13 Aug 2011 13:34:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224840 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 13:34:02 -0000 Author: rwatson Date: Sat Aug 13 13:34:01 2011 New Revision: 224840 URL: http://svn.freebsd.org/changeset/base/224840 Log: Update use of the FEATURE() macro in sys_capability.c to reflect the move to two different kernel options for capability mode vs. capabilities. Approved by: re (bz) Modified: head/sys/kern/sys_capability.c Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Sat Aug 13 13:26:40 2011 (r224839) +++ head/sys/kern/sys_capability.c Sat Aug 13 13:34:01 2011 (r224840) @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #ifdef CAPABILITY_MODE -FEATURE(security_capabilities, "Capsicum Capability Mode"); +FEATURE(security_capability_mode, "Capsicum Capability Mode"); /* * System call to enter capability mode for the process. @@ -134,6 +134,8 @@ cap_getmode(struct thread *td, struct ca #ifdef CAPABILITIES +FEATURE(security_capabilities, "Capsicum Capabilities"); + /* * struct capability describes a capability, and is hung off of its struct * file f_data field. cap_file and cap_rightss are static once hooked up, as From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 13:49:12 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A4C0106566B; Sat, 13 Aug 2011 13:49:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A41D8FC08; Sat, 13 Aug 2011 13:49:12 +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 p7DDnC8q019074; Sat, 13 Aug 2011 13:49:12 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DDnC4c019072; Sat, 13 Aug 2011 13:49:12 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108131349.p7DDnC4c019072@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 13 Aug 2011 13:49:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224841 - head/usr.sbin/jls X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 13:49:12 -0000 Author: bz Date: Sat Aug 13 13:49:11 2011 New Revision: 224841 URL: http://svn.freebsd.org/changeset/base/224841 Log: Fix jls backward compat mode broken in r222465, correctly displaying addresses in verbose mode (jls -v) again. Submitted by: jamie MFC after: 3 days Approved by: re (kib) Modified: head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jls/jls.c ============================================================================== --- head/usr.sbin/jls/jls.c Sat Aug 13 13:34:01 2011 (r224840) +++ head/usr.sbin/jls/jls.c Sat Aug 13 13:49:11 2011 (r224841) @@ -371,7 +371,7 @@ print_jail(int pflags, int jflags) *(int *)params[5].jp_value); n = 6; #ifdef INET - if (ip4_ok && !strcmp(params[n].jp_name, "ip.addr")) { + if (ip4_ok && !strcmp(params[n].jp_name, "ip4.addr")) { count = params[n].jp_valuelen / sizeof(struct in_addr); for (ai = 0; ai < count; ai++) if (inet_ntop(AF_INET, From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 16:03:40 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA053106566B; Sat, 13 Aug 2011 16:03:40 +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 CA7B88FC12; Sat, 13 Aug 2011 16:03:40 +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 p7DG3ePf023095; Sat, 13 Aug 2011 16:03:40 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DG3e80023093; Sat, 13 Aug 2011 16:03:40 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108131603.p7DG3e80023093@svn.freebsd.org> From: Robert Watson Date: Sat, 13 Aug 2011 16:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224842 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 16:03:40 -0000 Author: rwatson Date: Sat Aug 13 16:03:40 2011 New Revision: 224842 URL: http://svn.freebsd.org/changeset/base/224842 Log: When falloc() was broken into separate falloc_noinstall() and finstall(), a bug was introduced in kern_openat() such that the error from the vnode open operation was overwritten before it was passed as an argument to dupfdopen(). This broke operations on /dev/{stdin,stdout,stderr}. Fix by preserving the original error number across finstall() so that it is still available. Approved by: re (kib) Reported by: cognet Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Aug 13 13:49:11 2011 (r224841) +++ head/sys/kern/vfs_syscalls.c Sat Aug 13 16:03:40 2011 (r224842) @@ -1086,7 +1086,7 @@ kern_openat(struct thread *td, int fd, c struct vnode *vp; int cmode; struct file *nfp; - int type, indx = -1, error; + int type, indx = -1, error, error_open; struct flock lf; struct nameidata nd; int vfslocked; @@ -1145,10 +1145,11 @@ kern_openat(struct thread *td, int fd, c (error == ENODEV || error == ENXIO) && (td->td_dupfd >= 0)) { /* XXX from fdopen */ + error_open = error; if ((error = finstall(td, fp, &indx, flags)) != 0) goto bad_unlocked; if ((error = dupfdopen(td, fdp, indx, td->td_dupfd, - flags, error)) == 0) + flags, error_open)) == 0) goto success; } /* From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 17:17:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F1021065672; Sat, 13 Aug 2011 17:17:05 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F5DA8FC12; Sat, 13 Aug 2011 17:17: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 p7DHH5DF025533; Sat, 13 Aug 2011 17:17:05 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHH5qE025530; Sat, 13 Aug 2011 17:17:05 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201108131717.p7DHH5qE025530@svn.freebsd.org> From: Attilio Rao Date: Sat, 13 Aug 2011 17:17:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224845 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:17:05 -0000 Author: attilio Date: Sat Aug 13 17:17:04 2011 New Revision: 224845 URL: http://svn.freebsd.org/changeset/base/224845 Log: Fix a typo in cb_dumpdata() about wrongly calling wdog_kern_pat(). Submitted by: Andrew Boyer Approved by: re (kib) Modified: head/sys/mips/mips/dump_machdep.c Modified: head/sys/mips/mips/dump_machdep.c ============================================================================== --- head/sys/mips/mips/dump_machdep.c Sat Aug 13 17:16:06 2011 (r224844) +++ head/sys/mips/mips/dump_machdep.c Sat Aug 13 17:17:04 2011 (r224845) @@ -188,7 +188,7 @@ cb_dumpdata(struct md_pa *mdp, int seqnr } #ifdef SW_WATCHDOG - wdog_kern_path(WD_LASTVAL); + wdog_kern_pat(WD_LASTVAL); #endif error = dump_write(di, (void *)(intptr_t)(pa),0, dumplo, sz); /* XXX fix PA */ if (error) From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 17:22:16 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 718541065676; Sat, 13 Aug 2011 17:22:16 +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 61E818FC16; Sat, 13 Aug 2011 17:22:16 +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 p7DHMGpB026072; Sat, 13 Aug 2011 17:22:16 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHMG0s026070; Sat, 13 Aug 2011 17:22:16 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108131722.p7DHMG0s026070@svn.freebsd.org> From: Robert Watson Date: Sat, 13 Aug 2011 17:22:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224852 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:22:16 -0000 Author: rwatson Date: Sat Aug 13 17:22:16 2011 New Revision: 224852 URL: http://svn.freebsd.org/changeset/base/224852 Log: Trim some warnings and notes from capabilities.conf -- these are left over from Capsicum development, and no longer apply. Approved by: re (kib) Sponsored by: Google Inc Modified: head/sys/kern/capabilities.conf Modified: head/sys/kern/capabilities.conf ============================================================================== --- head/sys/kern/capabilities.conf Sat Aug 13 17:21:50 2011 (r224851) +++ head/sys/kern/capabilities.conf Sat Aug 13 17:22:16 2011 (r224852) @@ -196,7 +196,7 @@ fpathconf ## ## Allow various file descriptor-based I/O operations, subject to capability -## rights. mmap(2) requires further attention. +## rights. ## freebsd6_ftruncate freebsd6_lseek @@ -334,8 +334,6 @@ issetugid ## Allow kevent(2), as we will authorize based on capability rights on the ## target descriptor. ## -## XXXRW: Do we do this? -## kevent ## @@ -404,9 +402,6 @@ mlockall ## Allow memory mapping a file descriptor, and updating protections, subject ## to capability rights. ## -## XXXRW: We currently don't properly mask VM protections using capability -## rights. -## mmap mprotect From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 21:35:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93482106566B; Sat, 13 Aug 2011 21:35:22 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 829DE8FC15; Sat, 13 Aug 2011 21:35:22 +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 p7DLZM6F033951; Sat, 13 Aug 2011 21:35:22 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DLZMR3033948; Sat, 13 Aug 2011 21:35:22 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108132135.p7DLZMR3033948@svn.freebsd.org> From: Martin Matuska Date: Sat, 13 Aug 2011 21:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224855 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 21:35:22 -0000 Author: mm Date: Sat Aug 13 21:35:22 2011 New Revision: 224855 URL: http://svn.freebsd.org/changeset/base/224855 Log: zfs_ioctl.c: improve code readability in zfs_ioc_dataset_list_next() zvol.c: fix calling of dmu_objset_prefetch() in zvol_create_minors() by passing full instead of relative dataset name and prefetching all visible datasets to be processed later instead of just the pool name Reviewed by: pjd Approved by: re (kib) MFC after: 1 week > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Empty fields above will be automatically removed. M opensolaris/uts/common/fs/zfs/zfs_ioctl.c M opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 13 21:33:50 2011 (r224854) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 13 21:35:22 2011 (r224855) @@ -1963,9 +1963,10 @@ top: uint64_t cookie = 0; int len = sizeof (zc->zc_name) - (p - zc->zc_name); - while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) - if (dataset_name_hidden(zc->zc_name) == B_FALSE) + while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) { + if (!dataset_name_hidden(zc->zc_name)) (void) dmu_objset_prefetch(zc->zc_name, NULL); + } } do { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Aug 13 21:33:50 2011 (r224854) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Aug 13 21:35:22 2011 (r224855) @@ -2197,11 +2197,11 @@ zvol_create_minors(const char *name) p = osname + strlen(osname); len = MAXPATHLEN - (p - osname); - if (strchr(name, '/') == NULL) { - /* Prefetch only for pool name. */ - cookie = 0; - while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) - (void) dmu_objset_prefetch(p, NULL); + /* Prefetch the datasets. */ + cookie = 0; + while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) { + if (!dataset_name_hidden(osname)) + (void) dmu_objset_prefetch(osname, NULL); } cookie = 0; From owner-svn-src-head@FreeBSD.ORG Sat Aug 13 23:34:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2857F106564A; Sat, 13 Aug 2011 23:34:18 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 167FD8FC08; Sat, 13 Aug 2011 23:34:18 +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 p7DNYITg037495; Sat, 13 Aug 2011 23:34:18 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DNYHQL037489; Sat, 13 Aug 2011 23:34:17 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201108132334.p7DNYHQL037489@svn.freebsd.org> From: Matt Jacob Date: Sat, 13 Aug 2011 23:34:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224856 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 23:34:18 -0000 Author: mjacob Date: Sat Aug 13 23:34:17 2011 New Revision: 224856 URL: http://svn.freebsd.org/changeset/base/224856 Log: Most of these changes to isp are to allow for isp.ko unloading. We also revive loop down freezes. We also externaliz within isp isp_prt_endcmd so something outside the core module can print something about a command completing. Also some work in progress to assist in handling timed out commands better. Partially Sponsored by: Panasas Approved by: re (kib) MFC after: 1 month Modified: head/sys/dev/isp/isp.c head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/isp_freebsd.h head/sys/dev/isp/isp_pci.c head/sys/dev/isp/ispvar.h Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Sat Aug 13 21:35:22 2011 (r224855) +++ head/sys/dev/isp/isp.c Sat Aug 13 23:34:17 2011 (r224856) @@ -102,7 +102,6 @@ static const uint8_t alpa_map[] = { /* * Local function prototypes. */ -static void isp_prt_endcmd(ispsoftc_t *, XS_T *); static int isp_parse_async(ispsoftc_t *, uint16_t); static int isp_parse_async_fc(ispsoftc_t *, uint16_t); static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t *); @@ -5391,7 +5390,7 @@ out: * Support routines. */ -static void +void isp_prt_endcmd(ispsoftc_t *isp, XS_T *xs) { char cdbstr[16 * 5 + 1]; Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Sat Aug 13 21:35:22 2011 (r224855) +++ head/sys/dev/isp/isp_freebsd.c Sat Aug 13 23:34:17 2011 (r224856) @@ -108,15 +108,13 @@ isp_attach_chan(ispsoftc_t *isp, struct return (EIO); } ISP_UNLOCK(isp); - - if (xpt_create_path(&path, NULL, cam_sim_path(sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + if (xpt_create_path_unlocked(&path, NULL, cam_sim_path(sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { ISP_LOCK(isp); xpt_bus_deregister(cam_sim_path(sim)); ISP_UNLOCK(isp); cam_sim_free(sim, FALSE); return (ENXIO); } - xpt_setup_ccb(&csa.ccb_h, path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; @@ -190,12 +188,16 @@ isp_attach(ispsoftc_t *isp) isp->isp_osinfo.ehook.ich_func = isp_intr_enable; isp->isp_osinfo.ehook.ich_arg = isp; + /* + * Haha. Set this first, because if we're loaded as a module isp_intr_enable + * will be called right awawy, which will clear isp_osinfo.ehook_active, + * which would be unwise to then set again later. + */ + isp->isp_osinfo.ehook_active = 1; if (config_intrhook_establish(&isp->isp_osinfo.ehook) != 0) { isp_prt(isp, ISP_LOGERR, "could not establish interrupt enable hook"); return (-EIO); } - isp->isp_osinfo.ehook_active = 1; - /* * Create the device queue for our SIM(s). @@ -252,20 +254,33 @@ unwind: return (-1); } -void +int isp_detach(ispsoftc_t *isp) { + struct cam_sim *sim; + struct cam_path *path; + struct ccb_setasync csa; int chan; ISP_LOCK(isp); + for (chan = isp->isp_nchan - 1; chan >= 0; chan -= 1) { + if (IS_FC(isp)) { + sim = ISP_FC_PC(isp, chan)->sim; + path = ISP_FC_PC(isp, chan)->path; + } else { + sim = ISP_SPI_PC(isp, chan)->sim; + path = ISP_SPI_PC(isp, chan)->path; + } + if (sim->refcount > 2) { + ISP_UNLOCK(isp); + return (EBUSY); + } + } if (isp->isp_osinfo.timer_active) { callout_stop(&isp->isp_osinfo.tmo); isp->isp_osinfo.timer_active = 0; } - ISP_UNLOCK(isp); for (chan = isp->isp_nchan - 1; chan >= 0; chan -= 1) { - struct cam_sim *sim; - struct cam_path *path; if (IS_FC(isp)) { sim = ISP_FC_PC(isp, chan)->sim; path = ISP_FC_PC(isp, chan)->path; @@ -273,12 +288,17 @@ isp_detach(ispsoftc_t *isp) sim = ISP_SPI_PC(isp, chan)->sim; path = ISP_SPI_PC(isp, chan)->path; } + xpt_setup_ccb(&csa.ccb_h, path, 5); + csa.ccb_h.func_code = XPT_SASYNC_CB; + csa.event_enable = 0; + csa.callback = isp_cam_async; + csa.callback_arg = sim; + xpt_action((union ccb *)&csa); xpt_free_path(path); - ISP_LOCK(isp); xpt_bus_deregister(cam_sim_path(sim)); - ISP_UNLOCK(isp); cam_sim_free(sim, FALSE); } + ISP_UNLOCK(isp); if (isp->isp_osinfo.cdev) { destroy_dev(isp->isp_osinfo.cdev); isp->isp_osinfo.cdev = NULL; @@ -291,6 +311,7 @@ isp_detach(ispsoftc_t *isp) cam_simq_free(isp->isp_osinfo.devq); isp->isp_osinfo.devq = NULL; } + return (0); } static void @@ -309,6 +330,20 @@ isp_freeze_loopdown(ispsoftc_t *isp, int } } +static void +isp_unfreeze_loopdown(ispsoftc_t *isp, int chan) +{ + if (IS_FC(isp)) { + struct isp_fc *fc = ISP_FC_PC(isp, chan); + int wasfrozen = fc->simqfrozen & SIMQFRZ_LOOPDOWN; + fc->simqfrozen &= ~SIMQFRZ_LOOPDOWN; + if (wasfrozen && fc->simqfrozen == 0) { + isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "%s: Chan %d releasing simq", __func__, chan); + xpt_release_simq(fc->sim, 1); + } + } +} + static int ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td) @@ -702,6 +737,7 @@ isp_intr_enable(void *arg) } } } + isp->isp_osinfo.ehook_active = 0; ISP_UNLOCK(isp); /* Release our hook so that the boot can continue. */ config_intrhook_disestablish(&isp->isp_osinfo.ehook); @@ -1308,7 +1344,7 @@ done: xpt_print(ccb->ccb_h.path, "now disabled for target mode\n"); } if (tptr) { - rls_lun_statep(isp, tptr); + destroy_lun_state(isp, tptr); } isp->isp_osinfo.rptr = NULL; isp->isp_osinfo.tmbusy = 0; @@ -3787,19 +3823,20 @@ static void isp_cam_async(void *cbarg, uint32_t code, struct cam_path *path, void *arg) { struct cam_sim *sim; + int bus, tgt; ispsoftc_t *isp; sim = (struct cam_sim *)cbarg; isp = (ispsoftc_t *) cam_sim_softc(sim); + bus = cam_sim_bus(sim); + tgt = xpt_path_target_id(path); + switch (code) { case AC_LOST_DEVICE: if (IS_SCSI(isp)) { uint16_t oflags, nflags; - int bus = cam_sim_bus(sim); sdparam *sdp = SDPARAM(isp, bus); - int tgt; - tgt = xpt_path_target_id(path); if (tgt >= 0) { nflags = sdp->isp_devparam[tgt].nvrm_flags; #ifndef ISP_TARGET_MODE @@ -3843,11 +3880,32 @@ isp_watchdog(void *arg) { struct ccb_scsiio *xs = arg; ispsoftc_t *isp; - uint32_t handle; + uint32_t ohandle = ISP_HANDLE_FREE, handle; isp = XS_ISP(xs); handle = isp_find_handle(isp, xs); + + if (handle != ISP_HANDLE_FREE && !XS_CMD_WPEND_P(xs)) { + isp_xs_prt(isp, xs, ISP_LOGWARN, "first watchdog (handle 0x%x) timed out- deferring for grace period", handle); + callout_reset(&PISP_PCMD(xs)->wdog, 2 * hz, isp_watchdog, xs); + XS_CMD_S_WPEND(xs); + return; + } + XS_C_TACTIVE(xs); + + /* + * Hand crank the interrupt code just to be sure the command isn't stuck somewhere. + */ + if (handle != ISP_HANDLE_FREE) { + uint32_t isr; + uint16_t sema, mbox; + if (ISP_READ_ISR(isp, &isr, &sema, &mbox) != 0) { + isp_intr(isp, isr, sema, mbox); + } + ohandle = handle; + handle = isp_find_handle(isp, xs); + } if (handle != ISP_HANDLE_FREE) { /* * Try and make sure the command is really dead before @@ -3884,7 +3942,14 @@ isp_watchdog(void *arg) isp_destroy_handle(isp, handle); isp_prt(isp, ISP_LOGERR, "%s: timeout for handle 0x%x", __func__, handle); XS_SETERR(xs, CAM_CMD_TIMEOUT); + isp_prt_endcmd(isp, xs); isp_done(xs); + } else { + if (ohandle != ISP_HANDLE_FREE) { + isp_prt(isp, ISP_LOGWARN, "%s: timeout for handle 0x%x, recovered during interrupt", __func__, ohandle); + } else { + isp_prt(isp, ISP_LOGWARN, "%s: timeout for handle already free", __func__); + } } } @@ -4013,7 +4078,7 @@ isp_ldt_task(void *arg, int pending) ispsoftc_t *isp = fc->isp; int chan = fc - isp->isp_osinfo.pc.fc; fcportdb_t *lp; - int dbidx, tgt; + int dbidx, tgt, i; ISP_LOCK(isp); isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d Loop Down Timer expired @ %lu", chan, (unsigned long) time_uptime); @@ -4035,6 +4100,23 @@ isp_ldt_task(void *arg, int pending) /* * XXX: CLEAN UP AND COMPLETE ANY PENDING COMMANDS FIRST! */ + + + for (i = 0; i < isp->isp_maxcmds; i++) { + struct ccb_scsiio *xs; + + if (!ISP_VALID_HANDLE(isp, isp->isp_xflist[i].handle)) { + continue; + } + if ((xs = isp->isp_xflist[i].cmd) == NULL) { + continue; + } + if (dbidx != (FCPARAM(isp, chan)->isp_dev_map[XS_TGT(xs)] - 1)) { + continue; + } + isp_prt(isp, ISP_LOGWARN, "command handle 0x%08x for %d.%d.%d orphaned by loop down timeout", + isp->isp_xflist[i].handle, chan, XS_TGT(xs), XS_LUN(xs)); + } /* * Mark that we've announced that this device is gone.... @@ -4056,6 +4138,9 @@ isp_ldt_task(void *arg, int pending) isp_make_gone(isp, chan, tgt); } + if (FCPARAM(isp, chan)->role & ISP_ROLE_INITIATOR) { + isp_unfreeze_loopdown(isp, chan); + } /* * The loop down timer has expired. Wake up the kthread * to notice that fact (or make it false). @@ -4063,6 +4148,7 @@ isp_ldt_task(void *arg, int pending) fc->loop_dead = 1; fc->loop_down_time = fc->loop_down_limit+1; wakeup(fc); + ISP_UNLOCK(isp); } static void @@ -4076,7 +4162,7 @@ isp_kthread(void *arg) mtx_lock(&isp->isp_osinfo.lock); for (;;) { - int wasfrozen, lb, lim; + int lb, lim; isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "%s: Chan %d checking FC state", __func__, chan); lb = isp_fc_runstate(isp, chan, 250000); @@ -4147,12 +4233,7 @@ isp_kthread(void *arg) */ if (FCPARAM(isp, chan)->loop_seen_once || fc->loop_dead) { - wasfrozen = fc->simqfrozen & SIMQFRZ_LOOPDOWN; - fc->simqfrozen &= ~SIMQFRZ_LOOPDOWN; - if (wasfrozen && fc->simqfrozen == 0) { - isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "%s: Chan %d releasing simq", __func__, chan); - xpt_release_simq(fc->sim, 1); - } + isp_unfreeze_loopdown(isp, chan); } isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "%s: Chan %d sleep time %d", __func__, chan, slp); @@ -4251,6 +4332,7 @@ isp_action(struct cam_sim *sim, union cc ts = 60*1000; } ts = isp_mstohz(ts); + XS_S_TACTIVE(ccb); callout_reset(&PISP_PCMD(ccb)->wdog, ts, isp_watchdog, ccb); break; case CMD_RQLATER: @@ -4777,7 +4859,9 @@ isp_action(struct cam_sim *sim, union cc /* * Set base transfer capabilities for Fibre Channel, for this HBA. */ - if (IS_24XX(isp)) { + if (IS_25XX(isp)) { + cpi->base_transfer_speed = 8000000; + } else if (IS_24XX(isp)) { cpi->base_transfer_speed = 4000000; } else if (IS_23XX(isp)) { cpi->base_transfer_speed = 2000000; @@ -4823,6 +4907,7 @@ void isp_done(XS_T *sccb) { ispsoftc_t *isp = XS_ISP(sccb); + uint32_t status; if (XS_NOERR(sccb)) XS_SETERR(sccb, CAM_REQ_CMP); @@ -4837,8 +4922,10 @@ isp_done(XS_T *sccb) } sccb->ccb_h.status &= ~CAM_SIM_QUEUED; - if ((sccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - isp_prt(isp, ISP_LOGDEBUG0, "target %d lun %d CAM status 0x%x SCSI status 0x%x", XS_TGT(sccb), XS_LUN(sccb), sccb->ccb_h.status, sccb->scsi_status); + status = sccb->ccb_h.status & CAM_STATUS_MASK; + if (status != CAM_REQ_CMP) { + if (status != CAM_SEL_TIMEOUT) + isp_prt(isp, ISP_LOGDEBUG0, "target %d lun %d CAM status 0x%x SCSI status 0x%x", XS_TGT(sccb), XS_LUN(sccb), sccb->ccb_h.status, sccb->scsi_status); if ((sccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { sccb->ccb_h.status |= CAM_DEV_QFRZN; xpt_freeze_devq(sccb->ccb_h.path, 1); @@ -4850,7 +4937,8 @@ isp_done(XS_T *sccb) } XS_CMD_S_DONE(sccb); - callout_stop(&PISP_PCMD(sccb)->wdog); + if (XS_TACTIVE_P(sccb)) + callout_stop(&PISP_PCMD(sccb)->wdog); XS_CMD_S_CLEAR(sccb); isp_free_pcmd(isp, (union ccb *) sccb); xpt_done((union ccb *) sccb); Modified: head/sys/dev/isp/isp_freebsd.h ============================================================================== --- head/sys/dev/isp/isp_freebsd.h Sat Aug 13 21:35:22 2011 (r224855) +++ head/sys/dev/isp/isp_freebsd.h Sat Aug 13 23:34:17 2011 (r224856) @@ -582,7 +582,7 @@ default: \ * prototypes for isp_pci && isp_freebsd to share */ extern int isp_attach(ispsoftc_t *); -extern void isp_detach(ispsoftc_t *); +extern int isp_detach(ispsoftc_t *); extern void isp_uninit(ispsoftc_t *); extern uint64_t isp_default_wwn(ispsoftc_t *, int, int, int); @@ -600,12 +600,23 @@ extern int isp_autoconfig; * Platform private flags */ #define ISP_SPRIV_ERRSET 0x1 +#define ISP_SPRIV_TACTIVE 0x2 #define ISP_SPRIV_DONE 0x8 +#define ISP_SPRIV_WPEND 0x10 + +#define XS_S_TACTIVE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_TACTIVE +#define XS_C_TACTIVE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_TACTIVE +#define XS_TACTIVE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_TACTIVE) #define XS_CMD_S_DONE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_DONE #define XS_CMD_C_DONE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_DONE #define XS_CMD_DONE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_DONE) +#define XS_CMD_S_WPEND(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_WPEND +#define XS_CMD_C_WPEND(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_WPEND +#define XS_CMD_WPEND_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_WPEND) + + #define XS_CMD_S_CLEAR(sccb) (sccb)->ccb_h.spriv_field0 = 0 /* Modified: head/sys/dev/isp/isp_pci.c ============================================================================== --- head/sys/dev/isp/isp_pci.c Sat Aug 13 21:35:22 2011 (r224855) +++ head/sys/dev/isp/isp_pci.c Sat Aug 13 23:34:17 2011 (r224856) @@ -347,7 +347,11 @@ static int isp_pci_detach (device_t); struct isp_pcisoftc { ispsoftc_t pci_isp; device_t pci_dev; - struct resource * pci_reg; + struct resource * regs; + void * irq; + int iqd; + int rtp; + int rgd; void * ih; int16_t pci_poff[_NREG_BLKS]; bus_dma_tag_t dmat; @@ -645,8 +649,7 @@ isp_get_specific_options(device_t dev, i static int isp_pci_attach(device_t dev) { - struct resource *regs, *irq; - int rtp, rgd, iqd, i, m1, m2, locksetup = 0; + int i, m1, m2, locksetup = 0; int isp_nvports = 0; uint32_t data, cmd, linesz, did; struct isp_pcisoftc *pcs; @@ -687,32 +690,31 @@ isp_pci_attach(device_t dev) isp_get_pci_options(dev, &m1, &m2); linesz = PCI_DFLT_LNSZ; - irq = regs = NULL; - rgd = rtp = iqd = 0; + pcs->irq = pcs->regs = NULL; + pcs->rgd = pcs->rtp = pcs->iqd = 0; cmd = pci_read_config(dev, PCIR_COMMAND, 2); if (cmd & m1) { - rtp = (m1 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT; - rgd = (m1 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG; - regs = bus_alloc_resource_any(dev, rtp, &rgd, RF_ACTIVE); - } - if (regs == NULL && (cmd & m2)) { - rtp = (m2 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT; - rgd = (m2 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG; - regs = bus_alloc_resource_any(dev, rtp, &rgd, RF_ACTIVE); + pcs->rtp = (m1 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT; + pcs->rgd = (m1 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG; + pcs->regs = bus_alloc_resource_any(dev, pcs->rtp, &pcs->rgd, RF_ACTIVE); + } + if (pcs->regs == NULL && (cmd & m2)) { + pcs->rtp = (m2 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT; + pcs->rgd = (m2 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG; + pcs->regs = bus_alloc_resource_any(dev, pcs->rtp, &pcs->rgd, RF_ACTIVE); } - if (regs == NULL) { + if (pcs->regs == NULL) { device_printf(dev, "unable to map any ports\n"); goto bad; } if (bootverbose) { - device_printf(dev, "using %s space register mapping\n", (rgd == IO_MAP_REG)? "I/O" : "Memory"); + device_printf(dev, "using %s space register mapping\n", (pcs->rgd == IO_MAP_REG)? "I/O" : "Memory"); } - isp->isp_bus_tag = rman_get_bustag(regs); - isp->isp_bus_handle = rman_get_bushandle(regs); + isp->isp_bus_tag = rman_get_bustag(pcs->regs); + isp->isp_bus_handle = rman_get_bushandle(pcs->regs); pcs->pci_dev = dev; - pcs->pci_reg = regs; pcs->pci_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF; pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS_OFF; pcs->pci_poff[SXP_BLOCK >> _BLK_REG_SHFT] = PCI_SXP_REGS_OFF; @@ -931,13 +933,13 @@ isp_pci_attach(device_t dev) pcs->msicount = 1; } if (pci_alloc_msi(dev, &pcs->msicount) == 0) { - iqd = 1; + pcs->iqd = 1; } else { - iqd = 0; + pcs->iqd = 0; } } - irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, RF_ACTIVE | RF_SHAREABLE); - if (irq == NULL) { + pcs->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &pcs->iqd, RF_ACTIVE | RF_SHAREABLE); + if (pcs->irq == NULL) { device_printf(dev, "could not allocate interrupt\n"); goto bad; } @@ -946,7 +948,7 @@ isp_pci_attach(device_t dev) mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF); locksetup++; - if (isp_setup_intr(dev, irq, ISP_IFLAGS, NULL, isp_platform_intr, isp, &pcs->ih)) { + if (isp_setup_intr(dev, pcs->irq, ISP_IFLAGS, NULL, isp_platform_intr, isp, &pcs->ih)) { device_printf(dev, "could not setup interrupt\n"); goto bad; } @@ -982,19 +984,19 @@ isp_pci_attach(device_t dev) bad: if (pcs->ih) { - (void) bus_teardown_intr(dev, irq, pcs->ih); + (void) bus_teardown_intr(dev, pcs->irq, pcs->ih); } if (locksetup) { mtx_destroy(&isp->isp_osinfo.lock); } - if (irq) { - (void) bus_release_resource(dev, SYS_RES_IRQ, iqd, irq); + if (pcs->irq) { + (void) bus_release_resource(dev, SYS_RES_IRQ, pcs->iqd, pcs->irq); } if (pcs->msicount) { pci_release_msi(dev); } - if (regs) { - (void) bus_release_resource(dev, rtp, rgd, regs); + if (pcs->regs) { + (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); } if (pcs->pci_isp.isp_param) { free(pcs->pci_isp.isp_param, M_DEVBUF); @@ -1012,14 +1014,36 @@ isp_pci_detach(device_t dev) { struct isp_pcisoftc *pcs; ispsoftc_t *isp; + int status; pcs = device_get_softc(dev); if (pcs == NULL) { return (ENXIO); } isp = (ispsoftc_t *) pcs; - ISP_DISABLE_INTS(isp); + status = isp_detach(isp); + if (status) + return (status); + ISP_LOCK(isp); + isp_uninit(isp); + if (pcs->ih) { + (void) bus_teardown_intr(dev, pcs->irq, pcs->ih); + } + ISP_UNLOCK(isp); mtx_destroy(&isp->isp_osinfo.lock); + (void) bus_release_resource(dev, SYS_RES_IRQ, pcs->iqd, pcs->irq); + if (pcs->msicount) { + pci_release_msi(dev); + } + (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); + if (pcs->pci_isp.isp_param) { + free(pcs->pci_isp.isp_param, M_DEVBUF); + pcs->pci_isp.isp_param = NULL; + } + if (pcs->pci_isp.isp_osinfo.pc.ptr) { + free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF); + pcs->pci_isp.isp_osinfo.pc.ptr = NULL; + } return (0); } Modified: head/sys/dev/isp/ispvar.h ============================================================================== --- head/sys/dev/isp/ispvar.h Sat Aug 13 21:35:22 2011 (r224855) +++ head/sys/dev/isp/ispvar.h Sat Aug 13 23:34:17 2011 (r224856) @@ -953,6 +953,11 @@ void isp_async(ispsoftc_t *, ispasync_t, #define ISPASYNC_CHANGE_OTHER 2 /* + * Platform Independent Error Prinout + */ +void isp_prt_endcmd(ispsoftc_t *, XS_T *); + +/* * Platform Dependent Error and Debug Printout * * Two required functions for each platform must be provided: