From owner-svn-src-stable@FreeBSD.ORG Sun Feb 17 01:34:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 006E27CC; Sun, 17 Feb 2013 01:34:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E6A882E4; Sun, 17 Feb 2013 01:34:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1H1YhVe019735; Sun, 17 Feb 2013 01:34:43 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1H1YgoC019721; Sun, 17 Feb 2013 01:34:42 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302170134.r1H1YgoC019721@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 17 Feb 2013 01:34:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246892 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 01:34:44 -0000 Author: pfg Date: Sun Feb 17 01:34:41 2013 New Revision: 246892 URL: http://svnweb.freebsd.org/changeset/base/246892 Log: MFC r240355, r239372, r246258; ext2fs: general cleanups. - Remove unused extern declarations in fs.h - Correct comments in ext2_dir.h - Several panic() messages showed wrong function names. - Remove commented out stray line in ext2_alloc.c. - Remove the unused macro EXT2_BLOCK_SIZE_BITS() and the then write-only member e2fs_blocksize_bits from struct m_ext2fs. - Remove the unused macro EXT2_FIRST_INO() and the then write-only member e2fs_first_inode from struct m_ext2fs. - Remove EXT2_DESC_PER_BLOCK() and the member e2fs_descpb from struct m_ext2fs. - Remove the unused members e2fs_bmask, e2fs_dbpg and e2fs_mount_opt from struct m_ext2fs - Correct harmless off-by-one error for fspath in ext2_vfsops.c. - Remove the unused and broken macros EXT2_ADDR_PER_BLOCK_BITS() and EXT2_DESC_PER_BLOCK_BITS(). - Remove the !_KERNEL versions of the EXT2_* macros. Submitted by: Christoph Mallon To ease the ease bringing this change I also brought this changes: - Fix typo. - Fix style nit. Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/ext2fs/ext2_bmap.c stable/9/sys/fs/ext2fs/ext2_dir.h stable/9/sys/fs/ext2fs/ext2_inode.c stable/9/sys/fs/ext2fs/ext2_lookup.c stable/9/sys/fs/ext2fs/ext2_vfsops.c stable/9/sys/fs/ext2fs/ext2fs.h stable/9/sys/fs/ext2fs/fs.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_alloc.c Sun Feb 17 01:34:25 2013 (r246891) +++ stable/9/sys/fs/ext2fs/ext2_alloc.c Sun Feb 17 01:34:41 2013 (r246892) @@ -242,7 +242,7 @@ ext2_reallocblks(ap) } else { #ifdef DIAGNOSTIC if (start_ap[start_lvl-1].in_lbn == idp->in_lbn) - panic("ext2_reallocblk: start == end"); + panic("ext2_reallocblks: start == end"); #endif ssize = len - (idp->in_off + 1); if (bread(vp, idp->in_lbn, (int)fs->e2fs_bsize, NOCRED, &ebp)) @@ -1010,7 +1010,7 @@ ext2_blkfree(ip, bno, size) if (isclr(bbp, bno)) { printf("block = %lld, fs = %s\n", (long long)bno, fs->e2fs_fsmnt); - panic("blkfree: freeing free block"); + panic("ext2_blkfree: freeing free block"); } clrbit(bbp, bno); EXT2_LOCK(ump); @@ -1038,7 +1038,6 @@ ext2_vfree(pvp, ino, mode) struct ext2mount *ump; int error, cg; char * ibp; -/* mode_t save_i_mode; */ pip = VTOI(pvp); fs = pip->i_e2fs; @@ -1061,7 +1060,7 @@ ext2_vfree(pvp, ino, mode) printf("ino = %llu, fs = %s\n", (unsigned long long)ino, fs->e2fs_fsmnt); if (fs->e2fs_ronly == 0) - panic("ifree: freeing free inode"); + panic("ext2_vfree: freeing free inode"); } clrbit(ibp, ino); EXT2_LOCK(ump); @@ -1105,7 +1104,7 @@ ext2_mapsearch(struct m_ext2fs *fs, char if (loc == 0) { printf("start = %d, len = %d, fs = %s\n", start, len, fs->e2fs_fsmnt); - panic("ext2fs_alloccg: map corrupted"); + panic("ext2_mapsearch: map corrupted"); /* NOTREACHED */ } } Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_bmap.c Sun Feb 17 01:34:25 2013 (r246891) +++ stable/9/sys/fs/ext2fs/ext2_bmap.c Sun Feb 17 01:34:41 2013 (r246892) @@ -188,7 +188,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb) if ((bp->b_flags & B_CACHE) == 0) { #ifdef DIAGNOSTIC if (!daddr) - panic("ufs_bmaparray: indirect block not in cache"); + panic("ext2_bmaparray: indirect block not in cache"); #endif bp->b_blkno = blkptrtodb(ump, daddr); bp->b_iocmd = BIO_READ; Modified: stable/9/sys/fs/ext2fs/ext2_dir.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_dir.h Sun Feb 17 01:34:25 2013 (r246891) +++ stable/9/sys/fs/ext2fs/ext2_dir.h Sun Feb 17 01:34:41 2013 (r246892) @@ -37,7 +37,7 @@ struct ext2fs_direct { uint32_t e2d_ino; /* inode number of entry */ uint16_t e2d_reclen; /* length of this record */ - uint16_t e2d_namlen; /* length of string in d_name */ + uint16_t e2d_namlen; /* length of string in e2d_name */ char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */ }; /* @@ -49,7 +49,7 @@ struct ext2fs_direct { struct ext2fs_direct_2 { uint32_t e2d_ino; /* inode number of entry */ uint16_t e2d_reclen; /* length of this record */ - uint8_t e2d_namlen; /* length of string in d_name */ + uint8_t e2d_namlen; /* length of string in e2d_name */ uint8_t e2d_type; /* file type */ char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */ }; Modified: stable/9/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode.c Sun Feb 17 01:34:25 2013 (r246891) +++ stable/9/sys/fs/ext2fs/ext2_inode.c Sun Feb 17 01:34:41 2013 (r246892) @@ -311,7 +311,7 @@ ext2_truncate(vp, length, flags, cred, t oip->i_size = length; newspace = blksize(fs, oip, lastblock); if (newspace == 0) - panic("itrunc: newspace"); + panic("ext2_truncate: newspace"); if (oldspace - newspace > 0) { /* * Block number of space to be free'd is @@ -398,8 +398,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, le */ vp = ITOV(ip); bp = getblk(vp, lbn, (int)fs->e2fs_bsize, 0, 0, 0); - if (bp->b_flags & (B_DONE | B_DELWRI)) { - } else { + if ((bp->b_flags & (B_DONE | B_DELWRI)) == 0) { bp->b_iocmd = BIO_READ; if (bp->b_bcount > bp->b_bufsize) panic("ext2_indirtrunc: bad buffer size"); Modified: stable/9/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_lookup.c Sun Feb 17 01:34:25 2013 (r246891) +++ stable/9/sys/fs/ext2fs/ext2_lookup.c Sun Feb 17 01:34:41 2013 (r246892) @@ -812,7 +812,7 @@ ext2_direnter(ip, dvp, cnp) #ifdef DIAGNOSTIC if ((cnp->cn_flags & SAVENAME) == 0) - panic("direnter: missing name"); + panic("ext2_direnter: missing name"); #endif dp = VTOI(dvp); newdir.e2d_ino = ip->i_number; Modified: stable/9/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vfsops.c Sun Feb 17 01:34:25 2013 (r246891) +++ stable/9/sys/fs/ext2fs/ext2_vfsops.c Sun Feb 17 01:34:41 2013 (r246892) @@ -127,7 +127,7 @@ ext2_mount(struct mount *mp) vfs_getopt(opts, "fspath", (void **)&path, NULL); /* Double-check the length of path.. */ - if (strlen(path) >= MAXMNTLEN - 1) + if (strlen(path) >= MAXMNTLEN) return (ENAMETOOLONG); fspec = NULL; @@ -318,12 +318,12 @@ compute_sb_data(struct vnode *devvp, str int i; int logic_sb_block = 1; /* XXX for now */ struct buf *bp; + uint32_t e2fs_descpb; fs->e2fs_bsize = EXT2_MIN_BLOCK_SIZE << es->e2fs_log_bsize; fs->e2fs_bshift = EXT2_MIN_BLOCK_LOG_SIZE + es->e2fs_log_bsize; fs->e2fs_fsbtodb = es->e2fs_log_bsize + 1; fs->e2fs_qbmask = fs->e2fs_bsize - 1; - fs->e2fs_blocksize_bits = es->e2fs_log_bsize + 10; fs->e2fs_fsize = EXT2_MIN_FRAG_SIZE << es->e2fs_log_fsize; if (fs->e2fs_fsize) fs->e2fs_fpb = fs->e2fs_bsize / fs->e2fs_fsize; @@ -331,10 +331,8 @@ compute_sb_data(struct vnode *devvp, str fs->e2fs_fpg = es->e2fs_fpg; fs->e2fs_ipg = es->e2fs_ipg; if (es->e2fs_rev == E2FS_REV0) { - fs->e2fs_first_inode = EXT2_FIRSTINO; fs->e2fs_isize = E2FS_REV0_INODE_SIZE ; } else { - fs->e2fs_first_inode = es->e2fs_first_ino; fs->e2fs_isize = es->e2fs_inode_size; /* @@ -357,12 +355,11 @@ compute_sb_data(struct vnode *devvp, str fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb; - fs->e2fs_descpb = fs->e2fs_bsize / sizeof(struct ext2_gd); /* s_resuid / s_resgid ? */ fs->e2fs_gcount = (es->e2fs_bcount - es->e2fs_first_dblock + EXT2_BLOCKS_PER_GROUP(fs) - 1) / EXT2_BLOCKS_PER_GROUP(fs); - db_count = (fs->e2fs_gcount + EXT2_DESC_PER_BLOCK(fs) - 1) / - EXT2_DESC_PER_BLOCK(fs); + e2fs_descpb = fs->e2fs_bsize / sizeof(struct ext2_gd); + db_count = (fs->e2fs_gcount + e2fs_descpb - 1) / e2fs_descpb; fs->e2fs_gdbcount = db_count; fs->e2fs_gd = malloc(db_count * fs->e2fs_bsize, M_EXT2MNT, M_WAITOK); @@ -767,7 +764,7 @@ ext2_statfs(struct mount *mp, struct sta ump = VFSTOEXT2(mp); fs = ump->um_e2fs; if (fs->e2fs->e2fs_magic != E2FS_MAGIC) - panic("ext2fs_statvfs"); + panic("ext2_statfs"); /* * Compute the overhead (FS structures) Modified: stable/9/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2fs.h Sun Feb 17 01:34:25 2013 (r246891) +++ stable/9/sys/fs/ext2fs/ext2fs.h Sun Feb 17 01:34:41 2013 (r246892) @@ -153,7 +153,6 @@ struct m_ext2fs { char e2fs_fmod; /* super block modified flag */ uint32_t e2fs_bsize; /* Block size */ uint32_t e2fs_bshift; /* calc of logical block no */ - int32_t e2fs_bmask; /* calc of block offset */ int32_t e2fs_bpg; /* Number of blocks per group */ int64_t e2fs_qbmask; /* = s_blocksize -1 */ uint32_t e2fs_fsbtodb; /* Shift to get disk block */ @@ -163,14 +162,9 @@ struct m_ext2fs { uint32_t e2fs_fsize; /* Size of fragments per block */ uint32_t e2fs_fpb; /* Number of fragments per block */ uint32_t e2fs_fpg; /* Number of fragments per group */ - uint32_t e2fs_dbpg; /* Number of descriptor blocks per group */ - uint32_t e2fs_descpb; /* Number of group descriptors per block */ uint32_t e2fs_gdbcount; /* Number of group descriptors */ uint32_t e2fs_gcount; /* Number of groups */ - uint32_t e2fs_first_inode;/* First inode on fs */ int32_t e2fs_isize; /* Size of inode */ - uint32_t e2fs_mount_opt; - uint32_t e2fs_blocksize_bits; uint32_t e2fs_total_dir; /* Total number of directories */ uint8_t *e2fs_contigdirs; /* (u) # of contig. allocated dirs */ char e2fs_wasvalid; /* valid at mount time */ @@ -313,27 +307,9 @@ struct csum { #define EXT2_MIN_BLOCK_SIZE 1024 #define EXT2_MAX_BLOCK_SIZE 4096 #define EXT2_MIN_BLOCK_LOG_SIZE 10 -#if defined(_KERNEL) -# define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize) -#else -# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->e2fs_log_bsize) -#endif +#define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize) #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(uint32_t)) -#if defined(_KERNEL) -# define EXT2_BLOCK_SIZE_BITS(s) ((s)->e2fs_blocksize_bits) -#else -# define EXT2_BLOCK_SIZE_BITS(s) ((s)->e2fs_log_bsize + 10) -#endif -#if defined(_KERNEL) -#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits) #define EXT2_INODE_SIZE(s) (EXT2_SB(s)->e2fs_isize) -#define EXT2_FIRST_INO(s) (EXT2_SB(s)->e2fs_first_inode) -#else -#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == E2FS_REV0) ? \ - E2FS_REV0 : (s)->s_inode_size) -#define EXT2_FIRST_INO(s) (((s)->s_rev_level == E2FS_REV0) ? \ - E2FS_REV0 : (s)->e2fs_first_ino) -#endif /* * Macro-instructions used to manage fragments @@ -341,25 +317,12 @@ struct csum { #define EXT2_MIN_FRAG_SIZE 1024 #define EXT2_MAX_FRAG_SIZE 4096 #define EXT2_MIN_FRAG_LOG_SIZE 10 -#if defined(_KERNEL) -# define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->e2fs_fsize) -# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->e2fs_fpb) -#else -# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->e2fs_log_fsize) -# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s)) -#endif +#define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->e2fs_fsize) +#define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->e2fs_fpb) /* * Macro-instructions used to manage group descriptors */ -#if defined(_KERNEL) -# define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->e2fs_bpg) -# define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->e2fs_descpb) -# define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits) -#else -# define EXT2_BLOCKS_PER_GROUP(s) ((s)->e2fs_bpg) -# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(struct ext2_gd)) - -#endif +#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->e2fs_bpg) #endif /* !_FS_EXT2FS_EXT2FS_H_ */ Modified: stable/9/sys/fs/ext2fs/fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/fs.h Sun Feb 17 01:34:25 2013 (r246891) +++ stable/9/sys/fs/ext2fs/fs.h Sun Feb 17 01:34:41 2013 (r246892) @@ -149,7 +149,4 @@ */ #define NINDIR(fs) (EXT2_ADDR_PER_BLOCK(fs)) -extern int inside[], around[]; -extern u_char *fragtbl[]; - #endif /* !_FS_EXT2FS_FS_H_ */ From owner-svn-src-stable@FreeBSD.ORG Sun Feb 17 03:33:14 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9AD56B60; Sun, 17 Feb 2013 03:33:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8C1D481E; Sun, 17 Feb 2013 03:33:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1H3XEZt056889; Sun, 17 Feb 2013 03:33:14 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1H3XDlx056887; Sun, 17 Feb 2013 03:33:13 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302170333.r1H3XDlx056887@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 17 Feb 2013 03:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246895 - in stable/9/usr.sbin/crunch: crunchgen crunchide X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 03:33:14 -0000 Author: pfg Date: Sun Feb 17 03:33:13 2013 New Revision: 246895 URL: http://svnweb.freebsd.org/changeset/base/246895 Log: MFC r246296, r246298, r246346; crunchide: support non-custom elf object layout. crunchgen: Permit use of alternative linkers. crunchide: Put e_shnum into a local variable. [1] Submitted by: Pete Chou Reviewed by: Christoph Mallon [1] Modified: stable/9/usr.sbin/crunch/crunchgen/crunchgen.c stable/9/usr.sbin/crunch/crunchide/exec_elf32.c Directory Properties: stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/crunch/ (props changed) Modified: stable/9/usr.sbin/crunch/crunchgen/crunchgen.c ============================================================================== --- stable/9/usr.sbin/crunch/crunchgen/crunchgen.c Sun Feb 17 02:52:42 2013 (r246894) +++ stable/9/usr.sbin/crunch/crunchgen/crunchgen.c Sun Feb 17 03:33:13 2013 (r246895) @@ -978,6 +978,7 @@ top_makefile_rules(FILE *outmk) { prog_t *p; + fprintf(outmk, "LD?= ld\n"); if ( subtract_strlst(&libs, &libs_so) ) fprintf(outmk, "# NOTE: Some LIBS declarations below overridden by LIBS_SO\n"); @@ -1107,7 +1108,7 @@ prog_makefile_rules(FILE *outmk, prog_t fprintf(outmk, " $(%s_LIBS)", p->ident); fprintf(outmk, "\n"); - fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)", + fprintf(outmk, "\t$(LD) -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)", p->name, p->name, p->ident); if (p->libs) fprintf(outmk, " $(%s_LIBS)", p->ident); Modified: stable/9/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- stable/9/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 17 02:52:42 2013 (r246894) +++ stable/9/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 17 03:33:13 2013 (r246895) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -82,11 +83,9 @@ __FBSDID("$FreeBSD$"); #define xe32toh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x)) #define htoxe32(x) ((data == ELFDATA2MSB) ? htobe32(x) : htole32(x)) -struct listelem { - struct listelem *next; - void *mem; - off_t file; - size_t size; +struct shlayout { + Elf_Shdr *shdr; + void *bufp; }; static ssize_t @@ -235,87 +234,154 @@ int ELFNAMEEND(hide)(int fd, const char *fn) { Elf_Ehdr ehdr; - Elf_Shdr *shdrp = NULL, *symtabshdr, *strtabshdr; + struct shlayout *layoutp = NULL; + Elf_Shdr *shdrp = NULL, *symtabshdr, *strtabshdr, *shstrtabshdr; + Elf_Shdr shdrshdr; Elf_Sym *symtabp = NULL; - char *strtabp = NULL; - Elf_Size nsyms, ewi; + char *shstrtabp = NULL, *strtabp = NULL; + Elf_Size nsyms, ewi; + Elf_Off off; ssize_t shdrsize; - int rv, i, weird; - size_t nstrtab_size, nstrtab_nextoff, fn_size; + int rv, i, weird, l, m, r, strtabidx; + size_t nstrtab_size, nstrtab_nextoff, fn_size, size; char *nstrtabp = NULL; unsigned char data; - Elf_Off maxoff, stroff; const char *weirdreason = NULL; + void *buf; + Elf_Half shnum; rv = 0; if (xreadatoff(fd, &ehdr, 0, sizeof ehdr, fn) != sizeof ehdr) goto bad; data = ehdr.e_ident[EI_DATA]; + shnum = xe16toh(ehdr.e_shnum); - shdrsize = xe16toh(ehdr.e_shnum) * xe16toh(ehdr.e_shentsize); + shdrsize = shnum * xe16toh(ehdr.e_shentsize); if ((shdrp = xmalloc(shdrsize, fn, "section header table")) == NULL) goto bad; if (xreadatoff(fd, shdrp, xewtoh(ehdr.e_shoff), shdrsize, fn) != shdrsize) goto bad; - symtabshdr = strtabshdr = NULL; + symtabshdr = strtabshdr = shstrtabshdr = NULL; weird = 0; - maxoff = stroff = 0; - for (i = 0; i < xe16toh(ehdr.e_shnum); i++) { - if (xewtoh(shdrp[i].sh_offset) > maxoff) - maxoff = xewtoh(shdrp[i].sh_offset); + for (i = 0; i < shnum; i++) { switch (xe32toh(shdrp[i].sh_type)) { case SHT_SYMTAB: - if (symtabshdr != NULL) + if (symtabshdr != NULL) { weird = 1; + weirdreason = "multiple symbol tables"; + } symtabshdr = &shdrp[i]; strtabshdr = &shdrp[xe32toh(shdrp[i].sh_link)]; - - /* Check whether the string table is the last section */ - stroff = xewtoh(shdrp[xe32toh(shdrp[i].sh_link)].sh_offset); - if (!weird && xe32toh(shdrp[i].sh_link) != (xe16toh(ehdr.e_shnum) - 1)) { - weird = 1; - weirdreason = "string table not last section"; - } + break; + case SHT_STRTAB: + if (i == xe16toh(ehdr.e_shstrndx)) + shstrtabshdr = &shdrp[i]; break; } } - if (! weirdreason) - weirdreason = "unsupported"; if (symtabshdr == NULL) goto out; - if (strtabshdr == NULL) + if (strtabshdr == NULL) { weird = 1; - if (!weird && stroff != maxoff) { + weirdreason = "string table does not exist"; + } + if (shstrtabshdr == NULL) { weird = 1; - weirdreason = "string table section not last in file"; - } + weirdreason = "section header string table does not exist"; + } + if (weirdreason == NULL) + weirdreason = "unsupported"; if (weird) { fprintf(stderr, "%s: weird executable (%s)\n", fn, weirdreason); goto bad; } /* + * sort section layout table by offset + */ + layoutp = xmalloc((shnum + 1) * sizeof(struct shlayout), + fn, "layout table"); + if (layoutp == NULL) + goto bad; + + /* add a pseudo entry to represent the section header table */ + shdrshdr.sh_offset = ehdr.e_shoff; + shdrshdr.sh_size = htoxew(shdrsize); + shdrshdr.sh_addralign = htoxew(ELFSIZE / 8); + layoutp[shnum].shdr = &shdrshdr; + + /* insert and sort normal section headers */ + for (i = shnum; i-- != 0;) { + l = i + 1; + r = shnum; + while (l <= r) { + m = ( l + r) / 2; + if (xewtoh(shdrp[i].sh_offset) > + xewtoh(layoutp[m].shdr->sh_offset)) + l = m + 1; + else + r = m - 1; + } + + if (r != i) { + memmove(&layoutp[i], &layoutp[i + 1], + sizeof(struct shlayout) * (r - i)); + } + + layoutp[r].shdr = &shdrp[i]; + layoutp[r].bufp = NULL; + } + ++shnum; + + /* * load up everything we need */ - /* symbol table */ - if ((symtabp = xmalloc(xewtoh(symtabshdr->sh_size), fn, "symbol table")) - == NULL) - goto bad; - if ((size_t)xreadatoff(fd, symtabp, xewtoh(symtabshdr->sh_offset), - xewtoh(symtabshdr->sh_size), fn) != xewtoh(symtabshdr->sh_size)) + /* load section string table for debug use */ + if ((shstrtabp = xmalloc(xewtoh(shstrtabshdr->sh_size), fn, + "section string table")) == NULL) + goto bad; + if ((size_t)xreadatoff(fd, shstrtabp, xewtoh(shstrtabshdr->sh_offset), + xewtoh(shstrtabshdr->sh_size), fn) != xewtoh(shstrtabshdr->sh_size)) goto bad; - /* string table */ - if ((strtabp = xmalloc(xewtoh(strtabshdr->sh_size), fn, "string table")) - == NULL) - goto bad; - if ((size_t)xreadatoff(fd, strtabp, xewtoh(strtabshdr->sh_offset), - xewtoh(strtabshdr->sh_size), fn) != xewtoh(strtabshdr->sh_size)) - goto bad; + /* we need symtab, strtab, and everything behind strtab */ + strtabidx = INT_MAX; + for (i = 0; i < shnum; i++) { + if (layoutp[i].shdr == &shdrshdr) { + /* not load section header again */ + layoutp[i].bufp = shdrp; + continue; + } + if (layoutp[i].shdr == shstrtabshdr) { + /* not load section string table again */ + layoutp[i].bufp = shstrtabp; + continue; + } + + if (layoutp[i].shdr == strtabshdr) + strtabidx = i; + if (layoutp[i].shdr == symtabshdr || i >= strtabidx) { + off = xewtoh(layoutp[i].shdr->sh_offset); + size = xewtoh(layoutp[i].shdr->sh_size); + layoutp[i].bufp = xmalloc(size, fn, + shstrtabp + xewtoh(layoutp[i].shdr->sh_name)); + if (layoutp[i].bufp == NULL) + goto bad; + if ((size_t)xreadatoff(fd, layoutp[i].bufp, off, size, fn) != + size) + goto bad; + + /* set symbol table and string table */ + if (layoutp[i].shdr == symtabshdr) + symtabp = layoutp[i].bufp; + else if (layoutp[i].shdr == strtabshdr) + strtabp = layoutp[i].bufp; + } + } nstrtab_size = 256; nstrtabp = xmalloc(nstrtab_size, fn, "new string table"); @@ -365,28 +431,62 @@ ELFNAMEEND(hide)(int fd, const char *fn) strtabshdr->sh_size = htoxew(nstrtab_nextoff); /* - * write new tables to the file + * update section header table in ascending order of offset */ - if (xwriteatoff(fd, shdrp, xewtoh(ehdr.e_shoff), shdrsize, fn) != - shdrsize) - goto bad; - if ((size_t)xwriteatoff(fd, symtabp, xewtoh(symtabshdr->sh_offset), - xewtoh(symtabshdr->sh_size), fn) != xewtoh(symtabshdr->sh_size)) - goto bad; - /* write new symbol table strings */ - if ((size_t)xwriteatoff(fd, nstrtabp, xewtoh(strtabshdr->sh_offset), - xewtoh(strtabshdr->sh_size), fn) != xewtoh(strtabshdr->sh_size)) - goto bad; + for (i = strtabidx + 1; i < shnum; i++) { + Elf_Off off, align; + off = xewtoh(layoutp[i - 1].shdr->sh_offset) + + xewtoh(layoutp[i - 1].shdr->sh_size); + align = xewtoh(layoutp[i].shdr->sh_addralign); + off = (off + (align - 1)) & ~(align - 1); + layoutp[i].shdr->sh_offset = htoxew(off); + } + + /* + * write data to the file in descending order of offset + */ + for (i = shnum; i-- != 0;) { + if (layoutp[i].shdr == strtabshdr) { + /* new string table */ + buf = nstrtabp; + } else + buf = layoutp[i].bufp; + + if (layoutp[i].shdr == &shdrshdr || + layoutp[i].shdr == symtabshdr || i >= strtabidx) { + if (buf == NULL) + goto bad; + + /* + * update the offset of section header table in elf + * header if needed. + */ + if (layoutp[i].shdr == &shdrshdr && + ehdr.e_shoff != shdrshdr.sh_offset) { + ehdr.e_shoff = shdrshdr.sh_offset; + off = (ELFSIZE == 32) ? 32 : 44; + size = sizeof(Elf_Off); + if ((size_t)xwriteatoff(fd, &ehdr.e_shoff, off, size, + fn) != size) + goto bad; + } + + off = xewtoh(layoutp[i].shdr->sh_offset); + size = xewtoh(layoutp[i].shdr->sh_size); + if ((size_t)xwriteatoff(fd, buf, off, size, fn) != size) + goto bad; + } + } out: - if (shdrp != NULL) - free(shdrp); - if (symtabp != NULL) - free(symtabp); - if (strtabp != NULL) - free(strtabp); - if (nstrtabp != NULL) - free(nstrtabp); + if (layoutp != NULL) { + for (i = 0; i < shnum; i++) { + if (layoutp[i].bufp != NULL) + free(layoutp[i].bufp); + } + free(layoutp); + } + free(nstrtabp); return (rv); bad: From owner-svn-src-stable@FreeBSD.ORG Sun Feb 17 06:06:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A8A53D6A; Sun, 17 Feb 2013 06:06:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 903C4AE6; Sun, 17 Feb 2013 06:06:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1H66B1c002175; Sun, 17 Feb 2013 06:06:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1H66BV7002174; Sun, 17 Feb 2013 06:06:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302170606.r1H66BV7002174@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 17 Feb 2013 06:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246897 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 06:06:12 -0000 Author: kib Date: Sun Feb 17 06:06:11 2013 New Revision: 246897 URL: http://svnweb.freebsd.org/changeset/base/246897 Log: MFC r246636: Remove the ia64-specific code fragment, which effect is more cleanly done by the call to trans_prot() function a line before. Modified: stable/9/sys/kern/imgact_elf.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/imgact_elf.c ============================================================================== --- stable/9/sys/kern/imgact_elf.c Sun Feb 17 04:43:22 2013 (r246896) +++ stable/9/sys/kern/imgact_elf.c Sun Feb 17 06:06:11 2013 (r246897) @@ -829,16 +829,6 @@ __CONCAT(exec_, __elfN(imgact))(struct i if (phdr[i].p_memsz == 0) break; prot = __elfN(trans_prot)(phdr[i].p_flags); - -#if defined(__ia64__) && __ELF_WORD_SIZE == 32 && defined(IA32_ME_HARDER) - /* - * Some x86 binaries assume read == executable, - * notably the M3 runtime and therefore cvsup - */ - if (prot & VM_PROT_READ) - prot |= VM_PROT_EXECUTE; -#endif - if ((error = __elfN(load_section)(vmspace, imgp->object, phdr[i].p_offset, (caddr_t)(uintptr_t)phdr[i].p_vaddr + et_dyn_addr, From owner-svn-src-stable@FreeBSD.ORG Sun Feb 17 14:25:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BE6361DE; Sun, 17 Feb 2013 14:25:42 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A63849EA; Sun, 17 Feb 2013 14:25:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1HEPgku052955; Sun, 17 Feb 2013 14:25:42 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1HEPgPA052954; Sun, 17 Feb 2013 14:25:42 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302171425.r1HEPgPA052954@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 17 Feb 2013 14:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246914 - stable/9/bin/test X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 14:25:42 -0000 Author: jilles Date: Sun Feb 17 14:25:42 2013 New Revision: 246914 URL: http://svnweb.freebsd.org/changeset/base/246914 Log: MFC r244734: test(1): Document == alias for =. Modified: stable/9/bin/test/test.1 Directory Properties: stable/9/bin/test/ (props changed) Modified: stable/9/bin/test/test.1 ============================================================================== --- stable/9/bin/test/test.1 Sun Feb 17 13:06:59 2013 (r246913) +++ stable/9/bin/test/test.1 Sun Feb 17 14:25:42 2013 (r246914) @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd September 10, 2010 +.Dd December 27, 2012 .Dt TEST 1 .Os .Sh NAME @@ -331,6 +331,13 @@ missing. .It >1 An error occurred. .El +.Sh COMPATIBILITY +For compatibility with some other implementations, +the +.Cm = +primary can be substituted with +.Cm == +with the same meaning. .Sh SEE ALSO .Xr builtin 1 , .Xr expr 1 , From owner-svn-src-stable@FreeBSD.ORG Sun Feb 17 14:27:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4AA0D34D; Sun, 17 Feb 2013 14:27:05 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 255849F7; Sun, 17 Feb 2013 14:27:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1HER5Gm053191; Sun, 17 Feb 2013 14:27:05 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1HER5dE053190; Sun, 17 Feb 2013 14:27:05 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302171427.r1HER5dE053190@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 17 Feb 2013 14:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r246915 - stable/8/bin/test X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 14:27:05 -0000 Author: jilles Date: Sun Feb 17 14:27:04 2013 New Revision: 246915 URL: http://svnweb.freebsd.org/changeset/base/246915 Log: MFC r244734: test(1): Document == alias for =. Modified: stable/8/bin/test/test.1 Directory Properties: stable/8/bin/test/ (props changed) Modified: stable/8/bin/test/test.1 ============================================================================== --- stable/8/bin/test/test.1 Sun Feb 17 14:25:42 2013 (r246914) +++ stable/8/bin/test/test.1 Sun Feb 17 14:27:04 2013 (r246915) @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd September 10, 2010 +.Dd December 27, 2012 .Dt TEST 1 .Os .Sh NAME @@ -331,6 +331,13 @@ missing. .It >1 An error occurred. .El +.Sh COMPATIBILITY +For compatibility with some other implementations, +the +.Cm = +primary can be substituted with +.Cm == +with the same meaning. .Sh SEE ALSO .Xr builtin 1 , .Xr expr 1 , From owner-svn-src-stable@FreeBSD.ORG Sun Feb 17 19:49:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4FA9C126; Sun, 17 Feb 2013 19:49:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 325C466D; Sun, 17 Feb 2013 19:49:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1HJnJO8051799; Sun, 17 Feb 2013 19:49:19 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1HJnJib051798; Sun, 17 Feb 2013 19:49:19 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201302171949.r1HJnJib051798@svn.freebsd.org> From: Mark Johnston Date: Sun, 17 Feb 2013 19:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246918 - stable/9/usr.sbin/newsyslog X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 19:49:19 -0000 Author: markj Date: Sun Feb 17 19:49:18 2013 New Revision: 246918 URL: http://svnweb.freebsd.org/changeset/base/246918 Log: MFC r245961 r245962 r245963. MFC r245961: When the 'R' flag is used with a newsyslog.conf entry, some fields of the corresponding struct sigwork_entry were left uninitialized, potentially causing an early return from do_sigwork(). Ensure that these fields are initialized, and handle the 'R' flag properly in do_sigwork(). MFC r245962: Ensure that newsyslog -n prints the correct message for a rotation rule that uses the 'R' flag. MFC r245963: Rename the run_cmd field to sw_runcmd to make it consistent with the other fields in struct sigwork_entry. Approved by: emaste (co-mentor) Modified: stable/9/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/9/usr.sbin/newsyslog/ (props changed) Modified: stable/9/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/9/usr.sbin/newsyslog/newsyslog.c Sun Feb 17 19:48:23 2013 (r246917) +++ stable/9/usr.sbin/newsyslog/newsyslog.c Sun Feb 17 19:49:18 2013 (r246918) @@ -179,7 +179,7 @@ struct sigwork_entry { int sw_pidok; /* true if pid value is valid */ pid_t sw_pid; /* the process id from the PID file */ const char *sw_pidtype; /* "daemon" or "process group" */ - int run_cmd; /* run command or send PID to signal */ + int sw_runcmd; /* run command or send PID to signal */ char sw_fname[1]; /* file the PID was read from or shell cmd */ }; @@ -1864,7 +1864,7 @@ do_sigwork(struct sigwork_entry *swork) int kres, secs; char *tmp; - if (!(swork->sw_pidok) || swork->sw_pid == 0) + if (swork->sw_runcmd == 0 && (!(swork->sw_pidok) || swork->sw_pid == 0)) return; /* no work to do... */ /* @@ -1898,14 +1898,19 @@ do_sigwork(struct sigwork_entry *swork) } if (noaction) { - printf("\tkill -%d %d \t\t# %s\n", swork->sw_signum, - (int)swork->sw_pid, swork->sw_fname); - if (secs > 0) - printf("\tsleep %d\n", secs); + if (swork->sw_runcmd) + printf("\tsh -c '%s %d'\n", swork->sw_fname, + swork->sw_signum); + else { + printf("\tkill -%d %d \t\t# %s\n", swork->sw_signum, + (int)swork->sw_pid, swork->sw_fname); + if (secs > 0) + printf("\tsleep %d\n", secs); + } return; } - if (swork->run_cmd) { + if (swork->sw_runcmd) { asprintf(&tmp, "%s %d", swork->sw_fname, swork->sw_signum); if (tmp == NULL) { warn("can't allocate memory to run %s", @@ -1981,7 +1986,7 @@ do_zipwork(struct zipwork_entry *zwork) else pgm_name++; - if (zwork->zw_swork != NULL && zwork->zw_swork->run_cmd == 0 && + if (zwork->zw_swork != NULL && zwork->zw_swork->sw_runcmd == 0 && zwork->zw_swork->sw_pidok <= 0) { warnx( "log %s not compressed because daemon(s) not notified", @@ -2073,10 +2078,12 @@ save_sigwork(const struct conf_entry *en tmpsiz = sizeof(struct sigwork_entry) + strlen(ent->pid_cmd_file) + 1; stmp = malloc(tmpsiz); - stmp->run_cmd = 0; + stmp->sw_runcmd = 0; /* If this is a command to run we just set the flag and run command */ if (ent->flags & CE_PID2CMD) { - stmp->run_cmd = 1; + stmp->sw_pid = -1; + stmp->sw_pidok = 0; + stmp->sw_runcmd = 1; } else { set_swpid(stmp, ent); } From owner-svn-src-stable@FreeBSD.ORG Sun Feb 17 19:49:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 89475239; Sun, 17 Feb 2013 19:49:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6CCE0674; Sun, 17 Feb 2013 19:49:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1HJnUho051866; Sun, 17 Feb 2013 19:49:30 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1HJnUXT051864; Sun, 17 Feb 2013 19:49:30 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201302171949.r1HJnUXT051864@svn.freebsd.org> From: Mark Johnston Date: Sun, 17 Feb 2013 19:49:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r246919 - stable/8/usr.sbin/newsyslog X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 19:49:30 -0000 Author: markj Date: Sun Feb 17 19:49:29 2013 New Revision: 246919 URL: http://svnweb.freebsd.org/changeset/base/246919 Log: MFC r245961 r245962 r245963. MFC r245961: When the 'R' flag is used with a newsyslog.conf entry, some fields of the corresponding struct sigwork_entry were left uninitialized, potentially causing an early return from do_sigwork(). Ensure that these fields are initialized, and handle the 'R' flag properly in do_sigwork(). MFC r245962: Ensure that newsyslog -n prints the correct message for a rotation rule that uses the 'R' flag. MFC r245963: Rename the run_cmd field to sw_runcmd to make it consistent with the other fields in struct sigwork_entry. Approved by: emaste (co-mentor) Modified: stable/8/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/8/usr.sbin/newsyslog/ (props changed) Modified: stable/8/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/8/usr.sbin/newsyslog/newsyslog.c Sun Feb 17 19:49:18 2013 (r246918) +++ stable/8/usr.sbin/newsyslog/newsyslog.c Sun Feb 17 19:49:29 2013 (r246919) @@ -179,7 +179,7 @@ struct sigwork_entry { int sw_pidok; /* true if pid value is valid */ pid_t sw_pid; /* the process id from the PID file */ const char *sw_pidtype; /* "daemon" or "process group" */ - int run_cmd; /* run command or send PID to signal */ + int sw_runcmd; /* run command or send PID to signal */ char sw_fname[1]; /* file the PID was read from or shell cmd */ }; @@ -1830,7 +1830,7 @@ do_sigwork(struct sigwork_entry *swork) int kres, secs; char *tmp; - if (!(swork->sw_pidok) || swork->sw_pid == 0) + if (swork->sw_runcmd == 0 && (!(swork->sw_pidok) || swork->sw_pid == 0)) return; /* no work to do... */ /* @@ -1864,14 +1864,19 @@ do_sigwork(struct sigwork_entry *swork) } if (noaction) { - printf("\tkill -%d %d \t\t# %s\n", swork->sw_signum, - (int)swork->sw_pid, swork->sw_fname); - if (secs > 0) - printf("\tsleep %d\n", secs); + if (swork->sw_runcmd) + printf("\tsh -c '%s %d'\n", swork->sw_fname, + swork->sw_signum); + else { + printf("\tkill -%d %d \t\t# %s\n", swork->sw_signum, + (int)swork->sw_pid, swork->sw_fname); + if (secs > 0) + printf("\tsleep %d\n", secs); + } return; } - if (swork->run_cmd) { + if (swork->sw_runcmd) { asprintf(&tmp, "%s %d", swork->sw_fname, swork->sw_signum); if (tmp == NULL) { warn("can't allocate memory to run %s", @@ -1946,7 +1951,7 @@ do_zipwork(struct zipwork_entry *zwork) else pgm_name++; - if (zwork->zw_swork != NULL && zwork->zw_swork->run_cmd == 0 && + if (zwork->zw_swork != NULL && zwork->zw_swork->sw_runcmd == 0 && zwork->zw_swork->sw_pidok <= 0) { warnx( "log %s not compressed because daemon(s) not notified", @@ -2038,10 +2043,12 @@ save_sigwork(const struct conf_entry *en tmpsiz = sizeof(struct sigwork_entry) + strlen(ent->pid_cmd_file) + 1; stmp = malloc(tmpsiz); - stmp->run_cmd = 0; + stmp->sw_runcmd = 0; /* If this is a command to run we just set the flag and run command */ if (ent->flags & CE_PID2CMD) { - stmp->run_cmd = 1; + stmp->sw_pid = -1; + stmp->sw_pidok = 0; + stmp->sw_runcmd = 1; } else { set_swpid(stmp, ent); } From owner-svn-src-stable@FreeBSD.ORG Sun Feb 17 19:50:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 313C03F3; Sun, 17 Feb 2013 19:50:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 22F4267F; Sun, 17 Feb 2013 19:50:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1HJo0Fg051978; Sun, 17 Feb 2013 19:50:00 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1HJo0RK051965; Sun, 17 Feb 2013 19:50:00 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201302171950.r1HJo0RK051965@svn.freebsd.org> From: Mark Johnston Date: Sun, 17 Feb 2013 19:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246920 - stable/9/usr.bin/grep/regex X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 19:50:00 -0000 Author: markj Date: Sun Feb 17 19:49:59 2013 New Revision: 246920 URL: http://svnweb.freebsd.org/changeset/base/246920 Log: MFC r245075: Fix a segfault when bsdgrep -i is given an empty pattern string. Approved by: emaste (co-mentor) Modified: stable/9/usr.bin/grep/regex/tre-fastmatch.c Directory Properties: stable/9/usr.bin/grep/ (props changed) Modified: stable/9/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- stable/9/usr.bin/grep/regex/tre-fastmatch.c Sun Feb 17 19:49:29 2013 (r246919) +++ stable/9/usr.bin/grep/regex/tre-fastmatch.c Sun Feb 17 19:49:59 2013 (r246920) @@ -468,7 +468,7 @@ static int fastcmp(const fastmatch_t *fg fg->nosub = (cflags & REG_NOSUB); \ \ /* Cannot handle REG_ICASE with MB string */ \ - if (fg->icase && (TRE_MB_CUR_MAX > 1)) \ + if (fg->icase && (TRE_MB_CUR_MAX > 1) && n > 0) \ { \ DPRINT(("Cannot use fast matcher for MBS with REG_ICASE\n")); \ return REG_BADPAT; \ From owner-svn-src-stable@FreeBSD.ORG Mon Feb 18 05:05:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CB9FD7F2; Mon, 18 Feb 2013 05:05:02 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BDAC7B36; Mon, 18 Feb 2013 05:05:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1I5529P024768; Mon, 18 Feb 2013 05:05:02 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1I5520P024765; Mon, 18 Feb 2013 05:05:02 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201302180505.r1I5520P024765@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 18 Feb 2013 05:05:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246937 - stable/9/sys/ia64/ia64 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2013 05:05:02 -0000 Author: marcel Date: Mon Feb 18 05:05:01 2013 New Revision: 246937 URL: http://svnweb.freebsd.org/changeset/base/246937 Log: MFC r246715: Eliminate the PC_CURTHREAD symbol and load the current thread's thread structure pointer atomically from r13 (the pcpu pointer) for the current CPU/core. Modified: stable/9/sys/ia64/ia64/genassym.c stable/9/sys/ia64/ia64/machdep.c stable/9/sys/ia64/ia64/support.S Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ia64/ia64/genassym.c ============================================================================== --- stable/9/sys/ia64/ia64/genassym.c Mon Feb 18 04:33:45 2013 (r246936) +++ stable/9/sys/ia64/ia64/genassym.c Mon Feb 18 05:05:01 2013 (r246937) @@ -96,7 +96,6 @@ ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_SIZE, PAGE_SIZE); ASSYM(PC_CURRENT_PMAP, offsetof(struct pcpu, pc_md.current_pmap)); -ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_IDLETHREAD, offsetof(struct pcpu, pc_idlethread)); ASSYM(PCB_CURRENT_PMAP, offsetof(struct pcb, pcb_current_pmap)); Modified: stable/9/sys/ia64/ia64/machdep.c ============================================================================== --- stable/9/sys/ia64/ia64/machdep.c Mon Feb 18 04:33:45 2013 (r246936) +++ stable/9/sys/ia64/ia64/machdep.c Mon Feb 18 05:05:01 2013 (r246937) @@ -98,6 +98,22 @@ __FBSDID("$FreeBSD$"); #include #include +/* + * For atomicity reasons, we demand that pc_curthread is the first + * field in the struct pcpu. It allows us to read the pointer with + * a single atomic instruction: + * ld8 %curthread = [r13] + * Otherwise we would first have to calculate the load address and + * store the result in a temporary register and that for the load: + * add %temp = %offsetof(struct pcpu), r13 + * ld8 %curthread = [%temp] + * A context switch inbetween the add and the ld8 could have the + * thread migrate to a different core. In that case, %curthread + * would be the thread running on the original core and not actually + * the current thread. + */ +CTASSERT(offsetof(struct pcpu, pc_curthread) == 0); + SYSCTL_NODE(_hw, OID_AUTO, freq, CTLFLAG_RD, 0, ""); SYSCTL_NODE(_machdep, OID_AUTO, cpu, CTLFLAG_RD, 0, ""); Modified: stable/9/sys/ia64/ia64/support.S ============================================================================== --- stable/9/sys/ia64/ia64/support.S Mon Feb 18 04:33:45 2013 (r246936) +++ stable/9/sys/ia64/ia64/support.S Mon Feb 18 05:05:01 2013 (r246937) @@ -73,26 +73,25 @@ END(fusufault) */ ENTRY(casuword, 3) { .mlx - add r15=PC_CURTHREAD,r13 + ld8.acq r15=[r13] // r15 = curthread movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + add r15=TD_PCB,r15 cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; } { .mlx - add r15=TD_PCB,r15 + ld8 r15=[r15] // r15 = PCB movl r14=fusufault ;; } { .mmi - ld8 r15=[r15] // r15 = PCB - ;; mov ar.ccv=in1 add r15=PCB_ONFAULT,r15 + nop 0 ;; } { .mmi @@ -123,12 +122,11 @@ END(casuword) */ ENTRY(casuword32, 3) { .mlx - add r15=PC_CURTHREAD,r13 movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + ld8.acq r15=[r13] // r15 = curthread cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; @@ -177,12 +175,11 @@ END(casuword32) ENTRY(subyte, 2) { .mlx - add r15=PC_CURTHREAD,r13 movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + ld8.acq r15=[r13] // r15 = curthread cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; @@ -223,12 +220,11 @@ END(subyte) ENTRY(suword16, 2) { .mlx - add r15=PC_CURTHREAD,r13 movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + ld8.acq r15=[r13] // r15 = curthread cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; @@ -269,12 +265,11 @@ END(suword16) ENTRY(suword32, 2) { .mlx - add r15=PC_CURTHREAD,r13 movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + ld8.acq r15=[r13] // r15 = curthread cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; @@ -316,12 +311,11 @@ END(suword32) ENTRY(suword64, 2) XENTRY(suword) { .mlx - add r15=PC_CURTHREAD,r13 movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + ld8.acq r15=[r13] // r15 = curthread cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; @@ -370,12 +364,11 @@ END(suword64) ENTRY(fubyte, 1) { .mlx - add r15=PC_CURTHREAD,r13 movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + ld8.acq r15=[r13] // r15 = curthread cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; @@ -416,12 +409,11 @@ END(fubyte) ENTRY(fuword16, 2) { .mlx - add r15=PC_CURTHREAD,r13 movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + ld8.acq r15=[r13] // r15 = curthread cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; @@ -462,12 +454,11 @@ END(fuword16) ENTRY(fuword32, 2) { .mlx - add r15=PC_CURTHREAD,r13 movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + ld8.acq r15=[r13] // r15 = curthread cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; @@ -509,12 +500,11 @@ END(fuword32) ENTRY(fuword64, 2) XENTRY(fuword) { .mlx - add r15=PC_CURTHREAD,r13 movl r14=VM_MAXUSER_ADDRESS ;; } { .mib - ld8 r15=[r15] // r15 = curthread + ld8.acq r15=[r13] // r15 = curthread cmp.geu p6,p0=in0,r14 (p6) br.dpnt.few 1f ;; @@ -630,10 +620,8 @@ ENTRY(copyinstr, 4) cmp.geu p6,p0=in0,loc2 // is in user space. ;; (p6) br.cond.spnt.few copyerr // if it's not, error out. + ld8.acq r15=[r13] movl r14=copyerr // set up fault handler. - add r15=PC_CURTHREAD,r13 // find curthread - ;; - ld8 r15=[r15] ;; add r15=TD_PCB,r15 // find pcb ;; @@ -743,10 +731,8 @@ ENTRY(copyin, 3) cmp.geu p6,p0=in0,loc2 // is in user space. ;; (p6) br.cond.spnt.few copyerr // if it's not, error out. + ld8.acq r15=[r13] movl r14=copyerr // set up fault handler. - add r15=PC_CURTHREAD,r13 // find curthread - ;; - ld8 r15=[r15] ;; add r15=TD_PCB,r15 // find pcb ;; @@ -781,10 +767,8 @@ ENTRY(copyout, 3) cmp.geu p6,p0=in1,loc2 // is in user space. ;; (p6) br.cond.spnt.few copyerr // if it's not, error out. + ld8.acq r15=[r13] movl r14=copyerr // set up fault handler. - add r15=PC_CURTHREAD,r13 // find curthread - ;; - ld8 r15=[r15] ;; add r15=TD_PCB,r15 // find pcb ;; @@ -806,8 +790,7 @@ ENTRY(copyout, 3) END(copyout) ENTRY(copyerr, 0) - add r14=PC_CURTHREAD,r13 ;; // find curthread - ld8 r14=[r14] ;; + ld8.acq r14=[r13] ;; add r14=TD_PCB,r14 ;; // curthread->td_addr ld8 r14=[r14] ;; add r14=PCB_ONFAULT,r14 ;; // &curthread->td_pcb->pcb_onfault From owner-svn-src-stable@FreeBSD.ORG Mon Feb 18 08:24:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7BECE826; Mon, 18 Feb 2013 08:24:40 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6369629D; Mon, 18 Feb 2013 08:24:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1I8OeJU084807; Mon, 18 Feb 2013 08:24:40 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1I8Oe5H084805; Mon, 18 Feb 2013 08:24:40 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201302180824.r1I8Oe5H084805@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 18 Feb 2013 08:24:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246938 - in stable/9/sys: boot/common sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2013 08:24:40 -0000 Author: ae Date: Mon Feb 18 08:24:39 2013 New Revision: 246938 URL: http://svnweb.freebsd.org/changeset/base/246938 Log: MFC r246630: Add bootcamp support to the loader. Modified: stable/9/sys/boot/common/part.c stable/9/sys/sys/diskmbr.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/common/part.c ============================================================================== --- stable/9/sys/boot/common/part.c Mon Feb 18 05:05:01 2013 (r246937) +++ stable/9/sys/boot/common/part.c Mon Feb 18 08:24:39 2013 (r246938) @@ -645,9 +645,13 @@ ptable_open(void *dev, off_t sectors, ui /* Do we have some invalid values? */ if (i != NDOSPART || (table->type == PTABLE_GPT && count > 1)) { - table->type = PTABLE_NONE; - DEBUG("invalid values detected, ignore partition table"); - goto out; + if (dp[1].dp_typ != DOSPTYP_HFS) { + table->type = PTABLE_NONE; + DEBUG("invalid values detected, ignore " + "partition table"); + goto out; + } + DEBUG("Bootcamp detected"); } #ifdef LOADER_GPT_SUPPORT if (table->type == PTABLE_GPT) { Modified: stable/9/sys/sys/diskmbr.h ============================================================================== --- stable/9/sys/sys/diskmbr.h Mon Feb 18 05:05:01 2013 (r246937) +++ stable/9/sys/sys/diskmbr.h Mon Feb 18 08:24:39 2013 (r246938) @@ -50,6 +50,7 @@ #define DOSPTYP_EXTLBA 0x0f /* DOS extended partition */ #define DOSPTYP_LDM 0x42 /* Win2k dynamic extended partition */ #define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ +#define DOSPTYP_HFS 0xaf /* HFS/HFS+ partition type */ #define DOSPTYP_LINSWP 0x82 /* Linux swap partition */ #define DOSPTYP_LINUX 0x83 /* Linux partition */ #define DOSPTYP_LINLVM 0x8e /* Linux LVM partition */ From owner-svn-src-stable@FreeBSD.ORG Mon Feb 18 16:02:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B544B2A0; Mon, 18 Feb 2013 16:02:17 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9C77A6D1; Mon, 18 Feb 2013 16:02:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1IG2HbB024629; Mon, 18 Feb 2013 16:02:17 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1IG2HLo024628; Mon, 18 Feb 2013 16:02:17 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201302181602.r1IG2HLo024628@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 18 Feb 2013 16:02:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246941 - stable/9/share/man/man9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2013 16:02:17 -0000 Author: pluknet Date: Mon Feb 18 16:02:17 2013 New Revision: 246941 URL: http://svnweb.freebsd.org/changeset/base/246941 Log: MFC r246658: Cross-reference vfs_unbusy(9). Modified: stable/9/share/man/man9/vfs_busy.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/vfs_busy.9 ============================================================================== --- stable/9/share/man/man9/vfs_busy.9 Mon Feb 18 11:48:08 2013 (r246940) +++ stable/9/share/man/man9/vfs_busy.9 Mon Feb 18 16:02:17 2013 (r246941) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 14, 2010 +.Dd February 11, 2013 .Dt VFS_BUSY 9 .Os .Sh NAME @@ -84,6 +84,8 @@ The mount point is being unmounted .Dv ( MNTK_UNMOUNT is set). .El +.Sh SEE ALSO +.Xr vfs_unbusy 9 .Sh AUTHORS This manual page was written by .An Chad David Aq davidc@acns.ab.ca . From owner-svn-src-stable@FreeBSD.ORG Mon Feb 18 16:03:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CCA6441D; Mon, 18 Feb 2013 16:03:42 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A6AF66E7; Mon, 18 Feb 2013 16:03:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1IG3g5C024905; Mon, 18 Feb 2013 16:03:42 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1IG3gSb024904; Mon, 18 Feb 2013 16:03:42 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201302181603.r1IG3gSb024904@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 18 Feb 2013 16:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r246942 - stable/8/share/man/man9 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2013 16:03:42 -0000 Author: pluknet Date: Mon Feb 18 16:03:42 2013 New Revision: 246942 URL: http://svnweb.freebsd.org/changeset/base/246942 Log: MFC r246658: Cross-reference vfs_unbusy(9). Modified: stable/8/share/man/man9/vfs_busy.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/vfs_busy.9 ============================================================================== --- stable/8/share/man/man9/vfs_busy.9 Mon Feb 18 16:02:17 2013 (r246941) +++ stable/8/share/man/man9/vfs_busy.9 Mon Feb 18 16:03:42 2013 (r246942) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 14, 2010 +.Dd February 11, 2013 .Dt VFS_BUSY 9 .Os .Sh NAME @@ -84,6 +84,8 @@ The mount point is being unmounted .Dv ( MNTK_UNMOUNT is set). .El +.Sh SEE ALSO +.Xr vfs_unbusy 9 .Sh AUTHORS This manual page was written by .An Chad David Aq davidc@acns.ab.ca . From owner-svn-src-stable@FreeBSD.ORG Mon Feb 18 22:03:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6F6E6825; Mon, 18 Feb 2013 22:03:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5C9409E8; Mon, 18 Feb 2013 22:03:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1IM357K035295; Mon, 18 Feb 2013 22:03:05 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1IM35JN035294; Mon, 18 Feb 2013 22:03:05 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302182203.r1IM35JN035294@svn.freebsd.org> From: Dimitry Andric Date: Mon, 18 Feb 2013 22:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246950 - in stable: 7/usr.bin/mail 8/usr.bin/mail 9/usr.bin/mail X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2013 22:03:05 -0000 Author: dim Date: Mon Feb 18 22:03:04 2013 New Revision: 246950 URL: http://svnweb.freebsd.org/changeset/base/246950 Log: MFC r246860: Fix undefined behaviour in usr.bin/mail/util.c. Reported by: deeptech71@gmail.com Modified: stable/9/usr.bin/mail/util.c Directory Properties: stable/9/usr.bin/mail/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.bin/mail/aux.c stable/8/usr.bin/mail/util.c Directory Properties: stable/7/usr.bin/mail/ (props changed) stable/8/usr.bin/mail/ (props changed) Modified: stable/9/usr.bin/mail/util.c ============================================================================== --- stable/9/usr.bin/mail/util.c Mon Feb 18 20:21:26 2013 (r246949) +++ stable/9/usr.bin/mail/util.c Mon Feb 18 22:03:04 2013 (r246950) @@ -236,8 +236,8 @@ istrncpy(char *dest, const char *src, si { strlcpy(dest, src, dsize); - while (*dest) - *dest++ = tolower((unsigned char)*dest); + for (; *dest; dest++) + *dest = tolower((unsigned char)*dest); } /* From owner-svn-src-stable@FreeBSD.ORG Mon Feb 18 22:03:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C94B9826; Mon, 18 Feb 2013 22:03:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B2AAC9E9; Mon, 18 Feb 2013 22:03:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1IM35BX035301; Mon, 18 Feb 2013 22:03:05 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1IM35xs035300; Mon, 18 Feb 2013 22:03:05 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302182203.r1IM35xs035300@svn.freebsd.org> From: Dimitry Andric Date: Mon, 18 Feb 2013 22:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r246950 - in stable: 7/usr.bin/mail 8/usr.bin/mail 9/usr.bin/mail X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2013 22:03:05 -0000 Author: dim Date: Mon Feb 18 22:03:04 2013 New Revision: 246950 URL: http://svnweb.freebsd.org/changeset/base/246950 Log: MFC r246860: Fix undefined behaviour in usr.bin/mail/util.c. Reported by: deeptech71@gmail.com Modified: stable/8/usr.bin/mail/util.c Directory Properties: stable/8/usr.bin/mail/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.bin/mail/aux.c stable/9/usr.bin/mail/util.c Directory Properties: stable/7/usr.bin/mail/ (props changed) stable/9/usr.bin/mail/ (props changed) Modified: stable/8/usr.bin/mail/util.c ============================================================================== --- stable/8/usr.bin/mail/util.c Mon Feb 18 20:21:26 2013 (r246949) +++ stable/8/usr.bin/mail/util.c Mon Feb 18 22:03:04 2013 (r246950) @@ -257,8 +257,8 @@ istrncpy(dest, src, dsize) { strlcpy(dest, src, dsize); - while (*dest) - *dest++ = tolower((unsigned char)*dest); + for (; *dest; dest++) + *dest = tolower((unsigned char)*dest); } /* From owner-svn-src-stable@FreeBSD.ORG Mon Feb 18 22:03:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3A5B0827; Mon, 18 Feb 2013 22:03:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 219F59EB; Mon, 18 Feb 2013 22:03:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1IM35Nm035307; Mon, 18 Feb 2013 22:03:05 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1IM35a6035306; Mon, 18 Feb 2013 22:03:05 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302182203.r1IM35a6035306@svn.freebsd.org> From: Dimitry Andric Date: Mon, 18 Feb 2013 22:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r246950 - in stable: 7/usr.bin/mail 8/usr.bin/mail 9/usr.bin/mail X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2013 22:03:06 -0000 Author: dim Date: Mon Feb 18 22:03:04 2013 New Revision: 246950 URL: http://svnweb.freebsd.org/changeset/base/246950 Log: MFC r246860: Fix undefined behaviour in usr.bin/mail/util.c. Reported by: deeptech71@gmail.com Modified: stable/7/usr.bin/mail/aux.c Directory Properties: stable/7/usr.bin/mail/ (props changed) Changes in other areas also in this revision: Modified: stable/8/usr.bin/mail/util.c stable/9/usr.bin/mail/util.c Directory Properties: stable/8/usr.bin/mail/ (props changed) stable/9/usr.bin/mail/ (props changed) Modified: stable/7/usr.bin/mail/aux.c ============================================================================== --- stable/7/usr.bin/mail/aux.c Mon Feb 18 20:21:26 2013 (r246949) +++ stable/7/usr.bin/mail/aux.c Mon Feb 18 22:03:04 2013 (r246950) @@ -257,8 +257,8 @@ istrncpy(dest, src, dsize) { strlcpy(dest, src, dsize); - while (*dest) - *dest++ = tolower((unsigned char)*dest); + for (; *dest; dest++) + *dest = tolower((unsigned char)*dest); } /* From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 07:50:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 500C4DBE; Tue, 19 Feb 2013 07:50:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 415D0219; Tue, 19 Feb 2013 07:50:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J7oBcJ012571; Tue, 19 Feb 2013 07:50:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J7oBRj012570; Tue, 19 Feb 2013 07:50:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302190750.r1J7oBRj012570@svn.freebsd.org> From: Dimitry Andric Date: Tue, 19 Feb 2013 07:50:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r246980 - in stable: 7/contrib/opie 8/contrib/opie 9/contrib/opie X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 07:50:12 -0000 Author: dim Date: Tue Feb 19 07:50:10 2013 New Revision: 246980 URL: http://svnweb.freebsd.org/changeset/base/246980 Log: MFC r246873: In contrib/opie/opiekey.c, use the correct length to zero the secret. Found by: clang ToT Reviewed by: delphij Modified: stable/8/contrib/opie/opiekey.c Directory Properties: stable/8/contrib/opie/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/opie/opiekey.c stable/9/contrib/opie/opiekey.c Directory Properties: stable/7/contrib/opie/ (props changed) stable/9/contrib/opie/ (props changed) Modified: stable/8/contrib/opie/opiekey.c ============================================================================== --- stable/8/contrib/opie/opiekey.c Tue Feb 19 06:42:12 2013 (r246979) +++ stable/8/contrib/opie/opiekey.c Tue Feb 19 07:50:10 2013 (r246980) @@ -109,19 +109,19 @@ static void getsecret FUNCTION((secret, if (!opiereadpass(verify, OPIE_SECRET_MAX, 0)) { fprintf(stderr, "Error reading %ssecret pass phrase!\n", promptextra); memset(verify, 0, sizeof(verify)); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, OPIE_SECRET_MAX + 1); exit(1); } if (verify[0] && strcmp(verify, secret)) { fprintf(stderr, "They don't match. Try again.\n"); memset(verify, 0, sizeof(verify)); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, OPIE_SECRET_MAX + 1); exit(1); } memset(verify, 0, sizeof(verify)); } if (!(flags & 2) && !aflag && opiepasscheck(secret)) { - memset(secret, 0, sizeof(secret)); + memset(secret, 0, OPIE_SECRET_MAX + 1); fprintf(stderr, "Secret pass phrases must be between %d and %d characters long.\n", OPIE_SECRET_MIN, OPIE_SECRET_MAX); exit(1); }; From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 07:50:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5070ADBF; Tue, 19 Feb 2013 07:50:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41587218; Tue, 19 Feb 2013 07:50:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J7oBVi012565; Tue, 19 Feb 2013 07:50:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J7oBto012564; Tue, 19 Feb 2013 07:50:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302190750.r1J7oBto012564@svn.freebsd.org> From: Dimitry Andric Date: Tue, 19 Feb 2013 07:50:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246980 - in stable: 7/contrib/opie 8/contrib/opie 9/contrib/opie X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 07:50:12 -0000 Author: dim Date: Tue Feb 19 07:50:10 2013 New Revision: 246980 URL: http://svnweb.freebsd.org/changeset/base/246980 Log: MFC r246873: In contrib/opie/opiekey.c, use the correct length to zero the secret. Found by: clang ToT Reviewed by: delphij Modified: stable/9/contrib/opie/opiekey.c Directory Properties: stable/9/contrib/opie/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/opie/opiekey.c stable/8/contrib/opie/opiekey.c Directory Properties: stable/7/contrib/opie/ (props changed) stable/8/contrib/opie/ (props changed) Modified: stable/9/contrib/opie/opiekey.c ============================================================================== --- stable/9/contrib/opie/opiekey.c Tue Feb 19 06:42:12 2013 (r246979) +++ stable/9/contrib/opie/opiekey.c Tue Feb 19 07:50:10 2013 (r246980) @@ -109,19 +109,19 @@ static void getsecret FUNCTION((secret, if (!opiereadpass(verify, OPIE_SECRET_MAX, 0)) { fprintf(stderr, "Error reading %ssecret pass phrase!\n", promptextra); memset(verify, 0, sizeof(verify)); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, OPIE_SECRET_MAX + 1); exit(1); } if (verify[0] && strcmp(verify, secret)) { fprintf(stderr, "They don't match. Try again.\n"); memset(verify, 0, sizeof(verify)); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, OPIE_SECRET_MAX + 1); exit(1); } memset(verify, 0, sizeof(verify)); } if (!(flags & 2) && !aflag && opiepasscheck(secret)) { - memset(secret, 0, sizeof(secret)); + memset(secret, 0, OPIE_SECRET_MAX + 1); fprintf(stderr, "Secret pass phrases must be between %d and %d characters long.\n", OPIE_SECRET_MIN, OPIE_SECRET_MAX); exit(1); }; From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 07:50:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5AEA6DC0; Tue, 19 Feb 2013 07:50:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41CDF21A; Tue, 19 Feb 2013 07:50:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J7oCJo012579; Tue, 19 Feb 2013 07:50:12 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J7oCHL012578; Tue, 19 Feb 2013 07:50:12 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302190750.r1J7oCHL012578@svn.freebsd.org> From: Dimitry Andric Date: Tue, 19 Feb 2013 07:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r246980 - in stable: 7/contrib/opie 8/contrib/opie 9/contrib/opie X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 07:50:12 -0000 Author: dim Date: Tue Feb 19 07:50:10 2013 New Revision: 246980 URL: http://svnweb.freebsd.org/changeset/base/246980 Log: MFC r246873: In contrib/opie/opiekey.c, use the correct length to zero the secret. Found by: clang ToT Reviewed by: delphij Modified: stable/7/contrib/opie/opiekey.c Directory Properties: stable/7/contrib/opie/ (props changed) Changes in other areas also in this revision: Modified: stable/8/contrib/opie/opiekey.c stable/9/contrib/opie/opiekey.c Directory Properties: stable/8/contrib/opie/ (props changed) stable/9/contrib/opie/ (props changed) Modified: stable/7/contrib/opie/opiekey.c ============================================================================== --- stable/7/contrib/opie/opiekey.c Tue Feb 19 06:42:12 2013 (r246979) +++ stable/7/contrib/opie/opiekey.c Tue Feb 19 07:50:10 2013 (r246980) @@ -109,19 +109,19 @@ static void getsecret FUNCTION((secret, if (!opiereadpass(verify, OPIE_SECRET_MAX, 0)) { fprintf(stderr, "Error reading %ssecret pass phrase!\n", promptextra); memset(verify, 0, sizeof(verify)); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, OPIE_SECRET_MAX + 1); exit(1); } if (verify[0] && strcmp(verify, secret)) { fprintf(stderr, "They don't match. Try again.\n"); memset(verify, 0, sizeof(verify)); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, OPIE_SECRET_MAX + 1); exit(1); } memset(verify, 0, sizeof(verify)); } if (!(flags & 2) && !aflag && opiepasscheck(secret)) { - memset(secret, 0, sizeof(secret)); + memset(secret, 0, OPIE_SECRET_MAX + 1); fprintf(stderr, "Secret pass phrases must be between %d and %d characters long.\n", OPIE_SECRET_MIN, OPIE_SECRET_MAX); exit(1); }; From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 07:55:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 15BA02CF; Tue, 19 Feb 2013 07:55:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 06BB9251; Tue, 19 Feb 2013 07:55:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J7tr9d014944; Tue, 19 Feb 2013 07:55:53 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J7tr8W014941; Tue, 19 Feb 2013 07:55:53 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302190755.r1J7tr8W014941@svn.freebsd.org> From: Dimitry Andric Date: Tue, 19 Feb 2013 07:55:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246981 - in stable: 7/contrib/nvi/ex 7/contrib/nvi/vi 8/contrib/nvi/ex 8/contrib/nvi/vi 9/contrib/nvi/ex 9/contrib/nvi/vi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 07:55:54 -0000 Author: dim Date: Tue Feb 19 07:55:53 2013 New Revision: 246981 URL: http://svnweb.freebsd.org/changeset/base/246981 Log: MFC r246874: Fix two instances of undefined behaviour in contrib/nvi. Found by: clang ToT Obtained from: NetBSD Reviewed by: jh Modified: stable/9/contrib/nvi/ex/ex_txt.c stable/9/contrib/nvi/vi/v_txt.c Directory Properties: stable/9/contrib/nvi/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/nvi/ex/ex_txt.c stable/7/contrib/nvi/vi/v_txt.c stable/8/contrib/nvi/ex/ex_txt.c stable/8/contrib/nvi/vi/v_txt.c Directory Properties: stable/7/contrib/nvi/ (props changed) stable/8/contrib/nvi/ (props changed) Modified: stable/9/contrib/nvi/ex/ex_txt.c ============================================================================== --- stable/9/contrib/nvi/ex/ex_txt.c Tue Feb 19 07:50:10 2013 (r246980) +++ stable/9/contrib/nvi/ex/ex_txt.c Tue Feb 19 07:55:53 2013 (r246981) @@ -398,8 +398,8 @@ txt_dent(sp, tp) ++scno; /* Get the previous shiftwidth column. */ - cno = scno; - scno -= --scno % sw; + cno = scno--; + scno -= scno % sw; /* * Since we don't know what comes before the character(s) being Modified: stable/9/contrib/nvi/vi/v_txt.c ============================================================================== --- stable/9/contrib/nvi/vi/v_txt.c Tue Feb 19 07:50:10 2013 (r246980) +++ stable/9/contrib/nvi/vi/v_txt.c Tue Feb 19 07:55:53 2013 (r246981) @@ -1956,8 +1956,10 @@ txt_dent(sp, tp, isindent) target = current; if (isindent) target += COL_OFF(target, sw); - else - target -= --target % sw; + else { + --target; + target -= target % sw; + } /* * The AI characters will be turned into overwrite characters if the From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 07:55:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 917722D0; Tue, 19 Feb 2013 07:55:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 82A0C252; Tue, 19 Feb 2013 07:55:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J7tsa3014953; Tue, 19 Feb 2013 07:55:54 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J7tsVg014951; Tue, 19 Feb 2013 07:55:54 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302190755.r1J7tsVg014951@svn.freebsd.org> From: Dimitry Andric Date: Tue, 19 Feb 2013 07:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r246981 - in stable: 7/contrib/nvi/ex 7/contrib/nvi/vi 8/contrib/nvi/ex 8/contrib/nvi/vi 9/contrib/nvi/ex 9/contrib/nvi/vi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 07:55:54 -0000 Author: dim Date: Tue Feb 19 07:55:53 2013 New Revision: 246981 URL: http://svnweb.freebsd.org/changeset/base/246981 Log: MFC r246874: Fix two instances of undefined behaviour in contrib/nvi. Found by: clang ToT Obtained from: NetBSD Reviewed by: jh Modified: stable/8/contrib/nvi/ex/ex_txt.c stable/8/contrib/nvi/vi/v_txt.c Directory Properties: stable/8/contrib/nvi/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/nvi/ex/ex_txt.c stable/7/contrib/nvi/vi/v_txt.c stable/9/contrib/nvi/ex/ex_txt.c stable/9/contrib/nvi/vi/v_txt.c Directory Properties: stable/7/contrib/nvi/ (props changed) stable/9/contrib/nvi/ (props changed) Modified: stable/8/contrib/nvi/ex/ex_txt.c ============================================================================== --- stable/8/contrib/nvi/ex/ex_txt.c Tue Feb 19 07:50:10 2013 (r246980) +++ stable/8/contrib/nvi/ex/ex_txt.c Tue Feb 19 07:55:53 2013 (r246981) @@ -398,8 +398,8 @@ txt_dent(sp, tp) ++scno; /* Get the previous shiftwidth column. */ - cno = scno; - scno -= --scno % sw; + cno = scno--; + scno -= scno % sw; /* * Since we don't know what comes before the character(s) being Modified: stable/8/contrib/nvi/vi/v_txt.c ============================================================================== --- stable/8/contrib/nvi/vi/v_txt.c Tue Feb 19 07:50:10 2013 (r246980) +++ stable/8/contrib/nvi/vi/v_txt.c Tue Feb 19 07:55:53 2013 (r246981) @@ -1956,8 +1956,10 @@ txt_dent(sp, tp, isindent) target = current; if (isindent) target += COL_OFF(target, sw); - else - target -= --target % sw; + else { + --target; + target -= target % sw; + } /* * The AI characters will be turned into overwrite characters if the From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 07:55:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1F59A2D1; Tue, 19 Feb 2013 07:55:55 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 109EF253; Tue, 19 Feb 2013 07:55:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J7tsZv014960; Tue, 19 Feb 2013 07:55:54 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J7tsHd014958; Tue, 19 Feb 2013 07:55:54 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302190755.r1J7tsHd014958@svn.freebsd.org> From: Dimitry Andric Date: Tue, 19 Feb 2013 07:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r246981 - in stable: 7/contrib/nvi/ex 7/contrib/nvi/vi 8/contrib/nvi/ex 8/contrib/nvi/vi 9/contrib/nvi/ex 9/contrib/nvi/vi X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 07:55:55 -0000 Author: dim Date: Tue Feb 19 07:55:53 2013 New Revision: 246981 URL: http://svnweb.freebsd.org/changeset/base/246981 Log: MFC r246874: Fix two instances of undefined behaviour in contrib/nvi. Found by: clang ToT Obtained from: NetBSD Reviewed by: jh Modified: stable/7/contrib/nvi/ex/ex_txt.c stable/7/contrib/nvi/vi/v_txt.c Directory Properties: stable/7/contrib/nvi/ (props changed) Changes in other areas also in this revision: Modified: stable/8/contrib/nvi/ex/ex_txt.c stable/8/contrib/nvi/vi/v_txt.c stable/9/contrib/nvi/ex/ex_txt.c stable/9/contrib/nvi/vi/v_txt.c Directory Properties: stable/8/contrib/nvi/ (props changed) stable/9/contrib/nvi/ (props changed) Modified: stable/7/contrib/nvi/ex/ex_txt.c ============================================================================== --- stable/7/contrib/nvi/ex/ex_txt.c Tue Feb 19 07:50:10 2013 (r246980) +++ stable/7/contrib/nvi/ex/ex_txt.c Tue Feb 19 07:55:53 2013 (r246981) @@ -398,8 +398,8 @@ txt_dent(sp, tp) ++scno; /* Get the previous shiftwidth column. */ - cno = scno; - scno -= --scno % sw; + cno = scno--; + scno -= scno % sw; /* * Since we don't know what comes before the character(s) being Modified: stable/7/contrib/nvi/vi/v_txt.c ============================================================================== --- stable/7/contrib/nvi/vi/v_txt.c Tue Feb 19 07:50:10 2013 (r246980) +++ stable/7/contrib/nvi/vi/v_txt.c Tue Feb 19 07:55:53 2013 (r246981) @@ -1956,8 +1956,10 @@ txt_dent(sp, tp, isindent) target = current; if (isindent) target += COL_OFF(target, sw); - else - target -= --target % sw; + else { + --target; + target -= target % sw; + } /* * The AI characters will be turned into overwrite characters if the From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 08:07:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A113E8A1; Tue, 19 Feb 2013 08:07:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8D7B12D7; Tue, 19 Feb 2013 08:07:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J87CQO018543; Tue, 19 Feb 2013 08:07:12 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J87CFj018542; Tue, 19 Feb 2013 08:07:12 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302190807.r1J87CFj018542@svn.freebsd.org> From: Dimitry Andric Date: Tue, 19 Feb 2013 08:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246982 - in stable: 7/contrib/wpa_supplicant 8/contrib/wpa/src/crypto 9/contrib/wpa/src/crypto X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 08:07:12 -0000 Author: dim Date: Tue Feb 19 08:07:11 2013 New Revision: 246982 URL: http://svnweb.freebsd.org/changeset/base/246982 Log: MFC r246875: Import change 40eebf235370b6fe6353784ccf01ab92eed062a5 from upstream wpa: From: Jouni Malinen Date: Fri, 15 Jul 2011 13:42:06 +0300 Subject: [PATCH] MD5: Fix clearing of temporary stack memory to use correct length sizeof of the structure instead of the pointer was supposed to be used here. Fix this to clear the full structure at the end of MD5Final(). Found by: clang ToT Reviewed by: rpaulo Modified: stable/9/contrib/wpa/src/crypto/md5-internal.c Directory Properties: stable/9/contrib/wpa/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/wpa_supplicant/md5.c stable/8/contrib/wpa/src/crypto/md5.c Directory Properties: stable/7/contrib/wpa_supplicant/ (props changed) stable/8/contrib/wpa/ (props changed) Modified: stable/9/contrib/wpa/src/crypto/md5-internal.c ============================================================================== --- stable/9/contrib/wpa/src/crypto/md5-internal.c Tue Feb 19 07:55:53 2013 (r246981) +++ stable/9/contrib/wpa/src/crypto/md5-internal.c Tue Feb 19 08:07:11 2013 (r246982) @@ -188,7 +188,7 @@ void MD5Final(unsigned char digest[16], MD5Transform(ctx->buf, (u32 *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); os_memcpy(digest, ctx->buf, 16); - os_memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + os_memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* The four core functions - F1 is optimized somewhat */ From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 08:07:13 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 026BD8A2; Tue, 19 Feb 2013 08:07:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E321B2D8; Tue, 19 Feb 2013 08:07:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J87CXu018550; Tue, 19 Feb 2013 08:07:12 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J87Cd5018549; Tue, 19 Feb 2013 08:07:12 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302190807.r1J87Cd5018549@svn.freebsd.org> From: Dimitry Andric Date: Tue, 19 Feb 2013 08:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r246982 - in stable: 7/contrib/wpa_supplicant 8/contrib/wpa/src/crypto 9/contrib/wpa/src/crypto X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 08:07:13 -0000 Author: dim Date: Tue Feb 19 08:07:11 2013 New Revision: 246982 URL: http://svnweb.freebsd.org/changeset/base/246982 Log: MFC r246875: Import change 40eebf235370b6fe6353784ccf01ab92eed062a5 from upstream wpa: From: Jouni Malinen Date: Fri, 15 Jul 2011 13:42:06 +0300 Subject: [PATCH] MD5: Fix clearing of temporary stack memory to use correct length sizeof of the structure instead of the pointer was supposed to be used here. Fix this to clear the full structure at the end of MD5Final(). Found by: clang ToT Reviewed by: rpaulo Modified: stable/8/contrib/wpa/src/crypto/md5.c Directory Properties: stable/8/contrib/wpa/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/wpa_supplicant/md5.c stable/9/contrib/wpa/src/crypto/md5-internal.c Directory Properties: stable/7/contrib/wpa_supplicant/ (props changed) stable/9/contrib/wpa/ (props changed) Modified: stable/8/contrib/wpa/src/crypto/md5.c ============================================================================== --- stable/8/contrib/wpa/src/crypto/md5.c Tue Feb 19 07:55:53 2013 (r246981) +++ stable/8/contrib/wpa/src/crypto/md5.c Tue Feb 19 08:07:11 2013 (r246982) @@ -287,7 +287,7 @@ void MD5Final(unsigned char digest[16], MD5Transform(ctx->buf, (u32 *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); os_memcpy(digest, ctx->buf, 16); - os_memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + os_memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* The four core functions - F1 is optimized somewhat */ From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 08:07:13 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 584D18A3; Tue, 19 Feb 2013 08:07:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4508A2D9; Tue, 19 Feb 2013 08:07:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1J87DwO018556; Tue, 19 Feb 2013 08:07:13 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1J87Du5018555; Tue, 19 Feb 2013 08:07:13 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302190807.r1J87Du5018555@svn.freebsd.org> From: Dimitry Andric Date: Tue, 19 Feb 2013 08:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r246982 - in stable: 7/contrib/wpa_supplicant 8/contrib/wpa/src/crypto 9/contrib/wpa/src/crypto X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 08:07:13 -0000 Author: dim Date: Tue Feb 19 08:07:11 2013 New Revision: 246982 URL: http://svnweb.freebsd.org/changeset/base/246982 Log: MFC r246875: Import change 40eebf235370b6fe6353784ccf01ab92eed062a5 from upstream wpa: From: Jouni Malinen Date: Fri, 15 Jul 2011 13:42:06 +0300 Subject: [PATCH] MD5: Fix clearing of temporary stack memory to use correct length sizeof of the structure instead of the pointer was supposed to be used here. Fix this to clear the full structure at the end of MD5Final(). Found by: clang ToT Reviewed by: rpaulo Modified: stable/7/contrib/wpa_supplicant/md5.c Directory Properties: stable/7/contrib/wpa_supplicant/ (props changed) Changes in other areas also in this revision: Modified: stable/8/contrib/wpa/src/crypto/md5.c stable/9/contrib/wpa/src/crypto/md5-internal.c Directory Properties: stable/8/contrib/wpa/ (props changed) stable/9/contrib/wpa/ (props changed) Modified: stable/7/contrib/wpa_supplicant/md5.c ============================================================================== --- stable/7/contrib/wpa_supplicant/md5.c Tue Feb 19 07:55:53 2013 (r246981) +++ stable/7/contrib/wpa_supplicant/md5.c Tue Feb 19 08:07:11 2013 (r246982) @@ -287,7 +287,7 @@ void MD5Final(unsigned char digest[16], MD5Transform(ctx->buf, (u32 *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); os_memcpy(digest, ctx->buf, 16); - os_memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + os_memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* The four core functions - F1 is optimized somewhat */ From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 16:39:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0998C15E; Tue, 19 Feb 2013 16:39:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D71D22B5; Tue, 19 Feb 2013 16:39:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1JGdrkK076513; Tue, 19 Feb 2013 16:39:53 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1JGdrbi076512; Tue, 19 Feb 2013 16:39:53 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201302191639.r1JGdrbi076512@svn.freebsd.org> From: Mark Johnston Date: Tue, 19 Feb 2013 16:39:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246997 - stable/9/sys/netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 16:39:54 -0000 Author: markj Date: Tue Feb 19 16:39:53 2013 New Revision: 246997 URL: http://svnweb.freebsd.org/changeset/base/246997 Log: MFC r239672 (by rrs): This small change takes care of a race condition that can occur when both sides close at the same time. If that occurs, without this fix the connection enters FIN1 on both sides and they will forever send FIN|ACK at each other until the connection times out. This is because we stopped processing the FIN|ACK and thus did not advance the sequence and so never ACK'd each others FIN. This fix adjusts it so we *do* process the FIN properly and the race goes away ;-) Approved by: rrs Approved by: emaste (co-mentor) Modified: stable/9/sys/netinet/tcp_input.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp_input.c ============================================================================== --- stable/9/sys/netinet/tcp_input.c Tue Feb 19 16:35:27 2013 (r246996) +++ stable/9/sys/netinet/tcp_input.c Tue Feb 19 16:39:53 2013 (r246997) @@ -2447,6 +2447,16 @@ tcp_do_segment(struct mbuf *m, struct tc } } else tp->snd_cwnd += tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); goto drop; } else if (tp->t_dupacks == tcprexmtthresh) { @@ -2486,6 +2496,16 @@ tcp_do_segment(struct mbuf *m, struct tc } tp->snd_nxt = th->th_ack; tp->snd_cwnd = tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", @@ -2512,6 +2532,16 @@ tcp_do_segment(struct mbuf *m, struct tc (tp->snd_nxt - tp->snd_una) + (tp->t_dupacks - tp->snd_limited) * tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); sent = tp->snd_max - oldsndmax; if (sent > tp->t_maxseg) { From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 16:40:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 454E72CD; Tue, 19 Feb 2013 16:40:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1ED872BE; Tue, 19 Feb 2013 16:40:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1JGeHkx076644; Tue, 19 Feb 2013 16:40:17 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1JGeGNR076643; Tue, 19 Feb 2013 16:40:16 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201302191640.r1JGeGNR076643@svn.freebsd.org> From: Mark Johnston Date: Tue, 19 Feb 2013 16:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r246998 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 16:40:17 -0000 Author: markj Date: Tue Feb 19 16:40:16 2013 New Revision: 246998 URL: http://svnweb.freebsd.org/changeset/base/246998 Log: MFC r239672 (by rrs): This small change takes care of a race condition that can occur when both sides close at the same time. If that occurs, without this fix the connection enters FIN1 on both sides and they will forever send FIN|ACK at each other until the connection times out. This is because we stopped processing the FIN|ACK and thus did not advance the sequence and so never ACK'd each others FIN. This fix adjusts it so we *do* process the FIN properly and the race goes away ;-) Approved by: rrs Approved by: emaste (co-mentor) Modified: stable/8/sys/netinet/tcp_input.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/tcp_input.c ============================================================================== --- stable/8/sys/netinet/tcp_input.c Tue Feb 19 16:39:53 2013 (r246997) +++ stable/8/sys/netinet/tcp_input.c Tue Feb 19 16:40:16 2013 (r246998) @@ -2372,6 +2372,16 @@ tcp_do_segment(struct mbuf *m, struct tc } } else tp->snd_cwnd += tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); goto drop; } else if (tp->t_dupacks == tcprexmtthresh) { @@ -2411,6 +2421,16 @@ tcp_do_segment(struct mbuf *m, struct tc } tp->snd_nxt = th->th_ack; tp->snd_cwnd = tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", @@ -2437,6 +2457,16 @@ tcp_do_segment(struct mbuf *m, struct tc (tp->snd_nxt - tp->snd_una) + (tp->t_dupacks - tp->snd_limited) * tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); sent = tp->snd_max - oldsndmax; if (sent > tp->t_maxseg) { From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 16:40:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3EB2543C; Tue, 19 Feb 2013 16:40:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 187DC2CA; Tue, 19 Feb 2013 16:40:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1JGec4D078261; Tue, 19 Feb 2013 16:40:38 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1JGecKY078260; Tue, 19 Feb 2013 16:40:38 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201302191640.r1JGecKY078260@svn.freebsd.org> From: Mark Johnston Date: Tue, 19 Feb 2013 16:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r246999 - stable/7/sys/netinet X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 16:40:39 -0000 Author: markj Date: Tue Feb 19 16:40:38 2013 New Revision: 246999 URL: http://svnweb.freebsd.org/changeset/base/246999 Log: MFC r239672 (by rrs): This small change takes care of a race condition that can occur when both sides close at the same time. If that occurs, without this fix the connection enters FIN1 on both sides and they will forever send FIN|ACK at each other until the connection times out. This is because we stopped processing the FIN|ACK and thus did not advance the sequence and so never ACK'd each others FIN. This fix adjusts it so we *do* process the FIN properly and the race goes away ;-) Approved by: rrs Approved by: emaste (co-mentor) Modified: stable/7/sys/netinet/tcp_input.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/netinet/tcp_input.c ============================================================================== --- stable/7/sys/netinet/tcp_input.c Tue Feb 19 16:40:16 2013 (r246998) +++ stable/7/sys/netinet/tcp_input.c Tue Feb 19 16:40:38 2013 (r246999) @@ -1803,6 +1803,16 @@ tcp_do_segment(struct mbuf *m, struct tc } } else tp->snd_cwnd += tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); goto drop; } else if (tp->t_dupacks == tcprexmtthresh) { @@ -1846,6 +1856,16 @@ tcp_do_segment(struct mbuf *m, struct tc } tp->snd_nxt = th->th_ack; tp->snd_cwnd = tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", @@ -1871,6 +1891,16 @@ tcp_do_segment(struct mbuf *m, struct tc (tp->snd_nxt - tp->snd_una) + (tp->t_dupacks - tp->snd_limited) * tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); sent = tp->snd_max - oldsndmax; if (sent > tp->t_maxseg) { From owner-svn-src-stable@FreeBSD.ORG Tue Feb 19 17:57:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 69266B57; Tue, 19 Feb 2013 17:57:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41F4D9E1; Tue, 19 Feb 2013 17:57:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1JHvHFE029374; Tue, 19 Feb 2013 17:57:17 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1JHvHTV029369; Tue, 19 Feb 2013 17:57:17 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201302191757.r1JHvHTV029369@svn.freebsd.org> From: Ed Schouten Date: Tue, 19 Feb 2013 17:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247004 - stable/9/sbin/init X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 17:57:18 -0000 Author: ed Date: Tue Feb 19 17:57:17 2013 New Revision: 247004 URL: http://svnweb.freebsd.org/changeset/base/247004 Log: MFC r232977 and r233945: Make init(8) slightly more robust when /dev/console is missing. If the environment doesn't offer a working /dev/console, the existing version of init(8) will simply refuse running rc(8) scripts. This means you'll only have a system running init(8) and nothing else. Change the code to do the following: - Open /dev/console like we used to do, but make it more robust to use O_NONBLOCK to prevent blocking on a carrier. - If this fails, use /dev/null as stdin and /var/log/init.log as stdout and stderr. - If even this fails, use /dev/null as stdin, stdout and stderr. So why us this useful? Well, if you remove the `getpid() == 1' check in main(), you can now use init(8) inside jails to properly execute rc(8). It still requires some polishing, as existing tools assume init(8) has PID 1. Also it is now possible to use use init(8) on `headless' devices that don't even have a serial boot console. Modified: stable/9/sbin/init/init.8 stable/9/sbin/init/init.c stable/9/sbin/init/pathnames.h Directory Properties: stable/9/sbin/init/ (props changed) Modified: stable/9/sbin/init/init.8 ============================================================================== --- stable/9/sbin/init/init.8 Tue Feb 19 17:53:32 2013 (r247003) +++ stable/9/sbin/init/init.8 Tue Feb 19 17:57:17 2013 (r247004) @@ -31,7 +31,7 @@ .\" @(#)init.8 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd January 23, 2011 +.Dd March 14, 2012 .Dt INIT 8 .Os .Sh NAME @@ -300,22 +300,22 @@ as follows: file .El .Sh FILES -.Bl -tag -width /etc/rc.shutdown -compact +.Bl -tag -width /var/log/init.log -compact .It Pa /dev/console system console device .It Pa /dev/tty* terminal ports found in .Xr ttys 5 -.It Pa /var/run/utx.active -record of current users on the system -.It Pa /var/log/utx.log -record of all logins and logouts .It Pa /etc/ttys the terminal initialization information file .It Pa /etc/rc system startup commands .It Pa /etc/rc.shutdown system shutdown commands +.It Pa /var/log/init.log +log of +.Xr rc 8 +output if the system console device is not available .El .Sh DIAGNOSTICS .Bl -diag Modified: stable/9/sbin/init/init.c ============================================================================== --- stable/9/sbin/init/init.c Tue Feb 19 17:53:32 2013 (r247003) +++ stable/9/sbin/init/init.c Tue Feb 19 17:57:17 2013 (r247004) @@ -139,7 +139,7 @@ static void transition(state_t); static state_t requested_transition; static state_t current_state = death_single; -static void setctty(const char *); +static void open_console(void); static const char *get_shell(void); static void write_stderr(const char *message); @@ -585,19 +585,39 @@ clear_session_logs(session_t *sp __unuse * Only called by children of init after forking. */ static void -setctty(const char *name) +open_console(void) { int fd; - revoke(name); - if ((fd = open(name, O_RDWR)) == -1) { - stall("can't open %s: %m", name); - _exit(1); + /* + * Try to open /dev/console. Open the device with O_NONBLOCK to + * prevent potential blocking on a carrier. + */ + revoke(_PATH_CONSOLE); + if ((fd = open(_PATH_CONSOLE, O_RDWR | O_NONBLOCK)) != -1) { + (void)fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK); + if (login_tty(fd) == 0) + return; + close(fd); } - if (login_tty(fd) == -1) { - stall("can't get %s for controlling terminal: %m", name); + + /* No luck. Log output to file if possible. */ + if ((fd = open(_PATH_DEVNULL, O_RDWR)) == -1) { + stall("cannot open null device."); _exit(1); } + if (fd != STDIN_FILENO) { + dup2(fd, STDIN_FILENO); + close(fd); + } + fd = open(_PATH_INITLOG, O_WRONLY | O_APPEND | O_CREAT, 0644); + if (fd == -1) + dup2(STDIN_FILENO, STDOUT_FILENO); + else if (fd != STDOUT_FILENO) { + dup2(fd, STDOUT_FILENO); + close(fd); + } + dup2(STDOUT_FILENO, STDERR_FILENO); } static const char * @@ -655,7 +675,7 @@ single_user(void) /* * Start the single user session. */ - setctty(_PATH_CONSOLE); + open_console(); #ifdef SECURE /* @@ -819,7 +839,7 @@ run_script(const char *script) sigaction(SIGTSTP, &sa, (struct sigaction *)0); sigaction(SIGHUP, &sa, (struct sigaction *)0); - setctty(_PATH_CONSOLE); + open_console(); char _sh[] = "sh"; char _autoboot[] = "autoboot"; @@ -1602,7 +1622,7 @@ runshutdown(void) sigaction(SIGTSTP, &sa, (struct sigaction *)0); sigaction(SIGHUP, &sa, (struct sigaction *)0); - setctty(_PATH_CONSOLE); + open_console(); char _sh[] = "sh"; char _reboot[] = "reboot"; Modified: stable/9/sbin/init/pathnames.h ============================================================================== --- stable/9/sbin/init/pathnames.h Tue Feb 19 17:53:32 2013 (r247003) +++ stable/9/sbin/init/pathnames.h Tue Feb 19 17:57:17 2013 (r247004) @@ -35,6 +35,7 @@ #include +#define _PATH_INITLOG "/var/log/init.log" #define _PATH_SLOGGER "/sbin/session_logger" #define _PATH_RUNCOM "/etc/rc" #define _PATH_RUNDOWN "/etc/rc.shutdown" From owner-svn-src-stable@FreeBSD.ORG Wed Feb 20 03:59:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C0F7B891; Wed, 20 Feb 2013 03:59:46 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B3B42E08; Wed, 20 Feb 2013 03:59:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1K3xkft013606; Wed, 20 Feb 2013 03:59:46 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1K3xkCF013605; Wed, 20 Feb 2013 03:59:46 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201302200359.r1K3xkCF013605@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 20 Feb 2013 03:59:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247018 - stable/9/sys/ia64/ia64 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 03:59:46 -0000 Author: marcel Date: Wed Feb 20 03:59:45 2013 New Revision: 247018 URL: http://svnweb.freebsd.org/changeset/base/247018 Log: MFC r246890: Close a race relating to setting the PCPU pointer (r13). Modified: stable/9/sys/ia64/ia64/syscall.S Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ia64/ia64/syscall.S ============================================================================== --- stable/9/sys/ia64/ia64/syscall.S Wed Feb 20 02:40:03 2013 (r247017) +++ stable/9/sys/ia64/ia64/syscall.S Wed Feb 20 03:59:45 2013 (r247018) @@ -228,7 +228,7 @@ ENTRY_NOPROFILE(epc_syscall, 8) { .mmi mov r16=ar.rsc mov ar.rsc=0 - mov r17=r13 + nop 0 ;; } { .mmi @@ -239,13 +239,13 @@ ENTRY_NOPROFILE(epc_syscall, 8) ;; } { .mmi - mov r13=ar.k4 + mov r21=ar.unat add r30=-SIZEOF_TRAPFRAME,r14 mov r20=sp ;; } { .mii - mov r21=ar.unat + mov r17=r13 dep r30=0,r30,0,10 ;; add sp=-16,r30 @@ -258,10 +258,10 @@ ENTRY_NOPROFILE(epc_syscall, 8) add r31=8,r30 ;; } -{ .mii +{ .mmi + mov r13=ar.k4 mov r22=ar.fpsr sub r29=r14,r30 - nop 0 } { .mmi mov r23=ar.bsp From owner-svn-src-stable@FreeBSD.ORG Wed Feb 20 04:14:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9B8F2CF2; Wed, 20 Feb 2013 04:14:32 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 746AAEA4; Wed, 20 Feb 2013 04:14:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1K4EWRN019381; Wed, 20 Feb 2013 04:14:32 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1K4EWax019379; Wed, 20 Feb 2013 04:14:32 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201302200414.r1K4EWax019379@svn.freebsd.org> From: Jamie Gritton Date: Wed, 20 Feb 2013 04:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247019 - stable/9/usr.sbin/jail X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 04:14:32 -0000 Author: jamie Date: Wed Feb 20 04:14:31 2013 New Revision: 247019 URL: http://svnweb.freebsd.org/changeset/base/247019 Log: MFC r246804: Handle (ignore) when a process disappears before it can be tracked. Modified: stable/9/usr.sbin/jail/command.c Directory Properties: stable/9/usr.sbin/jail/ (props changed) Modified: stable/9/usr.sbin/jail/command.c ============================================================================== --- stable/9/usr.sbin/jail/command.c Wed Feb 20 03:59:45 2013 (r247018) +++ stable/9/usr.sbin/jail/command.c Wed Feb 20 04:14:31 2013 (r247019) @@ -66,7 +66,7 @@ int paralimit = -1; extern char **environ; static int run_command(struct cfjail *j); -static void add_proc(struct cfjail *j, pid_t pid); +static int add_proc(struct cfjail *j, pid_t pid); static void clear_procs(struct cfjail *j); static struct cfjail *find_proc(pid_t pid); static int term_procs(struct cfjail *j); @@ -542,13 +542,12 @@ run_command(struct cfjail *j) if (pid < 0) err(1, "fork"); if (pid > 0) { - if (bg) { + if (bg || !add_proc(j, pid)) { free(j->comline); j->comline = NULL; return 0; } else { paralimit--; - add_proc(j, pid); return 1; } } @@ -622,7 +621,7 @@ run_command(struct cfjail *j) /* * Add a process to the hash, tied to a jail. */ -static void +static int add_proc(struct cfjail *j, pid_t pid) { struct kevent ke; @@ -632,8 +631,11 @@ add_proc(struct cfjail *j, pid_t pid) if (!kq && (kq = kqueue()) < 0) err(1, "kqueue"); EV_SET(&ke, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL); - if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) + if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) { + if (errno == ESRCH) + return 0; err(1, "kevent"); + } ph = emalloc(sizeof(struct phash)); ph->j = j; ph->pid = pid; @@ -658,6 +660,7 @@ add_proc(struct cfjail *j, pid_t pid) TAILQ_INSERT_TAIL(&sleeping, j, tq); j->queue = &sleeping; } + return 1; } /* @@ -730,7 +733,7 @@ term_procs(struct cfjail *j) for (i = 0; i < pcnt; i++) if (ki[i].ki_jid == j->jid && kill(ki[i].ki_pid, SIGTERM) == 0) { - add_proc(j, ki[i].ki_pid); + (void)add_proc(j, ki[i].ki_pid); if (verbose > 0) { if (!noted) { noted = 1; From owner-svn-src-stable@FreeBSD.ORG Wed Feb 20 20:12:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E79EB795; Wed, 20 Feb 2013 20:12:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BEB0C17D; Wed, 20 Feb 2013 20:12:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1KKCITe012615; Wed, 20 Feb 2013 20:12:18 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1KKCIYa012611; Wed, 20 Feb 2013 20:12:18 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302202012.r1KKCIYa012611@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 20 Feb 2013 20:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247053 - in stable/9/sys: fs/ext2fs ufs/ufs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 20:12:19 -0000 Author: pfg Date: Wed Feb 20 20:12:17 2013 New Revision: 247053 URL: http://svnweb.freebsd.org/changeset/base/247053 Log: MFC r239359: Remove unused member of struct indir (in_exists) from UFS and EXT2 code. Discussed with: mjg Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c stable/9/sys/fs/ext2fs/inode.h stable/9/sys/ufs/ufs/inode.h stable/9/sys/ufs/ufs/ufs_bmap.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Feb 20 19:32:31 2013 (r247052) +++ stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Feb 20 20:12:17 2013 (r247053) @@ -183,7 +183,6 @@ ext2_bmaparray(vp, bn, bnp, runp, runb) if (bp) bqrelse(bp); - ap->in_exists = 1; bp = getblk(vp, metalbn, bsize, 0, 0, 0); if ((bp->b_flags & B_CACHE) == 0) { #ifdef DIAGNOSTIC @@ -310,7 +309,6 @@ ext2_getlbns(vp, bn, ap, nump) */ ap->in_lbn = metalbn; ap->in_off = off = NIADDR - i; - ap->in_exists = 0; ap++; for (++numlevels; i <= NIADDR; i++) { /* If searching for a meta-data block, quit when found. */ @@ -322,7 +320,6 @@ ext2_getlbns(vp, bn, ap, nump) ++numlevels; ap->in_lbn = metalbn; ap->in_off = off; - ap->in_exists = 0; ++ap; metalbn -= -1 + off * blockcnt; Modified: stable/9/sys/fs/ext2fs/inode.h ============================================================================== --- stable/9/sys/fs/ext2fs/inode.h Wed Feb 20 19:32:31 2013 (r247052) +++ stable/9/sys/fs/ext2fs/inode.h Wed Feb 20 20:12:17 2013 (r247053) @@ -151,7 +151,6 @@ struct inode { struct indir { int32_t in_lbn; /* Logical block number. */ int in_off; /* Offset in buffer. */ - int in_exists; /* Flag if the block exists. */ }; /* Convert between inode pointers and vnode pointers. */ Modified: stable/9/sys/ufs/ufs/inode.h ============================================================================== --- stable/9/sys/ufs/ufs/inode.h Wed Feb 20 19:32:31 2013 (r247052) +++ stable/9/sys/ufs/ufs/inode.h Wed Feb 20 20:12:17 2013 (r247053) @@ -167,7 +167,6 @@ struct inode { struct indir { ufs2_daddr_t in_lbn; /* Logical block number. */ int in_off; /* Offset in buffer. */ - int in_exists; /* Flag if the block exists. */ }; /* Convert between inode pointers and vnode pointers. */ Modified: stable/9/sys/ufs/ufs/ufs_bmap.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_bmap.c Wed Feb 20 19:32:31 2013 (r247052) +++ stable/9/sys/ufs/ufs/ufs_bmap.c Wed Feb 20 20:12:17 2013 (r247053) @@ -212,7 +212,6 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, ru if (bp) bqrelse(bp); - ap->in_exists = 1; bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0, 0); if ((bp->b_flags & B_CACHE) == 0) { #ifdef INVARIANTS @@ -357,7 +356,6 @@ ufs_getlbns(vp, bn, ap, nump) */ ap->in_lbn = metalbn; ap->in_off = off = NIADDR - i; - ap->in_exists = 0; ap++; for (++numlevels; i <= NIADDR; i++) { /* If searching for a meta-data block, quit when found. */ @@ -370,7 +368,6 @@ ufs_getlbns(vp, bn, ap, nump) ++numlevels; ap->in_lbn = metalbn; ap->in_off = off; - ap->in_exists = 0; ++ap; metalbn -= -1 + off * blockcnt; From owner-svn-src-stable@FreeBSD.ORG Wed Feb 20 20:56:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 18955208; Wed, 20 Feb 2013 20:56:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0A83A676; Wed, 20 Feb 2013 20:56:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1KKu73T026132; Wed, 20 Feb 2013 20:56:07 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1KKu7vC026129; Wed, 20 Feb 2013 20:56:07 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302202056.r1KKu7vC026129@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 20 Feb 2013 20:56:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247055 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 20:56:08 -0000 Author: pfg Date: Wed Feb 20 20:56:07 2013 New Revision: 247055 URL: http://svnweb.freebsd.org/changeset/base/247055 Log: MFC r246347, r246348, r246349, r246350, r246351, r246352: ext2fs: Miscellaneous cleanups and fixes. Use EXT2_LINK_MAX instead of LINK_MAX. Use nitems(). Correct off-by-one errors in FFTODT() and DDTOFT(). Remove useless rootino local variable. Remove unused em_e2fsb definition. Move assignment where it is not dead. Submitted by: Christoph Mallon Modified: stable/9/sys/fs/ext2fs/ext2_lookup.c stable/9/sys/fs/ext2fs/ext2_mount.h stable/9/sys/fs/ext2fs/ext2_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_lookup.c Wed Feb 20 20:42:56 2013 (r247054) +++ stable/9/sys/fs/ext2fs/ext2_lookup.c Wed Feb 20 20:56:07 2013 (r247055) @@ -88,9 +88,8 @@ static u_char ext2_ft_to_dt[] = { DT_SOCK, /* EXT2_FT_SOCK */ DT_LNK, /* EXT2_FT_SYMLINK */ }; -#define FTTODT(ft) \ - ((ft) > sizeof(ext2_ft_to_dt) / sizeof(ext2_ft_to_dt[0]) ? \ - DT_UNKNOWN : ext2_ft_to_dt[(ft)]) +#define FTTODT(ft) \ + ((ft) < nitems(ext2_ft_to_dt) ? ext2_ft_to_dt[(ft)] : DT_UNKNOWN) static u_char dt_to_ext2_ft[] = { EXT2_FT_UNKNOWN, /* DT_UNKNOWN */ @@ -109,9 +108,8 @@ static u_char dt_to_ext2_ft[] = { EXT2_FT_UNKNOWN, /* unused */ EXT2_FT_UNKNOWN, /* DT_WHT */ }; -#define DTTOFT(dt) \ - ((dt) > sizeof(dt_to_ext2_ft) / sizeof(dt_to_ext2_ft[0]) ? \ - EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)]) +#define DTTOFT(dt) \ + ((dt) < nitems(dt_to_ext2_ft) ? dt_to_ext2_ft[(dt)] : EXT2_FT_UNKNOWN) static int ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de, int entryoffsetinblock); @@ -1088,7 +1086,7 @@ ext2_checkpath(source, target, cred) struct ucred *cred; { struct vnode *vp; - int error, rootino, namlen; + int error, namlen; struct dirtemplate dirbuf; vp = ITOV(target); @@ -1096,10 +1094,10 @@ ext2_checkpath(source, target, cred) error = EEXIST; goto out; } - rootino = EXT2_ROOTINO; - error = 0; - if (target->i_number == rootino) + if (target->i_number == EXT2_ROOTINO) { + error = 0; goto out; + } for (;;) { if (vp->v_type != VDIR) { @@ -1123,7 +1121,7 @@ ext2_checkpath(source, target, cred) error = EINVAL; break; } - if (dirbuf.dotdot_ino == rootino) + if (dirbuf.dotdot_ino == EXT2_ROOTINO) break; vput(vp); if ((error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, Modified: stable/9/sys/fs/ext2fs/ext2_mount.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_mount.h Wed Feb 20 20:42:56 2013 (r247054) +++ stable/9/sys/fs/ext2fs/ext2_mount.h Wed Feb 20 20:56:07 2013 (r247055) @@ -48,7 +48,6 @@ struct ext2mount { struct vnode *um_devvp; /* block device mounted vnode */ struct m_ext2fs *um_e2fs; /* EXT2FS */ -#define em_e2fsb um_e2fs->e2fs u_long um_nindir; /* indirect ptrs per block */ u_long um_bptrtodb; /* indir ptr to disk block */ Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vnops.c Wed Feb 20 20:42:56 2013 (r247054) +++ stable/9/sys/fs/ext2fs/ext2_vnops.c Wed Feb 20 20:56:07 2013 (r247055) @@ -736,7 +736,7 @@ ext2_link(ap) goto out; } ip = VTOI(vp); - if ((nlink_t)ip->i_nlink >= LINK_MAX) { + if ((nlink_t)ip->i_nlink >= EXT2_LINK_MAX) { error = EMLINK; goto out; } @@ -847,7 +847,7 @@ abortit: goto abortit; dp = VTOI(fdvp); ip = VTOI(fvp); - if (ip->i_nlink >= LINK_MAX) { + if (ip->i_nlink >= EXT2_LINK_MAX) { VOP_UNLOCK(fvp, 0); error = EMLINK; goto abortit; @@ -945,7 +945,7 @@ abortit: * parent we don't fool with the link count. */ if (doingdirectory && newparent) { - if ((nlink_t)dp->i_nlink >= LINK_MAX) { + if ((nlink_t)dp->i_nlink >= EXT2_LINK_MAX) { error = EMLINK; goto bad; } @@ -1166,7 +1166,7 @@ ext2_mkdir(ap) panic("ext2_mkdir: no name"); #endif dp = VTOI(dvp); - if ((nlink_t)dp->i_nlink >= LINK_MAX) { + if ((nlink_t)dp->i_nlink >= EXT2_LINK_MAX) { error = EMLINK; goto out; } @@ -1530,7 +1530,7 @@ ext2_pathconf(ap) switch (ap->a_name) { case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; + *ap->a_retval = EXT2_LINK_MAX; return (0); case _PC_NAME_MAX: *ap->a_retval = NAME_MAX; From owner-svn-src-stable@FreeBSD.ORG Wed Feb 20 21:49:53 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 88DD0AA8; Wed, 20 Feb 2013 21:49:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 61C3794E; Wed, 20 Feb 2013 21:49:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1KLnq6B042222; Wed, 20 Feb 2013 21:49:52 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1KLnqUO042221; Wed, 20 Feb 2013 21:49:52 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302202149.r1KLnqUO042221@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 20 Feb 2013 21:49:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247057 - stable/9/bin/sh X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 21:49:53 -0000 Author: jilles Date: Wed Feb 20 21:49:52 2013 New Revision: 247057 URL: http://svnweb.freebsd.org/changeset/base/247057 Log: MFC r246507: sh: Fix a comment. Modified: stable/9/bin/sh/parser.h Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/parser.h ============================================================================== --- stable/9/bin/sh/parser.h Wed Feb 20 21:16:50 2013 (r247056) +++ stable/9/bin/sh/parser.h Wed Feb 20 21:49:52 2013 (r247057) @@ -39,7 +39,7 @@ #define CTLENDVAR '\371' #define CTLBACKQ '\372' #define CTLQUOTE 01 /* ored with CTLBACKQ code if in quotes */ -/* CTLBACKQ | CTLQUOTE == '\205' */ +/* CTLBACKQ | CTLQUOTE == '\373' */ #define CTLARI '\374' #define CTLENDARI '\375' #define CTLQUOTEMARK '\376' From owner-svn-src-stable@FreeBSD.ORG Wed Feb 20 21:57:01 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D384EEB8; Wed, 20 Feb 2013 21:57:01 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BAA049B4; Wed, 20 Feb 2013 21:57:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1KLv1mI044804; Wed, 20 Feb 2013 21:57:01 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1KLv1pL044803; Wed, 20 Feb 2013 21:57:01 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302202157.r1KLv1pL044803@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 20 Feb 2013 21:57:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247058 - stable/9/bin/sh X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 21:57:01 -0000 Author: jilles Date: Wed Feb 20 21:57:01 2013 New Revision: 247058 URL: http://svnweb.freebsd.org/changeset/base/247058 Log: MFC r246371: sh: Do not test for digit_contig in mksyntax. ISO/IEC 9899:1999 (E) 5.2.1p3 guarantees that the values of the characters 0123456789 are contiguous. The generated syntax.c and syntax.h remain the same. Submitted by: Christoph Mallon Modified: stable/9/bin/sh/mksyntax.c Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/mksyntax.c ============================================================================== --- stable/9/bin/sh/mksyntax.c Wed Feb 20 21:49:52 2013 (r247057) +++ stable/9/bin/sh/mksyntax.c Wed Feb 20 21:57:01 2013 (r247058) @@ -107,14 +107,12 @@ static const char *syntax[513]; static int base; static int size; /* number of values which a char variable can have */ static int nbits; /* number of bits in a character */ -static int digit_contig;/* true if digits are contiguous */ static void filltable(const char *); static void init(void); static void add(const char *, const char *); static void print(const char *); static void output_type_macros(void); -static void digit_convert(void); int main(int argc __unused, char **argv __unused) @@ -125,7 +123,6 @@ main(int argc __unused, char **argv __un int i; char buf[80]; int pos; - static char digit[] = "0123456789"; /* Create output files */ if ((cfile = fopen("syntax.c", "w")) == NULL) { @@ -158,11 +155,6 @@ main(int argc __unused, char **argv __un base = 1; if (sign) base += 1 << (nbits - 1); - digit_contig = 1; - for (i = 0 ; i < 10 ; i++) { - if (digit[i] != '0' + i) - digit_contig = 0; - } fputs("#include \n", hfile); fputs("#include \n", hfile); @@ -249,8 +241,6 @@ main(int argc __unused, char **argv __un add("_", "ISUNDER"); add("#?$!-*@", "ISSPECL"); print("is_type"); - if (! digit_contig) - digit_convert(); exit(0); } @@ -342,12 +332,13 @@ print(const char *name) */ static const char *macro[] = { - "#define is_digit(c)\t((is_type+SYNBASE)[(int)c] & ISDIGIT)", + "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)", "#define is_eof(c)\t((c) == PEOF)", "#define is_alpha(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER))", "#define is_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER))", "#define is_in_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))", "#define is_special(c)\t((is_type+SYNBASE)[(int)c] & (ISSPECL|ISDIGIT))", + "#define digit_val(c)\t((c) - '0')", NULL }; @@ -356,41 +347,6 @@ output_type_macros(void) { const char **pp; - if (digit_contig) - macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)"; for (pp = macro ; *pp ; pp++) fprintf(hfile, "%s\n", *pp); - if (digit_contig) - fputs("#define digit_val(c)\t((c) - '0')\n", hfile); - else - fputs("#define digit_val(c)\t(digit_value[c])\n", hfile); -} - - - -/* - * Output digit conversion table (if digits are not contiguous). - */ - -static void -digit_convert(void) -{ - int maxdigit; - static char digit[] = "0123456789"; - char *p; - int i; - - maxdigit = 0; - for (p = digit ; *p ; p++) - if (*p > maxdigit) - maxdigit = *p; - fputs("extern const char digit_value[];\n", hfile); - fputs("\n\nconst char digit_value[] = {\n", cfile); - for (i = 0 ; i <= maxdigit ; i++) { - for (p = digit ; *p && *p != i ; p++); - if (*p == '\0') - p = digit; - fprintf(cfile, " %d,\n", (int)(p - digit)); - } - fputs("};\n", cfile); } From owner-svn-src-stable@FreeBSD.ORG Wed Feb 20 23:26:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0780A244; Wed, 20 Feb 2013 23:26:16 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BB09820F; Wed, 20 Feb 2013 23:26:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1KNQF0t073128; Wed, 20 Feb 2013 23:26:15 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1KNQFoO073126; Wed, 20 Feb 2013 23:26:15 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302202326.r1KNQFoO073126@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 20 Feb 2013 23:26:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247063 - in stable/8: bin/sh tools/regression/bin/sh/builtins X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 23:26:16 -0000 Author: jilles Date: Wed Feb 20 23:26:14 2013 New Revision: 247063 URL: http://svnweb.freebsd.org/changeset/base/247063 Log: MFC r222292,r230095: Show errno messages in cd. Added: stable/8/tools/regression/bin/sh/builtins/cd8.0 - copied unchanged from r230095, head/tools/regression/bin/sh/builtins/cd8.0 Modified: stable/8/bin/sh/cd.c Directory Properties: stable/8/bin/sh/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) Modified: stable/8/bin/sh/cd.c ============================================================================== --- stable/8/bin/sh/cd.c Wed Feb 20 23:15:40 2013 (r247062) +++ stable/8/bin/sh/cd.c Wed Feb 20 23:26:14 2013 (r247063) @@ -84,6 +84,7 @@ cdcmd(int argc, char **argv) char *p; struct stat statb; int ch, phys, print = 0; + int errno1 = ENOENT; optreset = 1; optind = 1; opterr = 0; /* initialize getopt */ phys = Pflag; @@ -120,7 +121,12 @@ cdcmd(int argc, char **argv) if (*dest == '/' || (path = bltinlookup("CDPATH", 1)) == NULL) path = nullstr; while ((p = padvance(&path, dest)) != NULL) { - if (stat(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) { + if (stat(p, &statb) < 0) { + if (errno != ENOENT) + errno1 = errno; + } else if (!S_ISDIR(statb.st_mode)) + errno1 = ENOTDIR; + else { if (!print) { /* * XXX - rethink @@ -132,9 +138,11 @@ cdcmd(int argc, char **argv) } if (docd(p, print, phys) >= 0) return 0; + if (errno != ENOENT) + errno1 = errno; } } - error("can't cd to %s", dest); + error("%s: %s", dest, strerror(errno1)); /*NOTREACHED*/ return 0; } Copied: stable/8/tools/regression/bin/sh/builtins/cd8.0 (from r230095, head/tools/regression/bin/sh/builtins/cd8.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/cd8.0 Wed Feb 20 23:26:14 2013 (r247063, copy of r230095, head/tools/regression/bin/sh/builtins/cd8.0) @@ -0,0 +1,26 @@ +# $FreeBSD$ + +# The exact wording of the error message is not standardized, but giving +# a description of the errno is useful. + +LC_ALL=C +export LC_ALL +r=0 + +t() { + exec 3>&1 + errmsg=`cd "$1" 2>&1 >&3 3>&-` + exec 3>&- + case $errmsg in + *[Nn]ot\ a\ directory*) + ;; + *) + printf "Wrong error message for %s: %s\n" "$1" "$errmsg" + r=3 + ;; + esac +} + +t /dev/tty +t /dev/tty/x +exit $r From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 05:38:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 531FC9F8; Thu, 21 Feb 2013 05:38:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 45189105B; Thu, 21 Feb 2013 05:38:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L5cCwG087915; Thu, 21 Feb 2013 05:38:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L5cBrn087913; Thu, 21 Feb 2013 05:38:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302210538.r1L5cBrn087913@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Feb 2013 05:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247076 - in stable/9/sys: fs/devfs kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 05:38:12 -0000 Author: kib Date: Thu Feb 21 05:38:11 2013 New Revision: 247076 URL: http://svnweb.freebsd.org/changeset/base/247076 Log: MFC r246472: Stop translating the ERESTART error from the open(2) into EINTR. Posix requires that open(2) is restartable for SA_RESTART. Modified: stable/9/sys/fs/devfs/devfs_vnops.c stable/9/sys/kern/vfs_syscalls.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Thu Feb 21 05:08:21 2013 (r247075) +++ stable/9/sys/fs/devfs/devfs_vnops.c Thu Feb 21 05:38:11 2013 (r247076) @@ -1089,8 +1089,11 @@ devfs_open(struct vop_open_args *ap) vn_lock(vp, vlocked | LK_RETRY); dev_relthread(dev, ref); - if (error) + if (error != 0) { + if (error == ERESTART) + error = EINTR; return (error); + } #if 0 /* /dev/console */ KASSERT(fp != NULL, ("Could not vnode bypass device on NULL fp")); Modified: stable/9/sys/kern/vfs_syscalls.c ============================================================================== --- stable/9/sys/kern/vfs_syscalls.c Thu Feb 21 05:08:21 2013 (r247075) +++ stable/9/sys/kern/vfs_syscalls.c Thu Feb 21 05:38:11 2013 (r247076) @@ -1167,8 +1167,6 @@ kern_openat(struct thread *td, int fd, c fdclose(fdp, fp, indx, td); fdrop(fp, td); - if (error == ERESTART) - error = EINTR; return (error); } td->td_dupfd = 0; From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 05:47:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 64C4AC76; Thu, 21 Feb 2013 05:47:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4798F10AD; Thu, 21 Feb 2013 05:47:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L5ls93090796; Thu, 21 Feb 2013 05:47:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L5lrOU090788; Thu, 21 Feb 2013 05:47:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302210547.r1L5lrOU090788@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Feb 2013 05:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247077 - in stable/9/sys: kern sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 05:47:54 -0000 Author: kib Date: Thu Feb 21 05:47:52 2013 New Revision: 247077 URL: http://svnweb.freebsd.org/changeset/base/247077 Log: MFC r246484: Allow ptrace(2) operation on the child created by vfork(2), if the debugger is not the parent. Modified: stable/9/sys/kern/kern_exec.c stable/9/sys/kern/kern_exit.c stable/9/sys/kern/kern_sig.c stable/9/sys/kern/sys_process.c stable/9/sys/sys/proc.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_exec.c ============================================================================== --- stable/9/sys/kern/kern_exec.c Thu Feb 21 05:38:11 2013 (r247076) +++ stable/9/sys/kern/kern_exec.c Thu Feb 21 05:47:52 2013 (r247077) @@ -646,7 +646,7 @@ interpret: */ p->p_flag |= P_EXEC; if (p->p_pptr && (p->p_flag & P_PPWAIT)) { - p->p_flag &= ~P_PPWAIT; + p->p_flag &= ~(P_PPWAIT | P_PPTRACE); cv_broadcast(&p->p_pwait); } Modified: stable/9/sys/kern/kern_exit.c ============================================================================== --- stable/9/sys/kern/kern_exit.c Thu Feb 21 05:38:11 2013 (r247076) +++ stable/9/sys/kern/kern_exit.c Thu Feb 21 05:47:52 2013 (r247077) @@ -259,7 +259,7 @@ exit1(struct thread *td, int rv) PROC_LOCK(p); rv = p->p_xstat; /* Event handler could change exit status */ stopprofclock(p); - p->p_flag &= ~(P_TRACED | P_PPWAIT); + p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); /* * Stop the real interval timer. If the handler is currently Modified: stable/9/sys/kern/kern_sig.c ============================================================================== --- stable/9/sys/kern/kern_sig.c Thu Feb 21 05:38:11 2013 (r247076) +++ stable/9/sys/kern/kern_sig.c Thu Feb 21 05:47:52 2013 (r247077) @@ -2565,7 +2565,7 @@ issignal(struct thread *td, int stop_all sigqueue_delete(&p->p_sigqueue, sig); continue; } - if (p->p_flag & P_TRACED && (p->p_flag & P_PPWAIT) == 0) { + if (p->p_flag & P_TRACED && (p->p_flag & P_PPTRACE) == 0) { /* * If traced, always stop. * Remove old signal from queue before the stop. Modified: stable/9/sys/kern/sys_process.c ============================================================================== --- stable/9/sys/kern/sys_process.c Thu Feb 21 05:38:11 2013 (r247076) +++ stable/9/sys/kern/sys_process.c Thu Feb 21 05:47:52 2013 (r247077) @@ -824,6 +824,8 @@ kern_ptrace(struct thread *td, int req, case PT_TRACE_ME: /* set my trace flag and "owner" so it can read/write me */ p->p_flag |= P_TRACED; + if (p->p_flag & P_PPWAIT) + p->p_flag |= P_PPTRACE; p->p_oppid = p->p_pptr->p_pid; break; Modified: stable/9/sys/sys/proc.h ============================================================================== --- stable/9/sys/sys/proc.h Thu Feb 21 05:38:11 2013 (r247076) +++ stable/9/sys/sys/proc.h Thu Feb 21 05:47:52 2013 (r247077) @@ -636,6 +636,7 @@ struct proc { #define P_INMEM 0x10000000 /* Loaded into memory. */ #define P_SWAPPINGOUT 0x20000000 /* Process is being swapped out. */ #define P_SWAPPINGIN 0x40000000 /* Process is being swapped in. */ +#define P_PPTRACE 0x80000000 /* PT_TRACEME by vforked child. */ #define P_STOPPED (P_STOPPED_SIG|P_STOPPED_SINGLE|P_STOPPED_TRACE) #define P_SHOULDSTOP(p) ((p)->p_flag & P_STOPPED) From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 05:53:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 24BB7E13; Thu, 21 Feb 2013 05:53:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1599C10CC; Thu, 21 Feb 2013 05:53:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L5rgA2093140; Thu, 21 Feb 2013 05:53:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L5rg9d093139; Thu, 21 Feb 2013 05:53:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302210553.r1L5rg9d093139@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Feb 2013 05:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247078 - stable/9/sys/amd64/amd64 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 05:53:43 -0000 Author: kib Date: Thu Feb 21 05:53:42 2013 New Revision: 247078 URL: http://svnweb.freebsd.org/changeset/base/247078 Log: MFC r246801: Assert that user address is never qremoved. Modified: stable/9/sys/amd64/amd64/pmap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/pmap.c ============================================================================== --- stable/9/sys/amd64/amd64/pmap.c Thu Feb 21 05:47:52 2013 (r247077) +++ stable/9/sys/amd64/amd64/pmap.c Thu Feb 21 05:53:42 2013 (r247078) @@ -1440,6 +1440,7 @@ pmap_qremove(vm_offset_t sva, int count) va = sva; while (count-- > 0) { + KASSERT(va >= VM_MIN_KERNEL_ADDRESS, ("usermode va %lx", va)); pmap_kremove(va); va += PAGE_SIZE; } From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 05:55:53 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A1BEAF95; Thu, 21 Feb 2013 05:55:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 92BBE10E2; Thu, 21 Feb 2013 05:55:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L5trKe093517; Thu, 21 Feb 2013 05:55:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L5tr9x093516; Thu, 21 Feb 2013 05:55:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302210555.r1L5tr9x093516@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Feb 2013 05:55:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247079 - stable/9/sys/amd64/amd64 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 05:55:53 -0000 Author: kib Date: Thu Feb 21 05:55:52 2013 New Revision: 247079 URL: http://svnweb.freebsd.org/changeset/base/247079 Log: MFC r246802: Print slightly more useful information on the 'bad pte' panic. Modified: stable/9/sys/amd64/amd64/pmap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/pmap.c ============================================================================== --- stable/9/sys/amd64/amd64/pmap.c Thu Feb 21 05:53:42 2013 (r247078) +++ stable/9/sys/amd64/amd64/pmap.c Thu Feb 21 05:55:52 2013 (r247079) @@ -4405,8 +4405,10 @@ pmap_remove_pages(pmap_t pmap) pte = &pte[pmap_pte_index(pv->pv_va)]; tpte = *pte & ~PG_PTE_PAT; } - if ((tpte & PG_V) == 0) - panic("bad pte"); + if ((tpte & PG_V) == 0) { + panic("bad pte va %lx pte %lx", + pv->pv_va, tpte); + } /* * We cannot remove wired pages from a process' mapping at this time From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 05:57:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BD6C41E3; Thu, 21 Feb 2013 05:57:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AF14D10FD; Thu, 21 Feb 2013 05:57:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L5vqQG093813; Thu, 21 Feb 2013 05:57:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L5vqqg093812; Thu, 21 Feb 2013 05:57:52 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302210557.r1L5vqqg093812@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Feb 2013 05:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247080 - stable/9/lib/libc/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 05:57:52 -0000 Author: kib Date: Thu Feb 21 05:57:51 2013 New Revision: 247080 URL: http://svnweb.freebsd.org/changeset/base/247080 Log: MFC r246476: Document the ERESTART translation to EINTR for devfs nodes. Modified: stable/9/lib/libc/sys/open.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/open.2 ============================================================================== --- stable/9/lib/libc/sys/open.2 Thu Feb 21 05:55:52 2013 (r247079) +++ stable/9/lib/libc/sys/open.2 Thu Feb 21 05:57:51 2013 (r247080) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd March 25, 2011 +.Dd February 7, 2013 .Dt OPEN 2 .Os .Sh NAME @@ -244,6 +244,17 @@ It returns \-1 on failure. The file pointer used to mark the current position within the file is set to the beginning of the file. .Pp +If a sleeping open of a device node from +.Xr devfs 5 +is interrupted by a signal, the call always fails with +.Er EINTR , +even if the +.Dv SA_RESTART +flag is set for the signal. +A sleeping open of a fifo (see +.Xr mkfifo 2 ) +is restarted as normal. +.Pp When a new file is created it is given the group of the directory which contains it. .Pp From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 05:59:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6A46B356; Thu, 21 Feb 2013 05:59:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5CCB1110A; Thu, 21 Feb 2013 05:59:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L5xHxp094043; Thu, 21 Feb 2013 05:59:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L5xHIg094042; Thu, 21 Feb 2013 05:59:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302210559.r1L5xHIg094042@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Feb 2013 05:59:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247081 - stable/9/lib/libc/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 05:59:17 -0000 Author: kib Date: Thu Feb 21 05:59:16 2013 New Revision: 247081 URL: http://svnweb.freebsd.org/changeset/base/247081 Log: MFC r246485: Document the detail of interaction between vfork and PT_TRACEME. Modified: stable/9/lib/libc/sys/ptrace.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/ptrace.2 ============================================================================== --- stable/9/lib/libc/sys/ptrace.2 Thu Feb 21 05:57:51 2013 (r247080) +++ stable/9/lib/libc/sys/ptrace.2 Thu Feb 21 05:59:16 2013 (r247081) @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd February 19, 2012 +.Dd February 7, 2013 .Dt PTRACE 2 .Os .Sh NAME @@ -100,6 +100,16 @@ or any of the routines built on it it will stop before executing the first instruction of the new image. Also, any setuid or setgid bits on the executable being executed will be ignored. +If the child was created by +.Xr vfork 2 +system call or +.Xr rfork(2) +call with the +.Dv RFMEM +flag specified, the debugging events are reported to the parent +only after the +.Xr execve 2 +is executed. .It Dv PT_READ_I , Dv PT_READ_D These requests read a single .Vt int From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 06:00:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1BBD04CD; Thu, 21 Feb 2013 06:00:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0DB6D1118; Thu, 21 Feb 2013 06:00:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L60XGT095477; Thu, 21 Feb 2013 06:00:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L60Xr7095468; Thu, 21 Feb 2013 06:00:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302210600.r1L60Xr7095468@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Feb 2013 06:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247082 - stable/9/bin/ps X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 06:00:34 -0000 Author: kib Date: Thu Feb 21 06:00:33 2013 New Revision: 247082 URL: http://svnweb.freebsd.org/changeset/base/247082 Log: MFC r246486: Document P_PPTRACE. Modified: stable/9/bin/ps/ps.1 Directory Properties: stable/9/bin/ps/ (props changed) Modified: stable/9/bin/ps/ps.1 ============================================================================== --- stable/9/bin/ps/ps.1 Thu Feb 21 05:59:16 2013 (r247081) +++ stable/9/bin/ps/ps.1 Thu Feb 21 06:00:33 2013 (r247082) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd September 18, 2012 +.Dd February 7, 2013 .Dt PS 1 .Os .Sh NAME @@ -323,6 +323,7 @@ the include file .It Dv "P_INMEM" Ta No "0x10000000 Loaded into memory" .It Dv "P_SWAPPINGOUT" Ta No "0x20000000 Process is being swapped out" .It Dv "P_SWAPPINGIN" Ta No "0x40000000 Process is being swapped in" +.It Dv "P_PPTRACE" Ta No "0x80000000" Ta "Vforked child issued ptrace(PT_TRACEME)" .El .It Cm label The MAC label of the process. From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 06:10:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B7EB68D1; Thu, 21 Feb 2013 06:10:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A9E6E117F; Thu, 21 Feb 2013 06:10:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L6AbB4098111; Thu, 21 Feb 2013 06:10:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L6AbKs098109; Thu, 21 Feb 2013 06:10:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302210610.r1L6AbKs098109@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Feb 2013 06:10:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247083 - in stable/8/sys: fs/devfs kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 06:10:37 -0000 Author: kib Date: Thu Feb 21 06:10:36 2013 New Revision: 247083 URL: http://svnweb.freebsd.org/changeset/base/247083 Log: MFC r246472: Stop translating the ERESTART error from the open(2) into EINTR. Posix requires that open(2) is restartable for SA_RESTART. Modified: stable/8/sys/fs/devfs/devfs_vnops.c stable/8/sys/kern/vfs_syscalls.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/fs/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Thu Feb 21 06:00:33 2013 (r247082) +++ stable/8/sys/fs/devfs/devfs_vnops.c Thu Feb 21 06:10:36 2013 (r247083) @@ -1015,8 +1015,11 @@ devfs_open(struct vop_open_args *ap) vn_lock(vp, vlocked | LK_RETRY); dev_relthread(dev, ref); - if (error) + if (error != 0) { + if (error == ERESTART) + error = EINTR; return (error); + } #if 0 /* /dev/console */ KASSERT(fp != NULL, ("Could not vnode bypass device on NULL fp")); Modified: stable/8/sys/kern/vfs_syscalls.c ============================================================================== --- stable/8/sys/kern/vfs_syscalls.c Thu Feb 21 06:00:33 2013 (r247082) +++ stable/8/sys/kern/vfs_syscalls.c Thu Feb 21 06:10:36 2013 (r247083) @@ -1107,8 +1107,6 @@ kern_openat(struct thread *td, int fd, c fdclose(fdp, fp, indx, td); fdrop(fp, td); - if (error == ERESTART) - error = EINTR; return (error); } td->td_dupfd = 0; From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 06:12:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4AF66A44; Thu, 21 Feb 2013 06:12:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CB4F1118E; Thu, 21 Feb 2013 06:12:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L6CQMo099853; Thu, 21 Feb 2013 06:12:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L6CQDg099852; Thu, 21 Feb 2013 06:12:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302210612.r1L6CQDg099852@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Feb 2013 06:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247084 - stable/8/lib/libc/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 06:12:27 -0000 Author: kib Date: Thu Feb 21 06:12:26 2013 New Revision: 247084 URL: http://svnweb.freebsd.org/changeset/base/247084 Log: MFC r246476: Document the ERESTART translation to EINTR for devfs nodes. Modified: stable/8/lib/libc/sys/open.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/sys/open.2 ============================================================================== --- stable/8/lib/libc/sys/open.2 Thu Feb 21 06:10:36 2013 (r247083) +++ stable/8/lib/libc/sys/open.2 Thu Feb 21 06:12:26 2013 (r247084) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd March 25, 2011 +.Dd February 7, 2013 .Dt OPEN 2 .Os .Sh NAME @@ -235,6 +235,17 @@ It returns \-1 on failure. The file pointer used to mark the current position within the file is set to the beginning of the file. .Pp +If a sleeping open of a device node from +.Xr devfs 5 +is interrupted by a signal, the call always fails with +.Er EINTR , +even if the +.Dv SA_RESTART +flag is set for the signal. +A sleeping open of a fifo (see +.Xr mkfifo 2 ) +is restarted as normal. +.Pp When a new file is created it is given the group of the directory which contains it. .Pp From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 07:48:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A325AA61; Thu, 21 Feb 2013 07:48:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 92E4E18E4; Thu, 21 Feb 2013 07:48:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L7mAO4027782; Thu, 21 Feb 2013 07:48:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L7m75I027758; Thu, 21 Feb 2013 07:48:07 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302210748.r1L7m75I027758@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 21 Feb 2013 07:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247090 - in stable/9/sys: dev/usb dev/usb/controller dev/usb/template sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 07:48:10 -0000 Author: hselasky Date: Thu Feb 21 07:48:07 2013 New Revision: 247090 URL: http://svnweb.freebsd.org/changeset/base/247090 Log: MFC r246616 and r246759: - Move scratch data from the USB bus structure to the USB device structure so that simultaneous access cannot happen. Protect scratch area using the enumeration lock. - Reduce stack usage in usbd_transfer_setup() by moving some big stack members to the scratch area. This saves around 200 bytes of stack. - Fix a whitespace. - Protect control requests using the USB device enumeration lock. - Make sure all callers of usbd_enum_lock() check the return value. - Remove the control transfer specific lock. - Bump the FreeBSD version number, hence external USB modules may need to be recompiled due to a USB device structure change. Modified: stable/9/sys/dev/usb/controller/usb_controller.c stable/9/sys/dev/usb/template/usb_template.c stable/9/sys/dev/usb/usb_bus.h stable/9/sys/dev/usb/usb_controller.h stable/9/sys/dev/usb/usb_dev.c stable/9/sys/dev/usb/usb_dev.h stable/9/sys/dev/usb/usb_device.c stable/9/sys/dev/usb/usb_device.h stable/9/sys/dev/usb/usb_generic.c stable/9/sys/dev/usb/usb_handle_request.c stable/9/sys/dev/usb/usb_hub.c stable/9/sys/dev/usb/usb_msctest.c stable/9/sys/dev/usb/usb_request.c stable/9/sys/dev/usb/usb_transfer.c stable/9/sys/dev/usb/usb_util.c stable/9/sys/sys/param.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/controller/usb_controller.c ============================================================================== --- stable/9/sys/dev/usb/controller/usb_controller.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/controller/usb_controller.c Thu Feb 21 07:48:07 2013 (r247090) @@ -407,6 +407,7 @@ usb_bus_suspend(struct usb_proc_msg *pm) struct usb_bus *bus; struct usb_device *udev; usb_error_t err; + uint8_t do_unlock; bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; @@ -427,7 +428,7 @@ usb_bus_suspend(struct usb_proc_msg *pm) bus_generic_shutdown(bus->bdev); - usbd_enum_lock(udev); + do_unlock = usbd_enum_lock(udev); err = usbd_set_config_index(udev, USB_UNCONFIG_INDEX); if (err) @@ -444,7 +445,8 @@ usb_bus_suspend(struct usb_proc_msg *pm) if (bus->methods->set_hw_power_sleep != NULL) (bus->methods->set_hw_power_sleep) (bus, USB_HW_POWER_SUSPEND); - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_BUS_LOCK(bus); } @@ -460,6 +462,7 @@ usb_bus_resume(struct usb_proc_msg *pm) struct usb_bus *bus; struct usb_device *udev; usb_error_t err; + uint8_t do_unlock; bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; @@ -469,7 +472,7 @@ usb_bus_resume(struct usb_proc_msg *pm) USB_BUS_UNLOCK(bus); - usbd_enum_lock(udev); + do_unlock = usbd_enum_lock(udev); #if 0 DEVMETHOD(usb_take_controller, NULL); /* dummy */ #endif @@ -503,7 +506,8 @@ usb_bus_resume(struct usb_proc_msg *pm) "attach root HUB\n"); } - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_BUS_LOCK(bus); } @@ -519,6 +523,7 @@ usb_bus_shutdown(struct usb_proc_msg *pm struct usb_bus *bus; struct usb_device *udev; usb_error_t err; + uint8_t do_unlock; bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; @@ -530,7 +535,7 @@ usb_bus_shutdown(struct usb_proc_msg *pm bus_generic_shutdown(bus->bdev); - usbd_enum_lock(udev); + do_unlock = usbd_enum_lock(udev); err = usbd_set_config_index(udev, USB_UNCONFIG_INDEX); if (err) @@ -547,7 +552,8 @@ usb_bus_shutdown(struct usb_proc_msg *pm if (bus->methods->set_hw_power_sleep != NULL) (bus->methods->set_hw_power_sleep) (bus, USB_HW_POWER_SHUTDOWN); - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_BUS_LOCK(bus); } Modified: stable/9/sys/dev/usb/template/usb_template.c ============================================================================== --- stable/9/sys/dev/usb/template/usb_template.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/template/usb_template.c Thu Feb 21 07:48:07 2013 (r247090) @@ -845,20 +845,20 @@ usb_hw_ep_resolve(struct usb_device *ude struct usb_device_descriptor *dd; uint16_t mps; - if (desc == NULL) { + if (desc == NULL) return (USB_ERR_INVAL); - } + /* get bus methods */ methods = udev->bus->methods; - if (methods->get_hw_ep_profile == NULL) { + if (methods->get_hw_ep_profile == NULL) return (USB_ERR_INVAL); - } + if (desc->bDescriptorType == UDESC_DEVICE) { - if (desc->bLength < sizeof(*dd)) { + if (desc->bLength < sizeof(*dd)) return (USB_ERR_INVAL); - } + dd = (void *)desc; /* get HW control endpoint 0 profile */ @@ -905,13 +905,12 @@ usb_hw_ep_resolve(struct usb_device *ude } return (0); /* success */ } - if (desc->bDescriptorType != UDESC_CONFIG) { + if (desc->bDescriptorType != UDESC_CONFIG) return (USB_ERR_INVAL); - } - if (desc->bLength < sizeof(*(ues->cd))) { + if (desc->bLength < sizeof(*(ues->cd))) return (USB_ERR_INVAL); - } - ues = udev->bus->scratch[0].hw_ep_scratch; + + ues = udev->scratch.hw_ep_scratch; memset(ues, 0, sizeof(*ues)); @@ -1232,13 +1231,18 @@ usb_temp_setup(struct usb_device *udev, { struct usb_temp_setup *uts; void *buf; + usb_error_t error; uint8_t n; + uint8_t do_unlock; - if (tdd == NULL) { - /* be NULL safe */ + /* be NULL safe */ + if (tdd == NULL) return (0); - } - uts = udev->bus->scratch[0].temp_setup; + + /* Protect scratch area */ + do_unlock = usbd_enum_lock(udev); + + uts = udev->scratch.temp_setup; memset(uts, 0, sizeof(*uts)); @@ -1251,17 +1255,24 @@ usb_temp_setup(struct usb_device *udev, if (uts->err) { /* some error happened */ - return (uts->err); + goto done; } /* sanity check */ if (uts->size == 0) { - return (USB_ERR_INVAL); + uts->err = USB_ERR_INVAL; + goto done; } /* allocate zeroed memory */ uts->buf = malloc(uts->size, M_USB, M_WAITOK | M_ZERO); + /* + * Allow malloc() to return NULL regardless of M_WAITOK flag. + * This helps when porting the software to non-FreeBSD + * systems. + */ if (uts->buf == NULL) { /* could not allocate memory */ - return (USB_ERR_NOMEM); + uts->err = USB_ERR_NOMEM; + goto done; } /* second pass */ @@ -1276,7 +1287,7 @@ usb_temp_setup(struct usb_device *udev, if (uts->err) { /* some error happened during second pass */ - goto error; + goto done; } /* * Resolve all endpoint addresses ! @@ -1287,7 +1298,7 @@ usb_temp_setup(struct usb_device *udev, DPRINTFN(0, "Could not resolve endpoints for " "Device Descriptor, error = %s\n", usbd_errstr(uts->err)); - goto error; + goto done; } for (n = 0;; n++) { @@ -1300,14 +1311,16 @@ usb_temp_setup(struct usb_device *udev, DPRINTFN(0, "Could not resolve endpoints for " "Config Descriptor %u, error = %s\n", n, usbd_errstr(uts->err)); - goto error; + goto done; } } - return (uts->err); - -error: - usb_temp_unsetup(udev); - return (uts->err); +done: + error = uts->err; + if (error) + usb_temp_unsetup(udev); + if (do_unlock) + usbd_enum_unlock(udev); + return (error); } /*------------------------------------------------------------------------* Modified: stable/9/sys/dev/usb/usb_bus.h ============================================================================== --- stable/9/sys/dev/usb/usb_bus.h Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_bus.h Thu Feb 21 07:48:07 2013 (r247090) @@ -103,16 +103,6 @@ struct usb_bus { uint8_t devices_max; /* maximum number of USB devices */ uint8_t do_probe; /* set if USB should be re-probed */ uint8_t no_explore; /* don't explore USB ports */ - - /* - * The scratch area can only be used inside the explore thread - * belonging to the give serial bus. - */ - union { - struct usb_hw_ep_scratch hw_ep_scratch[1]; - struct usb_temp_setup temp_setup[1]; - uint8_t data[255]; - } scratch[1]; }; #endif /* _USB_BUS_H_ */ Modified: stable/9/sys/dev/usb/usb_controller.h ============================================================================== --- stable/9/sys/dev/usb/usb_controller.h Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_controller.h Thu Feb 21 07:48:07 2013 (r247090) @@ -40,7 +40,6 @@ struct usb_page_cache; struct usb_setup_params; struct usb_hw_ep_profile; struct usb_fs_isoc_schedule; -struct usb_config_descriptor; struct usb_endpoint_descriptor; /* typedefs */ @@ -181,50 +180,6 @@ struct usb_hw_ep_profile { uint8_t support_out:1; /* OUT-token is supported */ }; -/* - * The following structure is used when trying to allocate hardware - * endpoints for an USB configuration in USB device side mode. - */ -struct usb_hw_ep_scratch_sub { - const struct usb_hw_ep_profile *pf; - uint16_t max_frame_size; - uint8_t hw_endpoint_out; - uint8_t hw_endpoint_in; - uint8_t needs_ep_type; - uint8_t needs_in:1; - uint8_t needs_out:1; -}; - -/* - * The following structure is used when trying to allocate hardware - * endpoints for an USB configuration in USB device side mode. - */ -struct usb_hw_ep_scratch { - struct usb_hw_ep_scratch_sub ep[USB_EP_MAX]; - struct usb_hw_ep_scratch_sub *ep_max; - struct usb_config_descriptor *cd; - struct usb_device *udev; - struct usb_bus_methods *methods; - uint8_t bmOutAlloc[(USB_EP_MAX + 15) / 16]; - uint8_t bmInAlloc[(USB_EP_MAX + 15) / 16]; -}; - -/* - * The following structure is used when generating USB descriptors - * from USB templates. - */ -struct usb_temp_setup { - void *buf; - usb_size_t size; - enum usb_dev_speed usb_speed; - uint8_t self_powered; - uint8_t bNumEndpoints; - uint8_t bInterfaceNumber; - uint8_t bAlternateSetting; - uint8_t bConfigurationValue; - usb_error_t err; -}; - /* prototypes */ void usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb); Modified: stable/9/sys/dev/usb/usb_dev.c ============================================================================== --- stable/9/sys/dev/usb/usb_dev.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_dev.c Thu Feb 21 07:48:07 2013 (r247090) @@ -214,10 +214,10 @@ usb_ref_device(struct usb_cdev_privdata mtx_unlock(&usb_ref_lock); /* - * We need to grab the sx-lock before grabbing the - * FIFO refs to avoid deadlock at detach! + * We need to grab the enumeration SX-lock before + * grabbing the FIFO refs to avoid deadlock at detach! */ - usbd_enum_lock(cpd->udev); + crd->do_unlock = usbd_enum_lock(cpd->udev); mtx_lock(&usb_ref_lock); @@ -278,9 +278,10 @@ usb_ref_device(struct usb_cdev_privdata return (0); error: - if (crd->is_uref) { + if (crd->do_unlock) usbd_enum_unlock(cpd->udev); + if (crd->is_uref) { if (--(cpd->udev->refcount) == 0) { cv_signal(&cpd->udev->ref_cv); } @@ -332,7 +333,7 @@ usb_unref_device(struct usb_cdev_privdat DPRINTFN(2, "cpd=%p is_uref=%d\n", cpd, crd->is_uref); - if (crd->is_uref) + if (crd->do_unlock) usbd_enum_unlock(cpd->udev); mtx_lock(&usb_ref_lock); Modified: stable/9/sys/dev/usb/usb_dev.h ============================================================================== --- stable/9/sys/dev/usb/usb_dev.h Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_dev.h Thu Feb 21 07:48:07 2013 (r247090) @@ -82,6 +82,7 @@ struct usb_cdev_refdata { uint8_t is_write; /* location has write access */ uint8_t is_uref; /* USB refcount decr. needed */ uint8_t is_usbfs; /* USB-FS is active */ + uint8_t do_unlock; /* USB enum unlock needed */ }; struct usb_fs_privdata { Modified: stable/9/sys/dev/usb/usb_device.c ============================================================================== --- stable/9/sys/dev/usb/usb_device.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_device.c Thu Feb 21 07:48:07 2013 (r247090) @@ -443,13 +443,8 @@ usb_unconfigure(struct usb_device *udev, { uint8_t do_unlock; - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); /* detach all interface drivers */ usb_detach_device(udev, USB_IFACE_INDEX_ANY, flag); @@ -512,13 +507,8 @@ usbd_set_config_index(struct usb_device DPRINTFN(6, "udev=%p index=%d\n", udev, index); - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); usb_unconfigure(udev, 0); @@ -871,13 +861,9 @@ usbd_set_alt_interface_index(struct usb_ usb_error_t err; uint8_t do_unlock; - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); + if (iface == NULL) { err = USB_ERR_INVAL; goto done; @@ -914,7 +900,6 @@ usbd_set_alt_interface_index(struct usb_ done: if (do_unlock) usbd_enum_unlock(udev); - return (err); } @@ -1285,13 +1270,8 @@ usb_probe_and_attach(struct usb_device * DPRINTF("udev == NULL\n"); return (USB_ERR_INVAL); } - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); if (udev->curr_config_index == USB_UNCONFIG_INDEX) { /* do nothing - no configuration has been set */ @@ -1378,7 +1358,6 @@ usb_probe_and_attach(struct usb_device * done: if (do_unlock) usbd_enum_unlock(udev); - return (0); } @@ -1507,6 +1486,7 @@ usb_alloc_device(device_t parent_dev, st uint8_t config_index; uint8_t config_quirk; uint8_t set_config_failed; + uint8_t do_unlock; DPRINTF("parent_dev=%p, bus=%p, parent_hub=%p, depth=%u, " "port_index=%u, port_no=%u, speed=%u, usb_mode=%u\n", @@ -1541,9 +1521,6 @@ usb_alloc_device(device_t parent_dev, st return (NULL); } /* initialise our SX-lock */ - sx_init_flags(&udev->ctrl_sx, "USB device SX lock", SX_DUPOK); - - /* initialise our SX-lock */ sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS); @@ -1725,7 +1702,11 @@ usb_alloc_device(device_t parent_dev, st * device descriptor. If no strings are present there we * simply disable all USB strings. */ - scratch_ptr = udev->bus->scratch[0].data; + + /* Protect scratch area */ + do_unlock = usbd_enum_lock(udev); + + scratch_ptr = udev->scratch.data; if (udev->ddesc.iManufacturer || udev->ddesc.iProduct || @@ -1750,7 +1731,7 @@ usb_alloc_device(device_t parent_dev, st mask = usb_lang_mask; /* align length correctly */ - scratch_ptr[0] &= ~1; + scratch_ptr[0] &= ~1U; /* fix compiler warning */ langid = 0; @@ -1771,6 +1752,9 @@ usb_alloc_device(device_t parent_dev, st udev->langid = langid; } + if (do_unlock) + usbd_enum_unlock(udev); + /* assume 100mA bus powered for now. Changed when configured. */ udev->power = USB_MIN_POWER; /* fetch the vendor and product strings from the device */ @@ -2107,7 +2091,6 @@ usb_free_device(struct usb_device *udev, &udev->cs_msg[0], &udev->cs_msg[1]); USB_BUS_UNLOCK(udev->bus); - sx_destroy(&udev->ctrl_sx); sx_destroy(&udev->enum_sx); sx_destroy(&udev->sr_sx); @@ -2270,9 +2253,13 @@ usbd_set_device_strings(struct usb_devic size_t temp_size; uint16_t vendor_id; uint16_t product_id; + uint8_t do_unlock; - temp_ptr = (char *)udev->bus->scratch[0].data; - temp_size = sizeof(udev->bus->scratch[0].data); + /* Protect scratch area */ + do_unlock = usbd_enum_lock(udev); + + temp_ptr = (char *)udev->scratch.data; + temp_size = sizeof(udev->scratch.data); vendor_id = UGETW(udd->idVendor); product_id = UGETW(udd->idProduct); @@ -2327,6 +2314,9 @@ usbd_set_device_strings(struct usb_devic snprintf(temp_ptr, temp_size, "product 0x%04x", product_id); udev->product = strdup(temp_ptr, M_USB); } + + if (do_unlock) + usbd_enum_unlock(udev); } /* @@ -2639,11 +2629,17 @@ usbd_device_attached(struct usb_device * return (udev->state > USB_STATE_DETACHED); } -/* The following function locks enumerating the given USB device. */ - -void +/* + * The following function locks enumerating the given USB device. If + * the lock is already grabbed this function returns zero. Else a + * non-zero value is returned. + */ +uint8_t usbd_enum_lock(struct usb_device *udev) { + if (sx_xlocked(&udev->enum_sx)) + return (0); + sx_xlock(&udev->enum_sx); sx_xlock(&udev->sr_sx); /* @@ -2652,6 +2648,7 @@ usbd_enum_lock(struct usb_device *udev) * locked multiple times. */ mtx_lock(&Giant); + return (1); } /* The following function unlocks enumerating the given USB device. */ Modified: stable/9/sys/dev/usb/usb_device.h ============================================================================== --- stable/9/sys/dev/usb/usb_device.h Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_device.h Thu Feb 21 07:48:07 2013 (r247090) @@ -27,9 +27,18 @@ #ifndef _USB_DEVICE_H_ #define _USB_DEVICE_H_ -struct usb_symlink; /* UGEN */ +#ifndef USB_GLOBAL_INCLUDE_FILE +#include +#include +#include +#endif + +struct usb_bus_methods; +struct usb_config_descriptor; struct usb_device; /* linux compat */ struct usb_fs_privdata; +struct usb_hw_ep_profile; +struct usb_symlink; /* UGEN */ #define USB_CTRL_XFER_MAX 2 @@ -108,13 +117,70 @@ struct usb_power_save { }; /* + * The following structure is used when trying to allocate hardware + * endpoints for an USB configuration in USB device side mode. + */ +struct usb_hw_ep_scratch_sub { + const struct usb_hw_ep_profile *pf; + uint16_t max_frame_size; + uint8_t hw_endpoint_out; + uint8_t hw_endpoint_in; + uint8_t needs_ep_type; + uint8_t needs_in:1; + uint8_t needs_out:1; +}; + +/* + * The following structure is used when trying to allocate hardware + * endpoints for an USB configuration in USB device side mode. + */ +struct usb_hw_ep_scratch { + struct usb_hw_ep_scratch_sub ep[USB_EP_MAX]; + struct usb_hw_ep_scratch_sub *ep_max; + struct usb_config_descriptor *cd; + struct usb_device *udev; + struct usb_bus_methods *methods; + uint8_t bmOutAlloc[(USB_EP_MAX + 15) / 16]; + uint8_t bmInAlloc[(USB_EP_MAX + 15) / 16]; +}; + +/* + * The following structure is used when generating USB descriptors + * from USB templates. + */ +struct usb_temp_setup { + void *buf; + usb_size_t size; + enum usb_dev_speed usb_speed; + uint8_t self_powered; + uint8_t bNumEndpoints; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bConfigurationValue; + usb_error_t err; +}; + +/* + * The scratch area for USB devices. Access to this structure is + * protected by the enumeration SX lock. + */ +union usb_device_scratch { + struct usb_hw_ep_scratch hw_ep_scratch[1]; + struct usb_temp_setup temp_setup[1]; + struct { + struct usb_xfer dummy; + struct usb_setup_params parm; + } xfer_setup[1]; + uint8_t data[255]; +}; + +/* * The following structure defines an USB device. There exists one of * these structures for every USB device. */ struct usb_device { struct usb_clear_stall_msg cs_msg[2]; /* generic clear stall * messages */ - struct sx ctrl_sx; struct sx enum_sx; struct sx sr_sx; struct mtx device_mtx; @@ -191,6 +257,8 @@ struct usb_device { #endif uint32_t clear_stall_errors; /* number of clear-stall failures */ + + union usb_device_scratch scratch; }; /* globals */ @@ -227,7 +295,7 @@ struct usb_endpoint *usb_endpoint_foreac void usb_set_device_state(struct usb_device *, enum usb_dev_state); enum usb_dev_state usb_get_device_state(struct usb_device *); -void usbd_enum_lock(struct usb_device *); +uint8_t usbd_enum_lock(struct usb_device *); void usbd_enum_unlock(struct usb_device *); void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); Modified: stable/9/sys/dev/usb/usb_generic.c ============================================================================== --- stable/9/sys/dev/usb/usb_generic.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_generic.c Thu Feb 21 07:48:07 2013 (r247090) @@ -713,13 +713,20 @@ ugen_get_cdesc(struct usb_fifo *f, struc return (error); } +/* + * This function is called having the enumeration SX locked which + * protects the scratch area used. + */ static int ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { - void *ptr = f->udev->bus->scratch[0].data; - uint16_t size = sizeof(f->udev->bus->scratch[0].data); + void *ptr; + uint16_t size; int error; + ptr = f->udev->scratch.data; + size = sizeof(f->udev->scratch.data); + if (usbd_req_get_string_desc(f->udev, NULL, ptr, size, ugd->ugd_lang_id, ugd->ugd_string_index)) { error = EINVAL; Modified: stable/9/sys/dev/usb/usb_handle_request.c ============================================================================== --- stable/9/sys/dev/usb/usb_handle_request.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_handle_request.c Thu Feb 21 07:48:07 2013 (r247090) @@ -145,6 +145,7 @@ usb_handle_set_config(struct usb_xfer *x { struct usb_device *udev = xfer->xroot->udev; usb_error_t err = 0; + uint8_t do_unlock; /* * We need to protect against other threads doing probe and @@ -152,7 +153,8 @@ usb_handle_set_config(struct usb_xfer *x */ USB_XFER_UNLOCK(xfer); - usbd_enum_lock(udev); + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); if (conf_no == USB_UNCONFIG_NO) { conf_no = USB_UNCONFIG_INDEX; @@ -175,7 +177,8 @@ usb_handle_set_config(struct usb_xfer *x goto done; } done: - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (err); } @@ -187,13 +190,8 @@ usb_check_alt_setting(struct usb_device uint8_t do_unlock; usb_error_t err = 0; - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); if (alt_index >= usbd_get_no_alts(udev->cdesc, iface->idesc)) err = USB_ERR_INVAL; @@ -222,6 +220,7 @@ usb_handle_iface_request(struct usb_xfer int error; uint8_t iface_index; uint8_t temp_state; + uint8_t do_unlock; if ((req.bmRequestType & 0x1F) == UT_INTERFACE) { iface_index = req.wIndex[0]; /* unicast */ @@ -235,7 +234,8 @@ usb_handle_iface_request(struct usb_xfer */ USB_XFER_UNLOCK(xfer); - usbd_enum_lock(udev); + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); error = ENXIO; @@ -351,17 +351,20 @@ tr_repeat: goto tr_stalled; } tr_valid: - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (0); tr_short: - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (USB_ERR_SHORT_XFER); tr_stalled: - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (USB_ERR_STALLED); } Modified: stable/9/sys/dev/usb/usb_hub.c ============================================================================== --- stable/9/sys/dev/usb/usb_hub.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_hub.c Thu Feb 21 07:48:07 2013 (r247090) @@ -240,7 +240,9 @@ uhub_explore_sub(struct uhub_softc *sc, /* check if device should be re-enumerated */ if (child->flags.usb_mode == USB_MODE_HOST) { - usbd_enum_lock(child); + uint8_t do_unlock; + + do_unlock = usbd_enum_lock(child); if (child->re_enumerate_wait) { err = usbd_set_config_index(child, USB_UNCONFIG_INDEX); @@ -259,7 +261,8 @@ uhub_explore_sub(struct uhub_softc *sc, child->re_enumerate_wait = 0; err = 0; } - usbd_enum_unlock(child); + if (do_unlock) + usbd_enum_unlock(child); } /* check if probe and attach should be done */ @@ -710,6 +713,7 @@ uhub_explore(struct usb_device *udev) usb_error_t err; uint8_t portno; uint8_t x; + uint8_t do_unlock; hub = udev->hub; sc = hub->hubsoftc; @@ -731,7 +735,7 @@ uhub_explore(struct usb_device *udev) * Make sure we don't race against user-space applications * like LibUSB: */ - usbd_enum_lock(udev); + do_unlock = usbd_enum_lock(udev); for (x = 0; x != hub->nports; x++) { up = hub->ports + x; @@ -811,7 +815,8 @@ uhub_explore(struct usb_device *udev) up->restartcnt = 0; } - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); /* initial status checked */ sc->sc_flags |= UHUB_FLAG_DID_EXPLORE; Modified: stable/9/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/9/sys/dev/usb/usb_msctest.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_msctest.c Thu Feb 21 07:48:07 2013 (r247090) @@ -501,13 +501,8 @@ bbb_attach(struct usb_device *udev, uint usb_error_t err; uint8_t do_unlock; - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); /* * Make sure any driver which is hooked up to this interface, Modified: stable/9/sys/dev/usb/usb_request.c ============================================================================== --- stable/9/sys/dev/usb/usb_request.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_request.c Thu Feb 21 07:48:07 2013 (r247090) @@ -382,9 +382,8 @@ usbd_get_hr_func(struct usb_device *udev * than 30 seconds is treated like a 30 second timeout. This USB stack * does not allow control requests without a timeout. * - * NOTE: This function is thread safe. All calls to - * "usbd_do_request_flags" will be serialised by the use of an - * internal "sx_lock". + * NOTE: This function is thread safe. All calls to "usbd_do_request_flags" + * will be serialized by the use of the USB device enumeration lock. * * Returns: * 0: Success @@ -408,7 +407,7 @@ usbd_do_request_flags(struct usb_device uint16_t length; uint16_t temp; uint16_t acttemp; - uint8_t enum_locked; + uint8_t do_unlock; if (timeout < 50) { /* timeout is too small */ @@ -420,8 +419,6 @@ usbd_do_request_flags(struct usb_device } length = UGETW(req->wLength); - enum_locked = usbd_enum_is_locked(udev); - DPRINTFN(5, "udev=%p bmRequestType=0x%02x bRequest=0x%02x " "wValue=0x%02x%02x wIndex=0x%02x%02x wLength=0x%02x%02x\n", udev, req->bmRequestType, req->bRequest, @@ -452,17 +449,16 @@ usbd_do_request_flags(struct usb_device } /* - * We need to allow suspend and resume at this point, else the - * control transfer will timeout if the device is suspended! + * Grab the USB device enumeration SX-lock serialization is + * achieved when multiple threads are involved: */ - if (enum_locked) - usbd_sr_unlock(udev); + do_unlock = usbd_enum_lock(udev); /* - * Grab the default sx-lock so that serialisation - * is achieved when multiple threads are involved: + * We need to allow suspend and resume at this point, else the + * control transfer will timeout if the device is suspended! */ - sx_xlock(&udev->ctrl_sx); + usbd_sr_unlock(udev); hr_func = usbd_get_hr_func(udev); @@ -706,10 +702,10 @@ usbd_do_request_flags(struct usb_device USB_XFER_UNLOCK(xfer); done: - sx_xunlock(&udev->ctrl_sx); + usbd_sr_lock(udev); - if (enum_locked) - usbd_sr_lock(udev); + if (do_unlock) + usbd_enum_unlock(udev); if ((mtx != NULL) && (mtx != &Giant)) mtx_lock(mtx); Modified: stable/9/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/9/sys/dev/usb/usb_transfer.c Thu Feb 21 07:19:50 2013 (r247089) +++ stable/9/sys/dev/usb/usb_transfer.c Thu Feb 21 07:48:07 2013 (r247090) @@ -22,7 +22,7 @@ * 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 #include @@ -810,20 +810,17 @@ usbd_transfer_setup(struct usb_device *u const struct usb_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *xfer_mtx) { - struct usb_xfer dummy; - struct usb_setup_params parm; const struct usb_config *setup_end = setup_start + n_setup; const struct usb_config *setup; + struct usb_setup_params *parm; struct usb_endpoint *ep; struct usb_xfer_root *info; struct usb_xfer *xfer; void *buf = NULL; + usb_error_t error = 0; uint16_t n; uint16_t refcount; - - parm.err = 0; - refcount = 0; - info = NULL; + uint8_t do_unlock; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "usbd_transfer_setup can sleep!"); @@ -842,31 +839,40 @@ usbd_transfer_setup(struct usb_device *u DPRINTFN(6, "using global lock\n"); xfer_mtx = &Giant; } - /* sanity checks */ + + /* more sanity checks */ + for (setup = setup_start, n = 0; setup != setup_end; setup++, n++) { if (setup->bufsize == (usb_frlength_t)-1) { - parm.err = USB_ERR_BAD_BUFSIZE; + error = USB_ERR_BAD_BUFSIZE; DPRINTF("invalid bufsize\n"); } if (setup->callback == NULL) { - parm.err = USB_ERR_NO_CALLBACK; + error = USB_ERR_NO_CALLBACK; DPRINTF("no callback\n"); } ppxfer[n] = NULL; } - if (parm.err) { - goto done; - } - memset(&parm, 0, sizeof(parm)); + if (error) + return (error); + + /* Protect scratch area */ + do_unlock = usbd_enum_lock(udev); - parm.udev = udev; - parm.speed = usbd_get_speed(udev); - parm.hc_max_packet_count = 1; + refcount = 0; + info = NULL; - if (parm.speed >= USB_SPEED_MAX) { - parm.err = USB_ERR_INVAL; + parm = &udev->scratch.xfer_setup[0].parm; + memset(parm, 0, sizeof(*parm)); + + parm->udev = udev; + parm->speed = usbd_get_speed(udev); + parm->hc_max_packet_count = 1; + + if (parm->speed >= USB_SPEED_MAX) { + parm->err = USB_ERR_INVAL; goto done; } /* setup all transfers */ @@ -881,22 +887,22 @@ usbd_transfer_setup(struct usb_device *u info = USB_ADD_BYTES(buf, 0); info->memory_base = buf; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 08:21:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2A51A11F; Thu, 21 Feb 2013 08:21:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 19C0F1A5D; Thu, 21 Feb 2013 08:21:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1L8LHUT039032; Thu, 21 Feb 2013 08:21:17 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1L8LEm9039011; Thu, 21 Feb 2013 08:21:14 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302210821.r1L8LEm9039011@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 21 Feb 2013 08:21:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247091 - in stable/8/sys: dev/usb dev/usb/controller dev/usb/template sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 08:21:18 -0000 Author: hselasky Date: Thu Feb 21 08:21:14 2013 New Revision: 247091 URL: http://svnweb.freebsd.org/changeset/base/247091 Log: MFC r246616 and r246759: - Move scratch data from the USB bus structure to the USB device structure so that simultaneous access cannot happen. Protect scratch area using the enumeration lock. - Reduce stack usage in usbd_transfer_setup() by moving some big stack members to the scratch area. This saves around 200 bytes of stack. - Fix a whitespace. - Protect control requests using the USB device enumeration lock. - Make sure all callers of usbd_enum_lock() check the return value. - Remove the control transfer specific lock. - Bump the FreeBSD version number, hence external USB modules may need to be recompiled due to a USB device structure change. Modified: stable/8/sys/dev/usb/controller/usb_controller.c stable/8/sys/dev/usb/template/usb_template.c stable/8/sys/dev/usb/usb_bus.h stable/8/sys/dev/usb/usb_controller.h stable/8/sys/dev/usb/usb_dev.c stable/8/sys/dev/usb/usb_dev.h stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_device.h stable/8/sys/dev/usb/usb_generic.c stable/8/sys/dev/usb/usb_handle_request.c stable/8/sys/dev/usb/usb_hub.c stable/8/sys/dev/usb/usb_msctest.c stable/8/sys/dev/usb/usb_request.c stable/8/sys/dev/usb/usb_transfer.c stable/8/sys/dev/usb/usb_util.c stable/8/sys/sys/param.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/controller/usb_controller.c ============================================================================== --- stable/8/sys/dev/usb/controller/usb_controller.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/controller/usb_controller.c Thu Feb 21 08:21:14 2013 (r247091) @@ -407,6 +407,7 @@ usb_bus_suspend(struct usb_proc_msg *pm) struct usb_bus *bus; struct usb_device *udev; usb_error_t err; + uint8_t do_unlock; bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; @@ -427,7 +428,7 @@ usb_bus_suspend(struct usb_proc_msg *pm) bus_generic_shutdown(bus->bdev); - usbd_enum_lock(udev); + do_unlock = usbd_enum_lock(udev); err = usbd_set_config_index(udev, USB_UNCONFIG_INDEX); if (err) @@ -444,7 +445,8 @@ usb_bus_suspend(struct usb_proc_msg *pm) if (bus->methods->set_hw_power_sleep != NULL) (bus->methods->set_hw_power_sleep) (bus, USB_HW_POWER_SUSPEND); - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_BUS_LOCK(bus); } @@ -460,6 +462,7 @@ usb_bus_resume(struct usb_proc_msg *pm) struct usb_bus *bus; struct usb_device *udev; usb_error_t err; + uint8_t do_unlock; bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; @@ -469,7 +472,7 @@ usb_bus_resume(struct usb_proc_msg *pm) USB_BUS_UNLOCK(bus); - usbd_enum_lock(udev); + do_unlock = usbd_enum_lock(udev); #if 0 DEVMETHOD(usb_take_controller, NULL); /* dummy */ #endif @@ -503,7 +506,8 @@ usb_bus_resume(struct usb_proc_msg *pm) "attach root HUB\n"); } - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_BUS_LOCK(bus); } @@ -519,6 +523,7 @@ usb_bus_shutdown(struct usb_proc_msg *pm struct usb_bus *bus; struct usb_device *udev; usb_error_t err; + uint8_t do_unlock; bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; @@ -530,7 +535,7 @@ usb_bus_shutdown(struct usb_proc_msg *pm bus_generic_shutdown(bus->bdev); - usbd_enum_lock(udev); + do_unlock = usbd_enum_lock(udev); err = usbd_set_config_index(udev, USB_UNCONFIG_INDEX); if (err) @@ -547,7 +552,8 @@ usb_bus_shutdown(struct usb_proc_msg *pm if (bus->methods->set_hw_power_sleep != NULL) (bus->methods->set_hw_power_sleep) (bus, USB_HW_POWER_SHUTDOWN); - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_BUS_LOCK(bus); } Modified: stable/8/sys/dev/usb/template/usb_template.c ============================================================================== --- stable/8/sys/dev/usb/template/usb_template.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/template/usb_template.c Thu Feb 21 08:21:14 2013 (r247091) @@ -845,20 +845,20 @@ usb_hw_ep_resolve(struct usb_device *ude struct usb_device_descriptor *dd; uint16_t mps; - if (desc == NULL) { + if (desc == NULL) return (USB_ERR_INVAL); - } + /* get bus methods */ methods = udev->bus->methods; - if (methods->get_hw_ep_profile == NULL) { + if (methods->get_hw_ep_profile == NULL) return (USB_ERR_INVAL); - } + if (desc->bDescriptorType == UDESC_DEVICE) { - if (desc->bLength < sizeof(*dd)) { + if (desc->bLength < sizeof(*dd)) return (USB_ERR_INVAL); - } + dd = (void *)desc; /* get HW control endpoint 0 profile */ @@ -905,13 +905,12 @@ usb_hw_ep_resolve(struct usb_device *ude } return (0); /* success */ } - if (desc->bDescriptorType != UDESC_CONFIG) { + if (desc->bDescriptorType != UDESC_CONFIG) return (USB_ERR_INVAL); - } - if (desc->bLength < sizeof(*(ues->cd))) { + if (desc->bLength < sizeof(*(ues->cd))) return (USB_ERR_INVAL); - } - ues = udev->bus->scratch[0].hw_ep_scratch; + + ues = udev->scratch.hw_ep_scratch; memset(ues, 0, sizeof(*ues)); @@ -1232,13 +1231,18 @@ usb_temp_setup(struct usb_device *udev, { struct usb_temp_setup *uts; void *buf; + usb_error_t error; uint8_t n; + uint8_t do_unlock; - if (tdd == NULL) { - /* be NULL safe */ + /* be NULL safe */ + if (tdd == NULL) return (0); - } - uts = udev->bus->scratch[0].temp_setup; + + /* Protect scratch area */ + do_unlock = usbd_enum_lock(udev); + + uts = udev->scratch.temp_setup; memset(uts, 0, sizeof(*uts)); @@ -1251,17 +1255,24 @@ usb_temp_setup(struct usb_device *udev, if (uts->err) { /* some error happened */ - return (uts->err); + goto done; } /* sanity check */ if (uts->size == 0) { - return (USB_ERR_INVAL); + uts->err = USB_ERR_INVAL; + goto done; } /* allocate zeroed memory */ uts->buf = malloc(uts->size, M_USB, M_WAITOK | M_ZERO); + /* + * Allow malloc() to return NULL regardless of M_WAITOK flag. + * This helps when porting the software to non-FreeBSD + * systems. + */ if (uts->buf == NULL) { /* could not allocate memory */ - return (USB_ERR_NOMEM); + uts->err = USB_ERR_NOMEM; + goto done; } /* second pass */ @@ -1276,7 +1287,7 @@ usb_temp_setup(struct usb_device *udev, if (uts->err) { /* some error happened during second pass */ - goto error; + goto done; } /* * Resolve all endpoint addresses ! @@ -1287,7 +1298,7 @@ usb_temp_setup(struct usb_device *udev, DPRINTFN(0, "Could not resolve endpoints for " "Device Descriptor, error = %s\n", usbd_errstr(uts->err)); - goto error; + goto done; } for (n = 0;; n++) { @@ -1300,14 +1311,16 @@ usb_temp_setup(struct usb_device *udev, DPRINTFN(0, "Could not resolve endpoints for " "Config Descriptor %u, error = %s\n", n, usbd_errstr(uts->err)); - goto error; + goto done; } } - return (uts->err); - -error: - usb_temp_unsetup(udev); - return (uts->err); +done: + error = uts->err; + if (error) + usb_temp_unsetup(udev); + if (do_unlock) + usbd_enum_unlock(udev); + return (error); } /*------------------------------------------------------------------------* Modified: stable/8/sys/dev/usb/usb_bus.h ============================================================================== --- stable/8/sys/dev/usb/usb_bus.h Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_bus.h Thu Feb 21 08:21:14 2013 (r247091) @@ -103,16 +103,6 @@ struct usb_bus { uint8_t devices_max; /* maximum number of USB devices */ uint8_t do_probe; /* set if USB should be re-probed */ uint8_t no_explore; /* don't explore USB ports */ - - /* - * The scratch area can only be used inside the explore thread - * belonging to the give serial bus. - */ - union { - struct usb_hw_ep_scratch hw_ep_scratch[1]; - struct usb_temp_setup temp_setup[1]; - uint8_t data[255]; - } scratch[1]; }; #endif /* _USB_BUS_H_ */ Modified: stable/8/sys/dev/usb/usb_controller.h ============================================================================== --- stable/8/sys/dev/usb/usb_controller.h Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_controller.h Thu Feb 21 08:21:14 2013 (r247091) @@ -40,7 +40,6 @@ struct usb_page_cache; struct usb_setup_params; struct usb_hw_ep_profile; struct usb_fs_isoc_schedule; -struct usb_config_descriptor; struct usb_endpoint_descriptor; /* typedefs */ @@ -181,50 +180,6 @@ struct usb_hw_ep_profile { uint8_t support_out:1; /* OUT-token is supported */ }; -/* - * The following structure is used when trying to allocate hardware - * endpoints for an USB configuration in USB device side mode. - */ -struct usb_hw_ep_scratch_sub { - const struct usb_hw_ep_profile *pf; - uint16_t max_frame_size; - uint8_t hw_endpoint_out; - uint8_t hw_endpoint_in; - uint8_t needs_ep_type; - uint8_t needs_in:1; - uint8_t needs_out:1; -}; - -/* - * The following structure is used when trying to allocate hardware - * endpoints for an USB configuration in USB device side mode. - */ -struct usb_hw_ep_scratch { - struct usb_hw_ep_scratch_sub ep[USB_EP_MAX]; - struct usb_hw_ep_scratch_sub *ep_max; - struct usb_config_descriptor *cd; - struct usb_device *udev; - struct usb_bus_methods *methods; - uint8_t bmOutAlloc[(USB_EP_MAX + 15) / 16]; - uint8_t bmInAlloc[(USB_EP_MAX + 15) / 16]; -}; - -/* - * The following structure is used when generating USB descriptors - * from USB templates. - */ -struct usb_temp_setup { - void *buf; - usb_size_t size; - enum usb_dev_speed usb_speed; - uint8_t self_powered; - uint8_t bNumEndpoints; - uint8_t bInterfaceNumber; - uint8_t bAlternateSetting; - uint8_t bConfigurationValue; - usb_error_t err; -}; - /* prototypes */ void usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb); Modified: stable/8/sys/dev/usb/usb_dev.c ============================================================================== --- stable/8/sys/dev/usb/usb_dev.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_dev.c Thu Feb 21 08:21:14 2013 (r247091) @@ -214,10 +214,10 @@ usb_ref_device(struct usb_cdev_privdata mtx_unlock(&usb_ref_lock); /* - * We need to grab the sx-lock before grabbing the - * FIFO refs to avoid deadlock at detach! + * We need to grab the enumeration SX-lock before + * grabbing the FIFO refs to avoid deadlock at detach! */ - usbd_enum_lock(cpd->udev); + crd->do_unlock = usbd_enum_lock(cpd->udev); mtx_lock(&usb_ref_lock); @@ -278,9 +278,10 @@ usb_ref_device(struct usb_cdev_privdata return (0); error: - if (crd->is_uref) { + if (crd->do_unlock) usbd_enum_unlock(cpd->udev); + if (crd->is_uref) { if (--(cpd->udev->refcount) == 0) { cv_signal(&cpd->udev->ref_cv); } @@ -332,7 +333,7 @@ usb_unref_device(struct usb_cdev_privdat DPRINTFN(2, "cpd=%p is_uref=%d\n", cpd, crd->is_uref); - if (crd->is_uref) + if (crd->do_unlock) usbd_enum_unlock(cpd->udev); mtx_lock(&usb_ref_lock); Modified: stable/8/sys/dev/usb/usb_dev.h ============================================================================== --- stable/8/sys/dev/usb/usb_dev.h Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_dev.h Thu Feb 21 08:21:14 2013 (r247091) @@ -82,6 +82,7 @@ struct usb_cdev_refdata { uint8_t is_write; /* location has write access */ uint8_t is_uref; /* USB refcount decr. needed */ uint8_t is_usbfs; /* USB-FS is active */ + uint8_t do_unlock; /* USB enum unlock needed */ }; struct usb_fs_privdata { Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_device.c Thu Feb 21 08:21:14 2013 (r247091) @@ -443,13 +443,8 @@ usb_unconfigure(struct usb_device *udev, { uint8_t do_unlock; - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); /* detach all interface drivers */ usb_detach_device(udev, USB_IFACE_INDEX_ANY, flag); @@ -512,13 +507,8 @@ usbd_set_config_index(struct usb_device DPRINTFN(6, "udev=%p index=%d\n", udev, index); - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); usb_unconfigure(udev, 0); @@ -871,13 +861,9 @@ usbd_set_alt_interface_index(struct usb_ usb_error_t err; uint8_t do_unlock; - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); + if (iface == NULL) { err = USB_ERR_INVAL; goto done; @@ -914,7 +900,6 @@ usbd_set_alt_interface_index(struct usb_ done: if (do_unlock) usbd_enum_unlock(udev); - return (err); } @@ -1285,13 +1270,8 @@ usb_probe_and_attach(struct usb_device * DPRINTF("udev == NULL\n"); return (USB_ERR_INVAL); } - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); if (udev->curr_config_index == USB_UNCONFIG_INDEX) { /* do nothing - no configuration has been set */ @@ -1378,7 +1358,6 @@ usb_probe_and_attach(struct usb_device * done: if (do_unlock) usbd_enum_unlock(udev); - return (0); } @@ -1507,6 +1486,7 @@ usb_alloc_device(device_t parent_dev, st uint8_t config_index; uint8_t config_quirk; uint8_t set_config_failed; + uint8_t do_unlock; DPRINTF("parent_dev=%p, bus=%p, parent_hub=%p, depth=%u, " "port_index=%u, port_no=%u, speed=%u, usb_mode=%u\n", @@ -1541,9 +1521,6 @@ usb_alloc_device(device_t parent_dev, st return (NULL); } /* initialise our SX-lock */ - sx_init_flags(&udev->ctrl_sx, "USB device SX lock", SX_DUPOK); - - /* initialise our SX-lock */ sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS); @@ -1725,7 +1702,11 @@ usb_alloc_device(device_t parent_dev, st * device descriptor. If no strings are present there we * simply disable all USB strings. */ - scratch_ptr = udev->bus->scratch[0].data; + + /* Protect scratch area */ + do_unlock = usbd_enum_lock(udev); + + scratch_ptr = udev->scratch.data; if (udev->ddesc.iManufacturer || udev->ddesc.iProduct || @@ -1750,7 +1731,7 @@ usb_alloc_device(device_t parent_dev, st mask = usb_lang_mask; /* align length correctly */ - scratch_ptr[0] &= ~1; + scratch_ptr[0] &= ~1U; /* fix compiler warning */ langid = 0; @@ -1771,6 +1752,9 @@ usb_alloc_device(device_t parent_dev, st udev->langid = langid; } + if (do_unlock) + usbd_enum_unlock(udev); + /* assume 100mA bus powered for now. Changed when configured. */ udev->power = USB_MIN_POWER; /* fetch the vendor and product strings from the device */ @@ -2107,7 +2091,6 @@ usb_free_device(struct usb_device *udev, &udev->cs_msg[0], &udev->cs_msg[1]); USB_BUS_UNLOCK(udev->bus); - sx_destroy(&udev->ctrl_sx); sx_destroy(&udev->enum_sx); sx_destroy(&udev->sr_sx); @@ -2270,9 +2253,13 @@ usbd_set_device_strings(struct usb_devic size_t temp_size; uint16_t vendor_id; uint16_t product_id; + uint8_t do_unlock; - temp_ptr = (char *)udev->bus->scratch[0].data; - temp_size = sizeof(udev->bus->scratch[0].data); + /* Protect scratch area */ + do_unlock = usbd_enum_lock(udev); + + temp_ptr = (char *)udev->scratch.data; + temp_size = sizeof(udev->scratch.data); vendor_id = UGETW(udd->idVendor); product_id = UGETW(udd->idProduct); @@ -2327,6 +2314,9 @@ usbd_set_device_strings(struct usb_devic snprintf(temp_ptr, temp_size, "product 0x%04x", product_id); udev->product = strdup(temp_ptr, M_USB); } + + if (do_unlock) + usbd_enum_unlock(udev); } /* @@ -2714,11 +2704,17 @@ usbd_device_attached(struct usb_device * return (udev->state > USB_STATE_DETACHED); } -/* The following function locks enumerating the given USB device. */ - -void +/* + * The following function locks enumerating the given USB device. If + * the lock is already grabbed this function returns zero. Else a + * non-zero value is returned. + */ +uint8_t usbd_enum_lock(struct usb_device *udev) { + if (sx_xlocked(&udev->enum_sx)) + return (0); + sx_xlock(&udev->enum_sx); sx_xlock(&udev->sr_sx); /* @@ -2727,6 +2723,7 @@ usbd_enum_lock(struct usb_device *udev) * locked multiple times. */ mtx_lock(&Giant); + return (1); } /* The following function unlocks enumerating the given USB device. */ Modified: stable/8/sys/dev/usb/usb_device.h ============================================================================== --- stable/8/sys/dev/usb/usb_device.h Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_device.h Thu Feb 21 08:21:14 2013 (r247091) @@ -27,9 +27,18 @@ #ifndef _USB_DEVICE_H_ #define _USB_DEVICE_H_ -struct usb_symlink; /* UGEN */ +#ifndef USB_GLOBAL_INCLUDE_FILE +#include +#include +#include +#endif + +struct usb_bus_methods; +struct usb_config_descriptor; struct usb_device; /* linux compat */ struct usb_fs_privdata; +struct usb_hw_ep_profile; +struct usb_symlink; /* UGEN */ #define USB_CTRL_XFER_MAX 2 @@ -108,13 +117,70 @@ struct usb_power_save { }; /* + * The following structure is used when trying to allocate hardware + * endpoints for an USB configuration in USB device side mode. + */ +struct usb_hw_ep_scratch_sub { + const struct usb_hw_ep_profile *pf; + uint16_t max_frame_size; + uint8_t hw_endpoint_out; + uint8_t hw_endpoint_in; + uint8_t needs_ep_type; + uint8_t needs_in:1; + uint8_t needs_out:1; +}; + +/* + * The following structure is used when trying to allocate hardware + * endpoints for an USB configuration in USB device side mode. + */ +struct usb_hw_ep_scratch { + struct usb_hw_ep_scratch_sub ep[USB_EP_MAX]; + struct usb_hw_ep_scratch_sub *ep_max; + struct usb_config_descriptor *cd; + struct usb_device *udev; + struct usb_bus_methods *methods; + uint8_t bmOutAlloc[(USB_EP_MAX + 15) / 16]; + uint8_t bmInAlloc[(USB_EP_MAX + 15) / 16]; +}; + +/* + * The following structure is used when generating USB descriptors + * from USB templates. + */ +struct usb_temp_setup { + void *buf; + usb_size_t size; + enum usb_dev_speed usb_speed; + uint8_t self_powered; + uint8_t bNumEndpoints; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bConfigurationValue; + usb_error_t err; +}; + +/* + * The scratch area for USB devices. Access to this structure is + * protected by the enumeration SX lock. + */ +union usb_device_scratch { + struct usb_hw_ep_scratch hw_ep_scratch[1]; + struct usb_temp_setup temp_setup[1]; + struct { + struct usb_xfer dummy; + struct usb_setup_params parm; + } xfer_setup[1]; + uint8_t data[255]; +}; + +/* * The following structure defines an USB device. There exists one of * these structures for every USB device. */ struct usb_device { struct usb_clear_stall_msg cs_msg[2]; /* generic clear stall * messages */ - struct sx ctrl_sx; struct sx enum_sx; struct sx sr_sx; struct mtx device_mtx; @@ -192,6 +258,8 @@ struct usb_device { uint32_t clear_stall_errors; /* number of clear-stall failures */ uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ + + union usb_device_scratch scratch; }; /* globals */ @@ -228,7 +296,7 @@ struct usb_endpoint *usb_endpoint_foreac void usb_set_device_state(struct usb_device *, enum usb_dev_state); enum usb_dev_state usb_get_device_state(struct usb_device *); -void usbd_enum_lock(struct usb_device *); +uint8_t usbd_enum_lock(struct usb_device *); void usbd_enum_unlock(struct usb_device *); void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); Modified: stable/8/sys/dev/usb/usb_generic.c ============================================================================== --- stable/8/sys/dev/usb/usb_generic.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_generic.c Thu Feb 21 08:21:14 2013 (r247091) @@ -713,13 +713,20 @@ ugen_get_cdesc(struct usb_fifo *f, struc return (error); } +/* + * This function is called having the enumeration SX locked which + * protects the scratch area used. + */ static int ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { - void *ptr = f->udev->bus->scratch[0].data; - uint16_t size = sizeof(f->udev->bus->scratch[0].data); + void *ptr; + uint16_t size; int error; + ptr = f->udev->scratch.data; + size = sizeof(f->udev->scratch.data); + if (usbd_req_get_string_desc(f->udev, NULL, ptr, size, ugd->ugd_lang_id, ugd->ugd_string_index)) { error = EINVAL; Modified: stable/8/sys/dev/usb/usb_handle_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_handle_request.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_handle_request.c Thu Feb 21 08:21:14 2013 (r247091) @@ -145,6 +145,7 @@ usb_handle_set_config(struct usb_xfer *x { struct usb_device *udev = xfer->xroot->udev; usb_error_t err = 0; + uint8_t do_unlock; /* * We need to protect against other threads doing probe and @@ -152,7 +153,8 @@ usb_handle_set_config(struct usb_xfer *x */ USB_XFER_UNLOCK(xfer); - usbd_enum_lock(udev); + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); if (conf_no == USB_UNCONFIG_NO) { conf_no = USB_UNCONFIG_INDEX; @@ -175,7 +177,8 @@ usb_handle_set_config(struct usb_xfer *x goto done; } done: - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (err); } @@ -187,13 +190,8 @@ usb_check_alt_setting(struct usb_device uint8_t do_unlock; usb_error_t err = 0; - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); if (alt_index >= usbd_get_no_alts(udev->cdesc, iface->idesc)) err = USB_ERR_INVAL; @@ -222,6 +220,7 @@ usb_handle_iface_request(struct usb_xfer int error; uint8_t iface_index; uint8_t temp_state; + uint8_t do_unlock; if ((req.bmRequestType & 0x1F) == UT_INTERFACE) { iface_index = req.wIndex[0]; /* unicast */ @@ -235,7 +234,8 @@ usb_handle_iface_request(struct usb_xfer */ USB_XFER_UNLOCK(xfer); - usbd_enum_lock(udev); + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); error = ENXIO; @@ -351,17 +351,20 @@ tr_repeat: goto tr_stalled; } tr_valid: - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (0); tr_short: - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (USB_ERR_SHORT_XFER); tr_stalled: - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (USB_ERR_STALLED); } Modified: stable/8/sys/dev/usb/usb_hub.c ============================================================================== --- stable/8/sys/dev/usb/usb_hub.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_hub.c Thu Feb 21 08:21:14 2013 (r247091) @@ -240,7 +240,9 @@ uhub_explore_sub(struct uhub_softc *sc, /* check if device should be re-enumerated */ if (child->flags.usb_mode == USB_MODE_HOST) { - usbd_enum_lock(child); + uint8_t do_unlock; + + do_unlock = usbd_enum_lock(child); if (child->re_enumerate_wait) { err = usbd_set_config_index(child, USB_UNCONFIG_INDEX); @@ -259,7 +261,8 @@ uhub_explore_sub(struct uhub_softc *sc, child->re_enumerate_wait = 0; err = 0; } - usbd_enum_unlock(child); + if (do_unlock) + usbd_enum_unlock(child); } /* check if probe and attach should be done */ @@ -710,6 +713,7 @@ uhub_explore(struct usb_device *udev) usb_error_t err; uint8_t portno; uint8_t x; + uint8_t do_unlock; hub = udev->hub; sc = hub->hubsoftc; @@ -731,7 +735,7 @@ uhub_explore(struct usb_device *udev) * Make sure we don't race against user-space applications * like LibUSB: */ - usbd_enum_lock(udev); + do_unlock = usbd_enum_lock(udev); for (x = 0; x != hub->nports; x++) { up = hub->ports + x; @@ -811,7 +815,8 @@ uhub_explore(struct usb_device *udev) up->restartcnt = 0; } - usbd_enum_unlock(udev); + if (do_unlock) + usbd_enum_unlock(udev); /* initial status checked */ sc->sc_flags |= UHUB_FLAG_DID_EXPLORE; Modified: stable/8/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/8/sys/dev/usb/usb_msctest.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_msctest.c Thu Feb 21 08:21:14 2013 (r247091) @@ -500,13 +500,8 @@ bbb_attach(struct usb_device *udev, uint usb_error_t err; uint8_t do_unlock; - /* automatic locking */ - if (usbd_enum_is_locked(udev)) { - do_unlock = 0; - } else { - do_unlock = 1; - usbd_enum_lock(udev); - } + /* Prevent re-enumeration */ + do_unlock = usbd_enum_lock(udev); /* * Make sure any driver which is hooked up to this interface, Modified: stable/8/sys/dev/usb/usb_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_request.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_request.c Thu Feb 21 08:21:14 2013 (r247091) @@ -382,9 +382,8 @@ usbd_get_hr_func(struct usb_device *udev * than 30 seconds is treated like a 30 second timeout. This USB stack * does not allow control requests without a timeout. * - * NOTE: This function is thread safe. All calls to - * "usbd_do_request_flags" will be serialised by the use of an - * internal "sx_lock". + * NOTE: This function is thread safe. All calls to "usbd_do_request_flags" + * will be serialized by the use of the USB device enumeration lock. * * Returns: * 0: Success @@ -408,7 +407,7 @@ usbd_do_request_flags(struct usb_device uint16_t length; uint16_t temp; uint16_t acttemp; - uint8_t enum_locked; + uint8_t do_unlock; if (timeout < 50) { /* timeout is too small */ @@ -420,8 +419,6 @@ usbd_do_request_flags(struct usb_device } length = UGETW(req->wLength); - enum_locked = usbd_enum_is_locked(udev); - DPRINTFN(5, "udev=%p bmRequestType=0x%02x bRequest=0x%02x " "wValue=0x%02x%02x wIndex=0x%02x%02x wLength=0x%02x%02x\n", udev, req->bmRequestType, req->bRequest, @@ -452,17 +449,16 @@ usbd_do_request_flags(struct usb_device } /* - * We need to allow suspend and resume at this point, else the - * control transfer will timeout if the device is suspended! + * Grab the USB device enumeration SX-lock serialization is + * achieved when multiple threads are involved: */ - if (enum_locked) - usbd_sr_unlock(udev); + do_unlock = usbd_enum_lock(udev); /* - * Grab the default sx-lock so that serialisation - * is achieved when multiple threads are involved: + * We need to allow suspend and resume at this point, else the + * control transfer will timeout if the device is suspended! */ - sx_xlock(&udev->ctrl_sx); + usbd_sr_unlock(udev); hr_func = usbd_get_hr_func(udev); @@ -706,10 +702,10 @@ usbd_do_request_flags(struct usb_device USB_XFER_UNLOCK(xfer); done: - sx_xunlock(&udev->ctrl_sx); + usbd_sr_lock(udev); - if (enum_locked) - usbd_sr_lock(udev); + if (do_unlock) + usbd_enum_unlock(udev); if ((mtx != NULL) && (mtx != &Giant)) mtx_lock(mtx); Modified: stable/8/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/8/sys/dev/usb/usb_transfer.c Thu Feb 21 07:48:07 2013 (r247090) +++ stable/8/sys/dev/usb/usb_transfer.c Thu Feb 21 08:21:14 2013 (r247091) @@ -22,7 +22,7 @@ * 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 #include @@ -810,20 +810,17 @@ usbd_transfer_setup(struct usb_device *u const struct usb_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *xfer_mtx) { - struct usb_xfer dummy; - struct usb_setup_params parm; const struct usb_config *setup_end = setup_start + n_setup; const struct usb_config *setup; + struct usb_setup_params *parm; struct usb_endpoint *ep; struct usb_xfer_root *info; struct usb_xfer *xfer; void *buf = NULL; + usb_error_t error = 0; uint16_t n; uint16_t refcount; - - parm.err = 0; - refcount = 0; - info = NULL; + uint8_t do_unlock; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "usbd_transfer_setup can sleep!"); @@ -842,31 +839,40 @@ usbd_transfer_setup(struct usb_device *u DPRINTFN(6, "using global lock\n"); xfer_mtx = &Giant; } - /* sanity checks */ + + /* more sanity checks */ + for (setup = setup_start, n = 0; setup != setup_end; setup++, n++) { if (setup->bufsize == (usb_frlength_t)-1) { - parm.err = USB_ERR_BAD_BUFSIZE; + error = USB_ERR_BAD_BUFSIZE; DPRINTF("invalid bufsize\n"); } if (setup->callback == NULL) { - parm.err = USB_ERR_NO_CALLBACK; + error = USB_ERR_NO_CALLBACK; DPRINTF("no callback\n"); } ppxfer[n] = NULL; } - if (parm.err) { - goto done; - } - memset(&parm, 0, sizeof(parm)); + if (error) + return (error); + + /* Protect scratch area */ + do_unlock = usbd_enum_lock(udev); - parm.udev = udev; - parm.speed = usbd_get_speed(udev); - parm.hc_max_packet_count = 1; + refcount = 0; + info = NULL; - if (parm.speed >= USB_SPEED_MAX) { - parm.err = USB_ERR_INVAL; + parm = &udev->scratch.xfer_setup[0].parm; + memset(parm, 0, sizeof(*parm)); + + parm->udev = udev; + parm->speed = usbd_get_speed(udev); + parm->hc_max_packet_count = 1; + + if (parm->speed >= USB_SPEED_MAX) { + parm->err = USB_ERR_INVAL; goto done; } /* setup all transfers */ @@ -881,22 +887,22 @@ usbd_transfer_setup(struct usb_device *u info = USB_ADD_BYTES(buf, 0); info->memory_base = buf; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 15:21:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 00A18146; Thu, 21 Feb 2013 15:21:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E6BDDC33; Thu, 21 Feb 2013 15:21:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LFLQMQ065461; Thu, 21 Feb 2013 15:21:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LFLQFg065458; Thu, 21 Feb 2013 15:21:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211521.r1LFLQFg065458@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 15:21:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247098 - in stable/9/sys/dev: ahci ata ata/chipsets X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 15:21:27 -0000 Author: mav Date: Thu Feb 21 15:21:25 2013 New Revision: 247098 URL: http://svnweb.freebsd.org/changeset/base/247098 Log: MFC r244983 (by jfv): Add Intel Lynx Point PCH SATA Controller Device IDs Modified: stable/9/sys/dev/ahci/ahci.c stable/9/sys/dev/ata/ata-pci.h stable/9/sys/dev/ata/chipsets/ata-intel.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Thu Feb 21 15:06:19 2013 (r247097) +++ stable/9/sys/dev/ahci/ahci.c Thu Feb 21 15:21:25 2013 (r247098) @@ -186,6 +186,14 @@ static struct { {0x1e078086, 0x00, "Intel Panther Point", 0}, {0x1e0e8086, 0x00, "Intel Panther Point", 0}, {0x1e0f8086, 0x00, "Intel Panther Point", 0}, + {0x8c028086, 0x00, "Intel Lynx Point", 0}, + {0x8c038086, 0x00, "Intel Lynx Point", 0}, + {0x8c048086, 0x00, "Intel Lynx Point", 0}, + {0x8c058086, 0x00, "Intel Lynx Point", 0}, + {0x8c068086, 0x00, "Intel Lynx Point", 0}, + {0x8c078086, 0x00, "Intel Lynx Point", 0}, + {0x8c0e8086, 0x00, "Intel Lynx Point", 0}, + {0x8c0f8086, 0x00, "Intel Lynx Point", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, Modified: stable/9/sys/dev/ata/ata-pci.h ============================================================================== --- stable/9/sys/dev/ata/ata-pci.h Thu Feb 21 15:06:19 2013 (r247097) +++ stable/9/sys/dev/ata/ata-pci.h Thu Feb 21 15:21:25 2013 (r247098) @@ -260,6 +260,19 @@ struct ata_pci_controller { #define ATA_PPT_R5 0x1e0e8086 #define ATA_PPT_R6 0x1e0f8086 +#define ATA_LPT_S1 0x8c008086 +#define ATA_LPT_S2 0x8c018086 +#define ATA_LPT_AH1 0x8c028086 +#define ATA_LPT_AH2 0x8c038086 +#define ATA_LPT_R1 0x8c048086 +#define ATA_LPT_R2 0x8c058086 +#define ATA_LPT_R3 0x8c068086 +#define ATA_LPT_R4 0x8c078086 +#define ATA_LPT_S3 0x8c088086 +#define ATA_LPT_S4 0x8c098086 +#define ATA_LPT_R5 0x8c0e8086 +#define ATA_LPT_R6 0x8c0f8086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 Modified: stable/9/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-intel.c Thu Feb 21 15:06:19 2013 (r247097) +++ stable/9/sys/dev/ata/chipsets/ata-intel.c Thu Feb 21 15:21:25 2013 (r247098) @@ -211,6 +211,18 @@ ata_intel_probe(device_t dev) { ATA_PPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_LPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R4, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 15:22:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C054E405; Thu, 21 Feb 2013 15:22:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B22FACD9; Thu, 21 Feb 2013 15:22:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LFMtFY065743; Thu, 21 Feb 2013 15:22:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LFMtVs065740; Thu, 21 Feb 2013 15:22:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211522.r1LFMtVs065740@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 15:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247099 - in stable/8/sys/dev: ahci ata ata/chipsets X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 15:22:55 -0000 Author: mav Date: Thu Feb 21 15:22:54 2013 New Revision: 247099 URL: http://svnweb.freebsd.org/changeset/base/247099 Log: MFC r244983 (by jfv): Add Intel Lynx Point PCH SATA Controller Device IDs Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/chipsets/ata-intel.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/ahci/ (props changed) stable/8/sys/dev/ata/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Thu Feb 21 15:21:25 2013 (r247098) +++ stable/8/sys/dev/ahci/ahci.c Thu Feb 21 15:22:54 2013 (r247099) @@ -186,6 +186,14 @@ static struct { {0x1e078086, 0x00, "Intel Panther Point", 0}, {0x1e0e8086, 0x00, "Intel Panther Point", 0}, {0x1e0f8086, 0x00, "Intel Panther Point", 0}, + {0x8c028086, 0x00, "Intel Lynx Point", 0}, + {0x8c038086, 0x00, "Intel Lynx Point", 0}, + {0x8c048086, 0x00, "Intel Lynx Point", 0}, + {0x8c058086, 0x00, "Intel Lynx Point", 0}, + {0x8c068086, 0x00, "Intel Lynx Point", 0}, + {0x8c078086, 0x00, "Intel Lynx Point", 0}, + {0x8c0e8086, 0x00, "Intel Lynx Point", 0}, + {0x8c0f8086, 0x00, "Intel Lynx Point", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Thu Feb 21 15:21:25 2013 (r247098) +++ stable/8/sys/dev/ata/ata-pci.h Thu Feb 21 15:22:54 2013 (r247099) @@ -260,6 +260,19 @@ struct ata_pci_controller { #define ATA_PPT_R5 0x1e0e8086 #define ATA_PPT_R6 0x1e0f8086 +#define ATA_LPT_S1 0x8c008086 +#define ATA_LPT_S2 0x8c018086 +#define ATA_LPT_AH1 0x8c028086 +#define ATA_LPT_AH2 0x8c038086 +#define ATA_LPT_R1 0x8c048086 +#define ATA_LPT_R2 0x8c058086 +#define ATA_LPT_R3 0x8c068086 +#define ATA_LPT_R4 0x8c078086 +#define ATA_LPT_S3 0x8c088086 +#define ATA_LPT_S4 0x8c098086 +#define ATA_LPT_R5 0x8c0e8086 +#define ATA_LPT_R6 0x8c0f8086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Thu Feb 21 15:21:25 2013 (r247098) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Thu Feb 21 15:22:54 2013 (r247099) @@ -211,6 +211,18 @@ ata_intel_probe(device_t dev) { ATA_PPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_LPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R4, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 15:26:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1E6FA7BD; Thu, 21 Feb 2013 15:26:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 113B5D12; Thu, 21 Feb 2013 15:26:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LFQQC4066329; Thu, 21 Feb 2013 15:26:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LFQQKM066328; Thu, 21 Feb 2013 15:26:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211526.r1LFQQKM066328@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 15:26:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247100 - stable/8/sys/dev/ahci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 15:26:27 -0000 Author: mav Date: Thu Feb 21 15:26:26 2013 New Revision: 247100 URL: http://svnweb.freebsd.org/changeset/base/247100 Log: MFC r236242: Add quirk for Marvell based AHCI controller. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/ahci/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Thu Feb 21 15:22:54 2013 (r247099) +++ stable/8/sys/dev/ahci/ahci.c Thu Feb 21 15:26:26 2013 (r247100) @@ -215,6 +215,7 @@ static struct { {0x91231b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_SATA2|AHCI_Q_NOBSYRES}, {0x91251b4b, 0x00, "Marvell 88SE9125", AHCI_Q_NOBSYRES}, {0x91281b4b, 0x00, "Marvell 88SE9128", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, + {0x91301b4b, 0x00, "Marvell 88SE9130", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, {0x91721b4b, 0x00, "Marvell 88SE9172", AHCI_Q_NOBSYRES}, {0x91821b4b, 0x00, "Marvell 88SE9182", AHCI_Q_NOBSYRES}, {0x92201b4b, 0x00, "Marvell 88SE9220", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 16:59:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A5F26DF8; Thu, 21 Feb 2013 16:59:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7FBED6C6; Thu, 21 Feb 2013 16:59:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LGxTkV094093; Thu, 21 Feb 2013 16:59:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LGxTtB094091; Thu, 21 Feb 2013 16:59:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211659.r1LGxTtB094091@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 16:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247103 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 16:59:29 -0000 Author: mav Date: Thu Feb 21 16:59:28 2013 New Revision: 247103 URL: http://svnweb.freebsd.org/changeset/base/247103 Log: MFC r238379, r238382 (by bruefer): Renamed the kern.cam.da.da_send_ordered sysctl and tunable to kern.cam.da.send_ordered, more in line with the other da sysctls/tunables. Renamed the kern.cam.ada.ada_send_ordered sysctl and tunable to kern.cam.ada.send_ordered, more in line with the other da sysctls/tunables. PR: 169765 Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Thu Feb 21 15:41:09 2013 (r247102) +++ stable/9/sys/cam/ata/ata_da.c Thu Feb 21 16:59:28 2013 (r247103) @@ -478,9 +478,9 @@ TUNABLE_INT("kern.cam.ada.retry_count", SYSCTL_INT(_kern_cam_ada, OID_AUTO, default_timeout, CTLFLAG_RW, &ada_default_timeout, 0, "Normal I/O timeout (in seconds)"); TUNABLE_INT("kern.cam.ada.default_timeout", &ada_default_timeout); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, ada_send_ordered, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, send_ordered, CTLFLAG_RW, &ada_send_ordered, 0, "Send Ordered Tags"); -TUNABLE_INT("kern.cam.ada.ada_send_ordered", &ada_send_ordered); +TUNABLE_INT("kern.cam.ada.send_ordered", &ada_send_ordered); SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RW, &ada_spindown_shutdown, 0, "Spin down upon shutdown"); TUNABLE_INT("kern.cam.ada.spindown_shutdown", &ada_spindown_shutdown); Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Thu Feb 21 15:41:09 2013 (r247102) +++ stable/9/sys/cam/scsi/scsi_da.c Thu Feb 21 16:59:28 2013 (r247103) @@ -897,9 +897,9 @@ TUNABLE_INT("kern.cam.da.retry_count", & SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RW, &da_default_timeout, 0, "Normal I/O timeout (in seconds)"); TUNABLE_INT("kern.cam.da.default_timeout", &da_default_timeout); -SYSCTL_INT(_kern_cam_da, OID_AUTO, da_send_ordered, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_da, OID_AUTO, send_ordered, CTLFLAG_RW, &da_send_ordered, 0, "Send Ordered Tags"); -TUNABLE_INT("kern.cam.da.da_send_ordered", &da_send_ordered); +TUNABLE_INT("kern.cam.da.send_ordered", &da_send_ordered); /* * DA_ORDEREDTAG_INTERVAL determines how often, relative From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 17:00:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8EAE79A; Thu, 21 Feb 2013 17:00:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6890F6EE; Thu, 21 Feb 2013 17:00:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LH0cCq094615; Thu, 21 Feb 2013 17:00:38 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LH0cp7094612; Thu, 21 Feb 2013 17:00:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211700.r1LH0cp7094612@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 17:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247105 - in stable/8/sys/cam: ata scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 17:00:38 -0000 Author: mav Date: Thu Feb 21 17:00:37 2013 New Revision: 247105 URL: http://svnweb.freebsd.org/changeset/base/247105 Log: MFC r238379, r238382 (by bruefer): Renamed the kern.cam.da.da_send_ordered sysctl and tunable to kern.cam.da.send_ordered, more in line with the other da sysctls/tunables. Renamed the kern.cam.ada.ada_send_ordered sysctl and tunable to kern.cam.ada.send_ordered, more in line with the other da sysctls/tunables. PR: 169765 Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Thu Feb 21 17:00:35 2013 (r247104) +++ stable/8/sys/cam/ata/ata_da.c Thu Feb 21 17:00:37 2013 (r247105) @@ -471,9 +471,9 @@ TUNABLE_INT("kern.cam.ada.retry_count", SYSCTL_INT(_kern_cam_ada, OID_AUTO, default_timeout, CTLFLAG_RW, &ada_default_timeout, 0, "Normal I/O timeout (in seconds)"); TUNABLE_INT("kern.cam.ada.default_timeout", &ada_default_timeout); -SYSCTL_INT(_kern_cam_ada, OID_AUTO, ada_send_ordered, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_ada, OID_AUTO, send_ordered, CTLFLAG_RW, &ada_send_ordered, 0, "Send Ordered Tags"); -TUNABLE_INT("kern.cam.ada.ada_send_ordered", &ada_send_ordered); +TUNABLE_INT("kern.cam.ada.send_ordered", &ada_send_ordered); SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RW, &ada_spindown_shutdown, 0, "Spin down upon shutdown"); TUNABLE_INT("kern.cam.ada.spindown_shutdown", &ada_spindown_shutdown); Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Thu Feb 21 17:00:35 2013 (r247104) +++ stable/8/sys/cam/scsi/scsi_da.c Thu Feb 21 17:00:37 2013 (r247105) @@ -873,9 +873,9 @@ TUNABLE_INT("kern.cam.da.retry_count", & SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RW, &da_default_timeout, 0, "Normal I/O timeout (in seconds)"); TUNABLE_INT("kern.cam.da.default_timeout", &da_default_timeout); -SYSCTL_INT(_kern_cam_da, OID_AUTO, da_send_ordered, CTLFLAG_RW, +SYSCTL_INT(_kern_cam_da, OID_AUTO, send_ordered, CTLFLAG_RW, &da_send_ordered, 0, "Send Ordered Tags"); -TUNABLE_INT("kern.cam.da.da_send_ordered", &da_send_ordered); +TUNABLE_INT("kern.cam.da.send_ordered", &da_send_ordered); /* * DA_ORDEREDTAG_INTERVAL determines how often, relative From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 18:15:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 497FC9A3; Thu, 21 Feb 2013 18:15:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3B01BE1D; Thu, 21 Feb 2013 18:15:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LIFhko019081; Thu, 21 Feb 2013 18:15:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LIFgxv019074; Thu, 21 Feb 2013 18:15:42 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211815.r1LIFgxv019074@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 18:15:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247111 - in stable/9/sys/cam: . scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 18:15:43 -0000 Author: mav Date: Thu Feb 21 18:15:41 2013 New Revision: 247111 URL: http://svnweb.freebsd.org/changeset/base/247111 Log: MFC r230590 (by ken) except parts changing ABI: Add CAM infrastructure to allow reporting when a drive's long read capacity data changes. Modified: stable/9/sys/cam/cam_ccb.h stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt_internal.h stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/dev/puc/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/cam/cam_ccb.h ============================================================================== --- stable/9/sys/cam/cam_ccb.h Thu Feb 21 17:54:14 2013 (r247110) +++ stable/9/sys/cam/cam_ccb.h Thu Feb 21 18:15:41 2013 (r247111) @@ -1128,6 +1128,7 @@ struct ccb_dev_advinfo { #define CDAI_TYPE_SCSI_DEVID 1 #define CDAI_TYPE_SERIAL_NUM 2 #define CDAI_TYPE_PHYS_PATH 3 +#define CDAI_TYPE_RCAPLONG 4 off_t bufsiz; /* IN: Size of external buffer */ #define CAM_SCSI_DEVID_MAXLEN 65536 /* length in buffer is an uint16_t */ off_t provsiz; /* OUT: Size required/used */ Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Thu Feb 21 17:54:14 2013 (r247110) +++ stable/9/sys/cam/cam_xpt.c Thu Feb 21 18:15:41 2013 (r247111) @@ -4616,6 +4616,17 @@ xpt_release_device(struct cam_ed *device cam_devq_resize(devq, devq->alloc_queue.array_size - 1); camq_fini(&device->drvq); cam_ccbq_fini(&device->ccbq); + /* + * Free allocated memory. free(9) does nothing if the + * supplied pointer is NULL, so it is safe to call without + * checking. + */ + free(device->supported_vpds, M_CAMXPT); + free(device->device_id, M_CAMXPT); + free(device->physpath, M_CAMXPT); + free(device->rcap_buf, M_CAMXPT); + free(device->serial_num, M_CAMXPT); + xpt_release_target(device->target); free(device, M_CAMDEV); } else Modified: stable/9/sys/cam/cam_xpt_internal.h ============================================================================== --- stable/9/sys/cam/cam_xpt_internal.h Thu Feb 21 17:54:14 2013 (r247110) +++ stable/9/sys/cam/cam_xpt_internal.h Thu Feb 21 18:15:41 2013 (r247111) @@ -99,6 +99,8 @@ struct cam_ed { uint8_t *device_id; uint8_t physpath_len; uint8_t *physpath; /* physical path string form */ + uint32_t rcap_len; + uint8_t *rcap_buf; struct ata_params ident_data; u_int8_t inq_flags; /* * Current settings for inquiry flags. Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Thu Feb 21 17:54:14 2013 (r247110) +++ stable/9/sys/cam/scsi/scsi_all.h Thu Feb 21 18:15:41 2013 (r247111) @@ -1444,14 +1444,24 @@ struct scsi_read_capacity_data_long uint8_t length[4]; #define SRC16_PROT_EN 0x01 #define SRC16_P_TYPE 0x0e +#define SRC16_PTYPE_1 0x00 +#define SRC16_PTYPE_2 0x02 +#define SRC16_PTYPE_3 0x04 uint8_t prot; #define SRC16_LBPPBE 0x0f #define SRC16_PI_EXPONENT 0xf0 #define SRC16_PI_EXPONENT_SHIFT 4 uint8_t prot_lbppbe; -#define SRC16_LALBA 0x3fff -#define SRC16_LBPRZ 0x4000 -#define SRC16_LBPME 0x8000 +#define SRC16_LALBA 0x3f +#define SRC16_LBPRZ 0x40 +#define SRC16_LBPME 0x80 +/* + * Alternate versions of these macros that are intended for use on a 16-bit + * version of the lalba_lbp field instead of the array of 2 8 bit numbers. + */ +#define SRC16_LALBA_A 0x3fff +#define SRC16_LBPRZ_A 0x4000 +#define SRC16_LBPME_A 0x8000 uint8_t lalba_lbp[2]; }; Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Thu Feb 21 17:54:14 2013 (r247110) +++ stable/9/sys/cam/scsi/scsi_da.c Thu Feb 21 18:15:41 2013 (r247111) @@ -159,6 +159,7 @@ struct da_softc { struct callout sendordered_c; uint64_t wwpn; uint8_t unmap_buf[UNMAP_MAX_RANGES * 16 + 8]; + struct scsi_read_capacity_data_long rcaplong; }; struct da_quirk_entry { @@ -868,7 +869,9 @@ static int daerror(union ccb *ccb, u_i static void daprevent(struct cam_periph *periph, int action); static int dagetcapacity(struct cam_periph *periph); static void dasetgeom(struct cam_periph *periph, uint32_t block_len, - uint64_t maxsector, u_int lbppbe, u_int lalba); + uint64_t maxsector, + struct scsi_read_capacity_data_long *rcaplong, + size_t rcap_size); static timeout_t dasendorderedtag; static void dashutdown(void *arg, int howto); @@ -2262,10 +2265,15 @@ dadone(struct cam_periph *periph, union announce_buf[0] = '\0'; cam_periph_invalidate(periph); } else { + /* + * We pass rcaplong into dasetgeom(), + * because it will only use it if it is + * non-NULL. + */ dasetgeom(periph, block_size, maxsector, - lbppbe, lalba & SRC16_LALBA); - if ((lalba & SRC16_LBPME) && - softc->delete_method == DA_DELETE_NONE) + rcaplong, sizeof(*rcaplong)); + if ((lalba & SRC16_LBPME_A) + && softc->delete_method == DA_DELETE_NONE) softc->delete_method = DA_DELETE_UNMAP; dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), @@ -2539,6 +2547,7 @@ dagetcapacity(struct cam_periph *periph) lalba = 0; error = 0; rc16failed = 0; + rcaplong = NULL; sense_flags = SF_RETRY_UA; if (softc->flags & DA_FLAG_PACK_REMOVABLE) sense_flags |= SF_NO_PRINT; @@ -2556,39 +2565,46 @@ dagetcapacity(struct cam_periph *periph) /* Try READ CAPACITY(16) first if we think it should work. */ if (softc->flags & DA_FLAG_CAN_RC16) { scsi_read_capacity_16(&ccb->csio, - /*retries*/ 4, - /*cbfcnp*/ dadone, - /*tag_action*/ MSG_SIMPLE_Q_TAG, - /*lba*/ 0, - /*reladr*/ 0, - /*pmi*/ 0, - rcaplong, - /*sense_len*/ SSD_FULL_SIZE, - /*timeout*/ 60000); + /*retries*/ 4, + /*cbfcnp*/ dadone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*lba*/ 0, + /*reladr*/ 0, + /*pmi*/ 0, + /*rcap_buf*/ rcaplong, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 60000); ccb->ccb_h.ccb_bp = NULL; error = cam_periph_runccb(ccb, daerror, - /*cam_flags*/CAM_RETRY_SELTO, - sense_flags, - softc->disk->d_devstat); + /*cam_flags*/CAM_RETRY_SELTO, + sense_flags, softc->disk->d_devstat); if (error == 0) goto rc16ok; /* If we got ILLEGAL REQUEST, do not prefer RC16 any more. */ - if ((ccb->ccb_h.status & CAM_STATUS_MASK) == - CAM_REQ_INVALID) { + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { softc->flags &= ~DA_FLAG_CAN_RC16; } else if (((ccb->ccb_h.status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) && - (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND) && - (ccb->ccb_h.status & CAM_AUTOSNS_VALID) && - ((ccb->ccb_h.flags & CAM_SENSE_PHYS) == 0) && - ((ccb->ccb_h.flags & CAM_SENSE_PTR) == 0)) { + CAM_SCSI_STATUS_ERROR) + && (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND) + && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) + && ((ccb->ccb_h.flags & CAM_SENSE_PHYS) == 0) + && ((ccb->ccb_h.flags & CAM_SENSE_PTR) == 0)) { int sense_key, error_code, asc, ascq; - scsi_extract_sense(&ccb->csio.sense_data, - &error_code, &sense_key, &asc, &ascq); - if (sense_key == SSD_KEY_ILLEGAL_REQUEST) + scsi_extract_sense_len(&ccb->csio.sense_data, + ccb->csio.sense_len - + ccb->csio.sense_resid, + &error_code, &sense_key, + &asc, &ascq, /*show_errors*/1); + /* + * If we don't have enough sense to get the sense + * key, or if it's illegal request, turn off + * READ CAPACITY (16). + */ + if ((sense_key == -1) + || (sense_key == SSD_KEY_ILLEGAL_REQUEST)) softc->flags &= ~DA_FLAG_CAN_RC16; } rc16failed = 1; @@ -2652,9 +2668,9 @@ done: error = EINVAL; } else { dasetgeom(periph, block_len, maxsector, - lbppbe, lalba & SRC16_LALBA); - if ((lalba & SRC16_LBPME) && - softc->delete_method == DA_DELETE_NONE) + rcaplong, sizeof(*rcaplong)); + if ((lalba & SRC16_LBPME) + && softc->delete_method == DA_DELETE_NONE) softc->delete_method = DA_DELETE_UNMAP; } } @@ -2668,17 +2684,27 @@ done: static void dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector, - u_int lbppbe, u_int lalba) + struct scsi_read_capacity_data_long *rcaplong, size_t rcap_len) { struct ccb_calc_geometry ccg; struct da_softc *softc; struct disk_params *dp; + u_int lbppbe, lalba; softc = (struct da_softc *)periph->softc; dp = &softc->params; dp->secsize = block_len; dp->sectors = maxsector + 1; + if (rcaplong != NULL) { + lbppbe = rcaplong->prot_lbppbe & SRC16_LBPPBE; + lalba = scsi_2btoul(rcaplong->lalba_lbp); + lalba &= SRC16_LALBA_A; + } else { + lbppbe = 0; + lalba = 0; + } + if (lbppbe > 0) { dp->stripesize = block_len << lbppbe; dp->stripeoffset = (dp->stripesize - block_len * lalba) % @@ -2723,6 +2749,38 @@ dasetgeom(struct cam_periph *periph, uin dp->secs_per_track = ccg.secs_per_track; dp->cylinders = ccg.cylinders; } + + /* + * If the user supplied a read capacity buffer, and if it is + * different than the previous buffer, update the data in the EDT. + * If it's the same, we don't bother. This avoids sending an + * update every time someone opens this device. + */ + if ((rcaplong != NULL) + && (bcmp(rcaplong, &softc->rcaplong, + min(sizeof(softc->rcaplong), rcap_len)) != 0)) { + struct ccb_dev_advinfo cdai; + + xpt_setup_ccb(&cdai.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + cdai.ccb_h.func_code = XPT_DEV_ADVINFO; + cdai.buftype = CDAI_TYPE_RCAPLONG; + cdai.flags |= CDAI_FLAG_STORE; + cdai.bufsiz = rcap_len; + cdai.buf = (uint8_t *)rcaplong; + xpt_action((union ccb *)&cdai); + if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE); + if (cdai.ccb_h.status != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: failed to set read " + "capacity advinfo\n", __func__); + /* Use cam_error_print() to decode the status */ + cam_error_print((union ccb *)&cdai, CAM_ESF_CAM_STATUS, + CAM_EPF_ALL); + } else { + bcopy(rcaplong, &softc->rcaplong, + min(sizeof(softc->rcaplong), rcap_len)); + } + } } static void Modified: stable/9/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_xpt.c Thu Feb 21 17:54:14 2013 (r247110) +++ stable/9/sys/cam/scsi/scsi_xpt.c Thu Feb 21 18:15:41 2013 (r247111) @@ -2473,8 +2473,10 @@ scsi_dev_advinfo(union ccb *start_ccb) break; case CDAI_TYPE_PHYS_PATH: if (cdai->flags & CDAI_FLAG_STORE) { - if (device->physpath != NULL) + if (device->physpath != NULL) { free(device->physpath, M_CAMXPT); + device->physpath = NULL; + } device->physpath_len = cdai->bufsiz; /* Clear existing buffer if zero length */ if (cdai->bufsiz == 0) @@ -2495,6 +2497,36 @@ scsi_dev_advinfo(union ccb *start_ccb) memcpy(cdai->buf, device->physpath, amt); } break; + case CDAI_TYPE_RCAPLONG: + if (cdai->flags & CDAI_FLAG_STORE) { + if (device->rcap_buf != NULL) { + free(device->rcap_buf, M_CAMXPT); + device->rcap_buf = NULL; + } + + device->rcap_len = cdai->bufsiz; + /* Clear existing buffer if zero length */ + if (cdai->bufsiz == 0) + break; + + device->rcap_buf = malloc(cdai->bufsiz, M_CAMXPT, + M_NOWAIT); + if (device->rcap_buf == NULL) { + start_ccb->ccb_h.status = CAM_REQ_ABORTED; + return; + } + + memcpy(device->rcap_buf, cdai->buf, cdai->bufsiz); + } else { + cdai->provsiz = device->rcap_len; + if (device->rcap_len == 0) + break; + amt = device->rcap_len; + if (cdai->provsiz > cdai->bufsiz) + amt = cdai->bufsiz; + memcpy(cdai->buf, device->rcap_buf, amt); + } + break; default: return; } From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 18:41:36 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 18B86F7D; Thu, 21 Feb 2013 18:41:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 06015F9E; Thu, 21 Feb 2013 18:41:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LIfZW6027262; Thu, 21 Feb 2013 18:41:35 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LIfZ5m027261; Thu, 21 Feb 2013 18:41:35 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302211841.r1LIfZ5m027261@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 21 Feb 2013 18:41:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247112 - stable/9/share/mk X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 18:41:36 -0000 Author: pfg Date: Thu Feb 21 18:41:35 2013 New Revision: 247112 URL: http://svnweb.freebsd.org/changeset/base/247112 Log: MFC r237574: Ensure crunchen uses the same make binary as the rest of the build. I actually had already merged the crunchgen part of it as part of the the enhanced ELF support. Discussed with: Simon Gerraty Modified: stable/9/share/mk/bsd.crunchgen.mk Directory Properties: stable/9/ (props changed) stable/9/share/ (props changed) stable/9/share/mk/ (props changed) Modified: stable/9/share/mk/bsd.crunchgen.mk ============================================================================== --- stable/9/share/mk/bsd.crunchgen.mk Thu Feb 21 18:15:41 2013 (r247111) +++ stable/9/share/mk/bsd.crunchgen.mk Thu Feb 21 18:41:35 2013 (r247112) @@ -100,7 +100,7 @@ $(CONF): Makefile .MAKEFLAGS:= ${.MAKEFLAGS:N-P} .ORDER: $(OUTPUTS) objs $(OUTPUTS): $(CONF) - MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -fq -m $(OUTMK) \ + MAKE=${MAKE} MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -fq -m $(OUTMK) \ -c $(OUTC) $(CONF) $(PROG): $(OUTPUTS) objs From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 18:49:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 37644734; Thu, 21 Feb 2013 18:49:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 232F9FD; Thu, 21 Feb 2013 18:49:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LIn5gn028296; Thu, 21 Feb 2013 18:49:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LIn5SM028294; Thu, 21 Feb 2013 18:49:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211849.r1LIn5SM028294@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 18:49:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247113 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 18:49:06 -0000 Author: mav Date: Thu Feb 21 18:49:05 2013 New Revision: 247113 URL: http://svnweb.freebsd.org/changeset/base/247113 Log: MFC r236138 (by ken) for recently merged scsi_enc.c: Work around a race condition in devfs by changing the way closes are handled in most CAM peripheral drivers that are not handled by GEOM's disk class. The usual character driver open and close semantics are that the driver gets N open calls, but only one close, when the last caller closes the device. CAM peripheral drivers expect that behavior to be honored to the letter, and the CAM peripheral driver code (specifically cam_periph_release_locked_busses()) panics if it is done incorrectly. Since devfs has to drop its locks while it calls a driver's close routine, and it does not have a way to delay or prevent open calls while it is calling the close routine, there is a race. The sequence of events, simplified a bit, is: - devfs acquires a lock - devfs checks the reference count, and if it is 1, continues to close. - devfs releases the lock - 2nd process open call on the device happens here - devfs calls the driver's close routine - devfs acquires a lock - devfs decrements the reference count - devfs releases the lock - 2nd process close call on the device happens here At the second close, we get a panic in cam_periph_release_locked_busses(), complaining that peripheral has been released when the reference count is already 0. This is because we have gotten two closes in a row, which should not happen. The fix is to add the D_TRACKCLOSE flag to the driver's cdevsw, so that we get a close() call for each open(). That does happen reliably, so we can make sure that our reference counts are correct. Note that the sa(4) and pt(4) drivers only allow one context through the open routine. So these drivers aren't exposed to the same race condition. scsi_ch.c, scsi_enc.c, scsi_enc_internal.h, scsi_pass.c, scsi_sg.c: For these drivers, change the open() routine to increment the reference count for every open, and just decrement the reference count in the close. Call cam_periph_release_locked() in some scenarios to avoid additional lock and unlock calls. scsi_pt.c: Call cam_periph_release_locked() in some scenarios to avoid additional lock and unlock calls. Modified: stable/9/sys/cam/scsi/scsi_enc.c Modified: stable/9/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_enc.c Thu Feb 21 18:41:35 2013 (r247112) +++ stable/9/sys/cam/scsi/scsi_enc.c Thu Feb 21 18:49:05 2013 (r247113) @@ -88,7 +88,7 @@ static struct cdevsw enc_cdevsw = { .d_close = enc_close, .d_ioctl = enc_ioctl, .d_name = "ses", - .d_flags = 0, + .d_flags = D_TRACKCLOSE, }; static void @@ -249,12 +249,12 @@ enc_open(struct cdev *dev, int flags, in error = ENXIO; goto out; } - out: + if (error != 0) + cam_periph_release_locked(periph); + cam_periph_unlock(periph); - if (error) { - cam_periph_release(periph); - } + return (error); } @@ -262,17 +262,11 @@ static int enc_close(struct cdev *dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; - struct enc_softc *softc; periph = (struct cam_periph *)dev->si_drv1; if (periph == NULL) return (ENXIO); - cam_periph_lock(periph); - - softc = (struct enc_softc *)periph->softc; - - cam_periph_unlock(periph); cam_periph_release(periph); return (0); From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 18:56:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 907CFA28; Thu, 21 Feb 2013 18:56:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7CF7615E; Thu, 21 Feb 2013 18:56:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LIuAdg030896; Thu, 21 Feb 2013 18:56:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LIuAjO030895; Thu, 21 Feb 2013 18:56:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211856.r1LIuAjO030895@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 18:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247114 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 18:56:10 -0000 Author: mav Date: Thu Feb 21 18:56:09 2013 New Revision: 247114 URL: http://svnweb.freebsd.org/changeset/base/247114 Log: MFC r237328 (by ken) for recently merged scsi_enc.c: Fix several reference counting and object lifetime issues between the pass(4) and enc(4) drivers and devfs. The pass(4) driver uses the destroy_dev_sched() routine to schedule its device node for destruction in a separate thread context. It does this because the passcleanup() routine can get called indirectly from the passclose() routine, and that would cause a deadlock if the close routine tried to destroy its own device node. In any case, once a particular passthrough driver number, e.g. pass3, is destroyed, CAM considers that unit number (3 in this case) available for reuse. The problem is that devfs may not be done cleaning up the previous instance of pass3, and will panic if isn't done cleaning up the previous instance. The solution is to get a callback from devfs when the device node is removed, and make sure we hold a reference to the peripheral until that happens. Testing exposed some other cases where we have reference counting issues, and those were also fixed in the pass(4) driver. cam_periph.c: In camperiphfree(), reorder some of the operations. The peripheral destructor needs to be called before the peripheral is removed from the peripheral is removed from the list. This is because once we remove the peripheral from the list, and drop the topology lock, the peripheral number may be reused. But if the destructor hasn't been called yet, there may still be resources hanging around (like devfs nodes) that haven't been fully cleaned up. cam_xpt.c: Add an argument to xpt_remove_periph() to indicate whether the topology lock is already held. scsi_enc.c: Acquire an extra reference to the peripheral during registration, and release it once we get a callback from devfs indicating that the device node is gone. Call destroy_dev_sched_cb() in enc_oninvalidate() instead of calling destroy_dev() in the cleanup routine. scsi_pass.c: Add reference counting to handle peripheral and devfs object lifetime issues. Add a reference to the peripheral and the devfs node in the peripheral registration. Don't attempt to add a physical path alias if the peripheral has been marked invalid. Release the devfs reference once the initial physical path alias taskqueue run has completed. Schedule devfs node destruction in the passoninvalidate(), and release our peripheral reference in a new routine, passdevgonecb() once the devfs node is gone. This allows the peripheral to fully go away, and the peripheral destructor, passcleanup(), will get called. Modified: stable/9/sys/cam/scsi/scsi_enc.c Modified: stable/9/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_enc.c Thu Feb 21 18:49:05 2013 (r247113) +++ stable/9/sys/cam/scsi/scsi_enc.c Thu Feb 21 18:56:09 2013 (r247114) @@ -109,6 +109,16 @@ enc_init(void) } static void +enc_devgonecb(void *arg) +{ + struct cam_periph *periph; + + periph = (struct cam_periph *)arg; + + cam_periph_release(periph); +} + +static void enc_oninvalidate(struct cam_periph *periph) { struct enc_softc *enc; @@ -136,6 +146,8 @@ enc_oninvalidate(struct cam_periph *peri } callout_drain(&enc->status_updater); + destroy_dev_sched_cb(enc->enc_dev, enc_devgonecb, periph); + xpt_print(periph->path, "lost device\n"); } @@ -147,9 +159,7 @@ enc_dtor(struct cam_periph *periph) enc = periph->softc; xpt_print(periph->path, "removing device entry\n"); - cam_periph_unlock(periph); - destroy_dev(enc->enc_dev); - cam_periph_lock(periph); + /* If the sub-driver has a cleanup routine, call it */ if (enc->enc_vec.softc_cleanup != NULL) @@ -935,9 +945,19 @@ enc_ctor(struct cam_periph *periph, void goto out; } } + + if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: lost periph during " + "registration!\n", __func__); + cam_periph_lock(periph); + + return (CAM_REQ_CMP_ERR); + } + enc->enc_dev = make_dev(&enc_cdevsw, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); + cam_periph_lock(periph); enc->enc_dev->si_drv1 = periph; From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 19:02:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8CF74E55; Thu, 21 Feb 2013 19:02:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6F7D91D8; Thu, 21 Feb 2013 19:02:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LJ2UiF033618; Thu, 21 Feb 2013 19:02:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LJ2TWQ033610; Thu, 21 Feb 2013 19:02:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211902.r1LJ2TWQ033610@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 19:02:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247115 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 19:02:30 -0000 Author: mav Date: Thu Feb 21 19:02:29 2013 New Revision: 247115 URL: http://svnweb.freebsd.org/changeset/base/247115 Log: MFC r244014 (by ken): Fix a device departure bug for the the pass(4), enc(4), sg(4) and ch(4) drivers. The bug occurrs when a userland process has the driver instance open and the underlying device goes away. We get the devfs callback that the device node has been destroyed, but not all of the closes necessary to fully decrement the reference count on the CAM peripheral. The reason is that once devfs calls back and says the device has been destroyed, it is moved off to deadfs, and devfs guarantees that there will be no more open or close calls. So the solution is to keep track of how many outstanding open calls there are on the device, and just release that many references when we get the callback from devfs. scsi_pass.c, scsi_enc.c, scsi_enc_internal.h: Add an open count to the softc in these drivers. Increment it on open and decrement it on close. When we get a devfs callback to say that the device node has gone away, decrement the peripheral reference count by the number of still outstanding opens. Make sure we don't access the peripheral with cam_periph_unlock() after what might be the final call to cam_periph_release_locked(). The peripheral might have been freed, and we will be dereferencing freed memory. scsi_ch.c, scsi_sg.c: For the ch(4) and sg(4) drivers, add the same changes described above, and in addition, fix another bug that was previously fixed in the pass(4) and enc(4) drivers. These drivers were calling destroy_dev() from their cleanup routine, but that could cause a deadlock because the cleanup routine could be indirectly called from the driver's close routine. This would cause a deadlock, because the device node is being held open by the active close call, and can't be destroyed. Modified: stable/9/sys/cam/scsi/scsi_ch.c stable/9/sys/cam/scsi/scsi_enc.c stable/9/sys/cam/scsi/scsi_enc_internal.h stable/9/sys/cam/scsi/scsi_pass.c stable/9/sys/cam/scsi/scsi_sg.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_ch.c Thu Feb 21 18:56:09 2013 (r247114) +++ stable/9/sys/cam/scsi/scsi_ch.c Thu Feb 21 19:02:29 2013 (r247115) @@ -144,7 +144,8 @@ struct ch_softc { ch_quirks quirks; union ccb saved_ccb; struct devstat *device_stats; - struct cdev *dev; + struct cdev *dev; + int open_count; int sc_picker; /* current picker */ @@ -237,6 +238,48 @@ chinit(void) } static void +chdevgonecb(void *arg) +{ + struct cam_sim *sim; + struct ch_softc *softc; + struct cam_periph *periph; + int i; + + periph = (struct cam_periph *)arg; + sim = periph->sim; + softc = (struct ch_softc *)periph->softc; + + KASSERT(softc->open_count >= 0, ("Negative open count %d", + softc->open_count)); + + mtx_lock(sim->mtx); + + /* + * When we get this callback, we will get no more close calls from + * devfs. So if we have any dangling opens, we need to release the + * reference held for that particular context. + */ + for (i = 0; i < softc->open_count; i++) + cam_periph_release_locked(periph); + + softc->open_count = 0; + + /* + * Release the reference held for the device node, it is gone now. + */ + cam_periph_release_locked(periph); + + /* + * We reference the SIM lock directly here, instead of using + * cam_periph_unlock(). The reason is that the final call to + * cam_periph_release_locked() above could result in the periph + * getting freed. If that is the case, dereferencing the periph + * with a cam_periph_unlock() call would cause a page fault. + */ + mtx_unlock(sim->mtx); +} + +static void choninvalidate(struct cam_periph *periph) { struct ch_softc *softc; @@ -250,6 +293,12 @@ choninvalidate(struct cam_periph *periph softc->flags |= CH_FLAG_INVALID; + /* + * Tell devfs this device has gone away, and ask for a callback + * when it has cleaned up its state. + */ + destroy_dev_sched_cb(softc->dev, chdevgonecb, periph); + xpt_print(periph->path, "lost device\n"); } @@ -262,10 +311,9 @@ chcleanup(struct cam_periph *periph) softc = (struct ch_softc *)periph->softc; xpt_print(periph->path, "removing device entry\n"); + devstat_remove_entry(softc->device_stats); - cam_periph_unlock(periph); - destroy_dev(softc->dev); - cam_periph_lock(periph); + free(softc, M_DEVBUF); } @@ -359,6 +407,19 @@ chregister(struct cam_periph *periph, vo XPORT_DEVSTAT_TYPE(cpi.transport), DEVSTAT_PRIORITY_OTHER); + /* + * Acquire a reference to the periph before we create the devfs + * instance for it. We'll release this reference once the devfs + * instance has been freed. + */ + if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: lost periph during " + "registration!\n", __func__); + cam_periph_lock(periph); + return (CAM_REQ_CMP_ERR); + } + + /* Register the device */ softc->dev = make_dev(&ch_cdevsw, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, @@ -419,6 +480,9 @@ chopen(struct cdev *dev, int flags, int } cam_periph_unhold(periph); + + softc->open_count++; + cam_periph_unlock(periph); return(error); @@ -427,13 +491,36 @@ chopen(struct cdev *dev, int flags, int static int chclose(struct cdev *dev, int flag, int fmt, struct thread *td) { + struct cam_sim *sim; struct cam_periph *periph; + struct ch_softc *softc; periph = (struct cam_periph *)dev->si_drv1; if (periph == NULL) return(ENXIO); - cam_periph_release(periph); + sim = periph->sim; + softc = (struct ch_softc *)periph->softc; + + mtx_lock(sim->mtx); + + softc->open_count--; + + cam_periph_release_locked(periph); + + /* + * We reference the SIM lock directly here, instead of using + * cam_periph_unlock(). The reason is that the call to + * cam_periph_release_locked() above could result in the periph + * getting freed. If that is the case, dereferencing the periph + * with a cam_periph_unlock() call would cause a page fault. + * + * cam_periph_release() avoids this problem using the same method, + * but we're manually acquiring and dropping the lock here to + * protect the open count and avoid another lock acquisition and + * release. + */ + mtx_unlock(sim->mtx); return(0); } Modified: stable/9/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_enc.c Thu Feb 21 18:56:09 2013 (r247114) +++ stable/9/sys/cam/scsi/scsi_enc.c Thu Feb 21 19:02:29 2013 (r247115) @@ -111,11 +111,40 @@ enc_init(void) static void enc_devgonecb(void *arg) { + struct cam_sim *sim; struct cam_periph *periph; + struct enc_softc *enc; + int i; periph = (struct cam_periph *)arg; + sim = periph->sim; + enc = (struct enc_softc *)periph->softc; + + mtx_lock(sim->mtx); + + /* + * When we get this callback, we will get no more close calls from + * devfs. So if we have any dangling opens, we need to release the + * reference held for that particular context. + */ + for (i = 0; i < enc->open_count; i++) + cam_periph_release_locked(periph); - cam_periph_release(periph); + enc->open_count = 0; + + /* + * Release the reference held for the device node, it is gone now. + */ + cam_periph_release_locked(periph); + + /* + * We reference the SIM lock directly here, instead of using + * cam_periph_unlock(). The reason is that the final call to + * cam_periph_release_locked() above could result in the periph + * getting freed. If that is the case, dereferencing the periph + * with a cam_periph_unlock() call would cause a page fault. + */ + mtx_unlock(sim->mtx); } static void @@ -262,6 +291,8 @@ enc_open(struct cdev *dev, int flags, in out: if (error != 0) cam_periph_release_locked(periph); + else + softc->open_count++; cam_periph_unlock(periph); @@ -271,13 +302,36 @@ out: static int enc_close(struct cdev *dev, int flag, int fmt, struct thread *td) { + struct cam_sim *sim; struct cam_periph *periph; + struct enc_softc *enc; periph = (struct cam_periph *)dev->si_drv1; if (periph == NULL) return (ENXIO); - cam_periph_release(periph); + sim = periph->sim; + enc = periph->softc; + + mtx_lock(sim->mtx); + + enc->open_count--; + + cam_periph_release_locked(periph); + + /* + * We reference the SIM lock directly here, instead of using + * cam_periph_unlock(). The reason is that the call to + * cam_periph_release_locked() above could result in the periph + * getting freed. If that is the case, dereferencing the periph + * with a cam_periph_unlock() call would cause a page fault. + * + * cam_periph_release() avoids this problem using the same method, + * but we're manually acquiring and dropping the lock here to + * protect the open count and avoid another lock acquisition and + * release. + */ + mtx_unlock(sim->mtx); return (0); } @@ -946,6 +1000,11 @@ enc_ctor(struct cam_periph *periph, void } } + /* + * Acquire a reference to the periph before we create the devfs + * instance for it. We'll release this reference once the devfs + * instance has been freed. + */ if (cam_periph_acquire(periph) != CAM_REQ_CMP) { xpt_print(periph->path, "%s: lost periph during " "registration!\n", __func__); Modified: stable/9/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_enc_internal.h Thu Feb 21 18:56:09 2013 (r247114) +++ stable/9/sys/cam/scsi/scsi_enc_internal.h Thu Feb 21 19:02:29 2013 (r247115) @@ -148,6 +148,7 @@ struct enc_softc { union ccb saved_ccb; struct cdev *enc_dev; struct cam_periph *periph; + int open_count; /* Bitmap of pending operations. */ uint32_t pending_actions; Modified: stable/9/sys/cam/scsi/scsi_pass.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_pass.c Thu Feb 21 18:56:09 2013 (r247114) +++ stable/9/sys/cam/scsi/scsi_pass.c Thu Feb 21 19:02:29 2013 (r247115) @@ -76,6 +76,7 @@ struct pass_softc { pass_flags flags; u_int8_t pd_type; union ccb saved_ccb; + int open_count; struct devstat *device_stats; struct cdev *dev; struct cdev *alias_dev; @@ -140,12 +141,43 @@ passinit(void) static void passdevgonecb(void *arg) { + struct cam_sim *sim; struct cam_periph *periph; + struct pass_softc *softc; + int i; periph = (struct cam_periph *)arg; + sim = periph->sim; + softc = (struct pass_softc *)periph->softc; + + KASSERT(softc->open_count >= 0, ("Negative open count %d", + softc->open_count)); + + mtx_lock(sim->mtx); + + /* + * When we get this callback, we will get no more close calls from + * devfs. So if we have any dangling opens, we need to release the + * reference held for that particular context. + */ + for (i = 0; i < softc->open_count; i++) + cam_periph_release_locked(periph); + + softc->open_count = 0; + + /* + * Release the reference held for the device node, it is gone now. + */ + cam_periph_release_locked(periph); - xpt_print(periph->path, "%s: devfs entry is gone\n", __func__); - cam_periph_release(periph); + /* + * We reference the SIM lock directly here, instead of using + * cam_periph_unlock(). The reason is that the final call to + * cam_periph_release_locked() above could result in the periph + * getting freed. If that is the case, dereferencing the periph + * with a cam_periph_unlock() call would cause a page fault. + */ + mtx_unlock(sim->mtx); } static void @@ -368,7 +400,7 @@ passregister(struct cam_periph *periph, if (cam_periph_acquire(periph) != CAM_REQ_CMP) { xpt_print(periph->path, "%s: lost periph during " "registration!\n", __func__); - mtx_lock(periph->sim->mtx); + cam_periph_lock(periph); return (CAM_REQ_CMP_ERR); } @@ -461,6 +493,8 @@ passopen(struct cdev *dev, int flags, in return(EINVAL); } + softc->open_count++; + cam_periph_unlock(periph); return (error); @@ -469,13 +503,36 @@ passopen(struct cdev *dev, int flags, in static int passclose(struct cdev *dev, int flag, int fmt, struct thread *td) { + struct cam_sim *sim; struct cam_periph *periph; + struct pass_softc *softc; periph = (struct cam_periph *)dev->si_drv1; if (periph == NULL) return (ENXIO); - cam_periph_release(periph); + sim = periph->sim; + softc = periph->softc; + + mtx_lock(sim->mtx); + + softc->open_count--; + + cam_periph_release_locked(periph); + + /* + * We reference the SIM lock directly here, instead of using + * cam_periph_unlock(). The reason is that the call to + * cam_periph_release_locked() above could result in the periph + * getting freed. If that is the case, dereferencing the periph + * with a cam_periph_unlock() call would cause a page fault. + * + * cam_periph_release() avoids this problem using the same method, + * but we're manually acquiring and dropping the lock here to + * protect the open count and avoid another lock acquisition and + * release. + */ + mtx_unlock(sim->mtx); return (0); } Modified: stable/9/sys/cam/scsi/scsi_sg.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_sg.c Thu Feb 21 18:56:09 2013 (r247114) +++ stable/9/sys/cam/scsi/scsi_sg.c Thu Feb 21 19:02:29 2013 (r247115) @@ -99,6 +99,7 @@ struct sg_rdwr { struct sg_softc { sg_state state; sg_flags flags; + int open_count; struct devstat *device_stats; TAILQ_HEAD(, sg_rdwr) rdwr_done; struct cdev *dev; @@ -169,6 +170,49 @@ sginit(void) } static void +sgdevgonecb(void *arg) +{ + struct cam_sim *sim; + struct cam_periph *periph; + struct sg_softc *softc; + int i; + + periph = (struct cam_periph *)arg; + sim = periph->sim; + softc = (struct sg_softc *)periph->softc; + + KASSERT(softc->open_count >= 0, ("Negative open count %d", + softc->open_count)); + + mtx_lock(sim->mtx); + + /* + * When we get this callback, we will get no more close calls from + * devfs. So if we have any dangling opens, we need to release the + * reference held for that particular context. + */ + for (i = 0; i < softc->open_count; i++) + cam_periph_release_locked(periph); + + softc->open_count = 0; + + /* + * Release the reference held for the device node, it is gone now. + */ + cam_periph_release_locked(periph); + + /* + * We reference the SIM lock directly here, instead of using + * cam_periph_unlock(). The reason is that the final call to + * cam_periph_release_locked() above could result in the periph + * getting freed. If that is the case, dereferencing the periph + * with a cam_periph_unlock() call would cause a page fault. + */ + mtx_unlock(sim->mtx); +} + + +static void sgoninvalidate(struct cam_periph *periph) { struct sg_softc *softc; @@ -183,6 +227,12 @@ sgoninvalidate(struct cam_periph *periph softc->flags |= SG_FLAG_INVALID; /* + * Tell devfs this device has gone away, and ask for a callback + * when it has cleaned up its state. + */ + destroy_dev_sched_cb(softc->dev, sgdevgonecb, periph); + + /* * XXX Return all queued I/O with ENXIO. * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. @@ -201,10 +251,9 @@ sgcleanup(struct cam_periph *periph) softc = (struct sg_softc *)periph->softc; if (bootverbose) xpt_print(periph->path, "removing device entry\n"); + devstat_remove_entry(softc->device_stats); - cam_periph_unlock(periph); - destroy_dev(softc->dev); - cam_periph_lock(periph); + free(softc, M_DEVBUF); } @@ -299,6 +348,18 @@ sgregister(struct cam_periph *periph, vo DEVSTAT_TYPE_PASS, DEVSTAT_PRIORITY_PASS); + /* + * Acquire a reference to the periph before we create the devfs + * instance for it. We'll release this reference once the devfs + * instance has been freed. + */ + if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: lost periph during " + "registration!\n", __func__); + cam_periph_lock(periph); + return (CAM_REQ_CMP_ERR); + } + /* Register the device */ softc->dev = make_dev(&sg_cdevsw, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", @@ -414,6 +475,8 @@ sgopen(struct cdev *dev, int flags, int return (ENXIO); } + softc->open_count++; + cam_periph_unlock(periph); return (error); @@ -422,13 +485,36 @@ sgopen(struct cdev *dev, int flags, int static int sgclose(struct cdev *dev, int flag, int fmt, struct thread *td) { + struct cam_sim *sim; struct cam_periph *periph; + struct sg_softc *softc; periph = (struct cam_periph *)dev->si_drv1; if (periph == NULL) return (ENXIO); - cam_periph_release(periph); + sim = periph->sim; + softc = periph->softc; + + mtx_lock(sim->mtx); + + softc->open_count--; + + cam_periph_release_locked(periph); + + /* + * We reference the SIM lock directly here, instead of using + * cam_periph_unlock(). The reason is that the call to + * cam_periph_release_locked() above could result in the periph + * getting freed. If that is the case, dereferencing the periph + * with a cam_periph_unlock() call would cause a page fault. + * + * cam_periph_release() avoids this problem using the same method, + * but we're manually acquiring and dropping the lock here to + * protect the open count and avoid another lock acquisition and + * release. + */ + mtx_unlock(sim->mtx); return (0); } From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 19:23:36 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 266F4930; Thu, 21 Feb 2013 19:23:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0113D319; Thu, 21 Feb 2013 19:23:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LJNZQc040450; Thu, 21 Feb 2013 19:23:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LJNZw0040449; Thu, 21 Feb 2013 19:23:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211923.r1LJNZw0040449@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 19:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247118 - stable/8/sys/geom/raid X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 19:23:36 -0000 Author: mav Date: Thu Feb 21 19:23:35 2013 New Revision: 247118 URL: http://svnweb.freebsd.org/changeset/base/247118 Log: MFC r239175: Add missing FAILED event to g_raid_subdisk_event2str() to print it properly in debug messages. Modified: stable/8/sys/geom/raid/g_raid.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/geom/ (props changed) Modified: stable/8/sys/geom/raid/g_raid.c ============================================================================== --- stable/8/sys/geom/raid/g_raid.c Thu Feb 21 19:13:19 2013 (r247117) +++ stable/8/sys/geom/raid/g_raid.c Thu Feb 21 19:23:35 2013 (r247118) @@ -224,6 +224,8 @@ g_raid_subdisk_event2str(int event) switch (event) { case G_RAID_SUBDISK_E_NEW: return ("NEW"); + case G_RAID_SUBDISK_E_FAILED: + return ("FAILED"); case G_RAID_SUBDISK_E_DISCONNECTED: return ("DISCONNECTED"); default: From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 19:35:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 766D9D0A; Thu, 21 Feb 2013 19:35:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 63EA83E2; Thu, 21 Feb 2013 19:35:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LJZkNj043743; Thu, 21 Feb 2013 19:35:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LJZkoj043742; Thu, 21 Feb 2013 19:35:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211935.r1LJZkoj043742@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 19:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247119 - stable/8/sys/geom/raid X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 19:35:46 -0000 Author: mav Date: Thu Feb 21 19:35:45 2013 New Revision: 247119 URL: http://svnweb.freebsd.org/changeset/base/247119 Log: MFC r241418: NULL-ify last previously used pointer instead of last possible pointer. This should be only a cosmetic change. Modified: stable/8/sys/geom/raid/md_promise.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/geom/ (props changed) Modified: stable/8/sys/geom/raid/md_promise.c ============================================================================== --- stable/8/sys/geom/raid/md_promise.c Thu Feb 21 19:23:35 2013 (r247118) +++ stable/8/sys/geom/raid/md_promise.c Thu Feb 21 19:35:45 2013 (r247119) @@ -590,7 +590,7 @@ g_raid_md_promise_purge_disks(struct g_r free(pd->pd_meta[i], M_MD_PROMISE); for (j = i; j < pd->pd_subdisks - 1; j++) pd->pd_meta[j] = pd->pd_meta[j + 1]; - pd->pd_meta[PROMISE_MAX_SUBDISKS - 1] = NULL; + pd->pd_meta[pd->pd_subdisks - 1] = NULL; pd->pd_subdisks--; pd->pd_updated = 1; } @@ -695,7 +695,7 @@ g_raid_md_promise_start_disk(struct g_ra free(pd->pd_meta[sdn], M_MD_PROMISE); for (i = sdn; i < pd->pd_subdisks - 1; i++) pd->pd_meta[i] = pd->pd_meta[i + 1]; - pd->pd_meta[PROMISE_MAX_SUBDISKS - 1] = NULL; + pd->pd_meta[pd->pd_subdisks - 1] = NULL; pd->pd_subdisks--; } /* If we are in the start process, that's all for now. */ @@ -1144,7 +1144,7 @@ g_raid_md_taste_promise(struct g_raid_md free(metaarr[i], M_MD_PROMISE); for (j = i; j < subdisks - 1; j++) metaarr[i] = metaarr[j + 1]; - metaarr[PROMISE_MAX_SUBDISKS - 1] = NULL; + metaarr[subdisks - 1] = NULL; subdisks--; } From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 19:40:47 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E56DFFBA; Thu, 21 Feb 2013 19:40:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D772F633; Thu, 21 Feb 2013 19:40:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LJelvW046073; Thu, 21 Feb 2013 19:40:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LJelQu046071; Thu, 21 Feb 2013 19:40:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211940.r1LJelQu046071@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 19:40:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247120 - stable/9/sys/dev/sound/pci/hda X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 19:40:48 -0000 Author: mav Date: Thu Feb 21 19:40:46 2013 New Revision: 247120 URL: http://svnweb.freebsd.org/changeset/base/247120 Log: MFC r244980 (by jvf): Add Intel Lynx Point PCH HD Audio Device IDs Modified: stable/9/sys/dev/sound/pci/hda/hdac.c stable/9/sys/dev/sound/pci/hda/hdac.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/9/sys/dev/sound/pci/hda/hdac.c Thu Feb 21 19:35:45 2013 (r247119) +++ stable/9/sys/dev/sound/pci/hda/hdac.c Thu Feb 21 19:40:46 2013 (r247120) @@ -81,6 +81,8 @@ static const struct { { HDA_INTEL_CPT, "Intel Cougar Point", 0, 0 }, { HDA_INTEL_PATSBURG,"Intel Patsburg", 0, 0 }, { HDA_INTEL_PPT1, "Intel Panther Point", 0, 0 }, + { HDA_INTEL_LPT1, "Intel Lynx Point", 0, 0 }, + { HDA_INTEL_LPT2, "Intel Lynx Point", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: stable/9/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/9/sys/dev/sound/pci/hda/hdac.h Thu Feb 21 19:35:45 2013 (r247119) +++ stable/9/sys/dev/sound/pci/hda/hdac.h Thu Feb 21 19:40:46 2013 (r247120) @@ -54,6 +54,8 @@ #define HDA_INTEL_PCH HDA_MODEL_CONSTRUCT(INTEL, 0x3b56) #define HDA_INTEL_PCH2 HDA_MODEL_CONSTRUCT(INTEL, 0x3b57) #define HDA_INTEL_SCH HDA_MODEL_CONSTRUCT(INTEL, 0x811b) +#define HDA_INTEL_LPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x8c20) +#define HDA_INTEL_LPT2 HDA_MODEL_CONSTRUCT(INTEL, 0x8c21) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 19:44:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9A4DE228; Thu, 21 Feb 2013 19:44:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8CCA968A; Thu, 21 Feb 2013 19:44:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LJi6KO046615; Thu, 21 Feb 2013 19:44:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LJi5kC046613; Thu, 21 Feb 2013 19:44:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302211944.r1LJi5kC046613@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 19:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247121 - stable/8/sys/dev/sound/pci/hda X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 19:44:06 -0000 Author: mav Date: Thu Feb 21 19:44:05 2013 New Revision: 247121 URL: http://svnweb.freebsd.org/changeset/base/247121 Log: MFC r244980 (by jvf): Add Intel Lynx Point PCH HD Audio Device IDs Modified: stable/8/sys/dev/sound/pci/hda/hdac.c stable/8/sys/dev/sound/pci/hda/hdac.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/sound/ (props changed) stable/8/sys/dev/sound/pci/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Thu Feb 21 19:40:46 2013 (r247120) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Thu Feb 21 19:44:05 2013 (r247121) @@ -81,6 +81,8 @@ static const struct { { HDA_INTEL_CPT, "Intel Cougar Point", 0, 0 }, { HDA_INTEL_PATSBURG,"Intel Patsburg", 0, 0 }, { HDA_INTEL_PPT1, "Intel Panther Point", 0, 0 }, + { HDA_INTEL_LPT1, "Intel Lynx Point", 0, 0 }, + { HDA_INTEL_LPT2, "Intel Lynx Point", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: stable/8/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.h Thu Feb 21 19:40:46 2013 (r247120) +++ stable/8/sys/dev/sound/pci/hda/hdac.h Thu Feb 21 19:44:05 2013 (r247121) @@ -54,6 +54,8 @@ #define HDA_INTEL_PCH HDA_MODEL_CONSTRUCT(INTEL, 0x3b56) #define HDA_INTEL_PCH2 HDA_MODEL_CONSTRUCT(INTEL, 0x3b57) #define HDA_INTEL_SCH HDA_MODEL_CONSTRUCT(INTEL, 0x811b) +#define HDA_INTEL_LPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x8c20) +#define HDA_INTEL_LPT2 HDA_MODEL_CONSTRUCT(INTEL, 0x8c21) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 20:24:01 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CB1B5443; Thu, 21 Feb 2013 20:24:01 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B8EE98F0; Thu, 21 Feb 2013 20:24:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LKO135059080; Thu, 21 Feb 2013 20:24:01 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LKO1Fp059078; Thu, 21 Feb 2013 20:24:01 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201302212024.r1LKO1Fp059078@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 21 Feb 2013 20:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247123 - stable/9/lib/libc/stdlib X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 20:24:01 -0000 Author: pluknet Date: Thu Feb 21 20:24:00 2013 New Revision: 247123 URL: http://svnweb.freebsd.org/changeset/base/247123 Log: MFC r238802: Update the 'C1x draft' reference to '.St -isoC-2011' mdoc macro. Modified: stable/9/lib/libc/stdlib/at_quick_exit.3 stable/9/lib/libc/stdlib/quick_exit.3 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/lib/libc/sys/ (props changed) stable/9/lib/libc/uuid/ (props changed) Modified: stable/9/lib/libc/stdlib/at_quick_exit.3 ============================================================================== --- stable/9/lib/libc/stdlib/at_quick_exit.3 Thu Feb 21 20:13:15 2013 (r247122) +++ stable/9/lib/libc/stdlib/at_quick_exit.3 Thu Feb 21 20:24:00 2013 (r247123) @@ -58,4 +58,5 @@ function returns the value 0 if successf .Sh STANDARDS The .Fn at_quick_exit -function conforms to the C1x draft specification. +function conforms to +.St -isoC-2011 . Modified: stable/9/lib/libc/stdlib/quick_exit.3 ============================================================================== --- stable/9/lib/libc/stdlib/quick_exit.3 Thu Feb 21 20:13:15 2013 (r247122) +++ stable/9/lib/libc/stdlib/quick_exit.3 Thu Feb 21 20:24:00 2013 (r247123) @@ -54,4 +54,5 @@ function does not return. .Sh STANDARDS The .Fn quick_exit -function conforms to the C1x draft specification. +function conforms to +.St -isoC-2011 . From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 20:28:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 61DA161A; Thu, 21 Feb 2013 20:28:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 54292926; Thu, 21 Feb 2013 20:28:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LKSh76059780; Thu, 21 Feb 2013 20:28:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LKShwL059779; Thu, 21 Feb 2013 20:28:43 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302212028.r1LKShwL059779@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 20:28:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247124 - stable/9/sys/dev/ata X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 20:28:43 -0000 Author: mav Date: Thu Feb 21 20:28:42 2013 New Revision: 247124 URL: http://svnweb.freebsd.org/changeset/base/247124 Log: MFC r226064 (by wxs): Fix a typo in a comment. Modified: stable/9/sys/dev/ata/ata-all.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ata/ata-all.c ============================================================================== --- stable/9/sys/dev/ata/ata-all.c Thu Feb 21 20:24:00 2013 (r247123) +++ stable/9/sys/dev/ata/ata-all.c Thu Feb 21 20:28:42 2013 (r247124) @@ -869,7 +869,7 @@ ata_boot_attach(void) mtx_lock(&Giant); /* newbus suckage it needs Giant */ - /* kick of probe and attach on all channels */ + /* kick off probe and attach on all channels */ for (ctlr = 0; ctlr < devclass_get_maxunit(ata_devclass); ctlr++) { if ((ch = devclass_get_softc(ata_devclass, ctlr))) { ata_identify(ch->dev); From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 20:29:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 43A1C79B; Thu, 21 Feb 2013 20:29:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2BBDF936; Thu, 21 Feb 2013 20:29:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LKTiUh059960; Thu, 21 Feb 2013 20:29:44 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LKTi0m059959; Thu, 21 Feb 2013 20:29:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302212029.r1LKTi0m059959@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Feb 2013 20:29:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247125 - stable/8/sys/dev/ata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 20:29:44 -0000 Author: mav Date: Thu Feb 21 20:29:43 2013 New Revision: 247125 URL: http://svnweb.freebsd.org/changeset/base/247125 Log: MFC r226064 (by wxs): Fix a typo in a comment. Modified: stable/8/sys/dev/ata/ata-all.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/ata/ (props changed) Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Thu Feb 21 20:28:42 2013 (r247124) +++ stable/8/sys/dev/ata/ata-all.c Thu Feb 21 20:29:43 2013 (r247125) @@ -868,7 +868,7 @@ ata_boot_attach(void) mtx_lock(&Giant); /* newbus suckage it needs Giant */ - /* kick of probe and attach on all channels */ + /* kick off probe and attach on all channels */ for (ctlr = 0; ctlr < devclass_get_maxunit(ata_devclass); ctlr++) { if ((ch = devclass_get_softc(ata_devclass, ctlr))) { ata_identify(ch->dev); From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 20:40:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0A67D9CA; Thu, 21 Feb 2013 20:40:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DBF499A3; Thu, 21 Feb 2013 20:40:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LKeb1n063220; Thu, 21 Feb 2013 20:40:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LKebap063219; Thu, 21 Feb 2013 20:40:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302212040.r1LKebap063219@svn.freebsd.org> From: Xin LI Date: Thu, 21 Feb 2013 20:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org Subject: svn commit: r247126 - stable/6/lib/libc/gen X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 20:40:38 -0000 Author: delphij Date: Thu Feb 21 20:40:37 2013 New Revision: 247126 URL: http://svnweb.freebsd.org/changeset/base/247126 Log: MFC: r158812 (ache): Reflect size_t changes in glob.h Obtained from: NetBSD (mostly) r159294: - ANSIfy. - Remove two unnecessary casts. r243779 (marcel): Protect against DoS attacks, such as being described in CVE-2010-2632. The changes were derived from what has been committed to NetBSD, with modifications. This fixes FreeBSD-SA-13:02.libc for stable/6. Modified: stable/6/lib/libc/gen/glob.c Directory Properties: stable/6/lib/libc/ (props changed) Modified: stable/6/lib/libc/gen/glob.c ============================================================================== --- stable/6/lib/libc/gen/glob.c Thu Feb 21 20:29:43 2013 (r247125) +++ stable/6/lib/libc/gen/glob.c Thu Feb 21 20:40:37 2013 (r247126) @@ -93,6 +93,25 @@ __FBSDID("$FreeBSD$"); #include "collate.h" +/* + * glob(3) expansion limits. Stop the expansion if any of these limits + * is reached. This caps the runtime in the face of DoS attacks. See + * also CVE-2010-2632 + */ +#define GLOB_LIMIT_BRACE 128 /* number of brace calls */ +#define GLOB_LIMIT_PATH 65536 /* number of path elements */ +#define GLOB_LIMIT_READDIR 16384 /* number of readdirs */ +#define GLOB_LIMIT_STAT 1024 /* number of stat system calls */ +#define GLOB_LIMIT_STRING ARG_MAX /* maximum total size for paths */ + +struct glob_limit { + size_t l_brace_cnt; + size_t l_path_lim; + size_t l_readdir_cnt; + size_t l_stat_cnt; + size_t l_string_cnt; +}; + #define DOLLAR '$' #define DOT '.' #define EOS '\0' @@ -144,7 +163,7 @@ typedef char Char; static int compare(const void *, const void *); -static int g_Ctoc(const Char *, char *, u_int); +static int g_Ctoc(const Char *, char *, size_t); static int g_lstat(Char *, struct stat *, glob_t *); static DIR *g_opendir(Char *, glob_t *); static Char *g_strchr(Char *, wchar_t); @@ -152,34 +171,34 @@ static Char *g_strchr(Char *, wchar_t); static Char *g_strcat(Char *, const Char *); #endif static int g_stat(Char *, struct stat *, glob_t *); -static int glob0(const Char *, glob_t *, int *); -static int glob1(Char *, glob_t *, int *); -static int glob2(Char *, Char *, Char *, Char *, glob_t *, int *); -static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, int *); -static int globextend(const Char *, glob_t *, int *); -static const Char * +static int glob0(const Char *, glob_t *, struct glob_limit *); +static int glob1(Char *, glob_t *, struct glob_limit *); +static int glob2(Char *, Char *, Char *, Char *, glob_t *, + struct glob_limit *); +static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, + struct glob_limit *); +static int globextend(const Char *, glob_t *, struct glob_limit *); +static const Char * globtilde(const Char *, Char *, size_t, glob_t *); -static int globexp1(const Char *, glob_t *, int *); -static int globexp2(const Char *, const Char *, glob_t *, int *, int *); +static int globexp1(const Char *, glob_t *, struct glob_limit *); +static int globexp2(const Char *, const Char *, glob_t *, int *, + struct glob_limit *); static int match(Char *, Char *, Char *); #ifdef DEBUG static void qprintf(const char *, Char *); #endif int -glob(pattern, flags, errfunc, pglob) - const char *pattern; - int flags, (*errfunc)(const char *, int); - glob_t *pglob; +glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob) { - const u_char *patnext; - int limit; + struct glob_limit limit = { 0, 0, 0, 0, 0 }; + const char *patnext; Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot; mbstate_t mbs; wchar_t wc; size_t clen; - patnext = (u_char *) pattern; + patnext = pattern; if (!(flags & GLOB_APPEND)) { pglob->gl_pathc = 0; pglob->gl_pathv = NULL; @@ -187,11 +206,10 @@ glob(pattern, flags, errfunc, pglob) pglob->gl_offs = 0; } if (flags & GLOB_LIMIT) { - limit = pglob->gl_matchc; - if (limit == 0) - limit = ARG_MAX; - } else - limit = 0; + limit.l_path_lim = pglob->gl_matchc; + if (limit.l_path_lim == 0) + limit.l_path_lim = GLOB_LIMIT_PATH; + } pglob->gl_flags = flags & ~GLOB_MAGCHAR; pglob->gl_errfunc = errfunc; pglob->gl_matchc = 0; @@ -244,14 +262,17 @@ glob(pattern, flags, errfunc, pglob) * characters */ static int -globexp1(pattern, pglob, limit) - const Char *pattern; - glob_t *pglob; - int *limit; +globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit) { const Char* ptr = pattern; int rv; + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) { + errno = 0; + return (GLOB_NOSPACE); + } + /* Protect a single {}, for find(1), like csh */ if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS) return glob0(pattern, pglob, limit); @@ -270,10 +291,8 @@ globexp1(pattern, pglob, limit) * If it fails then it tries to glob the rest of the pattern and returns. */ static int -globexp2(ptr, pattern, pglob, rv, limit) - const Char *ptr, *pattern; - glob_t *pglob; - int *rv, *limit; +globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, + struct glob_limit *limit) { int i; Char *lm, *ls; @@ -377,11 +396,7 @@ globexp2(ptr, pattern, pglob, rv, limit) * expand tilde from the passwd file. */ static const Char * -globtilde(pattern, patbuf, patbuf_len, pglob) - const Char *pattern; - Char *patbuf; - size_t patbuf_len; - glob_t *pglob; +globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob) { struct passwd *pwd; char *h; @@ -447,13 +462,11 @@ globtilde(pattern, patbuf, patbuf_len, p * if things went well, nonzero if errors occurred. */ static int -glob0(pattern, pglob, limit) - const Char *pattern; - glob_t *pglob; - int *limit; +glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit) { const Char *qpatnext; - int c, err, oldpathc; + int c, err; + size_t oldpathc; Char *bufnext, patbuf[MAXPATHLEN]; qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob); @@ -536,17 +549,13 @@ glob0(pattern, pglob, limit) } static int -compare(p, q) - const void *p, *q; +compare(const void *p, const void *q) { return(strcmp(*(char **)p, *(char **)q)); } static int -glob1(pattern, pglob, limit) - Char *pattern; - glob_t *pglob; - int *limit; +glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit) { Char pathbuf[MAXPATHLEN]; @@ -563,10 +572,8 @@ glob1(pattern, pglob, limit) * meta characters. */ static int -glob2(pathbuf, pathend, pathend_last, pattern, pglob, limit) - Char *pathbuf, *pathend, *pathend_last, *pattern; - glob_t *pglob; - int *limit; +glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern, + glob_t *pglob, struct glob_limit *limit) { struct stat sb; Char *p, *q; @@ -582,6 +589,15 @@ glob2(pathbuf, pathend, pathend_last, pa if (g_lstat(pathbuf, &sb, pglob)) return(0); + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) { + errno = 0; + if (pathend + 1 > pathend_last) + return (GLOB_ABORTED); + *pathend++ = SEP; + *pathend = EOS; + return (GLOB_NOSPACE); + } if (((pglob->gl_flags & GLOB_MARK) && pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) || (S_ISLNK(sb.st_mode) && @@ -623,10 +639,9 @@ glob2(pathbuf, pathend, pathend_last, pa } static int -glob3(pathbuf, pathend, pathend_last, pattern, restpattern, pglob, limit) - Char *pathbuf, *pathend, *pathend_last, *pattern, *restpattern; - glob_t *pglob; - int *limit; +glob3(Char *pathbuf, Char *pathend, Char *pathend_last, + Char *pattern, Char *restpattern, + glob_t *pglob, struct glob_limit *limit) { struct dirent *dp; DIR *dirp; @@ -666,18 +681,31 @@ glob3(pathbuf, pathend, pathend_last, pa else readdirfunc = readdir; while ((dp = (*readdirfunc)(dirp))) { - u_char *sc; + char *sc; Char *dc; wchar_t wc; size_t clen; mbstate_t mbs; + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) { + errno = 0; + if (pathend + 1 > pathend_last) + err = GLOB_ABORTED; + else { + *pathend++ = SEP; + *pathend = EOS; + err = GLOB_NOSPACE; + } + break; + } + /* Initial DOT must be matched literally. */ if (dp->d_name[0] == DOT && *pattern != DOT) continue; memset(&mbs, 0, sizeof(mbs)); dc = pathend; - sc = (u_char *) dp->d_name; + sc = dp->d_name; while (dc < pathend_last) { clen = mbrtowc(&wc, sc, MB_LEN_MAX, &mbs); if (clen == (size_t)-1 || clen == (size_t)-2) { @@ -722,18 +750,15 @@ glob3(pathbuf, pathend, pathend_last, pa * gl_pathv points to (gl_offs + gl_pathc + 1) items. */ static int -globextend(path, pglob, limit) - const Char *path; - glob_t *pglob; - int *limit; +globextend(const Char *path, glob_t *pglob, struct glob_limit *limit) { char **pathv; - int i; - u_int newsize, len; + size_t i, newsize, len; char *copy; const Char *p; - if (*limit && pglob->gl_pathc > *limit) { + if ((pglob->gl_flags & GLOB_LIMIT) && + pglob->gl_matchc > limit->l_path_lim) { errno = 0; return (GLOB_NOSPACE); } @@ -753,7 +778,7 @@ globextend(path, pglob, limit) if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { /* first time around -- clear initial gl_offs items */ pathv += pglob->gl_offs; - for (i = pglob->gl_offs; --i >= 0; ) + for (i = pglob->gl_offs + 1; --i > 0; ) *--pathv = NULL; } pglob->gl_pathv = pathv; @@ -761,6 +786,12 @@ globextend(path, pglob, limit) for (p = path; *p++;) continue; len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */ + limit->l_string_cnt += len; + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_string_cnt >= GLOB_LIMIT_STRING) { + errno = 0; + return (GLOB_NOSPACE); + } if ((copy = malloc(len)) != NULL) { if (g_Ctoc(path, copy, len)) { free(copy); @@ -777,8 +808,7 @@ globextend(path, pglob, limit) * pattern causes a recursion level. */ static int -match(name, pat, patend) - Char *name, *pat, *patend; +match(Char *name, Char *pat, Char *patend) { int ok, negate_range; Char c, k; @@ -829,10 +859,9 @@ match(name, pat, patend) /* Free allocated data belonging to a glob_t structure. */ void -globfree(pglob) - glob_t *pglob; +globfree(glob_t *pglob) { - int i; + size_t i; char **pp; if (pglob->gl_pathv != NULL) { @@ -846,9 +875,7 @@ globfree(pglob) } static DIR * -g_opendir(str, pglob) - Char *str; - glob_t *pglob; +g_opendir(Char *str, glob_t *pglob) { char buf[MAXPATHLEN]; @@ -866,10 +893,7 @@ g_opendir(str, pglob) } static int -g_lstat(fn, sb, pglob) - Char *fn; - struct stat *sb; - glob_t *pglob; +g_lstat(Char *fn, struct stat *sb, glob_t *pglob) { char buf[MAXPATHLEN]; @@ -883,10 +907,7 @@ g_lstat(fn, sb, pglob) } static int -g_stat(fn, sb, pglob) - Char *fn; - struct stat *sb; - glob_t *pglob; +g_stat(Char *fn, struct stat *sb, glob_t *pglob) { char buf[MAXPATHLEN]; @@ -900,10 +921,9 @@ g_stat(fn, sb, pglob) } static Char * -g_strchr(str, ch) - Char *str; - wchar_t ch; +g_strchr(Char *str, wchar_t ch) { + do { if (*str == ch) return (str); @@ -912,10 +932,7 @@ g_strchr(str, ch) } static int -g_Ctoc(str, buf, len) - const Char *str; - char *buf; - u_int len; +g_Ctoc(const Char *str, char *buf, size_t len) { mbstate_t mbs; size_t clen; @@ -936,9 +953,7 @@ g_Ctoc(str, buf, len) #ifdef DEBUG static void -qprintf(str, s) - const char *str; - Char *s; +qprintf(const char *str, Char *s) { Char *p; From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 21:48:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1A123E59; Thu, 21 Feb 2013 21:48:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E8101E59; Thu, 21 Feb 2013 21:48:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LLmc0f084901; Thu, 21 Feb 2013 21:48:38 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LLmcoX084900; Thu, 21 Feb 2013 21:48:38 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201302212148.r1LLmcoX084900@svn.freebsd.org> From: Mark Johnston Date: Thu, 21 Feb 2013 21:48:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org Subject: svn commit: r247136 - stable/6/sys/netinet X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 21:48:39 -0000 Author: markj Date: Thu Feb 21 21:48:38 2013 New Revision: 247136 URL: http://svnweb.freebsd.org/changeset/base/247136 Log: MFC r239672 (by rrs): This small change takes care of a race condition that can occur when both sides close at the same time. If that occurs, without this fix the connection enters FIN1 on both sides and they will forever send FIN|ACK at each other until the connection times out. This is because we stopped processing the FIN|ACK and thus did not advance the sequence and so never ACK'd each others FIN. This fix adjusts it so we *do* process the FIN properly and the race goes away ;-) Approved by: emaste (co-mentor) Modified: stable/6/sys/netinet/tcp_input.c Directory Properties: stable/6/sys/ (props changed) Modified: stable/6/sys/netinet/tcp_input.c ============================================================================== --- stable/6/sys/netinet/tcp_input.c Thu Feb 21 21:47:35 2013 (r247135) +++ stable/6/sys/netinet/tcp_input.c Thu Feb 21 21:48:38 2013 (r247136) @@ -1908,6 +1908,16 @@ trimthenstep6: } } else tp->snd_cwnd += tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); goto drop; } else if (tp->t_dupacks == tcprexmtthresh) { @@ -1951,6 +1961,16 @@ trimthenstep6: } tp->snd_nxt = th->th_ack; tp->snd_cwnd = tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("tp->snd_limited too big")); @@ -1974,6 +1994,16 @@ trimthenstep6: (tp->snd_nxt - tp->snd_una) + (tp->t_dupacks - tp->snd_limited) * tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* + * If its a fin we need to process + * it to avoid a race where both + * sides enter FIN-WAIT and send FIN|ACK + * at the same time. + */ + break; + } (void) tcp_output(tp); sent = tp->snd_max - oldsndmax; if (sent > tp->t_maxseg) { From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 22:38:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1AD31BC5; Thu, 21 Feb 2013 22:38:40 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0760B1CF; Thu, 21 Feb 2013 22:38:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LMcdDh000651; Thu, 21 Feb 2013 22:38:39 GMT (envelope-from gshapiro@svn.freebsd.org) Received: (from gshapiro@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LMcdXw000650; Thu, 21 Feb 2013 22:38:39 GMT (envelope-from gshapiro@svn.freebsd.org) Message-Id: <201302212238.r1LMcdXw000650@svn.freebsd.org> From: Gregory Neil Shapiro Date: Thu, 21 Feb 2013 22:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247141 - stable/9/contrib/sendmail/src X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 22:38:40 -0000 Author: gshapiro Date: Thu Feb 21 22:38:39 2013 New Revision: 247141 URL: http://svnweb.freebsd.org/changeset/base/247141 Log: MFC: Merge sendmail 8.14.6 errata issue Modified: stable/9/contrib/sendmail/src/milter.c Directory Properties: stable/9/contrib/sendmail/ (props changed) Modified: stable/9/contrib/sendmail/src/milter.c ============================================================================== --- stable/9/contrib/sendmail/src/milter.c Thu Feb 21 22:21:45 2013 (r247140) +++ stable/9/contrib/sendmail/src/milter.c Thu Feb 21 22:38:39 2013 (r247141) @@ -4048,7 +4048,7 @@ milter_helo(helo, e, state) } response = milter_command(SMFIC_HELO, helo, strlen(helo) + 1, - SMFIM_EOH, e, state, "helo", false); + SMFIM_HELO, e, state, "helo", false); milter_per_connection_check(e); return response; } From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 22:46:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 89FA7189; Thu, 21 Feb 2013 22:46:27 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7C3D7249; Thu, 21 Feb 2013 22:46:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LMkRU9003371; Thu, 21 Feb 2013 22:46:27 GMT (envelope-from gshapiro@svn.freebsd.org) Received: (from gshapiro@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LMkRkU003370; Thu, 21 Feb 2013 22:46:27 GMT (envelope-from gshapiro@svn.freebsd.org) Message-Id: <201302212246.r1LMkRkU003370@svn.freebsd.org> From: Gregory Neil Shapiro Date: Thu, 21 Feb 2013 22:46:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247142 - stable/8/contrib/sendmail/src X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 22:46:27 -0000 Author: gshapiro Date: Thu Feb 21 22:46:26 2013 New Revision: 247142 URL: http://svnweb.freebsd.org/changeset/base/247142 Log: MFC: Merge sendmail 8.14.6 errata issue Modified: stable/8/contrib/sendmail/src/milter.c Directory Properties: stable/8/contrib/sendmail/ (props changed) Modified: stable/8/contrib/sendmail/src/milter.c ============================================================================== --- stable/8/contrib/sendmail/src/milter.c Thu Feb 21 22:38:39 2013 (r247141) +++ stable/8/contrib/sendmail/src/milter.c Thu Feb 21 22:46:26 2013 (r247142) @@ -4048,7 +4048,7 @@ milter_helo(helo, e, state) } response = milter_command(SMFIC_HELO, helo, strlen(helo) + 1, - SMFIM_EOH, e, state, "helo", false); + SMFIM_HELO, e, state, "helo", false); milter_per_connection_check(e); return response; } From owner-svn-src-stable@FreeBSD.ORG Thu Feb 21 22:48:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 76EAC301; Thu, 21 Feb 2013 22:48:26 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 68AE425B; Thu, 21 Feb 2013 22:48:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1LMmPqD003704; Thu, 21 Feb 2013 22:48:25 GMT (envelope-from gshapiro@svn.freebsd.org) Received: (from gshapiro@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1LMmPnM003703; Thu, 21 Feb 2013 22:48:25 GMT (envelope-from gshapiro@svn.freebsd.org) Message-Id: <201302212248.r1LMmPnM003703@svn.freebsd.org> From: Gregory Neil Shapiro Date: Thu, 21 Feb 2013 22:48:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r247143 - stable/7/contrib/sendmail/src X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2013 22:48:26 -0000 Author: gshapiro Date: Thu Feb 21 22:48:25 2013 New Revision: 247143 URL: http://svnweb.freebsd.org/changeset/base/247143 Log: MFC: Merge sendmail 8.14.6 errata issue Modified: stable/7/contrib/sendmail/src/milter.c Directory Properties: stable/7/contrib/sendmail/ (props changed) Modified: stable/7/contrib/sendmail/src/milter.c ============================================================================== --- stable/7/contrib/sendmail/src/milter.c Thu Feb 21 22:46:26 2013 (r247142) +++ stable/7/contrib/sendmail/src/milter.c Thu Feb 21 22:48:25 2013 (r247143) @@ -4048,7 +4048,7 @@ milter_helo(helo, e, state) } response = milter_command(SMFIC_HELO, helo, strlen(helo) + 1, - SMFIM_EOH, e, state, "helo", false); + SMFIM_HELO, e, state, "helo", false); milter_per_connection_check(e); return response; } From owner-svn-src-stable@FreeBSD.ORG Fri Feb 22 08:56:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CED427DD; Fri, 22 Feb 2013 08:56:48 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B642EFBD; Fri, 22 Feb 2013 08:56:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1M8umxT092103; Fri, 22 Feb 2013 08:56:48 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1M8um8j092102; Fri, 22 Feb 2013 08:56:48 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201302220856.r1M8um8j092102@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 22 Feb 2013 08:56:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247149 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2013 08:56:48 -0000 Author: pluknet Date: Fri Feb 22 08:56:48 2013 New Revision: 247149 URL: http://svnweb.freebsd.org/changeset/base/247149 Log: MFC r246832: vn_io_faults_cnt: - use u_long consistently - use SYSCTL_ULONG to match the type of variable Modified: stable/9/sys/kern/vfs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Fri Feb 22 08:47:21 2013 (r247148) +++ stable/9/sys/kern/vfs_vnops.c Fri Feb 22 08:56:48 2013 (r247149) @@ -834,8 +834,8 @@ static const int io_hold_cnt = 16; static int vn_io_fault_enable = 0; SYSCTL_INT(_debug, OID_AUTO, vn_io_fault_enable, CTLFLAG_RW, &vn_io_fault_enable, 0, "Enable vn_io_fault lock avoidance"); -static unsigned long vn_io_faults_cnt; -SYSCTL_LONG(_debug, OID_AUTO, vn_io_faults, CTLFLAG_RD, +static u_long vn_io_faults_cnt; +SYSCTL_ULONG(_debug, OID_AUTO, vn_io_faults, CTLFLAG_RD, &vn_io_faults_cnt, 0, "Count of vn_io_fault lock avoidance triggers"); /* From owner-svn-src-stable@FreeBSD.ORG Fri Feb 22 09:47:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AFDE0485; Fri, 22 Feb 2013 09:47:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 97195239; Fri, 22 Feb 2013 09:47:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1M9lLnf007895; Fri, 22 Feb 2013 09:47:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1M9lLmY007894; Fri, 22 Feb 2013 09:47:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302220947.r1M9lLmY007894@svn.freebsd.org> From: Alexander Motin Date: Fri, 22 Feb 2013 09:47:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247150 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2013 09:47:21 -0000 Author: mav Date: Fri Feb 22 09:47:21 2013 New Revision: 247150 URL: http://svnweb.freebsd.org/changeset/base/247150 Log: MFC r242852, r243069: Several optimizations to sched_idletd(): - Do not try to steal load from other CPUs if there was no context switches on this CPU (i.e. it was idle all the time and woke up just for bus mastering or TLB shutdown). If current CPU was idle, then it is quite unlikely that some other CPU has load to steal. Under high I/O rate, when TLB shutdowns cause numerous CPU wakeups, on 24-CPU system load stealing code may consume up to 25% of all CPU time without giving any benefits. - Change code that implements spinning for load to restart spin in case of context switch. Previous code periodically called cpu_idle() even under high interrupt/context switch rate. - Rise spinning threshold to 10KHz, where it gives at least some effect that may worth consumed power. Modified: stable/9/sys/kern/sched_ule.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Fri Feb 22 08:56:48 2013 (r247149) +++ stable/9/sys/kern/sched_ule.c Fri Feb 22 09:47:21 2013 (r247150) @@ -1407,7 +1407,7 @@ sched_initticks(void *dummy) affinity = SCHED_AFFINITY_DEFAULT; #endif if (sched_idlespinthresh < 0) - sched_idlespinthresh = imax(16, 2 * hz / realstathz); + sched_idlespinthresh = 2 * max(10000, 6 * hz) / realstathz; } @@ -1849,7 +1849,8 @@ sched_switch(struct thread *td, struct t preempted = !(td->td_flags & TDF_SLICEEND); td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; - tdq->tdq_switchcnt++; + if (!TD_IS_IDLETHREAD(td)) + tdq->tdq_switchcnt++; /* * The lock pointer in an idle thread should never change. Reset it * to CAN_RUN as well. @@ -2575,18 +2576,30 @@ sched_idletd(void *dummy) { struct thread *td; struct tdq *tdq; - int switchcnt; + int oldswitchcnt, switchcnt; int i; mtx_assert(&Giant, MA_NOTOWNED); td = curthread; tdq = TDQ_SELF(); + oldswitchcnt = -1; for (;;) { + if (tdq->tdq_load) { + thread_lock(td); + mi_switch(SW_VOL | SWT_IDLE, NULL); + thread_unlock(td); + } + switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; #ifdef SMP - if (tdq_idled(tdq) == 0) - continue; -#endif + if (switchcnt != oldswitchcnt) { + oldswitchcnt = switchcnt; + if (tdq_idled(tdq) == 0) + continue; + } switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; +#else + oldswitchcnt = switchcnt; +#endif /* * If we're switching very frequently, spin while checking * for load rather than entering a low power state that @@ -2601,20 +2614,26 @@ sched_idletd(void *dummy) cpu_spinwait(); } } + + /* If there was context switch during spin, restart it. */ switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; - if (tdq->tdq_load == 0) { - tdq->tdq_cpu_idle = 1; - if (tdq->tdq_load == 0) { - cpu_idle(switchcnt > sched_idlespinthresh * 4); - tdq->tdq_switchcnt++; - } - tdq->tdq_cpu_idle = 0; - } - if (tdq->tdq_load) { - thread_lock(td); - mi_switch(SW_VOL | SWT_IDLE, NULL); - thread_unlock(td); - } + if (tdq->tdq_load != 0 || switchcnt != oldswitchcnt) + continue; + + /* Run main MD idle handler. */ + tdq->tdq_cpu_idle = 1; + cpu_idle(switchcnt * 4 > sched_idlespinthresh); + tdq->tdq_cpu_idle = 0; + + /* + * Account thread-less hardware interrupts and + * other wakeup reasons equal to context switches. + */ + switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; + if (switchcnt != oldswitchcnt) + continue; + tdq->tdq_switchcnt++; + oldswitchcnt++; } } From owner-svn-src-stable@FreeBSD.ORG Fri Feb 22 18:30:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7DABAE34; Fri, 22 Feb 2013 18:30:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 563DE16B; Fri, 22 Feb 2013 18:30:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1MIUfKY067655; Fri, 22 Feb 2013 18:30:41 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1MIUf8P067654; Fri, 22 Feb 2013 18:30:41 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302221830.r1MIUf8P067654@svn.freebsd.org> From: Dimitry Andric Date: Fri, 22 Feb 2013 18:30:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247155 - stable/9/gnu/lib/libstdc++ X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2013 18:30:42 -0000 Author: dim Date: Fri Feb 22 18:30:41 2013 New Revision: 247155 URL: http://svnweb.freebsd.org/changeset/base/247155 Log: MFC r246857: Regenerate libstdc++'s config.h, synchronizing it with our current almost-C99 headers. Modified: stable/9/gnu/lib/libstdc++/config.h Directory Properties: stable/9/gnu/lib/libstdc++/ (props changed) Modified: stable/9/gnu/lib/libstdc++/config.h ============================================================================== --- stable/9/gnu/lib/libstdc++/config.h Fri Feb 22 17:45:32 2013 (r247154) +++ stable/9/gnu/lib/libstdc++/config.h Fri Feb 22 18:30:41 2013 (r247155) @@ -22,7 +22,7 @@ #define HAVE_ATAN2F 1 /* Define to 1 if you have the `atan2l' function. */ -/* #undef HAVE_ATAN2L */ +#define HAVE_ATAN2L 1 /* Define to 1 if you have the `atanf' function. */ #define HAVE_ATANF 1 @@ -67,7 +67,7 @@ #define HAVE_EXPF 1 /* Define to 1 if you have the `expl' function. */ -/* #undef HAVE_EXPL */ +#define HAVE_EXPL 1 /* Define to 1 if you have the `fabsf' function. */ #define HAVE_FABSF 1 @@ -100,7 +100,7 @@ #define HAVE_FMODF 1 /* Define to 1 if you have the `fmodl' function. */ -/* #undef HAVE_FMODL */ +#define HAVE_FMODL 1 /* Define to 1 if you have the `fpclass' function. */ /* #undef HAVE_FPCLASS */ @@ -134,7 +134,7 @@ #define HAVE_HYPOTF 1 /* Define to 1 if you have the `hypotl' function. */ -/* #undef HAVE_HYPOTL */ +#define HAVE_HYPOTL 1 /* Define to 1 if you have the `iconv' function. */ /* #undef HAVE_ICONV */ @@ -293,7 +293,7 @@ #define HAVE_SQRTF 1 /* Define to 1 if you have the `sqrtl' function. */ -/* #undef HAVE_SQRTL */ +#define HAVE_SQRTL 1 /* Define to 1 if you have the header file. */ #define HAVE_STDBOOL_H 1 @@ -304,6 +304,12 @@ /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 +/* Define if strerror_l is available in . */ +/* #undef HAVE_STRERROR_L */ + +/* Define if strerror_r is available in . */ +#define HAVE_STRERROR_R 1 + /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 @@ -316,6 +322,9 @@ /* Define to 1 if you have the `strtold' function. */ #define HAVE_STRTOLD 1 +/* Define if strxfrm_l is available in . */ +/* #undef HAVE_STRXFRM_L */ + /* Define to 1 if you have the header file. */ #define HAVE_SYS_FILIO_H 1 From owner-svn-src-stable@FreeBSD.ORG Fri Feb 22 18:33:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 06149B9; Fri, 22 Feb 2013 18:33:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E3B27194; Fri, 22 Feb 2013 18:33:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1MIXgYl068129; Fri, 22 Feb 2013 18:33:42 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1MIXgqM068128; Fri, 22 Feb 2013 18:33:42 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302221833.r1MIXgqM068128@svn.freebsd.org> From: Dimitry Andric Date: Fri, 22 Feb 2013 18:33:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247156 - stable/9/contrib/llvm/lib/Target/X86 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2013 18:33:43 -0000 Author: dim Date: Fri Feb 22 18:33:42 2013 New Revision: 247156 URL: http://svnweb.freebsd.org/changeset/base/247156 Log: MFC r246858: Pull in r175057 from upstream llvm trunk: X86: Disable generation of rep;movsl when %esi is used as a base pointer. This happens when there is both stack realignment and a dynamic alloca in the function. If we overwrite %esi (rep;movsl uses fixed registers) we'll lose the base pointer and the next register spill will write into oblivion. Fixes PR15249 and unbreaks firefox on i386/freebsd. Mozilla uses dynamic allocas and freebsd a 4 byte stack alignment. Modified: stable/9/contrib/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp Fri Feb 22 18:30:41 2013 (r247155) +++ stable/9/contrib/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp Fri Feb 22 18:33:42 2013 (r247156) @@ -202,6 +202,14 @@ X86SelectionDAGInfo::EmitTargetCodeForMe SrcPtrInfo.getAddrSpace() >= 256) return SDValue(); + // ESI might be used as a base pointer, in that case we can't simply overwrite + // the register. Fall back to generic code. + const X86RegisterInfo *TRI = + static_cast(DAG.getTarget().getRegisterInfo()); + if (TRI->hasBasePointer(DAG.getMachineFunction()) && + TRI->getBaseRegister() == X86::ESI) + return SDValue(); + MVT AVT; if (Align & 1) AVT = MVT::i8; From owner-svn-src-stable@FreeBSD.ORG Fri Feb 22 18:35:41 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 38E5E29B; Fri, 22 Feb 2013 18:35:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 12DCB1AF; Fri, 22 Feb 2013 18:35:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1MIZeID068444; Fri, 22 Feb 2013 18:35:40 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1MIZeu9068443; Fri, 22 Feb 2013 18:35:40 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302221835.r1MIZeu9068443@svn.freebsd.org> From: Dimitry Andric Date: Fri, 22 Feb 2013 18:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247157 - stable/9/contrib/llvm/lib/MC/MCParser X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2013 18:35:41 -0000 Author: dim Date: Fri Feb 22 18:35:40 2013 New Revision: 247157 URL: http://svnweb.freebsd.org/changeset/base/247157 Log: MFC r247003: Pull in r175360 from upstream llvm trunk: MCParser: Reject .balign with non-pow2 alignments. GNU as rejects them and there are configure scripts in the wild that check if the assembler rejects ".align 3" to determine whether the alignment is in bytes or powers of two. Modified: stable/9/contrib/llvm/lib/MC/MCParser/AsmParser.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/lib/MC/MCParser/AsmParser.cpp ============================================================================== --- stable/9/contrib/llvm/lib/MC/MCParser/AsmParser.cpp Fri Feb 22 18:33:42 2013 (r247156) +++ stable/9/contrib/llvm/lib/MC/MCParser/AsmParser.cpp Fri Feb 22 18:35:40 2013 (r247157) @@ -2372,6 +2372,10 @@ bool AsmParser::ParseDirectiveAlign(bool } Alignment = 1ULL << Alignment; + } else { + // Reject alignments that aren't a power of two, for gas compatibility. + if (!isPowerOf2_64(Alignment)) + Error(AlignmentLoc, "alignment must be a power of 2"); } // Diagnose non-sensical max bytes to align. From owner-svn-src-stable@FreeBSD.ORG Fri Feb 22 20:16:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A3DF1B9E; Fri, 22 Feb 2013 20:16:17 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8607E93E; Fri, 22 Feb 2013 20:16:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1MKGHOr099352; Fri, 22 Feb 2013 20:16:17 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1MKGHA9099351; Fri, 22 Feb 2013 20:16:17 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302222016.r1MKGHA9099351@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 22 Feb 2013 20:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247163 - stable/9/bin/sh X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2013 20:16:17 -0000 Author: jilles Date: Fri Feb 22 20:16:16 2013 New Revision: 247163 URL: http://svnweb.freebsd.org/changeset/base/247163 Log: MFC r246522: sh: Simplify mksyntax and make it fit for cross-compiling. Now it outputs fixed files, which use constants provided by the C standard library to determine appropriate values for the target machine. Before, mksyntax inspected the host machine which resulted in subtle breakage if e.g. char is signed on the host and unsigned on the target such as when cross-compiling on x86 for ARM. Submitted by: Christoph Mallon Modified: stable/9/bin/sh/mksyntax.c Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/mksyntax.c ============================================================================== --- stable/9/bin/sh/mksyntax.c Fri Feb 22 19:57:18 2013 (r247162) +++ stable/9/bin/sh/mksyntax.c Fri Feb 22 20:16:16 2013 (r247163) @@ -103,23 +103,16 @@ static char writer[] = "\ static FILE *cfile; static FILE *hfile; -static const char *syntax[513]; -static int base; -static int size; /* number of values which a char variable can have */ -static int nbits; /* number of bits in a character */ -static void filltable(const char *); -static void init(void); +static void add_default(void); +static void finish(void); +static void init(const char *); static void add(const char *, const char *); -static void print(const char *); static void output_type_macros(void); int main(int argc __unused, char **argv __unused) { - char c; - char d; - int sign; int i; char buf[80]; int pos; @@ -136,28 +129,8 @@ main(int argc __unused, char **argv __un fputs(writer, hfile); fputs(writer, cfile); - /* Determine the characteristics of chars. */ - c = -1; - sign = (c > 0) ? 0 : 1; - for (nbits = 1 ; ; nbits++) { - d = (1 << nbits) - 1; - if (d == c) - break; - } -#if 0 - printf("%s %d bit chars\n", sign? "signed" : "unsigned", nbits); -#endif - if (nbits > 9) { - fputs("Characters can't have more than 9 bits\n", stderr); - exit(2); - } - size = (1 << nbits) + 1; - base = 1; - if (sign) - base += 1 << (nbits - 1); - fputs("#include \n", hfile); - fputs("#include \n", hfile); + fputs("#include \n\n", hfile); /* Generate the #define statements in the header file */ fputs("/* Syntax classes */\n", hfile); @@ -178,8 +151,8 @@ main(int argc __unused, char **argv __un fprintf(hfile, "/* %s */\n", is_entry[i].comment); } putc('\n', hfile); - fprintf(hfile, "#define SYNBASE %d\n", base); - fprintf(hfile, "#define PEOF %d\n\n", -base); + fputs("#define SYNBASE (1 - CHAR_MIN)\n", hfile); + fputs("#define PEOF -SYNBASE\n\n", hfile); putc('\n', hfile); fputs("#define BASESYNTAX (basesyntax + SYNBASE)\n", hfile); fputs("#define DQSYNTAX (dqsyntax + SYNBASE)\n", hfile); @@ -190,10 +163,13 @@ main(int argc __unused, char **argv __un putc('\n', hfile); /* Generate the syntax tables. */ + fputs("#include \"parser.h\"\n", cfile); fputs("#include \"shell.h\"\n", cfile); fputs("#include \"syntax.h\"\n\n", cfile); - init(); + fputs("/* syntax table used when not in quotes */\n", cfile); + init("basesyntax"); + add_default(); add("\n", "CNL"); add("\\", "CBACK"); add("'", "CSQUOTE"); @@ -202,9 +178,11 @@ main(int argc __unused, char **argv __un add("$", "CVAR"); add("}", "CENDVAR"); add("<>();&| \t", "CSPCL"); - print("basesyntax"); - init(); + finish(); + fputs("\n/* syntax table used when in double quotes */\n", cfile); + init("dqsyntax"); + add_default(); add("\n", "CNL"); add("\\", "CBACK"); add("\"", "CENDQUOTE"); @@ -213,17 +191,21 @@ main(int argc __unused, char **argv __un add("}", "CENDVAR"); /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */ add("!*?[=~:/-", "CCTL"); - print("dqsyntax"); - init(); + finish(); + fputs("\n/* syntax table used when in single quotes */\n", cfile); + init("sqsyntax"); + add_default(); add("\n", "CNL"); add("\\", "CSBACK"); add("'", "CENDQUOTE"); /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */ add("!*?[=~:/-", "CCTL"); - print("sqsyntax"); - init(); + finish(); + fputs("\n/* syntax table used when in arithmetic */\n", cfile); + init("arisyntax"); + add_default(); add("\n", "CNL"); add("\\", "CBACK"); add("`", "CBQUOTE"); @@ -232,100 +214,95 @@ main(int argc __unused, char **argv __un add("}", "CENDVAR"); add("(", "CLP"); add(")", "CRP"); - print("arisyntax"); - filltable("0"); + finish(); + fputs("\n/* character classification table */\n", cfile); + init("is_type"); add("0123456789", "ISDIGIT"); add("abcdefghijklmnopqrstuvwxyz", "ISLOWER"); add("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ISUPPER"); add("_", "ISUNDER"); add("#?$!-*@", "ISSPECL"); - print("is_type"); + finish(); + exit(0); } - /* - * Clear the syntax table. + * Output the header and declaration of a syntax table. */ static void -filltable(const char *dftval) +init(const char *name) { - int i; + fprintf(hfile, "extern const char %s[];\n", name); + fprintf(cfile, "const char %s[SYNBASE + CHAR_MAX + 1] = {\n", name); +} + - for (i = 0 ; i < size ; i++) - syntax[i] = dftval; +static void +add_one(const char *key, const char *type) +{ + fprintf(cfile, "\t[SYNBASE + %s] = %s,\n", key, type); } /* - * Initialize the syntax table with default values. + * Add default values to the syntax table. */ static void -init(void) +add_default(void) { - filltable("CWORD"); - syntax[0] = "CEOF"; - syntax[base + CTLESC] = "CCTL"; - syntax[base + CTLVAR] = "CCTL"; - syntax[base + CTLENDVAR] = "CCTL"; - syntax[base + CTLBACKQ] = "CCTL"; - syntax[base + CTLBACKQ + CTLQUOTE] = "CCTL"; - syntax[base + CTLARI] = "CCTL"; - syntax[base + CTLENDARI] = "CCTL"; - syntax[base + CTLQUOTEMARK] = "CCTL"; - syntax[base + CTLQUOTEEND] = "CCTL"; + add_one("PEOF", "CEOF"); + add_one("CTLESC", "CCTL"); + add_one("CTLVAR", "CCTL"); + add_one("CTLENDVAR", "CCTL"); + add_one("CTLBACKQ", "CCTL"); + add_one("CTLBACKQ + CTLQUOTE", "CCTL"); + add_one("CTLARI", "CCTL"); + add_one("CTLENDARI", "CCTL"); + add_one("CTLQUOTEMARK", "CCTL"); + add_one("CTLQUOTEEND", "CCTL"); } /* - * Add entries to the syntax table. + * Output the footer of a syntax table. */ static void -add(const char *p, const char *type) +finish(void) { - while (*p) - syntax[*p++ + base] = type; + fputs("};\n", cfile); } - /* - * Output the syntax table. + * Add entries to the syntax table. */ static void -print(const char *name) +add(const char *p, const char *type) { - int i; - int col; - - fprintf(hfile, "extern const char %s[];\n", name); - fprintf(cfile, "const char %s[%d] = {\n", name, size); - col = 0; - for (i = 0 ; i < size ; i++) { - if (i == 0) { - fputs(" ", cfile); - } else if ((i & 03) == 0) { - fputs(",\n ", cfile); - col = 0; - } else { - putc(',', cfile); - while (++col < 9 * (i & 03)) - putc(' ', cfile); + for (; *p; ++p) { + char c = *p; + switch (c) { + case '\t': c = 't'; break; + case '\n': c = 'n'; break; + case '\'': c = '\''; break; + case '\\': c = '\\'; break; + + default: + fprintf(cfile, "\t[SYNBASE + '%c'] = %s,\n", c, type); + continue; } - fputs(syntax[i], cfile); - col += strlen(syntax[i]); + fprintf(cfile, "\t[SYNBASE + '\\%c'] = %s,\n", c, type); } - fputs("\n};\n", cfile); } - /* * Output character classification macros (e.g. is_digit). If digits are * contiguous, we can test for them quickly. From owner-svn-src-stable@FreeBSD.ORG Sat Feb 23 04:51:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 76E3ED9F; Sat, 23 Feb 2013 04:51:21 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5E382BED; Sat, 23 Feb 2013 04:51:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1N4pLDE056572; Sat, 23 Feb 2013 04:51:21 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1N4pLAX056571; Sat, 23 Feb 2013 04:51:21 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201302230451.r1N4pLAX056571@svn.freebsd.org> From: Tim Kientzle Date: Sat, 23 Feb 2013 04:51:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247167 - stable/9/contrib/gcc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Feb 2013 04:51:21 -0000 Author: kientzle Date: Sat Feb 23 04:51:20 2013 New Revision: 247167 URL: http://svnweb.freebsd.org/changeset/base/247167 Log: MFC support for -print-file-name=include. Modified: stable/9/contrib/gcc/gcc.c Directory Properties: stable/9/contrib/gcc/ (props changed) Modified: stable/9/contrib/gcc/gcc.c ============================================================================== --- stable/9/contrib/gcc/gcc.c Fri Feb 22 22:40:10 2013 (r247166) +++ stable/9/contrib/gcc/gcc.c Sat Feb 23 04:51:20 2013 (r247167) @@ -2696,6 +2696,17 @@ find_a_file (const struct path_prefix *p return xstrdup (DEFAULT_LINKER); #endif +#ifdef FREEBSD_NATIVE + if (! strcmp(name, "include")) + { +#ifdef CROSS_INCLUDE_DIR + return xstrdup(CROSS_INCLUDE_DIR); +#else + return xstrdup(STANDARD_INCLUDE_DIR); +#endif + } +#endif + /* Determine the filename to execute (special case for absolute paths). */ if (IS_ABSOLUTE_PATH (name)) From owner-svn-src-stable@FreeBSD.ORG Sat Feb 23 08:05:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B4E58FEA; Sat, 23 Feb 2013 08:05:05 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F52BE1; Sat, 23 Feb 2013 08:05:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1N855F9013845; Sat, 23 Feb 2013 08:05:05 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1N855gd013844; Sat, 23 Feb 2013 08:05:05 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201302230805.r1N855gd013844@svn.freebsd.org> From: Devin Teske Date: Sat, 23 Feb 2013 08:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247170 - stable/9/usr.sbin/sysinstall/help X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Feb 2013 08:05:05 -0000 Author: dteske Date: Sat Feb 23 08:05:04 2013 New Revision: 247170 URL: http://svnweb.freebsd.org/changeset/base/247170 Log: Whitespace. Direct commit to stable/9 (no sysinstall in head). Modified: stable/9/usr.sbin/sysinstall/help/media.hlp Modified: stable/9/usr.sbin/sysinstall/help/media.hlp ============================================================================== --- stable/9/usr.sbin/sysinstall/help/media.hlp Sat Feb 23 07:55:27 2013 (r247169) +++ stable/9/usr.sbin/sysinstall/help/media.hlp Sat Feb 23 08:05:04 2013 (r247170) @@ -2,7 +2,7 @@ You can install from the following types CDROM requires one of the following supported CDROM drives: ATAPI - Any standard ATAPI CDROM drive hooked to - a supported controller (see Hardware Guide). + a supported controller (see Hardware Guide). SCSI - Any standard SCSI CDROM drive hooked to a supported controller (see Hardware Guide).