Date: Fri, 22 Mar 2002 15:58:43 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 8223 for review Message-ID: <200203222358.g2MNwh960224@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=8223 Change 8223 by jhb@jhb_zion on 2002/03/22 15:58:06 IFC. Affected files ... ... //depot/projects/smpng/sys/alpha/alpha/interrupt.c#15 integrate ... //depot/projects/smpng/sys/alpha/alpha/mp_machdep.c#13 integrate ... //depot/projects/smpng/sys/alpha/pci/t2.c#15 integrate ... //depot/projects/smpng/sys/conf/files.powerpc#4 integrate ... //depot/projects/smpng/sys/dev/bge/if_bge.c#9 integrate ... //depot/projects/smpng/sys/dev/bge/if_bgereg.h#3 integrate ... //depot/projects/smpng/sys/dev/isp/isp.c#16 integrate ... //depot/projects/smpng/sys/dev/isp/isp_target.h#5 integrate ... //depot/projects/smpng/sys/dev/isp/ispvar.h#11 integrate ... //depot/projects/smpng/sys/dev/mii/brgphy.c#6 integrate ... //depot/projects/smpng/sys/dev/mii/miidevs#4 integrate ... //depot/projects/smpng/sys/dev/mii/miidevs.h#4 integrate ... //depot/projects/smpng/sys/i386/i386/trap.c#35 integrate ... //depot/projects/smpng/sys/i386/i386/vm_machdep.c#19 integrate ... //depot/projects/smpng/sys/kern/kern_linker.c#14 integrate ... //depot/projects/smpng/sys/kern/kern_prot.c#47 integrate ... //depot/projects/smpng/sys/kern/kern_sysctl.c#12 integrate ... //depot/projects/smpng/sys/kern/sys_pipe.c#11 integrate ... //depot/projects/smpng/sys/kern/vfs_syscalls.c#24 integrate ... //depot/projects/smpng/sys/netinet/in_pcb.c#17 integrate ... //depot/projects/smpng/sys/netinet/ip_icmp.c#12 integrate ... //depot/projects/smpng/sys/netinet/ip_mroute.c#9 integrate ... //depot/projects/smpng/sys/netinet/ip_output.c#18 integrate ... //depot/projects/smpng/sys/netinet/raw_ip.c#13 integrate ... //depot/projects/smpng/sys/netinet/tcp_subr.c#14 integrate ... //depot/projects/smpng/sys/netinet/udp_usrreq.c#14 integrate ... //depot/projects/smpng/sys/powerpc/powerpc/copyinout.c#1 branch ... //depot/projects/smpng/sys/powerpc/powerpc/copyinstr.c#2 delete ... //depot/projects/smpng/sys/powerpc/powerpc/fubyte.c#2 delete ... //depot/projects/smpng/sys/powerpc/powerpc/fuword.c#2 delete ... //depot/projects/smpng/sys/powerpc/powerpc/subyte.c#2 delete ... //depot/projects/smpng/sys/powerpc/powerpc/suword.c#2 delete ... //depot/projects/smpng/sys/powerpc/powerpc/trap.c#15 integrate ... //depot/projects/smpng/sys/sys/ioccom.h#3 integrate ... //depot/projects/smpng/sys/sys/systm.h#23 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/interrupt.c#15 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/alpha/alpha/interrupt.c,v 1.66 2002/03/21 06:14:57 imp Exp $ */ +/* $FreeBSD: src/sys/alpha/alpha/interrupt.c,v 1.67 2002/03/22 15:55:56 gallatin Exp $ */ /* $NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $ */ /* @@ -300,7 +300,7 @@ /* disallow further machine checks */ mc_expected = 0; - if (rptr) { + if (rptr && mc_received == 0) { switch (size) { case sizeof (u_int8_t): *(volatile u_int8_t *)rptr = rcpt; ==== //depot/projects/smpng/sys/alpha/alpha/mp_machdep.c#13 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.36 2002/03/20 02:27:55 jeff Exp $ + * $FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.37 2002/03/22 15:54:31 gallatin Exp $ */ #include <sys/param.h> @@ -536,7 +536,7 @@ printf("%s: releasing secondary CPUs\n", __func__); atomic_store_rel_int(&aps_ready, 1); - while (smp_started == 0) + while (mp_ncpus > 1 && smp_started == 0) ; /* nothing */ } ==== //depot/projects/smpng/sys/alpha/pci/t2.c#15 (text+ko) ==== @@ -45,7 +45,7 @@ * * * * ***************************************************************** * - * $FreeBSD: src/sys/alpha/pci/t2.c,v 1.15 2002/03/21 06:14:58 imp Exp $ + * $FreeBSD: src/sys/alpha/pci/t2.c,v 1.16 2002/03/21 18:48:00 gallatin Exp $ */ /* @@ -337,7 +337,7 @@ device_printf(dev, "using interrupt type %d on pci bus 0\n", pci_int_type[0]); - if (!badaddr((void *)&t2_csr[1]->tlbbr, sizeof(long))) { + if (!badaddr(__DEVOLATILE(void *, &t2_csr[1]->tlbbr), sizeof(long))) { pci_int_type[1] = 1; /* PCI1 always uses the new scheme */ /* Clear any errors that the BADADDR probe may have caused */ t2_csr[1]->cerr1 |= t2_csr[1]->cerr1; ==== //depot/projects/smpng/sys/conf/files.powerpc#4 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.powerpc,v 1.5 2002/03/05 09:19:01 ume Exp $ +# $FreeBSD: src/sys/conf/files.powerpc,v 1.6 2002/03/21 23:45:49 benno Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -14,20 +14,17 @@ powerpc/powerpc/autoconf.c standard powerpc/powerpc/bcopy.c standard powerpc/powerpc/clock.c standard -powerpc/powerpc/copyinstr.c standard +powerpc/powerpc/copyinout.c standard powerpc/powerpc/copystr.c standard powerpc/powerpc/elf_machdep.c standard powerpc/powerpc/extintr.c standard -powerpc/powerpc/fubyte.c standard powerpc/powerpc/fuswintr.c standard -powerpc/powerpc/fuword.c standard powerpc/powerpc/machdep.c standard +powerpc/powerpc/nexus.c standard powerpc/powerpc/ofwmagic.s standard powerpc/powerpc/ofw_machdep.c standard powerpc/powerpc/pmap.c standard -powerpc/powerpc/subyte.c standard powerpc/powerpc/suswintr.c standard -powerpc/powerpc/suword.c standard powerpc/powerpc/syncicache.c standard powerpc/powerpc/sys_machdep.c standard powerpc/powerpc/swtch.s standard ==== //depot/projects/smpng/sys/dev/bge/if_bge.c#9 (text+ko) ==== @@ -30,7 +30,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/bge/if_bge.c,v 1.9 2002/03/20 02:03:28 alfred Exp $ + * $FreeBSD: src/sys/dev/bge/if_bge.c,v 1.10 2002/03/22 06:45:40 wpaul Exp $ */ /* @@ -57,7 +57,7 @@ * function in a 32-bit/64-bit 33/66Mhz bus, or a 64-bit/133Mhz bus. * * The BCM5701 is a single-chip solution incorporating both the BCM5700 - * MAC and a BCM5401 10/100/1000 PHY. Unlike the BCM5700, the BCM5700 + * MAC and a BCM5401 10/100/1000 PHY. Unlike the BCM5700, the BCM5701 * does not support external SSRAM. * * Broadcom also produces a variation of the BCM5700 under the "Altima" @@ -122,7 +122,7 @@ #if !defined(lint) static const char rcsid[] = - "$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.9 2002/03/20 02:03:28 alfred Exp $"; + "$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.10 2002/03/22 06:45:40 wpaul Exp $"; #endif /* @@ -479,6 +479,9 @@ sc = device_get_softc(dev); ifp = &sc->arpcom.ac_if; + if (sc->bge_asicrev == BGE_ASICREV_BCM5701_B5 && phy != 1) + return(0); + if (ifp->if_flags & IFF_RUNNING) BGE_CLRBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); @@ -1623,6 +1626,12 @@ ifp->if_capabilities = IFCAP_HWCSUM; ifp->if_capenable = ifp->if_capabilities; + /* Save ASIC rev. */ + + sc->bge_asicrev = + pci_read_config(dev, BGE_PCI_MISC_CTL, 4) & + BGE_PCIMISCCTL_ASICREV; + /* The SysKonnect SK-9D41 is a 1000baseSX card. */ if ((pci_read_config(dev, BGE_PCI_SUBSYS, 4) >> 16) == SK_SUBSYSID_9D41) sc->bge_tbi = 1; @@ -1981,9 +1990,11 @@ /* Process link state changes. */ if (sc->bge_rdata->bge_status_block.bge_status & BGE_STATFLAG_LINKSTATE_CHANGED) { - sc->bge_link = 0; - untimeout(bge_tick, sc, sc->bge_stat_ch); - bge_tick(sc); + if (sc->bge_asicrev != BGE_ASICREV_BCM5701_B5) { + sc->bge_link = 0; + untimeout(bge_tick, sc, sc->bge_stat_ch); + bge_tick(sc); + } /* ack the event to clear/reset it */ CSR_WRITE_4(sc, BGE_MAC_STS, BGE_MACSTAT_SYNC_CHANGED| BGE_MACSTAT_CFG_CHANGED); ==== //depot/projects/smpng/sys/dev/bge/if_bgereg.h#3 (text+ko) ==== @@ -30,7 +30,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.2 2002/01/27 01:00:16 jdp Exp $ + * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.3 2002/03/22 06:45:40 wpaul Exp $ */ /* @@ -217,6 +217,10 @@ #define BGE_ASICREV_BCM5700_B2 0x71030000 #define BGE_ASICREV_BCM5700_ALTIMA 0x71040000 #define BGE_ASICREV_BCM5700_C0 0x72000000 +#define BGE_ASICREV_BCM5701_A0 0x00000000 /* grrrr */ +#define BGE_ASICREV_BCM5701_B0 0x01000000 +#define BGE_ASICREV_BCM5701_B2 0x01020000 +#define BGE_ASICREV_BCM5701_B5 0x01050000 /* PCI DMA Read/Write Control register */ #define BGE_PCIDMARWCTL_MINDMA 0x000000FF @@ -2109,6 +2113,7 @@ u_int8_t bge_unit; /* interface number */ u_int8_t bge_extram; /* has external SSRAM */ u_int8_t bge_tbi; + u_int32_t bge_asicrev; struct bge_ring_data *bge_rdata; /* rings */ struct bge_chain_data bge_cdata; /* mbufs */ u_int16_t bge_tx_saved_considx; ==== //depot/projects/smpng/sys/dev/isp/isp.c#16 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/isp/isp.c,v 1.89 2002/03/07 17:32:45 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/isp/isp.c,v 1.90 2002/03/21 21:10:16 mjacob Exp $ */ /* * Machine and OS Independent (well, as best as possible) * code for the Qlogic ISP SCSI adapters. @@ -2298,6 +2298,9 @@ return (0); } +#ifndef HICAP_MAX +#define HICAP_MAX 256 +#endif static int isp_scan_fabric(struct ispsoftc *isp) { @@ -2320,7 +2323,7 @@ first_portid = portid = fcp->isp_portid; fcp->isp_loopstate = LOOP_SCANNING_FABRIC; - for (first_portid_seen = hicap = 0; hicap < 65535; hicap++) { + for (first_portid_seen = hicap = 0; hicap < HICAP_MAX; hicap++) { mbreg_t mbs; sns_screq_t *rq; sns_ganrsp_t *rs0, *rs1; @@ -3133,6 +3136,7 @@ } else { iptr = READ_RESPONSE_QUEUE_IN_POINTER(isp); } + isp->isp_resodx = iptr; if (optr == iptr && sema == 0) { @@ -3167,9 +3171,15 @@ isr, junk, iptr, optr); } } + isp->isp_resodx = iptr; ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT); ISP_WRITE(isp, BIU_SEMA, 0); + if (isp->isp_rspbsy) { + return; + } + isp->isp_rspbsy = 1; + while (optr != iptr) { ispstatusreq_t local, *sp = &local; isphdr_t *hp; @@ -3198,19 +3208,17 @@ } if (isp->isp_fpcchiwater < rio.req_header.rqs_seqno) isp->isp_fpcchiwater = rio.req_header.rqs_seqno; + MEMZERO(hp, QENTRY_LEN); /* PERF */ continue; } else { /* * Somebody reachable via isp_handle_other_response * may have updated the response queue pointers for - * us. + * us, so we reload our goal index. */ - oop = optr; - if (!isp_handle_other_response(isp, type, hp, &optr)) { + if (isp_handle_other_response(isp, type, hp, &optr)) { + iptr = isp->isp_resodx; MEMZERO(hp, QENTRY_LEN); /* PERF */ - if (oop != optr) { - goto out; - } continue; } @@ -3438,7 +3446,7 @@ } isp->isp_residx = optr; -out: + isp->isp_rspbsy = 0; for (i = 0; i < ndone; i++) { xs = complist[i]; if (xs) { @@ -3788,7 +3796,7 @@ switch (type) { case RQSTYPE_STATUS_CONT: isp_prt(isp, ISP_LOGINFO, "Ignored Continuation Response"); - return (0); + return (1); case RQSTYPE_ATIO: case RQSTYPE_CTIO: case RQSTYPE_ENABLE_LUN: @@ -3801,7 +3809,9 @@ case RQSTYPE_CTIO3: isp->isp_rsltccmplt++; /* count as a response completion */ #ifdef ISP_TARGET_MODE - return (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)); + if (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)) { + return (1); + } #else optrp = optrp; /* FALLTHROUGH */ @@ -3809,11 +3819,11 @@ case RQSTYPE_REQUEST: default: if (isp_async(isp, ISPASYNC_UNHANDLED_RESPONSE, hp)) { - return (0); + return (1); } isp_prt(isp, ISP_LOGWARN, "Unhandled Response Type 0x%x", isp_get_response_type(isp, hp)); - return (-1); + return (0); } } @@ -4117,18 +4127,16 @@ /* * No such port on the loop. Moral equivalent of SELTIMEO */ - isp_prt(isp, ISP_LOGINFO, - "Port Unavailable for target %d", XS_TGT(xs)); - if (XS_NOERR(xs)) { - XS_SETERR(xs, HBA_SELTIMEOUT); - } - return; case RQCS_PORT_LOGGED_OUT: /* * It was there (maybe)- treat as a selection timeout. */ - isp_prt(isp, ISP_LOGINFO, - "port logout for target %d", XS_TGT(xs)); + if ((sp->req_completion_status & 0xff) == RQCS_PORT_UNAVAILABLE) + isp_prt(isp, ISP_LOGINFO, + "Port Unavailable for target %d", XS_TGT(xs)); + else + isp_prt(isp, ISP_LOGINFO, + "port logout for target %d", XS_TGT(xs)); /* * If we're on a local loop, force a LIP (which is overkill) * to force a re-login of this unit. ==== //depot/projects/smpng/sys/dev/isp/isp_target.h#5 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/isp/isp_target.h,v 1.18 2002/02/04 21:04:25 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/isp/isp_target.h,v 1.19 2002/03/21 21:10:16 mjacob Exp $ */ /* * Qlogic Target Mode Structure and Flag Definitions * @@ -409,9 +409,9 @@ isphdr_t ct_header; u_int16_t ct_reserved; u_int16_t ct_fwhandle; /* just to match CTIO */ - u_int8_t ct_lun; /* lun */ - u_int8_t ct_iid; /* initiator id */ - u_int16_t ct_rxid; /* response ID */ + u_int8_t ct_lun; /* lun */ + u_int8_t ct_iid; /* initiator id */ + u_int16_t ct_rxid; /* response ID */ u_int16_t ct_flags; u_int16_t ct_status; /* isp status */ u_int16_t ct_timeout; ==== //depot/projects/smpng/sys/dev/isp/ispvar.h#11 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/isp/ispvar.h,v 1.54 2002/02/17 06:32:58 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/isp/ispvar.h,v 1.55 2002/03/21 21:10:16 mjacob Exp $ */ /* * Soft Definitions for for Qlogic ISP SCSI adapters. * @@ -73,7 +73,7 @@ void (*dv_reset0) (struct ispsoftc *); void (*dv_reset1) (struct ispsoftc *); void (*dv_dregs) (struct ispsoftc *, const char *); - const u_int16_t *dv_ispfw; /* ptr to f/w */ + u_int16_t *dv_ispfw; /* ptr to f/w */ u_int16_t dv_conf1; u_int16_t dv_clock; /* clock frequency */ }; @@ -396,6 +396,8 @@ volatile u_int16_t isp_reqodx; /* index of last ISP pickup */ volatile u_int16_t isp_reqidx; /* index of next request */ volatile u_int16_t isp_residx; /* index of next result */ + volatile u_int16_t isp_resodx; /* index of next result */ + volatile u_int16_t isp_rspbsy; volatile u_int16_t isp_lasthdls; /* last handle seed */ volatile u_int16_t isp_mboxtmp[MAX_MAILBOX]; volatile u_int16_t isp_lastmbxcmd; /* last mbox command sent */ ==== //depot/projects/smpng/sys/dev/mii/brgphy.c#6 (text+ko) ==== @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/mii/brgphy.c,v 1.7 2002/03/20 02:07:29 alfred Exp $ + * $FreeBSD: src/sys/dev/mii/brgphy.c,v 1.8 2002/03/22 06:38:52 wpaul Exp $ */ /* @@ -59,7 +59,7 @@ #if !defined(lint) static const char rcsid[] = - "$FreeBSD: src/sys/dev/mii/brgphy.c,v 1.7 2002/03/20 02:07:29 alfred Exp $"; + "$FreeBSD: src/sys/dev/mii/brgphy.c,v 1.8 2002/03/22 06:38:52 wpaul Exp $"; #endif static int brgphy_probe (device_t); @@ -115,6 +115,12 @@ return(0); } + if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM && + MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5701) { + device_set_desc(dev, MII_STR_xxBROADCOM_BCM5701); + return(0); + } + return(ENXIO); } ==== //depot/projects/smpng/sys/dev/mii/miidevs#4 (text+ko) ==== @@ -1,4 +1,4 @@ -$FreeBSD: src/sys/dev/mii/miidevs,v 1.16 2001/09/29 19:18:52 jlemon Exp $ +$FreeBSD: src/sys/dev/mii/miidevs,v 1.17 2002/03/22 06:38:52 wpaul Exp $ /*$NetBSD: miidevs,v 1.6 1999/05/14 11:37:30 drochner Exp $*/ /*- @@ -108,6 +108,7 @@ model xxBROADCOM BCM5400 0x0004 Broadcom 1000baseTX PHY model xxBROADCOM BCM5401 0x0005 BCM5401 10/100/1000baseTX PHY model xxBROADCOM BCM5411 0x0007 BCM5411 10/100/1000baseTX PHY +model xxBROADCOM BCM5701 0x0011 BCM5701 10/100/1000baseTX PHY /* Davicom Semiconductor PHYs */ model xxDAVICOM DM9101 0x0000 DM9101 10/100 media interface ==== //depot/projects/smpng/sys/dev/mii/miidevs.h#4 (text+ko) ==== @@ -1,10 +1,10 @@ -/* $FreeBSD: src/sys/dev/mii/miidevs.h,v 1.15 2001/09/29 19:18:52 jlemon Exp $ */ +/* $FreeBSD: src/sys/dev/mii/miidevs.h,v 1.16 2002/03/22 06:39:13 wpaul Exp $ */ /* * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * FreeBSD: src/sys/dev/mii/miidevs,v 1.15 2001/09/04 22:00:33 wpaul Exp + * FreeBSD: src/sys/dev/mii/miidevs,v 1.17 2002/03/22 06:38:52 wpaul Exp */ /*$NetBSD: miidevs,v 1.6 1999/05/14 11:37:30 drochner Exp $*/ @@ -123,6 +123,8 @@ #define MII_STR_xxBROADCOM_BCM5401 "BCM5401 10/100/1000baseTX PHY" #define MII_MODEL_xxBROADCOM_BCM5411 0x0007 #define MII_STR_xxBROADCOM_BCM5411 "BCM5411 10/100/1000baseTX PHY" +#define MII_MODEL_xxBROADCOM_BCM5701 0x0011 +#define MII_STR_xxBROADCOM_BCM5701 "BCM5701 10/100/1000baseTX PHY" /* Davicom Semiconductor PHYs */ #define MII_MODEL_xxDAVICOM_DM9101 0x0000 ==== //depot/projects/smpng/sys/i386/i386/trap.c#35 (text+ko) ==== @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $FreeBSD: src/sys/i386/i386/trap.c,v 1.219 2002/03/20 21:09:08 jhb Exp $ + * $FreeBSD: src/sys/i386/i386/trap.c,v 1.220 2002/03/21 19:27:15 alc Exp $ */ /* @@ -716,13 +716,13 @@ /* * Grow the stack if necessary */ - /* grow_stack returns false only if va falls into + /* vm_map_growstack fails only if va falls into * a growable stack region and the stack growth - * fails. It returns true if va was not within + * fails. It succeeds if va was not within * a growable stack region, or if the stack * growth succeeded. */ - if (!grow_stack (p, va)) + if (vm_map_growstack(p, va) != KERN_SUCCESS) rv = KERN_FAILURE; else /* Fault in the user page: */ @@ -901,7 +901,7 @@ ++p->p_lock; PROC_UNLOCK(p); - if (!grow_stack (p, va)) + if (vm_map_growstack(p, va) != KERN_SUCCESS) rv = KERN_FAILURE; else /* ==== //depot/projects/smpng/sys/i386/i386/vm_machdep.c#19 (text+ko) ==== @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.185 2002/03/21 06:19:07 imp Exp $ + * $FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.186 2002/03/21 19:27:15 alc Exp $ */ #include "opt_npx.h" @@ -514,20 +514,6 @@ while(1); } -int -grow_stack(p, sp) - struct proc *p; - u_int sp; -{ - int rv; - - rv = vm_map_growstack (p, sp); - if (rv != KERN_SUCCESS) - return (0); - - return (1); -} - /* * Software interrupt handler for queued VM system processing. */ ==== //depot/projects/smpng/sys/kern/kern_linker.c#14 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/kern/kern_linker.c,v 1.83 2002/03/21 15:27:39 arr Exp $ + * $FreeBSD: src/sys/kern/kern_linker.c,v 1.84 2002/03/22 04:56:09 arr Exp $ */ #include "opt_ddb.h" @@ -698,11 +698,11 @@ td->td_retval[0] = -1; + if (securelevel > 0) /* redundant, but that's OK */ + return (EPERM); + mtx_lock(&Giant); - if ((error = securelevel_gt(td->td_ucred, 0)) != 0) - goto out; - if ((error = suser_xxx(td->td_ucred, NULL, 0)) != 0) goto out; @@ -745,11 +745,11 @@ linker_file_t lf; int error = 0; + if (securelevel > 0) /* redundant, but that's OK */ + return (EPERM); + mtx_lock(&Giant); - if ((error = securelevel_gt(td->td_ucred, 0)) != 0) - goto out; - if ((error = suser_xxx(td->td_ucred, NULL, 0)) != 0) goto out; ==== //depot/projects/smpng/sys/kern/kern_prot.c#47 (text+ko) ==== @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * @(#)kern_prot.c 8.6 (Berkeley) 1/21/94 - * $FreeBSD: src/sys/kern/kern_prot.c,v 1.141 2002/03/20 21:00:50 jhb Exp $ + * $FreeBSD: src/sys/kern/kern_prot.c,v 1.146 2002/03/22 22:32:04 jhb Exp $ */ /* @@ -59,6 +59,8 @@ #include <sys/jail.h> #include <sys/pioctl.h> #include <sys/resourcevar.h> +#include <sys/socket.h> +#include <sys/socketvar.h> #include <sys/sysctl.h> static MALLOC_DEFINE(M_CRED, "cred", "credentials"); @@ -163,9 +165,9 @@ { struct proc *p = td->td_proc; struct proc *pt; - int error, s; + int error; - s = mtx_lock_giant(kern_giant_proc); + mtx_lock(&Giant); error = 0; if (uap->pid == 0) { PROC_LOCK(p); @@ -179,7 +181,7 @@ td->td_retval[0] = pt->p_pgrp->pg_id; PROC_UNLOCK(pt); } - mtx_unlock_giant(s); + mtx_unlock(&Giant); return (error); } @@ -202,9 +204,8 @@ struct proc *p = td->td_proc; struct proc *pt; int error; - int s; - s = mtx_lock_giant(kern_giant_proc); + mtx_lock(&Giant); error = 0; if (uap->pid == 0) { PROC_LOCK(p); @@ -218,7 +219,7 @@ td->td_retval[0] = pt->p_session->s_sid; PROC_UNLOCK(pt); } - mtx_unlock_giant(s); + mtx_unlock(&Giant); return (error); } @@ -1337,7 +1338,7 @@ active_securelevel = securelevel; if (cr == NULL) - printf("securelevel_gt: cr is NULL\n"); + panic("securelevel_gt: cr is NULL\n"); if (cr->cr_prison != NULL) { mtx_lock(&cr->cr_prison->pr_mtx); active_securelevel = imax(cr->cr_prison->pr_securelevel, @@ -1354,7 +1355,7 @@ active_securelevel = securelevel; if (cr == NULL) - printf("securelevel_gt: cr is NULL\n"); + panic("securelevel_gt: cr is NULL\n"); if (cr->cr_prison != NULL) { mtx_lock(&cr->cr_prison->pr_mtx); active_securelevel = imax(cr->cr_prison->pr_securelevel, @@ -1376,6 +1377,25 @@ "Unprivileged processes may see subjects/objects with different real uid"); /*- + * Determine if u1 "can see" the subject specified by u2, according to the + * 'see_other_uids' policy. + * Returns: 0 for permitted, ESRCH otherwise + * Locks: none + * References: *u1 and *u2 must not change during the call + * u1 may equal u2, in which case only one reference is required + */ +static int +cr_seeotheruids(struct ucred *u1, struct ucred *u2) +{ + + if (!see_other_uids && u1->cr_ruid != u2->cr_ruid) { + if (suser_xxx(u1, NULL, PRISON_ROOT) != 0) + return (ESRCH); + } + return (0); +} + +/*- * Determine if u1 "can see" the subject specified by u2. * Returns: 0 for permitted, an errno value otherwise * Locks: none @@ -1389,10 +1409,8 @@ if ((error = prison_check(u1, u2))) return (error); - if (!see_other_uids && u1->cr_ruid != u2->cr_ruid) { - if (suser_xxx(u1, NULL, PRISON_ROOT) != 0) - return (ESRCH); - } + if ((error = cr_seeotheruids(u1, u2))) + return (error); return (0); } @@ -1430,6 +1448,9 @@ error = prison_check(cred, proc->p_ucred); if (error) return (error); + error = cr_seeotheruids(cred, proc->p_ucred); + if (error) + return (error); /* * UNIX signal semantics depend on the status of the P_SUGID @@ -1523,6 +1544,8 @@ return (0); if ((error = prison_check(p1->p_ucred, p2->p_ucred))) return (error); + if ((error = cr_seeotheruids(p1->p_ucred, p2->p_ucred))) + return (error); if (p1->p_ucred->cr_ruid == p2->p_ucred->cr_ruid) return (0); if (p1->p_ucred->cr_uid == p2->p_ucred->cr_ruid) @@ -1576,6 +1599,8 @@ return (0); if ((error = prison_check(p1->p_ucred, p2->p_ucred))) return (error); + if ((error = cr_seeotheruids(p1->p_ucred, p2->p_ucred))) + return (error); /* * Is p2's group set a subset of p1's effective group set? This @@ -1636,6 +1661,27 @@ return (0); } +/*- + * Determine whether the subject represented by cred can "see" a socket. + * Returns: 0 for permitted, ENOENT otherwise. + */ +int +cr_canseesocket(struct ucred *cred, struct socket *so) +{ + int error; + + error = prison_check(cred, so->so_cred); + if (error) + return (ENOENT); + if (cr_seeotheruids(cred, so->so_cred)) + return (ENOENT); +#ifdef MAC + /* XXX: error = mac_cred_check_seesocket() here. */ +#endif + + return (0); +} + /* * Allocate a zeroed cred structure. */ ==== //depot/projects/smpng/sys/kern/kern_sysctl.c#12 (text+ko) ==== @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 - * $FreeBSD: src/sys/kern/kern_sysctl.c,v 1.121 2002/02/27 18:32:12 jhb Exp $ + * $FreeBSD: src/sys/kern/kern_sysctl.c,v 1.122 2002/03/22 14:58:27 rwatson Exp $ */ #include "opt_compat.h" @@ -1067,32 +1067,26 @@ if (req->newptr && !(oid->oid_kind & CTLFLAG_WR)) return (EPERM); + KASSERT(req->td != NULL, ("sysctl_root(): req->td == NULL")); + /* Is this sysctl sensitive to securelevels? */ if (req->newptr && (oid->oid_kind & CTLFLAG_SECURE)) { - if (req->td == NULL) { - error = securelevel_gt(NULL, 0); /* XXX */ - if (error) - return (error); - } else { - error = securelevel_gt(req->td->td_ucred, 0); - if (error) - return (error); - } + error = securelevel_gt(req->td->td_ucred, 0); + if (error) + return (error); } /* Is this sysctl writable by only privileged users? */ if (req->newptr && !(oid->oid_kind & CTLFLAG_ANYBODY)) { - if (req->td != NULL) { - int flags; + int flags; - if (oid->oid_kind & CTLFLAG_PRISON) - flags = PRISON_ROOT; - else - flags = 0; - error = suser_xxx(NULL, req->td->td_proc, flags); - if (error) - return (error); - } + if (oid->oid_kind & CTLFLAG_PRISON) + flags = PRISON_ROOT; + else + flags = 0; + error = suser_xxx(NULL, req->td->td_proc, flags); + if (error) + return (error); } if (!oid->oid_handler) ==== //depot/projects/smpng/sys/kern/sys_pipe.c#11 (text+ko) ==== @@ -16,7 +16,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $FreeBSD: src/sys/kern/sys_pipe.c,v 1.98 2002/03/20 04:09:58 jeff Exp $ + * $FreeBSD: src/sys/kern/sys_pipe.c,v 1.99 2002/03/22 16:09:22 alfred Exp $ */ /* @@ -708,8 +708,6 @@ PIPE_LOCK_ASSERT(wpipe, MA_OWNED); size = wpipe->pipe_map.cnt; pos = wpipe->pipe_map.pos; - bcopy((caddr_t) wpipe->pipe_map.kva + pos, - (caddr_t) wpipe->pipe_buffer.buffer, size); wpipe->pipe_buffer.in = size; wpipe->pipe_buffer.out = 0; @@ -717,6 +715,8 @@ wpipe->pipe_state &= ~PIPE_DIRECTW; PIPE_GET_GIANT(wpipe); + bcopy((caddr_t) wpipe->pipe_map.kva + pos, + (caddr_t) wpipe->pipe_buffer.buffer, size); pipe_destroy_write_buffer(wpipe); PIPE_DROP_GIANT(wpipe); } ==== //depot/projects/smpng/sys/kern/vfs_syscalls.c#24 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.236 2002/03/21 15:27:39 arr Exp $ + * $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.237 2002/03/22 04:56:09 arr Exp $ */ /* For 4.3 integer FS ID compatibility */ @@ -307,11 +307,6 @@ vput(vp); return error; } - error = securelevel_gt(td->td_ucred, 0); - if (error != 0) { - vput(vp); - return (EPERM); - } error = linker_load_file(fstype, &lf); if (error || lf == NULL) { vput(vp); ==== //depot/projects/smpng/sys/netinet/in_pcb.c#17 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 - * $FreeBSD: src/sys/netinet/in_pcb.c,v 1.100 2002/03/20 05:48:55 jeff Exp $ + * $FreeBSD: src/sys/netinet/in_pcb.c,v 1.101 2002/03/22 03:28:11 silby Exp $ */ #include "opt_ipsec.h" @@ -80,8 +80,8 @@ */ int ipport_lowfirstauto = IPPORT_RESERVED - 1; /* 1023 */ int ipport_lowlastauto = IPPORT_RESERVEDSTART; /* 600 */ -int ipport_firstauto = IPPORT_RESERVED; /* 1024 */ -int ipport_lastauto = IPPORT_USERRESERVED; /* 5000 */ +int ipport_firstauto = IPPORT_HIFIRSTAUTO; /* 49152 */ +int ipport_lastauto = IPPORT_HILASTAUTO; /* 65535 */ int ipport_hifirstauto = IPPORT_HIFIRSTAUTO; /* 49152 */ int ipport_hilastauto = IPPORT_HILASTAUTO; /* 65535 */ ==== //depot/projects/smpng/sys/netinet/ip_icmp.c#12 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 - * $FreeBSD: src/sys/netinet/ip_icmp.c,v 1.68 2002/03/19 21:25:46 alfred Exp $ + * $FreeBSD: src/sys/netinet/ip_icmp.c,v 1.69 2002/03/22 16:45:54 ru Exp $ */ #include "opt_ipsec.h" @@ -600,6 +600,8 @@ } t = ip->ip_dst; ip->ip_dst = ip->ip_src; + ro = &rt; + bzero(ro, sizeof(*ro)); /* * If the incoming packet was addressed directly to us, * use dst as the src for the reply. Otherwise (broadcast @@ -620,8 +622,6 @@ goto match; } } - ro = &rt; - bzero(ro, sizeof(*ro)); ia = ip_rtaddr(ip->ip_dst, ro); /* We need a route to do anything useful. */ if (ia == NULL) { ==== //depot/projects/smpng/sys/netinet/ip_mroute.c#9 (text+ko) ==== @@ -9,7 +9,7 @@ * Modified by Bill Fenner, PARC, April 1995 * * MROUTING Revision: 3.5 - * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.71 2002/03/19 21:25:46 alfred Exp $ + * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.72 2002/03/22 16:45:54 ru Exp $ */ #include "opt_mrouting.h" @@ -1867,6 +1867,7 @@ { struct ip_moptions imo; int error; + static struct route ro; int s = splnet(); if (vifp->v_flags & VIFF_TUNNEL) { @@ -1885,7 +1886,7 @@ * should get rejected because they appear to come from * the loopback interface, thus preventing looping. */ - error = ip_output(m, (struct mbuf *)0, NULL, + error = ip_output(m, (struct mbuf *)0, &ro, IP_FORWARDING, &imo); if (mrtdebug & DEBUG_XMIT) ==== //depot/projects/smpng/sys/netinet/ip_output.c#18 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 - * $FreeBSD: src/sys/netinet/ip_output.c,v 1.152 2002/03/19 21:25:46 alfred Exp $ + * $FreeBSD: src/sys/netinet/ip_output.c,v 1.153 2002/03/22 16:45:54 ru Exp $ */ #define _IP_VHL >>> TRUNCATED FOR MAIL (1000 lines) <<< To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203222358.g2MNwh960224>