From owner-svn-src-stable-7@FreeBSD.ORG Mon Dec 8 17:18:37 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C08821065670; Mon, 8 Dec 2008 17:18:37 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACF1F8FC18; Mon, 8 Dec 2008 17:18:37 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB8HIbOr066047; Mon, 8 Dec 2008 17:18:37 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB8HIbwf066044; Mon, 8 Dec 2008 17:18:37 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812081718.mB8HIbwf066044@svn.freebsd.org> From: Tim Kientzle Date: Mon, 8 Dec 2008 17:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185770 - stable/7/lib/libarchive X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2008 17:18:37 -0000 Author: kientzle Date: Mon Dec 8 17:18:37 2008 New Revision: 185770 URL: http://svn.freebsd.org/changeset/base/185770 Log: MFC r185667,r185680,r185681: Overhaul the Rockridge option parsing and beef up the ISO9660 bidder. This makes the ISO reader a lot more robust when reading malformed input. Approved by: re Modified: stable/7/lib/libarchive/ (props changed) stable/7/lib/libarchive/archive_read_support_format_iso9660.c stable/7/lib/libarchive/archive_string.c stable/7/lib/libarchive/archive_string.h Modified: stable/7/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- stable/7/lib/libarchive/archive_read_support_format_iso9660.c Mon Dec 8 17:12:40 2008 (r185769) +++ stable/7/lib/libarchive/archive_read_support_format_iso9660.c Mon Dec 8 17:18:37 2008 (r185770) @@ -138,6 +138,15 @@ __FBSDID("$FreeBSD$"); #define PVD_reserved4_size 1 #define PVD_application_data_offset (PVD_reserved4_offset + PVD_reserved4_size) #define PVD_application_data_size 512 +#define PVD_reserved5_offset (PVD_application_data_offset + PVD_application_data_size) +#define PVD_reserved5_size (2048 - PVD_reserved5_offset) + +/* TODO: It would make future maintenance easier to just hardcode the + * above values. In particular, ECMA119 states the offsets as part of + * the standard. That would eliminate the need for the following check.*/ +#if PVD_reserved5_offset != 1395 +#error PVD offset and size definitions are wrong. +#endif /* Structure of an on-disk directory record. */ /* Note: ISO9660 stores each multi-byte integer twice, once in @@ -178,17 +187,20 @@ struct file_info { uint64_t size; /* File size in bytes. */ uint64_t ce_offset; /* Offset of CE */ uint64_t ce_size; /* Size of CE */ + time_t birthtime; /* File created time. */ time_t mtime; /* File last modified time. */ time_t atime; /* File last accessed time. */ - time_t ctime; /* File creation time. */ + time_t ctime; /* File attribute change time. */ uint64_t rdev; /* Device number */ mode_t mode; uid_t uid; gid_t gid; ino_t inode; int nlinks; - char *name; /* Null-terminated filename. */ + struct archive_string name; /* Pathname */ + char name_continues; /* Non-zero if name continues */ struct archive_string symlink; + char symlink_continues; /* Non-zero if link continues */ }; @@ -210,6 +222,7 @@ struct iso9660 { uint64_t current_position; ssize_t logical_block_size; + uint64_t volume_size; /* Total size of volume in bytes. */ off_t entry_sparse_offset; int64_t entry_bytes_remaining; @@ -224,7 +237,9 @@ static int archive_read_format_iso9660_r static int archive_read_format_iso9660_read_header(struct archive_read *, struct archive_entry *); static const char *build_pathname(struct archive_string *, struct file_info *); +#if DEBUG static void dump_isodirrec(FILE *, const unsigned char *isodirrec); +#endif static time_t time_from_tm(struct tm *); static time_t isodate17(const unsigned char *); static time_t isodate7(const unsigned char *); @@ -238,6 +253,12 @@ static struct file_info * static void parse_rockridge(struct iso9660 *iso9660, struct file_info *file, const unsigned char *start, const unsigned char *end); +static void parse_rockridge_NM1(struct file_info *, + const unsigned char *, int); +static void parse_rockridge_SL1(struct file_info *, + const unsigned char *, int); +static void parse_rockridge_TF1(struct file_info *, + const unsigned char *, int); static void release_file(struct iso9660 *, struct file_info *); static unsigned toi(const void *p, int n); @@ -314,13 +335,61 @@ static int isPVD(struct iso9660 *iso9660, const unsigned char *h) { struct file_info *file; + int i; - if (h[0] != 1) + /* Type of the Primary Volume Descriptor must be 1. */ + if (h[PVD_type_offset] != 1) return (0); - if (memcmp(h+1, "CD001", 5) != 0) + + /* ID must be "CD001" */ + if (memcmp(h + PVD_id_offset, "CD001", 5) != 0) + return (0); + + /* PVD version must be 1. */ + if (h[PVD_version_offset] != 1) return (0); + /* Reserved field must be 0. */ + if (h[PVD_reserved1_offset] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved2_size; ++i) + if (h[PVD_reserved2_offset + i] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved3_size; ++i) + if (h[PVD_reserved3_offset + i] != 0) + return (0); + + /* Logical block size must be > 0. */ + /* I've looked at Ecma 119 and can't find any stronger + * restriction on this field. */ iso9660->logical_block_size = toi(h + PVD_logical_block_size_offset, 2); + if (iso9660->logical_block_size <= 0) + return (0); + + iso9660->volume_size = iso9660->logical_block_size + * (uint64_t)toi(h + PVD_volume_space_size_offset, 4); + + /* File structure version must be 1 for ISO9660/ECMA119. */ + if (h[PVD_file_structure_version_offset] != 1) + return (0); + + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved4_size; ++i) + if (h[PVD_reserved4_offset + i] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved5_size; ++i) + if (h[PVD_reserved5_offset + i] != 0) + return (0); + + /* XXX TODO: Check other values for sanity; reject more + * malformed PVDs. XXX */ /* Store the root directory in the pending list. */ file = parse_file_info(iso9660, NULL, h + PVD_root_directory_record_offset); @@ -352,12 +421,22 @@ archive_read_format_iso9660_read_header( iso9660->entry_bytes_remaining = file->size; iso9660->entry_sparse_offset = 0; /* Offset for sparse-file-aware clients. */ + if (file->offset + file->size > iso9660->volume_size) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "File is beyond end-of-media: %s", file->name); + iso9660->entry_bytes_remaining = 0; + iso9660->entry_sparse_offset = 0; + release_file(iso9660, file); + return (ARCHIVE_WARN); + } + /* Set up the entry structure with information about this entry. */ archive_entry_set_mode(entry, file->mode); archive_entry_set_uid(entry, file->uid); archive_entry_set_gid(entry, file->gid); archive_entry_set_nlink(entry, file->nlinks); archive_entry_set_ino(entry, file->inode); + /* archive_entry_set_birthtime(entry, file->birthtime, 0); */ archive_entry_set_mtime(entry, file->mtime, 0); archive_entry_set_ctime(entry, file->ctime, 0); archive_entry_set_atime(entry, file->atime, 0); @@ -535,13 +614,7 @@ parse_file_info(struct iso9660 *iso9660, file->mtime = isodate7(isodirrec + DR_date_offset); file->ctime = file->atime = file->mtime; name_len = (size_t)*(const unsigned char *)(isodirrec + DR_name_len_offset); - file->name = (char *)malloc(name_len + 1); - if (file->name == NULL) { - free(file); - return (NULL); - } - memcpy(file->name, isodirrec + DR_name_offset, name_len); - file->name[name_len] = '\0'; + archive_strncpy(&file->name, isodirrec + DR_name_offset, name_len); flags = *(isodirrec + DR_flags_offset); if (flags & 0x02) file->mode = AE_IFDIR | 0700; @@ -561,6 +634,7 @@ parse_file_info(struct iso9660 *iso9660, parse_rockridge(iso9660, file, rr_start, rr_end); } +#if DEBUG /* DEBUGGING: Warn about attributes I don't yet fully support. */ if ((flags & ~0x02) != 0) { fprintf(stderr, "\n ** Unrecognized flag: "); @@ -583,7 +657,7 @@ parse_file_info(struct iso9660 *iso9660, dump_isodirrec(stderr, isodirrec); fprintf(stderr, "\n"); } - +#endif return (file); } @@ -623,6 +697,7 @@ parse_rockridge(struct iso9660 *iso9660, while (p + 4 < end /* Enough space for another entry. */ && p[0] >= 'A' && p[0] <= 'Z' /* Sanity-check 1st char of name. */ && p[1] >= 'A' && p[1] <= 'Z' /* Sanity-check 2nd char of name. */ + && p[2] >= 4 /* Sanity-check length. */ && p + p[2] <= end) { /* Sanity-check length. */ const unsigned char *data = p + 4; int data_length = p[2] - 4; @@ -635,61 +710,54 @@ parse_rockridge(struct iso9660 *iso9660, */ switch(p[0]) { case 'C': - if (p[0] == 'C' && p[1] == 'E' && version == 1) { - /* - * CE extension comprises: - * 8 byte sector containing extension - * 8 byte offset w/in above sector - * 8 byte length of continuation - */ - file->ce_offset = toi(data, 4) - * iso9660->logical_block_size - + toi(data + 8, 4); - file->ce_size = toi(data + 16, 4); + if (p[0] == 'C' && p[1] == 'E') { + if (version == 1 && data_length == 24) { + /* + * CE extension comprises: + * 8 byte sector containing extension + * 8 byte offset w/in above sector + * 8 byte length of continuation + */ + file->ce_offset = (uint64_t)toi(data, 4) + * iso9660->logical_block_size + + toi(data + 8, 4); + file->ce_size = toi(data + 16, 4); + /* If the result is rediculous, + * ignore it. */ + if (file->ce_offset + file->ce_size + > iso9660->volume_size) { + file->ce_offset = 0; + file->ce_size = 0; + } + } break; } /* FALLTHROUGH */ case 'N': - if (p[0] == 'N' && p[1] == 'M' && version == 1 - && *data == 0) { - /* NM extension with flag byte == 0 */ - /* - * NM extension comprises: - * one byte flag - * rest is long name - */ - /* TODO: Obey flags. */ - char *old_name = file->name; - - data++; /* Skip flag byte. */ - data_length--; - file->name = (char *)malloc(data_length + 1); - if (file->name != NULL) { - free(old_name); - memcpy(file->name, data, data_length); - file->name[data_length] = '\0'; - } else - file->name = old_name; + if (p[0] == 'N' && p[1] == 'M') { + if (version == 1) + parse_rockridge_NM1(file, + data, data_length); break; } /* FALLTHROUGH */ case 'P': - if (p[0] == 'P' && p[1] == 'D' && version == 1) { + if (p[0] == 'P' && p[1] == 'D') { /* * PD extension is padding; * contents are always ignored. */ break; } - if (p[0] == 'P' && p[1] == 'N' && version == 1) { - if (data_length == 16) { + if (p[0] == 'P' && p[1] == 'N') { + if (version == 1 && data_length == 16) { file->rdev = toi(data,4); file->rdev <<= 32; file->rdev |= toi(data + 8, 4); } break; } - if (p[0] == 'P' && p[1] == 'X' && version == 1) { + if (p[0] == 'P' && p[1] == 'X') { /* * PX extension comprises: * 8 bytes for mode, @@ -698,12 +766,22 @@ parse_rockridge(struct iso9660 *iso9660, * 8 bytes for gid, * 8 bytes for inode. */ - if (data_length == 32) { - file->mode = toi(data, 4); - file->nlinks = toi(data + 8, 4); - file->uid = toi(data + 16, 4); - file->gid = toi(data + 24, 4); - file->inode = toi(data + 32, 4); + if (version == 1) { + if (data_length >= 8) + file->mode + = toi(data, 4); + if (data_length >= 16) + file->nlinks + = toi(data + 8, 4); + if (data_length >= 24) + file->uid + = toi(data + 16, 4); + if (data_length >= 32) + file->gid + = toi(data + 24, 4); + if (data_length >= 40) + file->inode + = toi(data + 32, 4); } break; } @@ -720,56 +798,14 @@ parse_rockridge(struct iso9660 *iso9660, } /* FALLTHROUGH */ case 'S': - if (p[0] == 'S' && p[1] == 'L' && version == 1 - && *data == 0) { - int cont = 1; - /* SL extension with flags == 0 */ - /* TODO: handle non-zero flag values. */ - data++; /* Skip flag byte. */ - data_length--; - while (data_length > 0) { - unsigned char flag = *data++; - unsigned char nlen = *data++; - data_length -= 2; - - if (cont == 0) - archive_strcat(&file->symlink, "/"); - cont = 0; - - switch(flag) { - case 0x01: /* Continue */ - archive_strncat(&file->symlink, - (const char *)data, nlen); - cont = 1; - break; - case 0x02: /* Current */ - archive_strcat(&file->symlink, "."); - break; - case 0x04: /* Parent */ - archive_strcat(&file->symlink, ".."); - break; - case 0x08: /* Root */ - case 0x10: /* Volume root */ - archive_string_empty(&file->symlink); - break; - case 0x20: /* Hostname */ - archive_strcat(&file->symlink, "hostname"); - break; - case 0: - archive_strncat(&file->symlink, - (const char *)data, nlen); - break; - default: - /* TODO: issue a warning ? */ - break; - } - data += nlen; - data_length -= nlen; - } + if (p[0] == 'S' && p[1] == 'L') { + if (version == 1) + parse_rockridge_SL1(file, + data, data_length); break; } if (p[0] == 'S' && p[1] == 'P' - && version == 1 && data_length == 7 + && version == 1 && data_length == 3 && data[0] == (unsigned char)'\xbe' && data[1] == (unsigned char)'\xef') { /* @@ -805,66 +841,27 @@ parse_rockridge(struct iso9660 *iso9660, return; } case 'T': - if (p[0] == 'T' && p[1] == 'F' && version == 1) { - char flag = data[0]; - /* - * TF extension comprises: - * one byte flag - * create time (optional) - * modify time (optional) - * access time (optional) - * attribute time (optional) - * Time format and presence of fields - * is controlled by flag bits. - */ - data++; - if (flag & 0x80) { - /* Use 17-byte time format. */ - if (flag & 1) /* Create time. */ - data += 17; - if (flag & 2) { /* Modify time. */ - file->mtime = isodate17(data); - data += 17; - } - if (flag & 4) { /* Access time. */ - file->atime = isodate17(data); - data += 17; - } - if (flag & 8) { /* Attribute time. */ - file->ctime = isodate17(data); - data += 17; - } - } else { - /* Use 7-byte time format. */ - if (flag & 1) /* Create time. */ - data += 7; - if (flag & 2) { /* Modify time. */ - file->mtime = isodate7(data); - data += 7; - } - if (flag & 4) { /* Access time. */ - file->atime = isodate7(data); - data += 7; - } - if (flag & 8) { /* Attribute time. */ - file->ctime = isodate7(data); - data += 7; - } - } + if (p[0] == 'T' && p[1] == 'F') { + if (version == 1) + parse_rockridge_TF1(file, + data, data_length); break; } /* FALLTHROUGH */ default: /* The FALLTHROUGHs above leave us here for * any unsupported extension. */ +#if DEBUG { const unsigned char *t; - fprintf(stderr, "\nUnsupported RRIP extension for %s\n", file->name); + fprintf(stderr, "\nUnsupported RRIP extension for %s\n", file->name.s); fprintf(stderr, " %c%c(%d):", p[0], p[1], data_length); for (t = data; t < data + data_length && t < data + 16; t++) fprintf(stderr, " %02x", *t); fprintf(stderr, "\n"); } +#endif + break; } @@ -874,14 +871,222 @@ parse_rockridge(struct iso9660 *iso9660, } static void +parse_rockridge_NM1(struct file_info *file, const unsigned char *data, + int data_length) +{ + if (!file->name_continues) + archive_string_empty(&file->name); + file->name_continues = 0; + if (data_length < 1) + return; + /* + * NM version 1 extension comprises: + * 1 byte flag, value is one of: + * = 0: remainder is name + * = 1: remainder is name, next NM entry continues name + * = 2: "." + * = 4: ".." + * = 32: Implementation specific + * All other values are reserved. + */ + switch(data[0]) { + case 0: + if (data_length < 2) + return; + archive_strncat(&file->name, data + 1, data_length - 1); + break; + case 1: + if (data_length < 2) + return; + archive_strncat(&file->name, data + 1, data_length - 1); + file->name_continues = 1; + break; + case 2: + archive_strcat(&file->name, "."); + break; + case 4: + archive_strcat(&file->name, ".."); + break; + default: + return; + } + +} + +static void +parse_rockridge_TF1(struct file_info *file, const unsigned char *data, + int data_length) +{ + char flag; + /* + * TF extension comprises: + * one byte flag + * create time (optional) + * modify time (optional) + * access time (optional) + * attribute time (optional) + * Time format and presence of fields + * is controlled by flag bits. + */ + if (data_length < 1) + return; + flag = data[0]; + ++data; + --data_length; + if (flag & 0x80) { + /* Use 17-byte time format. */ + if ((flag & 1) && data_length >= 17) { + /* Create time. */ + file->birthtime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 2) && data_length >= 17) { + /* Modify time. */ + file->mtime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 4) && data_length >= 17) { + /* Access time. */ + file->atime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 8) && data_length >= 17) { + /* Attribute change time. */ + file->ctime = isodate17(data); + data += 17; + data_length -= 17; + } + } else { + /* Use 7-byte time format. */ + if ((flag & 1) && data_length >= 7) { + /* Create time. */ + file->birthtime = isodate17(data); + data += 7; + data_length -= 7; + } + if ((flag & 2) && data_length >= 7) { + /* Modify time. */ + file->mtime = isodate7(data); + data += 7; + data_length -= 7; + } + if ((flag & 4) && data_length >= 7) { + /* Access time. */ + file->atime = isodate7(data); + data += 7; + data_length -= 7; + } + if ((flag & 8) && data_length >= 7) { + /* Attribute change time. */ + file->ctime = isodate7(data); + data += 7; + data_length -= 7; + } + } +} + +static void +parse_rockridge_SL1(struct file_info *file, const unsigned char *data, + int data_length) +{ + int component_continues = 1; + + if (!file->symlink_continues) + archive_string_empty(&file->symlink); + else + archive_strcat(&file->symlink, "/"); + file->symlink_continues = 0; + + /* + * Defined flag values: + * 0: This is the last SL record for this symbolic link + * 1: this symbolic link field continues in next SL entry + * All other values are reserved. + */ + if (data_length < 1) + return; + switch(*data) { + case 0: + break; + case 1: + file->symlink_continues = 1; + break; + default: + return; + } + ++data; /* Skip flag byte. */ + --data_length; + + /* + * SL extension body stores "components". + * Basically, this is a complicated way of storing + * a POSIX path. It also interferes with using + * symlinks for storing non-path data. + * + * Each component is 2 bytes (flag and length) + * possibly followed by name data. + */ + while (data_length >= 2) { + unsigned char flag = *data++; + unsigned char nlen = *data++; + data_length -= 2; + + if (!component_continues) + archive_strcat(&file->symlink, "/"); + component_continues = 0; + + switch(flag) { + case 0: /* Usual case, this is text. */ + if (data_length < nlen) + return; + archive_strncat(&file->symlink, + (const char *)data, nlen); + break; + case 0x01: /* Text continues in next component. */ + if (data_length < nlen) + return; + archive_strncat(&file->symlink, + (const char *)data, nlen); + component_continues = 1; + break; + case 0x02: /* Current dir. */ + archive_strcat(&file->symlink, "."); + break; + case 0x04: /* Parent dir. */ + archive_strcat(&file->symlink, ".."); + break; + case 0x08: /* Root of filesystem. */ + archive_string_empty(&file->symlink); + archive_strcat(&file->symlink, "/"); + break; + case 0x10: /* Undefined (historically "volume root" */ + archive_string_empty(&file->symlink); + archive_strcat(&file->symlink, "ROOT"); + break; + case 0x20: /* Undefined (historically "hostname") */ + archive_strcat(&file->symlink, "hostname"); + break; + default: + /* TODO: issue a warning ? */ + return; + } + data += nlen; + data_length -= nlen; + } +} + + +static void release_file(struct iso9660 *iso9660, struct file_info *file) { struct file_info *parent; if (file->refcount == 0) { parent = file->parent; - if (file->name) - free(file->name); + archive_string_free(&file->name); archive_string_free(&file->symlink); free(file); if (parent != NULL) { @@ -906,7 +1111,9 @@ next_entry_seek(struct archive_read *a, /* CE area precedes actual file data? Ignore it. */ if (file->ce_offset > file->offset) { -fprintf(stderr, " *** Discarding CE data.\n"); +#if DEBUG + fprintf(stderr, " *** Discarding CE data.\n"); +#endif file->ce_offset = 0; file->ce_size = 0; } @@ -1071,17 +1278,18 @@ time_from_tm(struct tm *t) static const char * build_pathname(struct archive_string *as, struct file_info *file) { - if (file->parent != NULL && file->parent->name[0] != '\0') { + if (file->parent != NULL && archive_strlen(&file->parent->name) > 0) { build_pathname(as, file->parent); archive_strcat(as, "/"); } - if (file->name[0] == '\0') + if (archive_strlen(&file->name) == 0) archive_strcat(as, "."); else - archive_strcat(as, file->name); + archive_string_concat(as, &file->name); return (as->s); } +#if DEBUG static void dump_isodirrec(FILE *out, const unsigned char *isodirrec) { @@ -1106,3 +1314,4 @@ dump_isodirrec(FILE *out, const unsigned fprintf(out, " `%.*s'", toi(isodirrec + DR_name_len_offset, DR_name_len_size), isodirrec + DR_name_offset); } +#endif Modified: stable/7/lib/libarchive/archive_string.c ============================================================================== --- stable/7/lib/libarchive/archive_string.c Mon Dec 8 17:12:40 2008 (r185769) +++ stable/7/lib/libarchive/archive_string.c Mon Dec 8 17:18:37 2008 (r185770) @@ -70,6 +70,18 @@ __archive_string_copy(struct archive_str } void +__archive_string_concat(struct archive_string *dest, struct archive_string *src) +{ + if (src->length > 0) { + if (__archive_string_ensure(dest, dest->length + src->length + 1) == NULL) + __archive_errx(1, "Out of memory"); + memcpy(dest->s + dest->length, src->s, src->length); + dest->length += src->length; + dest->s[dest->length] = 0; + } +} + +void __archive_string_free(struct archive_string *as) { as->length = 0; Modified: stable/7/lib/libarchive/archive_string.h ============================================================================== --- stable/7/lib/libarchive/archive_string.h Mon Dec 8 17:12:40 2008 (r185769) +++ stable/7/lib/libarchive/archive_string.h Mon Dec 8 17:18:37 2008 (r185770) @@ -92,6 +92,12 @@ __archive_string_copy(struct archive_str #define archive_string_copy(dest, src) \ __archive_string_copy(dest, src) +/* Concatenate one archive_string to another */ +void +__archive_string_concat(struct archive_string *dest, struct archive_string *src); +#define archive_string_concat(dest, src) \ + __archive_string_concat(dest, src) + /* Ensure that the underlying buffer is at least as large as the request. */ struct archive_string * __archive_string_ensure(struct archive_string *, size_t); From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 9 11:01:18 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0699E1065676; Tue, 9 Dec 2008 11:01:18 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E87568FC2E; Tue, 9 Dec 2008 11:01:17 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB9B1HfF089079; Tue, 9 Dec 2008 11:01:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9B1Htr089077; Tue, 9 Dec 2008 11:01:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200812091101.mB9B1Htr089077@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 9 Dec 2008 11:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185792 - in stable/7/sys: . contrib/pf dev/re pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 11:01:18 -0000 Author: yongari Date: Tue Dec 9 11:01:17 2008 New Revision: 185792 URL: http://svn.freebsd.org/changeset/base/185792 Log: MFC r185542: Add 8168D support. Submitted by: Andrew < andrewwtulloch <> gmail DOT com > Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/re/if_re.c stable/7/sys/pci/if_rlreg.h Modified: stable/7/sys/dev/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Tue Dec 9 10:21:38 2008 (r185791) +++ stable/7/sys/dev/re/if_re.c Tue Dec 9 11:01:17 2008 (r185792) @@ -172,7 +172,7 @@ static struct rl_type re_devs[] = { { RT_VENDORID, RT_DEVICEID_8101E, 0, "RealTek 8101E/8102E/8102EL PCIe 10/100baseTX" }, { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8168B/8168C/8168CP/8111B/8111C/8111CP PCIe " + "RealTek 8168/8168B/8168C/8168CP/8168D/8111B/8111C/8111CP PCIe " "Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169, 0, "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, @@ -213,6 +213,7 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8168C, RL_8169, "8168C/8111C"}, { RL_HWREV_8168C_SPIN2, RL_8169, "8168C/8111C"}, { RL_HWREV_8168CP, RL_8169, "8168CP/8111CP"}, + { RL_HWREV_8168D, RL_8169, "8168D"}, { 0, 0, NULL } }; @@ -1225,6 +1226,7 @@ re_attach(device_t dev) case RL_HWREV_8168C: case RL_HWREV_8168C_SPIN2: case RL_HWREV_8168CP: + case RL_HWREV_8168D: sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT; /* Modified: stable/7/sys/pci/if_rlreg.h ============================================================================== --- stable/7/sys/pci/if_rlreg.h Tue Dec 9 10:21:38 2008 (r185791) +++ stable/7/sys/pci/if_rlreg.h Tue Dec 9 11:01:17 2008 (r185792) @@ -157,6 +157,7 @@ #define RL_HWREV_8169_8110SB 0x10000000 #define RL_HWREV_8169_8110SC 0x18000000 #define RL_HWREV_8102EL 0x24800000 +#define RL_HWREV_8168D 0x28000000 #define RL_HWREV_8168_SPIN1 0x30000000 #define RL_HWREV_8100E 0x30800000 #define RL_HWREV_8101E 0x34000000 From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 9 16:20:58 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC4C81065670; Tue, 9 Dec 2008 16:20:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB2528FC1C; Tue, 9 Dec 2008 16:20:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB9GKwQk095497; Tue, 9 Dec 2008 16:20:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9GKwCS095496; Tue, 9 Dec 2008 16:20:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812091620.mB9GKwCS095496@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 9 Dec 2008 16:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185796 - in stable/7/sys: . contrib/pf kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 16:20:59 -0000 Author: kib Date: Tue Dec 9 16:20:58 2008 New Revision: 185796 URL: http://svn.freebsd.org/changeset/base/185796 Log: MFC r185557: Prevent creation of the duplicated negative namecache entries. Approved by: re (kensmith) Requested by: jhb Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/vfs_cache.c Modified: stable/7/sys/kern/vfs_cache.c ============================================================================== --- stable/7/sys/kern/vfs_cache.c Tue Dec 9 15:49:02 2008 (r185795) +++ stable/7/sys/kern/vfs_cache.c Tue Dec 9 16:20:58 2008 (r185796) @@ -460,7 +460,7 @@ cache_enter(dvp, vp, cnp) struct vnode *vp; struct componentname *cnp; { - struct namecache *ncp; + struct namecache *ncp, *n2; struct nchashhead *ncpp; u_int32_t hash; int hold; @@ -516,8 +516,6 @@ cache_enter(dvp, vp, cnp) * name. */ if (vp) { - struct namecache *n2; - TAILQ_FOREACH(n2, &vp->v_cache_dst, nc_dst) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && @@ -527,7 +525,16 @@ cache_enter(dvp, vp, cnp) return; } } - } + } else { + TAILQ_FOREACH(n2, &ncneg, nc_dst) { + if (n2->nc_nlen == cnp->cn_namelen && + !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { + CACHE_UNLOCK(); + cache_free(ncp); + return; + } + } + } numcache++; if (!vp) { From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 9 16:30:41 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E01BE1065676; Tue, 9 Dec 2008 16:30:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97D4E8FC36; Tue, 9 Dec 2008 16:30:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB9GUf8K095812; Tue, 9 Dec 2008 16:30:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9GUf7L095811; Tue, 9 Dec 2008 16:30:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812091630.mB9GUf7L095811@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 9 Dec 2008 16:30:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185798 - in stable/7/sys: . contrib/pf ufs/ufs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 16:30:42 -0000 Author: kib Date: Tue Dec 9 16:30:41 2008 New Revision: 185798 URL: http://svn.freebsd.org/changeset/base/185798 Log: MFC r185761: Recheck the DQ_MOD after the dqh lock is relocked. Repeat dqsync() if the dq is dirty. This ensures that up to date dq is written in the quota file and fixes assertion in dqget(). Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/ufs/ufs/ufs_quota.c Modified: stable/7/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_quota.c Tue Dec 9 16:25:46 2008 (r185797) +++ stable/7/sys/ufs/ufs/ufs_quota.c Tue Dec 9 16:30:41 2008 (r185798) @@ -1321,7 +1321,7 @@ dqrele(vp, dq) return; } DQH_UNLOCK(); - +sync: (void) dqsync(vp, dq); DQH_LOCK(); @@ -1330,6 +1330,18 @@ dqrele(vp, dq) DQH_UNLOCK(); return; } + + /* + * The dq may become dirty after it is synced but before it is + * put to the free list. Checking the DQ_MOD there without + * locking dq should be safe since no other references to the + * dq exist. + */ + if ((dq->dq_flags & DQ_MOD) != 0) { + dq->dq_cnt++; + DQH_UNLOCK(); + goto sync; + } TAILQ_INSERT_TAIL(&dqfreelist, dq, dq_freelist); DQH_UNLOCK(); } From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 9 19:36:05 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 104831065676; Tue, 9 Dec 2008 19:36:05 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F30E08FC18; Tue, 9 Dec 2008 19:36:04 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB9Ja4mA099663; Tue, 9 Dec 2008 19:36:04 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9Ja4ar099659; Tue, 9 Dec 2008 19:36:04 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200812091936.mB9Ja4ar099659@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 9 Dec 2008 19:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185805 - in stable/7/sys/dev/cxgb: . common X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 19:36:05 -0000 Author: gnn Date: Tue Dec 9 19:36:04 2008 New Revision: 185805 URL: http://svn.freebsd.org/changeset/base/185805 Log: MFC of 3 separate commits. Bug fix from Chelsio which addresses the issue of the device resetting when it sees only received packets. In some cases where a device only recieves data it mistakenly thinks that its transmitting side is broken and resets the device. Fix a bug with the ael1006 PHY. The bug shows up as persistent but incomplete packet loss, of between 10-30%. The fix is to put the PHY into and take it out of local loopback mode when resetting the interface. Bug fix to support N310 version of Chelsio cards (board ID 1088). Obtained from: Chelsio Inc. Approved by: re@ Modified: stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/cxgb/common/cxgb_ael1002.c stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c stable/7/sys/dev/cxgb/common/cxgb_xgmac.c stable/7/sys/dev/cxgb/cxgb_main.c Modified: stable/7/sys/dev/cxgb/common/cxgb_ael1002.c ============================================================================== --- stable/7/sys/dev/cxgb/common/cxgb_ael1002.c Tue Dec 9 18:27:04 2008 (r185804) +++ stable/7/sys/dev/cxgb/common/cxgb_ael1002.c Tue Dec 9 19:36:04 2008 (r185805) @@ -209,6 +209,16 @@ static int ael1006_reset(struct cphy *ph t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out); msleep(125); t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); + + /* Phy loopback work around for ael1006 */ + /* Soft reset phy by toggling loopback */ + msleep(125); + /* Put phy into local loopback */ + t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 0, 1); + msleep(125); + /* Take phy out of local loopback */ + t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 0); + return 0; } Modified: stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c ============================================================================== --- stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Tue Dec 9 18:27:04 2008 (r185804) +++ stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Tue Dec 9 19:36:04 2008 (r185805) @@ -512,6 +512,12 @@ static struct adapter_info t3_adap_info[ F_GPIO6_OUT_VAL | F_GPIO7_OUT_VAL, { S_GPIO1, S_GPIO2, S_GPIO3, S_GPIO4 }, SUPPORTED_AUI, &mi1_mdio_ops, "Chelsio T304" }, + { 0 }, + { 1, 0, 0, 0, 0, + F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN | + F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, + { S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, + &mi1_mdio_ext_ops, "Chelsio N310" } }; /* Modified: stable/7/sys/dev/cxgb/common/cxgb_xgmac.c ============================================================================== --- stable/7/sys/dev/cxgb/common/cxgb_xgmac.c Tue Dec 9 18:27:04 2008 (r185804) +++ stable/7/sys/dev/cxgb/common/cxgb_xgmac.c Tue Dec 9 19:36:04 2008 (r185805) @@ -637,20 +637,15 @@ int t3b2_mac_watchdog_task(struct cmac * adapter_t *adap = mac->adapter; struct mac_stats *s = &mac->stats; unsigned int tx_mcnt = (unsigned int)s->tx_frames; - unsigned int rx_mcnt = (unsigned int)s->rx_frames; - unsigned int rx_xcnt; if (mac->multiport) { tx_mcnt = t3_read_reg(adap, A_XGM_STAT_TX_FRAME_LOW); - rx_mcnt = t3_read_reg(adap, A_XGM_STAT_RX_FRAMES_LOW); } else { tx_mcnt = (unsigned int)s->tx_frames; - rx_mcnt = (unsigned int)s->rx_frames; } status = 0; tx_xcnt = 1; /* By default tx_xcnt is making progress*/ tx_tcnt = mac->tx_tcnt; /* If tx_mcnt is progressing ignore tx_tcnt*/ - rx_xcnt = 1; /* By default rx_xcnt is making progress*/ if (tx_mcnt == mac->tx_mcnt && mac->rx_pause == s->rx_pause) { tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, A_XGM_TX_SPI4_SOP_EOP_CNT + @@ -661,11 +656,11 @@ int t3b2_mac_watchdog_task(struct cmac * tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, A_TP_PIO_DATA))); } else { - goto rxcheck; + goto out; } } else { mac->toggle_cnt = 0; - goto rxcheck; + goto out; } if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) { @@ -678,22 +673,6 @@ int t3b2_mac_watchdog_task(struct cmac * } } else { mac->toggle_cnt = 0; - goto rxcheck; - } - -rxcheck: - if (rx_mcnt != mac->rx_mcnt) { - rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, - A_XGM_RX_SPI4_SOP_EOP_CNT + - mac->offset))) + - (s->rx_fifo_ovfl - mac->rx_ocnt); - mac->rx_ocnt = s->rx_fifo_ovfl; - } else - goto out; - - if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0) { - if (!mac->multiport) - status = 2; goto out; } @@ -701,8 +680,6 @@ out: mac->tx_tcnt = tx_tcnt; mac->tx_xcnt = tx_xcnt; mac->tx_mcnt = s->tx_frames; - mac->rx_xcnt = rx_xcnt; - mac->rx_mcnt = s->rx_frames; mac->rx_pause = s->rx_pause; if (status == 1) { t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); Modified: stable/7/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/7/sys/dev/cxgb/cxgb_main.c Tue Dec 9 18:27:04 2008 (r185804) +++ stable/7/sys/dev/cxgb/cxgb_main.c Tue Dec 9 19:36:04 2008 (r185805) @@ -298,6 +298,7 @@ struct cxgb_ident { {PCI_VENDOR_ID_CHELSIO, 0x0031, 3, "T3B20"}, {PCI_VENDOR_ID_CHELSIO, 0x0032, 1, "T3B02"}, {PCI_VENDOR_ID_CHELSIO, 0x0033, 4, "T3B04"}, + {PCI_VENDOR_ID_CHELSIO, 0x0035, 6, "N310E"}, {0, 0, 0, NULL} }; @@ -486,12 +487,14 @@ cxgb_controller_attach(device_t dev) return (ENXIO); } sc->udbs_rid = PCIR_BAR(2); - if ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->udbs_rid, RF_ACTIVE)) == NULL) { + sc->udbs_res = NULL; + if (is_offload(sc) && + ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->udbs_rid, RF_ACTIVE)) == NULL)) { device_printf(dev, "Cannot allocate BAR region 1\n"); error = ENXIO; goto out; - } + } snprintf(sc->lockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb controller lock %d", device_get_unit(dev)); From owner-svn-src-stable-7@FreeBSD.ORG Wed Dec 10 00:08:25 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72B81106564A; Wed, 10 Dec 2008 00:08:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C90C8FC1A; Wed, 10 Dec 2008 00:08:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBA08PtJ005204; Wed, 10 Dec 2008 00:08:25 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBA08PwQ005203; Wed, 10 Dec 2008 00:08:25 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200812100008.mBA08PwQ005203@svn.freebsd.org> From: Robert Watson Date: Wed, 10 Dec 2008 00:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185814 - in stable/7/sys: . contrib/pf netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 00:08:25 -0000 Author: rwatson Date: Wed Dec 10 00:08:25 2008 New Revision: 185814 URL: http://svn.freebsd.org/changeset/base/185814 Log: Merge r185791 from head to stable/7: Move macros defining flags and shortcuts to nested structure fields in inpcbinfo below the structure definition in order to make inpcbinfo fit on a single printed page; related style tweaks. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet/in_pcb.h Modified: stable/7/sys/netinet/in_pcb.h ============================================================================== --- stable/7/sys/netinet/in_pcb.h Tue Dec 9 23:57:09 2008 (r185813) +++ stable/7/sys/netinet/in_pcb.h Wed Dec 10 00:08:25 2008 (r185814) @@ -1,6 +1,7 @@ /*- * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. + * The Regents of the University of California. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -88,11 +89,11 @@ struct in_endpoints { struct in_addr_4in6 ie46_local; struct in6_addr ie6_local; } ie_dependladdr; +}; #define ie_faddr ie_dependfaddr.ie46_foreign.ia46_addr4 #define ie_laddr ie_dependladdr.ie46_local.ia46_addr4 #define ie6_faddr ie_dependfaddr.ie6_foreign #define ie6_laddr ie_dependladdr.ie6_local -}; /* * XXX The defines for inc_* are hacks and should be changed to direct @@ -152,19 +153,10 @@ struct inpcb { LIST_ENTRY(inpcb) inp_list; /* (i/p) list for all PCBs for proto */ void *inp_ppcb; /* (i) pointer to per-protocol pcb */ struct inpcbinfo *inp_pcbinfo; /* (c) PCB list info */ - struct socket *inp_socket; /* (i) back pointer to socket */ - - u_int32_t inp_flow; /* (i) IPv6 flow information */ + struct socket *inp_socket; /* (i) back pointer to socket */ + u_int32_t inp_flow; /* (i) IPv6 flow information */ int inp_flags; /* (i) generic IP/datagram flags */ - u_char inp_vflag; /* (i) IP version flag (v4/v6) */ -#define INP_IPV4 0x1 -#define INP_IPV6 0x2 -#define INP_IPV6PROTO 0x4 /* opened under IPv6 protocol */ -#define INP_TIMEWAIT 0x8 /* .. probably doesn't go here */ -#define INP_ONESBCAST 0x10 /* send all-ones broadcast */ -#define INP_DROPPED 0x20 /* protocol drop flag */ -#define INP_SOCKREF 0x40 /* strong socket reference */ u_char inp_ip_ttl; /* (i) time to live proto */ u_char inp_ip_p; /* (c) protocol proto */ u_char inp_ip_minttl; /* (i) minimum TTL or drop */ @@ -173,9 +165,9 @@ struct inpcb { struct ucred *inp_cred; /* (c) cache of socket cred */ /* Local and foreign ports, local and foreign addr. */ - struct in_conninfo inp_inc; + struct in_conninfo inp_inc; /* (i/p) list for PCB's local port */ - /* (i/p) list for PCB's local port */ + /* MAC and IPSEC policy information. */ struct label *inp_label; /* (i) MAC label */ struct inpcbpolicy *inp_sp; /* (s) for IPSEC */ @@ -183,15 +175,8 @@ struct inpcb { struct { u_char inp4_ip_tos; /* (i) type of service proto */ struct mbuf *inp4_options; /* (i) IP options */ - struct ip_moptions *inp4_moptions; /* (i) IP multicast options */ + struct ip_moptions *inp4_moptions; /* (i) IP mcast options */ } inp_depend4; -#define inp_fport inp_inc.inc_fport -#define inp_lport inp_inc.inc_lport -#define inp_faddr inp_inc.inc_faddr -#define inp_laddr inp_inc.inc_laddr -#define inp_ip_tos inp_depend4.inp4_ip_tos -#define inp_options inp_depend4.inp4_options -#define inp_moptions inp_depend4.inp4_moptions struct { /* (i) IP options */ struct mbuf *inp6_options; @@ -208,8 +193,16 @@ struct inpcb { LIST_ENTRY(inpcb) inp_portlist; /* (i/p) */ struct inpcbport *inp_phd; /* (i/p) head of this list */ #define inp_zero_size offsetof(struct inpcb, inp_gencnt) - inp_gen_t inp_gencnt; /* (c) generation count of this instance */ + inp_gen_t inp_gencnt; /* (c) generation count */ struct rwlock inp_lock; +}; +#define inp_fport inp_inc.inc_fport +#define inp_lport inp_inc.inc_lport +#define inp_faddr inp_inc.inc_faddr +#define inp_laddr inp_inc.inc_laddr +#define inp_ip_tos inp_depend4.inp4_ip_tos +#define inp_options inp_depend4.inp4_options +#define inp_moptions inp_depend4.inp4_moptions #define in6p_faddr inp_inc.inc6_faddr #define in6p_laddr inp_inc.inc6_laddr @@ -227,7 +220,7 @@ struct inpcb { #define in6p_lport inp_lport /* for KAME src sync over BSD*'s */ #define in6p_fport inp_fport /* for KAME src sync over BSD*'s */ #define in6p_ppcb inp_ppcb /* for KAME src sync over BSD*'s */ -}; + /* * The range of the generation count, as used in this implementation, is 9e19. * We would have to create 300 billion connections per second for this number @@ -409,7 +402,22 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_PCBPORTHASH(lport, mask) \ (ntohs((lport)) & (mask)) -/* flags in inp_flags: */ +/* + * Flags for inp_vflags -- historically version flags only, but now quite a + * bit more due to an overflow of inp_flag, leading to some locking ambiguity + * as some bits are stable from initial allocation, and others may change. + */ +#define INP_IPV4 0x1 +#define INP_IPV6 0x2 +#define INP_IPV6PROTO 0x4 /* opened under IPv6 protocol */ +#define INP_TIMEWAIT 0x8 /* .. probably doesn't go here */ +#define INP_ONESBCAST 0x10 /* send all-ones broadcast */ +#define INP_DROPPED 0x20 /* protocol drop flag */ +#define INP_SOCKREF 0x40 /* strong socket reference */ + +/* + * Flags for inp_flag. + */ #define INP_RECVOPTS 0x01 /* receive incoming IP options */ #define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ #define INP_RECVDSTADDR 0x04 /* receive IP dst address */ From owner-svn-src-stable-7@FreeBSD.ORG Wed Dec 10 17:00:14 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8136510656D5; Wed, 10 Dec 2008 17:00:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7093E8FC2E; Wed, 10 Dec 2008 17:00:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBAH0Epj036978; Wed, 10 Dec 2008 17:00:14 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBAH0Ehq036977; Wed, 10 Dec 2008 17:00:14 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812101700.mBAH0Ehq036977@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 10 Dec 2008 17:00:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185866 - in stable/7/sys: . contrib/pf dev/cxgb fs/nullfs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 17:00:14 -0000 Author: kib Date: Wed Dec 10 17:00:14 2008 New Revision: 185866 URL: http://svn.freebsd.org/changeset/base/185866 Log: MFC r185335: In null_lookup(), do the needed cleanup instead of panicing saying the cleanup is needed. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/nullfs/null_vnops.c Modified: stable/7/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/7/sys/fs/nullfs/null_vnops.c Wed Dec 10 16:20:49 2008 (r185865) +++ stable/7/sys/fs/nullfs/null_vnops.c Wed Dec 10 17:00:14 2008 (r185866) @@ -365,11 +365,10 @@ null_lookup(struct vop_lookup_args *ap) vrele(lvp); } else { error = null_nodeget(dvp->v_mount, lvp, &vp); - if (error) { - /* XXX Cleanup needed... */ - panic("null_nodeget failed"); - } - *ap->a_vpp = vp; + if (error) + vput(lvp); + else + *ap->a_vpp = vp; } } return (error); From owner-svn-src-stable-7@FreeBSD.ORG Wed Dec 10 17:07:13 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D83B810656A4; Wed, 10 Dec 2008 17:07:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C81508FC17; Wed, 10 Dec 2008 17:07:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBAH7DJU037148; Wed, 10 Dec 2008 17:07:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBAH7Dcf037147; Wed, 10 Dec 2008 17:07:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812101707.mBAH7Dcf037147@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 10 Dec 2008 17: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 X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185867 - in stable/7/sys: . contrib/pf dev/cxgb ufs/ufs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 17:07:14 -0000 Author: kib Date: Wed Dec 10 17:07:13 2008 New Revision: 185867 URL: http://svn.freebsd.org/changeset/base/185867 Log: MFC r185739: Improve usefulness of the panic by printing the pointer to the problematic dquot. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/ufs/ufs/ufs_quota.c Modified: stable/7/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_quota.c Wed Dec 10 17:00:14 2008 (r185866) +++ stable/7/sys/ufs/ufs/ufs_quota.c Wed Dec 10 17:07:13 2008 (r185867) @@ -1207,7 +1207,7 @@ hfound: DQI_LOCK(dq); return (EUSERS); } if (dq->dq_cnt || (dq->dq_flags & DQ_MOD)) - panic("dqget: free dquot isn't"); + panic("dqget: free dquot isn't %p", dq); TAILQ_REMOVE(&dqfreelist, dq, dq_freelist); if (dq->dq_ump != NULL) LIST_REMOVE(dq, dq_hash); From owner-svn-src-stable-7@FreeBSD.ORG Thu Dec 11 05:56:48 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 265C71065670; Thu, 11 Dec 2008 05:56:48 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13BE18FC1D; Thu, 11 Dec 2008 05:56:48 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBB5ulvG055768; Thu, 11 Dec 2008 05:56:47 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBB5ulMx055764; Thu, 11 Dec 2008 05:56:47 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812110556.mBB5ulMx055764@svn.freebsd.org> From: Tim Kientzle Date: Thu, 11 Dec 2008 05:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185909 - in stable/7/usr.bin/tar: . test X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 05:56:48 -0000 Author: kientzle Date: Thu Dec 11 05:56:47 2008 New Revision: 185909 URL: http://svn.freebsd.org/changeset/base/185909 Log: MFC r183009, r184807, r184808: Fix --strip-components, plus a handful of test suite improvements. PR: bin/128562 Submitted by: Jaakko Heinonen Approved by: re Added: stable/7/usr.bin/tar/test/test_strip_components.c - copied, changed from r184807, head/usr.bin/tar/test/test_strip_components.c stable/7/usr.bin/tar/test/test_symlink_dir.c - copied unchanged from r183009, head/usr.bin/tar/test/test_symlink_dir.c Modified: stable/7/usr.bin/tar/ (props changed) stable/7/usr.bin/tar/test/Makefile stable/7/usr.bin/tar/util.c Modified: stable/7/usr.bin/tar/test/Makefile ============================================================================== --- stable/7/usr.bin/tar/test/Makefile Thu Dec 11 05:56:25 2008 (r185908) +++ stable/7/usr.bin/tar/test/Makefile Thu Dec 11 05:56:47 2008 (r185909) @@ -18,6 +18,8 @@ TESTS= \ test_option_q.c \ test_patterns.c \ test_stdio.c \ + test_strip_components.c \ + test_symlink_dir.c \ test_version.c # Build the test program Copied and modified: stable/7/usr.bin/tar/test/test_strip_components.c (from r184807, head/usr.bin/tar/test/test_strip_components.c) ============================================================================== --- head/usr.bin/tar/test/test_strip_components.c Mon Nov 10 05:04:55 2008 (r184807, copy source) +++ stable/7/usr.bin/tar/test/test_strip_components.c Thu Dec 11 05:56:47 2008 (r185909) @@ -63,15 +63,44 @@ DEFINE_TEST(test_strip_components) assertEqualInt(-1, lstat("target/d0", &st)); failure("d0/d1/ is too short and should not get restored"); assertEqualInt(-1, lstat("target/d1", &st)); - failure("d0/l1 is too short and should not get restored"); - assertEqualInt(-1, lstat("target/l1", &st)); - failure("d0/d1/l2 is a hardlink to file whose name was too short"); - assertEqualInt(-1, lstat("target/l2", &st)); - assertEqualInt(0, lstat("target/s2", &st)); failure("d0/d1/s2 is a symlink to something that won't be extracted"); assertEqualInt(-1, stat("target/s2", &st)); + assertEqualInt(0, lstat("target/s2", &st)); failure("d0/d1/d2 should be extracted"); assertEqualInt(0, lstat("target/d2", &st)); + + /* + * This next is a complicated case. d0/l1, d0/d1/l2, and + * d0/d1/d2/f1 are all hardlinks to the same file; d0/l1 can't + * be extracted with --strip-components=2 and the other two + * can. Remember that tar normally stores the first file with + * a body and the other as hardlink entries to the first + * appearance. So the final result depends on the order in + * which these three names get archived. If d0/l1 is first, + * none of the three can be restored. If either of the longer + * names are first, then the two longer ones can both be + * restored. + * + * The tree-walking code used by bsdtar always visits files + * before subdirectories, so bsdtar's behavior is fortunately + * deterministic: d0/l1 will always get stored first and the + * other two will be stored as hardlinks to d0/l1. Since + * d0/l1 can't be extracted, none of these three will be + * extracted. + * + * It may be worth extending this test to force a particular + * archiving order so as to exercise both of the cases described + * above. + * + * Of course, this is all totally different for cpio and newc + * formats because the hardlink management is different. + * TODO: Rename this to test_strip_components_tar and create + * parallel tests for cpio and newc formats. + */ + failure("d0/l1 is too short and should not get restored"); + assertEqualInt(-1, lstat("target/l1", &st)); + failure("d0/d1/l2 is a hardlink to file whose name was too short"); + assertEqualInt(-1, lstat("target/l2", &st)); failure("d0/d1/d2/f1 is a hardlink to file whose name was too short"); assertEqualInt(-1, lstat("target/d2/f1", &st)); } Copied: stable/7/usr.bin/tar/test/test_symlink_dir.c (from r183009, head/usr.bin/tar/test/test_symlink_dir.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/usr.bin/tar/test/test_symlink_dir.c Thu Dec 11 05:56:47 2008 (r185909, copy of r183009, head/usr.bin/tar/test/test_symlink_dir.c) @@ -0,0 +1,172 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * tar -x -P should follow existing symlinks for dirs, but not other + * content. Plain tar -x should remove symlinks when they're in the + * way of a dir extraction. + */ + +static int +mkfile(const char *name, int mode, const char *contents, ssize_t size) +{ + int fd = open(name, O_CREAT | O_WRONLY, mode); + if (fd < 0) + return (-1); + if (size != write(fd, contents, size)) { + close(fd); + return (-1); + } + close(fd); + return (0); +} + +DEFINE_TEST(test_symlink_dir) +{ + struct stat st, st2; + int oldumask; + + oldumask = umask(0); + + assertEqualInt(0, mkdir("source", 0755)); + assertEqualInt(0, mkfile("source/file", 0755, "a", 1)); + assertEqualInt(0, mkfile("source/file2", 0755, "ab", 2)); + assertEqualInt(0, mkdir("source/dir", 0755)); + assertEqualInt(0, mkdir("source/dir/d", 0755)); + assertEqualInt(0, mkfile("source/dir/f", 0755, "abc", 3)); + assertEqualInt(0, mkdir("source/dir2", 0755)); + assertEqualInt(0, mkdir("source/dir2/d2", 0755)); + assertEqualInt(0, mkfile("source/dir2/f2", 0755, "abcd", 4)); + assertEqualInt(0, mkdir("source/dir3", 0755)); + assertEqualInt(0, mkdir("source/dir3/d3", 0755)); + assertEqualInt(0, mkfile("source/dir3/f3", 0755, "abcde", 5)); + + assertEqualInt(0, + systemf("%s -cf test.tar -C source dir dir2 dir3 file file2", + testprog)); + + /* + * Extract with -x and without -P. + */ + assertEqualInt(0, mkdir("dest1", 0755)); + /* "dir" is a symlink to an existing "real_dir" */ + assertEqualInt(0, mkdir("dest1/real_dir", 0755)); + assertEqualInt(0, symlink("real_dir", "dest1/dir")); + /* "dir2" is a symlink to a non-existing "real_dir2" */ + assertEqualInt(0, symlink("real_dir2", "dest1/dir2")); + /* "dir3" is a symlink to an existing "non_dir3" */ + assertEqualInt(0, mkfile("dest1/non_dir3", 0755, "abcdef", 6)); + assertEqualInt(0, symlink("non_dir3", "dest1/dir3")); + /* "file" is a symlink to existing "real_file" */ + assertEqualInt(0, mkfile("dest1/real_file", 0755, "abcdefg", 7)); + assertEqualInt(0, symlink("real_file", "dest1/file")); + /* "file2" is a symlink to non-existing "real_file2" */ + assertEqualInt(0, symlink("real_file2", "dest1/file2")); + + assertEqualInt(0, systemf("%s -xf test.tar -C dest1", testprog)); + + /* dest1/dir symlink should be removed */ + assertEqualInt(0, lstat("dest1/dir", &st)); + failure("symlink to dir was followed when it shouldn't be"); + assert(S_ISDIR(st.st_mode)); + /* dest1/dir2 symlink should be removed */ + assertEqualInt(0, lstat("dest1/dir2", &st)); + failure("Broken symlink wasn't replaced with dir"); + assert(S_ISDIR(st.st_mode)); + /* dest1/dir3 symlink should be removed */ + assertEqualInt(0, lstat("dest1/dir3", &st)); + failure("Symlink to non-dir wasn't replaced with dir"); + assert(S_ISDIR(st.st_mode)); + /* dest1/file symlink should be removed */ + assertEqualInt(0, lstat("dest1/file", &st)); + failure("Symlink to existing file should be removed"); + assert(S_ISREG(st.st_mode)); + /* dest1/file2 symlink should be removed */ + assertEqualInt(0, lstat("dest1/file2", &st)); + failure("Symlink to non-existing file should be removed"); + assert(S_ISREG(st.st_mode)); + + /* + * Extract with both -x and -P + */ + assertEqualInt(0, mkdir("dest2", 0755)); + /* "dir" is a symlink to existing "real_dir" */ + assertEqualInt(0, mkdir("dest2/real_dir", 0755)); + assertEqualInt(0, symlink("real_dir", "dest2/dir")); + /* "dir2" is a symlink to a non-existing "real_dir2" */ + assertEqualInt(0, symlink("real_dir2", "dest2/dir2")); + /* "dir3" is a symlink to an existing "non_dir3" */ + assertEqualInt(0, mkfile("dest2/non_dir3", 0755, "abcdefgh", 8)); + assertEqualInt(0, symlink("non_dir3", "dest2/dir3")); + /* "file" is a symlink to existing "real_file" */ + assertEqualInt(0, mkfile("dest2/real_file", 0755, "abcdefghi", 9)); + assertEqualInt(0, symlink("real_file", "dest2/file")); + /* "file2" is a symlink to non-existing "real_file2" */ + assertEqualInt(0, symlink("real_file2", "dest2/file2")); + + assertEqualInt(0, systemf("%s -xPf test.tar -C dest2", testprog)); + + /* dest2/dir symlink should be followed */ + assertEqualInt(0, lstat("dest2/dir", &st)); + failure("tar -xP removed symlink instead of following it"); + if (assert(S_ISLNK(st.st_mode))) { + /* Only verify what the symlink points to if it + * really is a symlink. */ + failure("The symlink should point to a directory"); + assertEqualInt(0, stat("dest2/dir", &st)); + assert(S_ISDIR(st.st_mode)); + failure("The pre-existing directory should still be there"); + assertEqualInt(0, lstat("dest2/real_dir", &st2)); + assert(S_ISDIR(st2.st_mode)); + assertEqualInt(st.st_dev, st2.st_dev); + failure("symlink should still point to the existing directory"); + assertEqualInt(st.st_ino, st2.st_ino); + } + /* Contents of 'dir' should be restored */ + assertEqualInt(0, lstat("dest2/dir/d", &st)); + assert(S_ISDIR(st.st_mode)); + assertEqualInt(0, lstat("dest2/dir/f", &st)); + assert(S_ISREG(st.st_mode)); + assertEqualInt(3, st.st_size); + /* dest2/dir2 symlink should be removed */ + assertEqualInt(0, lstat("dest2/dir2", &st)); + failure("Broken symlink wasn't replaced with dir"); + assert(S_ISDIR(st.st_mode)); + /* dest2/dir3 symlink should be removed */ + assertEqualInt(0, lstat("dest2/dir3", &st)); + failure("Symlink to non-dir wasn't replaced with dir"); + assert(S_ISDIR(st.st_mode)); + /* dest2/file symlink should be removed; + * even -P shouldn't follow symlinks for files */ + assertEqualInt(0, lstat("dest2/file", &st)); + failure("Symlink to existing file should be removed"); + assert(S_ISREG(st.st_mode)); + /* dest2/file2 symlink should be removed */ + assertEqualInt(0, lstat("dest2/file2", &st)); + failure("Symlink to non-existing file should be removed"); + assert(S_ISREG(st.st_mode)); +} Modified: stable/7/usr.bin/tar/util.c ============================================================================== --- stable/7/usr.bin/tar/util.c Thu Dec 11 05:56:25 2008 (r185908) +++ stable/7/usr.bin/tar/util.c Thu Dec 11 05:56:47 2008 (r185909) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); static void bsdtar_vwarnc(struct bsdtar *, int code, const char *fmt, va_list ap); +static const char *strip_components(const char *path, int elements); /* * Print a string, taking care with any non-printable characters. @@ -346,6 +347,31 @@ do_chdir(struct bsdtar *bsdtar) bsdtar->pending_chdir = NULL; } +const char * +strip_components(const char *path, int elements) +{ + const char *p = path; + + while (elements > 0) { + switch (*p++) { + case '/': + elements--; + path = p; + break; + case '\0': + /* Path is too short, skip it. */ + return (NULL); + } + } + + while (*path == '/') + ++path; + if (*path == '\0') + return (NULL); + + return (path); +} + /* * Handle --strip-components and any future path-rewriting options. * Returns non-zero if the pathname should not be extracted. @@ -402,24 +428,20 @@ edit_pathname(struct bsdtar *bsdtar, str #endif /* Strip leading dir names as per --strip-components option. */ - if ((r = bsdtar->strip_components) > 0) { - const char *p = name; + if (bsdtar->strip_components > 0) { + const char *linkname = archive_entry_hardlink(entry); + + name = strip_components(name, bsdtar->strip_components); + if (name == NULL) + return (1); - while (r > 0) { - switch (*p++) { - case '/': - r--; - name = p; - break; - case '\0': - /* Path is too short, skip it. */ + if (linkname != NULL) { + linkname = strip_components(linkname, + bsdtar->strip_components); + if (linkname == NULL) return (1); - } + archive_entry_copy_hardlink(entry, linkname); } - while (*name == '/') - ++name; - if (*name == '\0') - return (1); } /* Strip redundant leading '/' characters. */ From owner-svn-src-stable-7@FreeBSD.ORG Thu Dec 11 12:44:29 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FC911065673; Thu, 11 Dec 2008 12:44:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DD588FC1D; Thu, 11 Dec 2008 12:44:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBBCiTEH065463; Thu, 11 Dec 2008 12:44:29 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBCiSlj065462; Thu, 11 Dec 2008 12:44:28 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200812111244.mBBCiSlj065462@svn.freebsd.org> From: Robert Watson Date: Thu, 11 Dec 2008 12:44:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185929 - in stable/7/sys: . contrib/pf dev/cxgb netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 12:44:29 -0000 Author: rwatson Date: Thu Dec 11 12:44:28 2008 New Revision: 185929 URL: http://svn.freebsd.org/changeset/base/185929 Log: Merge r185813 from head to stable/7: Update comment on INP_TIMEWAIT to say what it's about, as we caution regarding the misplacement of flags in inp_vflag in an earlier comment. Approved by: re (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/in_pcb.h Modified: stable/7/sys/netinet/in_pcb.h ============================================================================== --- stable/7/sys/netinet/in_pcb.h Thu Dec 11 10:29:35 2008 (r185928) +++ stable/7/sys/netinet/in_pcb.h Thu Dec 11 12:44:28 2008 (r185929) @@ -410,7 +410,7 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_IPV4 0x1 #define INP_IPV6 0x2 #define INP_IPV6PROTO 0x4 /* opened under IPv6 protocol */ -#define INP_TIMEWAIT 0x8 /* .. probably doesn't go here */ +#define INP_TIMEWAIT 0x8 /* inpcb in TIMEWAIT, ppcb is tcptw */ #define INP_ONESBCAST 0x10 /* send all-ones broadcast */ #define INP_DROPPED 0x20 /* protocol drop flag */ #define INP_SOCKREF 0x40 /* strong socket reference */ From owner-svn-src-stable-7@FreeBSD.ORG Thu Dec 11 13:30:30 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E54A106564A; Thu, 11 Dec 2008 13:30:30 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49D8E8FC24; Thu, 11 Dec 2008 13:30:30 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBBDUUx0066322; Thu, 11 Dec 2008 13:30:30 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBDUUGe066321; Thu, 11 Dec 2008 13:30:30 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200812111330.mBBDUUGe066321@svn.freebsd.org> From: Robert Watson Date: Thu, 11 Dec 2008 13:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185930 - in stable/7/sys: . contrib/pf dev/cxgb netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 13:30:30 -0000 Author: rwatson Date: Thu Dec 11 13:30:29 2008 New Revision: 185930 URL: http://svn.freebsd.org/changeset/base/185930 Log: Merge r185855 from head to stable/7: Move flag definitions for t_flags and t_oobflags below the definition of struct tcpcb so that the structure definition is a bit more vertically compact. Can't yet fit it on one printed page, though. Approved by: re (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/tcp_var.h Modified: stable/7/sys/netinet/tcp_var.h ============================================================================== --- stable/7/sys/netinet/tcp_var.h Thu Dec 11 12:44:28 2008 (r185929) +++ stable/7/sys/netinet/tcp_var.h Thu Dec 11 13:30:29 2008 (r185930) @@ -101,29 +101,6 @@ struct tcpcb { struct inpcb *t_inpcb; /* back pointer to internet pcb */ int t_state; /* state of this connection */ u_int t_flags; -#define TF_ACKNOW 0x000001 /* ack peer immediately */ -#define TF_DELACK 0x000002 /* ack, but try to delay it */ -#define TF_NODELAY 0x000004 /* don't delay packets to coalesce */ -#define TF_NOOPT 0x000008 /* don't use tcp options */ -#define TF_SENTFIN 0x000010 /* have sent FIN */ -#define TF_REQ_SCALE 0x000020 /* have/will request window scaling */ -#define TF_RCVD_SCALE 0x000040 /* other side has requested scaling */ -#define TF_REQ_TSTMP 0x000080 /* have/will request timestamps */ -#define TF_RCVD_TSTMP 0x000100 /* a timestamp was received in SYN */ -#define TF_SACK_PERMIT 0x000200 /* other side said I could SACK */ -#define TF_NEEDSYN 0x000400 /* send SYN (implicit state) */ -#define TF_NEEDFIN 0x000800 /* send FIN (implicit state) */ -#define TF_NOPUSH 0x001000 /* don't push */ -#define TF_MORETOCOME 0x010000 /* More data to be appended to sock */ -#define TF_LQ_OVERFLOW 0x020000 /* listen queue overflow */ -#define TF_LASTIDLE 0x040000 /* connection was previously idle */ -#define TF_RXWIN0SENT 0x080000 /* sent a receiver win 0 in response */ -#define TF_FASTRECOVERY 0x100000 /* in NewReno Fast Recovery */ -#define TF_WASFRECOVERY 0x200000 /* was in NewReno Fast Recovery */ -#define TF_SIGNATURE 0x400000 /* require MD5 digests (RFC2385) */ -#define TF_FORCEDATA 0x800000 /* force out a byte */ -#define TF_TSO 0x1000000 /* TSO enabled on this connection */ -#define TF_TOE 0x2000000 /* this connection is offloaded */ tcp_seq snd_una; /* send unacknowledged */ tcp_seq snd_max; /* highest sequence number sent; @@ -177,8 +154,6 @@ struct tcpcb { /* out-of-band data */ char t_oobflags; /* have some */ char t_iobc; /* input character */ -#define TCPOOB_HAVEDATA 0x01 -#define TCPOOB_HADDATA 0x02 /* RFC 1323 variables */ u_char snd_scale; /* window scaling for send window */ u_char rcv_scale; /* window scaling for recv window */ @@ -212,10 +187,43 @@ struct tcpcb { void *t_toe; /* TOE pcb pointer */ }; +/* + * Flags and utility macros for the t_flags field. + */ +#define TF_ACKNOW 0x000001 /* ack peer immediately */ +#define TF_DELACK 0x000002 /* ack, but try to delay it */ +#define TF_NODELAY 0x000004 /* don't delay packets to coalesce */ +#define TF_NOOPT 0x000008 /* don't use tcp options */ +#define TF_SENTFIN 0x000010 /* have sent FIN */ +#define TF_REQ_SCALE 0x000020 /* have/will request window scaling */ +#define TF_RCVD_SCALE 0x000040 /* other side has requested scaling */ +#define TF_REQ_TSTMP 0x000080 /* have/will request timestamps */ +#define TF_RCVD_TSTMP 0x000100 /* a timestamp was received in SYN */ +#define TF_SACK_PERMIT 0x000200 /* other side said I could SACK */ +#define TF_NEEDSYN 0x000400 /* send SYN (implicit state) */ +#define TF_NEEDFIN 0x000800 /* send FIN (implicit state) */ +#define TF_NOPUSH 0x001000 /* don't push */ +#define TF_MORETOCOME 0x010000 /* More data to be appended to sock */ +#define TF_LQ_OVERFLOW 0x020000 /* listen queue overflow */ +#define TF_LASTIDLE 0x040000 /* connection was previously idle */ +#define TF_RXWIN0SENT 0x080000 /* sent a receiver win 0 in response */ +#define TF_FASTRECOVERY 0x100000 /* in NewReno Fast Recovery */ +#define TF_WASFRECOVERY 0x200000 /* was in NewReno Fast Recovery */ +#define TF_SIGNATURE 0x400000 /* require MD5 digests (RFC2385) */ +#define TF_FORCEDATA 0x800000 /* force out a byte */ +#define TF_TSO 0x1000000 /* TSO enabled on this connection */ +#define TF_TOE 0x2000000 /* this connection is offloaded */ + #define IN_FASTRECOVERY(tp) (tp->t_flags & TF_FASTRECOVERY) #define ENTER_FASTRECOVERY(tp) tp->t_flags |= TF_FASTRECOVERY #define EXIT_FASTRECOVERY(tp) tp->t_flags &= ~TF_FASTRECOVERY +/* + * Flags for the t_oobflags field. + */ +#define TCPOOB_HAVEDATA 0x01 +#define TCPOOB_HADDATA 0x02 + #ifdef TCP_SIGNATURE /* * Defines which are needed by the xform_tcp module and tcp_[in|out]put From owner-svn-src-stable-7@FreeBSD.ORG Thu Dec 11 22:28:29 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0E7B1065675; Thu, 11 Dec 2008 22:28:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 855898FC18; Thu, 11 Dec 2008 22:28:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBBMSTDv078322; Thu, 11 Dec 2008 22:28:29 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBBMST21078321; Thu, 11 Dec 2008 22:28:29 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200812112228.mBBMST21078321@svn.freebsd.org> From: Robert Watson Date: Thu, 11 Dec 2008 22:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185944 - in stable/7/sys: . contrib/pf dev/cxgb netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 22:28:29 -0000 Author: rwatson Date: Thu Dec 11 22:28:29 2008 New Revision: 185944 URL: http://svn.freebsd.org/changeset/base/185944 Log: Merge r185857 from head to stable/7: Move syncache flag definitions below data structure, compress some vertical whitespace. Approved by: re (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/tcp_syncache.c Modified: stable/7/sys/netinet/tcp_syncache.c ============================================================================== --- stable/7/sys/netinet/tcp_syncache.c Thu Dec 11 22:20:36 2008 (r185943) +++ stable/7/sys/netinet/tcp_syncache.c Thu Dec 11 22:28:29 2008 (r185944) @@ -115,7 +115,6 @@ struct syncache { struct in_conninfo sc_inc; /* addresses */ int sc_rxttime; /* retransmit time */ u_int16_t sc_rxmits; /* retransmit counter */ - u_int32_t sc_tsreflect; /* timestamp to reflect */ u_int32_t sc_ts; /* our timestamp to send */ u_int32_t sc_tsoff; /* ts offset w/ syncookies */ @@ -123,7 +122,6 @@ struct syncache { tcp_seq sc_irs; /* seq from peer */ tcp_seq sc_iss; /* our ISS */ struct mbuf *sc_ipopts; /* source route */ - u_int16_t sc_peer_mss; /* peer's MSS */ u_int16_t sc_wnd; /* advertised window */ u_int8_t sc_ip_ttl; /* IPv4 TTL */ @@ -131,13 +129,6 @@ struct syncache { u_int8_t sc_requested_s_scale:4, sc_requested_r_scale:4; u_int8_t sc_flags; -#define SCF_NOOPT 0x01 /* no TCP options */ -#define SCF_WINSCALE 0x02 /* negotiated window scaling */ -#define SCF_TIMESTAMP 0x04 /* negotiated timestamps */ - /* MSS is implicit */ -#define SCF_UNREACH 0x10 /* icmp unreachable received */ -#define SCF_SIGNATURE 0x20 /* send MD5 digests */ -#define SCF_SACK 0x80 /* send SACK option */ #ifndef TCP_OFFLOAD_DISABLE struct toe_usrreqs *sc_tu; /* TOE operations */ void *sc_toepcb; /* TOE protocol block */ @@ -148,6 +139,17 @@ struct syncache { struct ucred *sc_cred; /* cred cache for jail checks */ }; +/* + * Flags for the sc_flags field. + */ +#define SCF_NOOPT 0x01 /* no TCP options */ +#define SCF_WINSCALE 0x02 /* negotiated window scaling */ +#define SCF_TIMESTAMP 0x04 /* negotiated timestamps */ + /* MSS is implicit */ +#define SCF_UNREACH 0x10 /* icmp unreachable received */ +#define SCF_SIGNATURE 0x20 /* send MD5 digests */ +#define SCF_SACK 0x80 /* send SACK option */ + #ifdef TCP_OFFLOAD_DISABLE #define TOEPCB_ISSET(sc) (0) #else From owner-svn-src-stable-7@FreeBSD.ORG Fri Dec 12 13:09:52 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADC571065670; Fri, 12 Dec 2008 13:09:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B86A8FC18; Fri, 12 Dec 2008 13:09:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBCD9qr1098321; Fri, 12 Dec 2008 13:09:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBCD9qWW098320; Fri, 12 Dec 2008 13:09:52 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812121309.mBCD9qWW098320@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 12 Dec 2008 13:09:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185985 - in stable/7/sys: . amd64/amd64 contrib/pf dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 13:09:52 -0000 Author: kib Date: Fri Dec 12 13:09:52 2008 New Revision: 185985 URL: http://svn.freebsd.org/changeset/base/185985 Log: MFC r185634: Improve db_backtrace() for compat ia32 on amd64. 32bit image enters the kernel via Xint0x80_syscall(). Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/db_trace.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/amd64/amd64/db_trace.c ============================================================================== --- stable/7/sys/amd64/amd64/db_trace.c Fri Dec 12 12:12:36 2008 (r185984) +++ stable/7/sys/amd64/amd64/db_trace.c Fri Dec 12 13:09:52 2008 (r185985) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #include #include #include @@ -318,6 +320,10 @@ db_nextframe(struct amd64_frame **fp, db frame_type = INTERRUPT; else if (strcmp(name, "Xfast_syscall") == 0) frame_type = SYSCALL; +#ifdef COMPAT_IA32 + else if (strcmp(name, "Xint0x80_syscall") == 0) + frame_type = SYSCALL; +#endif /* XXX: These are interrupts with trap frames. */ else if (strcmp(name, "Xtimerint") == 0 || strcmp(name, "Xcpustop") == 0 || From owner-svn-src-stable-7@FreeBSD.ORG Sat Dec 13 16:53:35 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9B221065673; Sat, 13 Dec 2008 16:53:35 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D69208FC16; Sat, 13 Dec 2008 16:53:35 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBDGrZRF034553; Sat, 13 Dec 2008 16:53:35 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBDGrZkM034552; Sat, 13 Dec 2008 16:53:35 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <200812131653.mBDGrZkM034552@svn.freebsd.org> From: Ruslan Ermilov Date: Sat, 13 Dec 2008 16:53:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186042 - releng/7.1/lib/libc releng/7.1/lib/libc/stdio stable/7/lib/libc stable/7/lib/libc/stdio X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 16:53:36 -0000 Author: ru Date: Sat Dec 13 16:53:35 2008 New Revision: 186042 URL: http://svn.freebsd.org/changeset/base/186042 Log: MFC: Fix fread() to return a correct value on platforms where sizeof(int) != sizeof(size_t), i.e. on all 64-bit platforms. Approved by: re (kib) Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdio/fread.c Changes in other areas also in this revision: Modified: releng/7.1/lib/libc/ (props changed) releng/7.1/lib/libc/stdio/fread.c Modified: stable/7/lib/libc/stdio/fread.c ============================================================================== --- stable/7/lib/libc/stdio/fread.c Sat Dec 13 16:13:37 2008 (r186041) +++ stable/7/lib/libc/stdio/fread.c Sat Dec 13 16:53:35 2008 (r186042) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); size_t fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp) { - int ret; + size_t ret; FLOCKFILE(fp); ret = __fread(buf, size, count, fp); From owner-svn-src-stable-7@FreeBSD.ORG Sat Dec 13 18:29:49 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 848A31065679; Sat, 13 Dec 2008 18:29:49 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 718E98FC13; Sat, 13 Dec 2008 18:29:49 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBDITn1b036330; Sat, 13 Dec 2008 18:29:49 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBDITnGp036329; Sat, 13 Dec 2008 18:29:49 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200812131829.mBDITnGp036329@svn.freebsd.org> From: Ken Smith Date: Sat, 13 Dec 2008 18:29:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186044 - stable/7/gnu/usr.bin/groff/tmac X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 18:29:49 -0000 Author: kensmith Date: Sat Dec 13 18:29:48 2008 New Revision: 186044 URL: http://svn.freebsd.org/changeset/base/186044 Log: Due to a mis-understanding on my part with Ruslan I haven't been updating this like I should have been. Mis-understanding is cleared up I think. Change default operating system for upcoming release. Add release names not in contrib/groff/tmac/doc-common yet. Submitted by: ru Approved by: re (implicit) Modified: stable/7/gnu/usr.bin/groff/tmac/mdoc.local Modified: stable/7/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- stable/7/gnu/usr.bin/groff/tmac/mdoc.local Sat Dec 13 17:48:06 2008 (r186043) +++ stable/7/gnu/usr.bin/groff/tmac/mdoc.local Sat Dec 13 18:29:48 2008 (r186044) @@ -64,10 +64,12 @@ .ds doc-volume-as-arm arm . .\" Default .Os value -.ds doc-default-operating-system FreeBSD\~7.0 +.ds doc-default-operating-system FreeBSD\~7.1 . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-6.3 6.3 +.ds doc-operating-system-FreeBSD-6.4 6.4 +.ds doc-operating-system-FreeBSD-7.1 7.1 .ds doc-operating-system-FreeBSD-8.0 8.0 . .ec