From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 00:20:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84A16106564A; Sun, 14 Aug 2011 00:20:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 722E18FC13; Sun, 14 Aug 2011 00:20:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7E0KbBe039074; Sun, 14 Aug 2011 00:20:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7E0KbMw039063; Sun, 14 Aug 2011 00:20:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201108140020.p7E0KbMw039063@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 14 Aug 2011 00:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224857 - in head/sys: boot/powerpc/ps3 conf powerpc/ps3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 00:20:37 -0000 Author: nwhitehorn Date: Sun Aug 14 00:20:37 2011 New Revision: 224857 URL: http://svn.freebsd.org/changeset/base/224857 Log: Add support for the Blu-Ray drive found in the Sony Playstation 3 and fix some realted minor bugs in PS3 internal storage support. Submitted by: glevand Approved by: re (bz) Added: head/sys/boot/powerpc/ps3/ps3cdrom.c (contents, props changed) head/sys/powerpc/ps3/ps3cdrom.c (contents, props changed) Modified: head/sys/boot/powerpc/ps3/Makefile head/sys/boot/powerpc/ps3/conf.c head/sys/boot/powerpc/ps3/devicename.c head/sys/boot/powerpc/ps3/lv1call.S head/sys/boot/powerpc/ps3/lv1call.h head/sys/boot/powerpc/ps3/main.c head/sys/boot/powerpc/ps3/ps3stor.c head/sys/conf/files.powerpc Modified: head/sys/boot/powerpc/ps3/Makefile ============================================================================== --- head/sys/boot/powerpc/ps3/Makefile Sat Aug 13 23:34:17 2011 (r224856) +++ head/sys/boot/powerpc/ps3/Makefile Sun Aug 14 00:20:37 2011 (r224857) @@ -10,7 +10,8 @@ INSTALLFLAGS= -b # Architecture-specific loader code SRCS= start.S conf.c metadata.c vers.c main.c devicename.c ppc64_elf_freebsd.c -SRCS+= lv1call.S ps3cons.c font.h ps3mmu.c ps3net.c ps3repo.c ps3stor.c ps3disk.c +SRCS+= lv1call.S ps3cons.c font.h ps3mmu.c ps3net.c ps3repo.c \ + ps3stor.c ps3disk.c ps3cdrom.c SRCS+= ucmpdi2.c LOADER_DISK_SUPPORT?= yes Modified: head/sys/boot/powerpc/ps3/conf.c ============================================================================== --- head/sys/boot/powerpc/ps3/conf.c Sat Aug 13 23:34:17 2011 (r224856) +++ head/sys/boot/powerpc/ps3/conf.c Sun Aug 14 00:20:37 2011 (r224857) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #endif extern struct devsw ps3disk; +extern struct devsw ps3cdrom; /* * We could use linker sets for some or all of these, but @@ -47,7 +48,10 @@ extern struct devsw ps3disk; /* Exported for libstand */ struct devsw *devsw[] = { -#if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT) +#if defined(LOADER_CD9660_SUPPORT) + &ps3cdrom, +#endif +#if defined(LOADER_DISK_SUPPORT) &ps3disk, #endif #if defined(LOADER_NET_SUPPORT) Modified: head/sys/boot/powerpc/ps3/devicename.c ============================================================================== --- head/sys/boot/powerpc/ps3/devicename.c Sat Aug 13 23:34:17 2011 (r224856) +++ head/sys/boot/powerpc/ps3/devicename.c Sun Aug 14 00:20:37 2011 (r224857) @@ -157,6 +157,7 @@ ps3_parsedev(struct ps3_devdesc **dev, c break; case DEVT_NET: + case DEVT_CD: /* * PS3 only has one network interface (well, two, but * netbooting over wireless is not something I'm going @@ -213,6 +214,7 @@ ps3_fmtdev(void *vdev) break; case DEVT_NET: + case DEVT_CD: sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit); break; } Modified: head/sys/boot/powerpc/ps3/lv1call.S ============================================================================== --- head/sys/boot/powerpc/ps3/lv1call.S Sat Aug 13 23:34:17 2011 (r224856) +++ head/sys/boot/powerpc/ps3/lv1call.S Sun Aug 14 00:20:37 2011 (r224857) @@ -307,14 +307,8 @@ lv1_storage_read: sldi %r6,%r9,32 clrldi %r7,%r10,32 or %r6,%r6,%r7 - lwz %r7,8(%r1) - lwz %r8,12(%r1) - sldi %r7,%r7,32 - or %r7,%r7,%r8 - lwz %r8,16(%r1) - lwz %r9,20(%r1) - sldi %r8,%r8,32 - or %r8,%r8,%r9 + ld %r7,8(%r1) + ld %r8,16(%r1) li %r11,245 hc Modified: head/sys/boot/powerpc/ps3/lv1call.h ============================================================================== --- head/sys/boot/powerpc/ps3/lv1call.h Sat Aug 13 23:34:17 2011 (r224856) +++ head/sys/boot/powerpc/ps3/lv1call.h Sun Aug 14 00:20:37 2011 (r224857) @@ -69,12 +69,12 @@ int lv1_net_stop_tx_dma(int bus, int dev int lv1_net_stop_rx_dma(int bus, int dev, int); int lv1_get_repository_node_value(uint64_t lpar_id, uint64_t n1, uint64_t n2, - uint64_t n3, uint64_t n4, uint64_t *v1, uint64_t *v2); + uint64_t n3, uint64_t n4, uint64_t *v1, uint64_t *v2); -int lv1_storage_read(uint64_t dev_id, uint64_t region_id, - uint64_t start_sector, uint64_t sector_count, - uint64_t flags, uint64_t buf, uint64_t *tag); -int lv1_storage_check_async_status(uint64_t dev_id, uint64_t tag, uint64_t *status); +int lv1_storage_read(uint64_t dev_id, uint64_t region_id, uint64_t start_sector, + uint64_t sector_count, uint64_t flags, uint64_t buf, uint64_t *tag); +int lv1_storage_check_async_status(uint64_t dev_id, uint64_t tag, + uint64_t *status); #endif Modified: head/sys/boot/powerpc/ps3/main.c ============================================================================== --- head/sys/boot/powerpc/ps3/main.c Sat Aug 13 23:34:17 2011 (r224856) +++ head/sys/boot/powerpc/ps3/main.c Sun Aug 14 00:20:37 2011 (r224857) @@ -92,11 +92,17 @@ main(void) } } - printf("\nDevice: %s\n", devsw[i]->dv_name); - currdev.d_dev = devsw[i]; currdev.d_type = currdev.d_dev->dv_type; + if (strcmp(devsw[i]->dv_name, "cd") == 0) { + f.f_devdata = &currdev; + currdev.d_unit = 0; + + if (devsw[i]->dv_open(&f, &currdev) == 0) + break; + } + if (strcmp(devsw[i]->dv_name, "disk") == 0) { f.f_devdata = &currdev; currdev.d_unit = 3; @@ -113,6 +119,8 @@ main(void) if (devsw[i] == NULL) panic("No boot device found!"); + else + printf("Boot device: %s\n", devsw[i]->dv_name); /* * Get timebase at boot. Added: head/sys/boot/powerpc/ps3/ps3cdrom.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Sun Aug 14 00:20:37 2011 (r224857) @@ -0,0 +1,154 @@ +/*- + * Copyright (C) 2011 glevand + * 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 ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include + +#include "bootstrap.h" +#include "ps3bus.h" +#include "ps3devdesc.h" +#include "ps3stor.h" + +#define dev_printf(dev, fmt, args...) \ + printf("%s%d: " fmt "\n", dev->d_dev->dv_name, dev->d_unit, ##args) + +#ifdef CD_DEBUG +#define DEBUG(fmt, args...) printf("%s:%d: " fmt "\n", __func__, __LINE__, ##args) +#else +#define DEBUG(fmt, args...) +#endif + +static int ps3cdrom_init(void); +static int ps3cdrom_strategy(void *devdata, int flag, daddr_t dblk, + size_t size, char *buf, size_t *rsize); +static int ps3cdrom_open(struct open_file *f, ...); +static int ps3cdrom_close(struct open_file *f); +static void ps3cdrom_print(int verbose); + +struct devsw ps3cdrom = { + "cd", + DEVT_CD, + ps3cdrom_init, + ps3cdrom_strategy, + ps3cdrom_open, + ps3cdrom_close, + noioctl, + ps3cdrom_print, +}; + +static struct ps3_stordev stor_dev; + +static int ps3cdrom_init(void) +{ + int err; + + err = ps3stor_setup(&stor_dev, PS3_DEV_TYPE_STOR_CDROM); + if (err) + return err; + + return 0; +} + +static int ps3cdrom_strategy(void *devdata, int flag, daddr_t dblk, + size_t size, char *buf, size_t *rsize) +{ + struct ps3_devdesc *dev = (struct ps3_devdesc *) devdata; + int err; + + DEBUG("d_unit=%u dblk=%llu size=%u", dev->d_unit, dblk, size); + + if (flag != F_READ) { + dev_printf(dev, "write operation is not supported!"); + return EROFS; + } + + if (dblk % (stor_dev.sd_blksize / DEV_BSIZE) != 0) + return EINVAL; + + dblk /= (stor_dev.sd_blksize / DEV_BSIZE); + + if (size % stor_dev.sd_blksize) { + dev_printf(dev, + "size=%u is not multiple of device block size=%llu", size, + stor_dev.sd_blksize); + return EINVAL; + } + + if (rsize) + *rsize = 0; + + err = ps3stor_read_sectors(&stor_dev, dev->d_unit, dblk, + size / stor_dev.sd_blksize, 0, buf); + + if (!err && rsize) + *rsize = size; + + if (err) + dev_printf(dev, + "read operation failed dblk=%llu size=%d err=%d", dblk, + size, err); + + return err; +} + +static int ps3cdrom_open(struct open_file *f, ...) +{ + char buf[2048]; + va_list ap; + struct ps3_devdesc *dev; + int err; + + va_start(ap, f); + dev = va_arg(ap, struct ps3_devdesc *); + va_end(ap); + + if (dev->d_unit > 0) { + dev_printf(dev, "attempt to open nonexistent disk"); + return ENXIO; + } + + err = ps3stor_read_sectors(&stor_dev, dev->d_unit, 16, 1, 0, buf); + if (err) + return EIO; + + /* Do not attach if not ISO9660 (workaround for buggy firmware) */ + if (memcmp(buf, "\001CD001", 6) != 0) + return EIO; + + return 0; +} + +static int ps3cdrom_close(struct open_file *f) +{ + return 0; +} + +static void ps3cdrom_print(int verbose) +{ +} Modified: head/sys/boot/powerpc/ps3/ps3stor.c ============================================================================== --- head/sys/boot/powerpc/ps3/ps3stor.c Sat Aug 13 23:34:17 2011 (r224856) +++ head/sys/boot/powerpc/ps3/ps3stor.c Sun Aug 14 00:20:37 2011 (r224857) @@ -52,35 +52,39 @@ int ps3stor_setup(struct ps3_stordev *sd if (err) goto out; - err = ps3repo_read_bus_dev_id(sd->sd_busidx, sd->sd_devidx, &sd->sd_devid); + err = ps3repo_read_bus_dev_id(sd->sd_busidx, sd->sd_devidx, + &sd->sd_devid); if (err) goto out; - err = ps3repo_read_bus_dev_blk_size(sd->sd_busidx, sd->sd_devidx, &sd->sd_blksize); + err = ps3repo_read_bus_dev_blk_size(sd->sd_busidx, sd->sd_devidx, + &sd->sd_blksize); if (err) goto out; - err = ps3repo_read_bus_dev_nblocks(sd->sd_busidx, sd->sd_devidx, &sd->sd_nblocks); + err = ps3repo_read_bus_dev_nblocks(sd->sd_busidx, sd->sd_devidx, + &sd->sd_nblocks); if (err) goto out; - err = ps3repo_read_bus_dev_nregs(sd->sd_busidx, sd->sd_devidx, &sd->sd_nregs); + err = ps3repo_read_bus_dev_nregs(sd->sd_busidx, sd->sd_devidx, + &sd->sd_nregs); if (err) goto out; for (i = 0; i < sd->sd_nregs; i++) { - err = ps3repo_read_bus_dev_reg_id(sd->sd_busidx, sd->sd_devidx, i, - &sd->sd_regs[i].sr_id); + err = ps3repo_read_bus_dev_reg_id(sd->sd_busidx, sd->sd_devidx, + i, &sd->sd_regs[i].sr_id); if (err) goto out; - err = ps3repo_read_bus_dev_reg_start(sd->sd_busidx, sd->sd_devidx, i, - &sd->sd_regs[i].sr_start); + err = ps3repo_read_bus_dev_reg_start(sd->sd_busidx, + sd->sd_devidx, i, &sd->sd_regs[i].sr_start); if (err) goto out; - err = ps3repo_read_bus_dev_reg_size(sd->sd_busidx, sd->sd_devidx, i, - &sd->sd_regs[i].sr_size); + err = ps3repo_read_bus_dev_reg_size(sd->sd_busidx, + sd->sd_devidx, i, &sd->sd_regs[i].sr_size); if (err) goto out; } @@ -109,19 +113,20 @@ out: return err; } +static char dma_buf[2048] __aligned(2048); + int ps3stor_read_sectors(struct ps3_stordev *sd, int regidx, uint64_t start_sector, uint64_t sector_count, uint64_t flags, char *buf) { #define MIN(a, b) ((a) <= (b) ? (a) : (b)) -#define BOUNCE_SECTORS 4 +#define BOUNCE_SECTORS (sizeof(dma_buf) / sd->sd_blksize) #define ASYNC_STATUS_POLL_PERIOD 100 /* microseconds */ struct ps3_storreg *reg = &sd->sd_regs[regidx]; - char dma_buf[sd->sd_blksize * BOUNCE_SECTORS]; uint64_t nleft, nread, nsectors; uint64_t tag, status; unsigned int timeout; - int err; + int err = 0; nleft = sector_count; nread = 0; @@ -129,8 +134,9 @@ int ps3stor_read_sectors(struct ps3_stor while (nleft) { nsectors = MIN(nleft, BOUNCE_SECTORS); - err = lv1_storage_read(sd->sd_devid, reg->sr_id, start_sector + nread, nsectors, - flags, (uint32_t) dma_buf, &tag); + err = lv1_storage_read(sd->sd_devid, reg->sr_id, + start_sector + nread, nsectors, flags, (uint32_t)dma_buf, + &tag); if (err) return err; @@ -140,7 +146,8 @@ int ps3stor_read_sectors(struct ps3_stor if (timeout < ASYNC_STATUS_POLL_PERIOD) return ETIMEDOUT; - err = lv1_storage_check_async_status(sd->sd_devid, tag, &status); + err = lv1_storage_check_async_status(sd->sd_devid, tag, + &status); if (!err && !status) break; @@ -148,12 +155,16 @@ int ps3stor_read_sectors(struct ps3_stor timeout -= ASYNC_STATUS_POLL_PERIOD; } - memcpy(buf + nread * sd->sd_blksize, (u_char *) dma_buf, nsectors * sd->sd_blksize); + if (status != 0) + return EIO; + + memcpy(buf + nread * sd->sd_blksize, (u_char *)dma_buf, + nsectors * sd->sd_blksize); nread += nsectors; nleft -= nsectors; } - return 0; + return err; #undef MIN #undef BOUNCE_SECTORS Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Aug 13 23:34:17 2011 (r224856) +++ head/sys/conf/files.powerpc Sun Aug 14 00:20:37 2011 (r224857) @@ -207,8 +207,8 @@ powerpc/ps3/ohci_ps3.c optional ps3 ohc powerpc/ps3/if_glc.c optional ps3 glc powerpc/ps3/mmu_ps3.c optional ps3 powerpc/ps3/platform_ps3.c optional ps3 -powerpc/ps3/ps3ata.c optional ps3 ps3ata powerpc/ps3/ps3bus.c optional ps3 +powerpc/ps3/ps3cdrom.c optional ps3 scbus powerpc/ps3/ps3disk.c optional ps3 powerpc/ps3/ps3pic.c optional ps3 powerpc/ps3/ps3_syscons.c optional ps3 sc Added: head/sys/powerpc/ps3/ps3cdrom.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/ps3/ps3cdrom.c Sun Aug 14 00:20:37 2011 (r224857) @@ -0,0 +1,703 @@ +/*- + * Copyright (C) 2010 Nathan Whitehorn + * Copyright (C) 2011 glevand + * 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, + * without modification, immediately at the beginning of the file. + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "ps3bus.h" +#include "ps3-hvcall.h" + +#define PS3CDROM_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), "ps3cdrom", \ + MTX_DEF) +#define PS3CDROM_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#define PS3CDROM_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define PS3CDROM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define PS3CDROM_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); +#define PS3CDROM_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); + +#define PS3CDROM_MAX_XFERS 3 + +#define LV1_STORAGE_SEND_ATAPI_COMMAND 0x01 + +struct ps3cdrom_softc; + +struct ps3cdrom_xfer { + TAILQ_ENTRY(ps3cdrom_xfer) x_queue; + struct ps3cdrom_softc *x_sc; + union ccb *x_ccb; + bus_dmamap_t x_dmamap; + uint64_t x_tag; +}; + +TAILQ_HEAD(ps3cdrom_xferq, ps3cdrom_xfer); + +struct ps3cdrom_softc { + device_t sc_dev; + + struct mtx sc_mtx; + + uint64_t sc_blksize; + uint64_t sc_nblocks; + + int sc_irqid; + struct resource *sc_irq; + void *sc_irqctx; + + bus_dma_tag_t sc_dmatag; + + struct cam_sim *sc_sim; + struct cam_path *sc_path; + + struct ps3cdrom_xfer sc_xfer[PS3CDROM_MAX_XFERS]; + struct ps3cdrom_xferq sc_active_xferq; + struct ps3cdrom_xferq sc_free_xferq; +}; + +enum lv1_ata_proto { + NON_DATA_PROTO = 0x00, + PIO_DATA_IN_PROTO = 0x01, + PIO_DATA_OUT_PROTO = 0x02, + DMA_PROTO = 0x03 +}; + +enum lv1_ata_in_out { + DIR_WRITE = 0x00, + DIR_READ = 0x01 +}; + +struct lv1_atapi_cmd { + uint8_t pkt[32]; + uint32_t pktlen; + uint32_t nblocks; + uint32_t blksize; + uint32_t proto; /* enum lv1_ata_proto */ + uint32_t in_out; /* enum lv1_ata_in_out */ + uint64_t buf; + uint32_t arglen; +}; + +static void ps3cdrom_action(struct cam_sim *sim, union ccb *ccb); +static void ps3cdrom_poll(struct cam_sim *sim); +static void ps3cdrom_async(void *callback_arg, u_int32_t code, + struct cam_path* path, void *arg); + +static void ps3cdrom_intr(void *arg); + +static void ps3cdrom_transfer(void *arg, bus_dma_segment_t *segs, int nsegs, + int error); + +static int ps3cdrom_decode_lv1_status(uint64_t status, + u_int8_t *sense_key, u_int8_t *asc, u_int8_t *ascq); + +static int +ps3cdrom_probe(device_t dev) +{ + if (ps3bus_get_bustype(dev) != PS3_BUSTYPE_STORAGE || + ps3bus_get_devtype(dev) != PS3_DEVTYPE_CDROM) + return (ENXIO); + + device_set_desc(dev, "Playstation 3 CDROM"); + + return (BUS_PROBE_SPECIFIC); +} + +static int +ps3cdrom_attach(device_t dev) +{ + struct ps3cdrom_softc *sc = device_get_softc(dev); + struct cam_devq *devq; + struct ps3cdrom_xfer *xp; + struct ccb_setasync csa; + int i, err; + + sc->sc_dev = dev; + + PS3CDROM_LOCK_INIT(sc); + + /* Setup interrupt handler */ + + sc->sc_irqid = 0; + sc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irqid, + RF_ACTIVE); + if (!sc->sc_irq) { + device_printf(dev, "Could not allocate IRQ\n"); + err = ENXIO; + goto fail_destroy_lock; + } + + err = bus_setup_intr(dev, sc->sc_irq, + INTR_TYPE_CAM | INTR_MPSAFE | INTR_ENTROPY, + NULL, ps3cdrom_intr, sc, &sc->sc_irqctx); + if (err) { + device_printf(dev, "Could not setup IRQ\n"); + err = ENXIO; + goto fail_release_intr; + } + + /* Setup DMA */ + + err = bus_dma_tag_create(bus_get_dma_tag(dev), 4096, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_UNRESTRICTED, 1, PAGE_SIZE, 0, + busdma_lock_mutex, &sc->sc_mtx, &sc->sc_dmatag); + if (err) { + device_printf(dev, "Could not create DMA tag\n"); + err = ENXIO; + goto fail_teardown_intr; + } + + /* Setup transfer queues */ + + TAILQ_INIT(&sc->sc_active_xferq); + TAILQ_INIT(&sc->sc_free_xferq); + + for (i = 0; i < PS3CDROM_MAX_XFERS; i++) { + xp = &sc->sc_xfer[i]; + xp->x_sc = sc; + + err = bus_dmamap_create(sc->sc_dmatag, BUS_DMA_COHERENT, + &xp->x_dmamap); + if (err) { + device_printf(dev, "Could not create DMA map (%d)\n", + err); + goto fail_destroy_dmamap; + } + + TAILQ_INSERT_TAIL(&sc->sc_free_xferq, xp, x_queue); + } + + /* Setup CAM */ + + devq = cam_simq_alloc(PS3CDROM_MAX_XFERS - 1); + if (!devq) { + device_printf(dev, "Could not allocate SIM queue\n"); + err = ENOMEM; + goto fail_destroy_dmatag; + } + + sc->sc_sim = cam_sim_alloc(ps3cdrom_action, ps3cdrom_poll, "ps3cdrom", + sc, device_get_unit(dev), &sc->sc_mtx, PS3CDROM_MAX_XFERS - 1, 0, + devq); + if (!sc->sc_sim) { + device_printf(dev, "Could not allocate SIM\n"); + cam_simq_free(devq); + err = ENOMEM; + goto fail_destroy_dmatag; + } + + /* Setup XPT */ + + PS3CDROM_LOCK(sc); + + err = xpt_bus_register(sc->sc_sim, dev, 0); + if (err != CAM_SUCCESS) { + device_printf(dev, "Could not register XPT bus\n"); + err = ENXIO; + PS3CDROM_UNLOCK(sc); + goto fail_free_sim; + } + + err = xpt_create_path(&sc->sc_path, NULL, cam_sim_path(sc->sc_sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); + if (err != CAM_REQ_CMP) { + device_printf(dev, "Could not create XPT path\n"); + err = ENOMEM; + PS3CDROM_UNLOCK(sc); + goto fail_unregister_xpt_bus; + } + + xpt_setup_ccb(&csa.ccb_h, sc->sc_path, 5); + csa.ccb_h.func_code = XPT_SASYNC_CB; + csa.event_enable = AC_LOST_DEVICE; + csa.callback = ps3cdrom_async; + csa.callback_arg = sc->sc_sim; + xpt_action((union ccb *) &csa); + + CAM_DEBUG(sc->sc_path, CAM_DEBUG_TRACE, + ("registered SIM for ps3cdrom%d\n", device_get_unit(dev))); + + PS3CDROM_UNLOCK(sc); + + return (BUS_PROBE_SPECIFIC); + +fail_unregister_xpt_bus: + + xpt_bus_deregister(cam_sim_path(sc->sc_sim)); + +fail_free_sim: + + cam_sim_free(sc->sc_sim, TRUE); + +fail_destroy_dmamap: + + while ((xp = TAILQ_FIRST(&sc->sc_free_xferq))) { + TAILQ_REMOVE(&sc->sc_free_xferq, xp, x_queue); + bus_dmamap_destroy(sc->sc_dmatag, xp->x_dmamap); + } + +fail_destroy_dmatag: + + bus_dma_tag_destroy(sc->sc_dmatag); + +fail_teardown_intr: + + bus_teardown_intr(dev, sc->sc_irq, sc->sc_irqctx); + +fail_release_intr: + + bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irqid, sc->sc_irq); + +fail_destroy_lock: + + PS3CDROM_LOCK_DESTROY(sc); + + return (err); +} + +static int +ps3cdrom_detach(device_t dev) +{ + struct ps3cdrom_softc *sc = device_get_softc(dev); + int i; + + xpt_async(AC_LOST_DEVICE, sc->sc_path, NULL); + xpt_free_path(sc->sc_path); + xpt_bus_deregister(cam_sim_path(sc->sc_sim)); + cam_sim_free(sc->sc_sim, TRUE); + + for (i = 0; i < PS3CDROM_MAX_XFERS; i++) + bus_dmamap_destroy(sc->sc_dmatag, sc->sc_xfer[i].x_dmamap); + + bus_dma_tag_destroy(sc->sc_dmatag); + + bus_teardown_intr(dev, sc->sc_irq, sc->sc_irqctx); + bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irqid, sc->sc_irq); + + PS3CDROM_LOCK_DESTROY(sc); + + return (0); +} + +static void +ps3cdrom_action(struct cam_sim *sim, union ccb *ccb) +{ + struct ps3cdrom_softc *sc = (struct ps3cdrom_softc *)cam_sim_softc(sim); + device_t dev = sc->sc_dev; + struct ps3cdrom_xfer *xp; + int err; + + PS3CDROM_ASSERT_LOCKED(sc); + + CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, + ("function code 0x%02x\n", ccb->ccb_h.func_code)); + + switch (ccb->ccb_h.func_code) { + case XPT_SCSI_IO: + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) + break; + + if(ccb->ccb_h.target_id > 0) { + ccb->ccb_h.status = CAM_TID_INVALID; + break; + } + + if(ccb->ccb_h.target_lun > 0) { + ccb->ccb_h.status = CAM_LUN_INVALID; + break; + } + + xp = TAILQ_FIRST(&sc->sc_free_xferq); + + KASSERT(xp != NULL, ("no free transfers")); + + xp->x_ccb = ccb; + + TAILQ_REMOVE(&sc->sc_free_xferq, xp, x_queue); + + err = bus_dmamap_load(sc->sc_dmatag, xp->x_dmamap, + ccb->csio.data_ptr, ccb->csio.dxfer_len, ps3cdrom_transfer, + xp, 0); + if (err && err != EINPROGRESS) { + device_printf(dev, "Could not load DMA map (%d)\n", + err); + + xp->x_ccb = NULL; + TAILQ_INSERT_TAIL(&sc->sc_free_xferq, xp, x_queue); + ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; + break; + } + return; + case XPT_SET_TRAN_SETTINGS: + ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; + break; + case XPT_GET_TRAN_SETTINGS: + { + struct ccb_trans_settings *cts = &ccb->cts; + + cts->protocol = PROTO_SCSI; + cts->protocol_version = SCSI_REV_2; + cts->transport = XPORT_SPI; + cts->transport_version = 2; + cts->proto_specific.valid = 0; + cts->xport_specific.valid = 0; + ccb->ccb_h.status = CAM_REQ_CMP; + break; + } + case XPT_RESET_BUS: + case XPT_RESET_DEV: + ccb->ccb_h.status = CAM_REQ_CMP; + break; + case XPT_CALC_GEOMETRY: + cam_calc_geometry(&ccb->ccg, 1); + break; + case XPT_PATH_INQ: + { + struct ccb_pathinq *cpi = &ccb->cpi; + + cpi->version_num = 1; + cpi->hba_inquiry = 0; + cpi->target_sprt = 0; + cpi->hba_inquiry = PI_SDTR_ABLE; + cpi->hba_misc = PIM_NOBUSRESET | PIM_SEQSCAN | PIM_NO_6_BYTE; + cpi->hba_eng_cnt = 0; + bzero(cpi->vuhba_flags, sizeof(cpi->vuhba_flags)); + cpi->max_target = 0; + cpi->max_lun = 0; + cpi->initiator_id = 7; + cpi->bus_id = cam_sim_bus(sim); + cpi->unit_number = cam_sim_unit(sim); + cpi->base_transfer_speed = 150000; + strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); + strncpy(cpi->hba_vid, "Sony", HBA_IDLEN); + strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol = PROTO_SCSI; + cpi->protocol_version = SCSI_REV_2; + cpi->maxio = PAGE_SIZE; + cpi->ccb_h.status = CAM_REQ_CMP; + break; + } + default: + CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, + ("unsupported function code 0x%02x\n", + ccb->ccb_h.func_code)); + ccb->ccb_h.status = CAM_REQ_INVALID; + break; + } + + xpt_done(ccb); +} + +static void +ps3cdrom_poll(struct cam_sim *sim) +{ + ps3cdrom_intr(cam_sim_softc(sim)); +} + +static void +ps3cdrom_async(void *callback_arg, u_int32_t code, + struct cam_path* path, void *arg) +{ + switch (code) { + case AC_LOST_DEVICE: + xpt_print_path(path); + break; + default: + break; + } +} + +static void +ps3cdrom_intr(void *arg) +{ + struct ps3cdrom_softc *sc = (struct ps3cdrom_softc *) arg; + device_t dev = sc->sc_dev; + uint64_t devid = ps3bus_get_device(dev); + struct ps3cdrom_xfer *xp; + union ccb *ccb; + u_int8_t *cdb, sense_key, asc, ascq; + uint64_t tag, status; + + if (lv1_storage_get_async_status(devid, &tag, &status) != 0) + return; + + PS3CDROM_LOCK(sc); + + /* Find transfer with the returned tag */ + + TAILQ_FOREACH(xp, &sc->sc_active_xferq, x_queue) { + if (xp->x_tag == tag) + break; + } + + if (xp) { + ccb = xp->x_ccb; + cdb = (ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->csio.cdb_io.cdb_ptr : + ccb->csio.cdb_io.cdb_bytes; + + CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, + ("ATAPI command 0x%02x tag 0x%016lx completed (0x%016lx)\n", + cdb[0], tag, status)); + + if (!status) { + ccb->csio.scsi_status = SCSI_STATUS_OK; + ccb->csio.resid = 0; + ccb->ccb_h.status = CAM_REQ_CMP; + } else { + ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; + ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; + + if (!ps3cdrom_decode_lv1_status(status, &sense_key, + &asc, &ascq)) { + struct scsi_sense_data sense_data; + + CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, + ("sense key 0x%02x asc 0x%02x ascq 0x%02x\n", + sense_key, asc, ascq)); + + bzero(&sense_data, sizeof(sense_data)); + sense_data.error_code = SSD_CURRENT_ERROR; + sense_data.flags |= sense_key; + sense_data.extra_len = 0xa; + sense_data.add_sense_code = asc; + sense_data.add_sense_code_qual = ascq; + ccb->csio.sense_len = sizeof(sense_data); + bcopy(&sense_data, &ccb->csio.sense_data, + ccb->csio.sense_len); + ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR | + CAM_AUTOSNS_VALID; + } + + if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) + ccb->csio.resid = ccb->csio.dxfer_len; + } + + if (ccb->ccb_h.flags & CAM_DIR_IN) + bus_dmamap_sync(sc->sc_dmatag, xp->x_dmamap, + BUS_DMASYNC_POSTREAD); + + bus_dmamap_unload(sc->sc_dmatag, xp->x_dmamap); + + xp->x_ccb = NULL; + TAILQ_REMOVE(&sc->sc_active_xferq, xp, x_queue); + TAILQ_INSERT_TAIL(&sc->sc_free_xferq, xp, x_queue); + + xpt_done(ccb); + } else { + device_printf(dev, + "Could not find transfer with tag 0x%016lx\n", tag); + } + + PS3CDROM_UNLOCK(sc); +} + +static void +ps3cdrom_transfer(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct ps3cdrom_xfer *xp = (struct ps3cdrom_xfer *) arg; + struct ps3cdrom_softc *sc = xp->x_sc; + device_t dev = sc->sc_dev; + uint64_t devid = ps3bus_get_device(dev); + union ccb *ccb = xp->x_ccb; + u_int8_t *cdb; + uint64_t start_sector, block_count; + int err; + + KASSERT(nsegs == 1, ("invalid number of DMA segments")); + + PS3CDROM_ASSERT_LOCKED(sc); + + if (error) { + device_printf(dev, "Could not load DMA map (%d)\n", error); + + xp->x_ccb = NULL; + TAILQ_INSERT_TAIL(&sc->sc_free_xferq, xp, x_queue); + ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; + xpt_done(ccb); + return; + } + + cdb = (ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->csio.cdb_io.cdb_ptr : + ccb->csio.cdb_io.cdb_bytes; + + CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, + ("ATAPI command 0x%02x cdb_len %d dxfer_len %d\n ", cdb[0], + ccb->csio.cdb_len, ccb->csio.dxfer_len)); + + switch (cdb[0]) { + case READ_10: + start_sector = (cdb[2] << 24) | (cdb[3] << 16) | + (cdb[4] << 8) | cdb[5]; + block_count = (cdb[7] << 8) | cdb[8]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 00:32:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57B55106566C; Sun, 14 Aug 2011 00:32:44 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46A118FC13; Sun, 14 Aug 2011 00:32:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7E0Wi52039449; Sun, 14 Aug 2011 00:32:44 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7E0WioD039447; Sun, 14 Aug 2011 00:32:44 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108140032.p7E0WioD039447@svn.freebsd.org> From: Rick Macklem Date: Sun, 14 Aug 2011 00:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224858 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 00:32:44 -0000 Author: rmacklem Date: Sun Aug 14 00:32:43 2011 New Revision: 224858 URL: http://svn.freebsd.org/changeset/base/224858 Log: MFC: r224532 The new NFS client failed to vput() the new vnode if a setattr failed after the file was created in nfs_create(). This would probably only happen during a forced dismount. The old NFS client does have a vput() for this case. Detected by pho during recent testing, where an open syscall returned with a vnode still locked. Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Sun Aug 14 00:20:37 2011 (r224857) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Sun Aug 14 00:32:43 2011 (r224858) @@ -1544,6 +1544,8 @@ again: if (attrflag) (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL, 0, 1); + if (error != 0) + vput(newvp); } } if (!error) { From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 00:42:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E94C1065673; Sun, 14 Aug 2011 00:42:10 +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 2C6BD8FC13; Sun, 14 Aug 2011 00:42:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7E0gAQU039771; Sun, 14 Aug 2011 00:42:10 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7E0gArn039763; Sun, 14 Aug 2011 00:42:10 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108140042.p7E0gArn039763@svn.freebsd.org> From: Robert Watson Date: Sun, 14 Aug 2011 00:42:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224859 - in head: lib/libprocstat usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 00:42:10 -0000 Author: rwatson Date: Sun Aug 14 00:42:09 2011 New Revision: 224859 URL: http://svn.freebsd.org/changeset/base/224859 Log: Updates to libprocstat(3) and procstat(1) to allow monitoring Capsicum capability mode and capabilities. Right now no attempt is made to unwrap capabilities when operating on a crashdump, so further refinement is required. Approved by: re (bz) Sponsored by: Google Inc Modified: head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h head/usr.bin/procstat/procstat.1 head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_cred.c head/usr.bin/procstat/procstat_files.c Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sun Aug 14 00:32:43 2011 (r224858) +++ head/lib/libprocstat/libprocstat.c Sun Aug 14 00:42:09 2011 (r224859) @@ -282,7 +282,7 @@ procstat_freefiles(struct procstat *proc static struct filestat * filestat_new_entry(void *typedep, int type, int fd, int fflags, int uflags, - int refcount, off_t offset, char *path) + int refcount, off_t offset, char *path, cap_rights_t cap_rights) { struct filestat *entry; @@ -299,6 +299,7 @@ filestat_new_entry(void *typedep, int ty entry->fs_ref_count = refcount; entry->fs_offset = offset; entry->fs_path = path; + entry->fs_cap_rights = cap_rights; return (entry); } @@ -381,21 +382,21 @@ procstat_getfiles_kvm(struct procstat *p /* root directory vnode, if one. */ if (filed.fd_rdir) { entry = filestat_new_entry(filed.fd_rdir, PS_FST_TYPE_VNODE, -1, - PS_FST_FFLAG_READ, PS_FST_UFLAG_RDIR, 0, 0, NULL); + PS_FST_FFLAG_READ, PS_FST_UFLAG_RDIR, 0, 0, NULL, 0); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } /* current working directory vnode. */ if (filed.fd_cdir) { entry = filestat_new_entry(filed.fd_cdir, PS_FST_TYPE_VNODE, -1, - PS_FST_FFLAG_READ, PS_FST_UFLAG_CDIR, 0, 0, NULL); + PS_FST_FFLAG_READ, PS_FST_UFLAG_CDIR, 0, 0, NULL, 0); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } /* jail root, if any. */ if (filed.fd_jdir) { entry = filestat_new_entry(filed.fd_jdir, PS_FST_TYPE_VNODE, -1, - PS_FST_FFLAG_READ, PS_FST_UFLAG_JAIL, 0, 0, NULL); + PS_FST_FFLAG_READ, PS_FST_UFLAG_JAIL, 0, 0, NULL, 0); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -403,14 +404,14 @@ procstat_getfiles_kvm(struct procstat *p if (kp->ki_tracep) { entry = filestat_new_entry(kp->ki_tracep, PS_FST_TYPE_VNODE, -1, PS_FST_FFLAG_READ | PS_FST_FFLAG_WRITE, - PS_FST_UFLAG_TRACE, 0, 0, NULL); + PS_FST_UFLAG_TRACE, 0, 0, NULL, 0); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } /* text vnode, if one */ if (kp->ki_textvp) { entry = filestat_new_entry(kp->ki_textvp, PS_FST_TYPE_VNODE, -1, - PS_FST_FFLAG_READ, PS_FST_UFLAG_TEXT, 0, 0, NULL); + PS_FST_FFLAG_READ, PS_FST_UFLAG_TEXT, 0, 0, NULL, 0); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -418,7 +419,7 @@ procstat_getfiles_kvm(struct procstat *p if ((vp = getctty(kd, kp)) != NULL) { entry = filestat_new_entry(vp, PS_FST_TYPE_VNODE, -1, PS_FST_FFLAG_READ | PS_FST_FFLAG_WRITE, - PS_FST_UFLAG_CTTY, 0, 0, NULL); + PS_FST_UFLAG_CTTY, 0, 0, NULL, 0); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -471,8 +472,9 @@ procstat_getfiles_kvm(struct procstat *p default: continue; } + /* XXXRW: No capability rights support for kvm yet. */ entry = filestat_new_entry(data, type, i, - to_filestat_flags(file.f_flag), 0, 0, 0, NULL); + to_filestat_flags(file.f_flag), 0, 0, 0, NULL, 0); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -531,7 +533,7 @@ do_mmapped: */ entry = filestat_new_entry(object.handle, PS_FST_TYPE_VNODE, -1, fflags, - PS_FST_UFLAG_MMAP, 0, 0, NULL); + PS_FST_UFLAG_MMAP, 0, 0, NULL, 0); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -586,6 +588,7 @@ kinfo_fflags2fst(int kfflags) } kfflags2fst[] = { { KF_FLAG_APPEND, PS_FST_FFLAG_APPEND }, { KF_FLAG_ASYNC, PS_FST_FFLAG_ASYNC }, + { KF_FLAG_CAPABILITY, PS_FST_FFLAG_CAPABILITY }, { KF_FLAG_CREAT, PS_FST_FFLAG_CREAT }, { KF_FLAG_DIRECT, PS_FST_FFLAG_DIRECT }, { KF_FLAG_EXCL, PS_FST_FFLAG_EXCL }, @@ -644,6 +647,7 @@ procstat_getfiles_sysctl(struct procstat int cnt, fd, fflags; int i, type, uflags; int refcount; + cap_rights_t cap_rights; assert(kp); if (kp->ki_fd == NULL) @@ -676,12 +680,13 @@ procstat_getfiles_sysctl(struct procstat path = strdup(kif->kf_path); else path = NULL; + cap_rights = kif->kf_cap_rights; /* * Create filestat entry. */ entry = filestat_new_entry(kif, type, fd, fflags, uflags, - refcount, offset, path); + refcount, offset, path, cap_rights); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } @@ -707,7 +712,8 @@ procstat_getfiles_sysctl(struct procstat else path = NULL; entry = filestat_new_entry(kve, PS_FST_TYPE_VNODE, -1, - fflags, PS_FST_UFLAG_MMAP, refcount, offset, path); + fflags, PS_FST_UFLAG_MMAP, refcount, offset, path, + 0); if (entry != NULL) STAILQ_INSERT_TAIL(head, entry, next); } Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Sun Aug 14 00:32:43 2011 (r224858) +++ head/lib/libprocstat/libprocstat.h Sun Aug 14 00:42:09 2011 (r224859) @@ -88,6 +88,7 @@ #define PS_FST_FFLAG_DIRECT 0x1000 #define PS_FST_FFLAG_EXEC 0x2000 #define PS_FST_FFLAG_HASLOCK 0x4000 +#define PS_FST_FFLAG_CAPABILITY 0x8000 struct procstat; struct filestat { @@ -101,6 +102,7 @@ struct filestat { void *fs_typedep; /* Type dependent data. */ char *fs_path; STAILQ_ENTRY(filestat) next; + cap_rights_t fs_cap_rights; /* Capability rights, if flag set. */ }; struct vnstat { uint64_t vn_fileid; Modified: head/usr.bin/procstat/procstat.1 ============================================================================== --- head/usr.bin/procstat/procstat.1 Sun Aug 14 00:32:43 2011 (r224858) +++ head/usr.bin/procstat/procstat.1 Sun Aug 14 00:42:09 2011 (r224859) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2007-2008 Robert N. M. Watson +.\" Copyright (c) 2007-2009 Robert N. M. Watson .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 7, 2010 +.Dd August 14, 2011 .Dt PROCSTAT 1 .Os .Sh NAME @@ -35,6 +35,7 @@ .Nm .Op Fl h .Op Fl n +.Op Fl C .Op Fl w Ar interval .Op Fl b | c | f | i | j | k | s | t | v .Op Fl a | Ar pid ... @@ -88,6 +89,11 @@ If the .Fl w flag is not specified, the output will not repeat. .Pp +The +.Fl C +flag requests the printing of additional capability information in the file +descriptor view. +.Pp Some information, such as VM and file descriptor information, is available only to the owner of a process or the superuser. .Ss Binary Information @@ -116,7 +122,8 @@ command line arguments (if available) Display detailed information about each file descriptor referenced by a process, including the process ID, command, file descriptor number, and per-file descriptor object information, such as object type and file system -path: +path. +By default, the following information will be printed: .Pp .Bl -tag -width indent -compact .It PID @@ -208,7 +215,17 @@ non-blocking direct I/O .It l lock held +.It c +descriptor is a capability .El +.Pp +If the +.Fl C +flag is specified, the vnode type, reference count, and offset fields will be +omitted, and a new capabilities field will be included listing capabilities, +as described in +.Xr cap_new 2 , +present for each capability descriptor. .Ss Signal Disposition Information Display signal pending and disposition for a process: .Pp @@ -306,9 +323,18 @@ effective group ID real group ID .It SVGID saved group ID +.It FLAGS +credential flags .It GROUPS group set .El +.Pp +The following credential flags may be displayed: +.Pp +.Bl -tag -width X -compact +.It C +capability mode +.El .Ss Thread Information Display per-thread information, including process ID, per-thread ID, name, CPU, and execution state: @@ -402,6 +428,8 @@ needs copy .Xr fstat 1 , .Xr ps 1 , .Xr sockstat 1 , +.Xr cap_enter 2 , +.Xr cap_new 2 , .Xr ddb 4 , .Xr stack 9 .Sh AUTHORS Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Sun Aug 14 00:32:43 2011 (r224858) +++ head/usr.bin/procstat/procstat.c Sun Aug 14 00:42:09 2011 (r224859) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Robert N. M. Watson + * Copyright (c) 2007, 2011 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,13 +40,13 @@ #include "procstat.h" static int aflag, bflag, cflag, fflag, iflag, jflag, kflag, sflag, tflag, vflag; -int hflag, nflag; +int hflag, nflag, Cflag; static void usage(void) { - fprintf(stderr, "usage: procstat [-h] [-M core] [-N system] " + fprintf(stderr, "usage: procstat [-h] [-C] [-M core] [-N system] " "[-w interval] [-b | -c | -f | -i | -j | -k | -s | -t | -v]\n"); fprintf(stderr, " [-a | pid ...]\n"); exit(EX_USAGE); @@ -117,8 +117,12 @@ main(int argc, char *argv[]) interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "N:M:abcfijkhstvw:")) != -1) { + while ((ch = getopt(argc, argv, "CN:M:abcfijkhstvw:")) != -1) { switch (ch) { + case 'C': + Cflag++; + break; + case 'M': memf = optarg; break; @@ -204,6 +208,10 @@ main(int argc, char *argv[]) if (!(aflag == 1 && argc == 0) && !(aflag == 0 && argc > 0)) usage(); + /* Only allow -C with -f. */ + if (Cflag && !fflag) + usage(); + if (memf != NULL) prstat = procstat_open_kvm(nlistf, memf); else Modified: head/usr.bin/procstat/procstat.h ============================================================================== --- head/usr.bin/procstat/procstat.h Sun Aug 14 00:32:43 2011 (r224858) +++ head/usr.bin/procstat/procstat.h Sun Aug 14 00:42:09 2011 (r224859) @@ -29,7 +29,7 @@ #ifndef PROCSTAT_H #define PROCSTAT_H -extern int hflag, nflag; +extern int hflag, nflag, Cflag; struct kinfo_proc; void kinfo_proc_sort(struct kinfo_proc *kipp, int count); Modified: head/usr.bin/procstat/procstat_cred.c ============================================================================== --- head/usr.bin/procstat/procstat_cred.c Sun Aug 14 00:32:43 2011 (r224858) +++ head/usr.bin/procstat/procstat_cred.c Sun Aug 14 00:42:09 2011 (r224859) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Robert N. M. Watson + * Copyright (c) 2007-2008 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,9 +48,9 @@ procstat_cred(struct kinfo_proc *kipp) gid_t *groups = NULL; if (!hflag) - printf("%5s %-16s %5s %5s %5s %5s %5s %5s %-20s\n", "PID", + printf("%5s %-16s %5s %5s %5s %5s %5s %5s %5s %-15s\n", "PID", "COMM", "EUID", "RUID", "SVUID", "EGID", "RGID", "SVGID", - "GROUPS"); + "FLAGS", "GROUPS"); printf("%5d ", kipp->ki_pid); printf("%-16s ", kipp->ki_comm); @@ -60,6 +60,8 @@ procstat_cred(struct kinfo_proc *kipp) printf("%5d ", kipp->ki_groups[0]); printf("%5d ", kipp->ki_rgid); printf("%5d ", kipp->ki_svgid); + printf("%s", kipp->ki_cr_flags & CRED_FLAG_CAPMODE ? "C" : "-"); + printf(" "); /* * We may have too many groups to fit in kinfo_proc's statically Modified: head/usr.bin/procstat/procstat_files.c ============================================================================== --- head/usr.bin/procstat/procstat_files.c Sun Aug 14 00:32:43 2011 (r224858) +++ head/usr.bin/procstat/procstat_files.c Sun Aug 14 00:42:09 2011 (r224859) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Robert N. M. Watson + * Copyright (c) 2007-2011 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,6 +27,7 @@ */ #include +#include #include #include #include @@ -131,6 +132,133 @@ print_address(struct sockaddr_storage *s printf("%s", addr); } +static struct cap_desc { + cap_rights_t cd_right; + const char *cd_desc; +} cap_desc[] = { + /* General file I/O. */ + { CAP_READ, "rd" }, + { CAP_WRITE, "wr" }, + { CAP_MMAP, "mm" }, + { CAP_MAPEXEC, "me" }, + { CAP_FEXECVE, "fe" }, + { CAP_FSYNC, "fy" }, + { CAP_FTRUNCATE, "ft" }, + { CAP_SEEK, "se" }, + + /* VFS methods. */ + { CAP_FCHFLAGS, "cf" }, + { CAP_FCHDIR, "cd" }, + { CAP_FCHMOD, "cm" }, + { CAP_FCHOWN, "cn" }, + { CAP_FCNTL, "fc" }, + { CAP_FPATHCONF, "fp" }, + { CAP_FLOCK, "fl" }, + { CAP_FSCK, "fk" }, + { CAP_FSTAT, "fs" }, + { CAP_FSTATFS, "sf" }, + { CAP_FUTIMES, "fu" }, + { CAP_CREATE, "cr" }, + { CAP_DELETE, "de" }, + { CAP_MKDIR, "md" }, + { CAP_RMDIR, "rm" }, + { CAP_MKFIFO, "mf" }, + + /* Lookups - used to constraint *at() calls. */ + { CAP_LOOKUP, "lo" }, + + /* Extended attributes. */ + { CAP_EXTATTR_GET, "eg" }, + { CAP_EXTATTR_SET, "es" }, + { CAP_EXTATTR_DELETE, "ed" }, + { CAP_EXTATTR_LIST, "el" }, + + /* Access Control Lists. */ + { CAP_ACL_GET, "ag" }, + { CAP_ACL_SET, "as" }, + { CAP_ACL_DELETE, "ad" }, + { CAP_ACL_CHECK, "ac" }, + + /* Socket operations. */ + { CAP_ACCEPT, "at" }, + { CAP_BIND, "bd" }, + { CAP_CONNECT, "co" }, + { CAP_GETPEERNAME, "pn" }, + { CAP_GETSOCKNAME, "sn" }, + { CAP_GETSOCKOPT, "gs" }, + { CAP_LISTEN, "ln" }, + { CAP_PEELOFF, "pf" }, + { CAP_SETSOCKOPT, "ss" }, + { CAP_SHUTDOWN, "sh" }, + + /* Mandatory Access Control. */ + { CAP_MAC_GET, "mg" }, + { CAP_MAC_SET, "ms" }, + + /* Methods on semaphores. */ + { CAP_SEM_GETVALUE, "sg" }, + { CAP_SEM_POST, "sp" }, + { CAP_SEM_WAIT, "sw" }, + + /* Event monitoring and posting. */ + { CAP_POLL_EVENT, "po" }, + { CAP_POST_EVENT, "ev" }, + + /* Strange and powerful rights that should not be given lightly. */ + { CAP_IOCTL, "io" }, + { CAP_TTYHOOK, "ty" }, + +#ifdef NOTYET + { CAP_PDGETPID, "pg" }, + { CAP_PDWAIT4, "pw" }, + { CAP_PDKILL, "pk" }, +#endif +}; +static const u_int cap_desc_count = sizeof(cap_desc) / + sizeof(cap_desc[0]); + +static u_int +width_capability(cap_rights_t rights) +{ + u_int count, i, width; + + count = 0; + width = 0; + for (i = 0; i < cap_desc_count; i++) { + if (rights & cap_desc[i].cd_right) { + width += strlen(cap_desc[i].cd_desc); + if (count) + width++; + count++; + } + } + return (width); +} + +static void +print_capability(cap_rights_t rights, u_int capwidth) +{ + u_int count, i, width; + + count = 0; + width = 0; + for (i = width_capability(rights); i < capwidth; i++) { + if (rights || i != 0) + printf(" "); + else + printf("-"); + } + for (i = 0; i < cap_desc_count; i++) { + if (rights & cap_desc[i].cd_right) { + printf("%s%s", count ? "," : "", cap_desc[i].cd_desc); + width += strlen(cap_desc[i].cd_desc); + if (count) + width++; + count++; + } + } +} + void procstat_files(struct procstat *procstat, struct kinfo_proc *kipp) { @@ -139,14 +267,39 @@ procstat_files(struct procstat *procstat struct filestat *fst; const char *str; struct vnstat vn; + u_int capwidth, width; int error; - if (!hflag) - printf("%5s %-16s %4s %1s %1s %-8s %3s %7s %-3s %-12s\n", - "PID", "COMM", "FD", "T", "V", "FLAGS", "REF", "OFFSET", - "PRO", "NAME"); - + /* + * To print the header in capability mode, we need to know the width + * of the widest capability string. Even if we get no processes + * back, we will print the header, so we defer aborting due to a lack + * of processes until after the header logic. + */ + capwidth = 0; head = procstat_getfiles(procstat, kipp, 0); + if (head != NULL && Cflag) { + STAILQ_FOREACH(fst, head, next) { + width = width_capability(fst->fs_cap_rights); + if (width > capwidth) + capwidth = width; + } + if (capwidth < strlen("CAPABILITIES")) + capwidth = strlen("CAPABILITIES"); + } + + if (!hflag) { + if (Cflag) + printf("%5s %-16s %4s %1s %-9s %-*s " + "%-3s %-12s\n", "PID", "COMM", "FD", "T", + "FLAGS", capwidth, "CAPABILITIES", "PRO", + "NAME"); + else + printf("%5s %-16s %4s %1s %1s %-9s " + "%3s %7s %-3s %-12s\n", "PID", "COMM", "FD", "T", + "V", "FLAGS", "REF", "OFFSET", "PRO", "NAME"); + } + if (head == NULL) return; STAILQ_FOREACH(fst, head, next) { @@ -215,50 +368,53 @@ procstat_files(struct procstat *procstat break; } printf("%1s ", str); - str = "-"; - if (fst->fs_type == PS_FST_TYPE_VNODE) { - error = procstat_get_vnode_info(procstat, fst, &vn, NULL); - switch (vn.vn_type) { - case PS_FST_VTYPE_VREG: - str = "r"; - break; - - case PS_FST_VTYPE_VDIR: - str = "d"; - break; - - case PS_FST_VTYPE_VBLK: - str = "b"; - break; - - case PS_FST_VTYPE_VCHR: - str = "c"; - break; - - case PS_FST_VTYPE_VLNK: - str = "l"; - break; - - case PS_FST_VTYPE_VSOCK: - str = "s"; - break; - - case PS_FST_VTYPE_VFIFO: - str = "f"; - break; - - case PS_FST_VTYPE_VBAD: - str = "x"; - break; - - case PS_FST_VTYPE_VNON: - case PS_FST_VTYPE_UNKNOWN: - default: - str = "?"; - break; + if (!Cflag) { + str = "-"; + if (fst->fs_type == PS_FST_TYPE_VNODE) { + error = procstat_get_vnode_info(procstat, fst, + &vn, NULL); + switch (vn.vn_type) { + case PS_FST_VTYPE_VREG: + str = "r"; + break; + + case PS_FST_VTYPE_VDIR: + str = "d"; + break; + + case PS_FST_VTYPE_VBLK: + str = "b"; + break; + + case PS_FST_VTYPE_VCHR: + str = "c"; + break; + + case PS_FST_VTYPE_VLNK: + str = "l"; + break; + + case PS_FST_VTYPE_VSOCK: + str = "s"; + break; + + case PS_FST_VTYPE_VFIFO: + str = "f"; + break; + + case PS_FST_VTYPE_VBAD: + str = "x"; + break; + + case PS_FST_VTYPE_VNON: + case PS_FST_VTYPE_UNKNOWN: + default: + str = "?"; + break; + } } + printf("%1s ", str); } - printf("%1s ", str); printf("%s", fst->fs_fflags & PS_FST_FFLAG_READ ? "r" : "-"); printf("%s", fst->fs_fflags & PS_FST_FFLAG_WRITE ? "w" : "-"); printf("%s", fst->fs_fflags & PS_FST_FFLAG_APPEND ? "a" : "-"); @@ -266,16 +422,23 @@ procstat_files(struct procstat *procstat printf("%s", fst->fs_fflags & PS_FST_FFLAG_SYNC ? "f" : "-"); printf("%s", fst->fs_fflags & PS_FST_FFLAG_NONBLOCK ? "n" : "-"); printf("%s", fst->fs_fflags & PS_FST_FFLAG_DIRECT ? "d" : "-"); - printf("%s ", fst->fs_fflags & PS_FST_FFLAG_HASLOCK ? "l" : "-"); - if (fst->fs_ref_count > -1) - printf("%3d ", fst->fs_ref_count); - else - printf("%3c ", '-'); - if (fst->fs_offset > -1) - printf("%7jd ", (intmax_t)fst->fs_offset); - else - printf("%7c ", '-'); - + printf("%s", fst->fs_fflags & PS_FST_FFLAG_HASLOCK ? "l" : "-"); + printf("%s ", fst->fs_fflags & PS_FST_FFLAG_CAPABILITY ? + "c" : "-"); + if (!Cflag) { + if (fst->fs_ref_count > -1) + printf("%3d ", fst->fs_ref_count); + else + printf("%3c ", '-'); + if (fst->fs_offset > -1) + printf("%7jd ", (intmax_t)fst->fs_offset); + else + printf("%7c ", '-'); + } + if (Cflag) { + print_capability(fst->fs_cap_rights, capwidth); + printf(" "); + } switch (fst->fs_type) { case PS_FST_TYPE_VNODE: case PS_FST_TYPE_FIFO: @@ -314,7 +477,6 @@ procstat_files(struct procstat *procstat break; default: - printf("%-3s ", "-"); printf("%-18s", "-"); } From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 00:55:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E4C106564A; Sun, 14 Aug 2011 00:55:19 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E62378FC12; Sun, 14 Aug 2011 00:55:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7E0tIOH040250; Sun, 14 Aug 2011 00:55:18 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7E0tIQD040248; Sun, 14 Aug 2011 00:55:18 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108140055.p7E0tIQD040248@svn.freebsd.org> From: Rick Macklem Date: Sun, 14 Aug 2011 00:55:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224860 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 00:55:19 -0000 Author: rmacklem Date: Sun Aug 14 00:55:18 2011 New Revision: 224860 URL: http://svn.freebsd.org/changeset/base/224860 Log: MFC: r224554 Fix rename in the new NFS server so that it does not require a recursive vnode lock on the directory for the case where the new file name is in the same directory as the old one. The patch handles this as a special case, recognized by the new directory having the same file handle as the old one and just VREF()s the old dir vnode for this case, instead of doing a second VFS_FHTOVP() to get it. This is required so that the server will work for file systems like msdosfs, that do not support recursive vnode locking. This problem was discovered during recent testing by pho@ when exporting an msdosfs file system via the new NFS server. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sun Aug 14 00:42:09 2011 (r224859) +++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sun Aug 14 00:55:18 2011 (r224860) @@ -1425,6 +1425,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, struct nfsrvfh tfh; char *bufp, *tbufp = NULL; u_long *hashp; + fhandle_t fh; if (nd->nd_repstat) { nfsrv_wcc(nd, fdirfor_ret, &fdirfor, fdiraft_ret, &fdiraft); @@ -1450,19 +1451,34 @@ nfsrvd_rename(struct nfsrv_descript *nd, tnes = *toexp; tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd->nd_cred, p, 0); } else { + tfh.nfsrvfh_len = 0; error = nfsrv_mtofh(nd, &tfh); + if (error == 0) + error = nfsvno_getfh(dp, &fh, p); if (error) { vput(dp); /* todp is always NULL except NFSv4 */ nfsvno_relpathbuf(&fromnd); goto out; } - nd->nd_cred->cr_uid = nd->nd_saveduid; - nfsd_fhtovp(nd, &tfh, LK_EXCLUSIVE, &tdp, &tnes, NULL, 0, p); - if (tdp) { + + /* If this is the same file handle, just VREF() the vnode. */ + if (tfh.nfsrvfh_len == NFSX_MYFH && + !NFSBCMP(tfh.nfsrvfh_data, &fh, NFSX_MYFH)) { + VREF(dp); + tdp = dp; + tnes = *exp; tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd->nd_cred, p, 1); - NFSVOPUNLOCK(tdp, 0); + } else { + nd->nd_cred->cr_uid = nd->nd_saveduid; + nfsd_fhtovp(nd, &tfh, LK_EXCLUSIVE, &tdp, &tnes, NULL, + 0, p); + if (tdp) { + tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, + nd->nd_cred, p, 1); + NFSVOPUNLOCK(tdp, 0); + } } } NFSNAMEICNDSET(&tond.ni_cnd, nd->nd_cred, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART); From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 12:41:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC47F106566B; Sun, 14 Aug 2011 12:41:44 +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 BBBE78FC13; Sun, 14 Aug 2011 12:41:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7ECfiWu064538; Sun, 14 Aug 2011 12:41:44 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7ECfi5o064536; Sun, 14 Aug 2011 12:41:44 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108141241.p7ECfi5o064536@svn.freebsd.org> From: Robert Watson Date: Sun, 14 Aug 2011 12:41:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224864 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 12:41:44 -0000 Author: rwatson Date: Sun Aug 14 12:41:44 2011 New Revision: 224864 URL: http://svn.freebsd.org/changeset/base/224864 Log: Cross-reference cap_new(2) from dup(2), as they have similar functionality. Approved by: re (kib) Modified: head/lib/libc/sys/dup.2 Modified: head/lib/libc/sys/dup.2 ============================================================================== --- head/lib/libc/sys/dup.2 Sun Aug 14 12:26:24 2011 (r224863) +++ head/lib/libc/sys/dup.2 Sun Aug 14 12:41:44 2011 (r224864) @@ -28,7 +28,7 @@ .\" @(#)dup.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd August 14, 2011 .Dt DUP 2 .Os .Sh NAME @@ -115,6 +115,11 @@ and is a valid descriptor, then .Fn dup2 is successful, and does nothing. +.Pp +The related +.Xr cap_new 2 +system call allows file descriptors to be duplicated with restrictions on +their use. .Sh RETURN VALUES The value -1 is returned if an error occurs in either call. The external variable @@ -139,6 +144,7 @@ Too many descriptors are active. .El .Sh SEE ALSO .Xr accept 2 , +.Xr cap_new 2 , .Xr close 2 , .Xr fcntl 2 , .Xr getdtablesize 2 , From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 13:37:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 183C71065670; Sun, 14 Aug 2011 13:37:39 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 078D38FC0A; Sun, 14 Aug 2011 13:37:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7EDbcsj066246; Sun, 14 Aug 2011 13:37:38 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7EDbct2066244; Sun, 14 Aug 2011 13:37:38 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201108141337.p7EDbct2066244@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 14 Aug 2011 13:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224865 - head/usr.bin/tail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 13:37:39 -0000 Author: jilles Date: Sun Aug 14 13:37:38 2011 New Revision: 224865 URL: http://svn.freebsd.org/changeset/base/224865 Log: tail: Fix crash if -F'ed file's filesystem disappears. If tail notices that a file it is following no longer exists (because stat() fails), it will output any final lines and then close the file. If the read operation also causes an error, such as when the filesystem is forcefully unmounted, it closes the file as well, leading to fclose(NULL) and a segmentation fault. PR: bin/159750 Submitted by: swills Approved by: re (kib) MFC after: 1 week Modified: head/usr.bin/tail/forward.c Modified: head/usr.bin/tail/forward.c ============================================================================== --- head/usr.bin/tail/forward.c Sun Aug 14 12:41:44 2011 (r224864) +++ head/usr.bin/tail/forward.c Sun Aug 14 13:37:38 2011 (r224865) @@ -361,8 +361,10 @@ follow(file_info_t *files, enum STYLE st if (errno != ENOENT) ierr(file->file_name); show(file); - fclose(file->fp); - file->fp = NULL; + if (file->fp != NULL) { + fclose(file->fp); + file->fp = NULL; + } ev_change++; continue; } From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 14:36:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1119E106566C; Sun, 14 Aug 2011 14:36:33 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 004D68FC0A; Sun, 14 Aug 2011 14:36:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7EEaWT0068047; Sun, 14 Aug 2011 14:36:32 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7EEaWuv068045; Sun, 14 Aug 2011 14:36:32 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201108141436.p7EEaWuv068045@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 14 Aug 2011 14:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224866 - head/release/powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 14:36:33 -0000 Author: nwhitehorn Date: Sun Aug 14 14:36:32 2011 New Revision: 224866 URL: http://svn.freebsd.org/changeset/base/224866 Log: Provide a kboot.conf to allow powerpc64 install media to be booted on Playstation 3 consoles running kboot or petitboot. Approved by: re (bz) Modified: head/release/powerpc/mkisoimages.sh Modified: head/release/powerpc/mkisoimages.sh ============================================================================== --- head/release/powerpc/mkisoimages.sh Sun Aug 14 13:37:38 2011 (r224865) +++ head/release/powerpc/mkisoimages.sh Sun Aug 14 14:36:32 2011 (r224866) @@ -45,6 +45,9 @@ if [ "x$1" = "x-b" ]; then EOF bootable="$bootable -o chrp-boot" + # Playstation 3 boot code + echo "FreeBSD Install='/boot/loader.ps3'" > $4/etc/kboot.conf + shift else bootable="" From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 15:53:16 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 646141065670; Sun, 14 Aug 2011 15:53:16 +0000 (UTC) (envelope-from niclas.zeising@gmail.com) Received: from mail.lysator.liu.se (mail.lysator.liu.se [IPv6:2001:6b0:17:f0a0::3]) by mx1.freebsd.org (Postfix) with ESMTP id E1E0F8FC13; Sun, 14 Aug 2011 15:53:15 +0000 (UTC) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 8E84C4001B; Sun, 14 Aug 2011 17:53:14 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 83D0340021; Sun, 14 Aug 2011 17:53:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bernadotte.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL,FREEMAIL_FROM autolearn=disabled version=3.3.1 X-Spam-Score: 0.0 Received: from mx.daemonic.se (mx.daemonic.se [IPv6:2001:470:dca9:0:1::3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 4D1A24001B; Sun, 14 Aug 2011 17:53:14 +0200 (CEST) Received: from mail.daemonic.se (mail.daemonic.se [IPv6:2001:470:dca9:0:1::4]) by mx.daemonic.se (Postfix) with ESMTPS id E23D8119C04; Sun, 14 Aug 2011 17:53:13 +0200 (CEST) Received: from [IPv6:2001:470:dca9:1::4] (vivi.daemonic.se [IPv6:2001:470:dca9:1::4]) by mail.daemonic.se (Postfix) with ESMTPSA id C93FB12B0A0; Sun, 14 Aug 2011 17:53:13 +0200 (CEST) Message-ID: <4E47EF64.2070405@gmail.com> Date: Sun, 14 Aug 2011 17:53:08 +0200 From: Niclas Zeising User-Agent: Mutt/1.5.21 MIME-Version: 1.0 To: Robert Watson References: <201108131603.p7DG3e80023093@svn.freebsd.org> In-Reply-To: <201108131603.p7DG3e80023093@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224842 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 15:53:16 -0000 On 2011-08-13 18:03, Robert Watson wrote: > Author: rwatson > Date: Sat Aug 13 16:03:40 2011 > New Revision: 224842 > URL: http://svn.freebsd.org/changeset/base/224842 > > Log: > When falloc() was broken into separate falloc_noinstall() and finstall(), > a bug was introduced in kern_openat() such that the error from the vnode > open operation was overwritten before it was passed as an argument to > dupfdopen(). This broke operations on /dev/{stdin,stdout,stderr}. Fix > by preserving the original error number across finstall() so that it is > still available. > > Approved by: re (kib) > Reported by: cognet > > Modified: > head/sys/kern/vfs_syscalls.c > It might be worth mentioning this in UPDATING or similar, since a kernel built with clang (I haven't tried gcc) during this window will make it impossible to do a buildworld without first rebuilding the kernel with this fix. It also seems to break at least portsnap, and possibly other tools as well. Regards! -- Niclas Zeising From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 15:53:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0100D106564A; Sun, 14 Aug 2011 15:53:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 862548FC0A; Sun, 14 Aug 2011 15:53:29 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p7EFrQxv020729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 15 Aug 2011 01:53:27 +1000 Date: Mon, 15 Aug 2011 01:53:26 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexander Best In-Reply-To: <20110810154956.GA4034@freebsd.org> Message-ID: <20110815013423.E2968@besplex.bde.org> References: <201108082036.p78KarlR062810@svn.freebsd.org> <20110809105824.P896@besplex.bde.org> <20110810103831.GA60858@freebsd.org> <20110810230856.M2222@besplex.bde.org> <20110810154956.GA4034@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, Dimitry Andric , Bruce Evans , svn-src-head@freebsd.org, Jonathan Anderson Subject: Re: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 15:53:30 -0000 On Wed, 10 Aug 2011, Alexander Best wrote: > On Wed Aug 10 11, Bruce Evans wrote: >> On Wed, 10 Aug 2011, Alexander Best wrote: >>> any reason {TIMEVAL,TIMESPEC}_TO_{TIMESPEC,TIMEVAL}()s code is being >>> executed >>> in a >>> >>> do { ... } while (0) >>> >>> conditional loop? >> >> Just the usual syntactical trick for making large macros that look >> like function calls almost usable like function calls. Without the > ... > thanks a lot for the in depth information. :) any reason, back in the days, it > was decided that the functionality of converting a timespec to a timeval and > vice versa should be implemented as a macro and not a function? Macros avoid some namespace pollution problems, and all the old kernel timeval manipulation interfaces are either extern functions or macros, partly because inline functions didn't exist when these interfaces were designed. But the TIME* macros still have gratuitously different styles: 1) they are spelled in upper case (which is "correct" since they are unsafe macros, but this is not done for the other timeval macros which are almost all unsafe) 2) FreeBSD moved their definitions from (where 4.4BSD-Lite put them) to . This is not incorrect (since is an old header that should only declare timeval interfaces (POSIX put timespec interfaces in ). However, the move became out of date before it was done (in 2001) because had already grown several other timespec interfaces which were not moved. But these were kernel-only, so they didn't cause namespace problems. Now has grown several more user timespec interfaces. Bruce From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 16:17:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0891106566C; Sun, 14 Aug 2011 16:17:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B00AF8FC0A; Sun, 14 Aug 2011 16:17:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7EGH0sg071085; Sun, 14 Aug 2011 16:17:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7EGH0Kd071083; Sun, 14 Aug 2011 16:17:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108141617.p7EGH0Kd071083@svn.freebsd.org> From: Alexander Motin Date: Sun, 14 Aug 2011 16:17:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224868 - head/sys/dev/mmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 16:17:00 -0000 Author: mav Date: Sun Aug 14 16:17:00 2011 New Revision: 224868 URL: http://svn.freebsd.org/changeset/base/224868 Log: Fix integer overflow on 32bit systems when calculating media size, reintroduced by r222475. Approved by: re (kib) Modified: head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Sun Aug 14 16:03:26 2011 (r224867) +++ head/sys/dev/mmc/mmcsd.c Sun Aug 14 16:17:00 2011 (r224868) @@ -137,7 +137,7 @@ mmcsd_attach(device_t dev) d->d_drv1 = sc; d->d_maxsize = 4*1024*1024; /* Maximum defined SD card AU size. */ d->d_sectorsize = mmc_get_sector_size(dev); - d->d_mediasize = mmc_get_media_size(dev) * d->d_sectorsize; + d->d_mediasize = (off_t)mmc_get_media_size(dev) * d->d_sectorsize; d->d_stripeoffset = 0; d->d_stripesize = mmc_get_erase_sector(dev) * d->d_sectorsize; d->d_unit = device_get_unit(dev); From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 16:27:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD474106566B; Sun, 14 Aug 2011 16:27:26 +0000 (UTC) (envelope-from ttsestt@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id A7ABD8FC0C; Sun, 14 Aug 2011 16:27:25 +0000 (UTC) Received: by bkat8 with SMTP id t8so3355344bka.13 for ; Sun, 14 Aug 2011 09:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=infYx1xLBFUFDGJwl3UlyvstkuLOLaa2A7RIjGWnxgQ=; b=Lb7QHTc0JheFpdVOvFZD5ULATWBl8FmVcpGRvYXdZIoNBOMzxmvv1hR3TTrG+d3p83 CeqDSKzf8y7zKLK5tnI2FVr3NfVrbDnPzpgKkvDHvBC1plpT3BpCIPCiByko7Ew0kV+h SVzYtyWwQPur4hXFa/WSNlOhIsI3eizN3Kl4A= Received: by 10.204.171.66 with SMTP id g2mr595049bkz.18.1313339244143; Sun, 14 Aug 2011 09:27:24 -0700 (PDT) Received: from localhost ([80.62.217.19]) by mx.google.com with ESMTPS id f9sm308764bkt.3.2011.08.14.09.27.23 (version=SSLv3 cipher=OTHER); Sun, 14 Aug 2011 09:27:23 -0700 (PDT) From: Test Rat To: Gordon Tetlow References: <201010070634.o976YlOG030724__26866.5940188386$1286433305$gmane$org@svn.freebsd.org> Date: Sun, 14 Aug 2011 20:27:19 +0400 In-Reply-To: <201010070634.o976YlOG030724__26866.5940188386$1286433305$gmane$org@svn.freebsd.org> (Gordon Tetlow's message of "Thu, 7 Oct 2010 06:34:47 +0000 (UTC)") Message-ID: <86obzsot5k.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, Alexander Best , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213507 - head/usr.bin/man X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 16:27:26 -0000 Gordon Tetlow writes: > Author: gordon > Date: Thu Oct 7 06:34:47 2010 > New Revision: 213507 > URL: http://svn.freebsd.org/changeset/base/213507 > > Log: > Add the ability to display specific manual pages if passed on the > commandline. This mirrors the old (undocumented) GNU man functionality. > Also document this feature in the implementation notes section of > the manpage. > > Submitted by: arundel > Approved by: wes (mentor implicit) Why the limitation? It's rather painful to prefix manpages with $PWD on command line. And a useful case of displaying generated on-the-fly manpages is missed, too, irrespective of GNU man. $ man dup.2 $ texi2pod.pl ffmpeg.texi | pod2man | man %% Index: usr.bin/man/man.sh =================================================================== --- usr.bin/man/man.sh (revision 224842) +++ usr.bin/man/man.sh (working copy) @@ -403,10 +403,9 @@ man_find_and_display() { local found_page locpath p path sect - # Check to see if it's a file. But only if it has a '/' in - # the filename. - case "$1" in - */*) if [ -f "$1" -a -r "$1" ]; then + # Check to see if it's a troff file. + case $(file --brief --mime-type "$1") in + text/troff) if [ -f "$1" -a -r "$1" ]; then decho "Found a usable page, displaying that" unset use_cat manpage="$1" @@ -898,12 +897,16 @@ do_man() { man_parse_args "$@" - if [ -z "$pages" ]; then + if [ -z "$pages" -a -t 0 ]; then echo 'What manual page do you want?' >&2 exit 1 fi man_setup + if [ ! -t 0 ]; then + man_display_page + fi + for page in $pages; do decho "Searching for $page" man_find_and_display "$page" Index: usr.bin/man/man.1 =================================================================== --- usr.bin/man/man.1 (revision 224842) +++ usr.bin/man/man.1 (working copy) @@ -232,9 +232,7 @@ The .Nm utility also supports displaying a specific manual page if passed a path -to the file as long as it contains a -.Ql / -character. +to the file as long as it's a troff file. .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : %% From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 17:06:21 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id B286F106566B; Sun, 14 Aug 2011 17:06:21 +0000 (UTC) Date: Sun, 14 Aug 2011 17:06:21 +0000 From: Alexander Best To: Niclas Zeising Message-ID: <20110814170621.GA4189@freebsd.org> References: <201108131603.p7DG3e80023093@svn.freebsd.org> <4E47EF64.2070405@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E47EF64.2070405@gmail.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson Subject: Re: svn commit: r224842 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 17:06:21 -0000 On Sun Aug 14 11, Niclas Zeising wrote: > On 2011-08-13 18:03, Robert Watson wrote: > > Author: rwatson > > Date: Sat Aug 13 16:03:40 2011 > > New Revision: 224842 > > URL: http://svn.freebsd.org/changeset/base/224842 > > > > Log: > > When falloc() was broken into separate falloc_noinstall() and finstall(), > > a bug was introduced in kern_openat() such that the error from the vnode > > open operation was overwritten before it was passed as an argument to > > dupfdopen(). This broke operations on /dev/{stdin,stdout,stderr}. Fix > > by preserving the original error number across finstall() so that it is > > still available. > > > > Approved by: re (kib) > > Reported by: cognet > > > > Modified: > > head/sys/kern/vfs_syscalls.c > > > > It might be worth mentioning this in UPDATING or similar, since a kernel > built with clang (I haven't tried gcc) during this window will make it > impossible to do a buildworld without first rebuilding the kernel with > this fix. It also seems to break at least portsnap, and possibly other > tools as well. +1. please also mention the KPI change to fget()! so many people have had issues, where 3rd party drivers - mostly the nvidia binary driver - got broken. cheers. alex > > Regards! > -- > Niclas Zeising From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 17:16:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id E7E2E1065672; Sun, 14 Aug 2011 17:16:17 +0000 (UTC) Date: Sun, 14 Aug 2011 17:16:17 +0000 From: Alexander Best To: Test Rat Message-ID: <20110814171617.GA4980@freebsd.org> References: <201010070634.o976YlOG030724__26866.5940188386$1286433305$gmane$org@svn.freebsd.org> <86obzsot5k.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86obzsot5k.fsf@gmail.com> Cc: Gordon Tetlow , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213507 - head/usr.bin/man X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 17:16:18 -0000 On Sun Aug 14 11, Test Rat wrote: > Gordon Tetlow writes: > > > Author: gordon > > Date: Thu Oct 7 06:34:47 2010 > > New Revision: 213507 > > URL: http://svn.freebsd.org/changeset/base/213507 > > > > Log: > > Add the ability to display specific manual pages if passed on the > > commandline. This mirrors the old (undocumented) GNU man functionality. > > Also document this feature in the implementation notes section of > > the manpage. > > > > Submitted by: arundel > > Approved by: wes (mentor implicit) > > Why the limitation? It's rather painful to prefix manpages with $PWD > on command line. And a useful case of displaying generated on-the-fly > manpages is missed, too, irrespective of GNU man. at the time my issue was that something like 'man /usr/src/share/man/man1/intro.1' didn't work and gordon fixed that to restore gnu man behavior. i never really tried or needed something like in your example to be honest. ;) but if it makes peoples lives easier and doesn't cause any collisions with gnu man behaviour, then i'm in. ;) cheers. alex > > $ man dup.2 > $ texi2pod.pl ffmpeg.texi | pod2man | man > > %% > Index: usr.bin/man/man.sh > =================================================================== > --- usr.bin/man/man.sh (revision 224842) > +++ usr.bin/man/man.sh (working copy) > @@ -403,10 +403,9 @@ > man_find_and_display() { > local found_page locpath p path sect > > - # Check to see if it's a file. But only if it has a '/' in > - # the filename. > - case "$1" in > - */*) if [ -f "$1" -a -r "$1" ]; then > + # Check to see if it's a troff file. > + case $(file --brief --mime-type "$1") in > + text/troff) if [ -f "$1" -a -r "$1" ]; then > decho "Found a usable page, displaying that" > unset use_cat > manpage="$1" > @@ -898,12 +897,16 @@ > > do_man() { > man_parse_args "$@" > - if [ -z "$pages" ]; then > + if [ -z "$pages" -a -t 0 ]; then > echo 'What manual page do you want?' >&2 > exit 1 > fi > man_setup > > + if [ ! -t 0 ]; then > + man_display_page > + fi > + > for page in $pages; do > decho "Searching for $page" > man_find_and_display "$page" > Index: usr.bin/man/man.1 > =================================================================== > --- usr.bin/man/man.1 (revision 224842) > +++ usr.bin/man/man.1 (working copy) > @@ -232,9 +232,7 @@ > The > .Nm > utility also supports displaying a specific manual page if passed a path > -to the file as long as it contains a > -.Ql / > -character. > +to the file as long as it's a troff file. > .Sh ENVIRONMENT > The following environment variables affect the execution of > .Nm : > %% From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 18:14:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 473A9106566C; Sun, 14 Aug 2011 18:14:20 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 22EEB8FC13; Sun, 14 Aug 2011 18:14:20 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id AFF8346B0D; Sun, 14 Aug 2011 14:14:19 -0400 (EDT) Date: Sun, 14 Aug 2011 19:14:19 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Niclas Zeising In-Reply-To: <4E47EF64.2070405@gmail.com> Message-ID: References: <201108131603.p7DG3e80023093@svn.freebsd.org> <4E47EF64.2070405@gmail.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224842 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 18:14:20 -0000 On Sun, 14 Aug 2011, Niclas Zeising wrote: >> When falloc() was broken into separate falloc_noinstall() and finstall(), >> a bug was introduced in kern_openat() such that the error from the vnode >> open operation was overwritten before it was passed as an argument to >> dupfdopen(). This broke operations on /dev/{stdin,stdout,stderr}. Fix >> by preserving the original error number across finstall() so that it is >> still available. > > It might be worth mentioning this in UPDATING or similar, since a kernel > built with clang (I haven't tried gcc) during this window will make it > impossible to do a buildworld without first rebuilding the kernel with this > fix. It also seems to break at least portsnap, and possibly other tools as > well. I've queued an update request for UPDATING to re@. I'm not sure that the gcc case was affected (which is to say: I'm not sure I've seen reports of it), but I don't know whether I've specifically tested that case. I can go back and test it, but it seems easiest to instead just advise people to skip those revs entirely. Robert From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 18:16:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52BCE106566C; Sun, 14 Aug 2011 18:16:45 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2CE158FC0A; Sun, 14 Aug 2011 18:16:45 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id D19FA46B09; Sun, 14 Aug 2011 14:16:43 -0400 (EDT) Date: Sun, 14 Aug 2011 19:16:43 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Alexander Best In-Reply-To: <20110814170621.GA4189@freebsd.org> Message-ID: References: <201108131603.p7DG3e80023093@svn.freebsd.org> <4E47EF64.2070405@gmail.com> <20110814170621.GA4189@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Niclas Zeising , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r224842 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 18:16:45 -0000 On Sun, 14 Aug 2011, Alexander Best wrote: >> It might be worth mentioning this in UPDATING or similar, since a kernel >> built with clang (I haven't tried gcc) during this window will make it >> impossible to do a buildworld without first rebuilding the kernel with this >> fix. It also seems to break at least portsnap, and possibly other tools as >> well. > > +1. please also mention the KPI change to fget()! so many people have had > issues, where 3rd party drivers - mostly the nvidia binary driver - got > broken. The nVidia driver is rare in that it uses the file descriptor interfaces from inside a third-party driver. Most third-party drivers plug into much more limited subsets of the kernel -- newbus, busdma, the ifnet interface, the disk interface, CAM, USB, etc. The reason to merge this change now was to ensure that 9.0 shipped with the interface in its final form rather than have to try to work around the existing modules for 9.1. However, I would comment more generally that device drivers that use interfaces outside of the kernel device driver KPIs are inherently fragile. (Not sure there's anything to be done about that in the nVidia case). (Per previous e-mail, I have queued a request to re@ to update UPDATING). Robert From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 20:07:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76594106574C; Sun, 14 Aug 2011 20:07:08 +0000 (UTC) (envelope-from niclas.zeising@gmail.com) Received: from mail.lysator.liu.se (mail.lysator.liu.se [IPv6:2001:6b0:17:f0a0::3]) by mx1.freebsd.org (Postfix) with ESMTP id F325A8FC12; Sun, 14 Aug 2011 20:07:07 +0000 (UTC) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 3F47540024; Sun, 14 Aug 2011 22:07:07 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 350E840023; Sun, 14 Aug 2011 22:07:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bernadotte.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL,FREEMAIL_FROM autolearn=disabled version=3.3.1 X-Spam-Score: 0.0 Received: from mx.daemonic.se (mx.daemonic.se [IPv6:2001:470:dca9:0:1::3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 10E8740026; Sun, 14 Aug 2011 22:04:45 +0200 (CEST) Received: from mail.daemonic.se (mail.daemonic.se [IPv6:2001:470:dca9:0:1::4]) by mx.daemonic.se (Postfix) with ESMTPS id D1AD0119C04; Sun, 14 Aug 2011 22:02:28 +0200 (CEST) Received: from [IPv6:2001:470:dca9:1::4] (vivi.daemonic.se [IPv6:2001:470:dca9:1::4]) by mail.daemonic.se (Postfix) with ESMTPSA id B979B12B0A0; Sun, 14 Aug 2011 22:02:28 +0200 (CEST) Message-ID: <4E4829CE.8060201@gmail.com> Date: Sun, 14 Aug 2011 22:02:22 +0200 From: Niclas Zeising User-Agent: Mutt/1.5.21 MIME-Version: 1.0 To: Robert Watson References: <201108131603.p7DG3e80023093@svn.freebsd.org> <4E47EF64.2070405@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224842 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 20:07:08 -0000 On 2011-08-14 20:14, Robert Watson wrote: > > On Sun, 14 Aug 2011, Niclas Zeising wrote: > >>> When falloc() was broken into separate falloc_noinstall() and >>> finstall(), >>> a bug was introduced in kern_openat() such that the error from the >>> vnode >>> open operation was overwritten before it was passed as an argument to >>> dupfdopen(). This broke operations on /dev/{stdin,stdout,stderr}. >>> Fix >>> by preserving the original error number across finstall() so that >>> it is >>> still available. >> >> It might be worth mentioning this in UPDATING or similar, since a >> kernel built with clang (I haven't tried gcc) during this window will >> make it impossible to do a buildworld without first rebuilding the >> kernel with this fix. It also seems to break at least portsnap, and >> possibly other tools as well. > > I've queued an update request for UPDATING to re@. I'm not sure that > the gcc case was affected (which is to say: I'm not sure I've seen > reports of it), but I don't know whether I've specifically tested that > case. I can go back and test it, but it seems easiest to instead just > advise people to skip those revs entirely. > > Robert Thank you very much! -- Niclas From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 20:55:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 206A2106564A; Sun, 14 Aug 2011 20:55:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F8B18FC17; Sun, 14 Aug 2011 20:55:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7EKtWZg079415; Sun, 14 Aug 2011 20:55:32 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7EKtWNA079408; Sun, 14 Aug 2011 20:55:32 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201108142055.p7EKtWNA079408@svn.freebsd.org> From: Michael Tuexen Date: Sun, 14 Aug 2011 20:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224870 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 20:55:33 -0000 Author: tuexen Date: Sun Aug 14 20:55:32 2011 New Revision: 224870 URL: http://svn.freebsd.org/changeset/base/224870 Log: Add support for the spp_dscp field in the SCTP_PEER_ADDR_PARAMS socket option. Backwards compatibility is provided by still supporting the spp_ipv4_tos field. Approved by: re@ MFC after: 2 months. Modified: head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Aug 14 20:54:13 2011 (r224869) +++ head/sys/netinet/sctp_output.c Sun Aug 14 20:55:32 2011 (r224870) @@ -3967,7 +3967,7 @@ sctp_lowlevel_chunk_output(struct sctp_i ip->ip_v = IPVERSION; ip->ip_hl = (sizeof(struct ip) >> 2); if (net) { - tos_value = net->tos_flowlabel & 0x000000ff; + tos_value = net->dscp; } else { tos_value = inp->ip_inp.inp.inp_ip_tos; } @@ -4204,7 +4204,7 @@ sctp_lowlevel_chunk_output(struct sctp_i int len; if (net != NULL) { - flowlabel = net->tos_flowlabel; + flowlabel = net->flowlabel; } else { flowlabel = ((struct in6pcb *)inp)->in6p_flowinfo; } Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Aug 14 20:54:13 2011 (r224869) +++ head/sys/netinet/sctp_pcb.c Sun Aug 14 20:55:32 2011 (r224870) @@ -4009,20 +4009,13 @@ sctp_add_remote_addr(struct sctp_tcb *st stcb->asoc.numnets++; *(&net->ref_count) = 1; net->cwr_window_tsn = net->last_cwr_tsn = stcb->asoc.sending_seq - 1; - net->tos_flowlabel = 0; if (SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable)) { net->port = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); } else { net->port = 0; } -#ifdef INET - if (newaddr->sa_family == AF_INET) - net->tos_flowlabel = stcb->asoc.default_tos; -#endif -#ifdef INET6 - if (newaddr->sa_family == AF_INET6) - net->tos_flowlabel = stcb->asoc.default_flowlabel; -#endif + net->dscp = stcb->asoc.default_dscp; + net->flowlabel = stcb->asoc.default_flowlabel; if (sctp_is_feature_on(stcb->sctp_ep, SCTP_PCB_FLAGS_DONOT_HEARTBEAT)) { net->dest_state |= SCTP_ADDR_NOHB; } else { Modified: head/sys/netinet/sctp_structs.h ============================================================================== --- head/sys/netinet/sctp_structs.h Sun Aug 14 20:54:13 2011 (r224869) +++ head/sys/netinet/sctp_structs.h Sun Aug 14 20:55:32 2011 (r224870) @@ -321,7 +321,8 @@ struct sctp_nets { uint32_t fast_recovery_tsn; uint32_t heartbeat_random1; uint32_t heartbeat_random2; - uint32_t tos_flowlabel; + uint32_t flowlabel; + uint8_t dscp; struct timeval start_time; /* time when this net was created */ uint32_t marked_retrans;/* number or DATA chunks marked for timer @@ -1137,7 +1138,7 @@ struct sctp_association { uint8_t last_flags_delivered; uint8_t hb_ect_randombit; uint8_t hb_random_idx; - uint8_t default_tos; + uint8_t default_dscp; uint8_t asconf_del_pending; /* asconf delete last addr pending */ /* Modified: head/sys/netinet/sctp_uio.h ============================================================================== --- head/sys/netinet/sctp_uio.h Sun Aug 14 20:54:13 2011 (r224869) +++ head/sys/netinet/sctp_uio.h Sun Aug 14 20:55:32 2011 (r224870) @@ -505,9 +505,11 @@ struct sctp_paddrparams { uint32_t spp_flags; uint32_t spp_ipv6_flowlabel; uint16_t spp_pathmaxrxt; - uint8_t spp_ipv4_tos; + uint8_t spp_dscp; }; +#define spp_ipv4_tos spp_dscp + #define SPP_HB_ENABLE 0x00000001 #define SPP_HB_DISABLE 0x00000002 #define SPP_HB_DEMAND 0x00000004 @@ -515,7 +517,8 @@ struct sctp_paddrparams { #define SPP_PMTUD_DISABLE 0x00000010 #define SPP_HB_TIME_IS_ZERO 0x00000080 #define SPP_IPV6_FLOWLABEL 0x00000100 -#define SPP_IPV4_TOS 0x00000200 +#define SPP_DSCP 0x00000200 +#define SPP_IPV4_TOS SPP_DSCP struct sctp_paddrthlds { sctp_assoc_t spt_assoc_id; Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun Aug 14 20:54:13 2011 (r224869) +++ head/sys/netinet/sctp_usrreq.c Sun Aug 14 20:55:32 2011 (r224870) @@ -2416,13 +2416,13 @@ flags_out: } #ifdef INET if (net->ro._l_addr.sin.sin_family == AF_INET) { - paddrp->spp_ipv4_tos = net->tos_flowlabel & 0x000000fc; - paddrp->spp_flags |= SPP_IPV4_TOS; + paddrp->spp_dscp = net->dscp; + paddrp->spp_flags |= SPP_DSCP; } #endif #ifdef INET6 if (net->ro._l_addr.sin6.sin6_family == AF_INET6) { - paddrp->spp_ipv6_flowlabel = net->tos_flowlabel; + paddrp->spp_ipv6_flowlabel = net->flowlabel; paddrp->spp_flags |= SPP_IPV6_FLOWLABEL; } #endif @@ -2436,8 +2436,8 @@ flags_out: paddrp->spp_pathmaxrxt = stcb->asoc.def_net_failure; paddrp->spp_pathmtu = sctp_get_frag_point(stcb, &stcb->asoc); #ifdef INET - paddrp->spp_ipv4_tos = stcb->asoc.default_tos & 0x000000fc; - paddrp->spp_flags |= SPP_IPV4_TOS; + paddrp->spp_dscp = stcb->asoc.default_dscp & 0x000000fc; + paddrp->spp_flags |= SPP_DSCP; #endif #ifdef INET6 paddrp->spp_ipv6_flowlabel = stcb->asoc.default_flowlabel; @@ -2470,8 +2470,8 @@ flags_out: paddrp->spp_assoc_id = SCTP_FUTURE_ASSOC; /* get inp's default */ #ifdef INET - paddrp->spp_ipv4_tos = inp->ip_inp.inp.inp_ip_tos; - paddrp->spp_flags |= SPP_IPV4_TOS; + paddrp->spp_dscp = inp->ip_inp.inp.inp_ip_tos; + paddrp->spp_flags |= SPP_DSCP; #endif #ifdef INET6 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { @@ -4626,16 +4626,16 @@ sctp_setopt(struct socket *so, int optna net->failure_threshold = paddrp->spp_pathmaxrxt; } #ifdef INET - if (paddrp->spp_flags & SPP_IPV4_TOS) { + if (paddrp->spp_flags & SPP_DSCP) { if (net->ro._l_addr.sin.sin_family == AF_INET) { - net->tos_flowlabel = paddrp->spp_ipv4_tos & 0x000000fc; + net->dscp = paddrp->spp_dscp & 0xfc; } } #endif #ifdef INET6 if (paddrp->spp_flags & SPP_IPV6_FLOWLABEL) { if (net->ro._l_addr.sin6.sin6_family == AF_INET6) { - net->tos_flowlabel = paddrp->spp_ipv6_flowlabel; + net->flowlabel = paddrp->spp_ipv6_flowlabel & 0x000fffff; } } #endif @@ -4724,27 +4724,18 @@ sctp_setopt(struct socket *so, int optna } } } -#ifdef INET - if (paddrp->spp_flags & SPP_IPV4_TOS) { + if (paddrp->spp_flags & SPP_DSCP) { TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { - if (net->ro._l_addr.sin.sin_family == AF_INET) { - net->tos_flowlabel = paddrp->spp_ipv4_tos & 0x000000fc; - } + net->dscp = paddrp->spp_dscp & 0x000000fc; } - stcb->asoc.default_tos = paddrp->spp_ipv4_tos & 0x000000fc; + stcb->asoc.default_dscp = paddrp->spp_dscp & 0x000000fc; } -#endif -#ifdef INET6 if (paddrp->spp_flags & SPP_IPV6_FLOWLABEL) { TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { - if (net->ro._l_addr.sin6.sin6_family == AF_INET6) { - net->tos_flowlabel = paddrp->spp_ipv6_flowlabel; - } + net->flowlabel = paddrp->spp_ipv6_flowlabel; } stcb->asoc.default_flowlabel = paddrp->spp_ipv6_flowlabel; } -#endif - } SCTP_TCB_UNLOCK(stcb); } else { Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun Aug 14 20:54:13 2011 (r224869) +++ head/sys/netinet/sctputil.c Sun Aug 14 20:55:32 2011 (r224870) @@ -924,9 +924,9 @@ sctp_init_asoc(struct sctp_inpcb *m, str asoc->sctp_frag_point = m->sctp_frag_point; asoc->sctp_features = m->sctp_features; #ifdef INET - asoc->default_tos = m->ip_inp.inp.inp_ip_tos; + asoc->default_dscp = m->ip_inp.inp.inp_ip_tos; #else - asoc->default_tos = 0; + asoc->default_dscp = 0; #endif #ifdef INET6 From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 07:30:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7622D106566C; Mon, 15 Aug 2011 07:30:48 +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 6612C8FC15; Mon, 15 Aug 2011 07:30:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7F7Umoi098661; Mon, 15 Aug 2011 07:30:48 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7F7Ummb098659; Mon, 15 Aug 2011 07:30:48 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108150730.p7F7Ummb098659@svn.freebsd.org> From: Robert Watson Date: Mon, 15 Aug 2011 07:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224875 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 07:30:48 -0000 Author: rwatson Date: Mon Aug 15 07:30:48 2011 New Revision: 224875 URL: http://svn.freebsd.org/changeset/base/224875 Log: Bump __FreeBSD_version to reflect the availability of capabilities, but also capability-related changes to fget(9). This is likely not part of a formal KPI, but the nvidia driver (at least) uses it. Mention /dev/{stdin,stdout,stderr} breakage that appears in certain kernel revisions as best avoided! Approved by: re (xxx) Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Aug 15 03:41:48 2011 (r224874) +++ head/UPDATING Mon Aug 15 07:30:48 2011 (r224875) @@ -22,6 +22,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20110815: + During the merge of Capsicum features, the fget(9) KPI was modified. + This may require the rebuilding of out-of-tree device drivers -- + issues have been reported specifically with the nVidia device driver. + __FreeBSD_version is bumped to 900041. + + Also, there is a period between 20110811 and 20110814 where the + special devices /dev/{stdin,stdout,stderr} did not work correctly. + Building world from a kernel during that window may not work. + 20110628: The packet filter (pf) code has been updated to OpenBSD 4.5. You need to update userland tools to be in sync with kernel. From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 07:32:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73EAC106564A; Mon, 15 Aug 2011 07:32:44 +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 634CC8FC17; Mon, 15 Aug 2011 07:32:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7F7Wiid098758; Mon, 15 Aug 2011 07:32:44 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7F7WiBQ098755; Mon, 15 Aug 2011 07:32:44 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108150732.p7F7WiBQ098755@svn.freebsd.org> From: Robert Watson Date: Mon, 15 Aug 2011 07:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224876 - in head/sys: modules/portalfs ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 07:32:44 -0000 Author: rwatson Date: Mon Aug 15 07:32:44 2011 New Revision: 224876 URL: http://svn.freebsd.org/changeset/base/224876 Log: Fix two cases involving opt_capsicum.h and module builds: (1) opt_capsicum.h is no longer required in ffs_alloc.c, so remove the #include. (2) portalfs depends on opt_capsicum.h, so have the Makefile generate one if required. These affect only modules built without a kernel (i.e, not buildkernel, but yes buildworld if the dubious MODULES_WITH_WORLD is used). Approved by: re (bz) Sponsored by: Google Inc Modified: head/sys/modules/portalfs/Makefile head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/modules/portalfs/Makefile ============================================================================== --- head/sys/modules/portalfs/Makefile Mon Aug 15 07:30:48 2011 (r224875) +++ head/sys/modules/portalfs/Makefile Mon Aug 15 07:32:44 2011 (r224876) @@ -4,6 +4,7 @@ KMOD= portalfs SRCS= vnode_if.h \ - portal_vfsops.c portal_vnops.c + portal_vfsops.c portal_vnops.c \ + opt_capsicum.h .include Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Mon Aug 15 07:30:48 2011 (r224875) +++ head/sys/ufs/ffs/ffs_alloc.c Mon Aug 15 07:32:44 2011 (r224876) @@ -62,7 +62,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_capsicum.h" #include "opt_quota.h" #include From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 08:01:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B81F9106564A; Mon, 15 Aug 2011 08:01:31 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 955008FC13; Mon, 15 Aug 2011 08:01:31 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 1419346B32; Mon, 15 Aug 2011 04:01:31 -0400 (EDT) Date: Mon, 15 Aug 2011 09:01:30 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Niclas Zeising In-Reply-To: <4E47EF64.2070405@gmail.com> Message-ID: References: <201108131603.p7DG3e80023093@svn.freebsd.org> <4E47EF64.2070405@gmail.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224842 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 08:01:31 -0000 On Sun, 14 Aug 2011, Niclas Zeising wrote: >> When falloc() was broken into separate falloc_noinstall() and finstall(), >> a bug was introduced in kern_openat() such that the error from the vnode >> open operation was overwritten before it was passed as an argument to >> dupfdopen(). This broke operations on /dev/{stdin,stdout,stderr}. Fix >> by preserving the original error number across finstall() so that it is >> still available. > > It might be worth mentioning this in UPDATING or similar, since a kernel > built with clang (I haven't tried gcc) during this window will make it > impossible to do a buildworld without first rebuilding the kernel with this > fix. It also seems to break at least portsnap, and possibly other tools as > well. Entry now in UPDATING, thanks! I've also sent out a warning to current@. Robert From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 08:05:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF8F810657D6; Mon, 15 Aug 2011 08:05:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id BB1DB8FC17; Mon, 15 Aug 2011 08:05:14 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 0F91546B32; Mon, 15 Aug 2011 04:05:14 -0400 (EDT) Date: Mon, 15 Aug 2011 09:05:13 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Alexander Best In-Reply-To: <20110814170621.GA4189@freebsd.org> Message-ID: References: <201108131603.p7DG3e80023093@svn.freebsd.org> <4E47EF64.2070405@gmail.com> <20110814170621.GA4189@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Niclas Zeising , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r224842 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 08:05:15 -0000 On Sun, 14 Aug 2011, Alexander Best wrote: >> It might be worth mentioning this in UPDATING or similar, since a kernel >> built with clang (I haven't tried gcc) during this window will make it >> impossible to do a buildworld without first rebuilding the kernel with this >> fix. It also seems to break at least portsnap, and possibly other tools as >> well. > > +1. please also mention the KPI change to fget()! so many people have had > issues, where 3rd party drivers - mostly the nvidia binary driver - got > broken. Now in place. However, I think it's fairly likely that nVidia binary drivers will see further disruption in the future. Other than preventing the driver from loading when it's out of sync with __FreeBSD_version (which I believe we now do?), I'm not sure what further is to be done there. In general, we don't tweak things like fget(9) very often, but we do make changes to fileops with moderate frequency, and the failure modes there are quite a bit more subtle. It would be useful to see a KBI analysis of the nVidia module so we can decide how to moderate that risk. (We've done some work on formalising the relationship between network device drivers and the kernel, which has led is to have specific policies on data structure changes, for example -- but we haven't done symbol dependencies as yet.) Robert From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 09:26:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 884B8106564A; Mon, 15 Aug 2011 09:26:53 +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 6D5FB8FC0C; Mon, 15 Aug 2011 09:26:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7F9Qrgp002418; Mon, 15 Aug 2011 09:26:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7F9QrUc002414; Mon, 15 Aug 2011 09:26:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108150926.p7F9QrUc002414@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 15 Aug 2011 09:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224878 - in stable/8/sys: compat/linprocfs vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 09:26:53 -0000 Author: kib Date: Mon Aug 15 09:26:53 2011 New Revision: 224878 URL: http://svn.freebsd.org/changeset/base/224878 Log: MFC r224582: Implement the linprocfs swaps file. Modified: stable/8/sys/compat/linprocfs/linprocfs.c stable/8/sys/vm/swap_pager.c stable/8/sys/vm/swap_pager.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/8/sys/compat/linprocfs/linprocfs.c Mon Aug 15 09:07:42 2011 (r224877) +++ stable/8/sys/compat/linprocfs/linprocfs.c Mon Aug 15 09:26:53 2011 (r224878) @@ -499,6 +499,33 @@ linprocfs_dostat(PFS_FILL_ARGS) return (0); } +static int +linprocfs_doswaps(PFS_FILL_ARGS) +{ + struct xswdev xsw; + uintmax_t total, used; + int n; + char devname[SPECNAMELEN + 1]; + + sbuf_printf(sb, "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n"); + mtx_lock(&Giant); + for (n = 0; ; n++) { + if (swap_dev_info(n, &xsw, devname, sizeof(devname)) != 0) + break; + total = (uintmax_t)xsw.xsw_nblks * PAGE_SIZE / 1024; + used = (uintmax_t)xsw.xsw_used * PAGE_SIZE / 1024; + + /* + * The space and not tab after the device name is on + * purpose. Linux does so. + */ + sbuf_printf(sb, "/dev/%-34s unknown\t\t%jd\t%jd\t-1\n", + devname, total, used); + } + mtx_unlock(&Giant); + return (0); +} + /* * Filler function for proc/uptime */ @@ -1453,6 +1480,8 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, 0); pfs_create_file(root, "stat", &linprocfs_dostat, NULL, NULL, NULL, PFS_RD); + pfs_create_file(root, "swaps", &linprocfs_doswaps, + NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "uptime", &linprocfs_douptime, NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "version", &linprocfs_doversion, Modified: stable/8/sys/vm/swap_pager.c ============================================================================== --- stable/8/sys/vm/swap_pager.c Mon Aug 15 09:07:42 2011 (r224877) +++ stable/8/sys/vm/swap_pager.c Mon Aug 15 09:26:53 2011 (r224878) @@ -2361,35 +2361,53 @@ swap_pager_status(int *total, int *used) mtx_unlock(&sw_dev_mtx); } -static int -sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) +int +swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len) { - int *name = (int *)arg1; - int error, n; - struct xswdev xs; struct swdevt *sp; - - if (arg2 != 1) /* name length */ - return (EINVAL); + char *tmp_devname; + int error, n; n = 0; + error = ENOENT; mtx_lock(&sw_dev_mtx); TAILQ_FOREACH(sp, &swtailq, sw_list) { - if (n == *name) { - mtx_unlock(&sw_dev_mtx); - xs.xsw_version = XSWDEV_VERSION; - xs.xsw_dev = sp->sw_dev; - xs.xsw_flags = sp->sw_flags; - xs.xsw_nblks = sp->sw_nblks; - xs.xsw_used = sp->sw_used; - - error = SYSCTL_OUT(req, &xs, sizeof(xs)); - return (error); + if (n != name) { + n++; + continue; + } + xs->xsw_version = XSWDEV_VERSION; + xs->xsw_dev = sp->sw_dev; + xs->xsw_flags = sp->sw_flags; + xs->xsw_nblks = sp->sw_nblks; + xs->xsw_used = sp->sw_used; + if (devname != NULL) { + if (vn_isdisk(sp->sw_vp, NULL)) + tmp_devname = sp->sw_vp->v_rdev->si_name; + else + tmp_devname = "[file]"; + strncpy(devname, tmp_devname, len); } - n++; + error = 0; + break; } mtx_unlock(&sw_dev_mtx); - return (ENOENT); + return (error); +} + +static int +sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) +{ + struct xswdev xs; + int error; + + if (arg2 != 1) /* name length */ + return (EINVAL); + error = swap_dev_info(*(int *)arg1, &xs, NULL, 0); + if (error != 0) + return (error); + error = SYSCTL_OUT(req, &xs, sizeof(xs)); + return (error); } SYSCTL_INT(_vm, OID_AUTO, nswapdev, CTLFLAG_RD, &nswapdev, 0, Modified: stable/8/sys/vm/swap_pager.h ============================================================================== --- stable/8/sys/vm/swap_pager.h Mon Aug 15 09:07:42 2011 (r224877) +++ stable/8/sys/vm/swap_pager.h Mon Aug 15 09:26:53 2011 (r224878) @@ -75,7 +75,8 @@ struct swdevt { extern int swap_pager_full; extern int swap_pager_avail; -struct swdevt; +struct xswdev; +int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); void swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_swap_init(void); From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 12:08:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AF201065675; Mon, 15 Aug 2011 12:08:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 624938FC1E; Mon, 15 Aug 2011 12:08:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FC8fWG009428; Mon, 15 Aug 2011 12:08:41 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FC8frR009426; Mon, 15 Aug 2011 12:08:41 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201108151208.p7FC8frR009426@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 15 Aug 2011 12:08:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224879 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 12:08:41 -0000 Author: glebius Date: Mon Aug 15 12:08:41 2011 New Revision: 224879 URL: http://svn.freebsd.org/changeset/base/224879 Log: Describe how carp(4) status changes can be processed with help of devd(8). Submitted by: "Alexander V. Chernikov" Approved by: re (kib) Modified: head/share/man/man4/carp.4 Modified: head/share/man/man4/carp.4 ============================================================================== --- head/share/man/man4/carp.4 Mon Aug 15 09:26:53 2011 (r224878) +++ head/share/man/man4/carp.4 Mon Aug 15 12:08:41 2011 (r224879) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 5, 2010 +.Dd August 15, 2011 .Dt CARP 4 .Os .Sh NAME @@ -168,6 +168,25 @@ forwarded to its destination, and destin than the state information is packed and synced with the second router. If the reply would be load balanced to second router, it will be dropped due to no state. +.Sh STATE CHANGE NOTIFICATIONS +Sometimes it is useful to get notified about +.Nm +status change events. +This can be accomplished by using +.Xr devd 8 +hooks. +Master/slave events are signalled as +.Nm +interface +.Dv LINK_UP +or +.Dv LINK_DOWN +event. +Please see +.Xr devd.conf 5 +and +.Sx EXAMPLES +section for more information. .Sh EXAMPLES For firewalls and routers with multiple interfaces, it is desirable to failover all of the @@ -249,6 +268,25 @@ This way, locally connected systems will subsequent IP traffic will be balanced among the hosts. If one of the hosts fails, the other will take over the virtual MAC address, and begin answering ARP requests on its behalf. +.Pp +Processing of +.Nm +status change events can be set up by using the following devd.conf rules: +.Bd -literal -offset indent +notify 0 { + match "system" "IFNET"; + match "type" "LINK_UP"; + match "subsystem" "carp*"; + action "/root/carpcontrol.sh $type $subsystem"; +}; + +notify 0 { + match "system" "IFNET"; + match "type" "LINK_UP"; + match "subsystem" "carp*"; + action "/root/carpcontrol.sh $type $subsystem"; +}; +.Ed .Sh SEE ALSO .Xr inet 4 , .Xr pfsync 4 , From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 12:09:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 29D73106568A; Mon, 15 Aug 2011 12:09:01 +0000 (UTC) Date: Mon, 15 Aug 2011 12:09:01 +0000 From: Alexander Best To: Bruce Evans Message-ID: <20110815120901.GC21258@freebsd.org> References: <201108082036.p78KarlR062810@svn.freebsd.org> <20110809105824.P896@besplex.bde.org> <20110810103831.GA60858@freebsd.org> <20110810230856.M2222@besplex.bde.org> <20110810154956.GA4034@freebsd.org> <20110815013423.E2968@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110815013423.E2968@besplex.bde.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric , Jonathan Anderson Subject: Re: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 12:09:01 -0000 On Mon Aug 15 11, Bruce Evans wrote: > On Wed, 10 Aug 2011, Alexander Best wrote: > > >On Wed Aug 10 11, Bruce Evans wrote: > >>On Wed, 10 Aug 2011, Alexander Best wrote: > >>>any reason {TIMEVAL,TIMESPEC}_TO_{TIMESPEC,TIMEVAL}()s code is being > >>>executed > >>>in a > >>> > >>>do { ... } while (0) > >>> > >>>conditional loop? > >> > >>Just the usual syntactical trick for making large macros that look > >>like function calls almost usable like function calls. Without the > >... > >thanks a lot for the in depth information. :) any reason, back in the > >days, it > >was decided that the functionality of converting a timespec to a timeval > >and > >vice versa should be implemented as a macro and not a function? > > Macros avoid some namespace pollution problems, and all the old kernel > timeval manipulation interfaces are either extern functions or macros, > partly because inline functions didn't exist when these interfaces were > designed. But the TIME* macros still have gratuitously different styles: > 1) they are spelled in upper case (which is "correct" since they are unsafe > macros, but this is not done for the other timeval macros which are > almost > all unsafe) > 2) FreeBSD moved their definitions from (where 4.4BSD-Lite > put them) to . This is not incorrect (since > is an old header that should only declare timeval interfaces (POSIX > put timespec interfaces in ). However, the move became out of > date before it was done (in 2001) because had already > grown several other timespec interfaces which were not moved. But these > were kernel-only, so they didn't cause namespace problems. Now > has grown several more user timespec interfaces. thanks for the explanation. :) > > Bruce From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 12:12:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 48CE61065673; Mon, 15 Aug 2011 12:12:59 +0000 (UTC) Date: Mon, 15 Aug 2011 12:12:59 +0000 From: Alexander Best Message-ID: <20110815121259.GA25324@freebsd.org> References: <201108082036.p78KarlR062810@svn.freebsd.org> <20110809105824.P896@besplex.bde.org> <20110810103831.GA60858@freebsd.org> <20110810230856.M2222@besplex.bde.org> <20110810154956.GA4034@freebsd.org> <20110815013423.E2968@besplex.bde.org> <20110815120901.GC21258@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110815120901.GC21258@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224721 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 12:12:59 -0000 On Mon Aug 15 11, Alexander Best wrote: > On Mon Aug 15 11, Bruce Evans wrote: > > On Wed, 10 Aug 2011, Alexander Best wrote: > > > > >On Wed Aug 10 11, Bruce Evans wrote: > > >>On Wed, 10 Aug 2011, Alexander Best wrote: > > >>>any reason {TIMEVAL,TIMESPEC}_TO_{TIMESPEC,TIMEVAL}()s code is being > > >>>executed > > >>>in a > > >>> > > >>>do { ... } while (0) > > >>> > > >>>conditional loop? > > >> > > >>Just the usual syntactical trick for making large macros that look > > >>like function calls almost usable like function calls. Without the > > >... > > >thanks a lot for the in depth information. :) any reason, back in the > > >days, it > > >was decided that the functionality of converting a timespec to a timeval > > >and > > >vice versa should be implemented as a macro and not a function? > > > > Macros avoid some namespace pollution problems, and all the old kernel > > timeval manipulation interfaces are either extern functions or macros, > > partly because inline functions didn't exist when these interfaces were > > designed. But the TIME* macros still have gratuitously different styles: > > 1) they are spelled in upper case (which is "correct" since they are unsafe > > macros, but this is not done for the other timeval macros which are > > almost > > all unsafe) > > 2) FreeBSD moved their definitions from (where 4.4BSD-Lite > > put them) to . This is not incorrect (since > > is an old header that should only declare timeval interfaces (POSIX > > put timespec interfaces in ). However, the move became out of > > date before it was done (in 2001) because had already > > grown several other timespec interfaces which were not moved. But these > > were kernel-only, so they didn't cause namespace problems. Now > > has grown several more user timespec interfaces. > > thanks for the explanation. :) sorry. this was supposed to go to bde@ alone and not the lists. > > > > > Bruce From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 13:33:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 019011065672; Mon, 15 Aug 2011 13:33:15 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E55BD8FC16; Mon, 15 Aug 2011 13:33:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FDXEgP012053; Mon, 15 Aug 2011 13:33:14 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FDXEUP012051; Mon, 15 Aug 2011 13:33:14 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201108151333.p7FDXEUP012051@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 15 Aug 2011 13:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224882 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 13:33:15 -0000 Author: nwhitehorn Date: Mon Aug 15 13:33:14 2011 New Revision: 224882 URL: http://svn.freebsd.org/changeset/base/224882 Log: Use a maximum of -O on PowerPC kernels instead of -O2 to prevent a rare bug that could cause intermittent memory corruption on PowerPC SMP systems using non-debug kernels. This is a temporary change until the real problem is fixed. Approved by: re (kib) Modified: head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Mon Aug 15 13:27:02 2011 (r224881) +++ head/sys/conf/kern.pre.mk Mon Aug 15 13:33:14 2011 (r224882) @@ -27,8 +27,12 @@ SIZE?= size _MINUS_O= -O CTFFLAGS+= -g .else +.if ${MACHINE_CPUARCH} == "powerpc" +_MINUS_O= -O # gcc miscompiles some code at -O2 +.else _MINUS_O= -O2 .endif +.endif .if ${MACHINE_CPUARCH} == "amd64" COPTFLAGS?=-O2 -frename-registers -pipe .else From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 13:33:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 988A7106566C; Mon, 15 Aug 2011 13:33:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 887368FC19; Mon, 15 Aug 2011 13:33:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FDXSWM012096; Mon, 15 Aug 2011 13:33:28 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FDXSqL012094; Mon, 15 Aug 2011 13:33:28 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201108151333.p7FDXSqL012094@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 15 Aug 2011 13:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224883 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 13:33:28 -0000 Author: glebius Date: Mon Aug 15 13:33:28 2011 New Revision: 224883 URL: http://svn.freebsd.org/changeset/base/224883 Log: Fix a couple of issues in last commit. Submitted by: maxim Approved by: re (kib) Modified: head/share/man/man4/carp.4 Modified: head/share/man/man4/carp.4 ============================================================================== --- head/share/man/man4/carp.4 Mon Aug 15 13:33:14 2011 (r224882) +++ head/share/man/man4/carp.4 Mon Aug 15 13:33:28 2011 (r224883) @@ -282,7 +282,7 @@ notify 0 { notify 0 { match "system" "IFNET"; - match "type" "LINK_UP"; + match "type" "LINK_DOWN"; match "subsystem" "carp*"; action "/root/carpcontrol.sh $type $subsystem"; }; @@ -291,6 +291,7 @@ notify 0 { .Xr inet 4 , .Xr pfsync 4 , .Xr rc.conf 5 , +.Xr devd.conf 5 , .Xr ifconfig 8 , .Xr sysctl 8 .Sh HISTORY From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 14:19:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE40910656B6; Mon, 15 Aug 2011 14:19:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB8F58FC1E; Mon, 15 Aug 2011 14:19:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FEJQAx013990; Mon, 15 Aug 2011 14:19:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FEJQeO013986; Mon, 15 Aug 2011 14:19:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108151419.p7FEJQeO013986@svn.freebsd.org> From: Alexander Motin Date: Mon, 15 Aug 2011 14:19:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224886 - in stable/8: lib/libusbhid usr.bin/usbhidaction usr.bin/usbhidctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 14:19:27 -0000 Author: mav Date: Mon Aug 15 14:19:26 2011 New Revision: 224886 URL: http://svn.freebsd.org/changeset/base/224886 Log: MFC r224511: - Fix usbhidctl and usbhidaction to handle HID devices with multiple report ids, such as multimedia keyboards. - Add collection type and report id to the `usbhidctl -r` output. They are important for proper device understanding and debugging. - Fix usbhidaction tool to properly handle items having report_count more then 1. Modified: stable/8/lib/libusbhid/parse.c stable/8/usr.bin/usbhidaction/usbhidaction.c stable/8/usr.bin/usbhidctl/usbhid.c Directory Properties: stable/8/lib/libusbhid/ (props changed) stable/8/usr.bin/usbhidaction/ (props changed) stable/8/usr.bin/usbhidctl/ (props changed) Modified: stable/8/lib/libusbhid/parse.c ============================================================================== --- stable/8/lib/libusbhid/parse.c Mon Aug 15 14:00:55 2011 (r224885) +++ stable/8/lib/libusbhid/parse.c Mon Aug 15 14:19:26 2011 (r224886) @@ -322,6 +322,8 @@ hid_get_item(hid_data_t s, hid_item_t *h * one and one item: */ c->report_count = 1; + c->usage_minimum = 0; + c->usage_maximum = 0; } else { s->ncount = 1; } @@ -512,13 +514,14 @@ hid_report_size(report_desc_t r, enum hi uint32_t temp; uint32_t hpos; uint32_t lpos; + int report_id = 0; hpos = 0; lpos = 0xFFFFFFFF; memset(&h, 0, sizeof h); for (d = hid_start_parse(r, 1 << k, id); hid_get_item(d, &h); ) { - if (h.report_ID == id && h.kind == k) { + if ((h.report_ID == id || id < 0) && h.kind == k) { /* compute minimum */ if (lpos > h.pos) lpos = h.pos; @@ -527,6 +530,8 @@ hid_report_size(report_desc_t r, enum hi /* compute maximum */ if (hpos < temp) hpos = temp; + if (h.report_ID != 0) + report_id = 1; } } hid_end_parse(d); @@ -537,11 +542,8 @@ hid_report_size(report_desc_t r, enum hi else temp = hpos - lpos; - if (id) - temp += 8; - /* return length in bytes rounded up */ - return ((temp + 7) / 8); + return ((temp + 7) / 8 + report_id); } int Modified: stable/8/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- stable/8/usr.bin/usbhidaction/usbhidaction.c Mon Aug 15 14:00:55 2011 (r224885) +++ stable/8/usr.bin/usbhidaction/usbhidaction.c Mon Aug 15 14:19:26 2011 (r224886) @@ -99,12 +99,12 @@ main(int argc, char **argv) char buf[100]; char devnamebuf[PATH_MAX]; struct command *cmd; - int reportid; + int reportid = -1; demon = 1; ignore = 0; dieearly = 0; - while ((ch = getopt(argc, argv, "c:def:ip:t:v")) != -1) { + while ((ch = getopt(argc, argv, "c:def:ip:r:t:v")) != -1) { switch(ch) { case 'c': conf = optarg; @@ -124,6 +124,9 @@ main(int argc, char **argv) case 'p': pidfile = optarg; break; + case 'r': + reportid = atoi(optarg); + break; case 't': table = optarg; break; @@ -153,14 +156,13 @@ main(int argc, char **argv) fd = open(dev, O_RDWR); if (fd < 0) err(1, "%s", dev); - reportid = hid_get_report_id(fd); repd = hid_get_report_desc(fd); if (repd == NULL) err(1, "hid_get_report_desc() failed"); commands = parse_conf(conf, repd, reportid, ignore); - sz = (size_t)hid_report_size(repd, hid_input, reportid); + sz = (size_t)hid_report_size(repd, hid_input, -1); if (verbose) printf("report size %zu\n", sz); @@ -204,7 +206,23 @@ main(int argc, char **argv) } #endif for (cmd = commands; cmd; cmd = cmd->next) { - val = hid_get_data(buf, &cmd->item); + if (cmd->item.report_ID != 0 && + buf[0] != cmd->item.report_ID) + continue; + if (cmd->item.flags & HIO_VARIABLE) + val = hid_get_data(buf, &cmd->item); + else { + uint32_t pos = cmd->item.pos; + for (i = 0; i < cmd->item.report_count; i++) { + val = hid_get_data(buf, &cmd->item); + if (val == cmd->value) + break; + cmd->item.pos += cmd->item.report_size; + } + cmd->item.pos = pos; + val = (i < cmd->item.report_count) ? + cmd->value : -1; + } if (cmd->value != val && cmd->anyvalue == 0) goto next; if ((cmd->debounce == 0) || Modified: stable/8/usr.bin/usbhidctl/usbhid.c ============================================================================== --- stable/8/usr.bin/usbhidctl/usbhid.c Mon Aug 15 14:00:55 2011 (r224885) +++ stable/8/usr.bin/usbhidctl/usbhid.c Mon Aug 15 14:19:26 2011 (r224886) @@ -53,7 +53,6 @@ int verbose = 0; int all = 0; int noname = 0; int hexdump = 0; -static int reportid; char **names; int nnames; @@ -108,11 +107,12 @@ dumpitem(const char *label, struct hid_i { if ((h->flags & HIO_CONST) && !verbose) return; - printf("%s size=%d count=%d page=%s usage=%s%s", label, - h->report_size, h->report_count, + printf("%s rid=%d size=%d count=%d page=%s usage=%s%s%s", label, + h->report_ID, h->report_size, h->report_count, hid_usage_page(HID_PAGE(h->usage)), hid_usage_in_page(h->usage), - h->flags & HIO_CONST ? " Const" : ""); + h->flags & HIO_CONST ? " Const" : "", + h->flags & HIO_VARIABLE ? "" : " Array"); printf(", logical range %d..%d", h->logical_minimum, h->logical_maximum); if (h->physical_minimum != h->physical_maximum) @@ -123,6 +123,24 @@ dumpitem(const char *label, struct hid_i printf("\n"); } +static const char * +hid_collection_type(int32_t type) +{ + static char num[8]; + + switch (type) { + case 0: return ("Physical"); + case 1: return ("Application"); + case 2: return ("Logical"); + case 3: return ("Report"); + case 4: return ("Named_Array"); + case 5: return ("Usage_Switch"); + case 6: return ("Usage_Modifier"); + } + snprintf(num, sizeof(num), "0x%02x", type); + return (num); +} + void dumpitems(report_desc_t r) { @@ -130,10 +148,11 @@ dumpitems(report_desc_t r) struct hid_item h; int size; - for (d = hid_start_parse(r, ~0, reportid); hid_get_item(d, &h); ) { + for (d = hid_start_parse(r, ~0, -1); hid_get_item(d, &h); ) { switch (h.kind) { case hid_collection: - printf("Collection page=%s usage=%s\n", + printf("Collection type=%s page=%s usage=%s\n", + hid_collection_type(h.collection), hid_usage_page(HID_PAGE(h.usage)), hid_usage_in_page(h.usage)); break; @@ -152,13 +171,13 @@ dumpitems(report_desc_t r) } } hid_end_parse(d); - size = hid_report_size(r, hid_input, 0); + size = hid_report_size(r, hid_input, -1); printf("Total input size %d bytes\n", size); - size = hid_report_size(r, hid_output, 0); + size = hid_report_size(r, hid_output, -1); printf("Total output size %d bytes\n", size); - size = hid_report_size(r, hid_feature, 0); + size = hid_report_size(r, hid_feature, -1); printf("Total feature size %d bytes\n", size); } @@ -187,14 +206,17 @@ prdata(u_char *buf, struct hid_item *h) pos = h->pos; for (i = 0; i < h->report_count; i++) { data = hid_get_data(buf, h); + if (i > 0) + printf(" "); if (h->logical_minimum < 0) printf("%d", (int)data); else printf("%u", data); if (hexdump) printf(" [0x%x]", data); - pos += h->report_size; + h->pos += h->report_size; } + h->pos = pos; } void @@ -209,7 +231,7 @@ dumpdata(int f, report_desc_t rd, int lo char namebuf[10000], *namep; hids = 0; - for (d = hid_start_parse(rd, 1<next) { + if (n->report_ID != 0 && dbuf[0] != n->report_ID) + continue; namep = namebuf; namep += sprintf(namep, "%s:%s.", hid_usage_page(HID_PAGE(n->collection)), @@ -249,7 +273,7 @@ dumpdata(int f, report_desc_t rd, int lo if (all || gotname(namebuf)) { if (!noname) printf("%s=", namebuf); - prdata(dbuf + (reportid != 0), n); + prdata(dbuf, n); printf("\n"); } } From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 17:08:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AC36106564A; Mon, 15 Aug 2011 17:08:55 +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 49ACC8FC13; Mon, 15 Aug 2011 17:08:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FH8tJB019185; Mon, 15 Aug 2011 17:08:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FH8ti4019182; Mon, 15 Aug 2011 17:08:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201108151708.p7FH8ti4019182@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 15 Aug 2011 17:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224891 - in stable/8/sys: dev/re pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 17:08:55 -0000 Author: yongari Date: Mon Aug 15 17:08:54 2011 New Revision: 224891 URL: http://svn.freebsd.org/changeset/base/224891 Log: MFC r224506: Add new device id of D-Link DGE-530T Rev. C controller. DGE-503T Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C controller is re-branded RealTek 8169 controller. PR: kern/159116 Modified: stable/8/sys/dev/re/if_re.c stable/8/sys/pci/if_rlreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/re/if_re.c ============================================================================== --- stable/8/sys/dev/re/if_re.c Mon Aug 15 16:06:28 2011 (r224890) +++ stable/8/sys/dev/re/if_re.c Mon Aug 15 17:08:54 2011 (r224891) @@ -174,6 +174,8 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe static struct rl_type re_devs[] = { { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, + { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, + "D-Link DGE-530(T) Gigabit Ethernet Adapter" }, { RT_VENDORID, RT_DEVICEID_8139, 0, "RealTek 8139C+ 10/100BaseTX" }, { RT_VENDORID, RT_DEVICEID_8101E, 0, Modified: stable/8/sys/pci/if_rlreg.h ============================================================================== --- stable/8/sys/pci/if_rlreg.h Mon Aug 15 16:06:28 2011 (r224890) +++ stable/8/sys/pci/if_rlreg.h Mon Aug 15 17:08:54 2011 (r224891) @@ -1042,6 +1042,7 @@ struct rl_softc { * D-Link DFE-5280T device ID */ #define DLINK_DEVICEID_528T 0x4300 +#define DLINK_DEVICEID_530T_REVC 0x4302 /* * D-Link DFE-690TXD device ID From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 17:10:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0B38106564A; Mon, 15 Aug 2011 17:10:23 +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 BFC858FC1D; Mon, 15 Aug 2011 17:10:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FHANCu019272; Mon, 15 Aug 2011 17:10:23 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FHANnA019269; Mon, 15 Aug 2011 17:10:23 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201108151710.p7FHANnA019269@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 15 Aug 2011 17:10:23 +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: r224892 - in stable/7/sys: dev/re pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 17:10:23 -0000 Author: yongari Date: Mon Aug 15 17:10:23 2011 New Revision: 224892 URL: http://svn.freebsd.org/changeset/base/224892 Log: MFC r224506: Add new device id of D-Link DGE-530T Rev. C controller. DGE-503T Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C controller is re-branded RealTek 8169 controller. PR: kern/159116 Modified: stable/7/sys/dev/re/if_re.c stable/7/sys/pci/if_rlreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Mon Aug 15 17:08:54 2011 (r224891) +++ stable/7/sys/dev/re/if_re.c Mon Aug 15 17:10:23 2011 (r224892) @@ -174,6 +174,8 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe static struct rl_type re_devs[] = { { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, + { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, + "D-Link DGE-530(T) Gigabit Ethernet Adapter" }, { RT_VENDORID, RT_DEVICEID_8139, 0, "RealTek 8139C+ 10/100BaseTX" }, { RT_VENDORID, RT_DEVICEID_8101E, 0, Modified: stable/7/sys/pci/if_rlreg.h ============================================================================== --- stable/7/sys/pci/if_rlreg.h Mon Aug 15 17:08:54 2011 (r224891) +++ stable/7/sys/pci/if_rlreg.h Mon Aug 15 17:10:23 2011 (r224892) @@ -1042,6 +1042,7 @@ struct rl_softc { * D-Link DFE-5280T device ID */ #define DLINK_DEVICEID_528T 0x4300 +#define DLINK_DEVICEID_530T_REVC 0x4302 /* * D-Link DFE-690TXD device ID From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 19:29:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E39431065673; Mon, 15 Aug 2011 19:29:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3F1E8FC14; Mon, 15 Aug 2011 19:29:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FJTPXB024341; Mon, 15 Aug 2011 19:29:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FJTPda024339; Mon, 15 Aug 2011 19:29:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201108151929.p7FJTPda024339@svn.freebsd.org> From: John Baldwin Date: Mon, 15 Aug 2011 19:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224898 - head/sys/dev/puc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 19:29:26 -0000 Author: jhb Date: Mon Aug 15 19:29:25 2011 New Revision: 224898 URL: http://svn.freebsd.org/changeset/base/224898 Log: Add device id for the Moxa CP-112UL dual-port serial adapters. Submitted by: Jan Mikkelsen janm of transactionware com Approved by: re (kib) MFC after: 1 week Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Mon Aug 15 18:49:42 2011 (r224897) +++ head/sys/dev/puc/pucdata.c Mon Aug 15 19:29:25 2011 (r224898) @@ -524,6 +524,12 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_4S, 0x18, 0, 8, }, + { 0x1393, 0x1120, 0xffff, 0, + "Moxa Technologies, CP-112UL", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x18, 0, 8, + }, + { 0x1393, 0x1141, 0xffff, 0, "Moxa Technologies, Industio CP-114", DEFAULT_RCLK * 8, From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 21:26:46 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49BE4106567A; Mon, 15 Aug 2011 21:26:46 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 12A808FC22; Mon, 15 Aug 2011 21:26:45 +0000 (UTC) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.5/8.14.5) with ESMTP id p7FKpo4Z008063; Mon, 15 Aug 2011 13:51:51 -0700 (PDT) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.5/8.14.4/Submit) id p7FKpofc008062; Mon, 15 Aug 2011 13:51:50 -0700 (PDT) (envelope-from obrien) Date: Mon, 15 Aug 2011 13:51:50 -0700 From: "David O'Brien" To: Alexander Motin Message-ID: <20110815205150.GA8002@dragon.NUXI.org> References: <201104261701.p3QH1ngd030888@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201104261701.p3QH1ngd030888@svn.freebsd.org> X-Operating-System: FreeBSD 9.0-CURRENT X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r221071 - in head: . sys/amd64/conf sys/arm/conf sys/cam sys/cam/ata sys/conf sys/geom sys/i386/conf sys/mips/conf sys/modules/cam sys/pc98/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 21:26:46 -0000 On Tue, Apr 26, 2011 at 05:01:49PM +0000, Alexander Motin wrote: > Log: > - Add shim to simplify migration to the CAM-based ATA. For each new adaX > device in /dev/ create symbolic link with adY name, trying to mimic old ATA > numbering. Imitation is not complete, but should be enough in most cases to > mount file systems without touching /etc/fstab. > - To know what behavior to mimic, restore ATA_STATIC_ID option in cases > where it was present before. > - Add some more details to UPDATING. [picking a random ata(4) CAM commit] Alexander, What are your plans on updating the ata.4 man page for 9.0-RELEASE? It still speaks of the old world order and doesn't provide help for folks trying to convert over. thanks, -- -- David (obrien@FreeBSD.org) From owner-svn-src-all@FreeBSD.ORG Mon Aug 15 23:00:23 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89EB91065670; Mon, 15 Aug 2011 23:00:23 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from fallbackmx09.syd.optusnet.com.au (fallbackmx09.syd.optusnet.com.au [211.29.132.242]) by mx1.freebsd.org (Postfix) with ESMTP id 0582B8FC15; Mon, 15 Aug 2011 23:00:22 +0000 (UTC) Received: from mail11.syd.optusnet.com.au (mail11.syd.optusnet.com.au [211.29.132.192]) by fallbackmx09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p7FKnflB004715; Tue, 16 Aug 2011 06:49:41 +1000 Received: from server.vk2pj.dyndns.org (c220-239-116-103.belrs4.nsw.optusnet.com.au [220.239.116.103]) by mail11.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p7FKnbh6017127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Aug 2011 06:49:38 +1000 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.4/8.14.4) with ESMTP id p7FKnba9059195; Tue, 16 Aug 2011 06:49:37 +1000 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.4/8.14.4/Submit) id p7FKnaMb059194; Tue, 16 Aug 2011 06:49:36 +1000 (EST) (envelope-from peter) Date: Tue, 16 Aug 2011 06:49:36 +1000 From: Peter Jeremy To: Robert Watson Message-ID: <20110815204936.GA59127@server.vk2pj.dyndns.org> References: <201108150730.p7F7Ummb098659@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uAKRQypu60I7Lcqm" Content-Disposition: inline In-Reply-To: <201108150730.p7F7Ummb098659@svn.freebsd.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224875 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 23:00:23 -0000 --uAKRQypu60I7Lcqm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2011-Aug-15 07:30:48 +0000, Robert Watson wrote: >Log: > Bump __FreeBSD_version to reflect the availability of capabilities, but > also capability-related changes to fget(9). This is likely not part of > a formal KPI, but the nvidia driver (at least) uses it. Maybe I missed it somewhere but I don't see the version bump anywhere. SVN reports this commit only affects UPDATING. --=20 Peter Jeremy --uAKRQypu60I7Lcqm Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk5JhmAACgkQ/opHv/APuIe5kQCghzw1i+VxsO47peZPJmI0QI6R 4HAAnih/Kv48T0ZJ89wqRWdXbbUTQtJN =EVHs -----END PGP SIGNATURE----- --uAKRQypu60I7Lcqm-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 07:54:07 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2429106564A; Tue, 16 Aug 2011 07:54:07 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8AFE48FC0A; Tue, 16 Aug 2011 07:54:07 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 276A746B3B; Tue, 16 Aug 2011 03:54:07 -0400 (EDT) Date: Tue, 16 Aug 2011 08:54:07 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Peter Jeremy In-Reply-To: <20110815204936.GA59127@server.vk2pj.dyndns.org> Message-ID: References: <201108150730.p7F7Ummb098659@svn.freebsd.org> <20110815204936.GA59127@server.vk2pj.dyndns.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224875 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 07:54:07 -0000 On Tue, 16 Aug 2011, Peter Jeremy wrote: > On 2011-Aug-15 07:30:48 +0000, Robert Watson wrote: >> Log: >> Bump __FreeBSD_version to reflect the availability of capabilities, but >> also capability-related changes to fget(9). This is likely not part of >> a formal KPI, but the nvidia driver (at least) uses it. > > Maybe I missed it somewhere but I don't see the version bump anywhere. > SVN reports this commit only affects UPDATING. The actual bump was here: r224834 | rwatson | 2011-08-13 14:11:28 +0100 (Sat, 13 Aug 2011) | 6 lines Bump __FreeBSD_version to reflect the availability of capabilities, but also capability-related changes to fget(9). This is likely not part of a formal KPI, but the nvidia driver (at least) uses it. Approved by: re (bz, kib) The above commit message should possibly have read "*Document* bump of...". Robert From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 08:34:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AEBE106566B; Tue, 16 Aug 2011 08:34:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31ABD8FC0A; Tue, 16 Aug 2011 08:34:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7G8YHP9048519; Tue, 16 Aug 2011 08:34:17 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7G8YHiT048516; Tue, 16 Aug 2011 08:34:17 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108160834.p7G8YHiT048516@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 16 Aug 2011 08:34:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224903 - head/lib/libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 08:34:17 -0000 Author: hselasky Date: Tue Aug 16 08:34:16 2011 New Revision: 224903 URL: http://svn.freebsd.org/changeset/base/224903 Log: Add missing function to get device speed to the LibUSB v1.0 API. MFC after: 1 week Approved by: re (kib) Modified: head/lib/libusb/libusb.h head/lib/libusb/libusb10.c Modified: head/lib/libusb/libusb.h ============================================================================== --- head/lib/libusb/libusb.h Tue Aug 16 06:26:51 2011 (r224902) +++ head/lib/libusb/libusb.h Tue Aug 16 08:34:16 2011 (r224903) @@ -151,6 +151,14 @@ enum libusb_error { LIBUSB_ERROR_OTHER = -99, }; +enum libusb_speed { + LIBUSB_SPEED_UNKNOWN = 0, + LIBUSB_SPEED_LOW = 1, + LIBUSB_SPEED_FULL = 2, + LIBUSB_SPEED_HIGH = 3, + LIBUSB_SPEED_SUPER = 4, +}; + enum libusb_transfer_status { LIBUSB_TRANSFER_COMPLETED, LIBUSB_TRANSFER_ERROR, @@ -304,6 +312,7 @@ ssize_t libusb_get_device_list(libusb_co void libusb_free_device_list(libusb_device ** list, int unref_devices); uint8_t libusb_get_bus_number(libusb_device * dev); uint8_t libusb_get_device_address(libusb_device * dev); +enum libusb_speed libusb_get_device_speed(libusb_device * dev); int libusb_clear_halt(libusb_device_handle *devh, uint8_t endpoint); int libusb_get_max_packet_size(libusb_device * dev, uint8_t endpoint); libusb_device *libusb_ref_device(libusb_device * dev); Modified: head/lib/libusb/libusb10.c ============================================================================== --- head/lib/libusb/libusb10.c Tue Aug 16 06:26:51 2011 (r224902) +++ head/lib/libusb/libusb10.c Tue Aug 16 08:34:16 2011 (r224903) @@ -272,6 +272,27 @@ libusb_get_device_address(libusb_device return (libusb20_dev_get_address(dev->os_priv)); } +enum libusb_speed +libusb_get_device_speed(libusb_device *dev) +{ + if (dev == NULL) + return (0); /* should not happen */ + + switch (libusb20_dev_get_speed(dev->os_priv)) { + case LIBUSB20_SPEED_LOW: + return (LIBUSB_SPEED_LOW); + case LIBUSB20_SPEED_FULL: + return (LIBUSB_SPEED_FULL); + case LIBUSB20_SPEED_HIGH: + return (LIBUSB_SPEED_HIGH); + case LIBUSB20_SPEED_SUPER: + return (LIBUSB_SPEED_SUPER); + default: + break; + } + return (LIBUSB_SPEED_UNKNOWN); +} + int libusb_get_max_packet_size(libusb_device *dev, uint8_t endpoint) { From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 08:41:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 221D9106564A; Tue, 16 Aug 2011 08:41:10 +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 119EE8FC0C; Tue, 16 Aug 2011 08:41:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7G8f9WQ048744; Tue, 16 Aug 2011 08:41:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7G8f9FZ048742; Tue, 16 Aug 2011 08:41:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108160841.p7G8f9FZ048742@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 16 Aug 2011 08:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224904 - stable/8/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 08:41:10 -0000 Author: kib Date: Tue Aug 16 08:41:09 2011 New Revision: 224904 URL: http://svn.freebsd.org/changeset/base/224904 Log: MFC r224743: Do not update mountpoint generation counter to the value which was not yet acted upon by devfs_populate(). Modified: stable/8/sys/fs/devfs/devfs_devs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_devs.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_devs.c Tue Aug 16 08:34:16 2011 (r224903) +++ stable/8/sys/fs/devfs/devfs_devs.c Tue Aug 16 08:41:09 2011 (r224904) @@ -505,13 +505,15 @@ devfs_populate_loop(struct devfs_mount * void devfs_populate(struct devfs_mount *dm) { + unsigned gen; sx_assert(&dm->dm_lock, SX_XLOCKED); - if (dm->dm_generation == devfs_generation) + gen = devfs_generation; + if (dm->dm_generation == gen) return; while (devfs_populate_loop(dm, 0)) continue; - dm->dm_generation = devfs_generation; + dm->dm_generation = gen; } /* From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 08:41:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AF09106567B; Tue, 16 Aug 2011 08:41:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01EA28FC18; Tue, 16 Aug 2011 08:41:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7G8fb9P048792; Tue, 16 Aug 2011 08:41:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7G8fbrR048790; Tue, 16 Aug 2011 08:41:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201108160841.p7G8fbrR048790@svn.freebsd.org> From: Xin LI Date: Tue, 16 Aug 2011 08:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224905 - head/sys/dev/arcmsr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 08:41:38 -0000 Author: delphij Date: Tue Aug 16 08:41:37 2011 New Revision: 224905 URL: http://svn.freebsd.org/changeset/base/224905 Log: Update arcmsr(4) to 1.20.00.22 to solve recursive acquisition of buffer mutex, which would lead to a deadlock. Many thanks to Areca for their continued support of FreeBSD. Submitted by: Ching Huang Tested by: Willem Jan Withagen MFC after: 3 days Approved by: re (kib) Modified: head/sys/dev/arcmsr/arcmsr.c Modified: head/sys/dev/arcmsr/arcmsr.c ============================================================================== --- head/sys/dev/arcmsr/arcmsr.c Tue Aug 16 08:41:09 2011 (r224904) +++ head/sys/dev/arcmsr/arcmsr.c Tue Aug 16 08:41:37 2011 (r224905) @@ -68,6 +68,7 @@ ** 1.20.00.21 02/08/2011 Ching Huang Implement I/O request timeout ** 02/14/2011 Ching Huang Modified pktRequestCount ** 1.20.00.21 03/03/2011 Ching Huang if a command timeout, then wait its ccb back before free it +** 1.20.00.22 07/04/2011 Ching Huang Fixed multiple MTX panic ****************************************************************************************** * $FreeBSD$ */ @@ -150,7 +151,7 @@ #define arcmsr_callout_init(a) callout_init(a); #endif -#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.21 2010-03-03" +#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.22 2011-07-04" #include #define SRB_SIZE ((sizeof(struct CommandControlBlock)+0x1f) & 0xffe0) #define ARCMSR_SRBS_POOL_SIZE (SRB_SIZE * ARCMSR_MAX_FREESRB_NUM) @@ -1293,11 +1294,15 @@ static void arcmsr_stop_adapter_bgrb(str static void arcmsr_poll(struct cam_sim * psim) { struct AdapterControlBlock *acb; + int mutex; acb = (struct AdapterControlBlock *)cam_sim_softc(psim); - ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); + mutex = mtx_owned(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); arcmsr_interrupt(acb); - ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); return; } /* @@ -2089,8 +2094,11 @@ struct CommandControlBlock * arcmsr_get_ { struct CommandControlBlock *srb=NULL; u_int32_t workingsrb_startindex, workingsrb_doneindex; + int mutex; - ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); + mutex = mtx_owned(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); workingsrb_doneindex=acb->workingsrb_doneindex; workingsrb_startindex=acb->workingsrb_startindex; srb=acb->srbworkingQ[workingsrb_startindex]; @@ -2101,7 +2109,8 @@ struct CommandControlBlock * arcmsr_get_ } else { srb=NULL; } - ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); return(srb); } /* From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 09:06:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3947106566B; Tue, 16 Aug 2011 09:06:44 +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 C33B18FC08; Tue, 16 Aug 2011 09:06:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7G96i80049610; Tue, 16 Aug 2011 09:06:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7G96iqn049608; Tue, 16 Aug 2011 09:06:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108160906.p7G96iqn049608@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 16 Aug 2011 09:06:44 +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: r224906 - stable/7/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 09:06:44 -0000 Author: kib Date: Tue Aug 16 09:06:44 2011 New Revision: 224906 URL: http://svn.freebsd.org/changeset/base/224906 Log: MFC r224743: Do not update mountpoint generation counter to the value which was not yet acted upon by devfs_populate(). Modified: stable/7/sys/fs/devfs/devfs_devs.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/fs/devfs/devfs_devs.c ============================================================================== --- stable/7/sys/fs/devfs/devfs_devs.c Tue Aug 16 08:41:37 2011 (r224905) +++ stable/7/sys/fs/devfs/devfs_devs.c Tue Aug 16 09:06:44 2011 (r224906) @@ -481,13 +481,15 @@ devfs_populate_loop(struct devfs_mount * void devfs_populate(struct devfs_mount *dm) { + unsigned gen; sx_assert(&dm->dm_lock, SX_XLOCKED); - if (dm->dm_generation == devfs_generation) + gen = devfs_generation; + if (dm->dm_generation == gen) return; while (devfs_populate_loop(dm, 0)) continue; - dm->dm_generation = devfs_generation; + dm->dm_generation = gen; } /* From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 09:07:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3AE5106566C; Tue, 16 Aug 2011 09:07:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B41C08FC0C; Tue, 16 Aug 2011 09:07:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7G97xWd049698; Tue, 16 Aug 2011 09:07:59 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7G97xs7049696; Tue, 16 Aug 2011 09:07:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108160907.p7G97xs7049696@svn.freebsd.org> From: Adrian Chadd Date: Tue, 16 Aug 2011 09:07:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224907 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 09:07:59 -0000 Author: adrian Date: Tue Aug 16 09:07:59 2011 New Revision: 224907 URL: http://svn.freebsd.org/changeset/base/224907 Log: Fix BAR frame TX completion - successful transmission is indicated by a status of 0. Approved by: re (kib) Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Tue Aug 16 09:06:44 2011 (r224906) +++ head/sys/net80211/ieee80211_ht.c Tue Aug 16 09:07:59 2011 (r224907) @@ -2207,7 +2207,7 @@ bar_tx_complete(struct ieee80211_node *n callout_pending(&tap->txa_timer)) { struct ieee80211com *ic = ni->ni_ic; - if (status) /* ACK'd */ + if (status == 0) /* ACK'd */ bar_stop_timer(tap); ic->ic_bar_response(ni, tap, status); /* NB: just let timer expire so we pace requests */ @@ -2219,7 +2219,7 @@ ieee80211_bar_response(struct ieee80211_ struct ieee80211_tx_ampdu *tap, int status) { - if (status != 0) { /* got ACK */ + if (status == 0) { /* got ACK */ IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni, "BAR moves BA win <%u:%u> (%u frames) txseq %u tid %u", tap->txa_start, From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 10:52:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACBD3106566B; Tue, 16 Aug 2011 10:52:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C3328FC14; Tue, 16 Aug 2011 10:52:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GAqTfk054837; Tue, 16 Aug 2011 10:52:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GAqTvK054835; Tue, 16 Aug 2011 10:52:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108161052.p7GAqTvK054835@svn.freebsd.org> From: Alexander Motin Date: Tue, 16 Aug 2011 10:52:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224908 - stable/8/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 10:52:29 -0000 Author: mav Date: Tue Aug 16 10:52:29 2011 New Revision: 224908 URL: http://svn.freebsd.org/changeset/base/224908 Log: MFC r224728: Do not block zero report ID. It is correct value for devices with single ID. This fixes USB_SET_IMMED call (synchronous operation) of the uhid(4) driver on devices with single report ID. Modified: stable/8/sys/dev/usb/usb_request.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/usb_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_request.c Tue Aug 16 09:07:59 2011 (r224907) +++ stable/8/sys/dev/usb/usb_request.c Tue Aug 16 10:52:29 2011 (r224908) @@ -1769,7 +1769,7 @@ usbd_req_get_report(struct usb_device *u struct usb_interface *iface = usbd_get_iface(udev, iface_index); struct usb_device_request req; - if ((iface == NULL) || (iface->idesc == NULL) || (id == 0)) { + if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); } DPRINTFN(5, "len=%d\n", len); From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 12:45:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 405CD106566B; Tue, 16 Aug 2011 12:45:02 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by mx1.freebsd.org (Postfix) with ESMTP id DEF518FC16; Tue, 16 Aug 2011 12:45:01 +0000 (UTC) Received: from jh (a91-153-115-208.elisa-laajakaista.fi [91.153.115.208]) by gw01.mail.saunalahti.fi (Postfix) with SMTP id 9945615191A; Tue, 16 Aug 2011 15:29:30 +0300 (EEST) Date: Tue, 16 Aug 2011 15:29:30 +0300 From: Jaakko Heinonen To: Robert Watson Message-ID: <20110816122930.GA44017@jh> References: <201108111230.p7BCUNnS092831@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201108111230.p7BCUNnS092831@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, jonathan@FreeBSD.org Subject: Re: svn commit: r224778 - in head: sys/amd64/linux32 sys/cddl/compat/opensolaris/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/dev/aac sys/dev/amr sys/dev/hwpmc sys/dev/ipmi sys/dev/isc... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 12:45:02 -0000 Hi, On 2011-08-11, Robert Watson wrote: > Second-to-last commit implementing Capsicum capabilities in the FreeBSD > kernel for FreeBSD 9.0: This commit seems to have broken nfsd for me. > Modified: head/sys/fs/nfsserver/nfs_nfsdport.c > ============================================================================== > --- head/sys/fs/nfsserver/nfs_nfsdport.c Thu Aug 11 11:30:21 2011 (r224777) > +++ head/sys/fs/nfsserver/nfs_nfsdport.c Thu Aug 11 12:30:23 2011 (r224778) > @@ -3027,8 +3029,14 @@ nfssvc_nfsd(struct thread *td, struct nf > error = copyin(uap->argp, (caddr_t)&sockarg, sizeof (sockarg)); > if (error) > goto out; > - if ((error = fget(td, sockarg.sock, &fp)) != 0) > + /* > + * Since we don't know what rights might be required, > + * pretend that we need them all. It is better to be too > + * careful than too reckless. > + */ > + if ((error = fget(td, sockarg.sock, CAP_SOCK_ALL, &fp)) != 0) > goto out; > + return (error); This for sure can't be correct. With the patch below nfsd seems to work again for me. %%% Index: sys/fs/nfsserver/nfs_nfsdport.c =================================================================== --- sys/fs/nfsserver/nfs_nfsdport.c (revision 224908) +++ sys/fs/nfsserver/nfs_nfsdport.c (working copy) @@ -3036,7 +3036,6 @@ nfssvc_nfsd(struct thread *td, struct nf */ if ((error = fget(td, sockarg.sock, CAP_SOCK_ALL, &fp)) != 0) goto out; - return (error); if (fp->f_type != DTYPE_SOCKET) { fdrop(fp, td); error = EPERM; %%% -- Jaakko From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 14:14:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FFFD106566B; Tue, 16 Aug 2011 14:14:57 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7EA8FC14; Tue, 16 Aug 2011 14:14:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GEEv9x060954; Tue, 16 Aug 2011 14:14:57 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GEEvXx060951; Tue, 16 Aug 2011 14:14:57 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108161414.p7GEEvXx060951@svn.freebsd.org> From: Jonathan Anderson Date: Tue, 16 Aug 2011 14:14:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224910 - in head: sys/kern tools/regression/security/cap_test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 14:14:57 -0000 Author: jonathan Date: Tue Aug 16 14:14:56 2011 New Revision: 224910 URL: http://svn.freebsd.org/changeset/base/224910 Log: poll(2) implementation for capabilities. When calling poll(2) on a capability, unwrap first and then poll the underlying object. Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Modified: head/sys/kern/sys_generic.c head/tools/regression/security/cap_test/cap_test_capabilities.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Tue Aug 16 13:34:34 2011 (r224909) +++ head/sys/kern/sys_generic.c Tue Aug 16 14:14:56 2011 (r224910) @@ -1279,11 +1279,17 @@ pollrescan(struct thread *td) if (si != NULL) continue; fp = fdp->fd_ofiles[fd->fd]; +#ifdef CAPABILITIES + if ((fp == NULL) + || (cap_funwrap(fp, CAP_POLL_EVENT, &fp) != 0)) { +#else if (fp == NULL) { +#endif fd->revents = POLLNVAL; n++; continue; } + /* * Note: backend also returns POLLHUP and * POLLERR if appropriate. @@ -1344,7 +1350,12 @@ pollscan(td, fds, nfd) fds->revents = 0; } else { fp = fdp->fd_ofiles[fds->fd]; +#ifdef CAPABILITIES + if ((fp == NULL) + || (cap_funwrap(fp, CAP_POLL_EVENT, &fp) != 0)) { +#else if (fp == NULL) { +#endif fds->revents = POLLNVAL; n++; } else { Modified: head/tools/regression/security/cap_test/cap_test_capabilities.c ============================================================================== --- head/tools/regression/security/cap_test/cap_test_capabilities.c Tue Aug 16 13:34:34 2011 (r224909) +++ head/tools/regression/security/cap_test/cap_test_capabilities.c Tue Aug 16 14:14:56 2011 (r224910) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -68,6 +69,7 @@ __FBSDID("$FreeBSD$"); else if (errno != ENOTCAPABLE) \ SYSCALL_FAIL(syscall, "errno != ENOTCAPABLE"); \ } \ + errno = 0; \ } while (0) /* @@ -87,6 +89,7 @@ __FBSDID("$FreeBSD$"); } else if (errno != ENOTCAPABLE) \ SYSCALL_FAIL(syscall, "errno != ENOTCAPABLE"); \ } \ + errno = 0; \ } while (0) /* @@ -104,6 +107,7 @@ try_file_ops(int fd, cap_rights_t rights void *p; char ch; int ret, is_nfs; + struct pollfd pollfd; int success = PASSED; REQUIRE(fstatfs(fd, &sf)); @@ -114,6 +118,10 @@ try_file_ops(int fd, cap_rights_t rights REQUIRE(fd_capcap = cap_new(fd_cap, rights)); CHECK(fd_capcap != fd_cap); + pollfd.fd = fd_cap; + pollfd.events = POLLIN | POLLERR | POLLHUP; + pollfd.revents = 0; + ssize = read(fd_cap, &ch, sizeof(ch)); CHECK_RESULT(read, CAP_READ | CAP_SEEK, ssize >= 0); @@ -189,7 +197,13 @@ try_file_ops(int fd, cap_rights_t rights ret = futimes(fd_cap, NULL); CHECK_RESULT(futimes, CAP_FUTIMES, ret == 0); - /* XXX select / poll / kqueue */ + ret = poll(&pollfd, 1, 0); + if (rights & CAP_POLL_EVENT) + CHECK((pollfd.revents & POLLNVAL) == 0); + else + CHECK((pollfd.revents & POLLNVAL) != 0); + + /* XXX: select, kqueue */ close (fd_cap); return (success); @@ -210,7 +224,7 @@ test_capabilities(void) int fd; int success = PASSED; - fd = open("/tmp/cap_test", O_RDWR | O_CREAT, 0644); + fd = open("/tmp/cap_test_capabilities", O_RDWR | O_CREAT, 0644); if (fd < 0) err(-1, "open"); From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 14:22:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13158106566C; Tue, 16 Aug 2011 14:22:33 +0000 (UTC) (envelope-from jonathan.robert.anderson@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 92C848FC13; Tue, 16 Aug 2011 14:22:32 +0000 (UTC) Received: by qyk9 with SMTP id 9so3960450qyk.13 for ; Tue, 16 Aug 2011 07:22:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=g2+FD2qZT/pedCu00J+/FmgC5rTlq0OJAenMfgwS1q0=; b=mldcH4+f91npCxC5tlk0HV7GpTHmnuL3xlKMnbIxl6DbLghdxYId2AXwzWZ3Y1Z3ZA SQnh/I77lf37OQAVL05gjtWk8mTLpPYeYeDNwDv+vjTavvPgoRXjmxbH+LAgTM22cuji 16FlQ0fD/zUdrW6gPzba/wM84RTxSubtvH6Hs= MIME-Version: 1.0 Received: by 10.224.194.197 with SMTP id dz5mr3542246qab.287.1313503044172; Tue, 16 Aug 2011 06:57:24 -0700 (PDT) Sender: jonathan.robert.anderson@gmail.com Received: by 10.229.85.16 with HTTP; Tue, 16 Aug 2011 06:57:24 -0700 (PDT) In-Reply-To: <20110816122930.GA44017@jh> References: <201108111230.p7BCUNnS092831@svn.freebsd.org> <20110816122930.GA44017@jh> Date: Tue, 16 Aug 2011 14:57:24 +0100 X-Google-Sender-Auth: CCwwTK1IXrtm5QfAbU9efr2HgXI Message-ID: From: Jonathan Anderson To: Jaakko Heinonen Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson Subject: Re: svn commit: r224778 - in head: sys/amd64/linux32 sys/cddl/compat/opensolaris/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/dev/aac sys/dev/amr sys/dev/hwpmc sys/dev/ipmi sys/dev/isc... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 14:22:33 -0000 SXQgbG9va3MgbGlrZSByMjI0MDg2IGFkZGVkICJnb3RvIG91dCIgZXJyb3IgaGFuZGxpbmcsIHNv IG91ciAicmV0dXJuCihlcnJvcikiIHNlZW1zIHRvIGJlIGEgbWVyZ2UgY29uZmxpY3QuCgpTb3Jy eSwgSSdsbCBhc2sgUkUgaWYgSSBjYW4gZml4IHRoYXQgcmlnaHQgbm93LgoKCkpvbgoKT24gMTYg QXVndXN0IDIwMTEgMTM6MjksIEphYWtrbyBIZWlub25lbiA8amhAZnJlZWJzZC5vcmc+IHdyb3Rl Ogo+Cj4gSGksCj4KPiBPbiAyMDExLTA4LTExLCBSb2JlcnQgV2F0c29uIHdyb3RlOgo+PiDCoCBT ZWNvbmQtdG8tbGFzdCBjb21taXQgaW1wbGVtZW50aW5nIENhcHNpY3VtIGNhcGFiaWxpdGllcyBp biB0aGUgRnJlZUJTRAo+PiDCoCBrZXJuZWwgZm9yIEZyZWVCU0QgOS4wOgo+Cj4gVGhpcyBjb21t aXQgc2VlbXMgdG8gaGF2ZSBicm9rZW4gbmZzZCBmb3IgbWUuCj4KPj4gTW9kaWZpZWQ6IGhlYWQv c3lzL2ZzL25mc3NlcnZlci9uZnNfbmZzZHBvcnQuYwo+PiA9PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0K Pj4gLS0tIGhlYWQvc3lzL2ZzL25mc3NlcnZlci9uZnNfbmZzZHBvcnQuYyDCoCDCoCDCoFRodSBB dWcgMTEgMTE6MzA6MjEgMjAxMSDCoCDCoCDCoCDCoChyMjI0Nzc3KQo+PiArKysgaGVhZC9zeXMv ZnMvbmZzc2VydmVyL25mc19uZnNkcG9ydC5jIMKgIMKgIMKgVGh1IEF1ZyAxMSAxMjozMDoyMyAy MDExIMKgIMKgIMKgIMKgKHIyMjQ3NzgpCj4+IEBAIC0zMDI3LDggKzMwMjksMTQgQEAgbmZzc3Zj X25mc2Qoc3RydWN0IHRocmVhZCAqdGQsIHN0cnVjdCBuZgo+PiDCoCDCoCDCoCDCoCDCoCDCoCDC oCBlcnJvciA9IGNvcHlpbih1YXAtPmFyZ3AsIChjYWRkcl90KSZzb2NrYXJnLCBzaXplb2YgKHNv Y2thcmcpKTsKPj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKGVycm9yKQo+PiDCoCDCoCDCoCDC oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBnb3RvIG91dDsKPj4gLSDCoCDCoCDCoCDCoCDCoCDCoCBp ZiAoKGVycm9yID0gZmdldCh0ZCwgc29ja2FyZy5zb2NrLCAmZnApKSAhPSAwKQo+PiArIMKgIMKg IMKgIMKgIMKgIMKgIC8qCj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAqIFNpbmNlIHdlIGRvbid0 IGtub3cgd2hhdCByaWdodHMgbWlnaHQgYmUgcmVxdWlyZWQsCj4+ICsgwqAgwqAgwqAgwqAgwqAg wqAgwqAqIHByZXRlbmQgdGhhdCB3ZSBuZWVkIHRoZW0gYWxsLiBJdCBpcyBiZXR0ZXIgdG8gYmUg dG9vCj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAqIGNhcmVmdWwgdGhhbiB0b28gcmVja2xlc3Mu Cj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAqLwo+PiArIMKgIMKgIMKgIMKgIMKgIMKgIGlmICgo ZXJyb3IgPSBmZ2V0KHRkLCBzb2NrYXJnLnNvY2ssIENBUF9TT0NLX0FMTCwgJmZwKSkgIT0gMCkK Pj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgZ290byBvdXQ7Cj4+ICsgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgcmV0dXJuIChlcnJvcik7Cj4KPiBUaGlzIGZvciBzdXJl IGNhbid0IGJlIGNvcnJlY3QuIFdpdGggdGhlIHBhdGNoIGJlbG93IG5mc2Qgc2VlbXMgdG8gd29y awo+IGFnYWluIGZvciBtZS4KPgo+ICUlJQo+IEluZGV4OiBzeXMvZnMvbmZzc2VydmVyL25mc19u ZnNkcG9ydC5jCj4gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PQo+IC0tLSBzeXMvZnMvbmZzc2VydmVyL25mc19uZnNkcG9y dC5jIMKgIMKgIChyZXZpc2lvbiAyMjQ5MDgpCj4gKysrIHN5cy9mcy9uZnNzZXJ2ZXIvbmZzX25m c2Rwb3J0LmMgwqAgwqAgKHdvcmtpbmcgY29weSkKPiBAQCAtMzAzNiw3ICszMDM2LDYgQEAgbmZz c3ZjX25mc2Qoc3RydWN0IHRocmVhZCAqdGQsIHN0cnVjdCBuZgo+IMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgICovCj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBpZiAoKGVycm9yID0gZmdldCh0ZCwg c29ja2FyZy5zb2NrLCBDQVBfU09DS19BTEwsICZmcCkpICE9IDApCj4gwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgwqBnb3RvIG91dDsKPiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIHJldHVybiAoZXJyb3IpOwo+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgaWYgKGZw LT5mX3R5cGUgIT0gRFRZUEVfU09DS0VUKSB7Cj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqBmZHJvcChmcCwgdGQpOwo+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgZXJyb3IgPSBFUEVSTTsKPiAlJSUKPgo+IC0tCj4gSmFha2tvCj4KCgoKLS0gCkpvbmF0aGFu IEFuZGVyc29uCgpqb25hdGhhbkBGcmVlQlNELm9yZwpodHRwOi8vZnJlZWJzZC5vcmcvfmpvbmF0 aGFuLwo= From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 14:23:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B38B1065673; Tue, 16 Aug 2011 14:23:17 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E98658FC20; Tue, 16 Aug 2011 14:23:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GENGE8061244; Tue, 16 Aug 2011 14:23:16 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GENGo8061242; Tue, 16 Aug 2011 14:23:16 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108161423.p7GENGo8061242@svn.freebsd.org> From: Jonathan Anderson Date: Tue, 16 Aug 2011 14:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224911 - head/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 14:23:17 -0000 Author: jonathan Date: Tue Aug 16 14:23:16 2011 New Revision: 224911 URL: http://svn.freebsd.org/changeset/base/224911 Log: Fix a merge conflict. r224086 added "goto out"-style error handling to nfssvc_nfsd(), in order to reliably call NFSEXITCODE() before returning. Our Capsicum changes, based on the old "return (error)" model, did not merge nicely. Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Tue Aug 16 14:14:56 2011 (r224910) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Tue Aug 16 14:23:16 2011 (r224911) @@ -3036,7 +3036,6 @@ nfssvc_nfsd(struct thread *td, struct nf */ if ((error = fget(td, sockarg.sock, CAP_SOCK_ALL, &fp)) != 0) goto out; - return (error); if (fp->f_type != DTYPE_SOCKET) { fdrop(fp, td); error = EPERM; From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 14:26:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 832E91065672; Tue, 16 Aug 2011 14:26:39 +0000 (UTC) (envelope-from jonathan.robert.anderson@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8D2E18FC12; Tue, 16 Aug 2011 14:26:38 +0000 (UTC) Received: by qwc9 with SMTP id 9so3946911qwc.13 for ; Tue, 16 Aug 2011 07:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hYs/49iXYjF/wCViY6VJAbgBeKtpkXjlzquc3wIL6g4=; b=dIyPjtsBZeMedhS+4ErG9eL+A/x6lk5DULZ+4ELdV2oQ+FFmeRvlPA5HAJWu/vXsMr pL30e+pDnFsm/wkG3a+yClWSMvuL+BenarCKJfNzFgYnE4YZc9WLMQnTU35sw5bedGMs mlmbWVAuJE6/Wxesmr3RFWYXPlgANx1nBD8nM= MIME-Version: 1.0 Received: by 10.224.35.68 with SMTP id o4mr3491190qad.137.1313504798062; Tue, 16 Aug 2011 07:26:38 -0700 (PDT) Sender: jonathan.robert.anderson@gmail.com Received: by 10.229.85.16 with HTTP; Tue, 16 Aug 2011 07:26:37 -0700 (PDT) In-Reply-To: References: <201108111230.p7BCUNnS092831@svn.freebsd.org> <20110816122930.GA44017@jh> Date: Tue, 16 Aug 2011 15:26:37 +0100 X-Google-Sender-Auth: YbO6KrVVD1dUjVnw_JtGghR1PlI Message-ID: From: Jonathan Anderson To: Jaakko Heinonen Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson Subject: Re: svn commit: r224778 - in head: sys/amd64/linux32 sys/cddl/compat/opensolaris/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/dev/aac sys/dev/amr sys/dev/hwpmc sys/dev/ipmi sys/dev/isc... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 14:26:39 -0000 Rml4ZWQgaW4gcjIyNDkxMS4KCgpKb24KCk9uIDE2IEF1Z3VzdCAyMDExIDE0OjU3LCBKb25hdGhh biBBbmRlcnNvbiA8am9uYXRoYW5AZnJlZWJzZC5vcmc+IHdyb3RlOgo+IEl0IGxvb2tzIGxpa2Ug cjIyNDA4NiBhZGRlZCAiZ290byBvdXQiIGVycm9yIGhhbmRsaW5nLCBzbyBvdXIgInJldHVybgo+ IChlcnJvcikiIHNlZW1zIHRvIGJlIGEgbWVyZ2UgY29uZmxpY3QuCj4KPiBTb3JyeSwgSSdsbCBh c2sgUkUgaWYgSSBjYW4gZml4IHRoYXQgcmlnaHQgbm93Lgo+Cj4KPiBKb24KPgo+IE9uIDE2IEF1 Z3VzdCAyMDExIDEzOjI5LCBKYWFra28gSGVpbm9uZW4gPGpoQGZyZWVic2Qub3JnPiB3cm90ZToK Pj4KPj4gSGksCj4+Cj4+IE9uIDIwMTEtMDgtMTEsIFJvYmVydCBXYXRzb24gd3JvdGU6Cj4+PiDC oCBTZWNvbmQtdG8tbGFzdCBjb21taXQgaW1wbGVtZW50aW5nIENhcHNpY3VtIGNhcGFiaWxpdGll cyBpbiB0aGUgRnJlZUJTRAo+Pj4gwqAga2VybmVsIGZvciBGcmVlQlNEIDkuMDoKPj4KPj4gVGhp cyBjb21taXQgc2VlbXMgdG8gaGF2ZSBicm9rZW4gbmZzZCBmb3IgbWUuCj4+Cj4+PiBNb2RpZmll ZDogaGVhZC9zeXMvZnMvbmZzc2VydmVyL25mc19uZnNkcG9ydC5jCj4+PiA9PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT0KPj4+IC0tLSBoZWFkL3N5cy9mcy9uZnNzZXJ2ZXIvbmZzX25mc2Rwb3J0LmMgwqAg wqAgwqBUaHUgQXVnIDExIDExOjMwOjIxIDIwMTEgwqAgwqAgwqAgwqAocjIyNDc3NykKPj4+ICsr KyBoZWFkL3N5cy9mcy9uZnNzZXJ2ZXIvbmZzX25mc2Rwb3J0LmMgwqAgwqAgwqBUaHUgQXVnIDEx IDEyOjMwOjIzIDIwMTEgwqAgwqAgwqAgwqAocjIyNDc3OCkKPj4+IEBAIC0zMDI3LDggKzMwMjks MTQgQEAgbmZzc3ZjX25mc2Qoc3RydWN0IHRocmVhZCAqdGQsIHN0cnVjdCBuZgo+Pj4gwqAgwqAg wqAgwqAgwqAgwqAgwqAgZXJyb3IgPSBjb3B5aW4odWFwLT5hcmdwLCAoY2FkZHJfdCkmc29ja2Fy Zywgc2l6ZW9mIChzb2NrYXJnKSk7Cj4+PiDCoCDCoCDCoCDCoCDCoCDCoCDCoCBpZiAoZXJyb3Ip Cj4+PiDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBnb3RvIG91dDsKPj4+IC0gwqAg wqAgwqAgwqAgwqAgwqAgaWYgKChlcnJvciA9IGZnZXQodGQsIHNvY2thcmcuc29jaywgJmZwKSkg IT0gMCkKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgLyoKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAg wqAqIFNpbmNlIHdlIGRvbid0IGtub3cgd2hhdCByaWdodHMgbWlnaHQgYmUgcmVxdWlyZWQsCj4+ PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgKiBwcmV0ZW5kIHRoYXQgd2UgbmVlZCB0aGVtIGFsbC4g SXQgaXMgYmV0dGVyIHRvIGJlIHRvbwo+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCogY2FyZWZ1 bCB0aGFuIHRvbyByZWNrbGVzcy4KPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAqLwo+Pj4gKyDC oCDCoCDCoCDCoCDCoCDCoCBpZiAoKGVycm9yID0gZmdldCh0ZCwgc29ja2FyZy5zb2NrLCBDQVBf U09DS19BTEwsICZmcCkpICE9IDApCj4+PiDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCBnb3RvIG91dDsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgcmV0dXJuIChl cnJvcik7Cj4+Cj4+IFRoaXMgZm9yIHN1cmUgY2FuJ3QgYmUgY29ycmVjdC4gV2l0aCB0aGUgcGF0 Y2ggYmVsb3cgbmZzZCBzZWVtcyB0byB3b3JrCj4+IGFnYWluIGZvciBtZS4KPj4KPj4gJSUlCj4+ IEluZGV4OiBzeXMvZnMvbmZzc2VydmVyL25mc19uZnNkcG9ydC5jCj4+ID09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KPj4g LS0tIHN5cy9mcy9uZnNzZXJ2ZXIvbmZzX25mc2Rwb3J0LmMgwqAgwqAgKHJldmlzaW9uIDIyNDkw OCkKPj4gKysrIHN5cy9mcy9uZnNzZXJ2ZXIvbmZzX25mc2Rwb3J0LmMgwqAgwqAgKHdvcmtpbmcg Y29weSkKPj4gQEAgLTMwMzYsNyArMzAzNiw2IEBAIG5mc3N2Y19uZnNkKHN0cnVjdCB0aHJlYWQg KnRkLCBzdHJ1Y3QgbmYKPj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgKi8KPj4gwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqBpZiAoKGVycm9yID0gZmdldCh0ZCwgc29ja2FyZy5zb2NrLCBDQVBfU09D S19BTEwsICZmcCkpICE9IDApCj4+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg Z290byBvdXQ7Cj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgcmV0dXJuIChl cnJvcik7Cj4+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgaWYgKGZwLT5mX3R5cGUgIT0gRFRZUEVf U09DS0VUKSB7Cj4+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgZmRyb3AoZnAs IHRkKTsKPj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBlcnJvciA9IEVQRVJN Owo+PiAlJSUKPj4KPj4gLS0KPj4gSmFha2tvCj4+Cj4KPgo+Cj4gLS0KPiBKb25hdGhhbiBBbmRl cnNvbgo+Cj4gam9uYXRoYW5ARnJlZUJTRC5vcmcKPiBodHRwOi8vZnJlZWJzZC5vcmcvfmpvbmF0 aGFuLwo+CgoKCi0tIApKb25hdGhhbiBBbmRlcnNvbgoKam9uYXRoYW5ARnJlZUJTRC5vcmcKaHR0 cDovL2ZyZWVic2Qub3JnL35qb25hdGhhbi8K From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 15:38:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DD181065673; Tue, 16 Aug 2011 15:38:18 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw03.mail.saunalahti.fi (gw03.mail.saunalahti.fi [195.197.172.111]) by mx1.freebsd.org (Postfix) with ESMTP id 2E7728FC0C; Tue, 16 Aug 2011 15:38:17 +0000 (UTC) Received: from a91-153-123-205.elisa-laajakaista.fi (a91-153-123-205.elisa-laajakaista.fi [91.153.123.205]) by gw03.mail.saunalahti.fi (Postfix) with SMTP id 4D6DE216AAB; Tue, 16 Aug 2011 18:38:11 +0300 (EEST) Date: Tue, 16 Aug 2011 18:38:11 +0300 From: Jaakko Heinonen To: Jonathan Anderson Message-ID: <20110816153810.GA2057@a91-153-123-205.elisa-laajakaista.fi> References: <201108111230.p7BCUNnS092831@svn.freebsd.org> <20110816122930.GA44017@jh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson Subject: Re: svn commit: r224778 - in head: sys/amd64/linux32 sys/cddl/compat/opensolaris/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/dev/aac sys/dev/amr sys/dev/hwpmc sys/dev/ipmi sys/dev/isc... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 15:38:18 -0000 On 2011-08-16, Jonathan Anderson wrote: > Fixed in r224911. Thanks! > On 16 August 2011 14:57, Jonathan Anderson wrote: > > It looks like r224086 added "goto out" error handling, so our "return > > (error)" seems to be a merge conflict. -- Jaakko From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 20:07:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E97F1065670; Tue, 16 Aug 2011 20:07:48 +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 6AD0B8FC1A; Tue, 16 Aug 2011 20:07:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GK7mP7071540; Tue, 16 Aug 2011 20:07:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GK7muH071515; Tue, 16 Aug 2011 20:07:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108162007.p7GK7muH071515@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 16 Aug 2011 20:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224914 - in head/sys: dev/streams fs/devfs fs/fifofs kern ofed/include/linux opencrypto security/mac security/mac_stub security/mac_test sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 20:07:48 -0000 Author: kib Date: Tue Aug 16 20:07:47 2011 New Revision: 224914 URL: http://svn.freebsd.org/changeset/base/224914 Log: Add the fo_chown and fo_chmod methods to struct fileops and use them to implement fchown(2) and fchmod(2) support for several file types that previously lacked it. Add MAC entries for chown/chmod done on posix shared memory and (old) in-kernel posix semaphores. Based on the submission by: glebius Reviewed by: rwatson Approved by: re (bz) Modified: head/sys/dev/streams/streams.c head/sys/fs/devfs/devfs_vnops.c head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/kern_descrip.c head/sys/kern/kern_event.c head/sys/kern/sys_capability.c head/sys/kern/sys_pipe.c head/sys/kern/sys_socket.c head/sys/kern/tty_pts.c head/sys/kern/uipc_mqueue.c head/sys/kern/uipc_sem.c head/sys/kern/uipc_shm.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/ofed/include/linux/linux_compat.c head/sys/opencrypto/cryptodev.c head/sys/security/mac/mac_framework.h head/sys/security/mac/mac_policy.h head/sys/security/mac/mac_posix_sem.c head/sys/security/mac/mac_posix_shm.c head/sys/security/mac_stub/mac_stub.c head/sys/security/mac_test/mac_test.c head/sys/sys/file.h head/sys/sys/vnode.h Modified: head/sys/dev/streams/streams.c ============================================================================== --- head/sys/dev/streams/streams.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/dev/streams/streams.c Tue Aug 16 20:07:47 2011 (r224914) @@ -95,7 +95,9 @@ static struct fileops svr4_netops = { .fo_poll = soo_poll, .fo_kqfilter = soo_kqfilter, .fo_stat = soo_stat, - .fo_close = svr4_soo_close + .fo_close = svr4_soo_close, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, }; static struct cdevsw streams_cdevsw = { Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/fs/devfs/devfs_vnops.c Tue Aug 16 20:07:47 2011 (r224914) @@ -1665,6 +1665,8 @@ static struct fileops devfs_ops_f = { .fo_kqfilter = devfs_kqfilter_f, .fo_stat = devfs_stat_f, .fo_close = devfs_close_f, + .fo_chmod = vn_chmod, + .fo_chown = vn_chown, .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE }; Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/fs/fifofs/fifo_vnops.c Tue Aug 16 20:07:47 2011 (r224914) @@ -72,6 +72,8 @@ struct fileops fifo_ops_f = { .fo_kqfilter = fifo_kqfilter_f, .fo_stat = fifo_stat_f, .fo_close = fifo_close_f, + .fo_chmod = vn_chmod, + .fo_chown = vn_chown, .fo_flags = DFLAG_PASSABLE }; Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/kern_descrip.c Tue Aug 16 20:07:47 2011 (r224914) @@ -3774,6 +3774,22 @@ badfo_close(struct file *fp, struct thre return (EBADF); } +static int +badfo_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, + struct thread *td) +{ + + return (EBADF); +} + +static int +badfo_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, + struct thread *td) +{ + + return (EBADF); +} + struct fileops badfileops = { .fo_read = badfo_readwrite, .fo_write = badfo_readwrite, @@ -3783,8 +3799,25 @@ struct fileops badfileops = { .fo_kqfilter = badfo_kqfilter, .fo_stat = badfo_stat, .fo_close = badfo_close, + .fo_chmod = badfo_chmod, + .fo_chown = badfo_chown, }; +int +invfo_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, + struct thread *td) +{ + + return (EINVAL); +} + +int +invfo_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, + struct thread *td) +{ + + return (EINVAL); +} /*-------------------------------------------------------------------*/ Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/kern_event.c Tue Aug 16 20:07:47 2011 (r224914) @@ -123,6 +123,8 @@ static struct fileops kqueueops = { .fo_kqfilter = kqueue_kqfilter, .fo_stat = kqueue_stat, .fo_close = kqueue_close, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, }; static int knote_attach(struct knote *kn, struct kqueue *kq); Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/sys_capability.c Tue Aug 16 20:07:47 2011 (r224914) @@ -161,6 +161,8 @@ static fo_poll_t capability_poll; static fo_kqfilter_t capability_kqfilter; static fo_stat_t capability_stat; static fo_close_t capability_close; +static fo_chmod_t capability_chmod; +static fo_chown_t capability_chown; static struct fileops capability_ops = { .fo_read = capability_read, @@ -171,6 +173,8 @@ static struct fileops capability_ops = { .fo_kqfilter = capability_kqfilter, .fo_stat = capability_stat, .fo_close = capability_close, + .fo_chmod = capability_chmod, + .fo_chown = capability_chown, .fo_flags = DFLAG_PASSABLE, }; @@ -183,6 +187,8 @@ static struct fileops capability_ops_unp .fo_kqfilter = capability_kqfilter, .fo_stat = capability_stat, .fo_close = capability_close, + .fo_chmod = capability_chmod, + .fo_chown = capability_chown, .fo_flags = 0, }; @@ -484,6 +490,22 @@ capability_stat(struct file *fp, struct panic("capability_stat"); } +int +capability_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, + struct thread *td) +{ + + panic("capability_chmod"); +} + +int +capability_chown(struct file *fp, uid_t uid, gid_t gid, + struct ucred *active_cred, struct thread *td) +{ + + panic("capability_chown"); +} + #else /* !CAPABILITIES */ /* Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/sys_pipe.c Tue Aug 16 20:07:47 2011 (r224914) @@ -155,6 +155,8 @@ static struct fileops pipeops = { .fo_kqfilter = pipe_kqfilter, .fo_stat = pipe_stat, .fo_close = pipe_close, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, .fo_flags = DFLAG_PASSABLE }; Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/sys_socket.c Tue Aug 16 20:07:47 2011 (r224914) @@ -64,6 +64,8 @@ struct fileops socketops = { .fo_kqfilter = soo_kqfilter, .fo_stat = soo_stat, .fo_close = soo_close, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, .fo_flags = DFLAG_PASSABLE }; Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/tty_pts.c Tue Aug 16 20:07:47 2011 (r224914) @@ -597,6 +597,8 @@ static struct fileops ptsdev_ops = { .fo_kqfilter = ptsdev_kqfilter, .fo_stat = ptsdev_stat, .fo_close = ptsdev_close, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, .fo_flags = DFLAG_PASSABLE, }; Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/uipc_mqueue.c Tue Aug 16 20:07:47 2011 (r224914) @@ -2469,6 +2469,7 @@ mqf_stat(struct file *fp, struct stat *s struct mqfs_node *pn = fp->f_data; bzero(st, sizeof *st); + sx_xlock(&mqfs_data.mi_lock); st->st_atim = pn->mn_atime; st->st_mtim = pn->mn_mtime; st->st_ctim = pn->mn_ctime; @@ -2476,10 +2477,56 @@ mqf_stat(struct file *fp, struct stat *s st->st_uid = pn->mn_uid; st->st_gid = pn->mn_gid; st->st_mode = S_IFIFO | pn->mn_mode; + sx_xunlock(&mqfs_data.mi_lock); return (0); } static int +mqf_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, + struct thread *td) +{ + struct mqfs_node *pn; + int error; + + error = 0; + pn = fp->f_data; + sx_xlock(&mqfs_data.mi_lock); + error = vaccess(VREG, pn->mn_mode, pn->mn_uid, pn->mn_gid, VADMIN, + active_cred, NULL); + if (error != 0) + goto out; + pn->mn_mode = mode & ACCESSPERMS; +out: + sx_xunlock(&mqfs_data.mi_lock); + return (error); +} + +static int +mqf_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, + struct thread *td) +{ + struct mqfs_node *pn; + int error; + + error = 0; + pn = fp->f_data; + sx_xlock(&mqfs_data.mi_lock); + if (uid == (uid_t)-1) + uid = pn->mn_uid; + if (gid == (gid_t)-1) + gid = pn->mn_gid; + if (((uid != pn->mn_uid && uid != active_cred->cr_uid) || + (gid != pn->mn_gid && !groupmember(gid, active_cred))) && + (error = priv_check_cred(active_cred, PRIV_VFS_CHOWN, 0))) + goto out; + pn->mn_uid = uid; + pn->mn_gid = gid; +out: + sx_xunlock(&mqfs_data.mi_lock); + return (error); +} + +static int mqf_kqfilter(struct file *fp, struct knote *kn) { struct mqueue *mq = FPTOMQ(fp); @@ -2535,6 +2582,8 @@ static struct fileops mqueueops = { .fo_poll = mqf_poll, .fo_kqfilter = mqf_kqfilter, .fo_stat = mqf_stat, + .fo_chmod = mqf_chmod, + .fo_chown = mqf_chown, .fo_close = mqf_close }; Modified: head/sys/kern/uipc_sem.c ============================================================================== --- head/sys/kern/uipc_sem.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/uipc_sem.c Tue Aug 16 20:07:47 2011 (r224914) @@ -135,6 +135,8 @@ static fo_poll_t ksem_poll; static fo_kqfilter_t ksem_kqfilter; static fo_stat_t ksem_stat; static fo_close_t ksem_closef; +static fo_chmod_t ksem_chmod; +static fo_chown_t ksem_chown; /* File descriptor operations. */ static struct fileops ksem_ops = { @@ -146,6 +148,8 @@ static struct fileops ksem_ops = { .fo_kqfilter = ksem_kqfilter, .fo_stat = ksem_stat, .fo_close = ksem_closef, + .fo_chmod = ksem_chmod, + .fo_chown = ksem_chown, .fo_flags = DFLAG_PASSABLE }; @@ -220,19 +224,75 @@ ksem_stat(struct file *fp, struct stat * * file descriptor. */ bzero(sb, sizeof(*sb)); - sb->st_mode = S_IFREG | ks->ks_mode; /* XXX */ + mtx_lock(&sem_lock); sb->st_atim = ks->ks_atime; sb->st_ctim = ks->ks_ctime; sb->st_mtim = ks->ks_mtime; - sb->st_birthtim = ks->ks_birthtime; + sb->st_birthtim = ks->ks_birthtime; sb->st_uid = ks->ks_uid; sb->st_gid = ks->ks_gid; + sb->st_mode = S_IFREG | ks->ks_mode; /* XXX */ + mtx_unlock(&sem_lock); return (0); } static int +ksem_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, + struct thread *td) +{ + struct ksem *ks; + int error; + + error = 0; + ks = fp->f_data; + mtx_lock(&sem_lock); +#ifdef MAC + error = mac_posixsem_check_setmode(active_cred, ks, mode); + if (error != 0) + goto out; +#endif + error = vaccess(VREG, ks->ks_mode, ks->ks_uid, ks->ks_gid, VADMIN, + active_cred, NULL); + if (error != 0) + goto out; + ks->ks_mode = mode & ACCESSPERMS; +out: + mtx_unlock(&sem_lock); + return (error); +} + +static int +ksem_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, + struct thread *td) +{ + struct ksem *ks; + int error; + + ks = fp->f_data; + mtx_lock(&sem_lock); +#ifdef MAC + error = mac_posixsem_check_setowner(active_cred, ks, uid, gid); + if (error != 0) + goto out; +#endif + if (uid == (uid_t)-1) + uid = ks->ks_uid; + if (gid == (gid_t)-1) + gid = ks->ks_gid; + if (((uid != ks->ks_uid && uid != active_cred->cr_uid) || + (gid != ks->ks_gid && !groupmember(gid, active_cred))) && + (error = priv_check_cred(active_cred, PRIV_VFS_CHOWN, 0))) + goto out; + ks->ks_uid = uid; + ks->ks_gid = gid; +out: + mtx_unlock(&sem_lock); + return (error); +} + +static int ksem_closef(struct file *fp, struct thread *td) { struct ksem *ks; Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/uipc_shm.c Tue Aug 16 20:07:47 2011 (r224914) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -123,6 +124,8 @@ static fo_poll_t shm_poll; static fo_kqfilter_t shm_kqfilter; static fo_stat_t shm_stat; static fo_close_t shm_close; +static fo_chmod_t shm_chmod; +static fo_chown_t shm_chown; /* File descriptor operations. */ static struct fileops shm_ops = { @@ -134,6 +137,8 @@ static struct fileops shm_ops = { .fo_kqfilter = shm_kqfilter, .fo_stat = shm_stat, .fo_close = shm_close, + .fo_chmod = shm_chmod, + .fo_chown = shm_chown, .fo_flags = DFLAG_PASSABLE }; @@ -218,16 +223,18 @@ shm_stat(struct file *fp, struct stat *s * descriptor. */ bzero(sb, sizeof(*sb)); - sb->st_mode = S_IFREG | shmfd->shm_mode; /* XXX */ sb->st_blksize = PAGE_SIZE; sb->st_size = shmfd->shm_size; sb->st_blocks = (sb->st_size + sb->st_blksize - 1) / sb->st_blksize; + mtx_lock(&shm_timestamp_lock); sb->st_atim = shmfd->shm_atime; sb->st_ctim = shmfd->shm_ctime; sb->st_mtim = shmfd->shm_mtime; - sb->st_birthtim = shmfd->shm_birthtime; + sb->st_birthtim = shmfd->shm_birthtime; + sb->st_mode = S_IFREG | shmfd->shm_mode; /* XXX */ sb->st_uid = shmfd->shm_uid; sb->st_gid = shmfd->shm_gid; + mtx_unlock(&shm_timestamp_lock); return (0); } @@ -395,14 +402,18 @@ static int shm_access(struct shmfd *shmfd, struct ucred *ucred, int flags) { accmode_t accmode; + int error; accmode = 0; if (flags & FREAD) accmode |= VREAD; if (flags & FWRITE) accmode |= VWRITE; - return (vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid, - accmode, ucred, NULL)); + mtx_lock(&shm_timestamp_lock); + error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid, + accmode, ucred, NULL); + mtx_unlock(&shm_timestamp_lock); + return (error); } /* @@ -651,3 +662,61 @@ shm_mmap(struct shmfd *shmfd, vm_size_t *obj = shmfd->shm_object; return (0); } + +static int +shm_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, + struct thread *td) +{ + struct shmfd *shmfd; + int error; + + error = 0; + shmfd = fp->f_data; + mtx_lock(&shm_timestamp_lock); + /* + * SUSv4 says that x bits of permission need not be affected. + * Be consistent with our shm_open there. + */ +#ifdef MAC + error = mac_posixshm_check_setmode(active_cred, shmfd, mode); + if (error != 0) + goto out; +#endif + error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, + shmfd->shm_gid, VADMIN, active_cred, NULL); + if (error != 0) + goto out; + shmfd->shm_mode = mode & ACCESSPERMS; +out: + mtx_unlock(&shm_timestamp_lock); + return (error); +} + +static int +shm_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, + struct thread *td) +{ + struct shmfd *shmfd; + int error; + + shmfd = fp->f_data; + mtx_lock(&shm_timestamp_lock); +#ifdef MAC + error = mac_posixshm_check_setowner(active_cred, shmfd, uid, gid); + if (error != 0) + goto out; +#endif + if (uid == (uid_t)-1) + uid = shmfd->shm_uid; + if (gid == (gid_t)-1) + gid = shmfd->shm_gid; + if (((uid != shmfd->shm_uid && uid != active_cred->cr_uid) || + (gid != shmfd->shm_gid && !groupmember(gid, active_cred))) && + (error = priv_check_cred(active_cred, PRIV_VFS_CHOWN, 0))) + goto out; + shmfd->shm_uid = uid; + shmfd->shm_gid = gid; +out: + mtx_unlock(&shm_timestamp_lock); + return (error); +} Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/vfs_syscalls.c Tue Aug 16 20:07:47 2011 (r224914) @@ -96,8 +96,6 @@ SDT_PROBE_ARGTYPE(vfs, , stat, reg, 1, " static int chroot_refuse_vdir_fds(struct filedesc *fdp); static int getutimes(const struct timeval *, enum uio_seg, struct timespec *); -static int setfown(struct thread *td, struct vnode *, uid_t, gid_t); -static int setfmode(struct thread *td, struct vnode *, int); static int setfflags(struct thread *td, struct vnode *, int); static int setutimes(struct thread *td, struct vnode *, const struct timespec *, int, int); @@ -2865,9 +2863,10 @@ fchflags(td, uap) /* * Common implementation code for chmod(), lchmod() and fchmod(). */ -static int -setfmode(td, vp, mode) +int +setfmode(td, cred, vp, mode) struct thread *td; + struct ucred *cred; struct vnode *vp; int mode; { @@ -2881,10 +2880,10 @@ setfmode(td, vp, mode) VATTR_NULL(&vattr); vattr.va_mode = mode & ALLPERMS; #ifdef MAC - error = mac_vnode_check_setmode(td->td_ucred, vp, vattr.va_mode); + error = mac_vnode_check_setmode(cred, vp, vattr.va_mode); if (error == 0) #endif - error = VOP_SETATTR(vp, &vattr, td->td_ucred); + error = VOP_SETATTR(vp, &vattr, cred); VOP_UNLOCK(vp, 0); vn_finished_write(mp); return (error); @@ -2980,7 +2979,7 @@ kern_fchmodat(struct thread *td, int fd, return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfmode(td, nd.ni_vp, mode); + error = setfmode(td, td->td_ucred, nd.ni_vp, mode); vrele(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); return (error); @@ -2996,30 +2995,18 @@ struct fchmod_args { }; #endif int -fchmod(td, uap) - struct thread *td; - register struct fchmod_args /* { - int fd; - int mode; - } */ *uap; +fchmod(struct thread *td, struct fchmod_args *uap) { struct file *fp; - int vfslocked; int error; AUDIT_ARG_FD(uap->fd); AUDIT_ARG_MODE(uap->mode); - if ((error = getvnode(td->td_proc->p_fd, uap->fd, CAP_FCHMOD, - &fp)) != 0) + + error = fget(td, uap->fd, CAP_FCHMOD, &fp); + if (error != 0) return (error); - vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); -#ifdef AUDIT - vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); - AUDIT_ARG_VNODE1(fp->f_vnode); - VOP_UNLOCK(fp->f_vnode, 0); -#endif - error = setfmode(td, fp->f_vnode, uap->mode); - VFS_UNLOCK_GIANT(vfslocked); + error = fo_chmod(fp, uap->mode, td->td_ucred, td); fdrop(fp, td); return (error); } @@ -3027,9 +3014,10 @@ fchmod(td, uap) /* * Common implementation for chown(), lchown(), and fchown() */ -static int -setfown(td, vp, uid, gid) +int +setfown(td, cred, vp, uid, gid) struct thread *td; + struct ucred *cred; struct vnode *vp; uid_t uid; gid_t gid; @@ -3045,11 +3033,11 @@ setfown(td, vp, uid, gid) vattr.va_uid = uid; vattr.va_gid = gid; #ifdef MAC - error = mac_vnode_check_setowner(td->td_ucred, vp, vattr.va_uid, + error = mac_vnode_check_setowner(cred, vp, vattr.va_uid, vattr.va_gid); if (error == 0) #endif - error = VOP_SETATTR(vp, &vattr, td->td_ucred); + error = VOP_SETATTR(vp, &vattr, cred); VOP_UNLOCK(vp, 0); vn_finished_write(mp); return (error); @@ -3124,7 +3112,7 @@ kern_fchownat(struct thread *td, int fd, return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfown(td, nd.ni_vp, uid, gid); + error = setfown(td, td->td_ucred, nd.ni_vp, uid, gid); vrele(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); return (error); @@ -3182,22 +3170,14 @@ fchown(td, uap) } */ *uap; { struct file *fp; - int vfslocked; int error; AUDIT_ARG_FD(uap->fd); AUDIT_ARG_OWNER(uap->uid, uap->gid); - if ((error = getvnode(td->td_proc->p_fd, uap->fd, CAP_FCHOWN, &fp)) - != 0) + error = fget(td, uap->fd, CAP_FCHOWN, &fp); + if (error != 0) return (error); - vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); -#ifdef AUDIT - vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); - AUDIT_ARG_VNODE1(fp->f_vnode); - VOP_UNLOCK(fp->f_vnode, 0); -#endif - error = setfown(td, fp->f_vnode, uap->uid, uap->gid); - VFS_UNLOCK_GIANT(vfslocked); + error = fo_chown(fp, uap->uid, uap->gid, td->td_ucred, td); fdrop(fp, td); return (error); } Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/kern/vfs_vnops.c Tue Aug 16 20:07:47 2011 (r224914) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include static fo_rdwr_t vn_read; @@ -81,6 +82,8 @@ struct fileops vnops = { .fo_kqfilter = vn_kqfilter, .fo_stat = vn_statfile, .fo_close = vn_closefile, + .fo_chmod = vn_chmod, + .fo_chown = vn_chown, .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE }; @@ -1357,3 +1360,41 @@ vn_rlimit_fsize(const struct vnode *vp, PROC_UNLOCK(td->td_proc); return (0); } + +int +vn_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, + struct thread *td) +{ + struct vnode *vp; + int error, vfslocked; + + vp = fp->f_vnode; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); +#ifdef AUDIT + vn_lock(vp, LK_SHARED | LK_RETRY); + AUDIT_ARG_VNODE1(vp); + VOP_UNLOCK(vp, 0); +#endif + error = setfmode(td, active_cred, vp, mode); + VFS_UNLOCK_GIANT(vfslocked); + return (error); +} + +int +vn_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, + struct thread *td) +{ + struct vnode *vp; + int error, vfslocked; + + vp = fp->f_vnode; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); +#ifdef AUDIT + vn_lock(vp, LK_SHARED | LK_RETRY); + AUDIT_ARG_VNODE1(vp); + VOP_UNLOCK(vp, 0); +#endif + error = setfown(td, active_cred, vp, uid, gid); + VFS_UNLOCK_GIANT(vfslocked); + return (error); +} Modified: head/sys/ofed/include/linux/linux_compat.c ============================================================================== --- head/sys/ofed/include/linux/linux_compat.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/ofed/include/linux/linux_compat.c Tue Aug 16 20:07:47 2011 (r224914) @@ -559,7 +559,9 @@ struct fileops linuxfileops = { .fo_read = linux_file_read, .fo_poll = linux_file_poll, .fo_close = linux_file_close, - .fo_ioctl = linux_file_ioctl + .fo_ioctl = linux_file_ioctl, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, }; /* Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/opencrypto/cryptodev.c Tue Aug 16 20:07:47 2011 (r224914) @@ -301,7 +301,9 @@ static struct fileops cryptofops = { .fo_poll = cryptof_poll, .fo_kqfilter = cryptof_kqfilter, .fo_stat = cryptof_stat, - .fo_close = cryptof_close + .fo_close = cryptof_close, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, }; static struct csession *csefind(struct fcrypt *, u_int); Modified: head/sys/security/mac/mac_framework.h ============================================================================== --- head/sys/security/mac/mac_framework.h Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/security/mac/mac_framework.h Tue Aug 16 20:07:47 2011 (r224914) @@ -225,6 +225,10 @@ int mac_posixsem_check_getvalue(struct u int mac_posixsem_check_open(struct ucred *cred, struct ksem *ks); int mac_posixsem_check_post(struct ucred *active_cred, struct ucred *file_cred, struct ksem *ks); +int mac_posixsem_check_setmode(struct ucred *cred, struct ksem *ks, + mode_t mode); +int mac_posixsem_check_setowner(struct ucred *cred, struct ksem *ks, + uid_t uid, gid_t gid); int mac_posixsem_check_stat(struct ucred *active_cred, struct ucred *file_cred, struct ksem *ks); int mac_posixsem_check_unlink(struct ucred *cred, struct ksem *ks); @@ -237,6 +241,10 @@ void mac_posixsem_init(struct ksem *); int mac_posixshm_check_mmap(struct ucred *cred, struct shmfd *shmfd, int prot, int flags); int mac_posixshm_check_open(struct ucred *cred, struct shmfd *shmfd); +int mac_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, + mode_t mode); +int mac_posixshm_check_setowner(struct ucred *cred, struct shmfd *shmfd, + uid_t uid, gid_t gid); int mac_posixshm_check_stat(struct ucred *active_cred, struct ucred *file_cred, struct shmfd *shmfd); int mac_posixshm_check_truncate(struct ucred *active_cred, Modified: head/sys/security/mac/mac_policy.h ============================================================================== --- head/sys/security/mac/mac_policy.h Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/security/mac/mac_policy.h Tue Aug 16 20:07:47 2011 (r224914) @@ -336,6 +336,12 @@ typedef int (*mpo_posixsem_check_open_t) typedef int (*mpo_posixsem_check_post_t)(struct ucred *active_cred, struct ucred *file_cred, struct ksem *ks, struct label *kslabel); +typedef int (*mpo_posixsem_check_setmode_t)(struct ucred *cred, + struct ksem *ks, struct label *shmlabel, + mode_t mode); +typedef int (*mpo_posixsem_check_setowner_t)(struct ucred *cred, + struct ksem *ks, struct label *shmlabel, + uid_t uid, gid_t gid); typedef int (*mpo_posixsem_check_stat_t)(struct ucred *active_cred, struct ucred *file_cred, struct ksem *ks, struct label *kslabel); @@ -354,6 +360,12 @@ typedef int (*mpo_posixshm_check_mmap_t) int flags); typedef int (*mpo_posixshm_check_open_t)(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel); +typedef int (*mpo_posixshm_check_setmode_t)(struct ucred *cred, + struct shmfd *shmfd, struct label *shmlabel, + mode_t mode); +typedef int (*mpo_posixshm_check_setowner_t)(struct ucred *cred, + struct shmfd *shmfd, struct label *shmlabel, + uid_t uid, gid_t gid); typedef int (*mpo_posixshm_check_stat_t)(struct ucred *active_cred, struct ucred *file_cred, struct shmfd *shmfd, struct label *shmlabel); @@ -791,6 +803,8 @@ struct mac_policy_ops { mpo_posixsem_check_getvalue_t mpo_posixsem_check_getvalue; mpo_posixsem_check_open_t mpo_posixsem_check_open; mpo_posixsem_check_post_t mpo_posixsem_check_post; + mpo_posixsem_check_setmode_t mpo_posixsem_check_setmode; + mpo_posixsem_check_setowner_t mpo_posixsem_check_setowner; mpo_posixsem_check_stat_t mpo_posixsem_check_stat; mpo_posixsem_check_unlink_t mpo_posixsem_check_unlink; mpo_posixsem_check_wait_t mpo_posixsem_check_wait; @@ -800,6 +814,8 @@ struct mac_policy_ops { mpo_posixshm_check_mmap_t mpo_posixshm_check_mmap; mpo_posixshm_check_open_t mpo_posixshm_check_open; + mpo_posixshm_check_setmode_t mpo_posixshm_check_setmode; + mpo_posixshm_check_setowner_t mpo_posixshm_check_setowner; mpo_posixshm_check_stat_t mpo_posixshm_check_stat; mpo_posixshm_check_truncate_t mpo_posixshm_check_truncate; mpo_posixshm_check_unlink_t mpo_posixshm_check_unlink; Modified: head/sys/security/mac/mac_posix_sem.c ============================================================================== --- head/sys/security/mac/mac_posix_sem.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/security/mac/mac_posix_sem.c Tue Aug 16 20:07:47 2011 (r224914) @@ -198,3 +198,35 @@ mac_posixsem_check_wait(struct ucred *ac return (error); } + +MAC_CHECK_PROBE_DEFINE3(posixsem_check_setmode, "struct ucred *", + "struct ksem *", "mode_t"); + +int +mac_posixsem_check_setmode(struct ucred *cred, struct ksem *ks, mode_t mode) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(posixsem_check_setmode, cred, ks, + ks->ks_label, mode); + MAC_CHECK_PROBE3(posixsem_check_setmode, error, cred, ks, mode); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE4(posixsem_check_setowner, "struct ucred *", + "struct ks *", "uid_t", "gid_t"); + +int +mac_posixsem_check_setowner(struct ucred *cred, struct ksem *ks, uid_t uid, + gid_t gid) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(posixsem_check_setowner, cred, ks, + ks->ks_label, uid, gid); + MAC_CHECK_PROBE4(posixsem_check_setowner, error, cred, ks, + uid, gid); + + return (error); +} Modified: head/sys/security/mac/mac_posix_shm.c ============================================================================== --- head/sys/security/mac/mac_posix_shm.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/security/mac/mac_posix_shm.c Tue Aug 16 20:07:47 2011 (r224914) @@ -181,3 +181,35 @@ mac_posixshm_check_unlink(struct ucred * return (error); } + +MAC_CHECK_PROBE_DEFINE3(posixshm_check_setmode, "struct ucred *", + "struct shmfd *", "mode_t"); + +int +mac_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, mode_t mode) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(posixshm_check_setmode, cred, shmfd, + shmfd->shm_label, mode); + MAC_CHECK_PROBE3(posixshm_check_setmode, error, cred, shmfd, mode); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE4(posixshm_check_setowner, "struct ucred *", + "struct shmfd *", "uid_t", "gid_t"); + +int +mac_posixshm_check_setowner(struct ucred *cred, struct shmfd *shmfd, uid_t uid, + gid_t gid) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(posixshm_check_setowner, cred, shmfd, + shmfd->shm_label, uid, gid); + MAC_CHECK_PROBE4(posixshm_check_setowner, error, cred, shmfd, + uid, gid); + + return (error); +} Modified: head/sys/security/mac_stub/mac_stub.c ============================================================================== --- head/sys/security/mac_stub/mac_stub.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/security/mac_stub/mac_stub.c Tue Aug 16 20:07:47 2011 (r224914) @@ -687,6 +687,22 @@ stub_posixsem_check_post(struct ucred *a } static int +stub_posixsem_check_setmode(struct ucred *cred, struct ksem *ks, + struct label *kslabel, mode_t mode) +{ + + return (0); +} + +static int +stub_posixsem_check_setowner(struct ucred *cred, struct ksem *ks, + struct label *kslabel, uid_t uid, gid_t gid) +{ + + return (0); +} + +static int stub_posixsem_check_stat(struct ucred *active_cred, struct ucred *file_cred, struct ksem *ks, struct label *kslabel) { @@ -734,6 +750,22 @@ stub_posixshm_check_open(struct ucred *c } static int +stub_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, + struct label *shmlabel, mode_t mode) +{ + + return (0); +} + +static int +stub_posixshm_check_setowner(struct ucred *cred, struct shmfd *shmfd, + struct label *shmlabel, uid_t uid, gid_t gid) +{ + + return (0); +} + +static int stub_posixshm_check_stat(struct ucred *active_cred, struct ucred *file_cred, struct shmfd *shmfd, struct label *shmlabel) { @@ -1731,6 +1763,8 @@ static struct mac_policy_ops stub_ops = .mpo_posixsem_check_getvalue = stub_posixsem_check_getvalue, .mpo_posixsem_check_open = stub_posixsem_check_open, .mpo_posixsem_check_post = stub_posixsem_check_post, + .mpo_posixsem_check_setmode = stub_posixsem_check_setmode, + .mpo_posixsem_check_setowner = stub_posixsem_check_setowner, .mpo_posixsem_check_stat = stub_posixsem_check_stat, .mpo_posixsem_check_unlink = stub_posixsem_check_unlink, .mpo_posixsem_check_wait = stub_posixsem_check_wait, @@ -1740,6 +1774,8 @@ static struct mac_policy_ops stub_ops = .mpo_posixshm_check_mmap = stub_posixshm_check_mmap, .mpo_posixshm_check_open = stub_posixshm_check_open, + .mpo_posixshm_check_setmode = stub_posixshm_check_setmode, + .mpo_posixshm_check_setowner = stub_posixshm_check_setowner, .mpo_posixshm_check_stat = stub_posixshm_check_stat, .mpo_posixshm_check_truncate = stub_posixshm_check_truncate, .mpo_posixshm_check_unlink = stub_posixshm_check_unlink, Modified: head/sys/security/mac_test/mac_test.c ============================================================================== --- head/sys/security/mac_test/mac_test.c Tue Aug 16 19:46:13 2011 (r224913) +++ head/sys/security/mac_test/mac_test.c Tue Aug 16 20:07:47 2011 (r224914) @@ -1297,6 +1297,30 @@ test_posixsem_check_post(struct ucred *a return (0); } +COUNTER_DECL(posixsem_check_setmode); +static int +test_posixsem_check_setmode(struct ucred *cred, struct ksem *ks, + struct label *kslabel, mode_t mode) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + LABEL_CHECK(kslabel, MAGIC_POSIX_SHM); + COUNTER_INC(posixsem_check_setmode); + return (0); +} + +COUNTER_DECL(posixsem_check_setowner); +static int +test_posixsem_check_setowner(struct ucred *cred, struct ksem *ks, + struct label *kslabel, uid_t uid, gid_t gid) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + LABEL_CHECK(kslabel, MAGIC_POSIX_SHM); + COUNTER_INC(posixsem_check_setowner); + return (0); +} + COUNTER_DECL(posixsem_check_stat); static int test_posixsem_check_stat(struct ucred *active_cred, @@ -1390,6 +1414,30 @@ test_posixshm_check_open(struct ucred *c return (0); } +COUNTER_DECL(posixshm_check_setmode); +static int +test_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, + struct label *shmfdlabel, mode_t mode) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + LABEL_CHECK(shmfdlabel, MAGIC_POSIX_SHM); + COUNTER_INC(posixshm_check_setmode); + return (0); +} + +COUNTER_DECL(posixshm_check_setowner); +static int +test_posixshm_check_setowner(struct ucred *cred, struct shmfd *shmfd, + struct label *shmfdlabel, uid_t uid, gid_t gid) +{ + + LABEL_CHECK(cred->cr_label, MAGIC_CRED); + LABEL_CHECK(shmfdlabel, MAGIC_POSIX_SHM); + COUNTER_INC(posixshm_check_setowner); + return (0); +} + COUNTER_DECL(posixshm_check_stat); static int test_posixshm_check_stat(struct ucred *active_cred, @@ -3045,6 +3093,8 @@ static struct mac_policy_ops test_ops = .mpo_posixsem_check_getvalue = test_posixsem_check_getvalue, .mpo_posixsem_check_open = test_posixsem_check_open, .mpo_posixsem_check_post = test_posixsem_check_post, + .mpo_posixsem_check_setmode = test_posixsem_check_setmode, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 20:13:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE0801065670; Tue, 16 Aug 2011 20:13:17 +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 ADB218FC0C; Tue, 16 Aug 2011 20:13:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GKDHRX071746; Tue, 16 Aug 2011 20:13:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GKDHB6071744; Tue, 16 Aug 2011 20:13:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108162013.p7GKDHB6071744@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 16 Aug 2011 20:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224915 - head/sys/fs/procfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 20:13:17 -0000 Author: kib Date: Tue Aug 16 20:13:17 2011 New Revision: 224915 URL: http://svn.freebsd.org/changeset/base/224915 Log: Do not return success and a string "unknown" when vn_fullpath() was unable to resolve the path of the text vnode of the process. The behaviour is very confusing for any consumer of the procfs, in particular, java. Reported and tested by: bf MFC after: 2 weeks Approved by: re (bz) Modified: head/sys/fs/procfs/procfs.c Modified: head/sys/fs/procfs/procfs.c ============================================================================== --- head/sys/fs/procfs/procfs.c Tue Aug 16 20:07:47 2011 (r224914) +++ head/sys/fs/procfs/procfs.c Tue Aug 16 20:13:17 2011 (r224915) @@ -67,20 +67,23 @@ int procfs_doprocfile(PFS_FILL_ARGS) { - char *fullpath = "unknown"; - char *freepath = NULL; + char *fullpath; + char *freepath; struct vnode *textvp; + int error; + freepath = NULL; PROC_LOCK(p); textvp = p->p_textvp; vhold(textvp); PROC_UNLOCK(p); - vn_fullpath(td, textvp, &fullpath, &freepath); + error = vn_fullpath(td, textvp, &fullpath, &freepath); vdrop(textvp); - sbuf_printf(sb, "%s", fullpath); - if (freepath) + if (error == 0) + sbuf_printf(sb, "%s", fullpath); + if (freepath != NULL) free(freepath, M_TEMP); - return (0); + return (error); } /* From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 21:04:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E977D106566B; Tue, 16 Aug 2011 21:04:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF5018FC0A; Tue, 16 Aug 2011 21:04:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GL44ss073316; Tue, 16 Aug 2011 21:04:04 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GL44Cd073313; Tue, 16 Aug 2011 21:04:04 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108162104.p7GL44Cd073313@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 16 Aug 2011 21:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224917 - head/lib/libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 21:04:05 -0000 Author: hselasky Date: Tue Aug 16 21:04:04 2011 New Revision: 224917 URL: http://svn.freebsd.org/changeset/base/224917 Log: Update LibUSB v1.0 manual page: - fix some minor spelling - fix some style - add description of new function MFC after: 1 week Approved by: re (kib) Modified: head/lib/libusb/Makefile head/lib/libusb/libusb.3 Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Tue Aug 16 20:29:03 2011 (r224916) +++ head/lib/libusb/Makefile Tue Aug 16 21:04:04 2011 (r224917) @@ -45,6 +45,7 @@ MLINKS += libusb.3 libusb_get_device_lis MLINKS += libusb.3 libusb_free_device_list.3 MLINKS += libusb.3 libusb_get_bus_number.3 MLINKS += libusb.3 libusb_get_device_address.3 +MLINKS += libusb.3 libusb_get_device_speed.3 MLINKS += libusb.3 libusb_get_max_packet_size.3 MLINKS += libusb.3 libusb_ref_device.3 MLINKS += libusb.3 libusb_unref_device.3 Modified: head/lib/libusb/libusb.3 ============================================================================== --- head/lib/libusb/libusb.3 Tue Aug 16 20:29:03 2011 (r224916) +++ head/lib/libusb/libusb.3 Tue Aug 16 21:04:04 2011 (r224917) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 18, 2010 +.Dd August 16, 2011 .Dt LIBUSB 3 .Os .Sh NAME @@ -116,14 +116,22 @@ Returns the number of the bus contained . .Ft uint8_t .Fn libusb_get_device_address "libusb_device *dev" -Return the device_address contained by the device +Returns the device_address contained by the device .Fa dev. . .Pp . +.Ft enum libusb_speed +.Fn libusb_get_device_speed "libusb_device *dev" +Returns the wire speed at which the device is connected. +See the LIBUSB_SPEED_XXX enums for more information. +LIBUSB_SPEED_UNKNOWN is returned in case of unknown wire speed. +. +.Pp +. .Ft int .Fn libusb_get_max_packet_size "libusb_device *dev" "unsigned char endpoint" -Return the wMaxPacketSize value on success, LIBUSB_ERROR_NOT_FOUND if the +Returns the wMaxPacketSize value on success, LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist and LIBUSB_ERROR_OTHERS on other failure. . .Pp @@ -144,7 +152,7 @@ Decrement the reference counter of the d . .Ft int .Fn libusb_open "libusb_device *dev" "libusb_device_handle **devh" -Open a device and obtain a device_handle. Return 0 on success, +Open a device and obtain a device_handle. Returns 0 on success, LIBUSB_ERROR_NO_MEM on memory allocation problem, LIBUSB_ERROR_ACCESS on permission problem, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on error. @@ -157,7 +165,7 @@ Convenience function to open a device wi .Fa vid and .Fa pid. -Return NULL on error. +Returns NULL on error. . .Pp . @@ -168,14 +176,15 @@ Close a device handle. .Pp . .Ft libusb_device * -.Fn libusb_get_device(libusb_device_handle *devh) -Get the device contained by devh. Return NULL on error. +.Fn libusb_get_device "libusb_device_handle *devh" +Get the device contained by devh. +Returns NULL on error. . .Pp . .Ft int .Fn libusb_get_configuration "libusb_device_handle *devh" "int *config" -Return the bConfiguration value of the current configuration. return 0 +Returns the bConfiguration value of the current configuration. Returns 0 on success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on error. . @@ -187,7 +196,7 @@ Set the active configuration .Fa config for the device contained by .Fa devh. -This function return 0 on success, LIBUSB_ERROR_NOT_FOUND if the requested +This function returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the requested configuration does not exist, LIBUSB_ERROR_BUSY if the interfaces are currently claimed, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. @@ -198,7 +207,7 @@ LIBUSB_ERROR code on failure. .Fn libusb_claim_interface "libusb_device_handle *devh" "int interface_number" Claim an interface in a given libusb_handle .Fa devh. -This is a non-blocking function. It return 0 success, LIBUSB_ERROR_NOT_FOUND +This is a non-blocking function. It returns 0 success, LIBUSB_ERROR_NOT_FOUND if the requested interface does not exist, LIBUSB_ERROR_BUSY if a program or driver has claimed the interface, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. @@ -251,7 +260,7 @@ code on failure. .Fn libusb_kernel_driver_active "libusb_device_handle *devh" "int interface" Determine if a driver is active on a interface. Returns 0 if no kernel driver is active, returns 1 if a kernel driver is active, returns LIBUSB_ERROR_NO_DEVICE -if the device has been disconnected and return a LIBUSB_ERROR code on failure. +if the device has been disconnected and returns a LIBUSB_ERROR code on failure. . .Pp . @@ -316,7 +325,7 @@ failure. .Fn libsub_get_active_config_descriptor "libusb_device *dev" "struct libusb_config_descriptor **config" Get the USB configuration descriptor for the active configuration. Returns 0 on success, returns LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state -and return another LIBUSB_ERROR code on error. +and returns another LIBUSB_ERROR code on error. . .Pp .Ft int @@ -342,8 +351,8 @@ Free a configuration descriptor. .Pp .Ft int .Fn libusb_get_string_descriptor_ascii "libusb_device_handle *devh" "uint8_t desc_idx" "unsigned char *data" "int length" -Retrieve a string descriptor in C style ascii. Returns a number of byte on success -and a LIBUSB_ERROR code on failure. +Retrieve a string descriptor in C style ascii. +Returns a positive number of bytes in the resulting ASCII string on success and a LIBUSB_ERROR code on failure. . .Pp . @@ -354,7 +363,8 @@ and a LIBUSB_ERROR code on failure. .Fn libusb_alloc_transfer "int iso_packets" Allocate a transfer with .Fa iso_packets -numbers of isochronous packet descriptors. Returns NULL on error. +numbers of isochronous packet descriptors. +Returns NULL on error. . .Pp .Ft void @@ -364,15 +374,15 @@ Free a transfer. .Pp .Ft int .Fn libusb_submit_transfer "struct libusb_transfer *tr" -This function will submit a transfer and returns immediately. Returns 0 on -success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and +This function will submit a transfer and returns immediately. +Returns 0 on success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and LIBUSB_ERROR code on other failure. . .Pp .Ft int .Fn libusb_cancel_transfer "struct libusb_transfer *tr" -This function asynchronously cancel a transfer. Returns 0 on success and -LIBUSB_ERROR code on failure. +This function asynchronously cancel a transfer. +Returns 0 on success and LIBUSB_ERROR code on failure. . .Pp .Sh USB SYNCHRONOUS I/O @@ -380,7 +390,8 @@ LIBUSB_ERROR code on failure. .Pp .Ft int .Fn libusb_control_transfer "libusb_device_handle *devh" "uint8_t bmRequestType" "uint8_t bRequest" "uint16_t wValue" "uint16_t wIndex" "unsigned char *data" "uint16_t wLength" "unsigned int timeout" -Perform a USB control transfer. Returns the actual number of bytes +Perform a USB control transfer. +Returns the actual number of bytes transferred on success in the range from and including zero until and including .Fa wLength . @@ -420,8 +431,8 @@ LIBUSB_ERROR code on other failure. .Pp .Ft int .Fn libusb_try_lock_events "libusb_context *ctx" -Try to acquire the event handling lock. Returns 0 if the lock was obtained and 1 -if not. +Try to acquire the event handling lock. +Returns 0 if the lock was obtained and 1 if not. . .Pp .Ft void From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 21:04:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94BE41065677; Tue, 16 Aug 2011 21:04:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83A9F8FC17; Tue, 16 Aug 2011 21:04:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GL4IHk073360; Tue, 16 Aug 2011 21:04:18 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GL4ImR073358; Tue, 16 Aug 2011 21:04:18 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201108162104.p7GL4ImR073358@svn.freebsd.org> From: Michael Tuexen Date: Tue, 16 Aug 2011 21:04:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224918 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 21:04:18 -0000 Author: tuexen Date: Tue Aug 16 21:04:18 2011 New Revision: 224918 URL: http://svn.freebsd.org/changeset/base/224918 Log: Fix the handling of [gs]etsockopt() unconnected 1-to-1 style sockets. While there: * Fix a locking issue in setsockopt() of SCTP_CMT_ON_OFF. * Fix a bug in setsockopt() of SCTP_DEFAULT_PRINFO, where the pr_value was ignored. Approved by: re@ MFC after: 2 months. Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Tue Aug 16 21:04:04 2011 (r224917) +++ head/sys/netinet/sctp_usrreq.c Tue Aug 16 21:04:18 2011 (r224918) @@ -1767,7 +1767,9 @@ flags_out: av->assoc_value = stcb->asoc.sctp_cmt_on_off; SCTP_TCB_UNLOCK(stcb); } else { - if (av->assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); av->assoc_value = inp->sctp_cmt_on_off; SCTP_INP_RUNLOCK(inp); @@ -1791,7 +1793,9 @@ flags_out: av->assoc_value = stcb->asoc.congestion_control_module; SCTP_TCB_UNLOCK(stcb); } else { - if (av->assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); av->assoc_value = inp->sctp_ep.sctp_default_cc_module; SCTP_INP_RUNLOCK(inp); @@ -1834,7 +1838,9 @@ flags_out: av->assoc_value = stcb->asoc.stream_scheduling_module; SCTP_TCB_UNLOCK(stcb); } else { - if (av->assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); av->assoc_value = inp->sctp_ep.sctp_default_ss_module; SCTP_INP_RUNLOCK(inp); @@ -1949,7 +1955,9 @@ flags_out: av->assoc_value = stcb->asoc.context; SCTP_TCB_UNLOCK(stcb); } else { - if (av->assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); av->assoc_value = inp->sctp_context; SCTP_INP_RUNLOCK(inp); @@ -2022,7 +2030,9 @@ flags_out: sack->sack_freq = stcb->asoc.sack_freq; SCTP_TCB_UNLOCK(stcb); } else { - if (sack->sack_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (sack->sack_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); sack->sack_delay = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]); sack->sack_freq = inp->sctp_ep.sctp_sack_freq; @@ -2067,7 +2077,9 @@ flags_out: av->assoc_value = stcb->asoc.max_burst; SCTP_TCB_UNLOCK(stcb); } else { - if (av->assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); av->assoc_value = inp->sctp_ep.max_burst; SCTP_INP_RUNLOCK(inp); @@ -2093,7 +2105,9 @@ flags_out: av->assoc_value = sctp_get_frag_point(stcb, &stcb->asoc); SCTP_TCB_UNLOCK(stcb); } else { - if (av->assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { ovh = SCTP_MED_OVERHEAD; @@ -2462,7 +2476,9 @@ flags_out: paddrp->spp_assoc_id = sctp_get_associd(stcb); SCTP_TCB_UNLOCK(stcb); } else { - if (paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC)) { /* Use endpoint defaults */ SCTP_INP_RLOCK(inp); paddrp->spp_pathmaxrxt = inp->sctp_ep.def_net_failure; @@ -2637,7 +2653,9 @@ flags_out: srto->srto_min = stcb->asoc.minrto; SCTP_TCB_UNLOCK(stcb); } else { - if (srto->srto_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (srto->srto_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); srto->srto_initial = inp->sctp_ep.initial_rto; srto->srto_max = inp->sctp_ep.sctp_maxrto; @@ -2691,7 +2709,9 @@ flags_out: sasoc->sasoc_local_rwnd = stcb->asoc.my_rwnd; SCTP_TCB_UNLOCK(stcb); } else { - if (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); sasoc->sasoc_cookie_life = TICKS_TO_MSEC(inp->sctp_ep.def_cookie_life); sasoc->sasoc_asocmaxrxt = inp->sctp_ep.max_send_times; @@ -2720,7 +2740,9 @@ flags_out: memcpy(s_info, &stcb->asoc.def_send, sizeof(stcb->asoc.def_send)); SCTP_TCB_UNLOCK(stcb); } else { - if (s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); memcpy(s_info, &inp->def_send, sizeof(inp->def_send)); SCTP_INP_RUNLOCK(inp); @@ -2822,7 +2844,9 @@ flags_out: scact->scact_keynumber = stcb->asoc.authinfo.active_keyid; SCTP_TCB_UNLOCK(stcb); } else { - if (scact->scact_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (scact->scact_assoc_id == SCTP_FUTURE_ASSOC)) { /* get the endpoint active key */ SCTP_INP_RLOCK(inp); scact->scact_keynumber = inp->sctp_ep.default_keyid; @@ -2861,7 +2885,9 @@ flags_out: } SCTP_TCB_UNLOCK(stcb); } else { - if (sac->gauth_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (sac->gauth_assoc_id == SCTP_FUTURE_ASSOC)) { /* get off the endpoint */ SCTP_INP_RLOCK(inp); chklist = inp->sctp_ep.local_auth_chunks; @@ -2967,7 +2993,9 @@ flags_out: event->se_on = sctp_stcb_is_feature_on(inp, stcb, event_type); SCTP_TCB_UNLOCK(stcb); } else { - if (event->se_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (event->se_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); event->se_on = sctp_is_feature_on(inp, event_type); SCTP_INP_RUNLOCK(inp); @@ -3035,7 +3063,9 @@ flags_out: info->snd_context = stcb->asoc.def_send.sinfo_context; SCTP_TCB_UNLOCK(stcb); } else { - if (info->snd_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (info->snd_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); info->snd_sid = inp->def_send.sinfo_stream; info->snd_flags = inp->def_send.sinfo_flags; @@ -3065,7 +3095,9 @@ flags_out: info->pr_value = stcb->asoc.def_send.sinfo_timetolive; SCTP_TCB_UNLOCK(stcb); } else { - if (info->pr_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (info->pr_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); info->pr_policy = PR_SCTP_POLICY(inp->def_send.sinfo_flags); info->pr_value = inp->def_send.sinfo_timetolive; @@ -3153,7 +3185,9 @@ flags_out: thlds->spt_assoc_id = sctp_get_associd(stcb); SCTP_TCB_UNLOCK(stcb); } else { - if (thlds->spt_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (thlds->spt_assoc_id == SCTP_FUTURE_ASSOC)) { /* Use endpoint defaults */ SCTP_INP_RLOCK(inp); thlds->spt_pathmaxrxt = inp->sctp_ep.def_net_failure; @@ -3347,7 +3381,9 @@ sctp_setopt(struct socket *so, int optna stcb->asoc.sctp_cmt_on_off = av->assoc_value; SCTP_TCB_UNLOCK(stcb); } else { - if ((av->assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC) || (av->assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); inp->sctp_cmt_on_off = av->assoc_value; @@ -3360,8 +3396,8 @@ sctp_setopt(struct socket *so, int optna SCTP_TCB_LOCK(stcb); stcb->asoc.sctp_cmt_on_off = av->assoc_value; SCTP_TCB_UNLOCK(stcb); - SCTP_INP_RUNLOCK(inp); } + SCTP_INP_RUNLOCK(inp); } } } else { @@ -3394,7 +3430,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if ((av->assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC) || (av->assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); inp->sctp_ep.sctp_default_cc_module = av->assoc_value; @@ -3474,7 +3512,9 @@ sctp_setopt(struct socket *so, int optna stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); SCTP_TCB_UNLOCK(stcb); } else { - if ((av->assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC) || (av->assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); inp->sctp_ep.sctp_default_ss_module = av->assoc_value; @@ -3548,7 +3588,9 @@ sctp_setopt(struct socket *so, int optna stcb->asoc.context = av->assoc_value; SCTP_TCB_UNLOCK(stcb); } else { - if ((av->assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC) || (av->assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); inp->sctp_context = av->assoc_value; @@ -3614,7 +3656,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if ((sack->sack_assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (sack->sack_assoc_id == SCTP_FUTURE_ASSOC) || (sack->sack_assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); if (sack->sack_delay) { @@ -3709,7 +3753,9 @@ sctp_setopt(struct socket *so, int optna error = sctp_insert_sharedkey(shared_keys, shared_key); SCTP_TCB_UNLOCK(stcb); } else { - if ((sca->sca_assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (sca->sca_assoc_id == SCTP_FUTURE_ASSOC) || (sca->sca_assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); shared_keys = &inp->sctp_ep.shared_keys; @@ -3853,7 +3899,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if ((scact->scact_assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (scact->scact_assoc_id == SCTP_FUTURE_ASSOC) || (scact->scact_assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); if (sctp_auth_setactivekey_ep(inp, scact->scact_keynumber)) { @@ -3890,7 +3938,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if ((scdel->scact_assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (scdel->scact_assoc_id == SCTP_FUTURE_ASSOC) || (scdel->scact_assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); if (sctp_delete_sharedkey_ep(inp, scdel->scact_keynumber)) { @@ -3927,7 +3977,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if ((keyid->scact_assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (keyid->scact_assoc_id == SCTP_FUTURE_ASSOC) || (keyid->scact_assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); if (sctp_deact_sharedkey_ep(inp, keyid->scact_keynumber)) { @@ -4193,7 +4245,9 @@ sctp_setopt(struct socket *so, int optna stcb->asoc.max_burst = av->assoc_value; SCTP_TCB_UNLOCK(stcb); } else { - if ((av->assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC) || (av->assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); inp->sctp_ep.max_burst = av->assoc_value; @@ -4233,7 +4287,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if (av->assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_WLOCK(inp); /* * FIXME MT: I think this is not in @@ -4441,7 +4497,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if ((s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC) || (s_info->sinfo_assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); memcpy(&inp->def_send, s_info, min(optsize, sizeof(inp->def_send))); @@ -4740,7 +4798,9 @@ sctp_setopt(struct socket *so, int optna SCTP_TCB_UNLOCK(stcb); } else { /************************NO TCB, SET TO default stuff ******************/ - if (paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_WLOCK(inp); /* * For the TOS/FLOWLABEL stuff you @@ -4806,7 +4866,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if (srto->srto_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (srto->srto_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_WLOCK(inp); if (srto->srto_initial) new_init = srto->srto_initial; @@ -4858,7 +4920,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_WLOCK(inp); if (sasoc->sasoc_asocmaxrxt) inp->sctp_ep.max_send_times = sasoc->sasoc_asocmaxrxt; @@ -5178,13 +5242,17 @@ sctp_setopt(struct socket *so, int optna * sender dry events */ if ((event_type == SCTP_PCB_FLAGS_DRYEVNT) && + ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) == 0) && + ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) == 0) && ((event->se_assoc_id == SCTP_ALL_ASSOC) || (event->se_assoc_id == SCTP_CURRENT_ASSOC))) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTSUP); error = ENOTSUP; break; } - if ((event->se_assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (event->se_assoc_id == SCTP_FUTURE_ASSOC) || (event->se_assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); if (event->se_on) { @@ -5262,7 +5330,9 @@ sctp_setopt(struct socket *so, int optna } SCTP_TCB_UNLOCK(stcb); } else { - if ((info->snd_assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (info->snd_assoc_id == SCTP_FUTURE_ASSOC) || (info->snd_assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); inp->def_send.sinfo_stream = info->snd_sid; @@ -5308,13 +5378,17 @@ sctp_setopt(struct socket *so, int optna if (stcb) { stcb->asoc.def_send.sinfo_flags &= 0xfff0; stcb->asoc.def_send.sinfo_flags |= info->pr_policy; + stcb->asoc.def_send.sinfo_timetolive = info->pr_value; SCTP_TCB_UNLOCK(stcb); } else { - if ((info->pr_assoc_id == SCTP_FUTURE_ASSOC) || + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (info->pr_assoc_id == SCTP_FUTURE_ASSOC) || (info->pr_assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); inp->def_send.sinfo_flags &= 0xfff0; inp->def_send.sinfo_flags |= info->pr_policy; + inp->def_send.sinfo_timetolive = info->pr_value; SCTP_INP_WUNLOCK(inp); } if ((info->pr_assoc_id == SCTP_CURRENT_ASSOC) || @@ -5324,6 +5398,7 @@ sctp_setopt(struct socket *so, int optna SCTP_TCB_LOCK(stcb); stcb->asoc.def_send.sinfo_flags &= 0xfff0; stcb->asoc.def_send.sinfo_flags |= info->pr_policy; + stcb->asoc.def_send.sinfo_timetolive = info->pr_value; SCTP_TCB_UNLOCK(stcb); } SCTP_INP_RUNLOCK(inp); @@ -5459,7 +5534,9 @@ sctp_setopt(struct socket *so, int optna stcb->asoc.def_net_pf_threshold = thlds->spt_pathpfthld; } } else { - if (thlds->spt_assoc_id == SCTP_FUTURE_ASSOC) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (thlds->spt_assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_WLOCK(inp); inp->sctp_ep.def_net_failure = thlds->spt_pathmaxrxt; inp->sctp_ep.def_net_pf_threshold = thlds->spt_pathpfthld; From owner-svn-src-all@FreeBSD.ORG Tue Aug 16 21:51:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4635B106564A; Tue, 16 Aug 2011 21:51:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C5E68FC12; Tue, 16 Aug 2011 21:51:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GLpUQ6074788; Tue, 16 Aug 2011 21:51:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GLpTHc074785; Tue, 16 Aug 2011 21:51:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108162151.p7GLpTHc074785@svn.freebsd.org> From: Alexander Motin Date: Tue, 16 Aug 2011 21:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224919 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 21:51:30 -0000 Author: mav Date: Tue Aug 16 21:51:29 2011 New Revision: 224919 URL: http://svn.freebsd.org/changeset/base/224919 Log: Always check current HPET counter value after comparator programming to avoid lost timer interrupts. Previous optimization attempt doing it only for intervals less then 5000 ticks (~300us) reported to be unreliable by some people. Probably because of some heavy SMI code on their boards. Introduce additional safety interval of 128 counter ticks (~9us) between programmed comparator and counter values to cover different cases of delayed write found on some chipsets. Approved by: re (kib) Modified: head/sys/dev/acpica/acpi_hpet.c head/sys/dev/acpica/acpi_hpet.h Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Tue Aug 16 21:04:18 2011 (r224918) +++ head/sys/dev/acpica/acpi_hpet.c Tue Aug 16 21:51:29 2011 (r224919) @@ -190,13 +190,10 @@ restart: bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), t->next); } - if (fdiv < 5000) { - bus_read_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num)); - now = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); - if ((int32_t)(now - t->next) >= 0) { - fdiv *= 2; - goto restart; - } + now = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); + if ((int32_t)(now - t->next + HPET_MIN_CYCLES) >= 0) { + fdiv *= 2; + goto restart; } return (0); } @@ -679,7 +676,8 @@ hpet_attach(device_t dev) t->et.et_quality -= 10; t->et.et_frequency = sc->freq; t->et.et_min_period.sec = 0; - t->et.et_min_period.frac = 0x00008000LLU << 32; + t->et.et_min_period.frac = + (((uint64_t)(HPET_MIN_CYCLES * 2) << 32) / sc->freq) << 32; t->et.et_max_period.sec = 0xfffffffeLLU / sc->freq; t->et.et_max_period.frac = ((0xfffffffeLLU << 32) / sc->freq) << 32; Modified: head/sys/dev/acpica/acpi_hpet.h ============================================================================== --- head/sys/dev/acpica/acpi_hpet.h Tue Aug 16 21:04:18 2011 (r224918) +++ head/sys/dev/acpica/acpi_hpet.h Tue Aug 16 21:51:29 2011 (r224919) @@ -62,4 +62,6 @@ #define HPET_TIMER_FSB_VAL(x) ((x) * 0x20 + 0x110) #define HPET_TIMER_FSB_ADDR(x) ((x) * 0x20 + 0x114) +#define HPET_MIN_CYCLES 128 /* Period considered reliable. */ + #endif /* !__ACPI_HPET_H__ */ From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 12:37:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A351106564A; Wed, 17 Aug 2011 12:37: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 7A68E8FC0A; Wed, 17 Aug 2011 12:37:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HCbEWp005470; Wed, 17 Aug 2011 12:37:14 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HCbECv005467; Wed, 17 Aug 2011 12:37:14 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108171237.p7HCbECv005467@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 17 Aug 2011 12:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 12:37:14 -0000 Author: kib Date: Wed Aug 17 12:37:14 2011 New Revision: 224935 URL: http://svn.freebsd.org/changeset/base/224935 Log: Fix build breakage. Initialize error variables explicitely for !MAC case. Pointy hat to: kib Approved by: re (bz) Modified: head/sys/kern/uipc_sem.c head/sys/kern/uipc_shm.c Modified: head/sys/kern/uipc_sem.c ============================================================================== --- head/sys/kern/uipc_sem.c Wed Aug 17 09:52:34 2011 (r224934) +++ head/sys/kern/uipc_sem.c Wed Aug 17 12:37:14 2011 (r224935) @@ -270,6 +270,7 @@ ksem_chown(struct file *fp, uid_t uid, g struct ksem *ks; int error; + error = 0; ks = fp->f_data; mtx_lock(&sem_lock); #ifdef MAC Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Wed Aug 17 09:52:34 2011 (r224934) +++ head/sys/kern/uipc_shm.c Wed Aug 17 12:37:14 2011 (r224935) @@ -699,6 +699,7 @@ shm_chown(struct file *fp, uid_t uid, gi struct shmfd *shmfd; int error; + error = 0; shmfd = fp->f_data; mtx_lock(&shm_timestamp_lock); #ifdef MAC From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 13:02:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7ECF11065670; Wed, 17 Aug 2011 13:02:50 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EA938FC1A; Wed, 17 Aug 2011 13:02:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HD2o3V006303; Wed, 17 Aug 2011 13:02:50 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HD2oBR006301; Wed, 17 Aug 2011 13:02:50 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201108171302.p7HD2oBR006301@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 17 Aug 2011 13:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224936 - head/sys/contrib/pf/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 13:02:50 -0000 Author: pluknet Date: Wed Aug 17 13:02:50 2011 New Revision: 224936 URL: http://svn.freebsd.org/changeset/base/224936 Log: Fix build failure without BPF. Reported by: deeptech71 at gmail dot com Approved by: re (kib) Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Wed Aug 17 12:37:14 2011 (r224935) +++ head/sys/contrib/pf/net/if_pfsync.c Wed Aug 17 13:02:50 2011 (r224936) @@ -2126,8 +2126,8 @@ pfsync_sendout(void) #else struct ifnet *ifp = &sc->sc_if; #endif - struct mbuf *m; #endif + struct mbuf *m; struct ip *ip; struct pfsync_header *ph; struct pfsync_subheader *subh; From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 13:56:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3808106566C; Wed, 17 Aug 2011 13:56:33 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C328A8FC15; Wed, 17 Aug 2011 13:56:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HDuXEb007914; Wed, 17 Aug 2011 13:56:33 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HDuXPm007912; Wed, 17 Aug 2011 13:56:33 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201108171356.p7HDuXPm007912@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 17 Aug 2011 13:56:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224937 - head/usr.bin/grep X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 13:56:33 -0000 Author: gabor Date: Wed Aug 17 13:56:33 2011 New Revision: 224937 URL: http://svn.freebsd.org/changeset/base/224937 Log: - Fix handling of environmental variables when they are set to empty string Submitted by: ttsestt@gmail.com Approved by: re (kib), delphij (mentor) Modified: head/usr.bin/grep/grep.c Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Wed Aug 17 13:02:50 2011 (r224936) +++ head/usr.bin/grep/grep.c Wed Aug 17 13:56:33 2011 (r224937) @@ -304,7 +304,7 @@ init_color(const char *d) char *c; c = getenv("GREP_COLOR"); - return (c != NULL ? c : d); + return (c != NULL && c[0] != '\0' ? c : d); } int @@ -360,7 +360,7 @@ main(int argc, char *argv[]) /* support for extra arguments in GREP_OPTIONS */ eargc = 0; - if (eopts != NULL) { + if (eopts != NULL && eopts[0] != '\0') { char *str; /* make an estimation of how many extra arguments we have */ @@ -373,7 +373,8 @@ main(int argc, char *argv[]) eargc = 0; /* parse extra arguments */ while ((str = strsep(&eopts, " ")) != NULL) - eargv[eargc++] = grep_strdup(str); + if (str[0] != '\0') + eargv[eargc++] = grep_strdup(str); aargv = (char **)grep_calloc(eargc + argc + 1, sizeof(char *)); From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 13:58:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BC79106567A; Wed, 17 Aug 2011 13:58:39 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B3208FC17; Wed, 17 Aug 2011 13:58:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HDwdgo008008; Wed, 17 Aug 2011 13:58:39 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HDwdFp008006; Wed, 17 Aug 2011 13:58:39 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201108171358.p7HDwdFp008006@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 17 Aug 2011 13:58:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224938 - head/usr.bin/grep X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 13:58:39 -0000 Author: gabor Date: Wed Aug 17 13:58:39 2011 New Revision: 224938 URL: http://svn.freebsd.org/changeset/base/224938 Log: - Fix exclusion of directories from a recursive search - Use FTS_SKIP for exclusion instead of custom code Submitted by: ttsestt@gmail.com Approved by: re (kib), delphij (mentor) Modified: head/usr.bin/grep/util.c Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Wed Aug 17 13:56:33 2011 (r224937) +++ head/usr.bin/grep/util.c Wed Aug 17 13:58:39 2011 (r224938) @@ -84,7 +84,7 @@ dir_matching(const char *dname) for (unsigned int i = 0; i < dpatterns; ++i) { if (dname != NULL && - fnmatch(dname, dpattern[i].pat, 0) == 0) { + fnmatch(dpattern[i].pat, dname, 0) == 0) { if (dpattern[i].mode == EXCL_PAT) return (false); else @@ -103,7 +103,6 @@ grep_tree(char **argv) { FTS *fts; FTSENT *p; - char *d, *dir = NULL; int c, fts_flags; bool ok; @@ -135,6 +134,10 @@ grep_tree(char **argv) case FTS_D: /* FALLTHROUGH */ case FTS_DP: + if (dexclude || dinclude) + if (!dir_matching(p->fts_name) || + !dir_matching(p->fts_path)) + fts_set(fts, p, FTS_SKIP); break; case FTS_DC: /* Print a warning for recursive directory loop */ @@ -144,18 +147,6 @@ grep_tree(char **argv) default: /* Check for file exclusion/inclusion */ ok = true; - if (dexclude || dinclude) { - if ((d = strrchr(p->fts_path, '/')) != NULL) { - dir = grep_malloc(sizeof(char) * - (d - p->fts_path + 1)); - memcpy(dir, p->fts_path, - d - p->fts_path); - dir[d - p->fts_path] = '\0'; - } - ok = dir_matching(dir); - free(dir); - dir = NULL; - } if (fexclude || finclude) ok &= file_matching(p->fts_path); From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 14:29:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76F921065670; Wed, 17 Aug 2011 14:29:33 +0000 (UTC) (envelope-from deischen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6580C8FC17; Wed, 17 Aug 2011 14:29:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HETXoW009108; Wed, 17 Aug 2011 14:29:33 GMT (envelope-from deischen@svn.freebsd.org) Received: (from deischen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HETXEF009106; Wed, 17 Aug 2011 14:29:33 GMT (envelope-from deischen@svn.freebsd.org) Message-Id: <201108171429.p7HETXEF009106@svn.freebsd.org> From: Daniel Eischen Date: Wed, 17 Aug 2011 14:29:33 +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: r224941 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 14:29:33 -0000 Author: deischen Date: Wed Aug 17 14:29:33 2011 New Revision: 224941 URL: http://svn.freebsd.org/changeset/base/224941 Log: MFC r218627 Allow SO_SETFIB to select/set the default routing table. Requested by: Andrew Boyer aboyer at averesystems dot com. Modified: stable/7/sys/kern/uipc_socket.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/uipc_socket.c ============================================================================== --- stable/7/sys/kern/uipc_socket.c Wed Aug 17 14:28:58 2011 (r224940) +++ stable/7/sys/kern/uipc_socket.c Wed Aug 17 14:29:33 2011 (r224941) @@ -2207,15 +2207,16 @@ sosetopt(struct socket *so, struct socko case SO_SETFIB: error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); - if (optval < 1 || optval > rt_numfibs) { + if (optval < 0 || optval > rt_numfibs) { error = EINVAL; goto bad; } - if ((so->so_proto->pr_domain->dom_family == PF_INET) || - (so->so_proto->pr_domain->dom_family == PF_ROUTE)) { + if (so->so_proto != NULL && + ((so->so_proto->pr_domain->dom_family == PF_INET) || + (so->so_proto->pr_domain->dom_family == PF_ROUTE))) { so->so_fibnum = optval; /* Note: ignore error */ - if (so->so_proto && so->so_proto->pr_ctloutput) + if (so->so_proto->pr_ctloutput) (*so->so_proto->pr_ctloutput)(so, sopt); } else { so->so_fibnum = 0; From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 14:39:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55EB6106564A; Wed, 17 Aug 2011 14:39:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 457938FC16; Wed, 17 Aug 2011 14:39:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HEdkSc009463; Wed, 17 Aug 2011 14:39:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HEdkBL009461; Wed, 17 Aug 2011 14:39:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201108171439.p7HEdkBL009461@svn.freebsd.org> From: John Baldwin Date: Wed, 17 Aug 2011 14:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224942 - head/sbin/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 14:39:46 -0000 Author: jhb Date: Wed Aug 17 14:39:45 2011 New Revision: 224942 URL: http://svn.freebsd.org/changeset/base/224942 Log: Fix a regression where a rule containing a source port option after a destination IP would incorrectly display the source port as a destination port. Reviewed by: luigi Approved by: re (kib) MFC after: 1 week Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Wed Aug 17 14:29:33 2011 (r224941) +++ head/sbin/ipfw/ipfw2.c Wed Aug 17 14:39:45 2011 (r224942) @@ -1282,6 +1282,8 @@ show_ipfw(struct ip_fw *rule, int pcwidt HAVE_PROTO | HAVE_SRCIP | HAVE_DSTIP | HAVE_IP, 0); case O_IP_SRCPORT: + if (flags & HAVE_DSTIP) + flags |= HAVE_IP; show_prerequisites(&flags, HAVE_PROTO | HAVE_SRCIP, 0); if ((cmd->len & F_OR) && !or_block) From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 15:19:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04441106564A; Wed, 17 Aug 2011 15:19:26 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E70768FC16; Wed, 17 Aug 2011 15:19:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HFJPBZ010890; Wed, 17 Aug 2011 15:19:25 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HFJPp1010888; Wed, 17 Aug 2011 15:19:25 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201108171519.p7HFJPp1010888@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 17 Aug 2011 15:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224944 - stable/8/usr.bin/rs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 15:19:26 -0000 Author: jh Date: Wed Aug 17 15:19:25 2011 New Revision: 224944 URL: http://svn.freebsd.org/changeset/base/224944 Log: MFC r218410: Handle EOF when skipping lines. Modified: stable/8/usr.bin/rs/rs.c Directory Properties: stable/8/usr.bin/rs/ (props changed) Modified: stable/8/usr.bin/rs/rs.c ============================================================================== --- stable/8/usr.bin/rs/rs.c Wed Aug 17 15:13:07 2011 (r224943) +++ stable/8/usr.bin/rs/rs.c Wed Aug 17 15:19:25 2011 (r224944) @@ -130,14 +130,17 @@ getfile(void) char *p; char *endp; char **ep; + int c; int multisep = (flags & ONEISEPONLY ? 0 : 1); int nullpad = flags & NULLPAD; char **padto; while (skip--) { - getline(); + c = getline(); if (flags & SKIPPRINT) puts(curline); + if (c == EOF) + return; } getline(); if (flags & NOARGS && curlen < owidth) From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 15:22:58 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD8C81065672; Wed, 17 Aug 2011 15:22:58 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92A1C8FC18; Wed, 17 Aug 2011 15:22:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HFMwNW011067; Wed, 17 Aug 2011 15:22:58 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HFMwgj011065; Wed, 17 Aug 2011 15:22:58 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201108171522.p7HFMwgj011065@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 17 Aug 2011 15:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224945 - stable/8/usr.bin/rs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 15:22:58 -0000 Author: jh Date: Wed Aug 17 15:22:58 2011 New Revision: 224945 URL: http://svn.freebsd.org/changeset/base/224945 Log: MFC r218411: - Use LINE_MAX from limits.h as the maximum line length instead of BUFSIZ. Use LINE_MAX * 2 as the buffer size (BSIZE). - Error out if we encounter a line longer than LINE_MAX. The previous behavior was to silently split long lines and produce corrupted output. PR: bin/151384 Modified: stable/8/usr.bin/rs/rs.c Directory Properties: stable/8/usr.bin/rs/ (props changed) Modified: stable/8/usr.bin/rs/rs.c ============================================================================== --- stable/8/usr.bin/rs/rs.c Wed Aug 17 15:19:25 2011 (r224944) +++ stable/8/usr.bin/rs/rs.c Wed Aug 17 15:22:58 2011 (r224945) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -332,8 +333,8 @@ prepfile(void) warnx("%d is colwidths, nelem %d", colwidths[i], nelem);*/ } -#define BSIZE 2048 -char ibuf[BSIZE]; /* two screenfuls should do */ +#define BSIZE (LINE_MAX * 2) +char ibuf[BSIZE]; int getline(void) /* get line; maintain curline, curlen; manage storage */ @@ -354,7 +355,7 @@ getline(void) /* get line; maintain curl curline = ibuf; } } - if (!putlength && endblock - curline < BUFSIZ) { /* need storage */ + if (!putlength && endblock - curline < LINE_MAX + 1) { /* need storage */ /*ww = endblock-curline; tt += ww;*/ /*printf("#wasted %d total %d\n",ww,tt);*/ if (!(curline = (char *) malloc(BSIZE))) @@ -362,11 +363,16 @@ getline(void) /* get line; maintain curl endblock = curline + BSIZE; /*printf("#endb %d curline %d\n",endblock,curline);*/ } - for (p = curline, i = 1; i < BUFSIZ; *p++ = c, i++) - if ((c = getchar()) == EOF || c == '\n') + for (p = curline, i = 0;; *p++ = c, i++) { + if ((c = getchar()) == EOF) break; + if (i >= LINE_MAX) + errx(1, "maximum line length (%d) exceeded", LINE_MAX); + if (c == '\n') + break; + } *p = '\0'; - curlen = i - 1; + curlen = i; return(c); } From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 15:24:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EB15106566B; Wed, 17 Aug 2011 15:24:25 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D8578FC19; Wed, 17 Aug 2011 15:24:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HFOPHs011167; Wed, 17 Aug 2011 15:24:25 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HFOPQL011165; Wed, 17 Aug 2011 15:24:25 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201108171524.p7HFOPQL011165@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 17 Aug 2011 15:24:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224946 - stable/8/usr.bin/rs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 15:24:25 -0000 Author: jh Date: Wed Aug 17 15:24:25 2011 New Revision: 224946 URL: http://svn.freebsd.org/changeset/base/224946 Log: MFC r219038: Document the input line length limit. Modified: stable/8/usr.bin/rs/rs.1 Directory Properties: stable/8/usr.bin/rs/ (props changed) Modified: stable/8/usr.bin/rs/rs.1 ============================================================================== --- stable/8/usr.bin/rs/rs.1 Wed Aug 17 15:22:58 2011 (r224945) +++ stable/8/usr.bin/rs/rs.1 Wed Aug 17 15:24:25 2011 (r224946) @@ -32,7 +32,7 @@ .\" @(#)rs.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd July 30, 2004 +.Dd February 25, 2011 .Dt RS 1 .Os .Sh NAME @@ -241,4 +241,9 @@ Re-ordering of columns is not yet possib There are too many options. .It Multibyte characters are not recognized. +.It +Lines longer than +.Dv LINE_MAX +(2048) bytes are not processed and result in immediate termination of +.Nm . .El From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 17:04:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9812106566C; Wed, 17 Aug 2011 17:04:43 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7CA08FC13; Wed, 17 Aug 2011 17:04:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HH4hVN014730; Wed, 17 Aug 2011 17:04:43 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HH4hb2014727; Wed, 17 Aug 2011 17:04:43 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201108171704.p7HH4hb2014727@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 17 Aug 2011 17:04:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224948 - stable/8/sys/dev/ichwd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 17:04:44 -0000 Author: gavin Date: Wed Aug 17 17:04:43 2011 New Revision: 224948 URL: http://svn.freebsd.org/changeset/base/224948 Log: Merge r211908 from head (originally by jfv): Add Intel Cougar Point PCH LPC Controller Device IDs for watchdog support. Also add additional Intel Ibex Peak (5 Series/3400 Series) PCH IDs. PR: kern/159800 Modified: stable/8/sys/dev/ichwd/ichwd.c stable/8/sys/dev/ichwd/ichwd.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.c Wed Aug 17 15:45:40 2011 (r224947) +++ stable/8/sys/dev/ichwd/ichwd.c Wed Aug 17 17:04:43 2011 (r224948) @@ -110,7 +110,53 @@ static struct ichwd_device ichwd_devices { DEVICEID_ICH10D, "Intel ICH10D watchdog timer", 10 }, { DEVICEID_ICH10DO, "Intel ICH10DO watchdog timer", 10 }, { DEVICEID_ICH10R, "Intel ICH10R watchdog timer", 10 }, + { DEVICEID_PCH, "Intel PCH watchdog timer", 10 }, + { DEVICEID_PCHM, "Intel PCH watchdog timer", 10 }, + { DEVICEID_P55, "Intel P55 watchdog timer", 10 }, + { DEVICEID_PM55, "Intel PM55 watchdog timer", 10 }, { DEVICEID_H55, "Intel H55 watchdog timer", 10 }, + { DEVICEID_QM57, "Intel QM57 watchdog timer", 10 }, + { DEVICEID_H57, "Intel H57 watchdog timer", 10 }, + { DEVICEID_HM55, "Intel HM55 watchdog timer", 10 }, + { DEVICEID_Q57, "Intel Q57 watchdog timer", 10 }, + { DEVICEID_HM57, "Intel HM57 watchdog timer", 10 }, + { DEVICEID_PCHMSFF, "Intel PCHMSFF watchdog timer", 10 }, + { DEVICEID_QS57, "Intel QS57 watchdog timer", 10 }, + { DEVICEID_3400, "Intel 3400 watchdog timer", 10 }, + { DEVICEID_3420, "Intel 3420 watchdog timer", 10 }, + { DEVICEID_3450, "Intel 3450 watchdog timer", 10 }, + { DEVICEID_CPT0, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT1, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT2, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT3, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT4, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT5, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT6, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT7, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT8, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT9, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT10, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT11, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT12, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT13, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT14, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT15, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT16, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT17, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT18, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT19, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT20, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT21, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT22, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT23, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT23, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT25, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT26, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT27, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT28, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT29, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT30, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT31, "Intel Cougar Point watchdog timer", 10 }, { DEVICEID_PATSBURG_LPC1, "Intel Patsburg watchdog timer", 10 }, { DEVICEID_PATSBURG_LPC2, "Intel Patsburg watchdog timer", 10 }, { DEVICEID_PPT0, "Intel Panther Point watchdog timer", 10 }, Modified: stable/8/sys/dev/ichwd/ichwd.h ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.h Wed Aug 17 15:45:40 2011 (r224947) +++ stable/8/sys/dev/ichwd/ichwd.h Wed Aug 17 17:04:43 2011 (r224948) @@ -65,6 +65,38 @@ struct ichwd_softc { }; #define VENDORID_INTEL 0x8086 +#define DEVICEID_CPT0 0x1c40 +#define DEVICEID_CPT1 0x1c41 +#define DEVICEID_CPT2 0x1c42 +#define DEVICEID_CPT3 0x1c43 +#define DEVICEID_CPT4 0x1c44 +#define DEVICEID_CPT5 0x1c45 +#define DEVICEID_CPT6 0x1c46 +#define DEVICEID_CPT7 0x1c47 +#define DEVICEID_CPT8 0x1c48 +#define DEVICEID_CPT9 0x1c49 +#define DEVICEID_CPT10 0x1c4a +#define DEVICEID_CPT11 0x1c4b +#define DEVICEID_CPT12 0x1c4c +#define DEVICEID_CPT13 0x1c4d +#define DEVICEID_CPT14 0x1c4e +#define DEVICEID_CPT15 0x1c4f +#define DEVICEID_CPT16 0x1c50 +#define DEVICEID_CPT17 0x1c51 +#define DEVICEID_CPT18 0x1c52 +#define DEVICEID_CPT19 0x1c53 +#define DEVICEID_CPT20 0x1c54 +#define DEVICEID_CPT21 0x1c55 +#define DEVICEID_CPT22 0x1c56 +#define DEVICEID_CPT23 0x1c57 +#define DEVICEID_CPT24 0x1c58 +#define DEVICEID_CPT25 0x1c59 +#define DEVICEID_CPT26 0x1c5a +#define DEVICEID_CPT27 0x1c5b +#define DEVICEID_CPT28 0x1c5c +#define DEVICEID_CPT29 0x1c5d +#define DEVICEID_CPT30 0x1c5e +#define DEVICEID_CPT31 0x1c5f #define DEVICEID_PATSBURG_LPC1 0x1d40 #define DEVICEID_PATSBURG_LPC2 0x1d41 #define DEVICEID_PPT0 0x1e40 @@ -136,7 +168,21 @@ struct ichwd_softc { #define DEVICEID_ICH10D 0x3a1a #define DEVICEID_ICH10DO 0x3a14 #define DEVICEID_ICH10R 0x3a16 +#define DEVICEID_PCH 0x3b00 +#define DEVICEID_PCHM 0x3b01 +#define DEVICEID_P55 0x3b02 +#define DEVICEID_PM55 0x3b03 #define DEVICEID_H55 0x3b06 +#define DEVICEID_QM57 0x3b07 +#define DEVICEID_H57 0x3b08 +#define DEVICEID_HM55 0x3b09 +#define DEVICEID_Q57 0x3b0a +#define DEVICEID_HM57 0x3b0b +#define DEVICEID_PCHMSFF 0x3b0d +#define DEVICEID_QS57 0x3b0f +#define DEVICEID_3400 0x3b12 +#define DEVICEID_3420 0x3b14 +#define DEVICEID_3450 0x3b16 /* ICH LPC Interface Bridge Registers (ICH5 and older) */ #define ICH_GEN_STA 0xd4 From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 19:43:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BAD9106564A; Wed, 17 Aug 2011 19:43:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE9A98FC1D; Wed, 17 Aug 2011 19:43:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HJhf4U020423; Wed, 17 Aug 2011 19:43:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HJhffq020420; Wed, 17 Aug 2011 19:43:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108171943.p7HJhffq020420@svn.freebsd.org> From: Alexander Motin Date: Wed, 17 Aug 2011 19:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224949 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 19:43:42 -0000 Author: mav Date: Wed Aug 17 19:43:41 2011 New Revision: 224949 URL: http://svn.freebsd.org/changeset/base/224949 Log: Update ata(4) manual page, reflecting migration to CAM-based ATA stack (`options ATA_CAM` enabled by default). Approved by: re (kib) Modified: head/share/man/man4/Makefile head/share/man/man4/ata.4 Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Aug 17 17:04:43 2011 (r224948) +++ head/share/man/man4/Makefile Wed Aug 17 19:43:41 2011 (r224949) @@ -526,10 +526,6 @@ MLINKS+=agp.4 agpgart.4 MLINKS+=ale.4 if_ale.4 MLINKS+=altq.4 ALTQ.4 MLINKS+=an.4 if_an.4 -MLINKS+=ata.4 acd.4 \ - ata.4 ad.4 \ - ata.4 afd.4 \ - ata.4 ast.4 MLINKS+=aue.4 if_aue.4 MLINKS+=axe.4 if_axe.4 MLINKS+=bce.4 if_bce.4 Modified: head/share/man/man4/ata.4 ============================================================================== --- head/share/man/man4/ata.4 Wed Aug 17 17:04:43 2011 (r224948) +++ head/share/man/man4/ata.4 Wed Aug 17 19:43:41 2011 (r224949) @@ -1,105 +1,91 @@ -.\" -.\" Copyright (c) 2003 Søren Schmidt +.\" Copyright (c) 2011 Alexander Motin .\" 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, -.\" without modification, immediately at the beginning of the file. +.\" 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. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. .\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd July 3, 2010 +.Dd August 17, 2011 .Dt ATA 4 .Os .Sh NAME -.Nm ata , -.Nm ar , -.Nm acd , -.Nm ad , -.Nm afd , -.Nm ast -.Nd generic ATA/ATAPI disk controller driver +.Nm ata +.Nd generic ATA/SATA controller driver .Sh SYNOPSIS -For ISA based ATA/ATAPI support: -.Cd device isa -.Cd device ata -.Pp -In -.Pa /boot/device.hints : -.Cd hint.ata.0.at="isa" -.Cd hint.ata.0.port="0x1f0" -.Cd hint.ata.0.irq="14" -.Cd hint.ata.1.at="isa" -.Cd hint.ata.1.port="0x170" -.Cd hint.ata.1.irq="15" -.Pp -For PC98 based ATA/ATAPI support: -.Cd device isa -.Cd device ata -.Pp -In -.Pa /boot/device.hints : -.Cd hint.atacbus.0.at="isa" -.Cd hint.atacbus.0.port="0x640" -.Cd hint.atacbus.0.irq="9" -.Pp -For PCI based ATA/ATAPI support: -.Cd device pci -.Cd device ata -.Pp -To support ATA compliant disk drives: -.Cd device atadisk -.Pp -To support ATA software RAID's: -.Cd device ataraid -.Pp -To support ATAPI CDROM, DVD and CD/DVD burner drives: -.Cd device atapicd -.Pp -To support ATAPI floppy drives: -.Cd device atapifd +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device scbus" +.Cd "device ata" +.Cd "options ATA_CAM" +.Ed +.Pp +Alternatively, to load the driver as set of modules at boot time, +place some of the following lines in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ata_load="YES" + +atacard_load="YES" +ataisa_load="YES" +atapci_load="YES" + +ataacard_load="YES" +ataacerlabs_load="YES" +ataadaptec_load="YES" +ataahci_load="YES" +ataamd_load="YES" +ataati_load="YES" +atacenatek_load="YES" +atacypress_load="YES" +atacyrix_load="YES" +atahighpoint_load="YES" +ataintel_load="YES" +ataite_load="YES" +atajmicron_load="YES" +atamarvell_load="YES" +atamicron_load="YES" +atanational_load="YES" +atanetcell_load="YES" +atanvidia_load="YES" +atapromise_load="YES" +ataserverworks_load="YES" +atasiliconimage_load="YES" +atasis_load="YES" +atavia_load="YES" +.Ed +.Pp +First line is common hardware independent code. +Next three lines are generic bus-specific drivers. +ataahci is AHCI driver. +The rest are vendor-specific PCI drivers. +ATA_CAM option should always remain in kernel configuration to make +the driver work as CAM(4) subsystem module. .Pp -To support ATAPI tape drives: -.Cd device atapist -.Pp -To turn -.Xr ata 4 -subsystem controller drivers into cam(4) interface modules (disables all native -.Xr ata 4 -APIs and peripheral drivers): -.Cd options ATA_CAM -.Pp -The following tunables are settable from the loader: +The following tunables are settable from the +.Xr loader 8 : .Bl -ohang -.It Va hw.ata.ata_dma -set to 1 for DMA access, 0 for PIO (default is DMA). .It Va hw.ata.ata_dma_check_80pin set to 0 to disable the 80pin cable check (default is 1, check the cable) -.It Va hw.ata.atapi_dma -set to 1 for DMA access, 0 for PIO (default is DMA). -.It Va hw.ata.wc -set to 1 to enable Write Caching, 0 to disable (default is enabled). -.Em WARNING : -can cause data loss on power failures and crashes. .It Va hint.atapci.X.msi set to 1 to allow Message Signalled Interrupts (MSI) to be used by specified PCI ATA controller, if supported. @@ -121,15 +107,55 @@ host initiates PARTIAL PM state transiti .It 3 host initiates SLUMBER PM state transition every time port becomes idle. .El -Modes 2 and 3 are implemented only for AHCI driver now. +Modes 2 and 3 are supported only for AHCI. .El .Sh DESCRIPTION The .Nm -driver provides access to ATA (IDE) and SerialATA disk drives, -ATAPI CDROM/DVD drives, ZIP/LS120 ATAPI drives and ATAPI tape drives -connected to controllers according to the ATA/ATAPI standards. +driver provides the CAM(4) subsystem access to ATA (IDE) and SATA ports +of many generic controllers. +Depending on controller, each PATA port or each one or two SATA ports are +represented to CAM as a separate bus with one or two targets. +Most of the bus-management details are handled by the ATA/SATA-specific +transport of CAM. +Connected ATA disks are handled by the ATA protocol disk peripheral driver +.Xr ada 4 . +ATAPI devices are handled by the SCSI protocol peripheral drivers +.Xr cd 4 , +.Xr da 4 , +.Xr sa 4 , +etc. +.Pp +Driver supports ATA and for the most of controllers ATAPI devices. +Command queuing and SATA port multipliers are not supported. +Device hot-plug and SATA interface power management supported only on +some controllers. +.Pp +The +.Nm +driver can change the transfer mode when the system is up and running. +See +.Xr camcontrol 8 +negotiate subcommand. .Pp +The +.Nm +driver sets the maximum transfer mode supported by the hardware as default. +However the +.Nm +driver sometimes warns: +.Dq Sy "DMA limited to UDMA33, non-ATA66 cable or device". +This means that +the +.Nm +driver has detected that the required 80 conductor cable is not present +or could not be detected properly, +or that one of the devices on the channel only accepts up +to UDMA2/ATA33. +The +.Va hw.ata.ata_dma_check_80pin +tunable can be set to 0 to disable this check. +.Sh HARDWARE The currently supported ATA/SATA controller chips are: .Pp .Bl -tag -width "Silicon Image:" -compact @@ -186,72 +212,18 @@ VT82C686A, VT82C686B, VT8231, VT8233, VT VT8237A, VT8237S, VT8251, CX700, VX800, VX855, VX900. .El .Pp +Some of above chips are also supported by the more featured +.Xr ahci 4 , +.Xr mvs 4 , +and +.Xr siis 4 +drivers. +If both drivers are loaded at the same time, those will have precedence. +.Pp Unknown ATA chipsets are supported in PIO modes, and if the standard busmaster DMA registers are present and contain valid setup, DMA is also enabled, although the max mode is limited to UDMA33, as it is not known what the chipset can do and how to program it. -.Pp -The -.Nm -driver can change the transfer mode and various other parameters -when the system is up and running. -See -.Xr atacontrol 8 . -.Pp -The -.Nm -driver sets the maximum transfer mode supported by the hardware as default. -However the -.Nm -driver sometimes warns: -.Dq Sy "DMA limited to UDMA33, non-ATA66 cable or device". -This means that -the -.Nm -driver has detected that the required 80 conductor cable is not present -or could not be detected properly, -or that one of the devices on the channel only accepts up -to UDMA2/ATA33. -The -.Va hw.ata.ata_dma_check_80pin -tunable can be set to 0 to disable this check. -.Pp -Unknown ATAPI devices are initialized to DMA mode if the -.Va hw.ata.atapi_dma -tunable is set to 1 and they support at least UDMA33 transfers. -Otherwise they are set to PIO mode because severe DMA problems are -common even if the device capabilities indicate support. -You can always try to set DMA mode on an ATAPI device using -.Xr atacontrol 8 , -but be aware that your hardware might -.Em not -support it and can potentially -.Em hang -the entire system causing data loss. -.Pp -The -.Nm acd -driver implements most of the -.Fn ioctl -requests documented by -.Xr cd 4 . -.Sh FILES -.Bl -tag -width ".Pa /sys/i386/conf/GENERIC" -compact -.It Pa /dev/ad* -ATA disk device nodes -.It Pa /dev/ar* -ATA RAID device nodes -.It Pa /dev/acd* -ATAPI CD-ROM device nodes -.It Pa /dev/afd* -ATAPI floppy drive device nodes -.It Pa /dev/ast* -ATAPI tape drive device nodes -.It Pa /sys/i386/conf/GENERIC -sample generic kernel config file for -.Nm -based systems -.El .Sh NOTES Please remember that in order to use UDMA4/ATA66 and above modes you .Em must @@ -260,31 +232,25 @@ Please assure that ribbon cables are no In case of rounded ATA cables, the length depends on the quality of the cables. SATA cables can be up to 1m long according to the specification. -.Pp -Static device numbering -(enabled with the -.Dv ATA_STATIC_ID -kernel option) -reserves a number for each possibly connected disk, -even when not present. -This is useful in hotswap scenarios -where disks should always show up as the same numbered device, -and not depend on attach order. -.Pp -Native Command Queuing (NCQ) on SATA drives is not yet supported. +External SATA cables can be 2m long and more, but not all controllers +work well on long cables, especially at high speeds. .Sh SEE ALSO +.Xr ada 4 , .Xr ahci 4 , .Xr cam 4 , -.Xr ataraid 4 , -.Xr atacontrol 8 , -.Xr burncd 8 , +.Xr camcontrol 8 , .Xr cd 4 , +.Xr mvs 4 , .Xr siis 4 .Sh HISTORY The .Nm driver first appeared in .Fx 4.0 . +Turned into CAM(4) interface module in +.Fx 9.0 . .Sh AUTHORS +.An Alexander Motin +.Aq mav@FreeBSD.org , .An S\(/oren Schmidt .Aq sos@FreeBSD.org . From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 20:03:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5CFA106566C; Wed, 17 Aug 2011 20:03:11 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C42558FC13; Wed, 17 Aug 2011 20:03:11 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 517AE46B2E; Wed, 17 Aug 2011 16:03:11 -0400 (EDT) Date: Wed, 17 Aug 2011 21:03:11 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Poul-Henning Kamp In-Reply-To: <201105171104.p4HB4oD0028308@svn.freebsd.org> Message-ID: References: <201105171104.p4HB4oD0028308@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222015 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 20:03:12 -0000 On Tue, 17 May 2011, Poul-Henning Kamp wrote: > + if ((s->s_flags & SBUF_AUTOEXTEND) == 0) { > + KASSERT(s->s_size > 1, > + ("attempt to create a too small sbuf")); > + } This change turns out to cause a kernel panic during fuzzing of mac_proc_get(2). Previously the code checked for a non-negative userspace buffer size, and also a bound at a max buffer length. While '0' is a bit of a silly buffer size to pass in, so is '1' (enough room for just a nul), and '2' (can't fit a useful string there), etc, so it's not extremely silly. I'd rather we had left this assertion as-is as it didn't relate to the actual functional change here. Can I convince you to revert that, rather than us having to walk through the kernel to try to find this and other instances of possibly passing a zero-size buffer in? (On a related note, zero-size buffers are accepted by most string routines...) Robert From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 20:44:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FBAA1065670; Wed, 17 Aug 2011 20:44:00 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 262898FC16; Wed, 17 Aug 2011 20:44:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HKi09P022297; Wed, 17 Aug 2011 20:44:00 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HKi0Nh022294; Wed, 17 Aug 2011 20:44:00 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108172044.p7HKi0Nh022294@svn.freebsd.org> From: Rick Macklem Date: Wed, 17 Aug 2011 20:44:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224950 - stable/8/sys/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 20:44:00 -0000 Author: rmacklem Date: Wed Aug 17 20:43:59 2011 New Revision: 224950 URL: http://svn.freebsd.org/changeset/base/224950 Log: MFC: r224604 Fix a LOR in the NFS client which could cause a deadlock. This was reported to the mailing list freebsd-net@freebsd.org on July 21, 2011 under the subject "LOR with nfsclient sillyrename". The LOR occurred when nfs_inactive() called vrele(sp->s_dvp) while holding the vnode lock on the file in s_dvp. This patch modifies the client so that it performs the vrele(sp->s_dvp) as a separate task to avoid the LOR. This fix was discussed with jhb@ and kib@, who both proposed variations of it. Modified: stable/8/sys/nfsclient/nfs_node.c stable/8/sys/nfsclient/nfsnode.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/nfsclient/nfs_node.c ============================================================================== --- stable/8/sys/nfsclient/nfs_node.c Wed Aug 17 19:43:41 2011 (r224949) +++ stable/8/sys/nfsclient/nfs_node.c Wed Aug 17 20:43:59 2011 (r224950) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -59,6 +60,8 @@ __FBSDID("$FreeBSD$"); static uma_zone_t nfsnode_zone; +static void nfs_freesillyrename(void *arg, __unused int pending); + #define TRUE 1 #define FALSE 0 @@ -185,6 +188,20 @@ nfs_nget(struct mount *mntp, nfsfh_t *fh return (0); } +/* + * Do the vrele(sp->s_dvp) as a separate task in order to avoid a + * deadlock because of a LOR when vrele() locks the directory vnode. + */ +static void +nfs_freesillyrename(void *arg, __unused int pending) +{ + struct sillyrename *sp; + + sp = arg; + vrele(sp->s_dvp); + free(sp, M_NFSREQ); +} + int nfs_inactive(struct vop_inactive_args *ap) { @@ -207,8 +224,8 @@ nfs_inactive(struct vop_inactive_args *a */ (sp->s_removeit)(sp); crfree(sp->s_cred); - vrele(sp->s_dvp); - free((caddr_t)sp, M_NFSREQ); + TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp); + taskqueue_enqueue(taskqueue_thread, &sp->s_task); mtx_lock(&np->n_mtx); } np->n_flag &= NMODIFIED; Modified: stable/8/sys/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/nfsclient/nfsnode.h Wed Aug 17 19:43:41 2011 (r224949) +++ stable/8/sys/nfsclient/nfsnode.h Wed Aug 17 20:43:59 2011 (r224950) @@ -36,6 +36,7 @@ #ifndef _NFSCLIENT_NFSNODE_H_ #define _NFSCLIENT_NFSNODE_H_ +#include #if !defined(_NFSCLIENT_NFS_H_) && !defined(_KERNEL) #include #endif @@ -45,6 +46,7 @@ * can be removed by nfs_inactive() */ struct sillyrename { + struct task s_task; struct ucred *s_cred; struct vnode *s_dvp; int (*s_removeit)(struct sillyrename *sp); From owner-svn-src-all@FreeBSD.ORG Wed Aug 17 20:55:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E828106566C; Wed, 17 Aug 2011 20:55:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15C708FC14; Wed, 17 Aug 2011 20:55:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HKtu4R022697; Wed, 17 Aug 2011 20:55:56 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HKtuSC022694; Wed, 17 Aug 2011 20:55:56 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108172055.p7HKtuSC022694@svn.freebsd.org> From: Rick Macklem Date: Wed, 17 Aug 2011 20:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224951 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 20:55:57 -0000 Author: rmacklem Date: Wed Aug 17 20:55:56 2011 New Revision: 224951 URL: http://svn.freebsd.org/changeset/base/224951 Log: MFC: r224606 Fix a LOR in the NFS client which could cause a deadlock. This was reported to the mailing list freebsd-net@freebsd.org on July 21, 2011 under the subject "LOR with nfsclient sillyrename". The LOR occurred when nfs_inactive() called vrele(sp->s_dvp) while holding the vnode lock on the file in s_dvp. This patch modifies the client so that it performs the vrele(sp->s_dvp) as a separate task to avoid the LOR. This fix was discussed with jhb@ and kib@, who both proposed variations of it. Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c stable/8/sys/fs/nfsclient/nfsnode.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clnode.c Wed Aug 17 20:43:59 2011 (r224950) +++ stable/8/sys/fs/nfsclient/nfs_clnode.c Wed Aug 17 20:55:56 2011 (r224951) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -62,6 +63,8 @@ MALLOC_DECLARE(M_NEWNFSREQ); uma_zone_t newnfsnode_zone; +static void nfs_freesillyrename(void *arg, __unused int pending); + void ncl_nhinit(void) { @@ -183,6 +186,20 @@ ncl_nget(struct mount *mntp, u_int8_t *f return (0); } +/* + * Do the vrele(sp->s_dvp) as a separate task in order to avoid a + * deadlock because of a LOR when vrele() locks the directory vnode. + */ +static void +nfs_freesillyrename(void *arg, __unused int pending) +{ + struct sillyrename *sp; + + sp = arg; + vrele(sp->s_dvp); + free(sp, M_NEWNFSREQ); +} + int ncl_inactive(struct vop_inactive_args *ap) { @@ -217,8 +234,8 @@ ncl_inactive(struct vop_inactive_args *a */ ncl_removeit(sp, vp); crfree(sp->s_cred); - vrele(sp->s_dvp); - FREE((caddr_t)sp, M_NEWNFSREQ); + TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp); + taskqueue_enqueue(taskqueue_thread, &sp->s_task); mtx_lock(&np->n_mtx); } np->n_flag &= NMODIFIED; Modified: stable/8/sys/fs/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/fs/nfsclient/nfsnode.h Wed Aug 17 20:43:59 2011 (r224950) +++ stable/8/sys/fs/nfsclient/nfsnode.h Wed Aug 17 20:55:56 2011 (r224951) @@ -35,11 +35,14 @@ #ifndef _NFSCLIENT_NFSNODE_H_ #define _NFSCLIENT_NFSNODE_H_ +#include + /* * Silly rename structure that hangs off the nfsnode until the name * can be removed by nfs_inactive() */ struct sillyrename { + struct task s_task; struct ucred *s_cred; struct vnode *s_dvp; long s_namlen; From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 00:05:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A71281065676; Thu, 18 Aug 2011 00:05:09 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9669A8FC13; Thu, 18 Aug 2011 00:05:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7I059aa028463; Thu, 18 Aug 2011 00:05:09 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7I059rB028461; Thu, 18 Aug 2011 00:05:09 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108180005.p7I059rB028461@svn.freebsd.org> From: Zack Kirsch Date: Thu, 18 Aug 2011 00:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224953 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 00:05:09 -0000 Author: zack Date: Thu Aug 18 00:05:09 2011 New Revision: 224953 URL: http://svn.freebsd.org/changeset/base/224953 Log: MFC r224637: Fix an NFS server issue where it was not correctly setting the eof flag when a READ had hit the end of the file. Also, clean up some cruft in the code. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Wed Aug 17 23:59:55 2011 (r224952) +++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Thu Aug 18 00:05:09 2011 (r224953) @@ -620,7 +620,7 @@ nfsrvd_read(struct nfsrv_descript *nd, _ vnode_t vp, NFSPROC_T *p, struct nfsexstuff *exp) { u_int32_t *tl; - int error = 0, cnt, len, getret = 1, reqlen, eof = 0; + int error = 0, cnt, getret = 1, reqlen, eof = 0; mbuf_t m2, m3; struct nfsvattr nva; off_t off = 0x0; @@ -714,11 +714,11 @@ nfsrvd_read(struct nfsrv_descript *nd, _ eof = 1; } else if (reqlen == 0) cnt = 0; - else if ((off + reqlen) > nva.na_size) + else if ((off + reqlen) >= nva.na_size) { cnt = nva.na_size - off; - else + eof = 1; + } else cnt = reqlen; - len = NFSM_RNDUP(cnt); m3 = NULL; if (cnt > 0) { nd->nd_repstat = nfsvno_read(vp, off, cnt, nd->nd_cred, p, @@ -748,7 +748,7 @@ nfsrvd_read(struct nfsrv_descript *nd, _ *tl++ = txdr_unsigned(cnt); } else NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - if (len < reqlen || eof) + if (eof) *tl++ = newnfs_true; else *tl++ = newnfs_false; From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 07:34:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C14251065675; Thu, 18 Aug 2011 07:34:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFCFD8FC1E; Thu, 18 Aug 2011 07:34:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7I7YBSb042385; Thu, 18 Aug 2011 07:34:11 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7I7YBVu042383; Thu, 18 Aug 2011 07:34:11 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108180734.p7I7YBVu042383@svn.freebsd.org> From: Martin Matuska Date: Thu, 18 Aug 2011 07:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224959 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 07:34:11 -0000 Author: mm Date: Thu Aug 18 07:34:11 2011 New Revision: 224959 URL: http://svn.freebsd.org/changeset/base/224959 Log: MFC r224605: Fix panic in zfs_read() if IO_SYNC flag supplied by checking for zfsvfs->z_log before calling zil_commit(). [1] Do not call zfs_read() from zfs_getextattr() with the IO_SYNC flag. Submitted by: Alexander Zagrebin [1] Reviewed by: pjd Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Aug 18 04:44:41 2011 (r224958) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Aug 18 07:34:11 2011 (r224959) @@ -618,7 +618,8 @@ zfs_read(vnode_t *vp, uio_t *uio, int io /* * If we're in FRSYNC mode, sync out this znode before reading it. */ - if (ioflag & FRSYNC || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) + if (zfsvfs->z_log && + (ioflag & FRSYNC || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)) zil_commit(zfsvfs->z_log, zp->z_id); /* @@ -6345,7 +6346,7 @@ vop_getextattr { if (error == 0) *ap->a_size = (size_t)va.va_size; } else if (ap->a_uio != NULL) - error = VOP_READ(vp, ap->a_uio, IO_UNIT | IO_SYNC, ap->a_cred); + error = VOP_READ(vp, ap->a_uio, IO_UNIT, ap->a_cred); VOP_UNLOCK(vp, 0); vn_close(vp, flags, ap->a_cred, td); From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 08:25:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74159106566B; Thu, 18 Aug 2011 08:25:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 620098FC08; Thu, 18 Aug 2011 08:25:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7I8PRpi045286; Thu, 18 Aug 2011 08:25:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7I8PRv6045281; Thu, 18 Aug 2011 08:25:27 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108180825.p7I8PRv6045281@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 18 Aug 2011 08:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224960 - stable/8/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 08:25:27 -0000 Author: hselasky Date: Thu Aug 18 08:25:27 2011 New Revision: 224960 URL: http://svn.freebsd.org/changeset/base/224960 Log: MFC r224777: Use synchronous device destruction instead of asynchronous. Modified: stable/8/sys/dev/usb/usb_dev.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_device.h stable/8/sys/dev/usb/usbdi.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/usb_dev.c ============================================================================== --- stable/8/sys/dev/usb/usb_dev.c Thu Aug 18 07:34:11 2011 (r224959) +++ stable/8/sys/dev/usb/usb_dev.c Thu Aug 18 08:25:27 2011 (r224960) @@ -1648,7 +1648,6 @@ usb_fifo_attach(struct usb_device *udev, struct usb_fifo *f_rx; char devname[32]; uint8_t n; - struct usb_fs_privdata* pd; f_sc->fp[USB_FIFO_TX] = NULL; f_sc->fp[USB_FIFO_RX] = NULL; @@ -1746,22 +1745,10 @@ usb_fifo_attach(struct usb_device *udev, usb_alloc_symlink(devname); } - /* - * Initialize device private data - this is used to find the - * actual USB device itself. - */ - pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, M_WAITOK | M_ZERO); - pd->bus_index = device_get_unit(udev->bus->bdev); - pd->dev_index = udev->device_index; - pd->ep_addr = -1; /* not an endpoint */ - pd->fifo_index = f_tx->fifo_index & f_rx->fifo_index; - pd->mode = FREAD|FWRITE; - - /* Now, create the device itself */ - f_sc->dev = make_dev(&usb_devsw, 0, uid, gid, mode, - "%s", devname); - /* XXX setting si_drv1 and creating the device is not atomic! */ - f_sc->dev->si_drv1 = pd; + /* Create the device */ + f_sc->dev = usb_make_dev(udev, devname, -1, + f_tx->fifo_index & f_rx->fifo_index, + FREAD|FWRITE, uid, gid, mode); } DPRINTFN(2, "attached %p/%p\n", f_tx, f_rx); @@ -1814,12 +1801,6 @@ usb_fifo_free_buffer(struct usb_fifo *f) bzero(&f->used_q, sizeof(f->used_q)); } -static void -usb_fifo_cleanup(void* ptr) -{ - free(ptr, M_USBDEV); -} - void usb_fifo_detach(struct usb_fifo_sc *f_sc) { @@ -1832,11 +1813,9 @@ usb_fifo_detach(struct usb_fifo_sc *f_sc f_sc->fp[USB_FIFO_TX] = NULL; f_sc->fp[USB_FIFO_RX] = NULL; - if (f_sc->dev != NULL) { - destroy_dev_sched_cb(f_sc->dev, - usb_fifo_cleanup, f_sc->dev->si_drv1); - f_sc->dev = NULL; - } + usb_destroy_dev(f_sc->dev); + + f_sc->dev = NULL; DPRINTFN(2, "detached %p\n", f_sc); } Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Thu Aug 18 07:34:11 2011 (r224959) +++ stable/8/sys/dev/usb/usb_device.c Thu Aug 18 08:25:27 2011 (r224960) @@ -102,10 +102,8 @@ static void usb_notify_addq(const char * #endif #if USB_HAVE_UGEN static void usb_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t); -static struct cdev *usb_make_dev(struct usb_device *, int, int); static void usb_cdev_create(struct usb_device *); static void usb_cdev_free(struct usb_device *); -static void usb_cdev_cleanup(void *); #endif /* This variable is global to allow easy access to it: */ @@ -1626,10 +1624,12 @@ usb_alloc_device(device_t parent_dev, st LIST_INIT(&udev->pd_list); /* Create the control endpoint device */ - udev->ctrl_dev = usb_make_dev(udev, 0, FREAD|FWRITE); + udev->ctrl_dev = usb_make_dev(udev, NULL, 0, 0, + FREAD|FWRITE, UID_ROOT, GID_OPERATOR, 0600); /* Create a link from /dev/ugenX.X to the default endpoint */ - make_dev_alias(udev->ctrl_dev, "%s", udev->ugen_name); + if (udev->ctrl_dev != NULL) + make_dev_alias(udev->ctrl_dev->cdev, "%s", udev->ugen_name); #endif /* Initialise device */ if (bus->methods->device_init != NULL) { @@ -1884,11 +1884,12 @@ done: } #if USB_HAVE_UGEN -static struct cdev * -usb_make_dev(struct usb_device *udev, int ep, int mode) +struct usb_fs_privdata * +usb_make_dev(struct usb_device *udev, const char *devname, int ep, + int fi, int rwmode, uid_t uid, gid_t gid, int mode) { struct usb_fs_privdata* pd; - char devname[20]; + char buffer[32]; /* Store information to locate ourselves again later */ pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, @@ -1896,16 +1897,39 @@ usb_make_dev(struct usb_device *udev, in pd->bus_index = device_get_unit(udev->bus->bdev); pd->dev_index = udev->device_index; pd->ep_addr = ep; - pd->mode = mode; + pd->fifo_index = fi; + pd->mode = rwmode; /* Now, create the device itself */ - snprintf(devname, sizeof(devname), "%u.%u.%u", - pd->bus_index, pd->dev_index, pd->ep_addr); - pd->cdev = make_dev(&usb_devsw, 0, UID_ROOT, - GID_OPERATOR, 0600, USB_DEVICE_DIR "/%s", devname); + if (devname == NULL) { + devname = buffer; + snprintf(buffer, sizeof(buffer), USB_DEVICE_DIR "/%u.%u.%u", + pd->bus_index, pd->dev_index, pd->ep_addr); + } + + pd->cdev = make_dev(&usb_devsw, 0, uid, gid, mode, "%s", devname); + + if (pd->cdev == NULL) { + DPRINTFN(0, "Failed to create device %s\n", devname); + free(pd, M_USBDEV); + return (NULL); + } + + /* XXX setting si_drv1 and creating the device is not atomic! */ pd->cdev->si_drv1 = pd; - return (pd->cdev); + return (pd); +} + +void +usb_destroy_dev(struct usb_fs_privdata *pd) +{ + if (pd == NULL) + return; + + destroy_dev(pd->cdev); + + free(pd, M_USBDEV); } static void @@ -1915,7 +1939,6 @@ usb_cdev_create(struct usb_device *udev) struct usb_endpoint_descriptor *ed; struct usb_descriptor *desc; struct usb_fs_privdata* pd; - struct cdev *dev; int inmode, outmode, inmask, outmask, mode; uint8_t ep; @@ -1957,14 +1980,16 @@ usb_cdev_create(struct usb_device *udev) /* Create all available endpoints except EP0 */ for (ep = 1; ep < 16; ep++) { - mode = inmask & (1 << ep) ? inmode : 0; - mode |= outmask & (1 << ep) ? outmode : 0; + mode = (inmask & (1 << ep)) ? inmode : 0; + mode |= (outmask & (1 << ep)) ? outmode : 0; if (mode == 0) continue; /* no IN or OUT endpoint */ - dev = usb_make_dev(udev, ep, mode); - pd = dev->si_drv1; - LIST_INSERT_HEAD(&udev->pd_list, pd, pd_next); + pd = usb_make_dev(udev, NULL, ep, 0, + mode, UID_ROOT, GID_OPERATOR, 0600); + + if (pd != NULL) + LIST_INSERT_HEAD(&udev->pd_list, pd, pd_next); } } @@ -1972,25 +1997,16 @@ static void usb_cdev_free(struct usb_device *udev) { struct usb_fs_privdata* pd; - struct cdev* pcdev; DPRINTFN(2, "Freeing device nodes\n"); while ((pd = LIST_FIRST(&udev->pd_list)) != NULL) { KASSERT(pd->cdev->si_drv1 == pd, ("privdata corrupt")); - pcdev = pd->cdev; - pd->cdev = NULL; LIST_REMOVE(pd, pd_next); - if (pcdev != NULL) - destroy_dev_sched_cb(pcdev, usb_cdev_cleanup, pd); - } -} -static void -usb_cdev_cleanup(void* arg) -{ - free(arg, M_USBDEV); + usb_destroy_dev(pd); + } } #endif @@ -2046,8 +2062,7 @@ usb_free_device(struct usb_device *udev, } mtx_unlock(&usb_ref_lock); - destroy_dev_sched_cb(udev->ctrl_dev, usb_cdev_cleanup, - udev->ctrl_dev->si_drv1); + usb_destroy_dev(udev->ctrl_dev); #endif if (udev->flags.usb_mode == USB_MODE_DEVICE) { Modified: stable/8/sys/dev/usb/usb_device.h ============================================================================== --- stable/8/sys/dev/usb/usb_device.h Thu Aug 18 07:34:11 2011 (r224959) +++ stable/8/sys/dev/usb/usb_device.h Thu Aug 18 08:25:27 2011 (r224960) @@ -29,6 +29,7 @@ struct usb_symlink; /* UGEN */ struct usb_device; /* linux compat */ +struct usb_fs_privdata; #define USB_CTRL_XFER_MAX 2 @@ -135,7 +136,7 @@ struct usb_device { #if USB_HAVE_UGEN struct usb_fifo *fifo[USB_FIFO_MAX]; struct usb_symlink *ugen_symlink; /* our generic symlink */ - struct cdev *ctrl_dev; /* Control Endpoint 0 device node */ + struct usb_fs_privdata *ctrl_dev; /* Control Endpoint 0 device node */ LIST_HEAD(,usb_fs_privdata) pd_list; char ugen_name[20]; /* name of ugenX.X device */ #endif @@ -202,6 +203,11 @@ struct usb_device *usb_alloc_device(devi struct usb_device *parent_hub, uint8_t depth, uint8_t port_index, uint8_t port_no, enum usb_dev_speed speed, enum usb_hc_mode mode); +#if USB_HAVE_UGEN +struct usb_fs_privdata *usb_make_dev(struct usb_device *, const char *, + int, int, int, uid_t, gid_t, int); +void usb_destroy_dev(struct usb_fs_privdata *); +#endif usb_error_t usb_probe_and_attach(struct usb_device *udev, uint8_t iface_index); void usb_detach_device(struct usb_device *, uint8_t, uint8_t); Modified: stable/8/sys/dev/usb/usbdi.h ============================================================================== --- stable/8/sys/dev/usb/usbdi.h Thu Aug 18 07:34:11 2011 (r224959) +++ stable/8/sys/dev/usb/usbdi.h Thu Aug 18 08:25:27 2011 (r224960) @@ -37,6 +37,7 @@ struct usb_page_search; struct usb_process; struct usb_proc_msg; struct usb_mbuf; +struct usb_fs_privdata; struct mbuf; typedef enum { /* keep in sync with usb_errstr_table */ @@ -449,7 +450,7 @@ struct usb_fifo_methods { struct usb_fifo_sc { struct usb_fifo *fp[2]; - struct cdev* dev; + struct usb_fs_privdata *dev; }; const char *usbd_errstr(usb_error_t error); From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 08:32:40 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B551106564A; Thu, 18 Aug 2011 08:32:40 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id BFAE68FC08; Thu, 18 Aug 2011 08:32:39 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id 343965E00; Thu, 18 Aug 2011 08:13:36 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id p7I8DZkn067026; Thu, 18 Aug 2011 08:13:36 GMT (envelope-from phk@phk.freebsd.dk) To: Robert Watson From: "Poul-Henning Kamp" In-Reply-To: Your message of "Wed, 17 Aug 2011 21:03:11 +0100." Content-Type: text/plain; charset=ISO-8859-1 Date: Thu, 18 Aug 2011 08:13:35 +0000 Message-ID: <67025.1313655215@critter.freebsd.dk> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222015 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 08:32:40 -0000 In message , Robert Wats on writes: >On Tue, 17 May 2011, Poul-Henning Kamp wrote: > >> + if ((s->s_flags & SBUF_AUTOEXTEND) == 0) { >> + KASSERT(s->s_size > 1, >> + ("attempt to create a too small sbuf")); >> + } > >This change turns out to cause a kernel panic during fuzzing of >mac_proc_get(2). Feel free to take it out, it probably is more of an EDOOFUS kind of situation than a KASSERT situation. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 13:33:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D322106566B; Thu, 18 Aug 2011 13:33:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DB658FC19; Thu, 18 Aug 2011 13:33:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7IDXZhG059094; Thu, 18 Aug 2011 13:33:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7IDXYoq059092; Thu, 18 Aug 2011 13:33:34 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108181333.p7IDXYoq059092@svn.freebsd.org> From: Alexander Motin Date: Thu, 18 Aug 2011 13:33:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224967 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 13:33:35 -0000 Author: mav Date: Thu Aug 18 13:33:34 2011 New Revision: 224967 URL: http://svn.freebsd.org/changeset/base/224967 Log: Fix headphones pin configuration on Lenovo B450 laptop. Submitted by: "Sergey V. Dyatko" Approved by: re (kib) Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Thu Aug 18 13:00:41 2011 (r224966) +++ head/sys/dev/sound/pci/hda/hdac.c Thu Aug 18 13:33:34 2011 (r224967) @@ -295,6 +295,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define LENOVO_VENDORID 0x17aa #define LENOVO_3KN100_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x2066) #define LENOVO_3KN200_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x384e) +#define LENOVO_B450_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x3a0d) #define LENOVO_TCA55_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x1015) #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) @@ -2582,6 +2583,13 @@ hdac_widget_pin_getconfig(struct hdac_wi break; } } + } else if (id == HDA_CODEC_CX20561 && + sc->pci_subvendor == LENOVO_B450_SUBVENDOR) { + switch (nid) { + case 22: + patch = "as=1 seq=15"; + break; + } } if (patch != NULL) From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 16:00:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F595106564A; Thu, 18 Aug 2011 16:00:33 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EADF8FC13; Thu, 18 Aug 2011 16:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7IG0X8R063890; Thu, 18 Aug 2011 16:00:33 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7IG0X40063888; Thu, 18 Aug 2011 16:00:33 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201108181600.p7IG0X40063888@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 18 Aug 2011 16:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224972 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 16:00:33 -0000 Author: nwhitehorn Date: Thu Aug 18 16:00:32 2011 New Revision: 224972 URL: http://svn.freebsd.org/changeset/base/224972 Log: Fix a bug that prevented docsinstall from being able to use DNS in most cases and provide a better error handling mechanism during package installation. Approved by: re (kib) Modified: head/usr.sbin/bsdinstall/scripts/docsinstall Modified: head/usr.sbin/bsdinstall/scripts/docsinstall ============================================================================== --- head/usr.sbin/bsdinstall/scripts/docsinstall Thu Aug 18 15:31:31 2011 (r224971) +++ head/usr.sbin/bsdinstall/scripts/docsinstall Thu Aug 18 16:00:32 2011 (r224972) @@ -59,11 +59,21 @@ NB: This requires a working, configured test $? -eq 0 || exit 0 exec 3>&- +# Let pkg_add be able to use name servers +cp ${BSDINSTALL_TMPETC}/resolv.conf ${BSDINSTALL_CHROOT}/etc + +error() { + dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox \ + "Could not install package $1 (`tail -n 1 ${BSDINSTALL_LOG}`)" 0 0 + exit 1 +} + + clear echo "FreeBSD Installer" echo "========================" echo for i in $DOCS; do - pkg_add -C ${BSDINSTALL_CHROOT} -r ${i}-freebsd-doc + pkg_add -C ${BSDINSTALL_CHROOT} -r ${i}-freebsd-doc || error $i-freebsd-doc done From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 16:07:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED74A1065672; Thu, 18 Aug 2011 16:07:41 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD8248FC16; Thu, 18 Aug 2011 16:07:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7IG7fZQ064125; Thu, 18 Aug 2011 16:07:41 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7IG7fIv064123; Thu, 18 Aug 2011 16:07:41 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201108181607.p7IG7fIv064123@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 18 Aug 2011 16:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224973 - head/sys/dev/mps X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 16:07:42 -0000 Author: ken Date: Thu Aug 18 16:07:41 2011 New Revision: 224973 URL: http://svn.freebsd.org/changeset/base/224973 Log: Set the max_lun field in the path inquiry CCB for the mps(4) driver to 8. This allows LUNs greater than 0 to be probed. The value can be increased later if need be. Approved by: re (kib) Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Thu Aug 18 16:00:32 2011 (r224972) +++ head/sys/dev/mps/mps_sas.c Thu Aug 18 16:07:41 2011 (r224973) @@ -925,7 +925,7 @@ mpssas_action(struct cam_sim *sim, union cpi->hba_misc = PIM_NOBUSRESET; cpi->hba_eng_cnt = 0; cpi->max_target = sassc->sc->facts->MaxTargets - 1; - cpi->max_lun = 0; + cpi->max_lun = 8; cpi->initiator_id = 255; strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "LSILogic", HBA_IDLEN); From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 16:54:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79B3B1065670; Thu, 18 Aug 2011 16:54:04 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69C1B8FC0A; Thu, 18 Aug 2011 16:54:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7IGs4fQ065739; Thu, 18 Aug 2011 16:54:04 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7IGs4SZ065737; Thu, 18 Aug 2011 16:54:04 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201108181654.p7IGs4SZ065737@svn.freebsd.org> From: Sean Bruno Date: Thu, 18 Aug 2011 16:54:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224978 - head/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 16:54:04 -0000 Author: sbruno Date: Thu Aug 18 16:54:04 2011 New Revision: 224978 URL: http://svn.freebsd.org/changeset/base/224978 Log: Allow release generation from a WORLDDIR that is not /usr/src PR: misc/159666 Submitted by: Test Rat Reviewed by: Nathan Whitehorn Approved by: re (kib) Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Thu Aug 18 16:45:23 2011 (r224977) +++ head/release/Makefile Thu Aug 18 16:54:04 2011 (r224978) @@ -66,7 +66,7 @@ base.txz: -mkdir ${DISTDIR} cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${DISTDIR} # Set up mergemaster root database - sh ${.CURDIR}/scripts/mm-mtree.sh -F \ + sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \ "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${DISTDIR}/base" # Package all components cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${DISTDIR} From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 22:20:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC80D106566C; Thu, 18 Aug 2011 22:20:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCD148FC1E; Thu, 18 Aug 2011 22:20:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7IMKjDR075717; Thu, 18 Aug 2011 22:20:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7IMKjoB075715; Thu, 18 Aug 2011 22:20:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201108182220.p7IMKjoB075715@svn.freebsd.org> From: John Baldwin Date: Thu, 18 Aug 2011 22:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224986 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 22:20:46 -0000 Author: jhb Date: Thu Aug 18 22:20:45 2011 New Revision: 224986 URL: http://svn.freebsd.org/changeset/base/224986 Log: One of the general principles of the sysctl(3) API is that a user can query the needed size for a sysctl result by passing in a NULL old pointer and a valid oldsize. The kern.proc.args sysctl handler broke this assumption by not calling SYSCTL_OUT() if the old pointer was NULL. Approved by: re (kib) MFC after: 3 days Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Thu Aug 18 18:15:59 2011 (r224985) +++ head/sys/kern/kern_proc.c Thu Aug 18 22:20:45 2011 (r224986) @@ -1391,7 +1391,7 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARG pa = p->p_args; pargs_hold(pa); PROC_UNLOCK(p); - if (req->oldptr != NULL && pa != NULL) + if (pa != NULL) error = SYSCTL_OUT(req, pa->ar_args, pa->ar_length); pargs_drop(pa); if (error != 0 || req->newptr == NULL) From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 22:51:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2DC21065670; Thu, 18 Aug 2011 22:51:31 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37CD58FC14; Thu, 18 Aug 2011 22:51:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7IMpVvs076708; Thu, 18 Aug 2011 22:51:31 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7IMpUir076690; Thu, 18 Aug 2011 22:51:30 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108182251.p7IMpUir076690@svn.freebsd.org> From: Jonathan Anderson Date: Thu, 18 Aug 2011 22:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224987 - in head: lib/libc/sys sys/compat/linux sys/conf sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 22:51:31 -0000 Author: jonathan Date: Thu Aug 18 22:51:30 2011 New Revision: 224987 URL: http://svn.freebsd.org/changeset/base/224987 Log: Add experimental support for process descriptors A "process descriptor" file descriptor is used to manage processes without using the PID namespace. This is required for Capsicum's Capability Mode, where the PID namespace is unavailable. New system calls pdfork(2) and pdkill(2) offer the functional equivalents of fork(2) and kill(2). pdgetpid(2) allows querying the PID of the remote process for debugging purposes. The currently-unimplemented pdwait(2) will, in the future, allow querying rusage/exit status. In the interim, poll(2) may be used to check (and wait for) process termination. When a process is referenced by a process descriptor, it does not issue SIGCHLD to the parent, making it suitable for use in libraries---a common scenario when using library compartmentalisation from within large applications (such as web browsers). Some observers may note a similarity to Mach task ports; process descriptors provide a subset of this behaviour, but in a UNIX style. This feature is enabled by "options PROCDESC", but as with several other Capsicum kernel features, is not enabled by default in GENERIC 9.0. Reviewed by: jhb, kib Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Added: head/lib/libc/sys/pdfork.2 (contents, props changed) head/sys/kern/sys_procdesc.c (contents, props changed) head/sys/sys/procdesc.h (contents, props changed) Modified: head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/lib/libc/sys/cap_new.2 head/sys/compat/linux/linux_fork.c head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/kern/capabilities.conf head/sys/kern/init_main.c head/sys/kern/kern_descrip.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_kthread.c head/sys/kern/kern_sig.c head/sys/kern/syscalls.master head/sys/sys/capability.h head/sys/sys/file.h head/sys/sys/proc.h head/sys/sys/unistd.h head/sys/sys/user.h Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Thu Aug 18 22:20:45 2011 (r224986) +++ head/lib/libc/sys/Makefile.inc Thu Aug 18 22:51:30 2011 (r224987) @@ -96,7 +96,7 @@ MAN+= abort2.2 accept.2 access.2 acct.2 mq_setattr.2 \ msgctl.2 msgget.2 msgrcv.2 msgsnd.2 \ msync.2 munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 \ - pathconf.2 pipe.2 poll.2 posix_fallocate.2 posix_openpt.2 profil.2 \ + pathconf.2 pdfork.2 pipe.2 poll.2 posix_fallocate.2 posix_openpt.2 profil.2 \ pselect.2 ptrace.2 quotactl.2 \ read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \ rtprio.2 @@ -178,6 +178,9 @@ MLINKS+=ntp_adjtime.2 ntp_gettime.2 MLINKS+=open.2 openat.2 MLINKS+=pathconf.2 fpathconf.2 MLINKS+=pathconf.2 lpathconf.2 +MLINKS+=pdfork.2 pdgetpid.2\ + pdfork.2 pdkill.2 \ + pdfork.2 pdwait4.2 MLINKS+=read.2 pread.2 read.2 preadv.2 read.2 readv.2 MLINKS+=readlink.2 readlinkat.2 MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2 Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Thu Aug 18 22:20:45 2011 (r224986) +++ head/lib/libc/sys/Symbol.map Thu Aug 18 22:51:30 2011 (r224987) @@ -366,6 +366,9 @@ FBSD_1.2 { cap_new; cap_getrights; getloginclass; + pdfork; + pdgetpid; + pdkill; posix_fallocate; rctl_get_racct; rctl_get_rules; Modified: head/lib/libc/sys/cap_new.2 ============================================================================== --- head/lib/libc/sys/cap_new.2 Thu Aug 18 22:20:45 2011 (r224986) +++ head/lib/libc/sys/cap_new.2 Thu Aug 18 22:51:30 2011 (r224987) @@ -260,7 +260,7 @@ Permit .Xr pdkill 2 . .It Dv CAP_PDWAIT Permit -.Xr pdwait 2 . +.Xr pdwait4 2 . .It Dv CAP_PEELOFF Permit .Xr sctp_peeloff 2 . @@ -429,7 +429,7 @@ argument is not a capability. .Xr openat 2 , .Xr pdgetpid 2 , .Xr pdkill 2 , -.Xr pdwait 2 , +.Xr pdwait4 2 , .Xr pipe 2 , .Xr poll 2 , .Xr pread 2 , Added: head/lib/libc/sys/pdfork.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/pdfork.2 Thu Aug 18 22:51:30 2011 (r224987) @@ -0,0 +1,182 @@ +.\" +.\" Copyright (c) 2009-2010 Robert N. M. Watson +.\" All rights reserved. +.\" +.\" This software was developed at the University of Cambridge Computer +.\" Laboratory with support from a grant from Google, Inc. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 16, 2011 +.Dt PDFORK 2 +.Os +.Sh NAME +.Nm pdfork , +.Nm pdgetpid , +.Nm pdkill , +.Nm pdwait4 +.Nd System calls to manage process descriptors +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/procdesc.h +.Ft int +.Fn pdfork "int *fdp" "int flags" +.Ft int +.Fn pdgetpid "int fd" "pid_t *pidp" +.Ft int +.Fn pdkill "int fd" "int signum" +.Ft int +.Fn pdwait4 "int fd" "int *status" "int options" "struct rusage *rusage" +.Sh DESCRIPTION +Process descriptors are special file descriptors that represent processes, +and are created using +.Fn pdfork , +a variant of +.Xr fork 2 , +which, if successful, returns a process descriptor in the integer pointed to +by +.Fa pidp . +Processes created via +.Fn pdfork +will not cause +.Dv SIGCHLD +on termination. +.Fn pdfork +can accept the flags: +.Bl -tag -width ".Dv PD_DAEMON" +.It Dv PD_DAEMON +Instead of the default terminate-on-close behaviour, allow the process to +live until it is explicitly killed with +.Xr kill 2 . +.Pp +This option is not permitted in Capsicum capability mode (see +.Xr cap_enter 2 ) . +.El +.Pp +.Fn pdgetpid +queries the process ID (PID) if the process descriptor +.Fa fd . +.Pp +.Fn pdkill +is functionally identical to +.Xr kill 2 , +except that it accepts a process descriptor, +.Fa fd , +rather than a PID. +.Pp +.Fn pdwait4 +behaves identially to +.Xr wait4 2 , +but operates with respect to a process descriptor argument rather than a PID. +.Pp +The following system calls also have effects specific to process descriptors: +.Pp +.Xr fstat 2 +queries status of a process descriptor; currently only the +.Fa st_mode , +.Fa st_birthtime , +.Fa st_atime , +.Fa st_ctime +and +.Fa st_mtime +fields are defined. If the owner read, write, and execute bits are set then the +process represented by the process descriptor is still alive. +.Pp +.Xr poll 2 +and +.Xr select 2 +allow waiting for process state transitions; currently only +.Dv POLLHUP +is defined, and will be raised when the process dies. +.Pp +.Xr close 2 +will close the process descriptor unless +.Dv PD_DAEMON +is set; if the process is still alive and this is +the last reference to the process descriptor, the process will be terminated +with the signal +.Dv SIGKILL . +.Sh RETURN VALUES +.Fn pdfork +returns a PID, 0 or -1, as +.Xr fork 2 +does. +.Pp +.Fn pdgetpid +and +.Fn pdkill +return 0 on success and -1 on failure. +.Pp +.Fn pdwait4 +returns a PID on success and -1 on failure. +.Sh ERRORS +These functions may return the same error numbers as their PID-based equivalents +(e.g. +.Fn pdfork +may return the same error numbers as +.Xr fork 2 ) , +with the following additions: +.Bl -tag -width Er +.It Bq Er EINVAL +The signal number given to +.Fn pdkill +is invalid. +.It Bq Er ENOTCAPABLE +The process descriptor being operated on has insufficient rights (e.g. +.Dv CAP_PDKILL +for +.Fn pdkill ) . +.El +.Sh SEE ALSO +.Xr close 2 , +.Xr fork 2 , +.Xr fstat 2 , +.Xr kill 2 , +.Xr poll 2 , +.Xr wait4 2 +.Sh HISTORY +The +.Fn pdfork , +.Fn pdgetpid , +.Fn pdkill +and +.Fn pdwait4 +system calls first appeared in +.Fx 9.0 . +.Pp +Support for process descriptors mode was developed as part of the +.Tn TrustedBSD +Project. +.Sh AUTHORS +.An -nosplit +These functions and the capability facility were created by +.An "Robert N. M. Watson" Aq rwatson@FreeBSD.org +and +.An "Jonathan Anderson" Aq jonathan@FreeBSD.org +at the University of Cambridge Computer Laboratory with support from a grant +from Google, Inc. +.Sh BUGS +.Fn pdwait4 +has not yet been implemented. Modified: head/sys/compat/linux/linux_fork.c ============================================================================== --- head/sys/compat/linux/linux_fork.c Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/compat/linux/linux_fork.c Thu Aug 18 22:51:30 2011 (r224987) @@ -64,7 +64,8 @@ linux_fork(struct thread *td, struct lin printf(ARGS(fork, "")); #endif - if ((error = fork1(td, RFFDG | RFPROC | RFSTOPPED, 0, &p2)) != 0) + if ((error = fork1(td, RFFDG | RFPROC | RFSTOPPED, 0, &p2, NULL, 0)) + != 0) return (error); td->td_retval[0] = p2->p_pid; @@ -100,7 +101,8 @@ linux_vfork(struct thread *td, struct li #endif /* Exclude RFPPWAIT */ - if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFSTOPPED, 0, &p2)) != 0) + if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFSTOPPED, 0, &p2, + NULL, 0)) != 0) return (error); td->td_retval[0] = p2->p_pid; @@ -190,7 +192,7 @@ linux_clone(struct thread *td, struct li if (args->parent_tidptr == NULL) return (EINVAL); - error = fork1(td, ff, 0, &p2); + error = fork1(td, ff, 0, &p2, NULL, 0); if (error) return (error); Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/conf/NOTES Thu Aug 18 22:51:30 2011 (r224987) @@ -1159,6 +1159,9 @@ options MAC_TEST options CAPABILITIES # fine-grained rights on file descriptors options CAPABILITY_MODE # sandboxes with no global namespace access +# Support for process descriptors +options PROCDESC + ##################################################################### # CLOCK OPTIONS Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/conf/files Thu Aug 18 22:51:30 2011 (r224987) @@ -2412,6 +2412,7 @@ kern/subr_witness.c optional witness kern/sys_capability.c standard kern/sys_generic.c standard kern/sys_pipe.c standard +kern/sys_procdesc.c standard kern/sys_process.c standard kern/sys_socket.c standard kern/syscalls.c standard Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/conf/options Thu Aug 18 22:51:30 2011 (r224987) @@ -149,6 +149,7 @@ PPC_DEBUG opt_ppc.h PPC_PROBE_CHIPSET opt_ppc.h PPS_SYNC opt_ntp.h PREEMPTION opt_sched.h +PROCDESC opt_procdesc.h QUOTA SCHED_4BSD opt_sched.h SCHED_STATS opt_sched.h Modified: head/sys/kern/capabilities.conf ============================================================================== --- head/sys/kern/capabilities.conf Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/kern/capabilities.conf Thu Aug 18 22:51:30 2011 (r224987) @@ -475,7 +475,7 @@ openbsd_poll pdfork pdgetpid pdkill -pdwait4 +#pdwait4 # not yet implemented ## ## Allow pipe(2). Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/kern/init_main.c Thu Aug 18 22:51:30 2011 (r224987) @@ -790,7 +790,8 @@ create_init(const void *udata __unused) struct ucred *newcred, *oldcred; int error; - error = fork1(&thread0, RFFDG | RFPROC | RFSTOPPED, 0, &initproc); + error = fork1(&thread0, RFFDG | RFPROC | RFSTOPPED, 0, &initproc, + NULL, 0); if (error) panic("cannot fork init: %d\n", error); KASSERT(initproc->p_pid == 1, ("create_init: initproc->p_pid != 1")); Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/kern/kern_descrip.c Thu Aug 18 22:51:30 2011 (r224987) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_ddb.h" #include "opt_ktrace.h" +#include "opt_procdesc.h" #include #include @@ -65,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -120,6 +122,8 @@ static int fill_vnode_info(struct vnode static int fill_socket_info(struct socket *so, struct kinfo_file *kif); static int fill_pts_info(struct tty *tp, struct kinfo_file *kif); static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif); +static int fill_procdesc_info(struct procdesc *pdp, + struct kinfo_file *kif); /* * A process is initially started out with NDFILE descriptors stored within @@ -3056,6 +3060,12 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE tp = fp->f_data; break; +#ifdef PROCDESC + case DTYPE_PROCDESC: + kif->kf_type = KF_TYPE_PROCDESC; + break; +#endif + default: kif->kf_type = KF_TYPE_UNKNOWN; break; @@ -3218,6 +3228,9 @@ export_fd_for_sysctl(void *data, int typ case KF_TYPE_PTS: error = fill_pts_info((struct tty *)data, kif); break; + case KF_TYPE_PROCDESC: + error = fill_procdesc_info((struct procdesc *)data, kif); + break; default: error = 0; } @@ -3391,6 +3404,13 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER data = fp->f_data; break; +#ifdef PROCDESC + case DTYPE_PROCDESC: + type = KF_TYPE_PROCDESC; + data = fp->f_data; + break; +#endif + default: type = KF_TYPE_UNKNOWN; break; @@ -3586,6 +3606,16 @@ fill_pipe_info(struct pipe *pi, struct k return (0); } +static int +fill_procdesc_info(struct procdesc *pdp, struct kinfo_file *kif) +{ + + if (pdp == NULL) + return (1); + kif->kf_un.kf_proc.kf_pid = pdp->pd_pid; + return (0); +} + static SYSCTL_NODE(_kern_proc, KERN_PROC_FILEDESC, filedesc, CTLFLAG_RD, sysctl_kern_proc_filedesc, "Process filedesc entries"); Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/kern/kern_exit.c Thu Aug 18 22:51:30 2011 (r224987) @@ -40,16 +40,19 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_kdtrace.h" #include "opt_ktrace.h" +#include "opt_procdesc.h" #include #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -461,39 +464,54 @@ exit1(struct thread *td, int rv) knlist_clear(&p->p_klist, 1); /* - * Notify parent that we're gone. If parent has the PS_NOCLDWAIT - * flag set, or if the handler is set to SIG_IGN, notify process - * 1 instead (and hope it will handle this situation). + * If this is a process with a descriptor, we may not need to deliver + * a signal to the parent. proctree_lock is held over + * procdesc_exit() to serialize concurrent calls to close() and + * exit(). */ - PROC_LOCK(p->p_pptr); - mtx_lock(&p->p_pptr->p_sigacts->ps_mtx); - if (p->p_pptr->p_sigacts->ps_flag & (PS_NOCLDWAIT | PS_CLDSIGIGN)) { - struct proc *pp; - - mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx); - pp = p->p_pptr; - PROC_UNLOCK(pp); - proc_reparent(p, initproc); - p->p_sigparent = SIGCHLD; - PROC_LOCK(p->p_pptr); - +#ifdef PROCDESC + if (p->p_procdesc == NULL || procdesc_exit(p)) { +#endif /* - * Notify parent, so in case he was wait(2)ing or - * executing waitpid(2) with our pid, he will - * continue. + * Notify parent that we're gone. If parent has the + * PS_NOCLDWAIT flag set, or if the handler is set to SIG_IGN, + * notify process 1 instead (and hope it will handle this + * situation). */ - wakeup(pp); + PROC_LOCK(p->p_pptr); + mtx_lock(&p->p_pptr->p_sigacts->ps_mtx); + if (p->p_pptr->p_sigacts->ps_flag & + (PS_NOCLDWAIT | PS_CLDSIGIGN)) { + struct proc *pp; + + mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx); + pp = p->p_pptr; + PROC_UNLOCK(pp); + proc_reparent(p, initproc); + p->p_sigparent = SIGCHLD; + PROC_LOCK(p->p_pptr); + + /* + * Notify parent, so in case he was wait(2)ing or + * executing waitpid(2) with our pid, he will + * continue. + */ + wakeup(pp); + } else + mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx); + + if (p->p_pptr == initproc) + psignal(p->p_pptr, SIGCHLD); + else if (p->p_sigparent != 0) { + if (p->p_sigparent == SIGCHLD) + childproc_exited(p); + else /* LINUX thread */ + psignal(p->p_pptr, p->p_sigparent); + } +#ifdef PROCDESC } else - mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx); - - if (p->p_pptr == initproc) - psignal(p->p_pptr, SIGCHLD); - else if (p->p_sigparent != 0) { - if (p->p_sigparent == SIGCHLD) - childproc_exited(p); - else /* LINUX thread */ - psignal(p->p_pptr, p->p_sigparent); - } + PROC_LOCK(p->p_pptr); +#endif sx_xunlock(&proctree_lock); /* @@ -660,7 +678,7 @@ wait4(struct thread *td, struct wait_arg * rusage. Asserts and will release both the proctree_lock and the process * lock as part of its work. */ -static void +void proc_reap(struct thread *td, struct proc *p, int *status, int options, struct rusage *rusage) { @@ -722,6 +740,10 @@ proc_reap(struct thread *td, struct proc sx_xunlock(&allproc_lock); LIST_REMOVE(p, p_sibling); leavepgrp(p); +#ifdef PROCDESC + if (p->p_procdesc != NULL) + procdesc_reap(p); +#endif sx_xunlock(&proctree_lock); /* Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/kern/kern_fork.c Thu Aug 18 22:51:30 2011 (r224987) @@ -40,11 +40,13 @@ __FBSDID("$FreeBSD$"); #include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_kstack_pages.h" +#include "opt_procdesc.h" #include #include #include #include +#include #include #include #include @@ -55,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -104,7 +107,7 @@ fork(struct thread *td, struct fork_args int error; struct proc *p2; - error = fork1(td, RFFDG | RFPROC, 0, &p2); + error = fork1(td, RFFDG | RFPROC, 0, &p2, NULL, 0); if (error == 0) { td->td_retval[0] = p2->p_pid; td->td_retval[1] = 0; @@ -112,6 +115,34 @@ fork(struct thread *td, struct fork_args return (error); } +/* ARGUSED */ +int +pdfork(td, uap) + struct thread *td; + struct pdfork_args *uap; +{ +#ifdef PROCDESC + int error, fd; + struct proc *p2; + + /* + * It is necessary to return fd by reference because 0 is a valid file + * descriptor number, and the child needs to be able to distinguish + * itself from the parent using the return value. + */ + error = fork1(td, RFFDG | RFPROC | RFPROCDESC, 0, &p2, + &fd, uap->flags); + if (error == 0) { + td->td_retval[0] = p2->p_pid; + td->td_retval[1] = 0; + error = copyout(&fd, uap->fdp, sizeof(fd)); + } + return (error); +#else + return (ENOSYS); +#endif +} + /* ARGSUSED */ int vfork(struct thread *td, struct vfork_args *uap) @@ -124,7 +155,7 @@ vfork(struct thread *td, struct vfork_ar #else flags = RFFDG | RFPROC | RFPPWAIT | RFMEM; #endif - error = fork1(td, flags, 0, &p2); + error = fork1(td, flags, 0, &p2, NULL, 0); if (error == 0) { td->td_retval[0] = p2->p_pid; td->td_retval[1] = 0; @@ -143,7 +174,7 @@ rfork(struct thread *td, struct rfork_ar return (EINVAL); AUDIT_ARG_FFLAGS(uap->flags); - error = fork1(td, uap->flags, 0, &p2); + error = fork1(td, uap->flags, 0, &p2, NULL, 0); if (error == 0) { td->td_retval[0] = p2 ? p2->p_pid : 0; td->td_retval[1] = 0; @@ -337,7 +368,7 @@ fail: static void do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2, - struct vmspace *vm2) + struct vmspace *vm2, int pdflags) { struct proc *p1, *pptr; int p2_held, trypid; @@ -625,6 +656,16 @@ do_fork(struct thread *td, int flags, st p2->p_vmspace->vm_ssize); } +#ifdef PROCDESC + /* + * Associate the process descriptor with the process before anything + * can happen that might cause that process to need the descriptor. + * However, don't do this until after fork(2) can no longer fail. + */ + if (flags & RFPROCDESC) + procdesc_new(p2, pdflags); +#endif + /* * Both processes are set up, now check if any loadable modules want * to adjust anything. @@ -710,7 +751,8 @@ do_fork(struct thread *td, int flags, st } int -fork1(struct thread *td, int flags, int pages, struct proc **procp) +fork1(struct thread *td, int flags, int pages, struct proc **procp, + int *procdescp, int pdflags) { struct proc *p1; struct proc *newproc; @@ -721,6 +763,9 @@ fork1(struct thread *td, int flags, int int error; static int curfail; static struct timeval lastfail; +#ifdef PROCDESC + struct file *fp_procdesc = NULL; +#endif /* Check for the undefined or unimplemented flags. */ if ((flags & ~(RFFLAGS | RFTSIGFLAGS(RFTSIGMASK))) != 0) @@ -738,6 +783,18 @@ fork1(struct thread *td, int flags, int if ((flags & RFTSIGZMB) != 0 && (u_int)RFTSIGNUM(flags) > _SIG_MAXSIG) return (EINVAL); +#ifdef PROCDESC + if ((flags & RFPROCDESC) != 0) { + /* Can't not create a process yet get a process descriptor. */ + if ((flags & RFPROC) == 0) + return (EINVAL); + + /* Must provide a place to put a procdesc if creating one. */ + if (procdescp == NULL) + return (EINVAL); + } +#endif + p1 = td->td_proc; /* @@ -757,6 +814,25 @@ fork1(struct thread *td, int flags, int return (EAGAIN); #endif +#ifdef PROCDESC + /* + * If required, create a process descriptor in the parent first; we + * will abandon it if something goes wrong. We don't finit() until + * later. + */ + if (flags & RFPROCDESC) { + error = falloc(td, &fp_procdesc, procdescp, 0); + if (error != 0) { +#ifdef RACCT + PROC_LOCK(p1); + racct_sub(p1, RACCT_NPROC, 1); + PROC_UNLOCK(p1); +#endif + return (error); + } + } +#endif + mem_charged = 0; vm2 = NULL; if (pages == 0) @@ -868,12 +944,16 @@ fork1(struct thread *td, int flags, int PROC_UNLOCK(p1); } if (ok) { - do_fork(td, flags, newproc, td2, vm2); + do_fork(td, flags, newproc, td2, vm2, pdflags); /* * Return child proc pointer to parent. */ *procp = newproc; +#ifdef PROCDESC + if (flags & RFPROCDESC) + procdesc_finit(newproc->p_procdesc, fp_procdesc); +#endif return (0); } @@ -892,6 +972,10 @@ fail1: if (vm2 != NULL) vmspace_free(vm2); uma_zfree(proc_zone, newproc); +#ifdef PROCDESC + if (((flags & RFPROCDESC) != 0) && (fp_procdesc != NULL)) + fdrop(fp_procdesc, td); +#endif pause("fork", hz / 2); #ifdef RACCT PROC_LOCK(p1); Modified: head/sys/kern/kern_kthread.c ============================================================================== --- head/sys/kern/kern_kthread.c Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/kern/kern_kthread.c Thu Aug 18 22:51:30 2011 (r224987) @@ -88,7 +88,7 @@ kproc_create(void (*func)(void *), void panic("kproc_create called too soon"); error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags, - pages, &p2); + pages, &p2, NULL, 0); if (error) return error; Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Thu Aug 18 22:20:45 2011 (r224986) +++ head/sys/kern/kern_sig.c Thu Aug 18 22:51:30 2011 (r224987) @@ -41,12 +41,14 @@ __FBSDID("$FreeBSD$"); #include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_core.h" +#include "opt_procdesc.h" #include #include #include #include #include +#include #include #include #include @@ -59,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1698,6 +1701,34 @@ kill(struct thread *td, struct kill_args /* NOTREACHED */ } +int +pdkill(td, uap) + struct thread *td; + struct pdkill_args *uap; +{ +#ifdef PROCDESC + struct proc *p; + int error; + + AUDIT_ARG_SIGNUM(uap->signum); + AUDIT_ARG_FD(uap->fd); + if ((u_int)uap->signum > _SIG_MAXSIG) + return (EINVAL); + + error = procdesc_find(td, uap->fd, CAP_PDKILL, &p); + if (error) + return (error); + AUDIT_ARG_PROCESS(p); + error = p_cansignal(td, p, uap->signum); + if (error == 0 && uap->signum) + psignal(p, uap->signum); + PROC_UNLOCK(p); + return (error); +#else + return (ENOSYS); +#endif +} + #if defined(COMPAT_43) #ifndef _SYS_SYSPROTO_H_ struct okillpg_args { Added: head/sys/kern/sys_procdesc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/sys_procdesc.c Thu Aug 18 22:51:30 2011 (r224987) @@ -0,0 +1,524 @@ +/*- + * Copyright (c) 2009 Robert N. M. Watson + * All rights reserved. + * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/*- + * FreeBSD process descriptor facility. + * + * Some processes are represented by a file descriptor, which will be used in + * preference to signaling and pids for the purposes of process management, + * and is, in effect, a form of capability. When a process descriptor is + * used with a process, it ceases to be visible to certain traditional UNIX + * process facilities, such as waitpid(2). + * + * Some semantics: + * + * - At most one process descriptor will exist for any process, although + * references to that descriptor may be held from many processes (or even + * be in flight between processes over a local domain socket). + * - Last close on the process descriptor will terminate the process using + * SIGKILL and reparent it to init so that there's a process to reap it + * when it's done exiting. + * - If the process exits before the descriptor is closed, it will not + * generate SIGCHLD on termination, or be picked up by waitpid(). + * - The pdkill(2) system call may be used to deliver a signal to the process + * using its process descriptor. + * - The pdwait4(2) system call may be used to block (or not) on a process + * descriptor to collect termination information. + * + * Open questions: + * + * - How to handle ptrace(2)? + * - Will we want to add a pidtoprocdesc(2) system call to allow process + * descriptors to be created for processes without pfork(2)? + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_procdesc.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#ifdef PROCDESC + +FEATURE(process_descriptors, "Process Descriptors"); + +static uma_zone_t procdesc_zone; + +static fo_rdwr_t procdesc_read; +static fo_rdwr_t procdesc_write; +static fo_truncate_t procdesc_truncate; +static fo_ioctl_t procdesc_ioctl; +static fo_poll_t procdesc_poll; +static fo_kqfilter_t procdesc_kqfilter; +static fo_stat_t procdesc_stat; +static fo_close_t procdesc_close; +static fo_chmod_t procdesc_chmod; +static fo_chown_t procdesc_chown; + +static struct fileops procdesc_ops = { + .fo_read = procdesc_read, + .fo_write = procdesc_write, + .fo_truncate = procdesc_truncate, + .fo_ioctl = procdesc_ioctl, + .fo_poll = procdesc_poll, + .fo_kqfilter = procdesc_kqfilter, + .fo_stat = procdesc_stat, + .fo_close = procdesc_close, + .fo_chmod = procdesc_chmod, + .fo_chown = procdesc_chown, + .fo_flags = DFLAG_PASSABLE, +}; + +/* + * Initialize with VFS so that process descriptors are available along with + * other file descriptor types. As long as it runs before init(8) starts, + * there shouldn't be a problem. + */ +static void +procdesc_init(void *dummy __unused) +{ + + procdesc_zone = uma_zcreate("procdesc", sizeof(struct procdesc), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + if (procdesc_zone == NULL) + panic("procdesc_init: procdesc_zone not initialized"); +} +SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_ANY, procdesc_init, NULL); + +/* + * Return a locked process given a process descriptor, or ESRCH if it has + * died. + */ +int +procdesc_find(struct thread *td, int fd, cap_rights_t rights, + struct proc **p) +{ + struct procdesc *pd; + struct file *fp; + int error; + + error = fget(td, fd, rights, &fp); + if (error) + return (error); + if (fp->f_type != DTYPE_PROCDESC) { + error = EBADF; + goto out; + } + pd = fp->f_data; + sx_slock(&proctree_lock); + if (pd->pd_proc != NULL) { + *p = pd->pd_proc; + PROC_LOCK(*p); + } else + error = ESRCH; + sx_sunlock(&proctree_lock); +out: + fdrop(fp, td); + return (error); +} + +/* + * Function to be used by procstat(1) sysctls when returning procdesc + * information. + */ +pid_t +procdesc_pid(struct file *fp_procdesc) +{ + struct procdesc *pd; + + KASSERT(fp_procdesc->f_type == DTYPE_PROCDESC, + ("procdesc_pid: !procdesc")); + + pd = fp_procdesc->f_data; + return (pd->pd_pid); +} + +/* + * Retrieve the PID associated with a process descriptor. + */ +int +kern_pdgetpid(struct thread *td, int fd, cap_rights_t rights, pid_t *pidp) +{ + struct file *fp; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 23:08:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB626106564A; Thu, 18 Aug 2011 23:08:52 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAB638FC0C; Thu, 18 Aug 2011 23:08:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7IN8qrM077252; Thu, 18 Aug 2011 23:08:52 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7IN8q5N077245; Thu, 18 Aug 2011 23:08:52 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108182308.p7IN8q5N077245@svn.freebsd.org> From: Jonathan Anderson Date: Thu, 18 Aug 2011 23:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224988 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 23:08:52 -0000 Author: jonathan Date: Thu Aug 18 23:08:52 2011 New Revision: 224988 URL: http://svn.freebsd.org/changeset/base/224988 Log: Auto-generated system call code based on r224987. Approved by: re (implicit) Modified: head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Thu Aug 18 22:51:30 2011 (r224987) +++ head/sys/kern/init_sysent.c Thu Aug 18 23:08:52 2011 (r224988) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan + * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan */ #include "opt_compat.h" @@ -552,10 +552,10 @@ struct sysent sysent[] = { { AS(cap_getrights_args), (sy_call_t *)cap_getrights, AUE_CAP_GETRIGHTS, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 515 = cap_getrights */ { 0, (sy_call_t *)cap_enter, AUE_CAP_ENTER, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 516 = cap_enter */ { AS(cap_getmode_args), (sy_call_t *)cap_getmode, AUE_CAP_GETMODE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 517 = cap_getmode */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 518 = pdfork */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 519 = pdkill */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 520 = pdgetpid */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 521 = pdwait */ + { AS(pdfork_args), (sy_call_t *)pdfork, AUE_PDFORK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 518 = pdfork */ + { AS(pdkill_args), (sy_call_t *)pdkill, AUE_PDKILL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 519 = pdkill */ + { AS(pdgetpid_args), (sy_call_t *)pdgetpid, AUE_PDGETPID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 520 = pdgetpid */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 521 = pdwait4 */ { AS(pselect_args), (sy_call_t *)pselect, AUE_SELECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 522 = pselect */ { AS(getloginclass_args), (sy_call_t *)getloginclass, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 523 = getloginclass */ { AS(setloginclass_args), (sy_call_t *)setloginclass, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 524 = setloginclass */ Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Thu Aug 18 22:51:30 2011 (r224987) +++ head/sys/kern/syscalls.c Thu Aug 18 23:08:52 2011 (r224988) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan + * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan */ const char *syscallnames[] = { @@ -525,10 +525,10 @@ const char *syscallnames[] = { "cap_getrights", /* 515 = cap_getrights */ "cap_enter", /* 516 = cap_enter */ "cap_getmode", /* 517 = cap_getmode */ - "#518", /* 518 = pdfork */ - "#519", /* 519 = pdkill */ - "#520", /* 520 = pdgetpid */ - "#521", /* 521 = pdwait */ + "pdfork", /* 518 = pdfork */ + "pdkill", /* 519 = pdkill */ + "pdgetpid", /* 520 = pdgetpid */ + "#521", /* 521 = pdwait4 */ "pselect", /* 522 = pselect */ "getloginclass", /* 523 = getloginclass */ "setloginclass", /* 524 = setloginclass */ Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Thu Aug 18 22:51:30 2011 (r224987) +++ head/sys/kern/systrace_args.c Thu Aug 18 23:08:52 2011 (r224988) @@ -3124,6 +3124,30 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } + /* pdfork */ + case 518: { + struct pdfork_args *p = params; + uarg[0] = (intptr_t) p->fdp; /* int * */ + iarg[1] = p->flags; /* int */ + *n_args = 2; + break; + } + /* pdkill */ + case 519: { + struct pdkill_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->signum; /* int */ + *n_args = 2; + break; + } + /* pdgetpid */ + case 520: { + struct pdgetpid_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t) p->pidp; /* pid_t * */ + *n_args = 2; + break; + } /* pselect */ case 522: { struct pselect_args *p = params; @@ -8381,6 +8405,45 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* pdfork */ + case 518: + switch(ndx) { + case 0: + p = "int *"; + break; + case 1: + p = "int"; + break; + default: + break; + }; + break; + /* pdkill */ + case 519: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + default: + break; + }; + break; + /* pdgetpid */ + case 520: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "pid_t *"; + break; + default: + break; + }; + break; /* pselect */ case 522: switch(ndx) { Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Thu Aug 18 22:51:30 2011 (r224987) +++ head/sys/sys/syscall.h Thu Aug 18 23:08:52 2011 (r224988) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan + * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan */ #define SYS_syscall 0 @@ -434,6 +434,9 @@ #define SYS_cap_getrights 515 #define SYS_cap_enter 516 #define SYS_cap_getmode 517 +#define SYS_pdfork 518 +#define SYS_pdkill 519 +#define SYS_pdgetpid 520 #define SYS_pselect 522 #define SYS_getloginclass 523 #define SYS_setloginclass 524 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Thu Aug 18 22:51:30 2011 (r224987) +++ head/sys/sys/syscall.mk Thu Aug 18 23:08:52 2011 (r224988) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan +# created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan MIASM = \ syscall.o \ exit.o \ @@ -383,6 +383,9 @@ MIASM = \ cap_getrights.o \ cap_enter.o \ cap_getmode.o \ + pdfork.o \ + pdkill.o \ + pdgetpid.o \ pselect.o \ getloginclass.o \ setloginclass.o \ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Thu Aug 18 22:51:30 2011 (r224987) +++ head/sys/sys/sysproto.h Thu Aug 18 23:08:52 2011 (r224988) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 224066 2011-07-15 18:26:19Z jonathan + * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan */ #ifndef _SYS_SYSPROTO_H_ @@ -1671,6 +1671,18 @@ struct cap_enter_args { struct cap_getmode_args { char modep_l_[PADL_(u_int *)]; u_int * modep; char modep_r_[PADR_(u_int *)]; }; +struct pdfork_args { + char fdp_l_[PADL_(int *)]; int * fdp; char fdp_r_[PADR_(int *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; +struct pdkill_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)]; +}; +struct pdgetpid_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pidp_l_[PADL_(pid_t *)]; pid_t * pidp; char pidp_r_[PADR_(pid_t *)]; +}; struct pselect_args { char nd_l_[PADL_(int)]; int nd; char nd_r_[PADR_(int)]; char in_l_[PADL_(fd_set *)]; fd_set * in; char in_r_[PADR_(fd_set *)]; @@ -2085,6 +2097,9 @@ int cap_new(struct thread *, struct cap_ int cap_getrights(struct thread *, struct cap_getrights_args *); int cap_enter(struct thread *, struct cap_enter_args *); int cap_getmode(struct thread *, struct cap_getmode_args *); +int pdfork(struct thread *, struct pdfork_args *); +int pdkill(struct thread *, struct pdkill_args *); +int pdgetpid(struct thread *, struct pdgetpid_args *); int pselect(struct thread *, struct pselect_args *); int getloginclass(struct thread *, struct getloginclass_args *); int setloginclass(struct thread *, struct setloginclass_args *); @@ -2772,6 +2787,9 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_cap_getrights AUE_CAP_GETRIGHTS #define SYS_AUE_cap_enter AUE_CAP_ENTER #define SYS_AUE_cap_getmode AUE_CAP_GETMODE +#define SYS_AUE_pdfork AUE_PDFORK +#define SYS_AUE_pdkill AUE_PDKILL +#define SYS_AUE_pdgetpid AUE_PDGETPID #define SYS_AUE_pselect AUE_SELECT #define SYS_AUE_getloginclass AUE_NULL #define SYS_AUE_setloginclass AUE_NULL From owner-svn-src-all@FreeBSD.ORG Thu Aug 18 23:15:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C247106564A; Thu, 18 Aug 2011 23:15:04 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B1648FC0C; Thu, 18 Aug 2011 23:15:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7INF4g4077495; Thu, 18 Aug 2011 23:15:04 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7INF4FK077490; Thu, 18 Aug 2011 23:15:04 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108182315.p7INF4FK077490@svn.freebsd.org> From: Jonathan Anderson Date: Thu, 18 Aug 2011 23:15:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224989 - head/tools/regression/security/cap_test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 23:15:04 -0000 Author: jonathan Date: Thu Aug 18 23:15:04 2011 New Revision: 224989 URL: http://svn.freebsd.org/changeset/base/224989 Log: Test process descriptors. Ensure that process descriptors work as expected. We should be able to: - pdfork(), like regular fork(), but producing a process descriptor - pdgetpid() to convert a PD into a PID - pdkill() to send signals to a process identified by a PD Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Added: head/tools/regression/security/cap_test/cap_test_pdfork.c (contents, props changed) head/tools/regression/security/cap_test/cap_test_pdkill.c (contents, props changed) Modified: head/tools/regression/security/cap_test/Makefile head/tools/regression/security/cap_test/cap_test.c head/tools/regression/security/cap_test/cap_test.h Modified: head/tools/regression/security/cap_test/Makefile ============================================================================== --- head/tools/regression/security/cap_test/Makefile Thu Aug 18 23:08:52 2011 (r224988) +++ head/tools/regression/security/cap_test/Makefile Thu Aug 18 23:15:04 2011 (r224989) @@ -5,6 +5,8 @@ SRCS= cap_test.c \ cap_test_capmode.c \ cap_test_capabilities.c \ cap_test_fcntl.c \ + cap_test_pdfork.c \ + cap_test_pdkill.c \ cap_test_relative.c \ cap_test_sysctl.c \ Modified: head/tools/regression/security/cap_test/cap_test.c ============================================================================== --- head/tools/regression/security/cap_test/cap_test.c Thu Aug 18 23:08:52 2011 (r224988) +++ head/tools/regression/security/cap_test/cap_test.c Thu Aug 18 23:15:04 2011 (r224989) @@ -49,6 +49,8 @@ struct test all_tests[] = { TEST_INIT(capmode), TEST_INIT(capabilities), TEST_INIT(fcntl), + TEST_INIT(pdfork), + TEST_INIT(pdkill), TEST_INIT(relative), TEST_INIT(sysctl), }; Modified: head/tools/regression/security/cap_test/cap_test.h ============================================================================== --- head/tools/regression/security/cap_test/cap_test.h Thu Aug 18 23:08:52 2011 (r224988) +++ head/tools/regression/security/cap_test/cap_test.h Thu Aug 18 23:15:04 2011 (r224989) @@ -149,6 +149,9 @@ int execute(int id, struct test*); int test_capmode(void); int test_capabilities(void); int test_fcntl(void); +int test_pdfork(void); +int test_pdkill(void); +int test_pdwait(void); int test_relative(void); int test_sysctl(void); Added: head/tools/regression/security/cap_test/cap_test_pdfork.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/security/cap_test/cap_test_pdfork.c Thu Aug 18 23:15:04 2011 (r224989) @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2009-2011 Robert N. M. Watson + * Copyright (c) 2011 Jonathan Anderson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Test routines to make sure a variety of system calls are or are not + * available in capability mode. The goal is not to see if they work, just + * whether or not they return the expected ECAPMODE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "cap_test.h" + +int +test_pdfork(void) +{ + struct stat stat; + int success = PASSED; + int pd, error; + pid_t pid; + time_t now; + + //cap_enter(); + + pid = pdfork(&pd, 0); + if (pid < 0) + err(-1, "pdfork"); + + else if (pid == 0) { + /* + * Child process. + * + * pd should not be a valid process descriptor. + */ + error = pdgetpid(pd, &pid); + if (error != -1) + FAILX("pdgetpid succeeded"); + else if (errno != EBADF) + FAIL("pdgetpid failed, but errno != EBADF"); + + exit(success); + } + + /* Parent process. Ensure that [acm]times have been set correctly. */ + REQUIRE(fstat(pd, &stat)); + + now = time(NULL); + CHECK(now != (time_t)-1); + + CHECK(now >= stat.st_birthtime); + CHECK((now - stat.st_birthtime) < 2); + CHECK(stat.st_birthtime == stat.st_atime); + CHECK(stat.st_atime == stat.st_ctime); + CHECK(stat.st_ctime == stat.st_mtime); + + /* Wait for the child to finish. */ + error = pdgetpid(pd, &pid); + CHECK(error == 0); + CHECK(pid > 0); + + int status; + while (waitpid(pid, &status, 0) != pid) {} + if ((success == PASSED) && WIFEXITED(status)) + success = WEXITSTATUS(status); + else + success = FAILED; + + return (success); +} Added: head/tools/regression/security/cap_test/cap_test_pdkill.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/security/cap_test/cap_test_pdkill.c Thu Aug 18 23:15:04 2011 (r224989) @@ -0,0 +1,101 @@ +/*- + * Copyright (c) 2009-2011 Robert N. M. Watson + * Copyright (c) 2011 Jonathan Anderson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Test routines to make sure a variety of system calls are or are not + * available in capability mode. The goal is not to see if they work, just + * whether or not they return the expected ECAPMODE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "cap_test.h" + +void handle_signal(int); +void handle_signal(int sig) { + exit(PASSED); +} + +int +test_pdkill(void) +{ + int success = PASSED; + int pd, error; + pid_t pid; + + //cap_enter(); + + error = pdfork(&pd, 0); + if (error < 0) + err(-1, "pdfork"); + + else if (error == 0) { + signal(SIGINT, handle_signal); + sleep(3600); + exit(FAILED); + } + + /* Parent process; find the child's PID (we'll need it later). */ + error = pdgetpid(pd, &pid); + if (error != 0) + FAIL("pdgetpid"); + + /* Kill the child! */ + usleep(100); + error = pdkill(pd, SIGINT); + if (error != 0) + FAIL("pdkill"); + + /* Make sure the child finished properly. */ + int status; + while (waitpid(pid, &status, 0) != pid) {} + if ((success == PASSED) && WIFEXITED(status)) + success = WEXITSTATUS(status); + else + success = FAILED; + + return (success); +} From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 01:11:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C3C6106564A; Fri, 19 Aug 2011 01:11:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22AED8FC08; Fri, 19 Aug 2011 01:11:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7J1B7CG081004; Fri, 19 Aug 2011 01:11:07 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7J1B7Gx081002; Fri, 19 Aug 2011 01:11:07 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201108190111.p7J1B7Gx081002@svn.freebsd.org> From: Xin LI Date: Fri, 19 Aug 2011 01:11:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224991 - stable/8/sys/dev/arcmsr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 01:11:07 -0000 Author: delphij Date: Fri Aug 19 01:11:06 2011 New Revision: 224991 URL: http://svn.freebsd.org/changeset/base/224991 Log: MFC r224905: Update arcmsr(4) to 1.20.00.22 to solve recursive acquisition of buffer mutex, which would lead to a deadlock. Many thanks to Areca for their continued support of FreeBSD. Submitted by: Ching Huang Tested by: Willem Jan Withagen Modified: stable/8/sys/dev/arcmsr/arcmsr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/8/sys/dev/arcmsr/arcmsr.c Fri Aug 19 00:44:37 2011 (r224990) +++ stable/8/sys/dev/arcmsr/arcmsr.c Fri Aug 19 01:11:06 2011 (r224991) @@ -68,6 +68,7 @@ ** 1.20.00.21 02/08/2011 Ching Huang Implement I/O request timeout ** 02/14/2011 Ching Huang Modified pktRequestCount ** 1.20.00.21 03/03/2011 Ching Huang if a command timeout, then wait its ccb back before free it +** 1.20.00.22 07/04/2011 Ching Huang Fixed multiple MTX panic ****************************************************************************************** * $FreeBSD$ */ @@ -150,7 +151,7 @@ #define arcmsr_callout_init(a) callout_init(a); #endif -#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.21 2010-03-03" +#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.22 2011-07-04" #include #define SRB_SIZE ((sizeof(struct CommandControlBlock)+0x1f) & 0xffe0) #define ARCMSR_SRBS_POOL_SIZE (SRB_SIZE * ARCMSR_MAX_FREESRB_NUM) @@ -1293,11 +1294,15 @@ static void arcmsr_stop_adapter_bgrb(str static void arcmsr_poll(struct cam_sim * psim) { struct AdapterControlBlock *acb; + int mutex; acb = (struct AdapterControlBlock *)cam_sim_softc(psim); - ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); + mutex = mtx_owned(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); arcmsr_interrupt(acb); - ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); return; } /* @@ -2089,8 +2094,11 @@ struct CommandControlBlock * arcmsr_get_ { struct CommandControlBlock *srb=NULL; u_int32_t workingsrb_startindex, workingsrb_doneindex; + int mutex; - ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); + mutex = mtx_owned(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); workingsrb_doneindex=acb->workingsrb_doneindex; workingsrb_startindex=acb->workingsrb_startindex; srb=acb->srbworkingQ[workingsrb_startindex]; @@ -2101,7 +2109,8 @@ struct CommandControlBlock * arcmsr_get_ } else { srb=NULL; } - ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); return(srb); } /* From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 08:29:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ACCE106564A; Fri, 19 Aug 2011 08:29:11 +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 1A3E28FC0A; Fri, 19 Aug 2011 08:29:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7J8TAd5094408; Fri, 19 Aug 2011 08:29:10 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7J8TAVd094406; Fri, 19 Aug 2011 08:29:10 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201108190829.p7J8TAVd094406@svn.freebsd.org> From: Robert Watson Date: Fri, 19 Aug 2011 08:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224999 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 08:29:11 -0000 Author: rwatson Date: Fri Aug 19 08:29:10 2011 New Revision: 224999 URL: http://svn.freebsd.org/changeset/base/224999 Log: r222015 introduced a new assertion that the size of a fixed-length sbuf buffer is greater than 1. This triggered panics in at least one spot in the kernel (the MAC Framework) which passes non-negative, rather than >1 buffer sizes based on the size of a user buffer passed into a system call. While 0-size buffers aren't particularly useful, they also aren't strictly incorrect, so loosen the assertion. Discussed with: phk (fears I might be EDOOFUS but willing to go along) Spotted by: pho + stress2 Approved by: re (kib) Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Aug 19 07:21:19 2011 (r224998) +++ head/sys/kern/subr_sbuf.c Fri Aug 19 08:29:10 2011 (r224999) @@ -184,7 +184,7 @@ sbuf_newbuf(struct sbuf *s, char *buf, i s->s_buf = buf; if ((s->s_flags & SBUF_AUTOEXTEND) == 0) { - KASSERT(s->s_size > 1, + KASSERT(s->s_size >= 0, ("attempt to create a too small sbuf")); } From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 09:01:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 707561065672; Fri, 19 Aug 2011 09:01:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FB7E8FC08; Fri, 19 Aug 2011 09:01:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7J91Y6f095450; Fri, 19 Aug 2011 09:01:34 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7J91YHR095448; Fri, 19 Aug 2011 09:01:34 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108190901.p7J91YHR095448@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 19 Aug 2011 09:01:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225000 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 09:01:34 -0000 Author: hselasky Date: Fri Aug 19 09:01:34 2011 New Revision: 225000 URL: http://svn.freebsd.org/changeset/base/225000 Log: Add sysctl to not reset the device on clear stall failures, to temporarily mitigate problems with VMs. Approved by: re (kib) MFC after: 1 week Modified: head/sys/dev/usb/usb_request.c Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Fri Aug 19 08:29:10 2011 (r224999) +++ head/sys/dev/usb/usb_request.c Fri Aug 19 09:01:34 2011 (r225000) @@ -67,6 +67,11 @@ #include #include +static int usb_no_cs_fail; + +SYSCTL_INT(_hw_usb, OID_AUTO, no_cs_fail, CTLFLAG_RW, + &usb_no_cs_fail, 0, "USB clear stall failures are ignored, if set"); + #ifdef USB_DEBUG static int usb_pr_poll_delay = USB_PORT_RESET_DELAY; static int usb_pr_recovery_delay = USB_PORT_RESET_RECOVERY; @@ -238,7 +243,7 @@ usb_do_clear_stall_callback(struct usb_x switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - +tr_transferred: /* reset error counter */ udev->clear_stall_errors = 0; @@ -297,6 +302,13 @@ tr_setup: break; DPRINTF("Clear stall failed.\n"); + + /* + * Some VMs like VirtualBox always return failure on + * clear-stall which we sometimes should just ignore. + */ + if (usb_no_cs_fail) + goto tr_transferred; if (udev->clear_stall_errors == USB_CS_RESET_LIMIT) goto tr_setup; From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 09:06:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E10FD106570B; Fri, 19 Aug 2011 09:06:00 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFB798FC20; Fri, 19 Aug 2011 09:06:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7J960Ff095611; Fri, 19 Aug 2011 09:06:00 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7J960T9095609; Fri, 19 Aug 2011 09:06:00 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <201108190906.p7J960T9095609@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Fri, 19 Aug 2011 09:06:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225001 - stable/8/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 09:06:01 -0000 Author: vanhu Date: Fri Aug 19 09:06:00 2011 New Revision: 225001 URL: http://svn.freebsd.org/changeset/base/225001 Log: MFC: Release SP's refcount in key_get_spdbyid(). PR: 156676 Submitted by: Tobias Brunner (tobias@strongswan.org) Modified: stable/8/sys/netipsec/key.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netipsec/key.c ============================================================================== --- stable/8/sys/netipsec/key.c Fri Aug 19 09:01:34 2011 (r225000) +++ stable/8/sys/netipsec/key.c Fri Aug 19 09:06:00 2011 (r225001) @@ -2292,6 +2292,7 @@ key_spdget(so, m, mhp) } n = key_setdumpsp(sp, SADB_X_SPDGET, 0, mhp->msg->sadb_msg_pid); + KEY_FREESP(&sp); if (n != NULL) { m_freem(m); return key_sendup_mbuf(so, n, KEY_SENDUP_ONE); From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 10:12:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45A98106564A; Fri, 19 Aug 2011 10:12:03 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E631B8FC08; Fri, 19 Aug 2011 10:12:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JAC2lg099267; Fri, 19 Aug 2011 10:12:02 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JAC2h1099265; Fri, 19 Aug 2011 10:12:02 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201108191012.p7JAC2h1099265@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 19 Aug 2011 10:12:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225003 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 10:12:03 -0000 Author: ae Date: Fri Aug 19 10:12:02 2011 New Revision: 225003 URL: http://svn.freebsd.org/changeset/base/225003 Log: Add new section "BOOTSTRAPPING" to the gpart(8), that describes bootstrap code images used to boot from MBR, GPT, BSD and VTOC8 schemes. Reviewed by: marius (previous version) Approved by: re (kib) MFC after: 1 week Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Fri Aug 19 09:14:22 2011 (r225002) +++ head/sbin/geom/class/part/gpart.8 Fri Aug 19 10:12:02 2011 (r225003) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 6, 2011 +.Dd August 19, 2011 .Dt GPART 8 .Os .Sh NAME @@ -260,29 +260,21 @@ and .Fl i Ar index ) . Not all partitioning schemes have embedded bootstrap code, so the .Fl b Ar bootcode -option is scheme-specific in nature. -For the GPT scheme, embedded bootstrap code is supported. -The bootstrap code is embedded in the protective MBR rather than the GPT. +option is scheme-specific in nature (see the section entitled +.Sx BOOTSTRAPPING +below). The .Fl b Ar bootcode option specifies a file that contains the bootstrap code. The contents and size of the file are determined by the partitioning scheme. -For the MBR scheme, it is a 512 byte file of which the first 446 bytes -are installed as bootstrap code. The .Fl p Ar partcode option specifies a file that contains the bootstrap code intended to be written to a partition. -For the VTOC8 scheme, it is a 8192 byte file of which the last 7680 bytes -are installed as bootstrap code. The partition is specified by the .Fl i Ar index option. -For the VTOC8 scheme, if the -.Fl i Ar index -option is omitted, the bootstrap code is written to all sufficiently large -partitions. The size of the file must be smaller than the size of the partition. .Pp Additional options include: @@ -716,6 +708,91 @@ The scheme-specific attributes for PC98: .It Cm active .It Cm bootable .El +.Sh BOOTSTRAPPING +.Fx supports several partitioning schemes and each scheme uses different +bootstrap code. +The bootstrap code is located in the specific disk area for each partitioning +scheme and also it might have different size. +.Pp +The bootstrap code could be separated into two types. +The first one is embedded in the partitioning scheme's metadata, the second +type is located on the specific partition. +The embedding bootstrap code should be done only with the +.Cm gpart bootcode +command with +.Fl b Ar bootcode +option. +The GEOM PART class has knowlege on how to embed bootstrap code into specific +partitioning scheme metadata without damage. +.Pp +The Master Boot Record (MBR) uses 512-bytes bootstrap code image, embedded into +partition table's metadata area. +There are two variants of this bootstrap code: +.Pa /boot/mbr +and +.Pa /boot/boot0 . +The first one searches partition with +.Cm active +attribute (see the +.Sx ATTRIBUTES +section) in the partition table. +Then it runs next bootstrap stage. +The +.Pa /boot/boot0 +image contains a boot manager with some additional interactive functions. +.Pp +The BSD disklabel is usually created on top of the MBR partition (slice) +with type +.Cm freebsd +(see the +.Sx "PARTITION TYPES" +section). +It uses 8 KB size bootstrap code image +.Pa /boot/boot , +embedded into partition table's metadata area. +.Pp +Both types of bootstrap code are used to boot from the GUID Partition Table. +First of all, a protective MBR is embedded into first disk sector from the +.Pa /boot/pmbr +image. +It searches the +.Cm freebsd-boot +partition (see the +.Sx "PARTITION TYPES" +section) in the GPT and runs next bootstrap stage from it. +The +.Cm freebsd-boot +partition should be smaller than 545 KB. +There are two variants of bootstrap code to write to this partition: +.Pa /boot/gptboot +and +.Pa /boot/gptzfsboot . +The first one is used to boot from UFS. +It searches in the GPT partition with type +.Cm freebsd-ufs , +and it runs the thrid bootstrap stage ( +.Pa /boot/loader ) +if it is found. +The +.Pa /boot/gptzfsboot +is used to boot from ZFS. +It searches partition with type +.Cm freebsd-zfs +and starts +.Pa /boot/zfsloader +from it. +.Pp +The VTOC8 scheme does not support embedding bootstrap code. +Instead, the 8 KBytes bootstrap code image +.Pa /boot/boot1 +could be written with +.Cm gpart bootcode +command with +.Fl p Ar bootcode +option to all sufficiently large VTOC8 partitions. +To do this the +.Fl i Ar index +option could be ommited. .Sh OPERATIONAL FLAGS Actions other than the .Cm commit @@ -949,6 +1026,7 @@ and .Sh SEE ALSO .Xr dd 1 , .Xr geom 4 , +.Xr boot0cfg 8 , .Xr geom 8 .Sh HISTORY The From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 12:08:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D5FB1065670; Fri, 19 Aug 2011 12:08:15 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C6858FC13; Fri, 19 Aug 2011 12:08:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JC8Fd6002992; Fri, 19 Aug 2011 12:08:15 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JC8Fj9002990; Fri, 19 Aug 2011 12:08:15 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201108191208.p7JC8Fj9002990@svn.freebsd.org> From: Takahashi Yoshihiro Date: Fri, 19 Aug 2011 12:08:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225005 - in stable/8/release: . picobsd/floppy.tree/sbin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 12:08:15 -0000 Author: nyan Date: Fri Aug 19 12:08:15 2011 New Revision: 225005 URL: http://svn.freebsd.org/changeset/base/225005 Log: MFC: revision 224780 Allow to build a release for stable/[78] on a current box and vise versa. Modified: stable/8/release/Makefile Directory Properties: stable/8/release/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/picobsd/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (props changed) stable/8/release/picobsd/qemu/ (props changed) stable/8/release/picobsd/tinyware/login/ (props changed) stable/8/release/powerpc/ (props changed) Modified: stable/8/release/Makefile ============================================================================== --- stable/8/release/Makefile Fri Aug 19 11:58:05 2011 (r225004) +++ stable/8/release/Makefile Fri Aug 19 12:08:15 2011 (r225005) @@ -583,7 +583,11 @@ release rerelease: echo "fi" >> ${_MK} echo "cd /usr/src/release" >> ${_MK} echo "make obj" >> ${_MK} - echo "make \$${_RELTARGET}" >> ${_MK} + echo "if [ -f Makefile.sysinstall ]; then" >> ${_MK} + echo " make -f Makefile.sysinstall \$${_RELTARGET}" >> ${_MK} + echo "else" >> ${_MK} + echo " make \$${_RELTARGET}" >> ${_MK} + echo "fi" >> ${_MK} echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK} chmod 755 ${_MK} .if defined(NOPORTS) From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 12:08:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7B24106564A; Fri, 19 Aug 2011 12:08:54 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B73848FC0C; Fri, 19 Aug 2011 12:08:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JC8sF0003048; Fri, 19 Aug 2011 12:08:54 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JC8sMQ003046; Fri, 19 Aug 2011 12:08:54 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201108191208.p7JC8sMQ003046@svn.freebsd.org> From: Takahashi Yoshihiro Date: Fri, 19 Aug 2011 12:08:54 +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: r225006 - stable/7/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 12:08:54 -0000 Author: nyan Date: Fri Aug 19 12:08:54 2011 New Revision: 225006 URL: http://svn.freebsd.org/changeset/base/225006 Log: MFC: revision 224780 Allow to build a release for stable/[78] on a current box and vise versa. Modified: stable/7/release/Makefile Directory Properties: stable/7/release/ (props changed) stable/7/release/doc/ (props changed) stable/7/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/7/release/picobsd/tinyware/login/ (props changed) Modified: stable/7/release/Makefile ============================================================================== --- stable/7/release/Makefile Fri Aug 19 12:08:15 2011 (r225005) +++ stable/7/release/Makefile Fri Aug 19 12:08:54 2011 (r225006) @@ -584,7 +584,11 @@ release rerelease: echo "fi" >> ${_MK} echo "cd /usr/src/release" >> ${_MK} echo "make obj" >> ${_MK} - echo "make \$${_RELTARGET}" >> ${_MK} + echo "if [ -f Makefile.sysinstall ]; then" >> ${_MK} + echo " make -f Makefile.sysinstall \$${_RELTARGET}" >> ${_MK} + echo "else" >> ${_MK} + echo " make \$${_RELTARGET}" >> ${_MK} + echo "fi" >> ${_MK} echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK} chmod 755 ${_MK} .if defined(NOPORTS) From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 12:48:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07F19106564A; Fri, 19 Aug 2011 12:48:07 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC4D08FC14; Fri, 19 Aug 2011 12:48:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JCm6oE004216; Fri, 19 Aug 2011 12:48:06 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JCm6fc004214; Fri, 19 Aug 2011 12:48:06 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201108191248.p7JCm6fc004214@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 19 Aug 2011 12:48:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225007 - head/sbin/fdisk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 12:48:07 -0000 Author: ae Date: Fri Aug 19 12:48:06 2011 New Revision: 225007 URL: http://svn.freebsd.org/changeset/base/225007 Log: The decimal() function was changed in r217808 to take the maximum value instead of number of bits. But for case when limitation is not needed it erroneously skips conversion to number and always returns zero. So, don't skip conversion for case when limitation is not needed. PR: bin/159765 Approved by: re (kib) Modified: head/sbin/fdisk/fdisk.c Modified: head/sbin/fdisk/fdisk.c ============================================================================== --- head/sbin/fdisk/fdisk.c Fri Aug 19 12:08:54 2011 (r225006) +++ head/sbin/fdisk/fdisk.c Fri Aug 19 12:48:06 2011 (r225007) @@ -940,7 +940,7 @@ decimal(const char *str, int *num, int d return 0; while ((c = *cp++)) { if (c <= '9' && c >= '0') { - if (maxval > 0 && acc <= maxval) + if (acc <= maxval || maxval == 0) acc = acc * 10 + c - '0'; } else break; From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 13:02:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7BF21065672; Fri, 19 Aug 2011 13:02:45 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) by mx1.freebsd.org (Postfix) with ESMTP id 6CDD78FC08; Fri, 19 Aug 2011 13:02:45 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1QuO1U-0001uK-Ho; Fri, 19 Aug 2011 16:18:04 +0400 Date: Fri, 19 Aug 2011 16:18:04 +0400 From: Slawa Olhovchenkov To: Robert Watson Message-ID: <20110819121804.GA5416@zxy.spb.ru> References: <201002221557.o1MFvatD089648@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201002221557.o1MFvatD089648@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r204202 - head/usr.bin/netstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 13:02:45 -0000 On Mon, Feb 22, 2010 at 03:57:36PM +0000, Robert Watson wrote: > Author: rwatson > Date: Mon Feb 22 15:57:36 2010 > New Revision: 204202 > URL: http://svn.freebsd.org/changeset/base/204202 > > Log: > Teach netstat(1) to print out netisr statistics when given the -Q argument. > Currently supports only reporting on live systems via sysctl, kmem support > needs to be edded. > > MFC after: 1 week Not MFC'ed? From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 13:31:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65593106564A; Fri, 19 Aug 2011 13:31:48 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 554488FC0A; Fri, 19 Aug 2011 13:31:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JDVmIs005624; Fri, 19 Aug 2011 13:31:48 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JDVmij005622; Fri, 19 Aug 2011 13:31:48 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201108191331.p7JDVmij005622@svn.freebsd.org> From: Attilio Rao Date: Fri, 19 Aug 2011 13:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225009 - head/sys/dev/coretemp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 13:31:48 -0000 Author: attilio Date: Fri Aug 19 13:31:48 2011 New Revision: 225009 URL: http://svn.freebsd.org/changeset/base/225009 Log: Bump the maximum coretemp limit (for CPU temperature) to 110. Several cores with temp in the range 101-105 have been found in the past. Sponsored by: Sandvine Incorporated Reviewed by: delphij, emaste Approved by: re (kib) MFC after: 3 days Modified: head/sys/dev/coretemp/coretemp.c Modified: head/sys/dev/coretemp/coretemp.c ============================================================================== --- head/sys/dev/coretemp/coretemp.c Fri Aug 19 12:55:50 2011 (r225008) +++ head/sys/dev/coretemp/coretemp.c Fri Aug 19 13:31:48 2011 (r225009) @@ -225,12 +225,12 @@ coretemp_attach(device_t dev) * these numbers are, with the publicly available * documents from Intel. * - * For now, we consider [70, 100]C range, as + * For now, we consider [70, 110]C range, as * described in #322683, as "reasonable" and accept * these values whenever the MSR is available for * read, regardless the CPU model. */ - if (tjtarget >= 70 && tjtarget <= 100) + if (tjtarget >= 70 && tjtarget <= 110) sc->sc_tjmax = tjtarget; else device_printf(dev, "Tj(target) value %d " From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 13:41:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 668931065672; Fri, 19 Aug 2011 13:41:00 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55B2D8FC21; Fri, 19 Aug 2011 13:41:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JDf09w005973; Fri, 19 Aug 2011 13:41:00 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JDf0ph005971; Fri, 19 Aug 2011 13:41:00 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <201108191341.p7JDf0ph005971@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Fri, 19 Aug 2011 13:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225011 - stable/8/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 13:41:00 -0000 Author: vanhu Date: Fri Aug 19 13:41:00 2011 New Revision: 225011 URL: http://svn.freebsd.org/changeset/base/225011 Log: MFC: fixed two race conditions when inserting/removing SAs via PFKey, which can both lead to a kernel panic when adding/removing quickly a lot of SAs. Obtained from: NETASQ Modified: stable/8/sys/netipsec/key.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netipsec/key.c ============================================================================== --- stable/8/sys/netipsec/key.c Fri Aug 19 13:34:05 2011 (r225010) +++ stable/8/sys/netipsec/key.c Fri Aug 19 13:41:00 2011 (r225011) @@ -2866,9 +2866,10 @@ key_newsav(m, mhp, sah, errp, where, tag sa_initref(newsav); newsav->state = SADB_SASTATE_LARVAL; - /* XXX locking??? */ + SAHTREE_LOCK(); LIST_INSERT_TAIL(&sah->savtree[SADB_SASTATE_LARVAL], newsav, secasvar, chain); + SAHTREE_UNLOCK(); done: KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s from %s:%u return SP:%p\n", __func__, @@ -5712,8 +5713,8 @@ key_delete(so, m, mhp) } key_sa_chgstate(sav, SADB_SASTATE_DEAD); - SAHTREE_UNLOCK(); KEY_FREESAV(&sav); + SAHTREE_UNLOCK(); { struct mbuf *n; From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 13:16:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F6211065673; Fri, 19 Aug 2011 13:16:05 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from argol.doit.wisc.edu (argol.doit.wisc.edu [144.92.197.212]) by mx1.freebsd.org (Postfix) with ESMTP id 844EA8FC0C; Fri, 19 Aug 2011 13:16:04 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0LQ600B00FIRT500@smtpauth3.wiscmail.wisc.edu>; Fri, 19 Aug 2011 08:16:03 -0500 (CDT) Received: from comporellon.tachypleus.net ([unknown] [76.210.68.180]) by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0LQ6002RPFIQ3C30@smtpauth3.wiscmail.wisc.edu>; Fri, 19 Aug 2011 08:16:03 -0500 (CDT) Date: Fri, 19 Aug 2011 08:16:00 -0500 From: Nathan Whitehorn In-reply-to: <201108191012.p7JAC2h1099265@svn.freebsd.org> To: "Andrey V. Elsukov" Message-id: <4E4E6210.4010303@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.68.180 X-Spam-PmxInfo: Server=avs-13, Version=5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.8.19.130314, SenderIP=76.210.68.180 References: <201108191012.p7JAC2h1099265@svn.freebsd.org> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110704 Thunderbird/5.0 X-Mailman-Approved-At: Fri, 19 Aug 2011 13:55:14 +0000 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r225003 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 13:16:05 -0000 On 08/19/11 05:12, Andrey V. Elsukov wrote: > Author: ae > Date: Fri Aug 19 10:12:02 2011 > New Revision: 225003 > URL: http://svn.freebsd.org/changeset/base/225003 > > Log: > Add new section "BOOTSTRAPPING" to the gpart(8), that describes > bootstrap code images used to boot from MBR, GPT, BSD and VTOC8 > schemes. > > Reviewed by: marius (previous version) > Approved by: re (kib) > MFC after: 1 week > Can you add a blurb about APM, too? It needs a boot partition, set to /boot/boot1.hfs, and does not have embedded boot code. I can send sample text if you like. -Nathan From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 15:21:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CD64106568B; Fri, 19 Aug 2011 15:21:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C6AC8FC12; Fri, 19 Aug 2011 15:21:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JFLEtR009017; Fri, 19 Aug 2011 15:21:14 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JFLEhA009015; Fri, 19 Aug 2011 15:21:14 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108191521.p7JFLEhA009015@svn.freebsd.org> From: Adrian Chadd Date: Fri, 19 Aug 2011 15:21:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225013 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 15:21:14 -0000 Author: adrian Date: Fri Aug 19 15:21:13 2011 New Revision: 225013 URL: http://svn.freebsd.org/changeset/base/225013 Log: Correctly handle BAR TX failures. On a TX failure, ic_raw_xmit will still call ieee80211_node_free(). There's no need to call it here. Submitted by: moonlightakkiy@yahoo.ca Approved by: re (kib) Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Fri Aug 19 15:14:13 2011 (r225012) +++ head/sys/net80211/ieee80211_ht.c Fri Aug 19 15:21:13 2011 (r225013) @@ -2309,11 +2309,15 @@ ieee80211_send_bar(struct ieee80211_node ni, "send BAR: tid %u ctl 0x%x start %u (attempt %d)", tid, barctl, seq, tap->txa_attempts); + /* + * ic_raw_xmit will free the node reference + * regardless of queue/TX success or failure. + */ ret = ic->ic_raw_xmit(ni, m, NULL); if (ret != 0) { /* xmit failed, clear state flag */ tap->txa_flags &= ~IEEE80211_AGGR_BARPEND; - goto bad; + return ret; } /* XXX hack against tx complete happening before timer is started */ if (tap->txa_flags & IEEE80211_AGGR_BARPEND) From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 19:12:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BDA81065672; Fri, 19 Aug 2011 19:12:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 211878FC1A; Fri, 19 Aug 2011 19:12:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JJCxNP016349; Fri, 19 Aug 2011 19:12:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JJCxou016346; Fri, 19 Aug 2011 19:12:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108191912.p7JJCxou016346@svn.freebsd.org> From: Marius Strobl Date: Fri, 19 Aug 2011 19:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225014 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 19:12:59 -0000 Author: marius Date: Fri Aug 19 19:12:58 2011 New Revision: 225014 URL: http://svn.freebsd.org/changeset/base/225014 Log: r221812 reveals that at least some Broadcom PHYs default to being not only isolated but also powered down after a reset and while they just work fine [sic] when both is the case they don't if they are only deisolate but still powered down. So in order to put PHYs in an overall normal operation mode for the common case, ensure in mii_phy_reset() that they are not powered down after a reset. Unfortunately, this only helps in case of BCM5421, while BCM5709S apparently only work when they remain isolated and powered down after a reset. So don't call mii_phy_reset() in brgphy_reset() and implement the reset locally leaving the problematic bits alone. Effectively this bypasses r221812 for brgphy(4). Thanks to Justin Hibbits for doing a binary search in order to identify the problematic commit. PR: 157405, 158156 Reviewed by: yongari (mii_phy_reset() part) Approved by: re (kib) MFC after: 3 days Modified: head/sys/dev/mii/brgphy.c head/sys/dev/mii/mii_physubr.c Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Fri Aug 19 15:21:13 2011 (r225013) +++ head/sys/dev/mii/brgphy.c Fri Aug 19 19:12:58 2011 (r225014) @@ -876,10 +876,22 @@ brgphy_reset(struct mii_softc *sc) struct bge_softc *bge_sc = NULL; struct bce_softc *bce_sc = NULL; struct ifnet *ifp; - int val; + int i, val; - /* Perform a standard PHY reset. */ - mii_phy_reset(sc); + /* + * Perform a reset. Note that at least some Broadcom PHYs default to + * being powered down as well as isolated after a reset but don't work + * if one or both of these bits are cleared. However, they just work + * fine if both bits remain set, so we don't use mii_phy_reset() here. + */ + PHY_WRITE(sc, BRGPHY_MII_BMCR, BRGPHY_BMCR_RESET); + + /* Wait 100ms for it to complete. */ + for (i = 0; i < 100; i++) { + if ((PHY_READ(sc, BRGPHY_MII_BMCR) & BRGPHY_BMCR_RESET) == 0) + break; + DELAY(1000); + } /* Handle any PHY specific procedures following the reset. */ switch (sc->mii_mpd_oui) { Modified: head/sys/dev/mii/mii_physubr.c ============================================================================== --- head/sys/dev/mii/mii_physubr.c Fri Aug 19 15:21:13 2011 (r225013) +++ head/sys/dev/mii/mii_physubr.c Fri Aug 19 19:12:58 2011 (r225014) @@ -273,8 +273,8 @@ mii_phy_reset(struct mii_softc *sc) DELAY(1000); } - /* NB: a PHY may default to isolation. */ - reg &= ~BMCR_ISO; + /* NB: a PHY may default to being powered down and/or isolated. */ + reg &= ~(BMCR_PDOWN | BMCR_ISO); if ((sc->mii_flags & MIIF_NOISOLATE) == 0 && ((ife == NULL && sc->mii_inst != 0) || (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst))) From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 19:13:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 869C91065676; Fri, 19 Aug 2011 19:13:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75C918FC22; Fri, 19 Aug 2011 19:13:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JJDVJg016434; Fri, 19 Aug 2011 19:13:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JJDV8M016432; Fri, 19 Aug 2011 19:13:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108191913.p7JJDV8M016432@svn.freebsd.org> From: Marius Strobl Date: Fri, 19 Aug 2011 19:13:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225015 - head/sys/dev/gem X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 19:13:31 -0000 Author: marius Date: Fri Aug 19 19:13:31 2011 New Revision: 225015 URL: http://svn.freebsd.org/changeset/base/225015 Log: Revert r224157, re-enabling r222135. The underlying problem keeping the latter from working as expected was fixed in r225014. MFC after: 3 days Approved by: re (kib) Modified: head/sys/dev/gem/if_gem.c Modified: head/sys/dev/gem/if_gem.c ============================================================================== --- head/sys/dev/gem/if_gem.c Fri Aug 19 19:12:58 2011 (r225014) +++ head/sys/dev/gem/if_gem.c Fri Aug 19 19:13:31 2011 (r225015) @@ -947,10 +947,8 @@ gem_init_locked(struct gem_softc *sc) GEM_LOCK_ASSERT(sc, MA_OWNED); -#ifdef notyet if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return; -#endif #ifdef GEM_DEBUG CTR2(KTR_GEM, "%s: %s: calling stop", device_get_name(sc->sc_dev), From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 21:28:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0681106564A; Fri, 19 Aug 2011 21:28:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B73D68FC0A; Fri, 19 Aug 2011 21:28:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JLSepL020673; Fri, 19 Aug 2011 21:28:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JLSeJR020671; Fri, 19 Aug 2011 21:28:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201108192128.p7JLSeJR020671@svn.freebsd.org> From: John Baldwin Date: Fri, 19 Aug 2011 21:28:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225017 - head/gnu/usr.bin/gdb/kgdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 21:28:41 -0000 Author: jhb Date: Fri Aug 19 21:28:40 2011 New Revision: 225017 URL: http://svn.freebsd.org/changeset/base/225017 Log: Walk the zombproc list as well as the allproc list when enumerating threads and processes in a kernel image. This allows examination of threads that have exited or are in the late stages of exiting. Tested by: avg Approved by: re (kib) MFC after: 1 week Modified: head/gnu/usr.bin/gdb/kgdb/kthr.c Modified: head/gnu/usr.bin/gdb/kgdb/kthr.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/kthr.c Fri Aug 19 20:34:34 2011 (r225016) +++ head/gnu/usr.bin/gdb/kgdb/kthr.c Fri Aug 19 21:28:40 2011 (r225017) @@ -73,11 +73,52 @@ kgdb_thr_first(void) return (first); } -struct kthr * -kgdb_thr_init(void) +static void +kgdb_thr_add_procs(uintptr_t paddr) { struct proc p; struct thread td; + struct kthr *kt; + CORE_ADDR addr; + + while (paddr != 0) { + if (kvm_read(kvm, paddr, &p, sizeof(p)) != sizeof(p)) { + warnx("kvm_read: %s", kvm_geterr(kvm)); + break; + } + addr = (uintptr_t)TAILQ_FIRST(&p.p_threads); + while (addr != 0) { + if (kvm_read(kvm, addr, &td, sizeof(td)) != + sizeof(td)) { + warnx("kvm_read: %s", kvm_geterr(kvm)); + break; + } + kt = malloc(sizeof(*kt)); + kt->next = first; + kt->kaddr = addr; + if (td.td_tid == dumptid) + kt->pcb = dumppcb; + else if (td.td_state == TDS_RUNNING && stoppcbs != 0 && + CPU_ISSET(td.td_oncpu, &stopped_cpus)) + kt->pcb = (uintptr_t)stoppcbs + + sizeof(struct pcb) * td.td_oncpu; + else + kt->pcb = (uintptr_t)td.td_pcb; + kt->kstack = td.td_kstack; + kt->tid = td.td_tid; + kt->pid = p.p_pid; + kt->paddr = paddr; + kt->cpu = td.td_oncpu; + first = kt; + addr = (uintptr_t)TAILQ_NEXT(&td, td_plist); + } + paddr = (uintptr_t)LIST_NEXT(&p, p_list); + } +} + +struct kthr * +kgdb_thr_init(void) +{ long cpusetsize; struct kthr *kt; CORE_ADDR addr; @@ -113,37 +154,11 @@ kgdb_thr_init(void) stoppcbs = kgdb_lookup("stoppcbs"); - while (paddr != 0) { - if (kvm_read(kvm, paddr, &p, sizeof(p)) != sizeof(p)) { - warnx("kvm_read: %s", kvm_geterr(kvm)); - break; - } - addr = (uintptr_t)TAILQ_FIRST(&p.p_threads); - while (addr != 0) { - if (kvm_read(kvm, addr, &td, sizeof(td)) != - sizeof(td)) { - warnx("kvm_read: %s", kvm_geterr(kvm)); - break; - } - kt = malloc(sizeof(*kt)); - kt->next = first; - kt->kaddr = addr; - if (td.td_tid == dumptid) - kt->pcb = dumppcb; - else if (td.td_state == TDS_RUNNING && stoppcbs != 0 && - CPU_ISSET(td.td_oncpu, &stopped_cpus)) - kt->pcb = (uintptr_t) stoppcbs + sizeof(struct pcb) * td.td_oncpu; - else - kt->pcb = (uintptr_t)td.td_pcb; - kt->kstack = td.td_kstack; - kt->tid = td.td_tid; - kt->pid = p.p_pid; - kt->paddr = paddr; - kt->cpu = td.td_oncpu; - first = kt; - addr = (uintptr_t)TAILQ_NEXT(&td, td_plist); - } - paddr = (uintptr_t)LIST_NEXT(&p, p_list); + kgdb_thr_add_procs(paddr); + addr = kgdb_lookup("zombproc"); + if (addr != 0) { + kvm_read(kvm, addr, &paddr, sizeof(paddr)); + kgdb_thr_add_procs(paddr); } curkthr = kgdb_thr_lookup_tid(dumptid); if (curkthr == NULL) From owner-svn-src-all@FreeBSD.ORG Fri Aug 19 21:33:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DC161065672; Fri, 19 Aug 2011 21:33:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2ECE28FC18; Fri, 19 Aug 2011 21:33:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JLXl9K020866; Fri, 19 Aug 2011 21:33:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JLXlIa020864; Fri, 19 Aug 2011 21:33:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108192133.p7JLXlIa020864@svn.freebsd.org> From: Alexander Motin Date: Fri, 19 Aug 2011 21:33:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225018 - head/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 21:33:47 -0000 Author: mav Date: Fri Aug 19 21:33:46 2011 New Revision: 225018 URL: http://svn.freebsd.org/changeset/base/225018 Log: Fix WWN printing in `camcontrol identify` output. Approved by: re (kib) MFC after: 1 week Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Aug 19 21:28:40 2011 (r225017) +++ head/sbin/camcontrol/camcontrol.c Fri Aug 19 21:33:46 2011 (r225018) @@ -1131,7 +1131,7 @@ atacapprint(struct ata_params *parm) printf("firmware revision %.8s\n", parm->revision); printf("serial number %.20s\n", parm->serial); if (parm->enabled.extension & ATA_SUPPORT_64BITWWN) { - printf("WWN %02x%02x%02x%02x\n", + printf("WWN %04x%04x%04x%04x\n", parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]); } if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) { From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 01:49:26 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90BEE1065677; Sat, 20 Aug 2011 01:49:26 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (farley.org [74.218.194.34]) by mx1.freebsd.org (Postfix) with ESMTP id 452EC8FC1B; Sat, 20 Aug 2011 01:49:26 +0000 (UTC) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f11:66f:1::5]) by mail.farley.org (8.14.5/8.14.5) with ESMTP id p7H0cMxj015237; Tue, 16 Aug 2011 20:38:22 -0400 (EDT) (envelope-from scf@FreeBSD.org) Date: Tue, 16 Aug 2011 20:38:22 -0400 (EDT) From: "Sean C. Farley" To: Hans Petter Selasky In-Reply-To: <201108160834.p7G8YHiT048516@svn.freebsd.org> Message-ID: References: <201108160834.p7G8YHiT048516@svn.freebsd.org> User-Agent: Alpine 2.02 (BSF 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Spam-Status: No, score=-1.2 required=4.0 tests=AWL,BAYES_00,SPF_SOFTFAIL autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224903 - head/lib/libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 01:49:26 -0000 On Tue, 16 Aug 2011, Hans Petter Selasky wrote: > Author: hselasky > Date: Tue Aug 16 08:34:16 2011 > New Revision: 224903 > URL: http://svn.freebsd.org/changeset/base/224903 > > Log: > Add missing function to get device speed to the LibUSB v1.0 API. > > MFC after: 1 week > Approved by: re (kib) > > Modified: > head/lib/libusb/libusb.h > head/lib/libusb/libusb10.c > > Modified: head/lib/libusb/libusb.h > ============================================================================== > --- head/lib/libusb/libusb.h Tue Aug 16 06:26:51 2011 (r224902) > +++ head/lib/libusb/libusb.h Tue Aug 16 08:34:16 2011 (r224903) > @@ -151,6 +151,14 @@ enum libusb_error { > LIBUSB_ERROR_OTHER = -99, > }; > > +enum libusb_speed { > + LIBUSB_SPEED_UNKNOWN = 0, > + LIBUSB_SPEED_LOW = 1, > + LIBUSB_SPEED_FULL = 2, > + LIBUSB_SPEED_HIGH = 3, > + LIBUSB_SPEED_SUPER = 4, > +}; > + *snip* > +enum libusb_speed > +libusb_get_device_speed(libusb_device *dev) > +{ > + if (dev == NULL) > + return (0); /* should not happen */ Should that return LIBUSB_SPEED_UNKNOWN instead of 0? Sean -- scf@FreeBSD.org From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 07:43:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B13E106566C; Sat, 20 Aug 2011 07:43:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00C7D8FC1C; Sat, 20 Aug 2011 07:43:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7K7hA4n039488; Sat, 20 Aug 2011 07:43:10 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7K7hAaG039485; Sat, 20 Aug 2011 07:43:10 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108200743.p7K7hAaG039485@svn.freebsd.org> From: Martin Matuska Date: Sat, 20 Aug 2011 07:43:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225022 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 07:43:11 -0000 Author: mm Date: Sat Aug 20 07:43:10 2011 New Revision: 225022 URL: http://svn.freebsd.org/changeset/base/225022 Log: MFC r224814, r224855: MFC r224814 [1]: Fix race between dmu_objset_prefetch() invoked from zfs_ioc_dataset_list_next() and dsl_dir_destroy_check() indirectly invoked from dmu_recv_existing_end() via dsl_dataset_destroy() by not prefetching temporary clones, as these count as always inconsistent. In addition, do not prefetch hidden datasets at all as we are not going to process these later. Filed as Illumos Bug #1346 MFC r224855: zfs_ioctl.c: improve code readability in zfs_ioc_dataset_list_next() zvol.c: fix calling of dmu_objset_prefetch() in zvol_create_minors() by passing full instead of relative dataset name and prefetching all visible datasets to be processed later instead of just the pool name PR: kern/157728 [1] Tested by: Borja Marcos [1], mm Reviewed by: pjd Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 20 06:08:31 2011 (r225021) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 20 07:43:10 2011 (r225022) @@ -1963,8 +1963,10 @@ top: uint64_t cookie = 0; int len = sizeof (zc->zc_name) - (p - zc->zc_name); - while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) - (void) dmu_objset_prefetch(zc->zc_name, NULL); + while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) { + if (!dataset_name_hidden(zc->zc_name)) + (void) dmu_objset_prefetch(zc->zc_name, NULL); + } } do { Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Aug 20 06:08:31 2011 (r225021) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Aug 20 07:43:10 2011 (r225022) @@ -2200,11 +2200,11 @@ zvol_create_minors(const char *name) p = osname + strlen(osname); len = MAXPATHLEN - (p - osname); - if (strchr(name, '/') == NULL) { - /* Prefetch only for pool name. */ - cookie = 0; - while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) - (void) dmu_objset_prefetch(p, NULL); + /* Prefetch the datasets. */ + cookie = 0; + while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) { + if (!dataset_name_hidden(osname)) + (void) dmu_objset_prefetch(osname, NULL); } cookie = 0; From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 08:20:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE24D1065670; Sat, 20 Aug 2011 08:20:10 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE6F88FC08; Sat, 20 Aug 2011 08:20:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7K8KAKj040603; Sat, 20 Aug 2011 08:20:10 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7K8KAA8040601; Sat, 20 Aug 2011 08:20:10 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201108200820.p7K8KAA8040601@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sat, 20 Aug 2011 08:20:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225023 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 08:20:10 -0000 Author: ae Date: Sat Aug 20 08:20:10 2011 New Revision: 225023 URL: http://svn.freebsd.org/changeset/base/225023 Log: o Fix mdoc formatting for the '.Fx' macro. [1] o Add information about APM scheme and fix typos. [2] Submitted by: gjb [1], nwhitehorn [2] Approved by: re (kib) MFC after: 1 week Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Sat Aug 20 07:43:10 2011 (r225022) +++ head/sbin/geom/class/part/gpart.8 Sat Aug 20 08:20:10 2011 (r225023) @@ -709,7 +709,8 @@ The scheme-specific attributes for PC98: .It Cm bootable .El .Sh BOOTSTRAPPING -.Fx supports several partitioning schemes and each scheme uses different +.Fx +supports several partitioning schemes and each scheme uses different bootstrap code. The bootstrap code is located in the specific disk area for each partitioning scheme and also it might have different size. @@ -770,7 +771,7 @@ and The first one is used to boot from UFS. It searches in the GPT partition with type .Cm freebsd-ufs , -and it runs the thrid bootstrap stage ( +and it runs the third bootstrap stage ( .Pa /boot/loader ) if it is found. The @@ -785,7 +786,7 @@ from it. The VTOC8 scheme does not support embedding bootstrap code. Instead, the 8 KBytes bootstrap code image .Pa /boot/boot1 -could be written with +should be written with .Cm gpart bootcode command with .Fl p Ar bootcode @@ -793,6 +794,15 @@ option to all sufficiently large VTOC8 p To do this the .Fl i Ar index option could be ommited. +.Pp +The APM scheme also does not support embedding bootstrap code. +Instead, the 800 KBytes bootstrap code image +.Pa /boot/boot1.hfs +should be written with +.Cm gpart bootcode +command to a partition of type +.Cm freebsd-boot , +which should also be 800 KB in size. .Sh OPERATIONAL FLAGS Actions other than the .Cm commit From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 11:44:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05F2F106564A; Sat, 20 Aug 2011 11:44:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7D338FC08; Sat, 20 Aug 2011 11:44:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KBimT4050307; Sat, 20 Aug 2011 11:44:48 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KBim1e050305; Sat, 20 Aug 2011 11:44:48 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201108201144.p7KBim1e050305@svn.freebsd.org> From: Andriy Gapon Date: Sat, 20 Aug 2011 11:44:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225026 - in stable/8/release: doc/en_US.ISO8859-1/hardware picobsd/floppy.tree/sbin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 11:44:49 -0000 Author: avg Date: Sat Aug 20 11:44:48 2011 New Revision: 225026 URL: http://svn.freebsd.org/changeset/base/225026 Log: MFC r224529: fix a typo/tautology in the release documentation Modified: stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml Directory Properties: stable/8/release/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/picobsd/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (props changed) stable/8/release/picobsd/qemu/ (props changed) stable/8/release/picobsd/tinyware/login/ (props changed) stable/8/release/powerpc/ (props changed) Modified: stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Aug 20 10:44:13 2011 (r225025) +++ stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Aug 20 11:44:48 2011 (r225026) @@ -195,7 +195,7 @@ resources between logical processors within the same CPU. Because this naive scheduling can result in suboptimal performance, under certain circumstances it may be useful to - disable the logical processors with the the + disable the logical processors with the machdep.hlt_logical_cpus sysctl variable. It is also possible to halt any CPU in the idle loop with the machdep.hlt_cpus sysctl variable. The From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 11:47:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86129106564A; Sat, 20 Aug 2011 11:47:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74D2C8FC08; Sat, 20 Aug 2011 11:47:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KBlBDZ050434; Sat, 20 Aug 2011 11:47:11 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KBlBJC050432; Sat, 20 Aug 2011 11:47:11 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201108201147.p7KBlBJC050432@svn.freebsd.org> From: Andriy Gapon Date: Sat, 20 Aug 2011 11:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225027 - stable/8/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 11:47:11 -0000 Author: avg Date: Sat Aug 20 11:47:11 2011 New Revision: 225027 URL: http://svn.freebsd.org/changeset/base/225027 Log: MFC r224632: fix a serious bug in libproc's proc_attach PR: bin/158431 Modified: stable/8/lib/libproc/proc_create.c Directory Properties: stable/8/lib/libproc/ (props changed) Modified: stable/8/lib/libproc/proc_create.c ============================================================================== --- stable/8/lib/libproc/proc_create.c Sat Aug 20 11:44:48 2011 (r225026) +++ stable/8/lib/libproc/proc_create.c Sat Aug 20 11:47:11 2011 (r225027) @@ -79,12 +79,11 @@ proc_attach(pid_t pid, int flags, struct else phdl->status = PS_STOP; +out: if (error) proc_free(phdl); else *pphdl = phdl; -out: - proc_free(phdl); return (error); } From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 11:50:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93821106564A; Sat, 20 Aug 2011 11:50:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F6618FC0A; Sat, 20 Aug 2011 11:50:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KBo20E050571; Sat, 20 Aug 2011 11:50:02 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KBo2n6050570; Sat, 20 Aug 2011 11:50:02 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201108201150.p7KBo2n6050570@svn.freebsd.org> From: Andriy Gapon Date: Sat, 20 Aug 2011 11:50:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225028 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 11:50:02 -0000 Author: avg Date: Sat Aug 20 11:50:02 2011 New Revision: 225028 URL: http://svn.freebsd.org/changeset/base/225028 Log: MFC r224527: smp_rendezvous: master cpu should wait until all slaves are fully done Modified: stable/8/sys/kern/subr_smp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/subr_smp.c ============================================================================== --- stable/8/sys/kern/subr_smp.c Sat Aug 20 11:47:11 2011 (r225027) +++ stable/8/sys/kern/subr_smp.c Sat Aug 20 11:50:02 2011 (r225028) @@ -110,8 +110,7 @@ static void (*volatile smp_rv_setup_func static void (*volatile smp_rv_action_func)(void *arg); static void (*volatile smp_rv_teardown_func)(void *arg); static void *volatile smp_rv_func_arg; -static volatile int smp_rv_waiters[3]; -static volatile int smp_rv_generation; +static volatile int smp_rv_waiters[4]; /* * Shared mutex to restrict busywaits between smp_rendezvous() and @@ -345,7 +344,6 @@ smp_rendezvous_action(void) void (*local_setup_func)(void*); void (*local_action_func)(void*); void (*local_teardown_func)(void*); - int generation; #ifdef INVARIANTS int owepreempt; #endif @@ -360,7 +358,6 @@ smp_rendezvous_action(void) local_setup_func = smp_rv_setup_func; local_action_func = smp_rv_action_func; local_teardown_func = smp_rv_teardown_func; - generation = smp_rv_generation; /* * Use a nested critical section to prevent any preemptions @@ -406,32 +403,28 @@ smp_rendezvous_action(void) if (local_action_func != NULL) local_action_func(local_func_arg); - /* - * Signal that the main action has been completed. If a - * full exit rendezvous is requested, then all CPUs will - * wait here until all CPUs have finished the main action. - * - * Note that the write by the last CPU to finish the action - * may become visible to different CPUs at different times. - * As a result, the CPU that initiated the rendezvous may - * exit the rendezvous and drop the lock allowing another - * rendezvous to be initiated on the same CPU or a different - * CPU. In that case the exit sentinel may be cleared before - * all CPUs have noticed causing those CPUs to hang forever. - * Workaround this by using a generation count to notice when - * this race occurs and to exit the rendezvous in that case. - */ - MPASS(generation == smp_rv_generation); - atomic_add_int(&smp_rv_waiters[2], 1); if (local_teardown_func != smp_no_rendevous_barrier) { - while (smp_rv_waiters[2] < smp_rv_ncpus && - generation == smp_rv_generation) + /* + * Signal that the main action has been completed. If a + * full exit rendezvous is requested, then all CPUs will + * wait here until all CPUs have finished the main action. + */ + atomic_add_int(&smp_rv_waiters[2], 1); + while (smp_rv_waiters[2] < smp_rv_ncpus) cpu_spinwait(); if (local_teardown_func != NULL) local_teardown_func(local_func_arg); } + /* + * Signal that the rendezvous is fully completed by this CPU. + * This means that no member of smp_rv_* pseudo-structure will be + * accessed by this target CPU after this point; in particular, + * memory pointed by smp_rv_func_arg. + */ + atomic_add_int(&smp_rv_waiters[3], 1); + td->td_critnest--; KASSERT(owepreempt == td->td_owepreempt, ("rendezvous action changed td_owepreempt")); @@ -465,8 +458,6 @@ smp_rendezvous_cpus(cpumask_t map, mtx_lock_spin(&smp_ipi_mtx); - atomic_add_acq_int(&smp_rv_generation, 1); - /* Pass rendezvous parameters via global variables. */ smp_rv_ncpus = ncpus; smp_rv_setup_func = setup_func; @@ -475,6 +466,7 @@ smp_rendezvous_cpus(cpumask_t map, smp_rv_func_arg = arg; smp_rv_waiters[1] = 0; smp_rv_waiters[2] = 0; + smp_rv_waiters[3] = 0; atomic_store_rel_int(&smp_rv_waiters[0], 0); /* @@ -488,13 +480,13 @@ smp_rendezvous_cpus(cpumask_t map, smp_rendezvous_action(); /* - * If the caller did not request an exit barrier to be enforced - * on each CPU, ensure that this CPU waits for all the other - * CPUs to finish the rendezvous. + * Ensure that the master CPU waits for all the other + * CPUs to finish the rendezvous, so that smp_rv_* + * pseudo-structure and the arg are guaranteed to not + * be in use. */ - if (teardown_func == smp_no_rendevous_barrier) - while (atomic_load_acq_int(&smp_rv_waiters[2]) < ncpus) - cpu_spinwait(); + while (atomic_load_acq_int(&smp_rv_waiters[3]) < ncpus) + cpu_spinwait(); mtx_unlock_spin(&smp_ipi_mtx); } From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 12:08:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEBB51065670; Sat, 20 Aug 2011 12:08:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A33578FC0C; Sat, 20 Aug 2011 12:08:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KC8rJh051237; Sat, 20 Aug 2011 12:08:53 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KC8rMZ051235; Sat, 20 Aug 2011 12:08:53 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201108201208.p7KC8rMZ051235@svn.freebsd.org> From: Andriy Gapon Date: Sat, 20 Aug 2011 12:08:53 +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: r225029 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 12:08:53 -0000 Author: avg Date: Sat Aug 20 12:08:53 2011 New Revision: 225029 URL: http://svn.freebsd.org/changeset/base/225029 Log: MFC r224527: smp_rendezvous: master cpu should wait until all slaves are fully done Modified: stable/7/sys/kern/subr_smp.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/subr_smp.c ============================================================================== --- stable/7/sys/kern/subr_smp.c Sat Aug 20 11:50:02 2011 (r225028) +++ stable/7/sys/kern/subr_smp.c Sat Aug 20 12:08:53 2011 (r225029) @@ -112,8 +112,7 @@ static void (*volatile smp_rv_setup_func static void (*volatile smp_rv_action_func)(void *arg); static void (*volatile smp_rv_teardown_func)(void *arg); static void * volatile smp_rv_func_arg; -static volatile int smp_rv_waiters[3]; -static volatile int smp_rv_generation; +static volatile int smp_rv_waiters[4]; /* * Shared mutex to restrict busywaits between smp_rendezvous() and @@ -308,7 +307,6 @@ smp_rendezvous_action(void) void (*local_setup_func)(void*); void (*local_action_func)(void*); void (*local_teardown_func)(void*); - int generation; #ifdef INVARIANTS int owepreempt; #endif @@ -323,7 +321,6 @@ smp_rendezvous_action(void) local_setup_func = smp_rv_setup_func; local_action_func = smp_rv_action_func; local_teardown_func = smp_rv_teardown_func; - generation = smp_rv_generation; /* * Use a nested critical section to prevent any preemptions @@ -369,32 +366,28 @@ smp_rendezvous_action(void) if (local_action_func != NULL) local_action_func(local_func_arg); - /* - * Signal that the main action has been completed. If a - * full exit rendezvous is requested, then all CPUs will - * wait here until all CPUs have finished the main action. - * - * Note that the write by the last CPU to finish the action - * may become visible to different CPUs at different times. - * As a result, the CPU that initiated the rendezvous may - * exit the rendezvous and drop the lock allowing another - * rendezvous to be initiated on the same CPU or a different - * CPU. In that case the exit sentinel may be cleared before - * all CPUs have noticed causing those CPUs to hang forever. - * Workaround this by using a generation count to notice when - * this race occurs and to exit the rendezvous in that case. - */ - MPASS(generation == smp_rv_generation); - atomic_add_int(&smp_rv_waiters[2], 1); if (local_teardown_func != smp_no_rendevous_barrier) { - while (smp_rv_waiters[2] < smp_rv_ncpus && - generation == smp_rv_generation) + /* + * Signal that the main action has been completed. If a + * full exit rendezvous is requested, then all CPUs will + * wait here until all CPUs have finished the main action. + */ + atomic_add_int(&smp_rv_waiters[2], 1); + while (smp_rv_waiters[2] < smp_rv_ncpus) cpu_spinwait(); if (local_teardown_func != NULL) local_teardown_func(local_func_arg); } + /* + * Signal that the rendezvous is fully completed by this CPU. + * This means that no member of smp_rv_* pseudo-structure will be + * accessed by this target CPU after this point; in particular, + * memory pointed by smp_rv_func_arg. + */ + atomic_add_int(&smp_rv_waiters[3], 1); + td->td_critnest--; KASSERT(owepreempt == td->td_owepreempt, ("rendezvous action changed td_owepreempt")); @@ -427,8 +420,6 @@ smp_rendezvous_cpus(cpumask_t map, mtx_lock_spin(&smp_ipi_mtx); - atomic_add_acq_int(&smp_rv_generation, 1); - /* Pass rendezvous parameters via global variables. */ smp_rv_ncpus = ncpus; smp_rv_setup_func = setup_func; @@ -437,6 +428,7 @@ smp_rendezvous_cpus(cpumask_t map, smp_rv_func_arg = arg; smp_rv_waiters[1] = 0; smp_rv_waiters[2] = 0; + smp_rv_waiters[3] = 0; atomic_store_rel_int(&smp_rv_waiters[0], 0); /* @@ -450,13 +442,13 @@ smp_rendezvous_cpus(cpumask_t map, smp_rendezvous_action(); /* - * If the caller did not request an exit barrier to be enforced - * on each CPU, ensure that this CPU waits for all the other - * CPUs to finish the rendezvous. + * Ensure that the master CPU waits for all the other + * CPUs to finish the rendezvous, so that smp_rv_* + * pseudo-structure and the arg are guaranteed to not + * be in use. */ - if (teardown_func == smp_no_rendevous_barrier) - while (atomic_load_acq_int(&smp_rv_waiters[2]) < ncpus) - cpu_spinwait(); + while (atomic_load_acq_int(&smp_rv_waiters[3]) < ncpus) + cpu_spinwait(); mtx_unlock_spin(&smp_ipi_mtx); } From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 12:40:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09FCC1065674; Sat, 20 Aug 2011 12:40:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E28648FC15; Sat, 20 Aug 2011 12:40:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KCeHdB052223; Sat, 20 Aug 2011 12:40:17 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KCeHKg052221; Sat, 20 Aug 2011 12:40:17 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108201240.p7KCeHKg052221@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 20 Aug 2011 12:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225030 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 12:40:18 -0000 Author: bz Date: Sat Aug 20 12:40:17 2011 New Revision: 225030 URL: http://svn.freebsd.org/changeset/base/225030 Log: While not explicitly allowed by RFC 2460, in case there is no translation technology involved (and that section is suggested to be removed by Errata 2843), single packet fragments do not harm. There is another errata under discussion to clarify and allow this. Meanwhile add a sysctl to allow disabling this behaviour again. We will treat single packet fragment (a fragment header added when not needed) as if there was no fragment header. PR: kern/145733 Submitted by: Matthew Luckie (mjl luckie.org.nz) (original version) Tested by: Matthew Luckie (mjl luckie.org.nz) MFC after: 2 weeks Approved by: re (kib) Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 12:08:53 2011 (r225029) +++ head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 12:40:17 2011 (r225030) @@ -107,6 +107,9 @@ static VNET_DEFINE(int, ipfw_vnet_ready) static VNET_DEFINE(int, fw_deny_unknown_exthdrs); #define V_fw_deny_unknown_exthdrs VNET(fw_deny_unknown_exthdrs) +static VNET_DEFINE(int, fw_permit_single_frag6) = 1; +#define V_fw_permit_single_frag6 VNET(fw_permit_single_frag6) + #ifdef IPFIREWALL_DEFAULT_TO_ACCEPT static int default_to_accept = 1; #else @@ -182,6 +185,9 @@ SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, fw SYSCTL_VNET_INT(_net_inet6_ip6_fw, OID_AUTO, deny_unknown_exthdrs, CTLFLAG_RW | CTLFLAG_SECURE, &VNET_NAME(fw_deny_unknown_exthdrs), 0, "Deny packets with unknown IPv6 Extension Headers"); +SYSCTL_VNET_INT(_net_inet6_ip6_fw, OID_AUTO, permit_single_frag6, + CTLFLAG_RW | CTLFLAG_SECURE, &VNET_NAME(fw_permit_single_frag6), 0, + "Permit single packet IPv6 fragments"); #endif /* INET6 */ SYSEND @@ -871,10 +877,14 @@ ipfw_chk(struct ip_fw_args *args) * we have a fragment at this offset of an IPv4 packet. * offset == 0 means that (if this is an IPv4 packet) * this is the first or only fragment. - * For IPv6 offset == 0 means there is no Fragment Header. + * For IPv6 offset == 0 means there is no Fragment Header or there + * is a single packet fragement (fragement header added without + * needed). We will treat a single packet fragment as if there + * was no fragment header (or log/block depending on the + * V_fw_permit_single_frag6 sysctl setting). * If offset != 0 for IPv6 always use correct mask to - * get the correct offset because we add IP6F_MORE_FRAG - * to be able to dectect the first fragment which would + * get the correct offset because we add IP6F_MORE_FRAG to be able + * to dectect the first of multiple fragments which would * otherwise have offset = 0. */ u_short offset = 0; @@ -1037,10 +1047,11 @@ do { \ offset = ((struct ip6_frag *)ulp)->ip6f_offlg & IP6F_OFF_MASK; /* Add IP6F_MORE_FRAG for offset of first - * fragment to be != 0. */ + * fragment to be != 0 if there shall be more. */ offset |= ((struct ip6_frag *)ulp)->ip6f_offlg & IP6F_MORE_FRAG; - if (offset == 0) { + if (V_fw_permit_single_frag6 == 0 && + offset == 0) { printf("IPFW2: IPV6 - Invalid Fragment " "Header\n"); if (V_fw_deny_unknown_exthdrs) From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 13:17:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D4FA1065672; Sat, 20 Aug 2011 13:17:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D75598FC16; Sat, 20 Aug 2011 13:17:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KDHl29053380; Sat, 20 Aug 2011 13:17:47 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KDHlUx053378; Sat, 20 Aug 2011 13:17:47 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108201317.p7KDHlUx053378@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 20 Aug 2011 13:17:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225032 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 13:17:48 -0000 Author: bz Date: Sat Aug 20 13:17:47 2011 New Revision: 225032 URL: http://svn.freebsd.org/changeset/base/225032 Log: ipfw internally checks for offset == 0 to determine whether the packet is a/the first fragment or not. For IPv6 we have added the "more fragments" flag as well to be able to determine on whether there will be more as we do not have the fragment header avaialble for logging, while for IPv4 this information can be derived directly from the IPv4 header. This allowed fragmented packets to bypass normal rules as proper masking was not done when checking offset. Split variables to not need masking for IPv6 to avoid further errors. PR: kern/145733 Submitted by: Matthew Luckie (mjl luckie.org.nz) MFC after: 2 weeks Approved by: re (kib) Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 13:07:29 2011 (r225031) +++ head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 13:17:47 2011 (r225032) @@ -877,17 +877,14 @@ ipfw_chk(struct ip_fw_args *args) * we have a fragment at this offset of an IPv4 packet. * offset == 0 means that (if this is an IPv4 packet) * this is the first or only fragment. - * For IPv6 offset == 0 means there is no Fragment Header or there - * is a single packet fragement (fragement header added without - * needed). We will treat a single packet fragment as if there - * was no fragment header (or log/block depending on the + * For IPv6 offset|ip6f_mf == 0 means there is no Fragment Header + * or there is a single packet fragement (fragement header added + * without needed). We will treat a single packet fragment as if + * there was no fragment header (or log/block depending on the * V_fw_permit_single_frag6 sysctl setting). - * If offset != 0 for IPv6 always use correct mask to - * get the correct offset because we add IP6F_MORE_FRAG to be able - * to dectect the first of multiple fragments which would - * otherwise have offset = 0. */ u_short offset = 0; + u_short ip6f_mf = 0; /* * Local copies of addresses. They are only valid if we have @@ -1046,12 +1043,10 @@ do { \ proto = ((struct ip6_frag *)ulp)->ip6f_nxt; offset = ((struct ip6_frag *)ulp)->ip6f_offlg & IP6F_OFF_MASK; - /* Add IP6F_MORE_FRAG for offset of first - * fragment to be != 0 if there shall be more. */ - offset |= ((struct ip6_frag *)ulp)->ip6f_offlg & + ip6f_mf = ((struct ip6_frag *)ulp)->ip6f_offlg & IP6F_MORE_FRAG; if (V_fw_permit_single_frag6 == 0 && - offset == 0) { + offset == 0 && ip6f_mf == 0) { printf("IPFW2: IPV6 - Invalid Fragment " "Header\n"); if (V_fw_deny_unknown_exthdrs) @@ -1687,7 +1682,7 @@ do { \ case O_LOG: ipfw_log(f, hlen, args, m, - oif, offset, tablearg, ip); + oif, offset | ip6f_mf, tablearg, ip); match = 1; break; From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 13:46:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDF96106566B; Sat, 20 Aug 2011 13:46:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD5048FC1B; Sat, 20 Aug 2011 13:46:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KDkJTP054245; Sat, 20 Aug 2011 13:46:19 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KDkJ1L054243; Sat, 20 Aug 2011 13:46:19 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108201346.p7KDkJ1L054243@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 20 Aug 2011 13:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225033 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 13:46:20 -0000 Author: bz Date: Sat Aug 20 13:46:19 2011 New Revision: 225033 URL: http://svn.freebsd.org/changeset/base/225033 Log: If we detect an IPv6 fragment header and it is not the first fragment, then terminate the loop as we will not find any further headers and for short fragments this could otherwise lead to a pullup error discarding the fragment. PR: kern/145733 Submitted by: Matthew Luckie (mjl luckie.org.nz) MFC after: 2 weeks Approved by: re (kib) Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 13:17:47 2011 (r225032) +++ head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 13:46:19 2011 (r225033) @@ -978,7 +978,7 @@ do { \ proto = ip6->ip6_nxt; /* Search extension headers to find upper layer protocols */ - while (ulp == NULL) { + while (ulp == NULL && offset == 0) { switch (proto) { case IPPROTO_ICMPV6: PULLUP_TO(hlen, ulp, struct icmp6_hdr); From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 13:47:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1680B106564A; Sat, 20 Aug 2011 13:47:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05F148FC0C; Sat, 20 Aug 2011 13:47:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KDl8AE054312; Sat, 20 Aug 2011 13:47:08 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KDl8SA054310; Sat, 20 Aug 2011 13:47:08 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108201347.p7KDl8SA054310@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 20 Aug 2011 13:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225034 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 13:47:09 -0000 Author: bz Date: Sat Aug 20 13:47:08 2011 New Revision: 225034 URL: http://svn.freebsd.org/changeset/base/225034 Log: After r225032 fix logging in a similar way masking the the IPv6 more fragments flag off so that offset == 0 checks work properly. PR: kern/145733 Submitted by: Matthew Luckie (mjl luckie.org.nz) MFC after: 2 weeks X-MFC with: r225032 Approved by: re (kib) Modified: head/sys/netinet/ipfw/ip_fw_log.c Modified: head/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_log.c Sat Aug 20 13:46:19 2011 (r225033) +++ head/sys/netinet/ipfw/ip_fw_log.c Sat Aug 20 13:47:08 2011 (r225034) @@ -333,10 +333,14 @@ ipfw_log(struct ip_fw *f, u_int hlen, st #ifdef INET6 struct ip6_hdr *ip6 = NULL; struct icmp6_hdr *icmp6; + u_short ip6f_mf; #endif src[0] = '\0'; dst[0] = '\0'; #ifdef INET6 + ip6f_mf = offset & IP6F_MORE_FRAG; + offset &= IP6F_OFF_MASK; + if (IS_IP6_FLOW_ID(&(args->f_id))) { char ip6buf[INET6_ADDRSTRLEN]; snprintf(src, sizeof(src), "[%s]", @@ -418,8 +422,7 @@ ipfw_log(struct ip_fw *f, u_int hlen, st " (frag %08x:%d@%d%s)", args->f_id.extra, ntohs(ip6->ip6_plen) - hlen, - ntohs(offset & IP6F_OFF_MASK) << 3, - (offset & IP6F_MORE_FRAG) ? "+" : ""); + ntohs(offset) << 3, ip6f_mf ? "+" : ""); } else #endif { From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 13:54:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C7B8106566B; Sat, 20 Aug 2011 13:54:27 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from swip.net (mailfe08.c2i.net [212.247.154.226]) by mx1.freebsd.org (Postfix) with ESMTP id 192D88FC19; Sat, 20 Aug 2011 13:54:25 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=0STrgBBJ/IeSzGUncdVPgrlXwYQACyAaeTEJnWJdz8Q= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=GWBMAHuL6AAA:10 a=dBRESv0yCI8A:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=4AcDRF-E5KFG74r69WgA:9 a=pILNOxqGKmIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 168735480; Sat, 20 Aug 2011 15:44:22 +0200 Received-SPF: softfail receiver=mailfe08.swip.net; client-ip=188.126.198.129; envelope-from=hselasky@freebsd.org From: Hans Petter Selasky To: "Sean C. Farley" Date: Sat, 20 Aug 2011 15:41:53 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201108160834.p7G8YHiT048516@svn.freebsd.org> In-Reply-To: X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201108201541.54006.hselasky@freebsd.org> Cc: "svn-src-head@FreeBSD.org" , "svn-src-all@FreeBSD.org" , "src-committers@FreeBSD.org" Subject: Re: svn commit: r224903 - head/lib/libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 13:54:27 -0000 On Wednesday 17 August 2011 02:38:22 Sean C. Farley wrote: > On Tue, 16 Aug 2011, Hans Petter Selasky wrote: > > +enum libusb_speed > > +libusb_get_device_speed(libusb_device *dev) > > +{ > > + if (dev == NULL) > > + return (0); /* should not happen */ > > Should that return LIBUSB_SPEED_UNKNOWN instead of 0? Yes, that's correct. --HPS From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 14:04:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63A2C1065670; Sat, 20 Aug 2011 14:04:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A6CA8FC08; Sat, 20 Aug 2011 14:04:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KE4GL4054852; Sat, 20 Aug 2011 14:04:16 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KE4GDM054850; Sat, 20 Aug 2011 14:04:16 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108201404.p7KE4GDM054850@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 20 Aug 2011 14:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225035 - head/lib/libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 14:04:17 -0000 Author: hselasky Date: Sat Aug 20 14:04:16 2011 New Revision: 225035 URL: http://svn.freebsd.org/changeset/base/225035 Log: Use correct enum instead of constant value. MFC after: 1 week Spotted by: scf @ Approved by: re (kib) Modified: head/lib/libusb/libusb10.c Modified: head/lib/libusb/libusb10.c ============================================================================== --- head/lib/libusb/libusb10.c Sat Aug 20 13:47:08 2011 (r225034) +++ head/lib/libusb/libusb10.c Sat Aug 20 14:04:16 2011 (r225035) @@ -276,7 +276,7 @@ enum libusb_speed libusb_get_device_speed(libusb_device *dev) { if (dev == NULL) - return (0); /* should not happen */ + return (LIBUSB_SPEED_UNKNOWN); /* should not happen */ switch (libusb20_dev_get_speed(dev->os_priv)) { case LIBUSB20_SPEED_LOW: From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 14:20:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BC82106564A; Sat, 20 Aug 2011 14:20:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF48C8FC08; Sat, 20 Aug 2011 14:20:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KEKaj7055491; Sat, 20 Aug 2011 14:20:36 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KEKarl055489; Sat, 20 Aug 2011 14:20:36 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108201420.p7KEKarl055489@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 20 Aug 2011 14:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225036 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 14:20:37 -0000 Author: bz Date: Sat Aug 20 14:20:36 2011 New Revision: 225036 URL: http://svn.freebsd.org/changeset/base/225036 Log: Hide IPv6 next header parsing warnings under the verbose sysctl so people can possibly disable it when their consoles are flooded, or enabled it for debugging. MFC after: 2 weeks Approved by: re (kib) Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 14:04:16 2011 (r225035) +++ head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 14:20:36 2011 (r225036) @@ -1023,9 +1023,11 @@ do { \ ext_hd |= EXT_RTHDR2; break; default: - printf("IPFW2: IPV6 - Unknown Routing " - "Header type(%d)\n", - ((struct ip6_rthdr *)ulp)->ip6r_type); + if (V_fw_verbose) + printf("IPFW2: IPV6 - Unknown " + "Routing Header type(%d)\n", + ((struct ip6_rthdr *) + ulp)->ip6r_type); if (V_fw_deny_unknown_exthdrs) return (IP_FW_DENY); break; @@ -1047,8 +1049,9 @@ do { \ IP6F_MORE_FRAG; if (V_fw_permit_single_frag6 == 0 && offset == 0 && ip6f_mf == 0) { - printf("IPFW2: IPV6 - Invalid Fragment " - "Header\n"); + if (V_fw_verbose) + printf("IPFW2: IPV6 - Invalid " + "Fragment Header\n"); if (V_fw_deny_unknown_exthdrs) return (IP_FW_DENY); break; @@ -1119,8 +1122,10 @@ do { \ break; default: - printf("IPFW2: IPV6 - Unknown Extension " - "Header(%d), ext_hd=%x\n", proto, ext_hd); + if (V_fw_verbose) + printf("IPFW2: IPV6 - Unknown " + "Extension Header(%d), ext_hd=%x\n", + proto, ext_hd); if (V_fw_deny_unknown_exthdrs) return (IP_FW_DENY); PULLUP_TO(hlen, ulp, struct ip6_ext); From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 14:21:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03AC510656EB; Sat, 20 Aug 2011 14:21:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD14E8FC0A; Sat, 20 Aug 2011 14:21:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KELWKC055565; Sat, 20 Aug 2011 14:21:32 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KELWkc055561; Sat, 20 Aug 2011 14:21:32 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108201421.p7KELWkc055561@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 20 Aug 2011 14:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225037 - in head: share/man/man4 sys/dev/usb sys/dev/usb/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 14:21:33 -0000 Author: hselasky Date: Sat Aug 20 14:21:32 2011 New Revision: 225037 URL: http://svn.freebsd.org/changeset/base/225037 Log: Add new USB ID. Approved by: re (kib) MFC after: 1 week PR: usb/159836 Modified: head/share/man/man4/uhso.4 head/sys/dev/usb/net/uhso.c head/sys/dev/usb/usbdevs Modified: head/share/man/man4/uhso.4 ============================================================================== --- head/share/man/man4/uhso.4 Sat Aug 20 14:20:36 2011 (r225036) +++ head/share/man/man4/uhso.4 Sat Aug 20 14:21:32 2011 (r225037) @@ -79,6 +79,8 @@ The following devices have been verified .It Option GlobeSurfer iCON 7.2 (new firmware) .It +Option GlobeTrotter Max 7.2 (new firmware) +.It Option iCON 225 .It Option iCON 452 Modified: head/sys/dev/usb/net/uhso.c ============================================================================== --- head/sys/dev/usb/net/uhso.c Sat Aug 20 14:20:36 2011 (r225036) +++ head/sys/dev/usb/net/uhso.c Sat Aug 20 14:21:32 2011 (r225037) @@ -249,6 +249,8 @@ static struct unrhdr *uhso_ifnet_unit = static const STRUCT_USB_HOST_ID uhso_devs[] = { #define UHSO_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + /* Option GlobeTrotter MAX 7.2 with upgraded firmware */ + UHSO_DEV(OPTION, GTMAX72, UHSO_STATIC_IFACE), /* Option GlobeSurfer iCON 7.2 */ UHSO_DEV(OPTION, GSICON72, UHSO_STATIC_IFACE), /* Option iCON 225 */ Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sat Aug 20 14:20:36 2011 (r225036) +++ head/sys/dev/usb/usbdevs Sat Aug 20 14:21:32 2011 (r225037) @@ -2448,6 +2448,7 @@ product OPTION GT3GQUAD 0x6300 GlobeTro product OPTION GT3GPLUS 0x6600 GlobeTrotter 3G+ datacard product OPTION GTICON322 0xd033 GlobeTrotter Icon322 storage product OPTION GTMAX36 0x6701 GlobeTrotter Max 3.6 Modem +product OPTION GTMAX72 0x6711 GlobeTrotter Max 7.2 HSDPA product OPTION GTHSDPA 0x6971 GlobeTrotter HSDPA product OPTION GTMAXHSUPA 0x7001 GlobeTrotter HSUPA product OPTION GTMAXHSUPAE 0x6901 GlobeTrotter HSUPA PCIe From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 15:12:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2000F106564A; Sat, 20 Aug 2011 15:12:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F22E8FC08; Sat, 20 Aug 2011 15:12:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KFCrSi057154; Sat, 20 Aug 2011 15:12:53 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KFCrn1057152; Sat, 20 Aug 2011 15:12:53 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108201512.p7KFCrn1057152@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 20 Aug 2011 15:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225038 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 15:12:54 -0000 Author: hselasky Date: Sat Aug 20 15:12:53 2011 New Revision: 225038 URL: http://svn.freebsd.org/changeset/base/225038 Log: Fix for recursive locking in usb_close() after change 224777. Approved by: re (kib) MFC after: 3 days Reported by: kwm @ Modified: head/sys/dev/usb/usb_dev.c Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Sat Aug 20 14:21:32 2011 (r225037) +++ head/sys/dev/usb/usb_dev.c Sat Aug 20 15:12:53 2011 (r225038) @@ -911,10 +911,23 @@ usb_close(void *arg) DPRINTFN(2, "cpd=%p\n", cpd); - err = usb_ref_device(cpd, &refs, 1); - if (err) { - free(cpd, M_USBDEV); - return; + err = usb_ref_device(cpd, &refs, 0); + if (err) + goto done; + + /* + * If this function is not called directly from the root HUB + * thread, there is usually a need to lock the enumeration + * lock. Check this. + */ + if (!usbd_enum_is_locked(cpd->udev)) { + + DPRINTFN(2, "Locking enumeration\n"); + + /* reference device */ + err = usb_usb_ref_device(cpd, &refs); + if (err) + goto done; } if (cpd->fflags & FREAD) { usb_fifo_close(refs.rxfifo, cpd->fflags); @@ -922,10 +935,9 @@ usb_close(void *arg) if (cpd->fflags & FWRITE) { usb_fifo_close(refs.txfifo, cpd->fflags); } - usb_unref_device(cpd, &refs); +done: free(cpd, M_USBDEV); - return; } static void From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 15:21:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8EB71065670; Sat, 20 Aug 2011 15:21:02 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7CF38FC0A; Sat, 20 Aug 2011 15:21:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KFL2eY057469; Sat, 20 Aug 2011 15:21:02 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KFL2AF057467; Sat, 20 Aug 2011 15:21:02 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201108201521.p7KFL2AF057467@svn.freebsd.org> From: Jaakko Heinonen Date: Sat, 20 Aug 2011 15:21:02 +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: r225039 - stable/7/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 15:21:03 -0000 Author: jh Date: Sat Aug 20 15:21:02 2011 New Revision: 225039 URL: http://svn.freebsd.org/changeset/base/225039 Log: MFC r208717: Don't try to call cdevsw d_close() method when devfs_close() is called because of insmntque1() failure. Modified: stable/7/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/7/sys/fs/devfs/devfs_vnops.c Sat Aug 20 15:12:53 2011 (r225038) +++ stable/7/sys/fs/devfs/devfs_vnops.c Sat Aug 20 15:21:02 2011 (r225039) @@ -396,6 +396,13 @@ devfs_close(struct vop_close_args *ap) int vp_locked, error; /* + * XXX: Don't call d_close() if we were called because of + * XXX: insmntque1() failure. + */ + if (vp->v_data == NULL) + return (0); + + /* * Hack: a tty device that is a controlling terminal * has a reference from the session structure. * We cannot easily tell that a character device is From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 16:12:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 807D71065672; Sat, 20 Aug 2011 16:12:29 +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 704BA8FC08; Sat, 20 Aug 2011 16:12:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KGCTTU059040; Sat, 20 Aug 2011 16:12:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KGCTMa059038; Sat, 20 Aug 2011 16:12:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108201612.p7KGCTMa059038@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 20 Aug 2011 16:12:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225040 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 16:12:29 -0000 Author: kib Date: Sat Aug 20 16:12:29 2011 New Revision: 225040 URL: http://svn.freebsd.org/changeset/base/225040 Log: Prevent the hiwatermark for the unix domain socket from becoming effectively negative. Often seen as upstream fastcgi connection timeouts in nginx when using sendfile over unix domain sockets for communication. Sendfile(2) may send more bytes then currently allowed by the hiwatermark of the socket, e.g. because the so_snd sockbuf lock is dropped after sbspace() call in the kern_sendfile() loop. In this case, recalculated hiwatermark will overflow. Since lowatermark is renewed as half of the hiwatermark by sendfile code, and both are unsigned, the send buffer never reaches the free space requested by lowatermark, causing indefinite wait in sendfile. Reviewed by: rwatson Approved by: re (bz) MFC after: 2 weeks Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Sat Aug 20 15:21:02 2011 (r225039) +++ head/sys/kern/uipc_usrreq.c Sat Aug 20 16:12:29 2011 (r225040) @@ -816,7 +816,7 @@ uipc_send(struct socket *so, int flags, struct unpcb *unp, *unp2; struct socket *so2; u_int mbcnt_delta, sbcc; - u_long newhiwat; + u_int newhiwat; int error = 0; unp = sotounpcb(so); @@ -974,7 +974,10 @@ uipc_send(struct socket *so, int flags, sorwakeup_locked(so2); SOCKBUF_LOCK(&so->so_snd); - newhiwat = so->so_snd.sb_hiwat - (sbcc - unp2->unp_cc); + if ((int)so->so_snd.sb_hiwat >= (int)(sbcc - unp2->unp_cc)) + newhiwat = so->so_snd.sb_hiwat - (sbcc - unp2->unp_cc); + else + newhiwat = 0; (void)chgsbsize(so->so_cred->cr_uidinfo, &so->so_snd.sb_hiwat, newhiwat, RLIM_INFINITY); so->so_snd.sb_mbmax -= mbcnt_delta; From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 16:21:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 957A7106564A; Sat, 20 Aug 2011 16:21:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C8BA8FC13; Sat, 20 Aug 2011 16:21:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KGLfYI059337; Sat, 20 Aug 2011 16:21:41 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KGLfxV059334; Sat, 20 Aug 2011 16:21:41 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108201621.p7KGLfxV059334@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 20 Aug 2011 16:21:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225041 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 16:21:41 -0000 Author: hselasky Date: Sat Aug 20 16:21:40 2011 New Revision: 225041 URL: http://svn.freebsd.org/changeset/base/225041 Log: Add new USB ID to u3g driver. Approved by: re (kib) MFC after: 1 week PR: usb/159919 Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Sat Aug 20 16:12:29 2011 (r225040) +++ head/sys/dev/usb/serial/u3g.c Sat Aug 20 16:21:40 2011 (r225041) @@ -280,6 +280,8 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(HUAWEI, E143D, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E143E, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E143F, U3GINIT_HUAWEI), + U3G_DEV(HUAWEI, E173, 0), + U3G_DEV(HUAWEI, E173_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, E180V, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sat Aug 20 16:12:29 2011 (r225040) +++ head/sys/dev/usb/usbdevs Sat Aug 20 16:21:40 2011 (r225041) @@ -1874,6 +1874,8 @@ product HUAWEI E1752 0x1446 3G modem product HUAWEI K3765 0x1465 3G modem product HUAWEI E1820 0x14ac E1820 HSPA+ USB Slider product HUAWEI K3765_INIT 0x1520 K3765 Initial +product HUAWEI E173 0x1c05 3G modem +product HUAWEI E173_INIT 0x1c0b 3G modem initial /* HUAWEI 3com products */ product HUAWEI3COM WUB320G 0x0009 Aolynk WUB320g From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 16:43:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22327106566C; Sat, 20 Aug 2011 16:43:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12EE28FC12; Sat, 20 Aug 2011 16:43:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KGhlKp060210; Sat, 20 Aug 2011 16:43:47 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KGhl1M060207; Sat, 20 Aug 2011 16:43:47 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108201643.p7KGhl1M060207@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 20 Aug 2011 16:43:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225043 - head/sys/netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 16:43:48 -0000 Author: bz Date: Sat Aug 20 16:43:47 2011 New Revision: 225043 URL: http://svn.freebsd.org/changeset/base/225043 Log: Add an in6_localip() helper function as in6_localaddr() is not doing what people think: returning true for an address in any connected subnet, not necessarily on the local machine. Sponsored by: Sandvine Incorporated MFC after: 2 weeks Approved by: re (kib) Modified: head/sys/netinet6/in6.c head/sys/netinet6/in6.h Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Aug 20 16:34:31 2011 (r225042) +++ head/sys/netinet6/in6.c Sat Aug 20 16:43:47 2011 (r225043) @@ -2017,6 +2017,27 @@ in6_localaddr(struct in6_addr *in6) return (0); } +/* + * Return 1 if an internet address is for the local host and configured + * on one of its interfaces. + */ +int +in6_localip(struct in6_addr *in6) +{ + struct in6_ifaddr *ia; + + IN6_IFADDR_RLOCK(); + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + if (IN6_ARE_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr)) { + IN6_IFADDR_RUNLOCK(); + return (1); + } + } + IN6_IFADDR_RUNLOCK(); + return (0); +} + + int in6_is_addr_deprecated(struct sockaddr_in6 *sa6) { Modified: head/sys/netinet6/in6.h ============================================================================== --- head/sys/netinet6/in6.h Sat Aug 20 16:34:31 2011 (r225042) +++ head/sys/netinet6/in6.h Sat Aug 20 16:43:47 2011 (r225043) @@ -631,6 +631,7 @@ struct cmsghdr; int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t)); int in6_localaddr __P((struct in6_addr *)); +int in6_localip(struct in6_addr *); int in6_addrscope __P((struct in6_addr *)); struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *)); extern void in6_if_up __P((struct ifnet *)); From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 17:05:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07018106564A; Sat, 20 Aug 2011 17:05:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E93208FC17; Sat, 20 Aug 2011 17:05:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KH5BTU060970; Sat, 20 Aug 2011 17:05:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KH5BmW060953; Sat, 20 Aug 2011 17:05:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108201705.p7KH5BmW060953@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 20 Aug 2011 17:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225044 - in head: sbin/ipfw sys/netinet sys/netinet/ipfw sys/netinet6 tools/regression/ipfw tools/regression/ipfw/fwd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 17:05:12 -0000 Author: bz Date: Sat Aug 20 17:05:11 2011 New Revision: 225044 URL: http://svn.freebsd.org/changeset/base/225044 Log: Add support for IPv6 to ipfw fwd: Distinguish IPv4 and IPv6 addresses and optional port numbers in user space to set the option for the correct protocol family. Add support in the kernel for carrying the new IPv6 destination address and port. Add support to TCP and UDP for IPv6 and fix UDP IPv4 to not change the address in the IP header. Add support for IPv6 forwarding to a non-local destination. Add a regession test uitilizing VIMAGE to check all 20 possible combinations I could think of. Obtained from: David Dolson at Sandvine Incorporated (original version for ipfw fwd IPv6 support) Sponsored by: Sandvine Incorporated PR: bin/117214 MFC after: 4 weeks Approved by: re (kib) Added: head/tools/regression/ipfw/ head/tools/regression/ipfw/fwd/ head/tools/regression/ipfw/fwd/vimage-fwd.sh (contents, props changed) Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sys/netinet/ip_fw.h head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_log.c head/sys/netinet/ipfw/ip_fw_pfil.c head/sys/netinet/ipfw/ip_fw_private.h head/sys/netinet/ipfw/ip_fw_sockopt.c head/sys/netinet/tcp_input.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_output.c head/sys/netinet6/udp6_usrreq.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Sat Aug 20 16:43:47 2011 (r225043) +++ head/sbin/ipfw/ipfw.8 Sat Aug 20 17:05:11 2011 (r225044) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 29, 2011 +.Dd August 20, 2011 .Dt IPFW 8 .Os .Sh NAME @@ -726,7 +726,7 @@ The search terminates. Change the next-hop on matching packets to .Ar ipaddr , which can be an IP address or a host name. -The next hop can also be supplied by the last table +For IPv4, the next hop can also be supplied by the last table looked up for the packet by using the .Cm tablearg keyword instead of an explicit address. Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sbin/ipfw/ipfw2.c Sat Aug 20 17:05:11 2011 (r225044) @@ -1111,6 +1111,18 @@ show_ipfw(struct ip_fw *rule, int pcwidt } break; + case O_FORWARD_IP6: + { + char buf[4 + INET6_ADDRSTRLEN + 1]; + ipfw_insn_sa6 *s = (ipfw_insn_sa6 *)cmd; + + printf("fwd %s", inet_ntop(AF_INET6, &s->sa.sin6_addr, + buf, sizeof(buf))); + if (s->sa.sin6_port) + printf(",%d", s->sa.sin6_port); + } + break; + case O_LOG: /* O_LOG is printed last */ logptr = (ipfw_insn_log *)cmd; break; @@ -2809,40 +2821,96 @@ chkarg: break; case TOK_FORWARD: { - ipfw_insn_sa *p = (ipfw_insn_sa *)action; + /* + * Locate the address-port separator (':' or ','). + * Could be one of the following: + * hostname:port + * IPv4 a.b.c.d,port + * IPv4 a.b.c.d:port + * IPv6 w:x:y::z,port + * The ':' can only be used with hostname and IPv4 address. + * XXX-BZ Should we also support [w:x:y::z]:port? + */ + struct sockaddr_storage result; + struct addrinfo *res; char *s, *end; + int family; + u_short port_number; NEED1("missing forward address[:port]"); - action->opcode = O_FORWARD_IP; - action->len = F_INSN_SIZE(ipfw_insn_sa); - - /* - * In the kernel we assume AF_INET and use only - * sin_port and sin_addr. Remember to set sin_len as - * the routing code seems to use it too. - */ - p->sa.sin_family = AF_INET; - p->sa.sin_len = sizeof(struct sockaddr_in); - p->sa.sin_port = 0; /* * locate the address-port separator (':' or ',') */ - s = strchr(*av, ':'); - if (s == NULL) - s = strchr(*av, ','); + s = strchr(*av, ','); + if (s == NULL) { + /* Distinguish between IPv4:port and IPv6 cases. */ + s = strchr(*av, ':'); + if (s && strchr(s+1, ':')) + s = NULL; /* no port */ + } + + port_number = 0; if (s != NULL) { + /* Terminate host portion and set s to start of port. */ *(s++) = '\0'; i = strtoport(s, &end, 0 /* base */, 0 /* proto */); if (s == end) errx(EX_DATAERR, "illegal forwarding port ``%s''", s); - p->sa.sin_port = (u_short)i; + port_number = (u_short)i; + } + + if (_substrcmp(*av, "tablearg") == 0) { + family = PF_INET; + ((struct sockaddr_in*)&result)->sin_addr.s_addr = + INADDR_ANY; + } else { + /* + * Resolve the host name or address to a family and a + * network representation of the addres. + */ + if (getaddrinfo(*av, NULL, NULL, &res)) + errx(EX_DATAERR, NULL); + /* Just use the first host in the answer. */ + family = res->ai_family; + memcpy(&result, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + } + + if (family == PF_INET) { + ipfw_insn_sa *p = (ipfw_insn_sa *)action; + + action->opcode = O_FORWARD_IP; + action->len = F_INSN_SIZE(ipfw_insn_sa); + + /* + * In the kernel we assume AF_INET and use only + * sin_port and sin_addr. Remember to set sin_len as + * the routing code seems to use it too. + */ + p->sa.sin_len = sizeof(struct sockaddr_in); + p->sa.sin_family = AF_INET; + p->sa.sin_port = port_number; + p->sa.sin_addr.s_addr = + ((struct sockaddr_in *)&result)->sin_addr.s_addr; + } else if (family == PF_INET6) { + ipfw_insn_sa6 *p = (ipfw_insn_sa6 *)action; + + action->opcode = O_FORWARD_IP6; + action->len = F_INSN_SIZE(ipfw_insn_sa6); + + p->sa.sin6_len = sizeof(struct sockaddr_in6); + p->sa.sin6_family = AF_INET6; + p->sa.sin6_port = port_number; + p->sa.sin6_flowinfo = 0; + p->sa.sin6_scope_id = 0; + /* No table support for v6 yet. */ + bcopy(&((struct sockaddr_in6*)&result)->sin6_addr, + &p->sa.sin6_addr, sizeof(p->sa.sin6_addr)); + } else { + errx(EX_DATAERR, "Invalid address family in forward action"); } - if (_substrcmp(*av, "tablearg") == 0) - p->sa.sin_addr.s_addr = INADDR_ANY; - else - lookup_host(*av, &(p->sa.sin_addr)); av++; break; } Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet/ip_fw.h Sat Aug 20 17:05:11 2011 (r225044) @@ -203,6 +203,8 @@ enum ipfw_opcodes { /* arguments (4 byt O_CALLRETURN, /* arg1=called rule number */ + O_FORWARD_IP6, /* fwd sockaddr_in6 */ + O_LAST_OPCODE /* not an opcode! */ }; @@ -299,6 +301,14 @@ typedef struct _ipfw_insn_sa { } ipfw_insn_sa; /* + * This is used to forward to a given address (ipv6). + */ +typedef struct _ipfw_insn_sa6 { + ipfw_insn o; + struct sockaddr_in6 sa; +} ipfw_insn_sa6; + +/* * This is used for MAC addr-mask pairs. */ typedef struct _ipfw_insn_mac { Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet/ipfw/ip_fw2.c Sat Aug 20 17:05:11 2011 (r225044) @@ -796,6 +796,7 @@ set_match(struct ip_fw_args *args, int s * * args->rule Pointer to the last matching rule (in/out) * args->next_hop Socket we are forwarding to (out). + * args->next_hop6 IPv6 next hop we are forwarding to (out). * args->f_id Addresses grabbed from the packet (out) * args->rule.info a cookie depending on rule action * @@ -2281,6 +2282,23 @@ do { \ done = 1; /* exit outer loop */ break; +#ifdef INET6 + case O_FORWARD_IP6: + if (args->eh) /* not valid on layer2 pkts */ + break; + if (q == NULL || q->rule != f || + dyn_dir == MATCH_FORWARD) { + struct sockaddr_in6 *sin6; + + sin6 = &(((ipfw_insn_sa6 *)cmd)->sa); + args->next_hop6 = sin6; + } + retval = IP_FW_PASS; + l = 0; /* exit inner loop */ + done = 1; /* exit outer loop */ + break; +#endif + case O_NETGRAPH: case O_NGTEE: set_match(args, f_pos, chain); Modified: head/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_log.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet/ipfw/ip_fw_log.c Sat Aug 20 17:05:11 2011 (r225044) @@ -167,7 +167,7 @@ ipfw_log(struct ip_fw *f, u_int hlen, st { char *action; int limit_reached = 0; - char action2[40], proto[128], fragment[32]; + char action2[92], proto[128], fragment[32]; if (V_fw_verbose == 0) { #ifndef WITHOUT_BPF @@ -290,6 +290,21 @@ ipfw_log(struct ip_fw *f, u_int hlen, st sa->sa.sin_port); } break; +#ifdef INET6 + case O_FORWARD_IP6: { + char buf[INET6_ADDRSTRLEN]; + ipfw_insn_sa6 *sa = (ipfw_insn_sa6 *)cmd; + int len; + + len = snprintf(SNPARGS(action2, 0), "Forward to [%s]", + ip6_sprintf(buf, &sa->sa.sin6_addr)); + + if (sa->sa.sin6_port) + snprintf(SNPARGS(action2, len), ":%u", + sa->sa.sin6_port); + } + break; +#endif case O_NETGRAPH: snprintf(SNPARGS(action2, 0), "Netgraph %d", cmd->arg1); Modified: head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_pfil.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet/ipfw/ip_fw_pfil.c Sat Aug 20 17:05:11 2011 (r225044) @@ -152,13 +152,26 @@ again: switch (ipfw) { case IP_FW_PASS: /* next_hop may be set by ipfw_chk */ - if (args.next_hop == NULL) + if (args.next_hop == NULL && args.next_hop6 == NULL) break; /* pass */ #ifndef IPFIREWALL_FORWARD ret = EACCES; #else { struct m_tag *fwd_tag; + size_t len; + + KASSERT(args.next_hop == NULL || args.next_hop6 == NULL, + ("%s: both next_hop=%p and next_hop6=%p not NULL", __func__, + args.next_hop, args.next_hop6)); +#ifdef INET6 + if (args.next_hop6 != NULL) + len = sizeof(struct sockaddr_in6); +#endif +#ifdef INET + if (args.next_hop != NULL) + len = sizeof(struct sockaddr_in); +#endif /* Incoming packets should not be tagged so we do not * m_tag_find. Outgoing packets may be tagged, so we @@ -169,18 +182,28 @@ again: if (fwd_tag != NULL) { m_tag_unlink(*m0, fwd_tag); } else { - fwd_tag = m_tag_get(PACKET_TAG_IPFORWARD, - sizeof(struct sockaddr_in), M_NOWAIT); + fwd_tag = m_tag_get(PACKET_TAG_IPFORWARD, len, + M_NOWAIT); if (fwd_tag == NULL) { ret = EACCES; break; /* i.e. drop */ } } - bcopy(args.next_hop, (fwd_tag+1), sizeof(struct sockaddr_in)); +#ifdef INET6 + if (args.next_hop6 != NULL) { + bcopy(args.next_hop6, (fwd_tag+1), len); + if (in6_localip(&args.next_hop6->sin6_addr)) + (*m0)->m_flags |= M_FASTFWD_OURS; + } +#endif +#ifdef INET + if (args.next_hop != NULL) { + bcopy(args.next_hop, (fwd_tag+1), len); + if (in_localip(args.next_hop->sin_addr)) + (*m0)->m_flags |= M_FASTFWD_OURS; + } +#endif m_tag_prepend(*m0, fwd_tag); - - if (in_localip(args.next_hop->sin_addr)) - (*m0)->m_flags |= M_FASTFWD_OURS; } #endif break; Modified: head/sys/netinet/ipfw/ip_fw_private.h ============================================================================== --- head/sys/netinet/ipfw/ip_fw_private.h Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet/ipfw/ip_fw_private.h Sat Aug 20 17:05:11 2011 (r225044) @@ -86,6 +86,7 @@ struct ip_fw_args { struct mbuf *m; /* the mbuf chain */ struct ifnet *oif; /* output interface */ struct sockaddr_in *next_hop; /* forward address */ + struct sockaddr_in6 *next_hop6; /* ipv6 forward address */ /* * On return, it points to the matching rule. Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_sockopt.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet/ipfw/ip_fw_sockopt.c Sat Aug 20 17:05:11 2011 (r225044) @@ -723,6 +723,17 @@ check_ipfw_struct(struct ip_fw *rule, in return EINVAL; #endif +#ifdef INET6 + case O_FORWARD_IP6: +#ifdef IPFIREWALL_FORWARD + if (cmdlen != F_INSN_SIZE(ipfw_insn_sa6)) + goto bad_size; + goto check_action; +#else + return (EINVAL); +#endif +#endif /* INET6 */ + case O_DIVERT: case O_TEE: if (ip_divert_ptr == NULL) Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet/tcp_input.c Sat Aug 20 17:05:11 2011 (r225044) @@ -573,11 +573,9 @@ tcp_input(struct mbuf *m, int off0) uint8_t sig_checked = 0; #endif uint8_t iptos = 0; -#ifdef INET #ifdef IPFIREWALL_FORWARD struct m_tag *fwd_tag; #endif -#endif /* INET */ #ifdef INET6 struct ip6_hdr *ip6 = NULL; int isipv6; @@ -776,14 +774,55 @@ findpcb: } #endif -#ifdef INET #ifdef IPFIREWALL_FORWARD /* * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. */ fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); +#endif /* IPFIREWALL_FORWARD */ - if (fwd_tag != NULL && isipv6 == 0) { /* IPv6 support is not yet */ +#ifdef INET6 +#ifdef IPFIREWALL_FORWARD + if (isipv6 && fwd_tag != NULL) { + struct sockaddr_in6 *next_hop6; + + next_hop6 = (struct sockaddr_in6 *)(fwd_tag + 1); + /* + * Transparently forwarded. Pretend to be the destination. + * Already got one like this? + */ + inp = in6_pcblookup_mbuf(&V_tcbinfo, + &ip6->ip6_src, th->th_sport, &ip6->ip6_dst, th->th_dport, + INPLOOKUP_WLOCKPCB, m->m_pkthdr.rcvif, m); + if (!inp) { + /* + * It's new. Try to find the ambushing socket. + * Because we've rewritten the destination address, + * any hardware-generated hash is ignored. + */ + inp = in6_pcblookup(&V_tcbinfo, &ip6->ip6_src, + th->th_sport, &next_hop6->sin6_addr, + next_hop6->sin6_port ? ntohs(next_hop6->sin6_port) : + th->th_dport, INPLOOKUP_WILDCARD | + INPLOOKUP_WLOCKPCB, m->m_pkthdr.rcvif); + } + /* Remove the tag from the packet. We don't need it anymore. */ + m_tag_delete(m, fwd_tag); + } else +#endif /* IPFIREWALL_FORWARD */ + if (isipv6) { + inp = in6_pcblookup_mbuf(&V_tcbinfo, &ip6->ip6_src, + th->th_sport, &ip6->ip6_dst, th->th_dport, + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, + m->m_pkthdr.rcvif, m); + } +#endif /* INET6 */ +#if defined(INET6) && defined(INET) + else +#endif +#ifdef INET +#ifdef IPFIREWALL_FORWARD + if (fwd_tag != NULL) { struct sockaddr_in *next_hop; next_hop = (struct sockaddr_in *)(fwd_tag+1); @@ -810,25 +849,11 @@ findpcb: m_tag_delete(m, fwd_tag); } else #endif /* IPFIREWALL_FORWARD */ + inp = in_pcblookup_mbuf(&V_tcbinfo, ip->ip_src, + th->th_sport, ip->ip_dst, th->th_dport, + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, + m->m_pkthdr.rcvif, m); #endif /* INET */ - { -#ifdef INET6 - if (isipv6) - inp = in6_pcblookup_mbuf(&V_tcbinfo, &ip6->ip6_src, - th->th_sport, &ip6->ip6_dst, th->th_dport, - INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, - m->m_pkthdr.rcvif, m); -#endif -#if defined(INET) && defined(INET6) - else -#endif -#ifdef INET - inp = in_pcblookup_mbuf(&V_tcbinfo, ip->ip_src, - th->th_sport, ip->ip_dst, th->th_dport, - INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, - m->m_pkthdr.rcvif, m); -#endif - } /* * If the INPCB does not exist then all data in the incoming Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet/udp_usrreq.c Sat Aug 20 17:05:11 2011 (r225044) @@ -441,28 +441,6 @@ udp_input(struct mbuf *m, int off) } else UDPSTAT_INC(udps_nosum); -#ifdef IPFIREWALL_FORWARD - /* - * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. - */ - fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); - if (fwd_tag != NULL) { - struct sockaddr_in *next_hop; - - /* - * Do the hack. - */ - next_hop = (struct sockaddr_in *)(fwd_tag + 1); - ip->ip_dst = next_hop->sin_addr; - uh->uh_dport = ntohs(next_hop->sin_port); - - /* - * Remove the tag from the packet. We don't need it anymore. - */ - m_tag_delete(m, fwd_tag); - } -#endif - if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || in_broadcast(ip->ip_dst, ifp)) { struct inpcb *last; @@ -568,9 +546,41 @@ udp_input(struct mbuf *m, int off) /* * Locate pcb for datagram. */ - inp = in_pcblookup_mbuf(&V_udbinfo, ip->ip_src, uh->uh_sport, - ip->ip_dst, uh->uh_dport, INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, - ifp, m); +#ifdef IPFIREWALL_FORWARD + /* + * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. + */ + fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); + if (fwd_tag != NULL) { + struct sockaddr_in *next_hop; + + next_hop = (struct sockaddr_in *)(fwd_tag + 1); + + /* + * Transparently forwarded. Pretend to be the destination. + * Already got one like this? + */ + inp = in_pcblookup_mbuf(&V_udbinfo, ip->ip_src, uh->uh_sport, + ip->ip_dst, uh->uh_dport, INPLOOKUP_RLOCKPCB, ifp, m); + if (!inp) { + /* + * It's new. Try to find the ambushing socket. + * Because we've rewritten the destination address, + * any hardware-generated hash is ignored. + */ + inp = in_pcblookup(&V_udbinfo, ip->ip_src, + uh->uh_sport, next_hop->sin_addr, + next_hop->sin_port ? htons(next_hop->sin_port) : + uh->uh_dport, INPLOOKUP_WILDCARD | + INPLOOKUP_RLOCKPCB, ifp); + } + /* Remove the tag from the packet. We don't need it anymore. */ + m_tag_delete(m, fwd_tag); + } else +#endif /* IPFIREWALL_FORWARD */ + inp = in_pcblookup_mbuf(&V_udbinfo, ip->ip_src, uh->uh_sport, + ip->ip_dst, uh->uh_dport, INPLOOKUP_WILDCARD | + INPLOOKUP_RLOCKPCB, ifp, m); if (inp == NULL) { if (udp_log_in_vain) { char buf[4*sizeof "123"]; Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet6/ip6_forward.c Sat Aug 20 17:05:11 2011 (r225044) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_ipfw.h" #include "opt_ipsec.h" #include "opt_ipstealth.h" @@ -50,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -98,11 +100,17 @@ ip6_forward(struct mbuf *m, int srcrt) struct mbuf *mcopy = NULL; struct ifnet *origifp; /* maybe unnecessary */ u_int32_t inzone, outzone; - struct in6_addr src_in6, dst_in6; + struct in6_addr src_in6, dst_in6, odst; #ifdef IPSEC struct secpolicy *sp = NULL; int ipsecrt = 0; #endif +#ifdef SCTP + int sw_csum; +#endif +#ifdef IPFIREWALL_FORWARD + struct m_tag *fwd_tag; +#endif char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; #ifdef IPSEC @@ -345,13 +353,15 @@ ip6_forward(struct mbuf *m, int srcrt) goto skip_routing; skip_ipsec: #endif - +again: bzero(&rin6, sizeof(struct route_in6)); dst = (struct sockaddr_in6 *)&rin6.ro_dst; dst->sin6_len = sizeof(struct sockaddr_in6); dst->sin6_family = AF_INET6; dst->sin6_addr = ip6->ip6_dst; - +#ifdef IPFIREWALL_FORWARD +again2: +#endif rin6.ro_rt = rtalloc1((struct sockaddr *)dst, 0, 0); if (rin6.ro_rt != NULL) RT_UNLOCK(rin6.ro_rt); @@ -554,6 +564,7 @@ skip_routing: if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto pass; + odst = ip6->ip6_dst; /* Run through list of hooks for output packets. */ error = pfil_run_hooks(&V_inet6_pfil_hook, &m, rt->rt_ifp, PFIL_OUT, NULL); if (error != 0) @@ -562,6 +573,59 @@ skip_routing: goto freecopy; ip6 = mtod(m, struct ip6_hdr *); + /* See if destination IP address was changed by packet filter. */ + if (!IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst)) { + m->m_flags |= M_SKIP_FIREWALL; + /* If destination is now ourself drop to ip6_input(). */ + if (in6_localip(&ip6->ip6_dst)) { + m->m_flags |= M_FASTFWD_OURS; + if (m->m_pkthdr.rcvif == NULL) + m->m_pkthdr.rcvif = V_loif; + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + m->m_pkthdr.csum_flags |= + CSUM_IP_CHECKED | CSUM_IP_VALID; +#ifdef SCTP + if (m->m_pkthdr.csum_flags & CSUM_SCTP) + m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; +#endif + error = netisr_queue(NETISR_IPV6, m); + goto out; + } else + goto again; /* Redo the routing table lookup. */ + } + +#ifdef IPFIREWALL_FORWARD + /* See if local, if yes, send it to netisr. */ + if (m->m_flags & M_FASTFWD_OURS) { + if (m->m_pkthdr.rcvif == NULL) + m->m_pkthdr.rcvif = V_loif; + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } +#ifdef SCTP + if (m->m_pkthdr.csum_flags & CSUM_SCTP) + m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; +#endif + error = netisr_queue(NETISR_IPV6, m); + goto out; + } + /* Or forward to some other address? */ + fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); + if (fwd_tag) { + dst = (struct sockaddr_in6 *)&rin6.ro_dst; + bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in6)); + m->m_flags |= M_SKIP_FIREWALL; + m_tag_delete(m, fwd_tag); + goto again2; + } +#endif /* IPFIREWALL_FORWARD */ + pass: error = nd6_output(rt->rt_ifp, origifp, m, dst, rt); if (error) { Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet6/ip6_input.c Sat Aug 20 17:05:11 2011 (r225044) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_ipfw.h" #include "opt_ipsec.h" #include "opt_route.h" @@ -91,6 +92,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef INET @@ -357,6 +359,17 @@ ip6_input(struct mbuf *m) */ ip6_delaux(m); + if (m->m_flags & M_FASTFWD_OURS) { + /* + * Firewall changed destination to local. + */ + m->m_flags &= ~M_FASTFWD_OURS; + ours = 1; + deliverifp = m->m_pkthdr.rcvif; + ip6 = mtod(m, struct ip6_hdr *); + goto hbhcheck; + } + /* * mbuf statistics */ @@ -533,6 +546,24 @@ ip6_input(struct mbuf *m) ip6 = mtod(m, struct ip6_hdr *); srcrt = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst); +#ifdef IPFIREWALL_FORWARD + if (m->m_flags & M_FASTFWD_OURS) { + m->m_flags &= ~M_FASTFWD_OURS; + ours = 1; + deliverifp = m->m_pkthdr.rcvif; + goto hbhcheck; + } + if (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL) { + /* + * Directly ship the packet on. This allows forwarding + * packets originally destined to us to some other directly + * connected host. + */ + ip6_forward(m, 1); + goto out; + } +#endif /* IPFIREWALL_FORWARD */ + passin: /* * Disambiguate address scope zones (if there is ambiguity). Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet6/ip6_output.c Sat Aug 20 17:05:11 2011 (r225044) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_ipfw.h" #include "opt_ipsec.h" #include "opt_sctp.h" #include "opt_route.h" @@ -90,6 +91,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -229,6 +231,9 @@ ip6_output(struct mbuf *m0, struct ip6_p int segleft_org = 0; struct secpolicy *sp = NULL; #endif /* IPSEC */ +#ifdef IPFIREWALL_FORWARD + struct m_tag *fwd_tag; +#endif ip6 = mtod(m, struct ip6_hdr *); if (ip6 == NULL) { @@ -850,7 +855,8 @@ again: if (!IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst)) { m->m_flags |= M_SKIP_FIREWALL; /* If destination is now ourself drop to ip6_input(). */ - if (in6_localaddr(&ip6->ip6_dst)) { + if (in6_localip(&ip6->ip6_dst)) { + m->m_flags |= M_FASTFWD_OURS; if (m->m_pkthdr.rcvif == NULL) m->m_pkthdr.rcvif = V_loif; if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { @@ -870,7 +876,33 @@ again: goto again; /* Redo the routing table lookup. */ } - /* XXX: IPFIREWALL_FORWARD */ +#ifdef IPFIREWALL_FORWARD + /* See if local, if yes, send it to netisr. */ + if (m->m_flags & M_FASTFWD_OURS) { + if (m->m_pkthdr.rcvif == NULL) + m->m_pkthdr.rcvif = V_loif; + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } +#ifdef SCTP + if (m->m_pkthdr.csum_flags & CSUM_SCTP) + m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; +#endif + error = netisr_queue(NETISR_IPV6, m); + goto done; + } + /* Or forward to some other address? */ + fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); + if (fwd_tag) { + dst = (struct sockaddr_in6 *)&ro->ro_dst; + bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in6)); + m->m_flags |= M_SKIP_FIREWALL; + m_tag_delete(m, fwd_tag); + goto again; + } +#endif /* IPFIREWALL_FORWARD */ passout: /* Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sat Aug 20 16:43:47 2011 (r225043) +++ head/sys/netinet6/udp6_usrreq.c Sat Aug 20 17:05:11 2011 (r225044) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_ipfw.h" #include "opt_ipsec.h" #include @@ -181,6 +182,9 @@ udp6_input(struct mbuf **mp, int *offp, int off = *offp; int plen, ulen; struct sockaddr_in6 fromsa; +#ifdef IPFIREWALL_FORWARD + struct m_tag *fwd_tag; +#endif ifp = m->m_pkthdr.rcvif; ip6 = mtod(m, struct ip6_hdr *); @@ -377,9 +381,43 @@ udp6_input(struct mbuf **mp, int *offp, /* * Locate pcb for datagram. */ - inp = in6_pcblookup_mbuf(&V_udbinfo, &ip6->ip6_src, uh->uh_sport, - &ip6->ip6_dst, uh->uh_dport, INPLOOKUP_WILDCARD | - INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif, m); +#ifdef IPFIREWALL_FORWARD + /* + * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. + */ + fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); + if (fwd_tag != NULL) { + struct sockaddr_in6 *next_hop6; + + next_hop6 = (struct sockaddr_in6 *)(fwd_tag + 1); + + /* + * Transparently forwarded. Pretend to be the destination. + * Already got one like this? + */ + inp = in6_pcblookup_mbuf(&V_udbinfo, + &ip6->ip6_src, uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, + INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif, m); + if (!inp) { + /* + * It's new. Try to find the ambushing socket. + * Because we've rewritten the destination address, + * any hardware-generated hash is ignored. + */ + inp = in6_pcblookup(&V_udbinfo, &ip6->ip6_src, + uh->uh_sport, &next_hop6->sin6_addr, + next_hop6->sin6_port ? htons(next_hop6->sin6_port) : + uh->uh_dport, INPLOOKUP_WILDCARD | + INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif); + } + /* Remove the tag from the packet. We don't need it anymore. */ + m_tag_delete(m, fwd_tag); + } else +#endif /* IPFIREWALL_FORWARD */ + inp = in6_pcblookup_mbuf(&V_udbinfo, &ip6->ip6_src, + uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, + INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, + m->m_pkthdr.rcvif, m); if (inp == NULL) { if (udp_log_in_vain) { char ip6bufs[INET6_ADDRSTRLEN]; Added: head/tools/regression/ipfw/fwd/vimage-fwd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/ipfw/fwd/vimage-fwd.sh Sat Aug 20 17:05:11 2011 (r225044) @@ -0,0 +1,369 @@ +#!/bin/sh +#- +# Copyright (c) 2010, "Bjoern A. Zeeb" +# Copyright (c) 2011, Sandvine Incorporated ULC. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# +# Test ipfw fwd for IPv4 and IPv6 using VIMAGE, testing that as well. +# For no test the packet header contents must be changed but always +# keeping the original destination. +# + +case `id -u` in +0) ;; +*) echo "ERROR: Must be run as superuser." >&2 + exit 2 +esac + +epair_base() +{ + local ep + + ep=`ifconfig epair create` + expr ${ep} : '\(.*\).' +} + +debug_err() +{ + local _p + _p="$1" + + case "${DEBUG}" in + "") ;; + *) + echo " ~~ start of debug ~~" + echo " ~~ left:" + jexec ${ljid} /sbin/ipfw show + echo " ~~ middle:" + jexec ${mjid} /sbin/ipfw show + echo " ~~ right:" + jexec ${rjid} /sbin/ipfw show + echo " ~~ result file:" + cat ${_p}.1 + echo " ~~ log file:" + cat ${_p} + echo " ~~ end of debug ~~" + ;; + esac +} + +check_cleanup_result_file() +{ + local _p + _p="$1" + + if test ! -s ${_p}.1; then + echo "FAIL (output file empty)." + debug_err ${_p} + else + read line < ${_p}.1 + # Netcat adds 'X's in udp mode. + l="/${line#*/}" + if test "${l}" = "${_p}"; then + echo "PASS." + else + echo "FAIL (expected: '${_p}' got '${l}')." + debug_err ${_p} + fi + fi + + rm -f ${_p}.1 + rm -f ${_p} +} + +# Transparent proxy scenario (local address). +run_test_tp() +{ + local _descr + local _sip _dip _fip _fport _dport _p + local _nc_af _nc_p + local _lport + descr="$1" + _sip="$2" + _dip="$3" + _fip="$4" + _fport="$5" + _dport="$6" + _p="$7" + _nc_af="$8" + + _lport=${_dport} + case "${_fport}" in + "") _lport="${_dport}" ;; + *) _lport="${_fport#,}" ;; + esac + + case "${_p}" in + udp) _nc_p="-u" ;; + esac + + OUT=`mktemp -t "ipfwfwd$$-XXXXXX"` + echo -n "${descr} (${OUT}).." + ( + jexec ${ljid} /sbin/ipfw -f flush + jexec ${ljid} /sbin/ipfw -f zero + jexec ${mjid} /sbin/ipfw -f flush + jexec ${mjid} /sbin/ipfw -f zero + jexec ${rjid} /sbin/ipfw -f flush + jexec ${rjid} /sbin/ipfw -f zero + jexec ${mjid} /sbin/ipfw add 100 fwd ${_fip}${_fport} ${_p} from ${_sip} to ${_dip} + + jexec ${mjid} /bin/sh -c "nc -w 10 ${_nc_af} -n ${_nc_p} -l ${_fip} ${_lport} > ${OUT}.1 &" + jexec ${rjid} /bin/sh -c "echo '${OUT}' | nc -w 1 -v ${_nc_af} -n ${_nc_p} ${_dip} ${_dport}" + ) > ${OUT} 2>&1 + check_cleanup_result_file "${OUT}" +} + +# Transparent redirect scenario (non-local address). +run_test_nh() +{ + local _descr + local _sip _dip _fip _fport _dport _p + local _nc_af _nc_p + local _lport + descr="$1" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 18:45:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2CAB1065670; Sat, 20 Aug 2011 18:45:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A36318FC1D; Sat, 20 Aug 2011 18:45:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KIjcGN064466; Sat, 20 Aug 2011 18:45:38 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KIjcSQ064464; Sat, 20 Aug 2011 18:45:38 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108201845.p7KIjcSQ064464@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 20 Aug 2011 18:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225046 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 18:45:38 -0000 Author: bz Date: Sat Aug 20 18:45:38 2011 New Revision: 225046 URL: http://svn.freebsd.org/changeset/base/225046 Log: Fix compilation in case of defined(INET) && defined(IPFIREWALL_FORWARD) but no INET6. Reported by: avg Tested by: avg MFC after: 4 weeks X-MFC with: r225044 Approved by: re (kib) Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sat Aug 20 17:11:51 2011 (r225045) +++ head/sys/netinet/tcp_input.c Sat Aug 20 18:45:38 2011 (r225046) @@ -581,9 +581,6 @@ tcp_input(struct mbuf *m, int off0) int isipv6; #else const void *ip6 = NULL; -#if (defined(INET) && defined(IPFIREWALL_FORWARD)) || defined(TCPDEBUG) - const int isipv6 = 0; -#endif #endif /* INET6 */ struct tcpopt to; /* options in this segment */ char *s = NULL; /* address and port logging */ @@ -1028,11 +1025,11 @@ relocked: #ifdef TCPDEBUG if (so->so_options & SO_DEBUG) { ostate = tp->t_state; - if (isipv6) { #ifdef INET6 + if (isipv6) { bcopy((char *)ip6, (char *)tcp_saveipgen, sizeof(*ip6)); -#endif } else +#endif bcopy((char *)ip, (char *)tcp_saveipgen, sizeof(*ip)); tcp_savetcp = *th; } From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 19:21:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E3D11065670; Sat, 20 Aug 2011 19:21:47 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44AB78FC15; Sat, 20 Aug 2011 19:21:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KJLlSO065776; Sat, 20 Aug 2011 19:21:47 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KJLlQV065772; Sat, 20 Aug 2011 19:21:47 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201108201921.p7KJLlQV065772@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 20 Aug 2011 19:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225048 - in head/sys: amd64/amd64 i386/i386 pc98/pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 19:21:47 -0000 Author: bz Date: Sat Aug 20 19:21:46 2011 New Revision: 225048 URL: http://svn.freebsd.org/changeset/base/225048 Log: In HEAD when doing no further checkes there is no reason use the temporary variable and check with if as TUNABLE_*_FETCH do not alter values unless successfully found the tunable. Reported by: jhb, bde MFC after: 3 days X-MFC with: r224516 Approved by: re (kib) Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/i386/machdep.c head/sys/pc98/pc98/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sat Aug 20 19:09:25 2011 (r225047) +++ head/sys/amd64/amd64/machdep.c Sat Aug 20 19:21:46 2011 (r225048) @@ -1309,7 +1309,7 @@ getmemsize(caddr_t kmdp, u_int64_t first { int i, physmap_idx, pa_indx, da_indx; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; - u_long physmem_tunable, memtest, tmpul; + u_long physmem_tunable, memtest; pt_entry_t *pte; struct bios_smap *smapbase, *smap, *smapend; u_int32_t smapsize; @@ -1376,8 +1376,7 @@ getmemsize(caddr_t kmdp, u_int64_t first * one could eventually do more with the code than just disable it. */ memtest = 1; - if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) - memtest = tmpul; + TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); /* * Don't allow MAXMEM or hw.physmem to extend the amount of memory Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Sat Aug 20 19:09:25 2011 (r225047) +++ head/sys/i386/i386/machdep.c Sat Aug 20 19:21:46 2011 (r225048) @@ -2132,7 +2132,7 @@ static void getmemsize(int first) { int has_smap, off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable, memtest, tmpul; + u_long physmem_tunable, memtest; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; quad_t dcons_addr, dcons_size; @@ -2344,8 +2344,7 @@ physmap_done: * one could eventually do more with the code than just disable it. */ memtest = 1; - if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) - memtest = tmpul; + TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Sat Aug 20 19:09:25 2011 (r225047) +++ head/sys/pc98/pc98/machdep.c Sat Aug 20 19:21:46 2011 (r225048) @@ -1855,7 +1855,7 @@ static void getmemsize(int first) { int off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable, memtest, tmpul; + u_long physmem_tunable, memtest; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; quad_t dcons_addr, dcons_size; @@ -1920,8 +1920,7 @@ getmemsize(int first) * one could eventually do more with the code than just disable it. */ memtest = 1; - if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) - memtest = tmpul; + TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) From owner-svn-src-all@FreeBSD.ORG Sat Aug 20 21:26:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4A38106566B; Sat, 20 Aug 2011 21:26:35 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4C1C8FC12; Sat, 20 Aug 2011 21:26:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KLQZtn069498; Sat, 20 Aug 2011 21:26:35 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KLQZ4G069496; Sat, 20 Aug 2011 21:26:35 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108202126.p7KLQZ4G069496@svn.freebsd.org> From: Rick Macklem Date: Sat, 20 Aug 2011 21:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225049 - head/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 21:26:35 -0000 Author: rmacklem Date: Sat Aug 20 21:26:35 2011 New Revision: 225049 URL: http://svn.freebsd.org/changeset/base/225049 Log: Fix the NFSv4 server so that it returns NFSERR_SYMLINK when an attempt to do an Open operation on any type of file other than VREG is done. A recent discussion on the IETF working group's mailing list (nfsv4@ietf.org) decided that NFSERR_SYMLINK should be returned for all non-regular files and not just symlinks, so that the Linux client would work correctly. This change does not affect the FreeBSD NFSv4 client and is not believed to have a negative effect on other NFSv4 clients. Reviewed by: zkirsch Approved by: re (kib) MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdserv.c Sat Aug 20 19:21:46 2011 (r225048) +++ head/sys/fs/nfsserver/nfs_nfsdserv.c Sat Aug 20 21:26:35 2011 (r225049) @@ -2741,12 +2741,11 @@ nfsrvd_open(struct nfsrv_descript *nd, _ * Do basic access checking. */ if (!nd->nd_repstat && vnode_vtype(vp) != VREG) { - if (vnode_vtype(vp) == VDIR) - nd->nd_repstat = NFSERR_ISDIR; - else if (vnode_vtype(vp) == VLNK) + /* + * The IETF working group decided that this is the correct + * error return for all non-regular files. + */ nd->nd_repstat = NFSERR_SYMLINK; - else - nd->nd_repstat = NFSERR_INVAL; } if (!nd->nd_repstat && (stp->ls_flags & NFSLCK_WRITEACCESS)) nd->nd_repstat = nfsvno_accchk(vp, VWRITE, nd->nd_cred,