From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 00:24:07 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 73061F20; Sun, 7 Dec 2014 00:24:07 +0000 (UTC) Received: from smtp.digiware.nl (smtp.digiware.nl [31.223.170.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F380652; Sun, 7 Dec 2014 00:24:06 +0000 (UTC) Received: from rack1.digiware.nl (unknown [127.0.0.1]) by smtp.digiware.nl (Postfix) with ESMTP id 9356D16A408; Sun, 7 Dec 2014 01:24:02 +0100 (CET) X-Virus-Scanned: amavisd-new at digiware.nl Received: from smtp.digiware.nl ([127.0.0.1]) by rack1.digiware.nl (rack1.digiware.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M8xKdyom5M4y; Sun, 7 Dec 2014 01:23:35 +0100 (CET) Received: from [192.168.10.9] (vaio [192.168.10.9]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.digiware.nl (Postfix) with ESMTPSA id BB21B16A401; Sun, 7 Dec 2014 01:23:35 +0100 (CET) Message-ID: <54839E06.60700@digiware.nl> Date: Sun, 07 Dec 2014 01:23:34 +0100 From: Willem Jan Withagen User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Andriy Gapon , d@delphij.net, Xin LI , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r273060 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs References: <201410132039.s9DKdpmh055573@svn.freebsd.org> <546F57B1.2020602@FreeBSD.org> <546F9FC3.10402@delphij.net> <5474540D.2000607@FreeBSD.org> <54836BCC.2080707@digiware.nl> <54837EC3.3070609@FreeBSD.org> In-Reply-To: <54837EC3.3070609@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 00:24:07 -0000 On 6-12-2014 23:10, Andriy Gapon wrote: > On 06/12/2014 22:49, Willem Jan Withagen wrote: >> Not sure how this got resolved but I immediately recognise some of this >> since I run into this on one of my volumes. >> >> These are 2 ssd caches on a raidz2 pool, and they are certainly not 16EB. >> ........... >> cache - - - - - - >> diskid/DISK-S1ANNSADB75814Wp3 109G 187G 16.0E - 0% 172% >> diskid/DISK-S1ANNSADB75819Ep3 109G 166G 16.0E - 0% 152% > > With what revision do you get see this? > 10.1-PRERELEASE FreeBSD 10.1-PRERELEASE #29 r273481: Thu Oct 23 08:33:17 CEST 2014 --WjW From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 06:47:00 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D49CB93A; Sun, 7 Dec 2014 06:47:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C16EBAE8; Sun, 7 Dec 2014 06:47:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB76l0Hk009387; Sun, 7 Dec 2014 06:47:00 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB76l0dj009386; Sun, 7 Dec 2014 06:47:00 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412070647.sB76l0dj009386@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 7 Dec 2014 06:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275575 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 06:47:00 -0000 Author: ae Date: Sun Dec 7 06:47:00 2014 New Revision: 275575 URL: https://svnweb.freebsd.org/changeset/base/275575 Log: key_getspacq() returns holding the spacq_lock. Unlock it in all cases. MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Sat Dec 6 22:57:19 2014 (r275574) +++ head/sys/netipsec/key.c Sun Dec 7 06:47:00 2014 (r275575) @@ -2313,7 +2313,8 @@ key_spdacquire(struct secpolicy *sp) } else { /* increment counter and do nothing. */ newspacq->count++; - return 0; + SPACQ_UNLOCK(); + return (0); } SPACQ_UNLOCK(); } else { From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 11:21:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A3E467CA; Sun, 7 Dec 2014 11:21:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D71B3DE; Sun, 7 Dec 2014 11:21:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7BLiu5040999; Sun, 7 Dec 2014 11:21:44 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7BLgnH040986; Sun, 7 Dec 2014 11:21:42 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201412071121.sB7BLgnH040986@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 7 Dec 2014 11:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275576 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/sys cddl/dev/cyclic cddl/dev/fbt cddl/dev/profile kern ... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 11:21:44 -0000 Author: avg Date: Sun Dec 7 11:21:41 2014 New Revision: 275576 URL: https://svnweb.freebsd.org/changeset/base/275576 Log: remove opensolaris cyclic code, replace with high-precision callouts In the old days callout(9) had 1 tick precision and that was inadequate for some uses, e.g. DTrace profile module, so we had to emulate cyclic API and behavior. Now we can directly use callout(9) in the very few places where cyclic was used. Differential Revision: https://reviews.freebsd.org/D1161 Reviewed by: gnn, jhb, markj MFC after: 2 weeks Deleted: head/sys/cddl/compat/opensolaris/sys/cyclic.h head/sys/cddl/compat/opensolaris/sys/cyclic_impl.h head/sys/cddl/dev/cyclic/ head/sys/modules/cyclic/ Modified: head/sys/cddl/compat/opensolaris/sys/cpuvar.h head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/dev/fbt/fbt.c head/sys/cddl/dev/profile/profile.c head/sys/kern/kern_clocksource.c head/sys/modules/Makefile head/sys/modules/dtrace/Makefile.inc head/sys/modules/dtrace/dtraceall/dtraceall.c head/sys/sys/dtrace_bsd.h Modified: head/sys/cddl/compat/opensolaris/sys/cpuvar.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/cpuvar.h Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/cddl/compat/opensolaris/sys/cpuvar.h Sun Dec 7 11:21:41 2014 (r275576) @@ -38,11 +38,8 @@ struct cyc_cpu; typedef struct { int cpuid; - struct cyc_cpu *cpu_cyclic; uint32_t cpu_flags; uint_t cpu_intr_actv; - uintptr_t cpu_profile_pc; - uintptr_t cpu_profile_upc; uintptr_t cpu_dtrace_caller; /* DTrace: caller, if any */ hrtime_t cpu_dtrace_chillmark; /* DTrace: chill mark time */ hrtime_t cpu_dtrace_chilled; /* DTrace: total chill time */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sun Dec 7 11:21:41 2014 (r275576) @@ -17947,6 +17947,5 @@ SYSINIT(dtrace_anon_init, SI_SUB_DTRACE_ DEV_MODULE(dtrace, dtrace_modevent, NULL); MODULE_VERSION(dtrace, 1); -MODULE_DEPEND(dtrace, cyclic, 1, 1, 1); MODULE_DEPEND(dtrace, opensolaris, 1, 1, 1); #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Sun Dec 7 11:21:41 2014 (r275576) @@ -57,6 +57,7 @@ extern "C" { #if defined(sun) #include #else +#include #include #include #include @@ -64,8 +65,8 @@ extern "C" { typedef int model_t; #endif #include -#include #if defined(sun) +#include #include #else #include Modified: head/sys/cddl/dev/fbt/fbt.c ============================================================================== --- head/sys/cddl/dev/fbt/fbt.c Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/cddl/dev/fbt/fbt.c Sun Dec 7 11:21:41 2014 (r275576) @@ -145,13 +145,6 @@ fbt_provide_module(void *arg, modctl_t * return; /* - * The cyclic timer subsystem can be built as a module and DTrace - * depends on that, so it is ineligible too. - */ - if (strcmp(modname, "cyclic") == 0) - return; - - /* * To register with DTrace, a module must list 'dtrace' as a * dependency in order for the kernel linker to resolve * symbols like dtrace_register(). All modules with such a Modified: head/sys/cddl/dev/profile/profile.c ============================================================================== --- head/sys/cddl/dev/profile/profile.c Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/cddl/dev/profile/profile.c Sun Dec 7 11:21:41 2014 (r275576) @@ -52,9 +52,9 @@ #include #include #include +#include #include -#include #include #include @@ -97,7 +97,7 @@ * allow for a manual override in case we get it completely wrong. */ #ifdef __amd64 -#define PROF_ARTIFICIAL_FRAMES 7 +#define PROF_ARTIFICIAL_FRAMES 10 #else #ifdef __i386 #define PROF_ARTIFICIAL_FRAMES 6 @@ -126,18 +126,30 @@ #define PROF_ARTIFICIAL_FRAMES 3 #endif +struct profile_probe_percpu; + typedef struct profile_probe { char prof_name[PROF_NAMELEN]; dtrace_id_t prof_id; int prof_kind; +#ifdef illumos hrtime_t prof_interval; cyclic_id_t prof_cyclic; +#else + sbintime_t prof_interval; + struct callout prof_cyclic; + sbintime_t prof_expected; + struct profile_probe_percpu **prof_pcpus; +#endif } profile_probe_t; typedef struct profile_probe_percpu { hrtime_t profc_expected; hrtime_t profc_interval; profile_probe_t *profc_probe; +#ifdef __FreeBSD__ + struct callout profc_cyclic; +#endif } profile_probe_percpu_t; static d_open_t profile_open; @@ -206,29 +218,92 @@ static dtrace_provider_id_t profile_id; static hrtime_t profile_interval_min = NANOSEC / 5000; /* 5000 hz */ static int profile_aframes = 0; /* override */ +static sbintime_t +nsec_to_sbt(hrtime_t nsec) +{ + time_t sec; + + /* + * We need to calculate nsec * 2^32 / 10^9 + * Seconds and nanoseconds are split to avoid overflow. + */ + sec = nsec / NANOSEC; + nsec = nsec % NANOSEC; + return (((sbintime_t)sec << 32) | ((sbintime_t)nsec << 32) / NANOSEC); +} + +static hrtime_t +sbt_to_nsec(sbintime_t sbt) +{ + + return ((sbt >> 32) * NANOSEC + + (((uint32_t)sbt * (hrtime_t)NANOSEC) >> 32)); +} + static void profile_fire(void *arg) { profile_probe_percpu_t *pcpu = arg; profile_probe_t *prof = pcpu->profc_probe; hrtime_t late; - solaris_cpu_t *c = &solaris_cpu[curcpu]; + struct trapframe *frame; + uintfptr_t pc, upc; +#ifdef illumos late = gethrtime() - pcpu->profc_expected; - pcpu->profc_expected += pcpu->profc_interval; +#else + late = sbt_to_nsec(sbinuptime() - pcpu->profc_expected); +#endif - dtrace_probe(prof->prof_id, c->cpu_profile_pc, - c->cpu_profile_upc, late, 0, 0); + pc = 0; + upc = 0; + + /* + * td_intr_frame can be unset if this is a catch up event + * after waking up from idle sleep. + * This can only happen on a CPU idle thread. + */ + frame = curthread->td_intr_frame; + if (frame != NULL) { + if (TRAPF_USERMODE(frame)) + upc = TRAPF_PC(frame); + else + pc = TRAPF_PC(frame); + } + dtrace_probe(prof->prof_id, pc, upc, late, 0, 0); + + pcpu->profc_expected += pcpu->profc_interval; + callout_schedule_sbt_curcpu(&pcpu->profc_cyclic, + pcpu->profc_expected, 0, C_DIRECT_EXEC | C_ABSOLUTE); } static void profile_tick(void *arg) { profile_probe_t *prof = arg; - solaris_cpu_t *c = &solaris_cpu[curcpu]; + struct trapframe *frame; + uintfptr_t pc, upc; + + pc = 0; + upc = 0; + + /* + * td_intr_frame can be unset if this is a catch up event + * after waking up from idle sleep. + * This can only happen on a CPU idle thread. + */ + frame = curthread->td_intr_frame; + if (frame != NULL) { + if (TRAPF_USERMODE(frame)) + upc = TRAPF_PC(frame); + else + pc = TRAPF_PC(frame); + } + dtrace_probe(prof->prof_id, pc, upc, 0, 0, 0); - dtrace_probe(prof->prof_id, c->cpu_profile_pc, - c->cpu_profile_upc, 0, 0, 0); + prof->prof_expected += prof->prof_interval; + callout_schedule_sbt(&prof->prof_cyclic, + prof->prof_expected, 0, C_DIRECT_EXEC | C_ABSOLUTE); } static void @@ -250,8 +325,13 @@ profile_create(hrtime_t interval, char * prof = kmem_zalloc(sizeof (profile_probe_t), KM_SLEEP); (void) strcpy(prof->prof_name, name); +#ifdef illumos prof->prof_interval = interval; prof->prof_cyclic = CYCLIC_NONE; +#else + prof->prof_interval = nsec_to_sbt(interval); + callout_init(&prof->prof_cyclic, CALLOUT_MPSAFE); +#endif prof->prof_kind = kind; prof->prof_id = dtrace_probe_create(profile_id, NULL, NULL, name, @@ -396,13 +476,18 @@ profile_destroy(void *arg, dtrace_id_t i { profile_probe_t *prof = parg; +#ifdef illumos ASSERT(prof->prof_cyclic == CYCLIC_NONE); +#else + ASSERT(!callout_active(&prof->prof_cyclic) && prof->prof_pcpus == NULL); +#endif kmem_free(prof, sizeof (profile_probe_t)); ASSERT(profile_total >= 1); atomic_add_32(&profile_total, -1); } +#ifdef illumos /*ARGSUSED*/ static void profile_online(void *arg, cpu_t *cpu, cyc_handler_t *hdlr, cyc_time_t *when) @@ -478,6 +563,81 @@ profile_disable(void *arg, dtrace_id_t i prof->prof_cyclic = CYCLIC_NONE; } +#else + +static void +profile_enable_omni(profile_probe_t *prof) +{ + profile_probe_percpu_t *pcpu; + int cpu; + + prof->prof_pcpus = kmem_zalloc((mp_maxid + 1) * sizeof(pcpu), KM_SLEEP); + CPU_FOREACH(cpu) { + pcpu = kmem_zalloc(sizeof(profile_probe_percpu_t), KM_SLEEP); + prof->prof_pcpus[cpu] = pcpu; + pcpu->profc_probe = prof; + pcpu->profc_expected = sbinuptime() + prof->prof_interval; + pcpu->profc_interval = prof->prof_interval; + callout_init(&pcpu->profc_cyclic, CALLOUT_MPSAFE); + callout_reset_sbt_on(&pcpu->profc_cyclic, + pcpu->profc_expected, 0, profile_fire, pcpu, + cpu, C_DIRECT_EXEC | C_ABSOLUTE); + } +} + +static void +profile_disable_omni(profile_probe_t *prof) +{ + profile_probe_percpu_t *pcpu; + int cpu; + + ASSERT(prof->prof_pcpus != NULL); + CPU_FOREACH(cpu) { + pcpu = prof->prof_pcpus[cpu]; + ASSERT(pcpu->profc_probe == prof); + ASSERT(callout_active(&pcpu->profc_cyclic)); + callout_stop(&pcpu->profc_cyclic); + callout_drain(&pcpu->profc_cyclic); + kmem_free(pcpu, sizeof(profile_probe_percpu_t)); + } + kmem_free(prof->prof_pcpus, (mp_maxid + 1) * sizeof(pcpu)); + prof->prof_pcpus = NULL; +} + +/* ARGSUSED */ +static void +profile_enable(void *arg, dtrace_id_t id, void *parg) +{ + profile_probe_t *prof = parg; + + if (prof->prof_kind == PROF_TICK) { + prof->prof_expected = sbinuptime() + prof->prof_interval; + callout_reset_sbt(&prof->prof_cyclic, + prof->prof_expected, 0, profile_tick, prof, + C_DIRECT_EXEC | C_ABSOLUTE); + } else { + ASSERT(prof->prof_kind == PROF_PROFILE); + profile_enable_omni(prof); + } +} + +/* ARGSUSED */ +static void +profile_disable(void *arg, dtrace_id_t id, void *parg) +{ + profile_probe_t *prof = parg; + + if (prof->prof_kind == PROF_TICK) { + ASSERT(callout_active(&prof->prof_cyclic)); + callout_stop(&prof->prof_cyclic); + callout_drain(&prof->prof_cyclic); + } else { + ASSERT(prof->prof_kind == PROF_PROFILE); + profile_disable_omni(prof); + } +} +#endif + static void profile_load(void *dummy) { @@ -541,5 +701,4 @@ SYSUNINIT(profile_unload, SI_SUB_DTRACE_ DEV_MODULE(profile, profile_modevent, NULL); MODULE_VERSION(profile, 1); MODULE_DEPEND(profile, dtrace, 1, 1, 1); -MODULE_DEPEND(profile, cyclic, 1, 1, 1); MODULE_DEPEND(profile, opensolaris, 1, 1, 1); Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/kern/kern_clocksource.c Sun Dec 7 11:21:41 2014 (r275576) @@ -54,11 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef KDTRACE_HOOKS -#include -cyclic_clock_func_t cyclic_clock_func = NULL; -#endif - int cpu_can_deep_sleep = 0; /* C3 state is available. */ int cpu_disable_deep_sleep = 0; /* Timer dies in C3. */ @@ -125,9 +120,6 @@ struct pcpu_state { sbintime_t nextprof; /* Next profclock() event. */ sbintime_t nextcall; /* Next callout event. */ sbintime_t nextcallopt; /* Next optional callout event. */ -#ifdef KDTRACE_HOOKS - sbintime_t nextcyc; /* Next OpenSolaris cyclics event. */ -#endif int ipi; /* This CPU needs IPI. */ int idle; /* This CPU is in idle mode. */ }; @@ -219,13 +211,6 @@ handleevents(sbintime_t now, int fake) callout_process(now); } -#ifdef KDTRACE_HOOKS - if (fake == 0 && now >= state->nextcyc && cyclic_clock_func != NULL) { - state->nextcyc = SBT_MAX; - (*cyclic_clock_func)(frame); - } -#endif - t = getnextcpuevent(0); ET_HW_LOCK(state); if (!busy) { @@ -271,10 +256,6 @@ getnextcpuevent(int idle) if (profiling && event > state->nextprof) event = state->nextprof; } -#ifdef KDTRACE_HOOKS - if (event > state->nextcyc) - event = state->nextcyc; -#endif return (event); } @@ -595,9 +576,6 @@ cpu_initclocks_bsp(void) CPU_FOREACH(cpu) { state = DPCPU_ID_PTR(cpu, timerstate); mtx_init(&state->et_hw_mtx, "et_hw_mtx", NULL, MTX_SPIN); -#ifdef KDTRACE_HOOKS - state->nextcyc = SBT_MAX; -#endif state->nextcall = SBT_MAX; state->nextcallopt = SBT_MAX; } @@ -816,41 +794,6 @@ cpu_et_frequency(struct eventtimer *et, ET_UNLOCK(); } -#ifdef KDTRACE_HOOKS -void -clocksource_cyc_set(const struct bintime *bt) -{ - sbintime_t now, t; - struct pcpu_state *state; - - /* Do not touch anything if somebody reconfiguring timers. */ - if (busy) - return; - t = bttosbt(*bt); - state = DPCPU_PTR(timerstate); - if (periodic) - now = state->now; - else - now = sbinuptime(); - - CTR5(KTR_SPARE2, "set_cyc at %d: now %d.%08x t %d.%08x", - curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff), - (int)(t >> 32), (u_int)(t & 0xffffffff)); - - ET_HW_LOCK(state); - if (t == state->nextcyc) - goto done; - state->nextcyc = t; - if (t >= state->nextevent) - goto done; - state->nextevent = t; - if (!periodic) - loadtimer(now, 0); -done: - ET_HW_UNLOCK(state); -} -#endif - void cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt) { Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/modules/Makefile Sun Dec 7 11:21:41 2014 (r275576) @@ -90,7 +90,6 @@ SUBDIR= \ cuse \ ${_cxgb} \ ${_cxgbe} \ - ${_cyclic} \ dc \ dcons \ dcons_crom \ @@ -476,9 +475,6 @@ _cardbus= cardbus _cbb= cbb _cpuctl= cpuctl _cpufreq= cpufreq -.if ${MK_CDDL} != "no" || defined(ALL_MODULES) -_cyclic= cyclic -.endif _dpms= dpms _drm= drm _drm2= drm2 @@ -686,9 +682,6 @@ _cardbus= cardbus _cbb= cbb _cfi= cfi _cpufreq= cpufreq -.if ${MK_CDDL} != "no" || defined(ALL_MODULES) -_cyclic= cyclic -.endif _drm= drm .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _dtrace= dtrace Modified: head/sys/modules/dtrace/Makefile.inc ============================================================================== --- head/sys/modules/dtrace/Makefile.inc Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/modules/dtrace/Makefile.inc Sun Dec 7 11:21:41 2014 (r275576) @@ -3,7 +3,6 @@ IGNORE_PRAGMA= 1 load : - -kldload cyclic -kldload dtrace .if ${MACHINE_CPUARCH} == "i386" -kldload sdt @@ -25,5 +24,4 @@ unload : -kldunload sdt .endif -kldunload dtrace - -kldunload cyclic kldstat Modified: head/sys/modules/dtrace/dtraceall/dtraceall.c ============================================================================== --- head/sys/modules/dtrace/dtraceall/dtraceall.c Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/modules/dtrace/dtraceall/dtraceall.c Sun Dec 7 11:21:41 2014 (r275576) @@ -63,7 +63,6 @@ DEV_MODULE(dtraceall, dtraceall_modevent MODULE_VERSION(dtraceall, 1); /* All the DTrace modules should be dependencies here: */ -MODULE_DEPEND(dtraceall, cyclic, 1, 1, 1); MODULE_DEPEND(dtraceall, opensolaris, 1, 1, 1); MODULE_DEPEND(dtraceall, dtrace, 1, 1, 1); MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1); Modified: head/sys/sys/dtrace_bsd.h ============================================================================== --- head/sys/sys/dtrace_bsd.h Sun Dec 7 06:47:00 2014 (r275575) +++ head/sys/sys/dtrace_bsd.h Sun Dec 7 11:21:41 2014 (r275576) @@ -39,15 +39,6 @@ struct vattr; struct vnode; struct reg; -/* - * Cyclic clock function type definition used to hook the cyclic - * subsystem into the appropriate timer interrupt. - */ -typedef void (*cyclic_clock_func_t)(struct trapframe *); -extern cyclic_clock_func_t cyclic_clock_func; - -void clocksource_cyc_set(const struct bintime *t); - int dtrace_trap(struct trapframe *); /* From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 13:51:03 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7CB1EFDA; Sun, 7 Dec 2014 13:51:03 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 3189235D; Sun, 7 Dec 2014 13:51:01 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA18028; Sun, 07 Dec 2014 15:52:53 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1XxcEk-0005G1-UW; Sun, 07 Dec 2014 15:50:58 +0200 Message-ID: <54845AF1.8020208@FreeBSD.org> Date: Sun, 07 Dec 2014 15:49:37 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Warner Losh , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r266566 - head/usr.bin/bmake References: <201405230020.s4N0KiLx086859@svn.freebsd.org> In-Reply-To: <201405230020.s4N0KiLx086859@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 13:51:03 -0000 On 23/05/2014 03:20, Warner Losh wrote: > Author: imp > Date: Fri May 23 00:20:44 2014 > New Revision: 266566 > URL: http://svnweb.freebsd.org/changeset/base/266566 > > Log: > Add .../share/mk to the default system make path. This will fix the > problem with broken in-tree builds (which are used far more > pervasively than I'd known outside the tree). However, weird results > may now happen if at any point in the tree above you there happens to > be a directory that has subdirectory of share/mk, as unpredictable > results will follow. This was considered the lessor of the two evils, > at least for now. In the future this will be removed again when the > underlying issues are resolved. Just in case, a concrete example of a possible problem. If a ports tree is placed somewhere below /usr/local and devel/bmake is installed then /usr/local/share/mk/sys.mk would be used instead of /usr/share/mk/sys.mk during port builds. And the former looks nothing like the latter. > Modified: > head/usr.bin/bmake/Makefile > > Modified: head/usr.bin/bmake/Makefile > ============================================================================== > --- head/usr.bin/bmake/Makefile Thu May 22 23:38:17 2014 (r266565) > +++ head/usr.bin/bmake/Makefile Fri May 23 00:20:44 2014 (r266566) > @@ -166,7 +166,6 @@ accept test: > # override some simple things > BINDIR= /usr/bin > MANDIR= /usr/share/man/man > -DEFAULT_SYS_PATH= /usr/share/mk > > # make sure we get this > CFLAGS+= ${COPTS.${.IMPSRC:T}} > -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 17:32:17 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC70A3AA for ; Sun, 7 Dec 2014 17:32:17 +0000 (UTC) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B851C3D for ; Sun, 7 Dec 2014 17:32:17 +0000 (UTC) Received: by mail-pd0-f172.google.com with SMTP id y13so3704233pdi.31 for ; Sun, 07 Dec 2014 09:32:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=dcUXjVY5Wo+yX6XUIGTXX9XJyhExFIrFlXjsndTAtL0=; b=bjKWdtinaBQuEpnMZrtMsXLCpb17bcFpUN87PkHXYsYIPKdY2IQ3oodmXB+Ca0HoQQ 0b4leN+yMcN9mdnUD5u0HgZ9ULEpBzDCC8g66PQqdNgPdDnuK5DIH7FVg8097RgciOV2 oMEy8CfgU/eRIg0IulUImtaT0t2J7UA3GEyz8HUszgxnRfyV/iIJsh0h9Cq8e471VwJo /W+l+sdwM0qg4Qkth7SmNlfwHr1h0hHX1Y/UQX3AobE2Zc80TiF9GisKZYKoJ9x0EXYY JiABFA1pGZhqndvEghJFk5NUs12NrY0DycVmTo83DTpnyHKCS2Y1H93N4EsNDFN6BOMe WHDg== X-Gm-Message-State: ALoCoQlPlK1A13B00yvslly1Y3C8NId4lWh5W6A+XhyRIUv2RVlY9M3VeP6K+Cdd+qEUsNrtpiEK X-Received: by 10.70.36.236 with SMTP id t12mr13784052pdj.143.1417973531822; Sun, 07 Dec 2014 09:32:11 -0800 (PST) Received: from [10.64.27.58] ([69.53.236.236]) by mx.google.com with ESMTPSA id c3sm29152194pdi.96.2014.12.07.09.32.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 07 Dec 2014 09:32:10 -0800 (PST) Sender: Warner Losh Subject: Re: svn commit: r266566 - head/usr.bin/bmake Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Content-Type: multipart/signed; boundary="Apple-Mail=_5E7B9651-B172-4849-8F2E-7364816DC576"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5b3 From: Warner Losh In-Reply-To: <54845AF1.8020208@FreeBSD.org> Date: Sun, 7 Dec 2014 10:32:07 -0700 Message-Id: <1ABC505B-3E88-4223-9CFE-99D64F382D66@bsdimp.com> References: <201405230020.s4N0KiLx086859@svn.freebsd.org> <54845AF1.8020208@FreeBSD.org> To: Andriy Gapon X-Mailer: Apple Mail (2.1993) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Warner Losh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 17:32:18 -0000 --Apple-Mail=_5E7B9651-B172-4849-8F2E-7364816DC576 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 7, 2014, at 6:49 AM, Andriy Gapon wrote: >=20 > On 23/05/2014 03:20, Warner Losh wrote: >> Author: imp >> Date: Fri May 23 00:20:44 2014 >> New Revision: 266566 >> URL: http://svnweb.freebsd.org/changeset/base/266566 >>=20 >> Log: >> Add .../share/mk to the default system make path. This will fix the >> problem with broken in-tree builds (which are used far more >> pervasively than I'd known outside the tree). However, weird results >> may now happen if at any point in the tree above you there happens = to >> be a directory that has subdirectory of share/mk, as unpredictable >> results will follow. This was considered the lessor of the two = evils, >> at least for now. In the future this will be removed again when the >> underlying issues are resolved. >=20 > Just in case, a concrete example of a possible problem. > If a ports tree is placed somewhere below /usr/local and devel/bmake = is > installed then /usr/local/share/mk/sys.mk would be used instead of > /usr/share/mk/sys.mk during port builds. And the former looks nothing = like the > latter. That=E2=80=99s exactly the sort of problem I=E2=80=99d expect that was = judged to be the lessor of the two evils. Warner --Apple-Mail=_5E7B9651-B172-4849-8F2E-7364816DC576 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJUhI8XAAoJEGwc0Sh9sBEA3ygQAMxlqQyhBZ+xy6VV3EWwuGSY stY2TJHEWj6MaCCj9dXayGyjnOpRtnzb2//LerKq4fKcrFzLYWQiyjVOEBokm7hx mioRhH9FV0JItTbVHqRjxBrtyFMxCCzaMwRXLF31f7z0Lxeq35md5K124RHFN0Gb GSWpHFeExm4AgYQF0l3L2E/is2JtYrDSRtuBhYhsjmbX+130ydpXrYjCdz5ZGrMf WXYtCh+XWvYvtAHyKBj4LqpBuruKMDccTsz+Rz9nBD0nN/o94sT8cHtgLnLetazi YqJocAoBzFsWSRnl3FVOCuhbjshCeDgikgbGgdjoXjBy4ByOa3IZtS795BDNC1v7 Kj3i9epizYa4JBvfcGeqlryMTahSBaFx4bXBBdCF38AS8gP7eHEdU5bGxjAyzgHp ezMCmo9ORXr/T7qm6fUeR20XRZe9Ucy6vS+jo/thgic0Q4Che0EkqJOb58giW8oQ FR81iInsR3BGKeQG1Gg8IeENwZpY8zKMnCf4JQ6JFCyaJKObW5fACP0TF/8W4lEO YGNpEB47px2dP2RQSfGZzAoPUW9Tb+P6/7PU19dQoYVLtyqf0PkFjZvhIJGFT8Qy k181dS+g5NQrLI3cthCvnztM9t8SJR68Imx3Zbncplk1DQx0OHmqky0FzlKu4dnX 571NQwuA9s+LSwekrbme =jxdV -----END PGP SIGNATURE----- --Apple-Mail=_5E7B9651-B172-4849-8F2E-7364816DC576-- From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 18:15:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1FF6D1C; Sun, 7 Dec 2014 18:15:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDB1DA0; Sun, 7 Dec 2014 18:15:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7IFSKc038819; Sun, 7 Dec 2014 18:15:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7IFS7M038816; Sun, 7 Dec 2014 18:15:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412071815.sB7IFS7M038816@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 7 Dec 2014 18:15:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275579 - in head/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 18:15:29 -0000 Author: delphij Date: Sun Dec 7 18:15:27 2014 New Revision: 275579 URL: https://svnweb.freebsd.org/changeset/base/275579 Log: MFV r275537: Illumos issue: 5316 allow smbadm join to use RPC (Due to our lack of smbsrv this is mostly no-op on FreeBSD) MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Dec 7 17:32:06 2014 (r275578) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Dec 7 18:15:27 2014 (r275579) @@ -68,6 +68,7 @@ #ifdef sun #include #include +#include #endif #include "zfs_iter.h" @@ -2390,10 +2391,9 @@ userspace_cb(void *arg, const char *doma /* SMB */ char sid[ZFS_MAXNAMELEN + 32]; uid_t id; - uint64_t classes; #ifdef sun int err; - directory_error_t e; + int flag = IDMAP_REQ_FLG_USE_CACHE; #endif smbentity = B_TRUE; @@ -2416,10 +2416,13 @@ userspace_cb(void *arg, const char *doma if (err == 0) { rid = id; if (!cb->cb_sid2posix) { - e = directory_name_from_sid(NULL, sid, &name, - &classes); - if (e != NULL) - directory_error_free(e); + if (type == USTYPE_SMB_USR) { + (void) idmap_getwinnamebyuid(rid, flag, + &name, NULL); + } else { + (void) idmap_getwinnamebygid(rid, flag, + &name, NULL); + } if (name == NULL) name = sid; } Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Dec 7 17:32:06 2014 (r275578) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Dec 7 18:15:27 2014 (r275579) @@ -2615,7 +2615,7 @@ userquota_propname_decode(const char *pr boolean_t isuser; domain[0] = '\0'; - + *ridp = 0; /* Figure out the property type ({user|group}{quota|space}) */ for (type = 0; type < ZFS_NUM_USERQUOTA_PROPS; type++) { if (strncmp(propname, zfs_userquota_prop_prefixes[type], @@ -2637,23 +2637,46 @@ userquota_propname_decode(const char *pr * It's a SID name (eg "user@domain") that needs to be * turned into S-1-domainID-RID. */ - directory_error_t e; + int flag = 0; + idmap_stat stat, map_stat; + uid_t pid; + idmap_rid_t rid; + idmap_get_handle_t *gh = NULL; + + stat = idmap_get_create(&gh); + if (stat != IDMAP_SUCCESS) { + idmap_get_destroy(gh); + return (ENOMEM); + } if (zoned && getzoneid() == GLOBAL_ZONEID) return (ENOENT); if (isuser) { - e = directory_sid_from_user_name(NULL, - cp, &numericsid); + stat = idmap_getuidbywinname(cp, NULL, flag, &pid); + if (stat < 0) + return (ENOENT); + stat = idmap_get_sidbyuid(gh, pid, flag, &numericsid, + &rid, &map_stat); } else { - e = directory_sid_from_group_name(NULL, - cp, &numericsid); + stat = idmap_getgidbywinname(cp, NULL, flag, &pid); + if (stat < 0) + return (ENOENT); + stat = idmap_get_sidbygid(gh, pid, flag, &numericsid, + &rid, &map_stat); + } + if (stat < 0) { + idmap_get_destroy(gh); + return (ENOENT); } - if (e != NULL) { - directory_error_free(e); + stat = idmap_get_mappings(gh); + idmap_get_destroy(gh); + + if (stat < 0) { return (ENOENT); } if (numericsid == NULL) return (ENOENT); cp = numericsid; + *ridp = rid; /* will be further decoded below */ #else /* !sun */ return (ENOENT); @@ -2663,12 +2686,15 @@ userquota_propname_decode(const char *pr if (strncmp(cp, "S-1-", 4) == 0) { /* It's a numeric SID (eg "S-1-234-567-89") */ (void) strlcpy(domain, cp, domainlen); - cp = strrchr(domain, '-'); - *cp = '\0'; - cp++; - errno = 0; - *ridp = strtoull(cp, &end, 10); + if (*ridp == 0) { + cp = strrchr(domain, '-'); + *cp = '\0'; + cp++; + *ridp = strtoull(cp, &end, 10); + } else { + end = ""; + } if (numericsid) { free(numericsid); numericsid = NULL; From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 18:17:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9ED95E81; Sun, 7 Dec 2014 18:17:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71862B8; Sun, 7 Dec 2014 18:17:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7IHPcq039179; Sun, 7 Dec 2014 18:17:25 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7IHPfA039178; Sun, 7 Dec 2014 18:17:25 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412071817.sB7IHPfA039178@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 7 Dec 2014 18:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275580 - head/sys/cddl/contrib/opensolaris X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 18:17:25 -0000 Author: delphij Date: Sun Dec 7 18:17:24 2014 New Revision: 275580 URL: https://svnweb.freebsd.org/changeset/base/275580 Log: Note vendor revision r275538 as merged. Modified: Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 20:15:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4846551A; Sun, 7 Dec 2014 20:15:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 347EEDC1; Sun, 7 Dec 2014 20:15:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7KF85S099177; Sun, 7 Dec 2014 20:15:08 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7KF8Hj099176; Sun, 7 Dec 2014 20:15:08 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201412072015.sB7KF8Hj099176@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 7 Dec 2014 20:15:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275581 - head/usr.bin/patch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 20:15:08 -0000 Author: pfg Date: Sun Dec 7 20:15:07 2014 New Revision: 275581 URL: https://svnweb.freebsd.org/changeset/base/275581 Log: Prefer setvbuf() to setlinebuf(). On FreeBSD's libc setlinebuf is a wrapper to setvbuf anyways. Obtained from: OpenBSD MFC after: 5 days Modified: head/usr.bin/patch/patch.c Modified: head/usr.bin/patch/patch.c ============================================================================== --- head/usr.bin/patch/patch.c Sun Dec 7 18:17:24 2014 (r275580) +++ head/usr.bin/patch/patch.c Sun Dec 7 20:15:07 2014 (r275581) @@ -23,7 +23,7 @@ * -C option added in 1998, original code by Marc Espie, based on FreeBSD * behaviour * - * $OpenBSD: patch.c,v 1.50 2012/05/15 19:32:02 millert Exp $ + * $OpenBSD: patch.c,v 1.52 2014/11/26 18:34:51 millert Exp $ * $FreeBSD$ * */ @@ -150,8 +150,8 @@ main(int argc, char *argv[]) const char *tmpdir; char *v; - setlinebuf(stdout); - setlinebuf(stderr); + setvbuf(stdout, NULL, _IOLBF, 0); + setvbuf(stderr, NULL, _IOLBF, 0); for (i = 0; i < MAXFILEC; i++) filearg[i] = NULL; From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 20:32:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74CDF958; Sun, 7 Dec 2014 20:32:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47705F62; Sun, 7 Dec 2014 20:32:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7KWPUF008943; Sun, 7 Dec 2014 20:32:25 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7KWPDE008942; Sun, 7 Dec 2014 20:32:25 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201412072032.sB7KWPDE008942@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 7 Dec 2014 20:32:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275582 - head/usr.bin/patch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 20:32:25 -0000 Author: pfg Date: Sun Dec 7 20:32:24 2014 New Revision: 275582 URL: https://svnweb.freebsd.org/changeset/base/275582 Log: Small space changes Mostly to keep in sync with OpenBSD and update the TAG. Obtained from: OpenBSD MFC after: 5 days Modified: head/usr.bin/patch/pch.c Modified: head/usr.bin/patch/pch.c ============================================================================== --- head/usr.bin/patch/pch.c Sun Dec 7 20:15:07 2014 (r275581) +++ head/usr.bin/patch/pch.c Sun Dec 7 20:32:24 2014 (r275582) @@ -24,7 +24,7 @@ * -C option added in 1998, original code by Marc Espie, based on FreeBSD * behaviour * - * $OpenBSD: pch.c,v 1.40 2013/07/11 12:39:31 otto Exp $ + * $OpenBSD: pch.c,v 1.43 2014/11/18 17:03:35 tobias Exp $ * $FreeBSD$ */ @@ -319,7 +319,8 @@ intuit_diff_type(void) for (t = s + 7; isspace((unsigned char)*t); t++) ; revision = savestr(t); - for (t = revision; *t && !isspace((unsigned char)*t); t++) + for (t = revision; + *t && !isspace((unsigned char)*t); t++) ; *t = '\0'; if (*revision == '\0') { @@ -585,7 +586,8 @@ another_hunk(void) p_end--; return false; } - for (s = buf; *s && !isdigit((unsigned char)*s); s++) + for (s = buf; + *s && !isdigit((unsigned char)*s); s++) ; if (!*s) malformed(); @@ -595,7 +597,8 @@ another_hunk(void) while (isdigit((unsigned char)*s)) s++; if (*s == ',') { - for (; *s && !isdigit((unsigned char)*s); s++) + for (; + *s && !isdigit((unsigned char)*s); s++) ; if (!*s) malformed(); @@ -692,8 +695,8 @@ another_hunk(void) change_line: if (buf[1] == '\n' && canonicalize) strlcpy(buf + 1, " \n", buf_size - 1); - if (!isspace((unsigned char)buf[1]) && buf[1] != '>' && - buf[1] != '<' && + if (!isspace((unsigned char)buf[1]) && + buf[1] != '>' && buf[1] != '<' && repl_beginning && repl_could_be_missing) { repl_missing = true; goto hunk_done; @@ -1422,8 +1425,8 @@ do_ed_script(void) for (t = buf; isdigit((unsigned char)*t) || *t == ','; t++) ; /* POSIX defines allowed commands as {a,c,d,i,s} */ - if (isdigit((unsigned char)*buf) && (*t == 'a' || *t == 'c' || - *t == 'd' || *t == 'i' || *t == 's')) { + if (isdigit((unsigned char)*buf) && + (*t == 'a' || *t == 'c' || *t == 'd' || *t == 'i' || *t == 's')) { if (pipefp != NULL) fputs(buf, pipefp); if (*t != 'd') { From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 21:02:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BC0171FA; Sun, 7 Dec 2014 21:02:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8DE32EE; Sun, 7 Dec 2014 21:02:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7L2k3u024032; Sun, 7 Dec 2014 21:02:46 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7L2kom024031; Sun, 7 Dec 2014 21:02:46 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201412072102.sB7L2kom024031@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Sun, 7 Dec 2014 21:02:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275583 - head/sys/arm/mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 21:02:46 -0000 Author: zbb Date: Sun Dec 7 21:02:45 2014 New Revision: 275583 URL: https://svnweb.freebsd.org/changeset/base/275583 Log: Fix buffer overflow in Marvell PCI/PCIe driver Buffer overflow occured when more than one MSI was allocated. Submitted by: Wojciech Macek Obtained from: Semihalf Modified: head/sys/arm/mv/mv_pci.c Modified: head/sys/arm/mv/mv_pci.c ============================================================================== --- head/sys/arm/mv/mv_pci.c Sun Dec 7 20:32:24 2014 (r275582) +++ head/sys/arm/mv/mv_pci.c Sun Dec 7 21:02:45 2014 (r275583) @@ -1171,7 +1171,7 @@ mv_pcib_alloc_msi(device_t dev, device_t for (i = start; i < start + count; i++) { setbit(&sc->sc_msi_bitmap, i); - irqs[i] = MSI_IRQ + i; + *irqs++ = MSI_IRQ + i; } debugf("%s: start: %x count: %x\n", __func__, start, count); From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 21:47:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F3E687D; Sun, 7 Dec 2014 21:47:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BB978C1; Sun, 7 Dec 2014 21:47:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7LlKxF044642; Sun, 7 Dec 2014 21:47:20 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7LlKei044641; Sun, 7 Dec 2014 21:47:20 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201412072147.sB7LlKei044641@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 7 Dec 2014 21:47:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275584 - head/contrib/binutils/gas/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 21:47:20 -0000 Author: andrew Date: Sun Dec 7 21:47:19 2014 New Revision: 275584 URL: https://svnweb.freebsd.org/changeset/base/275584 Log: Fix mrc and mrc2 with APSR_nzcv. Binutils encodes it internally as 0 where we need it to be set to 15 for it to be equivalent to r15. MFC after: 1 week X-MFC with: r275415 Sponsored by: ABT Systems Ltd Modified: head/contrib/binutils/gas/config/tc-arm.c Modified: head/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- head/contrib/binutils/gas/config/tc-arm.c Sun Dec 7 21:02:45 2014 (r275583) +++ head/contrib/binutils/gas/config/tc-arm.c Sun Dec 7 21:47:19 2014 (r275584) @@ -6789,7 +6789,11 @@ do_co_reg (void) { inst.instruction |= inst.operands[0].reg << 8; inst.instruction |= inst.operands[1].imm << 21; - inst.instruction |= inst.operands[2].reg << 12; + /* If this is a vector we are using the APSR_nzcv syntax, encode as r15 */ + if (inst.operands[2].isvec != 0) + inst.instruction |= 15 << 12; + else + inst.instruction |= inst.operands[2].reg << 12; inst.instruction |= inst.operands[3].reg << 16; inst.instruction |= inst.operands[4].reg; inst.instruction |= inst.operands[5].imm << 5; From owner-svn-src-all@FreeBSD.ORG Sun Dec 7 22:30:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26B17EA0; Sun, 7 Dec 2014 22:30:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC467CB6; Sun, 7 Dec 2014 22:30:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7MUtXt065993; Sun, 7 Dec 2014 22:30:55 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7MUtZa065987; Sun, 7 Dec 2014 22:30:55 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201412072230.sB7MUtZa065987@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 7 Dec 2014 22:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275585 - in stable/10: etc/mtree usr.bin/truncate usr.bin/truncate/tests X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 07 Dec 2014 22:30:56 -0000 Author: jilles Date: Sun Dec 7 22:30:54 2014 New Revision: 275585 URL: https://svnweb.freebsd.org/changeset/base/275585 Log: MFC r267265: truncate: Detect integer overflow, fix relative sizes, add tests. The change to expand_number (r204654) broke detection of too large sizes and relative sizes ('+'/'-'). Also add some tests. The usr.bin/truncate/Makefile is slightly different in the MFC because src.opts.mk does not exist in stable/10. PR: 190735 Submitted by: Kirk Russell Added: stable/10/usr.bin/truncate/tests/ - copied from r267265, head/usr.bin/truncate/tests/ Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/usr.bin/truncate/Makefile stable/10/usr.bin/truncate/truncate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Sun Dec 7 21:47:19 2014 (r275584) +++ stable/10/etc/mtree/BSD.tests.dist Sun Dec 7 22:30:54 2014 (r275585) @@ -291,6 +291,8 @@ .. tr .. + truncate + .. uudecode .. uuencode Modified: stable/10/usr.bin/truncate/Makefile ============================================================================== --- stable/10/usr.bin/truncate/Makefile Sun Dec 7 21:47:19 2014 (r275584) +++ stable/10/usr.bin/truncate/Makefile Sun Dec 7 22:30:54 2014 (r275585) @@ -1,7 +1,13 @@ # $FreeBSD$ +.include + PROG= truncate DPADD= ${LIBUTIL} LDADD= -lutil +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Modified: stable/10/usr.bin/truncate/truncate.c ============================================================================== --- stable/10/usr.bin/truncate/truncate.c Sun Dec 7 21:47:19 2014 (r275584) +++ stable/10/usr.bin/truncate/truncate.c Sun Dec 7 22:30:54 2014 (r275585) @@ -54,8 +54,8 @@ main(int argc, char **argv) { struct stat sb; mode_t omode; - off_t oflow, rsize, tsize; - int64_t sz; + off_t oflow, rsize, sz, tsize; + uint64_t usz; int ch, error, fd, oflags; char *fname, *rname; @@ -73,11 +73,13 @@ main(int argc, char **argv) rname = optarg; break; case 's': - if (expand_number(optarg, &sz) == -1) + do_relative = *optarg == '+' || *optarg == '-'; + if (expand_number(do_relative ? optarg + 1 : optarg, + &usz) == -1 || (off_t)usz < 0) errx(EXIT_FAILURE, "invalid size argument `%s'", optarg); - if (*optarg == '+' || *optarg == '-') - do_relative = 1; + + sz = (*optarg == '-') ? -(off_t)usz : (off_t)usz; got_size = 1; break; default: From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 03:30:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7911E65; Mon, 8 Dec 2014 03:30:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94D59B7B; Mon, 8 Dec 2014 03:30:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB83Uhev013866; Mon, 8 Dec 2014 03:30:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB83Uhrr013865; Mon, 8 Dec 2014 03:30:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412080330.sB83Uhrr013865@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 03:30:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275588 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 03:30:43 -0000 Author: ngie Date: Mon Dec 8 03:30:42 2014 New Revision: 275588 URL: https://svnweb.freebsd.org/changeset/base/275588 Log: ${CC} --version doesn't need to be queried if both COMPILER_TYPE and COMPILER_VERSION are known Modified: head/share/mk/bsd.compiler.mk Directory Properties: head/ (props changed) head/share/ (props changed) Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Sun Dec 7 23:59:44 2014 (r275587) +++ head/share/mk/bsd.compiler.mk Mon Dec 8 03:30:42 2014 (r275588) @@ -25,6 +25,7 @@ .if !target(____) ____: +.if !defined(COMPILER_TYPE) && !defined(COMPILER_VERSION) _v!= ${CC} --version 2>/dev/null || echo 0.0.0 .if !defined(COMPILER_TYPE) . if ${CC:T:M*gcc*} @@ -45,6 +46,7 @@ COMPILER_TYPE:= clang COMPILER_VERSION!=echo ${_v:M[1-9].[0-9]*} | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' .endif .undef _v +.endif .if ${COMPILER_TYPE} == "clang" || \ (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800) From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 03:32:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 63F36FAE; Mon, 8 Dec 2014 03:32:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50FA1C12; Mon, 8 Dec 2014 03:32:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB83WRbN015793; Mon, 8 Dec 2014 03:32:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB83WR28015792; Mon, 8 Dec 2014 03:32:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412080332.sB83WR28015792@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 03:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275589 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 03:32:27 -0000 Author: ngie Date: Mon Dec 8 03:32:26 2014 New Revision: 275589 URL: https://svnweb.freebsd.org/changeset/base/275589 Log: The previous commit should have been a logical or not a logical "and" Pointyhat to: me Modified: head/share/mk/bsd.compiler.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Mon Dec 8 03:30:42 2014 (r275588) +++ head/share/mk/bsd.compiler.mk Mon Dec 8 03:32:26 2014 (r275589) @@ -25,7 +25,7 @@ .if !target(____) ____: -.if !defined(COMPILER_TYPE) && !defined(COMPILER_VERSION) +.if !defined(COMPILER_TYPE) || !defined(COMPILER_VERSION) _v!= ${CC} --version 2>/dev/null || echo 0.0.0 .if !defined(COMPILER_TYPE) . if ${CC:T:M*gcc*} From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 04:06:04 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7AD1A793; Mon, 8 Dec 2014 04:06:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 687F8E6D; Mon, 8 Dec 2014 04:06:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8464Kp032554; Mon, 8 Dec 2014 04:06:04 GMT (envelope-from mp@FreeBSD.org) Received: (from mp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8464cZ032553; Mon, 8 Dec 2014 04:06:04 GMT (envelope-from mp@FreeBSD.org) Message-Id: <201412080406.sB8464cZ032553@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mp set sender to mp@FreeBSD.org using -f From: Mark Peek Date: Mon, 8 Dec 2014 04:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275591 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 04:06:04 -0000 Author: mp Date: Mon Dec 8 04:06:03 2014 New Revision: 275591 URL: https://svnweb.freebsd.org/changeset/base/275591 Log: Document support for Netgear WG111v1 (rev2) Modified: head/share/man/man4/upgt.4 Modified: head/share/man/man4/upgt.4 ============================================================================== --- head/share/man/man4/upgt.4 Mon Dec 8 03:36:43 2014 (r275590) +++ head/share/man/man4/upgt.4 Mon Dec 8 04:06:03 2014 (r275591) @@ -168,6 +168,8 @@ Gigaset USB Adapter 54 .It Inventel UR045G .It +Netgear WG111v1 (rev2) +.It SMC EZ ConnectG SMC2862W-G .It Sagem XG703A From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 04:35:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A8AAAE2D; Mon, 8 Dec 2014 04:35:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D00610F; Mon, 8 Dec 2014 04:35:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB84ZZeQ048247; Mon, 8 Dec 2014 04:35:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB84ZZ0p048245; Mon, 8 Dec 2014 04:35:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201412080435.sB84ZZ0p048245@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Dec 2014 04:35:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275592 - in head/cddl: contrib/opensolaris/lib/libctf/common lib/libctf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 04:35:35 -0000 Author: markj Date: Mon Dec 8 04:35:34 2014 New Revision: 275592 URL: https://svnweb.freebsd.org/changeset/base/275592 Log: MFV r272851: 5202 want ctf(4) illumos/illumos-gate@fe2e029eea29fd49d0d9058dbd5b79a252667e6b Added: head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 - copied, changed from r275591, vendor/illumos/dist/man/man4/ctf.4 Modified: head/cddl/lib/libctf/Makefile Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Copied and modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 (from r275591, vendor/illumos/dist/man/man4/ctf.4) ============================================================================== --- vendor/illumos/dist/man/man4/ctf.4 Mon Dec 8 04:06:03 2014 (r275591, copy source) +++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 Mon Dec 8 04:35:34 2014 (r275592) @@ -12,7 +12,7 @@ .\" Copyright (c) 2014 Joyent, Inc. .\" .Dd Sep 26, 2014 -.Dt CTF 4 +.Dt CTF 5 .Os .Sh NAME .Nm ctf @@ -1093,7 +1093,7 @@ should be written out, including the nul to something in this section should refer to the first byte which begins a string. Beyond the first byte in the section being the null terminator, the order of strings is unimportant. -.Sh Data Encoding and ELF Considerations +.Ss Data Encoding and ELF Considerations .Nm data is generally included in ELF objects which specify information to identify the architecture and endianness of the file. A @@ -1133,8 +1133,8 @@ The type of the section must be The section should have a link set to the symbol table and its address alignment must be 4. .Sh SEE ALSO -.Xr mdb 1 , -.Xr dtrace 1M , -.Xr libelf 3LIB , -.Xr gelf 3ELF , -.Xr a.out 4 +.Xr dtrace 1 , +.Xr elf 3 , +.Xr gelf 3 , +.Xr a.out 5 , +.Xr elf 5 Modified: head/cddl/lib/libctf/Makefile ============================================================================== --- head/cddl/lib/libctf/Makefile Mon Dec 8 04:06:03 2014 (r275591) +++ head/cddl/lib/libctf/Makefile Mon Dec 8 04:35:34 2014 (r275592) @@ -16,6 +16,7 @@ SRCS= ctf_create.c \ ctf_subr.c \ ctf_types.c \ ctf_util.c +MAN= ctf.5 WARNS?= 0 CFLAGS+= -DCTF_OLD_VERSIONS From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 04:44:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9BCC9FE9; Mon, 8 Dec 2014 04:44:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D3C41FC; Mon, 8 Dec 2014 04:44:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB84ifhQ053322; Mon, 8 Dec 2014 04:44:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB84ieRg053316; Mon, 8 Dec 2014 04:44:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201412080444.sB84ieRg053316@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Dec 2014 04:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275593 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 04:44:41 -0000 Author: markj Date: Mon Dec 8 04:44:40 2014 New Revision: 275593 URL: https://svnweb.freebsd.org/changeset/base/275593 Log: Add refcounting to IPv6 DAD objects and simplify the DAD code to fix a number of races which could cause double frees or use-after-frees when performing DAD on an address. In particular, an IPv6 address can now only be marked as a duplicate from the DAD callout. Differential Revision: https://reviews.freebsd.org/D1258 Reviewed by: ae, hrs Reported by: rstone MFC after: 1 month Modified: head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Dec 8 04:35:34 2014 (r275592) +++ head/sys/netinet6/nd6.c Mon Dec 8 04:44:40 2014 (r275593) @@ -153,6 +153,8 @@ nd6_init(void) callout_init(&V_nd6_slowtimo_ch, 0); callout_reset(&V_nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, nd6_slowtimo, curvnet); + + nd6_dad_init(); } #ifdef VIMAGE Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Mon Dec 8 04:35:34 2014 (r275592) +++ head/sys/netinet6/nd6.h Mon Dec 8 04:44:40 2014 (r275593) @@ -428,6 +428,7 @@ void nd6_ns_input(struct mbuf *, int, in void nd6_ns_output(struct ifnet *, const struct in6_addr *, const struct in6_addr *, struct llentry *, int); caddr_t nd6_ifptomac(struct ifnet *); +void nd6_dad_init(void); void nd6_dad_start(struct ifaddr *, int); void nd6_dad_stop(struct ifaddr *); Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Mon Dec 8 04:35:34 2014 (r275592) +++ head/sys/netinet6/nd6_nbr.c Mon Dec 8 04:44:40 2014 (r275593) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -81,6 +82,7 @@ struct dadq; static struct dadq *nd6_dad_find(struct ifaddr *); static void nd6_dad_add(struct dadq *dp); static void nd6_dad_del(struct dadq *dp); +static void nd6_dad_rele(struct dadq *); static void nd6_dad_starttimer(struct dadq *, int); static void nd6_dad_stoptimer(struct dadq *); static void nd6_dad_timer(struct dadq *); @@ -1167,6 +1169,7 @@ struct dadq { int dad_na_icount; struct callout dad_timer_ch; struct vnet *dad_vnet; + u_int dad_refcnt; }; static VNET_DEFINE(TAILQ_HEAD(, dadq), dadq); @@ -1174,9 +1177,6 @@ static VNET_DEFINE(struct rwlock, dad_rw #define V_dadq VNET(dadq) #define V_dad_rwlock VNET(dad_rwlock) -#define DADQ_LOCK_INIT() rw_init(&V_dad_rwlock, "nd6 DAD queue") -#define DADQ_LOCK_DESTROY() rw_destroy(&V_dad_rwlock) -#define DADQ_LOCK_INITIALIZED() rw_initialized(&V_dad_rwlock) #define DADQ_RLOCK() rw_rlock(&V_dad_rwlock) #define DADQ_RUNLOCK() rw_runlock(&V_dad_rwlock) #define DADQ_WLOCK() rw_wlock(&V_dad_rwlock) @@ -1186,9 +1186,8 @@ static void nd6_dad_add(struct dadq *dp) { - ifa_ref(dp->dad_ifa); /* just for safety */ DADQ_WLOCK(); - TAILQ_INSERT_TAIL(&V_dadq, (struct dadq *)dp, dad_list); + TAILQ_INSERT_TAIL(&V_dadq, dp, dad_list); DADQ_WUNLOCK(); } @@ -1196,10 +1195,10 @@ static void nd6_dad_del(struct dadq *dp) { - ifa_free(dp->dad_ifa); DADQ_WLOCK(); - TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); + TAILQ_REMOVE(&V_dadq, dp, dad_list); DADQ_WUNLOCK(); + nd6_dad_rele(dp); } static struct dadq * @@ -1209,8 +1208,10 @@ nd6_dad_find(struct ifaddr *ifa) DADQ_RLOCK(); TAILQ_FOREACH(dp, &V_dadq, dad_list) - if (dp->dad_ifa == ifa) + if (dp->dad_ifa == ifa) { + refcount_acquire(&dp->dad_refcnt); break; + } DADQ_RUNLOCK(); return (dp); @@ -1228,7 +1229,25 @@ static void nd6_dad_stoptimer(struct dadq *dp) { - callout_stop(&dp->dad_timer_ch); + callout_drain(&dp->dad_timer_ch); +} + +static void +nd6_dad_rele(struct dadq *dp) +{ + + if (refcount_release(&dp->dad_refcnt)) { + ifa_free(dp->dad_ifa); + free(dp, M_IP6NDP); + } +} + +void +nd6_dad_init(void) +{ + + rw_init(&V_dad_rwlock, "nd6 DAD queue"); + TAILQ_INIT(&V_dadq); } /* @@ -1241,11 +1260,6 @@ nd6_dad_start(struct ifaddr *ifa, int de struct dadq *dp; char ip6buf[INET6_ADDRSTRLEN]; - if (DADQ_LOCK_INITIALIZED() == 0) { - DADQ_LOCK_INIT(); - TAILQ_INIT(&V_dadq); - } - /* * If we don't need DAD, don't do it. * There are several cases: @@ -1275,12 +1289,13 @@ nd6_dad_start(struct ifaddr *ifa, int de } if (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_IFDISABLED) return; - if (nd6_dad_find(ifa) != NULL) { + if ((dp = nd6_dad_find(ifa)) != NULL) { /* DAD already in progress */ + nd6_dad_rele(dp); return; } - dp = malloc(sizeof(*dp), M_IP6NDP, M_NOWAIT); + dp = malloc(sizeof(*dp), M_IP6NDP, M_NOWAIT | M_ZERO); if (dp == NULL) { log(LOG_ERR, "nd6_dad_start: memory allocation failed for " "%s(%s)\n", @@ -1288,7 +1303,6 @@ nd6_dad_start(struct ifaddr *ifa, int de ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); return; } - bzero(dp, sizeof(*dp)); callout_init(&dp->dad_timer_ch, 0); #ifdef VIMAGE dp->dad_vnet = curvnet; @@ -1303,9 +1317,11 @@ nd6_dad_start(struct ifaddr *ifa, int de * (re)initialization. */ dp->dad_ifa = ifa; + ifa_ref(dp->dad_ifa); dp->dad_count = V_ip6_dad_count; dp->dad_ns_icount = dp->dad_na_icount = 0; dp->dad_ns_ocount = dp->dad_ns_tcount = 0; + refcount_init(&dp->dad_refcnt, 1); nd6_dad_add(dp); if (delay == 0) { nd6_dad_ns_output(dp, ifa); @@ -1324,8 +1340,6 @@ nd6_dad_stop(struct ifaddr *ifa) { struct dadq *dp; - if (DADQ_LOCK_INITIALIZED() == 0) - return; dp = nd6_dad_find(ifa); if (!dp) { /* DAD wasn't started yet */ @@ -1334,8 +1348,16 @@ nd6_dad_stop(struct ifaddr *ifa) nd6_dad_stoptimer(dp); + /* + * The DAD queue entry may have been removed by nd6_dad_timer() while + * we were waiting for it to stop, so re-do the lookup. + */ + nd6_dad_rele(dp); + if (nd6_dad_find(ifa) == NULL) + return; + nd6_dad_del(dp); - free(dp, M_IP6NDP); + nd6_dad_rele(dp); } static void @@ -1350,42 +1372,34 @@ nd6_dad_timer(struct dadq *dp) /* Sanity check */ if (ia == NULL) { log(LOG_ERR, "nd6_dad_timer: called with null parameter\n"); - goto done; + goto err; } if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) { /* Do not need DAD for ifdisabled interface. */ - TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); log(LOG_ERR, "nd6_dad_timer: cancel DAD on %s because of " "ND6_IFF_IFDISABLED.\n", ifp->if_xname); - free(dp, M_IP6NDP); - dp = NULL; - ifa_free(ifa); - goto done; + goto err; } if (ia->ia6_flags & IN6_IFF_DUPLICATED) { log(LOG_ERR, "nd6_dad_timer: called with duplicated address " "%s(%s)\n", ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr), ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); - goto done; + goto err; } if ((ia->ia6_flags & IN6_IFF_TENTATIVE) == 0) { log(LOG_ERR, "nd6_dad_timer: called with non-tentative address " "%s(%s)\n", ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr), ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); - goto done; + goto err; } /* timeouted with IFF_{RUNNING,UP} check */ if (dp->dad_ns_tcount > V_dad_maxtry) { nd6log((LOG_INFO, "%s: could not run DAD, driver problem?\n", if_name(ifa->ifa_ifp))); - - nd6_dad_del(dp); - free(dp, M_IP6NDP); - dp = NULL; - goto done; + goto err; } /* Need more checks? */ @@ -1396,33 +1410,16 @@ nd6_dad_timer(struct dadq *dp) nd6_dad_ns_output(dp, ifa); nd6_dad_starttimer(dp, (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); + goto done; } else { /* * We have transmitted sufficient number of DAD packets. * See what we've got. */ - int duplicate; - - duplicate = 0; - - if (dp->dad_na_icount) { - /* - * the check is in nd6_dad_na_input(), - * but just in case - */ - duplicate++; - } - - if (dp->dad_ns_icount) { - /* We've seen NS, means DAD has failed. */ - duplicate++; - } - - if (duplicate) { - /* (*dp) will be freed in nd6_dad_duplicated() */ + if (dp->dad_ns_icount > 0 || dp->dad_na_icount > 0) + /* We've seen NS or NA, means DAD has failed. */ nd6_dad_duplicated(ifa, dp); - dp = NULL; - } else { + else { /* * We are done with DAD. No NA came, no NS came. * No duplicate address found. Check IFDISABLED flag @@ -1436,18 +1433,15 @@ nd6_dad_timer(struct dadq *dp) "%s: DAD complete for %s - no duplicates found\n", if_name(ifa->ifa_ifp), ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr))); - - nd6_dad_del(dp); - free(dp, M_IP6NDP); - dp = NULL; } } - +err: + nd6_dad_del(dp); done: CURVNET_RESTORE(); } -void +static void nd6_dad_duplicated(struct ifaddr *ifa, struct dadq *dp) { struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; @@ -1462,9 +1456,6 @@ nd6_dad_duplicated(struct ifaddr *ifa, s ia->ia6_flags &= ~IN6_IFF_TENTATIVE; ia->ia6_flags |= IN6_IFF_DUPLICATED; - /* We are done with DAD, with duplicate address found. (failure) */ - nd6_dad_stoptimer(dp); - ifp = ifa->ifa_ifp; log(LOG_ERR, "%s: DAD complete for %s - duplicate found\n", if_name(ifp), ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr)); @@ -1505,9 +1496,6 @@ nd6_dad_duplicated(struct ifaddr *ifa, s break; } } - - nd6_dad_del(dp); - free(dp, M_IP6NDP); } static void @@ -1535,7 +1523,6 @@ nd6_dad_ns_input(struct ifaddr *ifa) struct ifnet *ifp; const struct in6_addr *taddr6; struct dadq *dp; - int duplicate; if (ifa == NULL) panic("ifa == NULL in nd6_dad_ns_input"); @@ -1543,8 +1530,9 @@ nd6_dad_ns_input(struct ifaddr *ifa) ia = (struct in6_ifaddr *)ifa; ifp = ifa->ifa_ifp; taddr6 = &ia->ia_addr.sin6_addr; - duplicate = 0; dp = nd6_dad_find(ifa); + if (dp == NULL) + return; /* Quickhack - completely ignore DAD NS packets */ if (V_dad_ignore_ns) { @@ -1556,26 +1544,10 @@ nd6_dad_ns_input(struct ifaddr *ifa) return; } - /* - * if I'm yet to start DAD, someone else started using this address - * first. I have a duplicate and you win. - */ - if (dp == NULL || dp->dad_ns_ocount == 0) - duplicate++; - /* XXX more checks for loopback situation - see nd6_dad_timer too */ - if (duplicate) { - nd6_dad_duplicated(ifa, dp); - dp = NULL; /* will be freed in nd6_dad_duplicated() */ - } else { - /* - * not sure if I got a duplicate. - * increment ns count and see what happens. - */ - if (dp) - dp->dad_ns_icount++; - } + dp->dad_ns_icount++; + nd6_dad_rele(dp); } static void @@ -1587,9 +1559,8 @@ nd6_dad_na_input(struct ifaddr *ifa) panic("ifa == NULL in nd6_dad_na_input"); dp = nd6_dad_find(ifa); - if (dp) + if (dp != NULL) { dp->dad_na_icount++; - - /* remove the address. */ - nd6_dad_duplicated(ifa, dp); + nd6_dad_rele(dp); + } } From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 06:04:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98992919; Mon, 8 Dec 2014 06:04:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79277B35; Mon, 8 Dec 2014 06:04:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB864hxi094783; Mon, 8 Dec 2014 06:04:43 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB864gPh094779; Mon, 8 Dec 2014 06:04:42 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412080604.sB864gPh094779@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 8 Dec 2014 06:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275594 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 06:04:43 -0000 Author: delphij Date: Mon Dec 8 06:04:42 2014 New Revision: 275594 URL: https://svnweb.freebsd.org/changeset/base/275594 Log: MFV r275540: When importing a pool, don't assume that the passed pool configuration at vdev_load is always vaild. It's possible that a stale configuration that comes with extra vdevs, where metaslab_init() would fail because of lower layer returns error. Change the code to make metaslab_init() handle and return errors from lower layer and pass it back to upper layer and handle it there. Illumos issue: 5213 panic in metaslab_init due to space_map_open returning ENXIO MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Mon Dec 8 04:44:40 2014 (r275593) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Mon Dec 8 06:04:42 2014 (r275594) @@ -1297,28 +1297,36 @@ metaslab_unload(metaslab_t *msp) msp->ms_weight &= ~METASLAB_ACTIVE_MASK; } -metaslab_t * -metaslab_init(metaslab_group_t *mg, uint64_t id, uint64_t object, uint64_t txg) +int +metaslab_init(metaslab_group_t *mg, uint64_t id, uint64_t object, uint64_t txg, + metaslab_t **msp) { vdev_t *vd = mg->mg_vd; objset_t *mos = vd->vdev_spa->spa_meta_objset; - metaslab_t *msp; + metaslab_t *ms; + int error; - msp = kmem_zalloc(sizeof (metaslab_t), KM_SLEEP); - mutex_init(&msp->ms_lock, NULL, MUTEX_DEFAULT, NULL); - cv_init(&msp->ms_load_cv, NULL, CV_DEFAULT, NULL); - msp->ms_id = id; - msp->ms_start = id << vd->vdev_ms_shift; - msp->ms_size = 1ULL << vd->vdev_ms_shift; + ms = kmem_zalloc(sizeof (metaslab_t), KM_SLEEP); + mutex_init(&ms->ms_lock, NULL, MUTEX_DEFAULT, NULL); + cv_init(&ms->ms_load_cv, NULL, CV_DEFAULT, NULL); + ms->ms_id = id; + ms->ms_start = id << vd->vdev_ms_shift; + ms->ms_size = 1ULL << vd->vdev_ms_shift; /* * We only open space map objects that already exist. All others * will be opened when we finally allocate an object for it. */ if (object != 0) { - VERIFY0(space_map_open(&msp->ms_sm, mos, object, msp->ms_start, - msp->ms_size, vd->vdev_ashift, &msp->ms_lock)); - ASSERT(msp->ms_sm != NULL); + error = space_map_open(&ms->ms_sm, mos, object, ms->ms_start, + ms->ms_size, vd->vdev_ashift, &ms->ms_lock); + + if (error != 0) { + kmem_free(ms, sizeof (metaslab_t)); + return (error); + } + + ASSERT(ms->ms_sm != NULL); } /* @@ -1328,11 +1336,11 @@ metaslab_init(metaslab_group_t *mg, uint * addition of new space; and for debugging, it ensures that we'd * data fault on any attempt to use this metaslab before it's ready. */ - msp->ms_tree = range_tree_create(&metaslab_rt_ops, msp, &msp->ms_lock); - metaslab_group_add(mg, msp); + ms->ms_tree = range_tree_create(&metaslab_rt_ops, ms, &ms->ms_lock); + metaslab_group_add(mg, ms); - msp->ms_fragmentation = metaslab_fragmentation(msp); - msp->ms_ops = mg->mg_class->mc_ops; + ms->ms_fragmentation = metaslab_fragmentation(ms); + ms->ms_ops = mg->mg_class->mc_ops; /* * If we're opening an existing pool (txg == 0) or creating @@ -1341,25 +1349,27 @@ metaslab_init(metaslab_group_t *mg, uint * does not become available until after this txg has synced. */ if (txg <= TXG_INITIAL) - metaslab_sync_done(msp, 0); + metaslab_sync_done(ms, 0); /* * If metaslab_debug_load is set and we're initializing a metaslab * that has an allocated space_map object then load the its space * map so that can verify frees. */ - if (metaslab_debug_load && msp->ms_sm != NULL) { - mutex_enter(&msp->ms_lock); - VERIFY0(metaslab_load(msp)); - mutex_exit(&msp->ms_lock); + if (metaslab_debug_load && ms->ms_sm != NULL) { + mutex_enter(&ms->ms_lock); + VERIFY0(metaslab_load(ms)); + mutex_exit(&ms->ms_lock); } if (txg != 0) { vdev_dirty(vd, 0, NULL, txg); - vdev_dirty(vd, VDD_METASLAB, msp, txg); + vdev_dirty(vd, VDD_METASLAB, ms, txg); } - return (msp); + *msp = ms; + + return (0); } void Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h Mon Dec 8 04:44:40 2014 (r275593) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h Mon Dec 8 06:04:42 2014 (r275594) @@ -42,8 +42,8 @@ typedef struct metaslab_ops { extern metaslab_ops_t *zfs_metaslab_ops; -metaslab_t *metaslab_init(metaslab_group_t *, uint64_t, - uint64_t, uint64_t); +int metaslab_init(metaslab_group_t *, uint64_t, uint64_t, uint64_t, + metaslab_t **); void metaslab_fini(metaslab_t *); void metaslab_load_wait(metaslab_t *); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Dec 8 04:44:40 2014 (r275593) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Dec 8 06:04:42 2014 (r275594) @@ -955,7 +955,11 @@ vdev_metaslab_init(vdev_t *vd, uint64_t if (error) return (error); } - vd->vdev_ms[m] = metaslab_init(vd->vdev_mg, m, object, txg); + + error = metaslab_init(vd->vdev_mg, m, object, txg, + &(vd->vdev_ms[m])); + if (error) + return (error); } if (txg == 0) From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 06:10:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 79F0AAF7; Mon, 8 Dec 2014 06:10:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6677CB7B; Mon, 8 Dec 2014 06:10:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB86Am8B096411; Mon, 8 Dec 2014 06:10:48 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB86AmPV096410; Mon, 8 Dec 2014 06:10:48 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412080610.sB86AmPV096410@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 8 Dec 2014 06:10:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275595 - head/cddl/compat/opensolaris/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 06:10:48 -0000 Author: delphij Date: Mon Dec 8 06:10:47 2014 New Revision: 275595 URL: https://svnweb.freebsd.org/changeset/base/275595 Log: Use calloc() instead of malloc() + bzero(). This also gets rid of a warning because bzero is defined by strings.h which is not included in thread_pool.c. MFC after: 2 weeks Modified: head/cddl/compat/opensolaris/misc/thread_pool.c Modified: head/cddl/compat/opensolaris/misc/thread_pool.c ============================================================================== --- head/cddl/compat/opensolaris/misc/thread_pool.c Mon Dec 8 06:04:42 2014 (r275594) +++ head/cddl/compat/opensolaris/misc/thread_pool.c Mon Dec 8 06:10:47 2014 (r275595) @@ -233,12 +233,11 @@ tpool_create(uint_t min_threads, uint_t return (NULL); } - tpool = malloc(sizeof (*tpool)); + tpool = calloc(1, sizeof (*tpool)); if (tpool == NULL) { errno = ENOMEM; return (NULL); } - bzero(tpool, sizeof(*tpool)); (void) pthread_mutex_init(&tpool->tp_mutex, NULL); (void) pthread_cond_init(&tpool->tp_busycv, NULL); (void) pthread_cond_init(&tpool->tp_workcv, NULL); @@ -267,9 +266,8 @@ tpool_dispatch(tpool_t *tpool, void (*fu { tpool_job_t *job; - if ((job = malloc(sizeof (*job))) == NULL) + if ((job = calloc(1, sizeof (*job))) == NULL) return (-1); - bzero(job, sizeof(*job)); job->tpj_next = NULL; job->tpj_func = func; job->tpj_arg = arg; From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 07:26:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1FF71BBE; Mon, 8 Dec 2014 07:26:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B94E648; Mon, 8 Dec 2014 07:26:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB87Q0FC034910; Mon, 8 Dec 2014 07:26:00 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB87Q0Yw034908; Mon, 8 Dec 2014 07:26:00 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201412080726.sB87Q0Yw034908@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Mon, 8 Dec 2014 07:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275599 - in head/sys/ofed/include: linux net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 07:26:01 -0000 Author: rodrigc Date: Mon Dec 8 07:25:59 2014 New Revision: 275599 URL: https://svnweb.freebsd.org/changeset/base/275599 Log: Use CURVNET macros inside inet_get_local_port_range() function. Without this fix, a kernel with VIMAGE + Infiniband will panic on bootup. Certain necessary #include statements require LIST_HEAD. Add these includes to ofed/include/linux/list.h, because LIST_HEAD is specifically overridden in this file. PR: 191468 Differential Revision: D1279 Reviewed by: hselasky Modified: head/sys/ofed/include/linux/list.h head/sys/ofed/include/net/ip.h Modified: head/sys/ofed/include/linux/list.h ============================================================================== --- head/sys/ofed/include/linux/list.h Mon Dec 8 07:14:25 2014 (r275598) +++ head/sys/ofed/include/linux/list.h Mon Dec 8 07:25:59 2014 (r275599) @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,7 @@ #include #include #include +#include #include #include Modified: head/sys/ofed/include/net/ip.h ============================================================================== --- head/sys/ofed/include/net/ip.h Mon Dec 8 07:14:25 2014 (r275598) +++ head/sys/ofed/include/net/ip.h Mon Dec 8 07:25:59 2014 (r275599) @@ -45,8 +45,10 @@ #ifdef INET static inline void inet_get_local_port_range(int *low, int *high) { + CURVNET_SET_QUIET(TD_TO_VNET(curthread)); *low = V_ipport_firstauto; *high = V_ipport_lastauto; + CURVNET_RESTORE(); } static inline void From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 08:36:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BE60DB4C; Mon, 8 Dec 2014 08:36:05 +0000 (UTC) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.fer.hr", Issuer "TERENA SSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 511D2D73; Mon, 8 Dec 2014 08:36:04 +0000 (UTC) Received: from x23 (161.53.63.210) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server (TLS) id 14.2.342.3; Mon, 8 Dec 2014 09:35:55 +0100 Date: Mon, 8 Dec 2014 09:36:06 +0100 From: Marko Zec To: Craig Rodrigues Subject: Re: svn commit: r275599 - in head/sys/ofed/include: linux net Message-ID: <20141208093606.0960142f@x23> In-Reply-To: <201412080726.sB87Q0Yw034908@svn.freebsd.org> References: <201412080726.sB87Q0Yw034908@svn.freebsd.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.22; amd64-portbld-freebsd10.0) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [161.53.63.210] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, hselasky@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 08:36:05 -0000 On Mon, 8 Dec 2014 07:26:00 +0000 Craig Rodrigues wrote: > Author: rodrigc > Date: Mon Dec 8 07:25:59 2014 > New Revision: 275599 > URL: https://svnweb.freebsd.org/changeset/base/275599 > > Log: > Use CURVNET macros inside inet_get_local_port_range() function. > Without this fix, a kernel with VIMAGE + Infiniband will panic on > bootup. Why is CURVNET_SET_QUIET() used here instead of plain CURVNET_SET()? inet_get_local_port_range() seems to be called from only two functions: cma_alloc_any_port() and cma_init(). Did the panic ocur in both, or only in cma_init()? If so, then CURVNET_SET() should have been placed only inside cma_init() and not in inet_get_local_port_range(). And perhaps all of this stuff could have been completely avoided if cma_init() was scheduled to fire with curvnet contex already set to vnet0, using proper SYSINIT scheduling instead of module_init(), i.e. after SI_SUB_VNET and before SI_SUB_VNET_DONE? Finally, the comment re. extra #includes and LIST_HEAD seems confusing since TD_TO_VNET() macro requires both sys/jail.h and net/vnet.h, and this dependency is unrelated to the LIST_HEAD macro cited in commit log. Marko > Certain necessary #include statements require LIST_HEAD. > Add these includes to ofed/include/linux/list.h, because > LIST_HEAD is specifically overridden in this file. > > PR: 191468 > Differential Revision: D1279 > Reviewed by: hselasky > > Modified: > head/sys/ofed/include/linux/list.h > head/sys/ofed/include/net/ip.h > > Modified: head/sys/ofed/include/linux/list.h > ============================================================================== > --- head/sys/ofed/include/linux/list.h Mon Dec 8 07:14:25 > 2014 (r275598) +++ head/sys/ofed/include/linux/list.h > Mon Dec 8 07:25:59 2014 (r275599) @@ -40,6 +40,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -53,6 +54,7 @@ > #include > #include > #include > +#include > > #include > #include > > Modified: head/sys/ofed/include/net/ip.h > ============================================================================== > --- head/sys/ofed/include/net/ip.h Mon Dec 8 07:14:25 > 2014 (r275598) +++ head/sys/ofed/include/net/ip.h Mon > Dec 8 07:25:59 2014 (r275599) @@ -45,8 +45,10 @@ > #ifdef INET > static inline void inet_get_local_port_range(int *low, int *high) > { > + CURVNET_SET_QUIET(TD_TO_VNET(curthread)); > *low = V_ipport_firstauto; > *high = V_ipport_lastauto; > + CURVNET_RESTORE(); > } > > static inline void > From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 09:09:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C39C4F6; Mon, 8 Dec 2014 09:09:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68E5510A; Mon, 8 Dec 2014 09:09:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB899pkT082526; Mon, 8 Dec 2014 09:09:51 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB899phe082525; Mon, 8 Dec 2014 09:09:51 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412080909.sB899phe082525@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 09:09:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275602 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 09:09:51 -0000 Author: ngie Date: Mon Dec 8 09:09:50 2014 New Revision: 275602 URL: https://svnweb.freebsd.org/changeset/base/275602 Log: Build gperf with xdev as part of _xb-bootstrap-tools This will unbreak the build when "env MK_CXX=no make delete-old" has been run on the build host post-r272849 Tested with the following commands: /bin/sh export __MAKE_CONF=/dev/null SRCCONF=/dev/null export MK_CLANG=no MK_CLANG_BOOTSTRAP=no MK_GCC=yes MK_GCC_BOOTSTRAP=yes export MK_GNUCXX=yes TARGET=armv6 TARGET_ARCH=arm make xdev make toolchain make xdev-build sudo -E make xdev-install /usr/armv6-freebsd/usr/bin/cc -dumpmachine | grep arm X-MFC with: r272849 Reported by: Dan Raymond , gjb Modified: head/Makefile.inc1 Directory Properties: head/ (props changed) Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Dec 8 07:43:02 2014 (r275601) +++ head/Makefile.inc1 Mon Dec 8 09:09:50 2014 (r275602) @@ -2039,7 +2039,8 @@ _xb-worldtmp: _xb-bootstrap-tools: .for _tool in \ - ${_clang_tblgen} + ${_clang_tblgen} \ + ${_gperf} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ cd ${.CURDIR}/${_tool} && \ ${CDMAKE} DIRPRFX=${_tool}/ obj && \ From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 09:14:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D53B5EF; Mon, 8 Dec 2014 09:14:48 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E33C2208; Mon, 8 Dec 2014 09:14:47 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C5CF11FE023; Mon, 8 Dec 2014 10:14:45 +0100 (CET) Message-ID: <54856C25.5090706@selasky.org> Date: Mon, 08 Dec 2014 10:15:17 +0100 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Marko Zec , Craig Rodrigues Subject: Re: svn commit: r275599 - in head/sys/ofed/include: linux net References: <201412080726.sB87Q0Yw034908@svn.freebsd.org> <20141208093606.0960142f@x23> In-Reply-To: <20141208093606.0960142f@x23> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 09:14:48 -0000 On 12/08/14 09:36, Marko Zec wrote: > Finally, the comment re. extra #includes and LIST_HEAD seems confusing > since TD_TO_VNET() macro requires both sys/jail.h and net/vnet.h, and > this dependency is unrelated to the LIST_HEAD macro cited in commit log. Regarding the headers, they must be in this indirect header file until further, due to some macro conflicts. --HPS From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 09:47:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6B142309; Mon, 8 Dec 2014 09:47:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 572C87EF; Mon, 8 Dec 2014 09:47:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB89lo6h003241; Mon, 8 Dec 2014 09:47:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB89loHl003240; Mon, 8 Dec 2014 09:47:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201412080947.sB89loHl003240@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 8 Dec 2014 09:47:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275603 - stable/10/sys/cam X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 09:47:50 -0000 Author: mav Date: Mon Dec 8 09:47:49 2014 New Revision: 275603 URL: https://svnweb.freebsd.org/changeset/base/275603 Log: MFC r275368: When passing LUN IDs through treat ASCII values as fixed-length, not interpreating NULLs as EOLs, but converting them to spaces. SPC-4 does not tell that T10-based IDs should be NULL-terminated/padded. And while it tells that it should include only ASCII chars (0x20-0x7F), there are some USB sticks (SanDisk Ultra Fit), that have NULLs inside the value. Treating NULLs as EOLs there made those LUN IDs non-unique. Modified: stable/10/sys/cam/cam_xpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_xpt.c ============================================================================== --- stable/10/sys/cam/cam_xpt.c Mon Dec 8 09:09:50 2014 (r275602) +++ stable/10/sys/cam/cam_xpt.c Mon Dec 8 09:47:49 2014 (r275603) @@ -1140,8 +1140,15 @@ xpt_getattr(char *buf, size_t len, const if (idd == NULL) goto out; ret = 0; - if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_ASCII || - (idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_UTF8) { + if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_ASCII) { + if (idd->length < len) { + for (l = 0; l < idd->length; l++) + buf[l] = idd->identifier[l] ? + idd->identifier[l] : ' '; + buf[l] = 0; + } else + ret = EFAULT; + } else if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_UTF8) { l = strnlen(idd->identifier, idd->length); if (l < len) { bcopy(idd->identifier, buf, l); From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 09:48:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3F6CC44E; Mon, 8 Dec 2014 09:48:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BD07800; Mon, 8 Dec 2014 09:48:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB89ml6G003471; Mon, 8 Dec 2014 09:48:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB89mlOW003470; Mon, 8 Dec 2014 09:48:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201412080948.sB89mlOW003470@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 8 Dec 2014 09:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275604 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 09:48:47 -0000 Author: mav Date: Mon Dec 8 09:48:46 2014 New Revision: 275604 URL: https://svnweb.freebsd.org/changeset/base/275604 Log: MFC r275368: When passing LUN IDs through treat ASCII values as fixed-length, not interpreating NULLs as EOLs, but converting them to spaces. SPC-4 does not tell that T10-based IDs should be NULL-terminated/padded. And while it tells that it should include only ASCII chars (0x20-0x7F), there are some USB sticks (SanDisk Ultra Fit), that have NULLs inside the value. Treating NULLs as EOLs there made those LUN IDs non-unique. Modified: stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Mon Dec 8 09:47:49 2014 (r275603) +++ stable/9/sys/cam/cam_xpt.c Mon Dec 8 09:48:46 2014 (r275604) @@ -1158,8 +1158,15 @@ xpt_getattr(char *buf, size_t len, const if (idd == NULL) goto out; ret = 0; - if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_ASCII || - (idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_UTF8) { + if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_ASCII) { + if (idd->length < len) { + for (l = 0; l < idd->length; l++) + buf[l] = idd->identifier[l] ? + idd->identifier[l] : ' '; + buf[l] = 0; + } else + ret = EFAULT; + } else if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_UTF8) { l = strnlen(idd->identifier, idd->length); if (l < len) { bcopy(idd->identifier, buf, l); From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 10:41:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F62B113; Mon, 8 Dec 2014 10:41:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60B6FE25; Mon, 8 Dec 2014 10:41:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8AfZf8028169; Mon, 8 Dec 2014 10:41:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8AfYOk028167; Mon, 8 Dec 2014 10:41:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201412081041.sB8AfYOk028167@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 8 Dec 2014 10:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275605 - in head/sys/dev/usb: . quirk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 10:41:35 -0000 Author: hselasky Date: Mon Dec 8 10:41:34 2014 New Revision: 275605 URL: https://svnweb.freebsd.org/changeset/base/275605 Log: Add more USB quirks for Western Digital external USB HDD enclosures. Rename an incorrectly named device. Increase limit for maximum number of quirks. PR: 178771, 180617 MFC after: 2 weeks Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Mon Dec 8 09:48:46 2014 (r275604) +++ head/sys/dev/usb/quirk/usb_quirk.c Mon Dec 8 10:41:34 2014 (r275605) @@ -59,7 +59,7 @@ MODULE_DEPEND(usb_quirk, usb, 1, 1, 1); MODULE_VERSION(usb_quirk, 1); -#define USB_DEV_QUIRKS_MAX 320 +#define USB_DEV_QUIRKS_MAX 384 #define USB_SUB_QUIRKS_MAX 8 struct usb_quirk_entry { @@ -438,8 +438,27 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(WESTERN, MYBOOK, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY_EVPD, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(WESTERN, MYPASSWORD, 0x0000, 0xffff, UQ_MSC_FORCE_SHORT_INQ), - USB_QUIRK(WESTERN, MYPASSPORT, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_00, 0x0000, 0xffff, UQ_MSC_FORCE_SHORT_INQ), + USB_QUIRK(WESTERN, MYPASSPORT_01, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_02, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_03, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_04, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_05, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_06, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_07, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_08, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_09, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORT_10, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_00, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_01, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_02, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_03, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_04, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_05, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_06, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_07, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_08, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(WESTERN, MYPASSPORTES_09, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(WINMAXGROUP, FLASH64MC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(YANO, FW800HD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Dec 8 09:48:46 2014 (r275604) +++ head/sys/dev/usb/usbdevs Mon Dec 8 10:41:34 2014 (r275605) @@ -4486,8 +4486,27 @@ product WESTERN COMBO 0x0200 Firewire U product WESTERN EXTHDD 0x0400 External HDD product WESTERN HUB 0x0500 USB HUB product WESTERN MYBOOK 0x0901 MyBook External HDD -product WESTERN MYPASSWORD 0x0704 MyPassword External HDD -product WESTERN MYPASSPORT 0x0748 MyPassport External HDD +product WESTERN MYPASSPORT_00 0x0704 MyPassport External HDD +product WESTERN MYPASSPORT_01 0x0746 MyPassport External HDD +product WESTERN MYPASSPORT_02 0x0748 MyPassport External HDD +product WESTERN MYPASSPORT_03 0x074A MyPassport External HDD +product WESTERN MYPASSPORT_04 0x074C MyPassport External HDD +product WESTERN MYPASSPORT_05 0x074E MyPassport External HDD +product WESTERN MYPASSPORT_06 0x07A6 MyPassport External HDD +product WESTERN MYPASSPORT_07 0x07A8 MyPassport External HDD +product WESTERN MYPASSPORT_08 0x07AA MyPassport External HDD +product WESTERN MYPASSPORT_09 0x07AC MyPassport External HDD +product WESTERN MYPASSPORT_10 0x07AE MyPassport External HDD +product WESTERN MYPASSPORTES_00 0x070A MyPassport Essential External HDD +product WESTERN MYPASSPORTES_01 0x071A MyPassport Essential External HDD +product WESTERN MYPASSPORTES_02 0x0730 MyPassport Essential External HDD +product WESTERN MYPASSPORTES_03 0x0732 MyPassport Essential External HDD +product WESTERN MYPASSPORTES_04 0x0740 MyPassport Essential External HDD +product WESTERN MYPASSPORTES_05 0x0742 MyPassport Essential External HDD +product WESTERN MYPASSPORTES_06 0x0750 MyPassport Essential External HDD +product WESTERN MYPASSPORTES_07 0x0752 MyPassport Essential External HDD +product WESTERN MYPASSPORTES_08 0x07A0 MyPassport Essential External HDD +product WESTERN MYPASSPORTES_09 0x07A2 MyPassport Essential External HDD /* WeTelecom products */ product WETELECOM WM_D200 0x6801 WM-D200 From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 10:49:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A479B470; Mon, 8 Dec 2014 10:49:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78AABE7E; Mon, 8 Dec 2014 10:49:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8AnOUL032244; Mon, 8 Dec 2014 10:49:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8AnO5b032242; Mon, 8 Dec 2014 10:49:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201412081049.sB8AnO5b032242@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 8 Dec 2014 10:49:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275606 - in head/sys/dev/usb: . serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 10:49:24 -0000 Author: hselasky Date: Mon Dec 8 10:49:23 2014 New Revision: 275606 URL: https://svnweb.freebsd.org/changeset/base/275606 Log: Add more U3G USB IDs. Submitted by: Benediktus Anindito MFC after: 1 week 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 Mon Dec 8 10:41:34 2014 (r275605) +++ head/sys/dev/usb/serial/u3g.c Mon Dec 8 10:49:23 2014 (r275606) @@ -400,7 +400,11 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(QUALCOMM2, VW110L, U3GINIT_SCSIEJECT), U3G_DEV(QUALCOMM2, GOBI2000_QDL, 0), U3G_DEV(QUALCOMM2, GOBI2000, 0), + U3G_DEV(QUALCOMM2, VT80N, 0), + U3G_DEV(QUALCOMM3, VFAST2, 0), U3G_DEV(QUALCOMMINC, AC2726, 0), + U3G_DEV(QUALCOMMINC, AC682_INIT, U3GINIT_SCSIEJECT), + U3G_DEV(QUALCOMMINC, AC682, 0), U3G_DEV(QUALCOMMINC, AC8700, 0), U3G_DEV(QUALCOMMINC, AC8710, 0), U3G_DEV(QUALCOMMINC, CDMA_MSM, U3GINIT_SCSIEJECT), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Dec 8 10:41:34 2014 (r275605) +++ head/sys/dev/usb/usbdevs Mon Dec 8 10:49:23 2014 (r275606) @@ -695,6 +695,7 @@ vendor QCOM 0x18e8 Qcom vendor ELV 0x18ef ELV vendor LINKSYS3 0x1915 Linksys vendor QUALCOMMINC 0x19d2 Qualcomm, Incorporated +vendor QUALCOMM3 0x19f5 Qualcomm, Inc. vendor BAYER 0x1a79 Bayer vendor WCH2 0x1a86 QinHeng Electronics vendor STELERA 0x1a8d Stelera Wireless @@ -3574,6 +3575,8 @@ product QUALCOMM2 VW110L 0x1000 Vertex W product QUALCOMM2 SIM5218 0x9000 SIM5218 product QUALCOMM2 GOBI2000_QDL 0x9204 Qualcomm Gobi 2000 QDL product QUALCOMM2 GOBI2000 0x9205 Qualcomm Gobi 2000 modem +product QUALCOMM2 VT80N 0x6500 Venus VT80N +product QUALCOMM3 VFAST2 0x9909 Venus Fast2 modem product QUALCOMMINC CDMA_MSM 0x0001 CDMA Technologies MSM modem product QUALCOMMINC E0002 0x0002 3G modem product QUALCOMMINC E0003 0x0003 3G modem @@ -3648,6 +3651,8 @@ product QUALCOMMINC MF195E 0x1516 MF195E product QUALCOMMINC ZTE_STOR 0x2000 USB ZTE Storage product QUALCOMMINC E2002 0x2002 3G modem product QUALCOMMINC E2003 0x2003 3G modem +product QUALCOMMINC AC682 0xffdd CDMA 1xEVDO USB modem +product QUALCOMMINC AC682_INIT 0xffde CDMA 1xEVDO USB modem (initial) product QUALCOMMINC AC8710 0xfff1 3G modem product QUALCOMMINC AC2726 0xfff5 3G modem product QUALCOMMINC AC8700 0xfffe CDMA 1xEVDO USB modem From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 11:28:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 70779FD9; Mon, 8 Dec 2014 11:28:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CB7933A; Mon, 8 Dec 2014 11:28:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8BS9Go051104; Mon, 8 Dec 2014 11:28:09 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8BS998051103; Mon, 8 Dec 2014 11:28:09 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201412081128.sB8BS998051103@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 8 Dec 2014 11:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275607 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 11:28:09 -0000 Author: trasz Date: Mon Dec 8 11:28:08 2014 New Revision: 275607 URL: https://svnweb.freebsd.org/changeset/base/275607 Log: MFC r274277: ctld(8) doesn't require -lcam or -lssl; remove those from DPADD and LDADD. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/Makefile ============================================================================== --- stable/10/usr.sbin/ctld/Makefile Mon Dec 8 10:49:23 2014 (r275606) +++ stable/10/usr.sbin/ctld/Makefile Mon Dec 8 11:28:08 2014 (r275607) @@ -10,8 +10,8 @@ CFLAGS+= -I${.CURDIR}/../../sys/dev/iscs #CFLAGS+= -DICL_KERNEL_PROXY MAN= ctld.8 ctl.conf.5 -DPADD= ${LIBBSDXML} ${LIBCAM} ${LIBCRYPTO} ${LIBL} ${LIBSBUF} ${LIBSSL} ${LIBUTIL} -LDADD= -lbsdxml -lcam -lcrypto -ll -lsbuf -lssl -lutil +DPADD= ${LIBBSDXML} ${LIBCRYPTO} ${LIBL} ${LIBSBUF} ${LIBUTIL} +LDADD= -lbsdxml -lcrypto -ll -lsbuf -lutil YFLAGS+= -v CLEANFILES= y.tab.c y.tab.h y.output From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 12:30:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D592C13; Mon, 8 Dec 2014 12:30:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08ECABFF; Mon, 8 Dec 2014 12:30:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8CUewY079974; Mon, 8 Dec 2014 12:30:40 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8CUe8t079973; Mon, 8 Dec 2014 12:30:40 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201412081230.sB8CUe8t079973@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 8 Dec 2014 12:30:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275608 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 12:30:41 -0000 Author: melifaro Date: Mon Dec 8 12:30:40 2014 New Revision: 275608 URL: https://svnweb.freebsd.org/changeset/base/275608 Log: Merge r267361: Improve logic besides net.bpf.optimize_writers. Direct bpf(4) consumers should now work fine with this tunable turned on. In fact, the only case when optimized_writers can change program behavior is direct bpf(4) consumer setting its read filter to catch-all one. Sponsored by: Yandex LLC Modified: stable/9/sys/net/bpf.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/bpf.c ============================================================================== --- stable/9/sys/net/bpf.c Mon Dec 8 11:28:08 2014 (r275607) +++ stable/9/sys/net/bpf.c Mon Dec 8 12:30:40 2014 (r275608) @@ -659,6 +659,67 @@ bpf_attachd(struct bpf_d *d, struct bpf_ } /* + * Check if we need to upgrade our descriptor @d from write-only mode. + */ +static int +bpf_check_upgrade(u_long cmd, struct bpf_d *d, struct bpf_insn *fcode, int flen) +{ + int is_snap, need_upgrade; + + /* + * Check if we've already upgraded or new filter is empty. + */ + if (d->bd_writer == 0 || fcode == NULL) + return (0); + + need_upgrade = 0; + + /* + * Check if cmd looks like snaplen setting from + * pcap_bpf.c:pcap_open_live(). + * Note we're not checking .k value here: + * while pcap_open_live() definitely sets to to non-zero value, + * we'd prefer to treat k=0 (deny ALL) case the same way: e.g. + * do not consider upgrading immediately + */ + if (cmd == BIOCSETF && flen == 1 && fcode[0].code == (BPF_RET | BPF_K)) + is_snap = 1; + else + is_snap = 0; + + if (is_snap == 0) { + /* + * We're setting first filter and it doesn't look like + * setting snaplen. We're probably using bpf directly. + * Upgrade immediately. + */ + need_upgrade = 1; + } else { + /* + * Do not require upgrade by first BIOCSETF + * (used to set snaplen) by pcap_open_live(). + */ + + if (--d->bd_writer == 0) { + /* + * First snaplen filter has already + * been set. This is probably catch-all + * filter + */ + need_upgrade = 1; + } + } + + CTR5(KTR_NET, + "%s: filter function set by pid %d, " + "bd_writer counter %d, snap %d upgrade %d", + __func__, d->bd_pid, d->bd_writer, + is_snap, need_upgrade); + + return (need_upgrade); +} + +/* * Add d to the list of active bp filters. * Reuqires bpf_attachd() to be called before */ @@ -1818,17 +1879,7 @@ bpf_setf(struct bpf_d *d, struct bpf_pro if (cmd == BIOCSETF) reset_d(d); - if (fcode != NULL) { - /* - * Do not require upgrade by first BIOCSETF - * (used to set snaplen) by pcap_open_live(). - */ - if (d->bd_writer != 0 && --d->bd_writer == 0) - need_upgrade = 1; - CTR4(KTR_NET, "%s: filter function set by pid %d, " - "bd_writer counter %d, need_upgrade %d", - __func__, d->bd_pid, d->bd_writer, need_upgrade); - } + need_upgrade = bpf_check_upgrade(cmd, d, fcode, flen); } BPFD_UNLOCK(d); if (d->bd_bif != NULL) @@ -1841,7 +1892,7 @@ bpf_setf(struct bpf_d *d, struct bpf_pro #endif /* Move d to active readers list. */ - if (need_upgrade) + if (need_upgrade != 0) bpf_upgraded(d); BPF_UNLOCK(); From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 13:01:38 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6DD7E2B8; Mon, 8 Dec 2014 13:01:38 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id CC3BFEDF; Mon, 8 Dec 2014 13:01:30 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA05577; Mon, 08 Dec 2014 15:03:22 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1XxxwN-0006VY-8H; Mon, 08 Dec 2014 15:01:27 +0200 Message-ID: <5485A0E9.2010807@FreeBSD.org> Date: Mon, 08 Dec 2014 15:00:25 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Xin LI , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org Subject: Re: svn commit: r275492 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs References: <201412050032.sB50WXki040350@svn.freebsd.org> In-Reply-To: <201412050032.sB50WXki040350@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 13:01:38 -0000 On 05/12/2014 02:32, Xin LI wrote: > Author: delphij > Date: Fri Dec 5 00:32:33 2014 > New Revision: 275492 > URL: https://svnweb.freebsd.org/changeset/base/275492 > > Log: > MFC r274172 (avg) > > fix l2arc compression buffers leak Thanks a lot! BTW, do you plan to MFC this commit to stable/9? It seems that r268075 and r268858 need MFC-ing to that branch as well. > We have observed that arc_release() can be called concurrently with a > l2arc in-flight write. > Also, we have observed that arc_hdr_destroy() can be called from > arc_write_done() for a zio with ZIO_FLAG_IO_REWRITE flag in similar > circumstances. > > Previously the l2arc headers would be freed while leaking their > associated compression buffers. Now the buffers are placed on > l2arc_free_on_write list for delayed freeing. This is similar to what > was already done to arc buffers that were supposed to be freed > concurrently with in-flight writes of those buffers. > > In addition to fixing the discovered leaks this change also adds some > protective code to assert that a compression buffer associated with a > l2arc header is never leaked. > > A new kstat l2_cdata_free_on_write is added. It keeps a count of > delayed compression buffer frees which previously would have been leaks. > > Tested by: Vitalij Satanivskij et al > Requested by: many > Sponsored by: HybridCluster / ClusterHQ > > This is a 10.1-RELEASE errata candidate. > > Modified: > stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c > Directory Properties: > stable/10/ (props changed) -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 13:06:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E11A439; Mon, 8 Dec 2014 13:06:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69809F0B; Mon, 8 Dec 2014 13:06:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8D6jNp097726; Mon, 8 Dec 2014 13:06:45 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8D6jab097725; Mon, 8 Dec 2014 13:06:45 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201412081306.sB8D6jab097725@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 8 Dec 2014 13:06:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275609 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 13:06:45 -0000 Author: avg Date: Mon Dec 8 13:06:44 2014 New Revision: 275609 URL: https://svnweb.freebsd.org/changeset/base/275609 Log: MFC r274628: l2arc: restore correct rounding up of asize of compressed data Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Dec 8 12:30:40 2014 (r275608) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Dec 8 13:06:44 2014 (r275609) @@ -5329,12 +5329,6 @@ l2arc_compress_buf(l2arc_buf_hdr_t *l2hd csize = zio_compress_data(ZIO_COMPRESS_LZ4, l2hdr->b_tmp_cdata, cdata, l2hdr->b_asize); - rounded = P2ROUNDUP(csize, (size_t)SPA_MINBLOCKSIZE); - if (rounded > csize) { - bzero((char *)cdata + csize, rounded - csize); - csize = rounded; - } - if (csize == 0) { /* zero block, indicate that there's nothing to write */ zio_data_buf_free(cdata, len); @@ -5343,11 +5337,19 @@ l2arc_compress_buf(l2arc_buf_hdr_t *l2hd l2hdr->b_tmp_cdata = NULL; ARCSTAT_BUMP(arcstat_l2_compress_zeros); return (B_TRUE); - } else if (csize > 0 && csize < len) { + } + + rounded = P2ROUNDUP(csize, + (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift); + if (rounded < len) { /* * Compression succeeded, we'll keep the cdata around for * writing and release it afterwards. */ + if (rounded > csize) { + bzero((char *)cdata + csize, rounded - csize); + csize = rounded; + } l2hdr->b_compress = ZIO_COMPRESS_LZ4; l2hdr->b_asize = csize; l2hdr->b_tmp_cdata = cdata; From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 13:13:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D604C6AE; Mon, 8 Dec 2014 13:13:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1E15FD9; Mon, 8 Dec 2014 13:13:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8DDIGx002221; Mon, 8 Dec 2014 13:13:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8DDIWA002218; Mon, 8 Dec 2014 13:13:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201412081313.sB8DDIWA002218@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 8 Dec 2014 13:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275610 - in stable/10: share/man/man9 sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 13:13:19 -0000 Author: avg Date: Mon Dec 8 13:13:17 2014 New Revision: 275610 URL: https://svnweb.freebsd.org/changeset/base/275610 Log: MFC r275045: callout(9): add sbt flavors of callout_schedule Not applicable to earlier releases. Modified: stable/10/share/man/man9/Makefile stable/10/share/man/man9/timeout.9 stable/10/sys/sys/callout.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/Makefile ============================================================================== --- stable/10/share/man/man9/Makefile Mon Dec 8 13:06:44 2014 (r275609) +++ stable/10/share/man/man9/Makefile Mon Dec 8 13:13:17 2014 (r275610) @@ -1385,10 +1385,14 @@ MLINKS+=timeout.9 callout.9 \ timeout.9 callout_init_rw.9 \ timeout.9 callout_pending.9 \ timeout.9 callout_reset.9 \ - timeout.9 callout_reset_sbt.9 \ timeout.9 callout_reset_on.9 \ + timeout.9 callout_reset_sbt.9 \ + timeout.9 callout_reset_sbt_curcpu.9 \ timeout.9 callout_reset_sbt_on.9 \ timeout.9 callout_schedule.9 \ + timeout.9 callout_schedule_sbt.9 \ + timeout.9 callout_schedule_sbt_curcpu.9 \ + timeout.9 callout_schedule_sbt_on.9 \ timeout.9 callout_stop.9 \ timeout.9 untimeout.9 MLINKS+=ucred.9 crcopy.9 \ Modified: stable/10/share/man/man9/timeout.9 ============================================================================== --- stable/10/share/man/man9/timeout.9 Mon Dec 8 13:06:44 2014 (r275609) +++ stable/10/share/man/man9/timeout.9 Mon Dec 8 13:13:17 2014 (r275610) @@ -51,6 +51,9 @@ .Nm callout_schedule , .Nm callout_schedule_curcpu , .Nm callout_schedule_on , +.Nm callout_schedule_sbt , +.Nm callout_schedule_sbt_curcpu , +.Nm callout_schedule_sbt_on , .Nm callout_stop , .Nm timeout , .Nm untimeout @@ -106,6 +109,15 @@ struct callout_handle handle = CALLOUT_H .Ft int .Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu" .Ft int +.Fn callout_schedule_sbt "struct callout *c" "sbintime_t sbt" \ +"sbintime_t pr" "int flags" +.Ft int +.Fn callout_schedule_sbt_curcpu "struct callout *c" "sbintime_t sbt" \ +"sbintime_t pr" "int flags" +.Ft int +.Fn callout_schedule_sbt_on "struct callout *c" "sbintime_t sbt" \ +"sbintime_t pr" "int cpu" "int flags" +.Ft int .Fn callout_stop "struct callout *c" .Ft struct callout_handle .Fn timeout "timeout_t *func" "void *arg" "int ticks" @@ -386,21 +398,24 @@ callouts are assigned to CPU 0. The .Fn callout_reset_on , .Fn callout_reset_sbt_on , -and .Fn callout_schedule_on +and +.Fn callout_schedule_sbt_on functions assign the callout to CPU .Fa cpu . The .Fn callout_reset_curcpu , .Fn callout_reset_sbt_curpu , -and .Fn callout_schedule_curcpu +and +.Fn callout_schedule_sbt_curcpu functions assign the callout to the current CPU. The .Fn callout_reset , .Fn callout_reset_sbt , -and .Fn callout_schedule +and +.Fn callout_schedule_sbt functions schedule the callout to execute in the softclock thread of the CPU to which it is currently assigned. .Pp Modified: stable/10/sys/sys/callout.h ============================================================================== --- stable/10/sys/sys/callout.h Mon Dec 8 13:06:44 2014 (r275609) +++ stable/10/sys/sys/callout.h Mon Dec 8 13:13:17 2014 (r275610) @@ -91,6 +91,13 @@ int callout_reset_sbt_on(struct callout callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu) #define callout_reset_curcpu(c, on_tick, fn, arg) \ callout_reset_on((c), (on_tick), (fn), (arg), PCPU_GET(cpuid)) +#define callout_schedule_sbt_on(c, sbt, pr, cpu, flags) \ + callout_reset_sbt_on((c), (sbt), (pr), (c)->c_func, (c)->c_arg, \ + (cpu), (flags)) +#define callout_schedule_sbt(c, sbt, pr, flags) \ + callout_schedule_sbt_on((c), (sbt), (pr), (c)->c_cpu, (flags)) +#define callout_schedule_sbt_curcpu(c, sbt, pr, flags) \ + callout_schedule_sbt_on((c), (sbt), (pr), PCPU_GET(cpuid), (flags)) int callout_schedule(struct callout *, int); int callout_schedule_on(struct callout *, int, int); #define callout_schedule_curcpu(c, on_tick) \ From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 13:19:30 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 54210982; Mon, 8 Dec 2014 13:19:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 408C37F; Mon, 8 Dec 2014 13:19:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8DJUU6003022; Mon, 8 Dec 2014 13:19:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8DJUVH003021; Mon, 8 Dec 2014 13:19:30 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201412081319.sB8DJUVH003021@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 8 Dec 2014 13:19:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275611 - stable/10/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 13:19:30 -0000 Author: avg Date: Mon Dec 8 13:19:29 2014 New Revision: 275611 URL: https://svnweb.freebsd.org/changeset/base/275611 Log: MFC r275046: whitespace and cosmetic changes in callout_reset family of macros Not applicable to earlier releases. Modified: stable/10/sys/sys/callout.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/callout.h ============================================================================== --- stable/10/sys/sys/callout.h Mon Dec 8 13:13:17 2014 (r275610) +++ stable/10/sys/sys/callout.h Mon Dec 8 13:19:29 2014 (r275611) @@ -81,11 +81,12 @@ void _callout_init_lock(struct callout * int callout_reset_sbt_on(struct callout *, sbintime_t, sbintime_t, void (*)(void *), void *, int, int); #define callout_reset_sbt(c, sbt, pr, fn, arg, flags) \ - callout_reset_sbt_on((c), (sbt), (pr), (fn), (arg), (c)->c_cpu, flags) + callout_reset_sbt_on((c), (sbt), (pr), (fn), (arg), (c)->c_cpu, (flags)) #define callout_reset_sbt_curcpu(c, sbt, pr, fn, arg, flags) \ - callout_reset_sbt_on((c), (sbt), (pr), (fn), (arg), PCPU_GET(cpuid), flags) + callout_reset_sbt_on((c), (sbt), (pr), (fn), (arg), PCPU_GET(cpuid),\ + (flags)) #define callout_reset_on(c, to_ticks, fn, arg, cpu) \ - callout_reset_sbt_on((c), (tick_sbt * (to_ticks)), 0, (fn), (arg), \ + callout_reset_sbt_on((c), tick_sbt * (to_ticks), 0, (fn), (arg), \ (cpu), C_HARDCLOCK) #define callout_reset(c, on_tick, fn, arg) \ callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu) From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 15:10:49 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C340F994; Mon, 8 Dec 2014 15:10:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFC95E48; Mon, 8 Dec 2014 15:10:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8FAnKC057815; Mon, 8 Dec 2014 15:10:49 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8FAn3Z057813; Mon, 8 Dec 2014 15:10:49 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201412081510.sB8FAn3Z057813@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 8 Dec 2014 15:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275612 - head/usr.bin/patch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 15:10:49 -0000 Author: pfg Date: Mon Dec 8 15:10:48 2014 New Revision: 275612 URL: https://svnweb.freebsd.org/changeset/base/275612 Log: patch(1): avoid line number overflows Introduce strtolinenum to properly check line numbers while parsing: no signs, no spaces, just digits, 0 <= x <= LONG_MAX Properly validate line ranges supplied in diff file to prevent overflows. Also fixes an out of boundary memory access because the resulting values are used as array indices. PR: 195436 Obtained from: OpenBSD (CVS pch.c rev 1.45, 1,46, common.h rev 1.28) MFC after: 1 week Modified: head/usr.bin/patch/common.h head/usr.bin/patch/pch.c Modified: head/usr.bin/patch/common.h ============================================================================== --- head/usr.bin/patch/common.h Mon Dec 8 13:19:29 2014 (r275611) +++ head/usr.bin/patch/common.h Mon Dec 8 15:10:48 2014 (r275612) @@ -40,6 +40,7 @@ #define INITHUNKMAX 125 /* initial dynamic allocation size */ #define INITLINELEN 4096 #define BUFFERSIZE 4096 +#define LINENUM_MAX LONG_MAX #define SCCSPREFIX "s." #define GET "get -e %s" Modified: head/usr.bin/patch/pch.c ============================================================================== --- head/usr.bin/patch/pch.c Mon Dec 8 13:19:29 2014 (r275611) +++ head/usr.bin/patch/pch.c Mon Dec 8 15:10:48 2014 (r275612) @@ -78,6 +78,7 @@ static size_t pgets(bool _do_indent); static char *best_name(const struct file_name *, bool); static char *posix_name(const struct file_name *, bool); static size_t num_components(const char *); +static LINENUM strtolinenum(char *, char **); /* * Prepare to look for the next patch in the patch file. @@ -354,7 +355,7 @@ intuit_diff_type(void) stars_this_line = strnEQ(s, "********", 8); if ((!diff_type || diff_type == CONTEXT_DIFF) && stars_last_line && strnEQ(s, "*** ", 4)) { - if (atol(s + 4) == 0) + if (strtolinenum(s + 4, &s) == 0) ok_to_create_file = true; /* * If this is a new context diff the character just @@ -593,22 +594,25 @@ another_hunk(void) malformed(); if (strnEQ(s, "0,0", 3)) memmove(s, s + 2, strlen(s + 2) + 1); - p_first = (LINENUM) atol(s); - while (isdigit((unsigned char)*s)) - s++; + p_first = strtolinenum(s, &s); if (*s == ',') { for (; *s && !isdigit((unsigned char)*s); s++) ; if (!*s) malformed(); - p_ptrn_lines = ((LINENUM) atol(s)) - p_first + 1; + p_ptrn_lines = strtolinenum(s, &s) - p_first + 1; + if (p_ptrn_lines < 0) + malformed(); } else if (p_first) p_ptrn_lines = 1; else { p_ptrn_lines = 0; p_first = 1; } + if (p_first >= LINENUM_MAX - p_ptrn_lines || + p_ptrn_lines >= LINENUM_MAX - 6) + malformed(); /* we need this much at least */ p_max = p_ptrn_lines + 6; @@ -661,22 +665,25 @@ another_hunk(void) ; if (!*s) malformed(); - p_newfirst = (LINENUM) atol(s); - while (isdigit((unsigned char)*s)) - s++; + p_newfirst = strtolinenum(s, &s); if (*s == ',') { for (; *s && !isdigit((unsigned char)*s); s++) ; if (!*s) malformed(); - p_repl_lines = ((LINENUM) atol(s)) - + p_repl_lines = strtolinenum(s, &s) - p_newfirst + 1; + if (p_repl_lines < 0) + malformed(); } else if (p_newfirst) p_repl_lines = 1; else { p_repl_lines = 0; p_newfirst = 1; } + if (p_newfirst >= LINENUM_MAX - p_repl_lines || + p_repl_lines >= LINENUM_MAX - p_end) + malformed(); p_max = p_repl_lines + p_end; if (p_max > MAXHUNKSIZE) fatal("hunk too large (%ld lines) at line %ld: %s", @@ -869,32 +876,28 @@ hunk_done: s = buf + 4; if (!*s) malformed(); - p_first = (LINENUM) atol(s); - while (isdigit((unsigned char)*s)) - s++; + p_first = strtolinenum(s, &s); if (*s == ',') { - p_ptrn_lines = (LINENUM) atol(++s); - while (isdigit((unsigned char)*s)) - s++; + p_ptrn_lines = strtolinenum(s + 1, &s); } else p_ptrn_lines = 1; if (*s == ' ') s++; if (*s != '+' || !*++s) malformed(); - p_newfirst = (LINENUM) atol(s); - while (isdigit((unsigned char)*s)) - s++; + p_newfirst = strtolinenum(s, &s); if (*s == ',') { - p_repl_lines = (LINENUM) atol(++s); - while (isdigit((unsigned char)*s)) - s++; + p_repl_lines = strtolinenum(s + 1, &s); } else p_repl_lines = 1; if (*s == ' ') s++; if (*s != '@') malformed(); + if (p_first >= LINENUM_MAX - p_ptrn_lines || + p_newfirst > LINENUM_MAX - p_repl_lines || + p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1) + malformed(); if (!p_ptrn_lines) p_first++; /* do append rather than insert */ p_max = p_ptrn_lines + p_repl_lines + 1; @@ -1034,35 +1037,36 @@ hunk_done: next_intuit_at(line_beginning, p_input_line); return false; } - p_first = (LINENUM) atol(buf); - for (s = buf; isdigit((unsigned char)*s); s++) - ; + p_first = strtolinenum(buf, &s); if (*s == ',') { - p_ptrn_lines = (LINENUM) atol(++s) - p_first + 1; - while (isdigit((unsigned char)*s)) - s++; + p_ptrn_lines = strtolinenum(s + 1, &s) - p_first + 1; + if (p_ptrn_lines < 0) + malformed(); } else p_ptrn_lines = (*s != 'a'); hunk_type = *s; if (hunk_type == 'a') p_first++; /* do append rather than insert */ - min = (LINENUM) atol(++s); - for (; isdigit((unsigned char)*s); s++) - ; + min = strtolinenum(s + 1, &s); if (*s == ',') - max = (LINENUM) atol(++s); + max = strtolinenum(s + 1, &s); else max = min; + if (min < 0 || min > max || max - min == LINENUM_MAX) + malformed(); if (hunk_type == 'd') min++; - p_end = p_ptrn_lines + 1 + max - min + 1; + p_newfirst = min; + p_repl_lines = max - min + 1; + if (p_newfirst > LINENUM_MAX - p_repl_lines || + p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1) + malformed(); + p_end = p_ptrn_lines + p_repl_lines + 1; if (p_end > MAXHUNKSIZE) fatal("hunk too large (%ld lines) at line %ld: %s", p_end, p_input_line, buf); while (p_end >= hunkmax) grow_hunkmax(); - p_newfirst = min; - p_repl_lines = max - min + 1; snprintf(buf, buf_size, "*** %ld,%ld\n", p_first, p_first + p_ptrn_lines - 1); p_line[0] = savestr(buf); @@ -1582,3 +1586,36 @@ num_components(const char *path) } return n; } + +/* + * Convert number at NPTR into LINENUM and save address of first + * character that is not a digit in ENDPTR. If conversion is not + * possible, call fatal. + */ +static LINENUM +strtolinenum(char *nptr, char **endptr) +{ + LINENUM rv; + char c; + char *p; + const char *errstr; + + for (p = nptr; isdigit((unsigned char)*p); p++) + ; + + if (p == nptr) + malformed(); + + c = *p; + *p = '\0'; + + rv = strtonum(nptr, 0, LINENUM_MAX, &errstr); + if (errstr != NULL) + fatal("invalid line number at line %ld: `%s' is %s\n", + p_input_line, nptr, errstr); + + *p = c; + *endptr = p; + + return rv; +} From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 15:45:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4EF752E6; Mon, 8 Dec 2014 15:45:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C7F02D7; Mon, 8 Dec 2014 15:45:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8Fj8pi075038; Mon, 8 Dec 2014 15:45:08 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8Fj82T075037; Mon, 8 Dec 2014 15:45:08 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201412081545.sB8Fj82T075037@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 8 Dec 2014 15:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275613 - head/release/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 15:45:08 -0000 Author: gjb Date: Mon Dec 8 15:45:07 2014 New Revision: 275613 URL: https://svnweb.freebsd.org/changeset/base/275613 Log: Adjust the 'Relnotes:' search to look for any non-empty string following the tag. Sponsored by: The FreeBSD Foundation Modified: head/release/scripts/relnotes-search.sh Modified: head/release/scripts/relnotes-search.sh ============================================================================== --- head/release/scripts/relnotes-search.sh Mon Dec 8 15:10:48 2014 (r275612) +++ head/release/scripts/relnotes-search.sh Mon Dec 8 15:45:07 2014 (r275613) @@ -125,7 +125,7 @@ main() { # All tests passed. Let's see what can possibly go wrong # from here. The search string specified should match this # in PCRE speak: ':[\t ]*' - ${svn} log ${rev} --search 'Relnotes:?[^ ]*' ${1} > ${where} + ${svn} log ${rev} --search 'Relnotes:*[A-Za-z0-9]*' ${1} > ${where} return $? } From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 15:47:53 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 21FC544B; Mon, 8 Dec 2014 15:47:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F4302EF; Mon, 8 Dec 2014 15:47:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8FlqwT075407; Mon, 8 Dec 2014 15:47:52 GMT (envelope-from kargl@FreeBSD.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8FlqsS075406; Mon, 8 Dec 2014 15:47:52 GMT (envelope-from kargl@FreeBSD.org) Message-Id: <201412081547.sB8FlqsS075406@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kargl set sender to kargl@FreeBSD.org using -f From: Steve Kargl Date: Mon, 8 Dec 2014 15:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275614 - head/lib/msun/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 15:47:53 -0000 Author: kargl Date: Mon Dec 8 15:47:52 2014 New Revision: 275614 URL: https://svnweb.freebsd.org/changeset/base/275614 Log: Adjust the |x| small limit from 0x1p-7 to 0x1p-9. This adjustment increases the number of correctly rounded cases within the interval on i386. Requested by: bde Modified: head/lib/msun/src/e_j0f.c Modified: head/lib/msun/src/e_j0f.c ============================================================================== --- head/lib/msun/src/e_j0f.c Mon Dec 8 15:45:07 2014 (r275613) +++ head/lib/msun/src/e_j0f.c Mon Dec 8 15:47:52 2014 (r275614) @@ -69,7 +69,7 @@ __ieee754_j0f(float x) } return z; } - if(ix<0x3c000000) { /* |x| < 2**-7 */ + if(ix<0x3b000000) { /* |x| < 2**-9 */ if(huge+x>one) { /* raise inexact if x != 0 */ if(ix<0x39800000) return one; /* |x|<2**-12 */ else return one - x*x/4; From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 16:02:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F25F703; Mon, 8 Dec 2014 16:02:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2334C6E1; Mon, 8 Dec 2014 16:02:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8G23ur085966; Mon, 8 Dec 2014 16:02:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8G22F4085965; Mon, 8 Dec 2014 16:02:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412081602.sB8G22F4085965@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 8 Dec 2014 16:02:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275615 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 16:02:03 -0000 Author: kib Date: Mon Dec 8 16:02:02 2014 New Revision: 275615 URL: https://svnweb.freebsd.org/changeset/base/275615 Log: When process is exiting, check for suspension regardless of multithreaded status of the process. The stopped state must be cleared before P_WEXIT is set. A stop signal delivered just before first PROC_LOCK() block in exit1(9) would put the process into pending stop with P_WEXIT set or assertion triggered. Also recheck for the suspension after failed thread_single(9) call, since process lock could be dropped. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Dec 8 15:47:52 2014 (r275614) +++ head/sys/kern/kern_exit.c Mon Dec 8 16:02:02 2014 (r275615) @@ -182,14 +182,15 @@ exit1(struct thread *td, int rv) * MUST abort all other threads before proceeding past here. */ PROC_LOCK(p); + /* + * First check if some other thread or external request got + * here before us. If so, act appropriately: exit or suspend. + * We must ensure that stop requests are handled before we set + * P_WEXIT. + */ + thread_suspend_check(0); while (p->p_flag & P_HADTHREADS) { /* - * First check if some other thread got here before us. - * If so, act appropriately: exit or suspend. - */ - thread_suspend_check(0); - - /* * Kill off the other threads. This requires * some co-operation from other parts of the kernel * so it may not be instantaneous. With this state set @@ -207,12 +208,18 @@ exit1(struct thread *td, int rv) * either be suspended there or exit. */ if (!thread_single(SINGLE_EXIT)) + /* + * All other activity in this process is now + * stopped. Threading support has been turned + * off. + */ break; - /* - * All other activity in this process is now stopped. - * Threading support has been turned off. + * Recheck for new stop or suspend requests which + * might appear while process lock was dropped in + * thread_single(). */ + thread_suspend_check(0); } KASSERT(p->p_numthreads == 1, ("exit1: proc %p exiting with %d threads", p, p->p_numthreads)); From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 16:18:06 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 82470614; Mon, 8 Dec 2014 16:18:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EE5B92D; Mon, 8 Dec 2014 16:18:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8GI60U093013; Mon, 8 Dec 2014 16:18:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8GI5l3093010; Mon, 8 Dec 2014 16:18:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412081618.sB8GI5l3093010@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 8 Dec 2014 16:18:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275616 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 16:18:06 -0000 Author: kib Date: Mon Dec 8 16:18:05 2014 New Revision: 275616 URL: https://svnweb.freebsd.org/changeset/base/275616 Log: Thread waiting for the vfork(2)-ed child to exec or exit, must allow for the suspension. Currently, the loop performs uninterruptible cv_wait(9) call, which prevents suspension until child allows further execution of parent. If child is stopped, suspension or single-threading is delayed indefinitely. Create a helper thread_suspend_check_needed() to identify the need for a call to thread_suspend_check(). It is required since call to the thread_suspend_check() cannot be safely done while owning the child (p2) process lock. Only when suspension is needed, drop p2 lock and call thread_suspend_check(). Perform wait for cv with timeout, in case suspend is requested after wait started; I do not see a better way to interrupt the wait. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_thread.c head/sys/kern/subr_syscall.c head/sys/sys/proc.h Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Mon Dec 8 16:02:02 2014 (r275615) +++ head/sys/kern/kern_thread.c Mon Dec 8 16:18:05 2014 (r275616) @@ -725,6 +725,19 @@ stopme: return (0); } +bool +thread_suspend_check_needed(void) +{ + struct proc *p; + struct thread *td; + + td = curthread; + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + return (P_SHOULDSTOP(p) || ((p->p_flag & P_TRACED) != 0 && + (td->td_dbgflags & TDB_SUSPEND) != 0)); +} + /* * Called in from locations that can safely check to see * whether we have to suspend or at least throttle for a @@ -769,8 +782,7 @@ thread_suspend_check(int return_instead) p = td->td_proc; mtx_assert(&Giant, MA_NOTOWNED); PROC_LOCK_ASSERT(p, MA_OWNED); - while (P_SHOULDSTOP(p) || - ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) { + while (thread_suspend_check_needed()) { if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { KASSERT(p->p_singlethread != NULL, ("singlethread not set")); Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Mon Dec 8 16:02:02 2014 (r275615) +++ head/sys/kern/subr_syscall.c Mon Dec 8 16:18:05 2014 (r275616) @@ -226,9 +226,20 @@ syscallret(struct thread *td, int error, */ td->td_pflags &= ~TDP_RFPPWAIT; p2 = td->td_rfppwait_p; +again: PROC_LOCK(p2); - while (p2->p_flag & P_PPWAIT) - cv_wait(&p2->p_pwait, &p2->p_mtx); + while (p2->p_flag & P_PPWAIT) { + PROC_LOCK(p); + if (thread_suspend_check_needed()) { + PROC_UNLOCK(p2); + thread_suspend_check(0); + PROC_UNLOCK(p); + goto again; + } else { + PROC_UNLOCK(p); + } + cv_timedwait(&p2->p_pwait, &p2->p_mtx, hz); + } PROC_UNLOCK(p2); } } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Dec 8 16:02:02 2014 (r275615) +++ head/sys/sys/proc.h Mon Dec 8 16:18:05 2014 (r275616) @@ -970,6 +970,7 @@ void childproc_stopped(struct proc *chil void childproc_continued(struct proc *child); void childproc_exited(struct proc *child); int thread_suspend_check(int how); +bool thread_suspend_check_needed(void); void thread_suspend_switch(struct thread *); void thread_suspend_one(struct thread *td); void thread_unlink(struct thread *td); From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 16:27:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F63FAB9; Mon, 8 Dec 2014 16:27:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 705F8A2E; Mon, 8 Dec 2014 16:27:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8GRi7o097858; Mon, 8 Dec 2014 16:27:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8GRicv097857; Mon, 8 Dec 2014 16:27:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412081627.sB8GRicv097857@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 8 Dec 2014 16:27:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275617 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 16:27:44 -0000 Author: kib Date: Mon Dec 8 16:27:43 2014 New Revision: 275617 URL: https://svnweb.freebsd.org/changeset/base/275617 Log: Do some refactoring and minor cleanups of the thread_single() code in preparation for the global stop commit. Move the code to weed suspended or sleeping threads into the appropriate state, into the helper weed_inhib(). Current code already has deep nesting and hard to follow [1]. Add currently useless helper remain_for_mode(), which returns the count of threads which are allowed to run, according to the single-threading mode. In thread_single_end(), do not save curthread into local variable, it is unused after, except to find curproc. Remove stray empty line. Requested by: avg [1] Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Mon Dec 8 16:18:05 2014 (r275616) +++ head/sys/kern/kern_thread.c Mon Dec 8 16:27:43 2014 (r275617) @@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$"); SDT_PROVIDER_DECLARE(proc); SDT_PROBE_DEFINE(proc, , , lwp__exit); - /* * thread related storage. */ @@ -584,6 +583,46 @@ calc_remaining(struct proc *p, int mode) return (remaining); } +static int +remain_for_mode(int mode) +{ + + return (1); +} + +static int +weed_inhib(int mode, struct thread *td2, struct proc *p) +{ + int wakeup_swapper; + + PROC_LOCK_ASSERT(p, MA_OWNED); + PROC_SLOCK_ASSERT(p, MA_OWNED); + THREAD_LOCK_ASSERT(td2, MA_OWNED); + + wakeup_swapper = 0; + switch (mode) { + case SINGLE_EXIT: + if (TD_IS_SUSPENDED(td2)) + wakeup_swapper |= thread_unsuspend_one(td2); + if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) + wakeup_swapper |= sleepq_abort(td2, EINTR); + break; + case SINGLE_BOUNDARY: + if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) + wakeup_swapper |= thread_unsuspend_one(td2); + if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) + wakeup_swapper |= sleepq_abort(td2, ERESTART); + break; + case SINGLE_NO_EXIT: + if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) + wakeup_swapper |= thread_unsuspend_one(td2); + if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) + wakeup_swapper |= sleepq_abort(td2, ERESTART); + break; + } + return (wakeup_swapper); +} + /* * Enforce single-threading. * @@ -631,7 +670,7 @@ thread_single(int mode) PROC_SLOCK(p); p->p_singlethread = td; remaining = calc_remaining(p, mode); - while (remaining != 1) { + while (remaining != remain_for_mode(mode)) { if (P_SHOULDSTOP(p) != P_STOPPED_SINGLE) goto stopme; wakeup_swapper = 0; @@ -640,41 +679,8 @@ thread_single(int mode) continue; thread_lock(td2); td2->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; - if (TD_IS_INHIBITED(td2)) { - switch (mode) { - case SINGLE_EXIT: - if (TD_IS_SUSPENDED(td2)) - wakeup_swapper |= - thread_unsuspend_one(td2); - if (TD_ON_SLEEPQ(td2) && - (td2->td_flags & TDF_SINTR)) - wakeup_swapper |= - sleepq_abort(td2, EINTR); - break; - case SINGLE_BOUNDARY: - if (TD_IS_SUSPENDED(td2) && - !(td2->td_flags & TDF_BOUNDARY)) - wakeup_swapper |= - thread_unsuspend_one(td2); - if (TD_ON_SLEEPQ(td2) && - (td2->td_flags & TDF_SINTR)) - wakeup_swapper |= - sleepq_abort(td2, ERESTART); - break; - case SINGLE_NO_EXIT: - if (TD_IS_SUSPENDED(td2) && - !(td2->td_flags & TDF_BOUNDARY)) - wakeup_swapper |= - thread_unsuspend_one(td2); - if (TD_ON_SLEEPQ(td2) && - (td2->td_flags & TDF_SINTR)) - wakeup_swapper |= - sleepq_abort(td2, ERESTART); - break; - default: - break; - } - } + if (TD_IS_INHIBITED(td2)) + wakeup_swapper |= weed_inhib(mode, td2, p); #ifdef SMP else if (TD_IS_RUNNING(td2) && td != td2) { forward_signal(td2); @@ -689,7 +695,7 @@ thread_single(int mode) /* * Maybe we suspended some threads.. was it enough? */ - if (remaining == 1) + if (remaining == remain_for_mode(mode)) break; stopme: @@ -968,8 +974,7 @@ thread_single_end(void) struct proc *p; int wakeup_swapper; - td = curthread; - p = td->td_proc; + p = curproc; PROC_LOCK_ASSERT(p, MA_OWNED); p->p_flag &= ~(P_STOPPED_SINGLE | P_SINGLE_EXIT | P_SINGLE_BOUNDARY); PROC_SLOCK(p); @@ -981,7 +986,8 @@ thread_single_end(void) * on the process. The single threader must be allowed * to continue however as this is a bad place to stop. */ - if ((p->p_numthreads != 1) && (!P_SHOULDSTOP(p))) { + if (p->p_numthreads != remain_for_mode(SINGLE_EXIT) && + !P_SHOULDSTOP(p)) { FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); if (TD_IS_SUSPENDED(td)) { From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 16:33:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 34339C9F; Mon, 8 Dec 2014 16:33:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2136BB0B; Mon, 8 Dec 2014 16:33:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8GXIKK002212; Mon, 8 Dec 2014 16:33:18 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8GXIwl002211; Mon, 8 Dec 2014 16:33:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412081633.sB8GXIwl002211@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 8 Dec 2014 16:33:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275618 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 16:33:19 -0000 Author: kib Date: Mon Dec 8 16:33:18 2014 New Revision: 275618 URL: https://svnweb.freebsd.org/changeset/base/275618 Log: Current reaction of the nfsd worker threads to any signal is exit. This is not correct at least for the stop requests. Check for stop conditions and suspend threads if requested. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/rpc/svc.c Modified: head/sys/rpc/svc.c ============================================================================== --- head/sys/rpc/svc.c Mon Dec 8 16:27:43 2014 (r275617) +++ head/sys/rpc/svc.c Mon Dec 8 16:33:18 2014 (r275618) @@ -1101,6 +1101,7 @@ svc_run_internal(SVCGROUP *grp, bool_t i SVCXPRT *xprt; enum xprt_stat stat; struct svc_req *rqstp; + struct proc *p; size_t sz; int error; @@ -1183,11 +1184,22 @@ svc_run_internal(SVCGROUP *grp, bool_t i > grp->sg_minthreads) && !st->st_xprt) break; - } else if (error) { + } else if (error != 0) { + KASSERT(error == EINTR || error == ERESTART, + ("non-signal error %d", error)); mtx_unlock(&grp->sg_lock); - svc_exit(pool); - mtx_lock(&grp->sg_lock); - break; + p = curproc; + PROC_LOCK(p); + if (P_SHOULDSTOP(p)) { + thread_suspend_check(0); + PROC_UNLOCK(p); + mtx_lock(&grp->sg_lock); + } else { + PROC_UNLOCK(p); + svc_exit(pool); + mtx_lock(&grp->sg_lock); + break; + } } continue; } From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 16:42:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C74C6ECD; Mon, 8 Dec 2014 16:42:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A328C03; Mon, 8 Dec 2014 16:42:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8GgZhX006862; Mon, 8 Dec 2014 16:42:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8GgZbm006861; Mon, 8 Dec 2014 16:42:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412081642.sB8GgZbm006861@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 8 Dec 2014 16:42:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275619 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 16:42:35 -0000 Author: kib Date: Mon Dec 8 16:42:34 2014 New Revision: 275619 URL: https://svnweb.freebsd.org/changeset/base/275619 Log: When getnewbuf_reuse_bp() is called to reclaim some (clean) buffer, the vnode owning the buffer is not locked. More, it cannot be locked safely, since getnewbuf_reuse_bp() is called from newbuf(), and some other vnode is already locked, for which reused buffer will be reassigned. As the consequence, reclamation of the owning vnode could go in parallel, in particular, the call to vnode_destroy_vobject(), which deallocates the vm object and zeroes the v_bufobj->bo_object. Note that the pages wired by the buffer are left wired and can be safely freed by the vfs_vmio_release() without the need for the vm object lock. Also, seeing stale pointer to the v_object is safe due to vm object type stability. Check for bo_bufobj != NULL and cache the value in local variable to avoid trying to lock NULL vm object. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon Dec 8 16:33:18 2014 (r275618) +++ head/sys/kern/vfs_bio.c Mon Dec 8 16:42:34 2014 (r275619) @@ -1883,15 +1883,18 @@ out: static void vfs_vmio_release(struct buf *bp) { - int i; + vm_object_t obj; vm_page_t m; + int i; if ((bp->b_flags & B_UNMAPPED) == 0) { BUF_CHECK_MAPPED(bp); pmap_qremove(trunc_page((vm_offset_t)bp->b_data), bp->b_npages); } else BUF_CHECK_UNMAPPED(bp); - VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); + obj = bp->b_bufobj->bo_object; + if (obj != NULL) + VM_OBJECT_WLOCK(obj); for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; bp->b_pages[i] = NULL; @@ -1916,7 +1919,8 @@ vfs_vmio_release(struct buf *bp) vm_page_try_to_cache(m); vm_page_unlock(m); } - VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); + if (obj != NULL) + VM_OBJECT_WUNLOCK(obj); if (bp->b_bufsize) { bufspacewakeup(); From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 16:48:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE9D815B; Mon, 8 Dec 2014 16:48:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1177C58; Mon, 8 Dec 2014 16:48:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8GmwUF019054; Mon, 8 Dec 2014 16:48:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8GmwCB019038; Mon, 8 Dec 2014 16:48:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412081648.sB8GmwCB019038@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 8 Dec 2014 16:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275620 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 16:48:58 -0000 Author: kib Date: Mon Dec 8 16:48:57 2014 New Revision: 275620 URL: https://svnweb.freebsd.org/changeset/base/275620 Log: Add functions syncer_suspend() and syncer_resume(), which are supposed to be called before suspension and after resume, correspondingly. The syncer_suspend() ensures that all filesystems dirty data and metadata are saved to the permanent storage, and stops kernel threads which might modify filesystems. The syncer_resume() restores stopped threads. For now, only syncer is stopped. This is needed, because each sync loop causes superblock updates for UFS. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_subr.c head/sys/sys/mount.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Dec 8 16:42:34 2014 (r275619) +++ head/sys/kern/vfs_subr.c Mon Dec 8 16:48:57 2014 (r275620) @@ -1773,6 +1773,8 @@ sync_vnode(struct synclist *slp, struct return (0); } +static int first_printf = 1; + /* * System filesystem synchronizer daemon. */ @@ -1791,7 +1793,6 @@ sched_sync(void) last_work_seen = 0; syncer_final_iter = 0; - first_printf = 1; syncer_state = SYNCER_RUNNING; starttime = time_uptime; td->td_pflags |= TDP_NORUNNINGBUF; @@ -1955,6 +1956,25 @@ syncer_shutdown(void *arg, int howto) kproc_shutdown(arg, howto); } +void +syncer_suspend(void) +{ + + syncer_shutdown(updateproc, 0); +} + +void +syncer_resume(void) +{ + + mtx_lock(&sync_mtx); + first_printf = 1; + syncer_state = SYNCER_RUNNING; + mtx_unlock(&sync_mtx); + cv_broadcast(&sync_wakeup); + kproc_resume(updateproc); +} + /* * Reassign a buffer from one vnode to another. * Used to assign file specific control information Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Dec 8 16:42:34 2014 (r275619) +++ head/sys/sys/mount.h Mon Dec 8 16:48:57 2014 (r275620) @@ -917,6 +917,9 @@ vfs_uninit_t vfs_stduninit; vfs_extattrctl_t vfs_stdextattrctl; vfs_sysctl_t vfs_stdsysctl; +void syncer_suspend(void); +void syncer_resume(void); + #else /* !_KERNEL */ #include From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 17:14:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9D851D73; Mon, 8 Dec 2014 17:14:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A55B74; Mon, 8 Dec 2014 17:14:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8HE2Nj033281; Mon, 8 Dec 2014 17:14:02 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8HE2oZ033280; Mon, 8 Dec 2014 17:14:02 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201412081714.sB8HE2oZ033280@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Mon, 8 Dec 2014 17:14:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275621 - head/tools/bsdbox X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 17:14:02 -0000 Author: sbruno Date: Mon Dec 8 17:14:01 2014 New Revision: 275621 URL: https://svnweb.freebsd.org/changeset/base/275621 Log: Add -lxo (for df) and -lgpio(for gpioctl) to bsdbox. This will allow the picostation build to work again. Reviewed by: adrian Modified: head/tools/bsdbox/Makefile Modified: head/tools/bsdbox/Makefile ============================================================================== --- head/tools/bsdbox/Makefile Mon Dec 8 16:48:57 2014 (r275620) +++ head/tools/bsdbox/Makefile Mon Dec 8 17:14:01 2014 (r275621) @@ -55,7 +55,7 @@ CRUNCH_SRCDIRS+= bin # setuid binaries - they use these libraries. PAM needs to be # built dynamically or it tries to build _all_ of the modules # statically - and that ends very badly. -CRUNCH_SHLIBS+= -lc -lutil -lcrypt +CRUNCH_SHLIBS+= -lc -lutil -lcrypt -lxo -lgpio CRUNCH_LIBS+= -lkvm -lmemstat -lnetgraph CRUNCH_LIBS+= -lcrypt -ledit -ll -ltermcapw From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 18:29:21 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6890BC9E; Mon, 8 Dec 2014 18:29:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55A66CE1; Mon, 8 Dec 2014 18:29:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8ITL1l067322; Mon, 8 Dec 2014 18:29:21 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8ITLtP067321; Mon, 8 Dec 2014 18:29:21 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412081829.sB8ITLtP067321@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 18:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275622 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 18:29:21 -0000 Author: ngie Date: Mon Dec 8 18:29:20 2014 New Revision: 275622 URL: https://svnweb.freebsd.org/changeset/base/275622 Log: Add makewhatis to ITOOLS if MK_MAN != no This will fix installation with differing host targets in installworld, so one can build i386/i386 on an amd64 host, then install to an i386/i386 target Reported by: alfred Phabric: D1280 MFC after: 1 week Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Dec 8 17:14:01 2014 (r275621) +++ head/Makefile.inc1 Mon Dec 8 18:29:20 2014 (r275622) @@ -791,6 +791,11 @@ ITOOLS= [ awk cap_mkdb cat chflags chmod rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} \ ${LOCAL_ITOOLS} +# Needed for share/man +.if ${MK_MAN} != "no" +ITOOLS+=makewhatis +.endif + # # distributeworld # From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 21:14:14 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 46DB35DA; Mon, 8 Dec 2014 21:14:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33083BA; Mon, 8 Dec 2014 21:14:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8LEENA054909; Mon, 8 Dec 2014 21:14:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8LEEwR054908; Mon, 8 Dec 2014 21:14:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201412082114.sB8LEEwR054908@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 8 Dec 2014 21:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275624 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 21:14:14 -0000 Author: hselasky Date: Mon Dec 8 21:14:13 2014 New Revision: 275624 URL: https://svnweb.freebsd.org/changeset/base/275624 Log: Add port routing support for Wildcat Point. PR: 195793 MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Mon Dec 8 19:56:34 2014 (r275623) +++ head/sys/dev/usb/controller/xhci_pci.c Mon Dec 8 21:14:13 2014 (r275624) @@ -252,6 +252,7 @@ xhci_pci_attach(device_t self) case 0x9c318086: /* Panther Point */ case 0x1e318086: /* Panther Point */ case 0x8c318086: /* Lynx Point */ + case 0x8cb18086: /* Wildcat Point */ sc->sc_port_route = &xhci_pci_port_route; sc->sc_imod_default = XHCI_IMOD_DEFAULT_LP; break; From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 22:19:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E6D2EE0; Mon, 8 Dec 2014 22:19:44 +0000 (UTC) Received: from mail-lb0-x236.google.com (mail-lb0-x236.google.com [IPv6:2a00:1450:4010:c04::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F00FB99D; Mon, 8 Dec 2014 22:19:43 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id f15so4935780lbj.27 for ; Mon, 08 Dec 2014 14:19:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=qlWZMncWCfcp+Wh3ACKLcKSpfCVpnIujQegfUwKlCvs=; b=y+6F56bUYMxKHjHCPDyuxhorWupwiWbEYRjriBy9IndAz5Nes6t/yru+eCufd3fe4f An+TByY2d8eyqumwnLwuCHcWlL76OKHtxedyZ44/uqd/8xAhqwf/eY47tNbl9iuLOyEF dg97QDCrDqfD/V+YuM9B8Q7In7Qm1KSB/yMgCi6cTbpZR6ZjLteiByNcFZ4E/ATOX4pS oXls758KO4CI/l0mdSb2Cs6LRhGDjmGCaXuwKHl9mSsxwLaAe4SRYkqyouOZcX6T8ayy KTYNJvlka2b36mZJNFwAlwjJr7jzT8S39No3pXi7M1JJJ+I5fFwxrwZZJfDdRB4wm96K /GSA== MIME-Version: 1.0 X-Received: by 10.112.12.65 with SMTP id w1mr3066345lbb.68.1418077181941; Mon, 08 Dec 2014 14:19:41 -0800 (PST) Sender: crodr001@gmail.com Received: by 10.112.130.168 with HTTP; Mon, 8 Dec 2014 14:19:41 -0800 (PST) In-Reply-To: <20141208093606.0960142f@x23> References: <201412080726.sB87Q0Yw034908@svn.freebsd.org> <20141208093606.0960142f@x23> Date: Mon, 8 Dec 2014 14:19:41 -0800 X-Google-Sender-Auth: J7vchb79Jd4byFjYUfjcjPZmg-I Message-ID: Subject: Re: svn commit: r275599 - in head/sys/ofed/include: linux net From: Craig Rodrigues To: Marko Zec Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, hselasky@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Dec 2014 22:19:44 -0000 On Mon, Dec 8, 2014 at 12:36 AM, Marko Zec wrote: > > And perhaps all of this stuff could have been completely avoided if > cma_init() was scheduled to fire with curvnet contex already set to > vnet0, using proper SYSINIT scheduling instead of module_init(), i.e. > after SI_SUB_VNET and before SI_SUB_VNET_DONE? > If this is the way to go, then please submit a patch implementing this. Use the kernel config mentioned in: https://reviews.freebsd.org/D1279 and verify that it works. Thanks. -- Craig From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 00:47:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5D48D82D; Tue, 9 Dec 2014 00:47:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DF71BDC; Tue, 9 Dec 2014 00:47:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB90l3fj065252; Tue, 9 Dec 2014 00:47:03 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB90l3Em065251; Tue, 9 Dec 2014 00:47:03 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412090047.sB90l3Em065251@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 9 Dec 2014 00:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275626 - stable/10/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 00:47:03 -0000 Author: delphij Date: Tue Dec 9 00:47:02 2014 New Revision: 275626 URL: https://svnweb.freebsd.org/changeset/base/275626 Log: MFC r275071: Reinstitate send() after syslogd restarts. In r228193 the test of CONNPRIV have been moved to before the _usleep and send in vsyslog(). When syslogd restarts, this would prevent the message being logged after the disconnect/connect dance for scenario #1. PR: 194751 Submitted by: Peter Creath Reviewed By: glebius Modified: stable/10/lib/libc/gen/syslog.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/syslog.c ============================================================================== --- stable/10/lib/libc/gen/syslog.c Mon Dec 8 23:23:53 2014 (r275625) +++ stable/10/lib/libc/gen/syslog.c Tue Dec 9 00:47:02 2014 (r275626) @@ -261,26 +261,45 @@ vsyslog(int pri, const char *fmt, va_lis connectlog(); /* - * If the send() failed, there are two likely scenarios: + * If the send() fails, there are two likely scenarios: * 1) syslogd was restarted * 2) /var/run/log is out of socket buffer space, which * in most cases means local DoS. - * We attempt to reconnect to /var/run/log[priv] to take care of - * case #1 and keep send()ing data to cover case #2 - * to give syslogd a chance to empty its socket buffer. + * If the error does not indicate a full buffer, we address + * case #1 by attempting to reconnect to /var/run/log[priv] + * and resending the message once. * - * If we are working with a priveleged socket, then take - * only one attempt, because we don't want to freeze a + * If we are working with a privileged socket, the retry + * attempts end there, because we don't want to freeze a * critical application like su(1) or sshd(8). * + * Otherwise, we address case #2 by repeatedly retrying the + * send() to give syslogd a chance to empty its socket buffer. */ if (send(LogFile, tbuf, cnt, 0) < 0) { if (errno != ENOBUFS) { + /* + * Scenario 1: syslogd was restarted + * reconnect and resend once + */ disconnectlog(); connectlog(); + if (send(LogFile, tbuf, cnt, 0) >= 0) { + THREAD_UNLOCK(); + return; + } + /* + * if the resend failed, fall through to + * possible scenario 2 + */ } - do { + while (errno == ENOBUFS) { + /* + * Scenario 2: out of socket buffer space + * possible DoS, fail fast on a privileged + * socket + */ if (status == CONNPRIV) break; _usleep(1); @@ -288,7 +307,7 @@ vsyslog(int pri, const char *fmt, va_lis THREAD_UNLOCK(); return; } - } while (errno == ENOBUFS); + } } else { THREAD_UNLOCK(); return; @@ -350,7 +369,7 @@ connectlog(void) SyslogAddr.sun_family = AF_UNIX; /* - * First try priveleged socket. If no success, + * First try privileged socket. If no success, * then try default socket. */ (void)strncpy(SyslogAddr.sun_path, _PATH_LOG_PRIV, From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 00:47:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 75630964; Tue, 9 Dec 2014 00:47:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56457BE7; Tue, 9 Dec 2014 00:47:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB90llP7065424; Tue, 9 Dec 2014 00:47:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB90llHM065423; Tue, 9 Dec 2014 00:47:47 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412090047.sB90llHM065423@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 9 Dec 2014 00:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275627 - stable/9/lib/libc/gen X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 00:47:47 -0000 Author: delphij Date: Tue Dec 9 00:47:46 2014 New Revision: 275627 URL: https://svnweb.freebsd.org/changeset/base/275627 Log: MFC r275071: Reinstitate send() after syslogd restarts. In r228193 the test of CONNPRIV have been moved to before the _usleep and send in vsyslog(). When syslogd restarts, this would prevent the message being logged after the disconnect/connect dance for scenario #1. PR: 194751 Submitted by: Peter Creath Reviewed By: glebius Modified: stable/9/lib/libc/gen/syslog.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/syslog.c ============================================================================== --- stable/9/lib/libc/gen/syslog.c Tue Dec 9 00:47:02 2014 (r275626) +++ stable/9/lib/libc/gen/syslog.c Tue Dec 9 00:47:46 2014 (r275627) @@ -261,26 +261,45 @@ vsyslog(int pri, const char *fmt, va_lis connectlog(); /* - * If the send() failed, there are two likely scenarios: + * If the send() fails, there are two likely scenarios: * 1) syslogd was restarted * 2) /var/run/log is out of socket buffer space, which * in most cases means local DoS. - * We attempt to reconnect to /var/run/log[priv] to take care of - * case #1 and keep send()ing data to cover case #2 - * to give syslogd a chance to empty its socket buffer. + * If the error does not indicate a full buffer, we address + * case #1 by attempting to reconnect to /var/run/log[priv] + * and resending the message once. * - * If we are working with a priveleged socket, then take - * only one attempt, because we don't want to freeze a + * If we are working with a privileged socket, the retry + * attempts end there, because we don't want to freeze a * critical application like su(1) or sshd(8). * + * Otherwise, we address case #2 by repeatedly retrying the + * send() to give syslogd a chance to empty its socket buffer. */ if (send(LogFile, tbuf, cnt, 0) < 0) { if (errno != ENOBUFS) { + /* + * Scenario 1: syslogd was restarted + * reconnect and resend once + */ disconnectlog(); connectlog(); + if (send(LogFile, tbuf, cnt, 0) >= 0) { + THREAD_UNLOCK(); + return; + } + /* + * if the resend failed, fall through to + * possible scenario 2 + */ } - do { + while (errno == ENOBUFS) { + /* + * Scenario 2: out of socket buffer space + * possible DoS, fail fast on a privileged + * socket + */ if (status == CONNPRIV) break; _usleep(1); @@ -288,7 +307,7 @@ vsyslog(int pri, const char *fmt, va_lis THREAD_UNLOCK(); return; } - } while (errno == ENOBUFS); + } } else { THREAD_UNLOCK(); return; @@ -350,7 +369,7 @@ connectlog(void) SyslogAddr.sun_family = AF_UNIX; /* - * First try priveleged socket. If no success, + * First try privileged socket. If no success, * then try default socket. */ (void)strncpy(SyslogAddr.sun_path, _PATH_LOG_PRIV, From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 07:03:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CF5A3B5C; Tue, 9 Dec 2014 07:03:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A01A26D0; Tue, 9 Dec 2014 07:03:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB973o5g065093; Tue, 9 Dec 2014 07:03:50 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB973otD065092; Tue, 9 Dec 2014 07:03:50 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201412090703.sB973otD065092@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Tue, 9 Dec 2014 07:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275630 - stable/10/sbin/camcontrol X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 07:03:50 -0000 Author: bryanv Date: Tue Dec 9 07:03:49 2014 New Revision: 275630 URL: https://svnweb.freebsd.org/changeset/base/275630 Log: MFC r274322: Attempt to report a better error if sanitize is not supported Modified: stable/10/sbin/camcontrol/camcontrol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/10/sbin/camcontrol/camcontrol.c Tue Dec 9 06:40:38 2014 (r275629) +++ stable/10/sbin/camcontrol/camcontrol.c Tue Dec 9 07:03:49 2014 (r275630) @@ -5827,15 +5827,31 @@ scsisanitize(struct cam_device *device, if (arglist & CAM_ARG_ERR_RECOVER) ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; - if (((retval = cam_send_ccb(device, ccb)) < 0) - || ((immediate == 0) - && ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP))) { - const char errstr[] = "error sending sanitize command"; + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending sanitize command"); + error = 1; + goto scsisanitize_bailout; + } - if (retval < 0) - warn(errstr); - else - warnx(errstr); + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + struct scsi_sense_data *sense; + int error_code, sense_key, asc, ascq; + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == + CAM_SCSI_STATUS_ERROR) { + sense = &ccb->csio.sense_data; + scsi_extract_sense_len(sense, ccb->csio.sense_len - + ccb->csio.sense_resid, &error_code, &sense_key, + &asc, &ascq, /*show_errors*/ 1); + + if (sense_key == SSD_KEY_ILLEGAL_REQUEST && + asc == 0x20 && ascq == 0x00) + warnx("sanitize is not supported by " + "this device"); + else + warnx("error sanitizing this device"); + } else + warnx("error sanitizing this device"); if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 07:15:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12A19D26; Tue, 9 Dec 2014 07:15:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E83C0809; Tue, 9 Dec 2014 07:15:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB97FsmU070770; Tue, 9 Dec 2014 07:15:54 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB97Fs6A070767; Tue, 9 Dec 2014 07:15:54 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412090715.sB97Fs6A070767@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 9 Dec 2014 07:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275631 - in stable/10/contrib/binutils/bfd: . po X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 07:15:55 -0000 Author: dim Date: Tue Dec 9 07:15:53 2014 New Revision: 275631 URL: https://svnweb.freebsd.org/changeset/base/275631 Log: MFC r275386: Let GNU ld be less obscure about missing symbols and DSOs. If the BFD object looks like a typical shared library, suggest adding '-l', where has the 'lib' prefix and '.so' or '.a' suffix removed. Otherwise, suggest adding '-l:', where is the full DT_SONAME. Submitted by: Conrad Meyer Sponsored by: EMC / Isilon storage division Reviewed by: emaste PR: 194296 Differential Revision: https://reviews.freebsd.org/D1152 Modified: stable/10/contrib/binutils/bfd/elflink.c stable/10/contrib/binutils/bfd/po/bfd.pot Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/binutils/bfd/elflink.c ============================================================================== --- stable/10/contrib/binutils/bfd/elflink.c Tue Dec 9 07:03:49 2014 (r275630) +++ stable/10/contrib/binutils/bfd/elflink.c Tue Dec 9 07:15:53 2014 (r275631) @@ -4356,9 +4356,38 @@ elf_link_add_object_symbols (bfd *abfd, --no-add-needed is used. */ if ((elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0) { + bfd_boolean looks_soish; + const char *print_name; + int print_len; + size_t len, lend = 0; + + looks_soish = FALSE; + print_name = soname; + print_len = strlen(soname); + if (strncmp(soname, "lib", 3) == 0) + { + len = print_len; + if (len > 5 && strcmp(soname + len - 2, ".a") == 0) + lend = len - 5; + else + { + while (len > 6 && (ISDIGIT(soname[len - 1]) || + soname[len - 1] == '.')) + len--; + if (strncmp(soname + len - 3, ".so", 3) == 0) + lend = len - 6; + } + if (lend != 0) + { + print_name = soname + 3; + print_len = lend; + looks_soish = TRUE; + } + } + (*_bfd_error_handler) - (_("%B: invalid DSO for symbol `%s' definition"), - abfd, name); + (_("undefined reference to symbol `%s' (try adding -l%s%.*s)"), + name, looks_soish? "" : ":", print_len, print_name); bfd_set_error (bfd_error_bad_value); goto error_free_vers; } Modified: stable/10/contrib/binutils/bfd/po/bfd.pot ============================================================================== --- stable/10/contrib/binutils/bfd/po/bfd.pot Tue Dec 9 07:03:49 2014 (r275630) +++ stable/10/contrib/binutils/bfd/po/bfd.pot Tue Dec 9 07:15:53 2014 (r275631) @@ -2438,9 +2438,9 @@ msgstr "" msgid "Warning: size of symbol `%s' changed from %lu in %B to %lu in %B" msgstr "" -#: elflink.c:4309 +#: elflink.c:4389 #, c-format -msgid "%B: invalid DSO for symbol `%s' definition" +msgid "undefined reference to symbol `%s' (try adding -l%s%.*s)" msgstr "" #: elflink.c:5535 From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 07:19:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8FE37EC0; Tue, 9 Dec 2014 07:19:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B7A683E; Tue, 9 Dec 2014 07:19:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB97JPEY071336; Tue, 9 Dec 2014 07:19:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB97JO9F071332; Tue, 9 Dec 2014 07:19:24 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412090719.sB97JO9F071332@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 9 Dec 2014 07:19:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275632 - in stable/9/contrib/binutils/bfd: . po X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 07:19:25 -0000 Author: dim Date: Tue Dec 9 07:19:24 2014 New Revision: 275632 URL: https://svnweb.freebsd.org/changeset/base/275632 Log: MFC r257302 (by rea): binutils/bfd: fix printf-like format strings for "bfd *" arguments There is a special format argument '%B' that directly handles values of type 'bfd *', they must be used instead of '%s'. Manifestations of this bug can be seen in ld(1) error messages, for example, http://lists.freebsd.org/pipermail/freebsd-current/2013-August/043580.html http://lists.freebsd.org/pipermail/freebsd-current/2013-October/045404.html Approved by: dim MFC r275386: Let GNU ld be less obscure about missing symbols and DSOs. If the BFD object looks like a typical shared library, suggest adding '-l', where has the 'lib' prefix and '.so' or '.a' suffix removed. Otherwise, suggest adding '-l:', where is the full DT_SONAME. Submitted by: Conrad Meyer Sponsored by: EMC / Isilon storage division Reviewed by: emaste PR: 194296 Differential Revision: https://reviews.freebsd.org/D1152 Modified: stable/9/contrib/binutils/bfd/elf32-score.c stable/9/contrib/binutils/bfd/elflink.c stable/9/contrib/binutils/bfd/po/bfd.pot Directory Properties: stable/9/contrib/binutils/ (props changed) Modified: stable/9/contrib/binutils/bfd/elf32-score.c ============================================================================== --- stable/9/contrib/binutils/bfd/elf32-score.c Tue Dec 9 07:15:53 2014 (r275631) +++ stable/9/contrib/binutils/bfd/elf32-score.c Tue Dec 9 07:19:24 2014 (r275632) @@ -2546,7 +2546,7 @@ _bfd_score_elf_check_relocs (bfd *abfd, } else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: Malformed reloc detected for section %s"), abfd, name); + (*_bfd_error_handler) (_("%B: Malformed reloc detected for section %s"), abfd, name); bfd_set_error (bfd_error_bad_value); return FALSE; } Modified: stable/9/contrib/binutils/bfd/elflink.c ============================================================================== --- stable/9/contrib/binutils/bfd/elflink.c Tue Dec 9 07:15:53 2014 (r275631) +++ stable/9/contrib/binutils/bfd/elflink.c Tue Dec 9 07:19:24 2014 (r275632) @@ -4356,9 +4356,38 @@ elf_link_add_object_symbols (bfd *abfd, --no-add-needed is used. */ if ((elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0) { + bfd_boolean looks_soish; + const char *print_name; + int print_len; + size_t len, lend = 0; + + looks_soish = FALSE; + print_name = soname; + print_len = strlen(soname); + if (strncmp(soname, "lib", 3) == 0) + { + len = print_len; + if (len > 5 && strcmp(soname + len - 2, ".a") == 0) + lend = len - 5; + else + { + while (len > 6 && (ISDIGIT(soname[len - 1]) || + soname[len - 1] == '.')) + len--; + if (strncmp(soname + len - 3, ".so", 3) == 0) + lend = len - 6; + } + if (lend != 0) + { + print_name = soname + 3; + print_len = lend; + looks_soish = TRUE; + } + } + (*_bfd_error_handler) - (_("%s: invalid DSO for symbol `%s' definition"), - abfd, name); + (_("undefined reference to symbol `%s' (try adding -l%s%.*s)"), + name, looks_soish? "" : ":", print_len, print_name); bfd_set_error (bfd_error_bad_value); goto error_free_vers; } Modified: stable/9/contrib/binutils/bfd/po/bfd.pot ============================================================================== --- stable/9/contrib/binutils/bfd/po/bfd.pot Tue Dec 9 07:15:53 2014 (r275631) +++ stable/9/contrib/binutils/bfd/po/bfd.pot Tue Dec 9 07:19:24 2014 (r275632) @@ -1572,7 +1572,7 @@ msgstr "" #: elf32-score.c:2549 #, c-format -msgid "%s: Malformed reloc detected for section %s" +msgid "%B: Malformed reloc detected for section %s" msgstr "" #: elf32-score.c:2600 @@ -2438,9 +2438,9 @@ msgstr "" msgid "Warning: size of symbol `%s' changed from %lu in %B to %lu in %B" msgstr "" -#: elflink.c:4309 +#: elflink.c:4389 #, c-format -msgid "%s: invalid DSO for symbol `%s' definition" +msgid "undefined reference to symbol `%s' (try adding -l%s%.*s)" msgstr "" #: elflink.c:5535 From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 07:34:30 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1BDF429A; Tue, 9 Dec 2014 07:34:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E25759E4; Tue, 9 Dec 2014 07:34:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB97YTSs080622; Tue, 9 Dec 2014 07:34:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB97YT2X080620; Tue, 9 Dec 2014 07:34:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412090734.sB97YT2X080620@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 9 Dec 2014 07:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275633 - in head: contrib/llvm/lib/Transforms/Vectorize sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 07:34:30 -0000 Author: dim Date: Tue Dec 9 07:34:28 2014 New Revision: 275633 URL: https://svnweb.freebsd.org/changeset/base/275633 Log: Pull in r223171 from upstream llvm trunk (by Michael Zolotukhin): PR21302. Vectorize only bottom-tested loops. rdar://problem/18886083 This fixes a bug in the llvm vectorizer, which could sometimes cause vectorized loops to perform an additional iteration, leading to possible buffer overruns. Symptoms of this, which are usually segfaults, were first noticed when building gcc ports, here: https://lists.freebsd.org/pipermail/freebsd-ports/2014-September/095466.html https://lists.freebsd.org/pipermail/freebsd-toolchain/2014-September/001211.html Since this fix is very important for ports, bump __FreeBSD_version to make it easier for port maintainers to test whether the fix has been applied. Upstream PR: http://llvm.org/PR21302 MFC after: 3 days Modified: head/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp head/sys/sys/param.h Modified: head/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Tue Dec 9 07:19:24 2014 (r275632) +++ head/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Tue Dec 9 07:34:28 2014 (r275633) @@ -2864,6 +2864,14 @@ bool LoopVectorizationLegality::canVecto if (!TheLoop->getExitingBlock()) return false; + // We only handle bottom-tested loops, i.e. loop in which the condition is + // checked at the end of each iteration. With that we can assume that all + // instructions in the loop are executed the same number of times. + if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch()) { + DEBUG(dbgs() << "LV: loop control flow is not understood by vectorizer\n"); + return false; + } + // We need to have a loop header. DEBUG(dbgs() << "LV: Found a loop: " << TheLoop->getHeader()->getName() << '\n'); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Dec 9 07:19:24 2014 (r275632) +++ head/sys/sys/param.h Tue Dec 9 07:34:28 2014 (r275633) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100048 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100049 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 08:56:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43956A23; Tue, 9 Dec 2014 08:56:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 300642AA; Tue, 9 Dec 2014 08:56:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB98u25i022383; Tue, 9 Dec 2014 08:56:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB98u2e2022382; Tue, 9 Dec 2014 08:56:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201412090856.sB98u2e2022382@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 9 Dec 2014 08:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275636 - head/sys/ofed/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 08:56:02 -0000 Author: hselasky Date: Tue Dec 9 08:56:01 2014 New Revision: 275636 URL: https://svnweb.freebsd.org/changeset/base/275636 Log: Move OFED init a bit earlier so that PXE boot works. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/ofed/include/linux/module.h Modified: head/sys/ofed/include/linux/module.h ============================================================================== --- head/sys/ofed/include/linux/module.h Tue Dec 9 07:55:37 2014 (r275635) +++ head/sys/ofed/include/linux/module.h Tue Dec 9 08:56:01 2014 (r275636) @@ -49,9 +49,9 @@ #define EXPORT_SYMBOL_GPL(name) /* OFED pre-module initialization */ -#define SI_SUB_OFED_PREINIT (SI_SUB_KTHREAD_INIT - 2) +#define SI_SUB_OFED_PREINIT (SI_SUB_ROOT_CONF - 2) /* OFED default module initialization */ -#define SI_SUB_OFED_MODINIT (SI_SUB_KTHREAD_INIT - 1) +#define SI_SUB_OFED_MODINIT (SI_SUB_ROOT_CONF - 1) #include From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 09:36:29 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 882FF4E8; Tue, 9 Dec 2014 09:36:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75B5E962; Tue, 9 Dec 2014 09:36:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB99aTqO042903; Tue, 9 Dec 2014 09:36:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB99aTLI042902; Tue, 9 Dec 2014 09:36:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412090936.sB99aTLI042902@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 9 Dec 2014 09:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275637 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 09:36:29 -0000 Author: kib Date: Tue Dec 9 09:36:28 2014 New Revision: 275637 URL: https://svnweb.freebsd.org/changeset/base/275637 Log: Apply chunk forgotten in r275620. Remove local variable for real. CID: 1257462 Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Tue Dec 9 08:56:01 2014 (r275636) +++ head/sys/kern/vfs_subr.c Tue Dec 9 09:36:28 2014 (r275637) @@ -1788,7 +1788,6 @@ sched_sync(void) int last_work_seen; int net_worklist_len; int syncer_final_iter; - int first_printf; int error; last_work_seen = 0; From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 10:00:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B738A30; Tue, 9 Dec 2014 10:00:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EBCEB77; Tue, 9 Dec 2014 10:00:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9A0lvu054741; Tue, 9 Dec 2014 10:00:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9A0l9Z054543; Tue, 9 Dec 2014 10:00:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412091000.sB9A0l9Z054543@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 9 Dec 2014 10:00:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275638 - in head/sys: fs/msdosfs kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 10:00:48 -0000 Author: kib Date: Tue Dec 9 10:00:47 2014 New Revision: 275638 URL: https://svnweb.freebsd.org/changeset/base/275638 Log: Do not call VFS_SYNC() before VFS_UNMOUNT() for forced unmount. Since VFS does not/cannot stop writes, sync might run indefinitely, or be a wrong thing to do at all. E. g. NFS ignores VFS_SYNC() for forced unmounts, since non-responding server does not allow sync to finish. On the other hand, filesystems can and do stop writes using fs-specific facilities, and should already fully flush caches in VFS_UNMOUNT() due to the race. Adjust msdosfs tp sync in unmount for forced call, to accomodate the new behaviour. Note that it is still racy, since writes are not stopped. Discussed with: avg, bjk, mckusick Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c head/sys/kern/vfs_mount.c Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vfsops.c Tue Dec 9 09:36:28 2014 (r275637) +++ head/sys/fs/msdosfs/msdosfs_vfsops.c Tue Dec 9 10:00:47 2014 (r275638) @@ -797,11 +797,15 @@ msdosfs_unmount(struct mount *mp, int mn int error, flags; flags = 0; - if (mntflags & MNT_FORCE) + error = msdosfs_sync(mp, MNT_WAIT); + if ((mntflags & MNT_FORCE) != 0) { flags |= FORCECLOSE; + } else if (error != 0) { + return (error); + } error = vflush(mp, 0, flags, curthread); - if (error && error != ENXIO) - return error; + if (error != 0 && error != ENXIO) + return (error); pmp = VFSTOMSDOSFS(mp); if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0) { error = markvoldirty(pmp, 0); Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Tue Dec 9 09:36:28 2014 (r275637) +++ head/sys/kern/vfs_mount.c Tue Dec 9 10:00:47 2014 (r275638) @@ -1305,8 +1305,8 @@ dounmount(mp, flags, td) } vput(fsrootvp); } - if (((mp->mnt_flag & MNT_RDONLY) || - (error = VFS_SYNC(mp, MNT_WAIT)) == 0) || (flags & MNT_FORCE) != 0) + if ((mp->mnt_flag & MNT_RDONLY) != 0 || (flags & MNT_FORCE) != 0 || + (error = VFS_SYNC(mp, MNT_WAIT)) == 0) error = VFS_UNMOUNT(mp, flags); vn_finished_write(mp); /* From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 10:21:31 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E950BF5D; Tue, 9 Dec 2014 10:21:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D63E8E0A; Tue, 9 Dec 2014 10:21:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9ALVW3067007; Tue, 9 Dec 2014 10:21:31 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9ALVr2067006; Tue, 9 Dec 2014 10:21:31 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201412091021.sB9ALVr2067006@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 9 Dec 2014 10:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275639 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 10:21:32 -0000 Author: andrew Date: Tue Dec 9 10:21:31 2014 New Revision: 275639 URL: https://svnweb.freebsd.org/changeset/base/275639 Log: Include sys/kernel.h to pick up the definition of hz. subr_syscall.c uses it after r275616. X-MFC with: r275616 Modified: head/sys/arm/arm/syscall.c Modified: head/sys/arm/arm/syscall.c ============================================================================== --- head/sys/arm/arm/syscall.c Tue Dec 9 10:00:47 2014 (r275638) +++ head/sys/arm/arm/syscall.c Tue Dec 9 10:21:31 2014 (r275639) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 10:31:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1453A60D; Tue, 9 Dec 2014 10:31:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0020EF13; Tue, 9 Dec 2014 10:31:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9AVZqU072701; Tue, 9 Dec 2014 10:31:35 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9AVZ2Y072700; Tue, 9 Dec 2014 10:31:35 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201412091031.sB9AVZ2Y072700@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 9 Dec 2014 10:31:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275640 - head/sys/dev/virtio/mmio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 10:31:36 -0000 Author: andrew Date: Tue Dec 9 10:31:35 2014 New Revision: 275640 URL: https://svnweb.freebsd.org/changeset/base/275640 Log: Update the virtio driver to work on the ARM AArch64 Foundation Model. There are two main parts to get it to work, 1) most of the register accesses need to be word sized, other than the config register which needs to be byte aligned, and 2) we don't need the platform driver for this to work on the Foundation Model, allow it to be NULL. Differential Revision: https://reviews.freebsd.org/D1240 Reviewed by: bryanv Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/virtio/mmio/virtio_mmio.c Modified: head/sys/dev/virtio/mmio/virtio_mmio.c ============================================================================== --- head/sys/dev/virtio/mmio/virtio_mmio.c Tue Dec 9 10:21:31 2014 (r275639) +++ head/sys/dev/virtio/mmio/virtio_mmio.c Tue Dec 9 10:31:35 2014 (r275640) @@ -1,11 +1,15 @@ /*- * Copyright (c) 2014 Ruslan Bukin + * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -131,15 +135,24 @@ static void vtmmio_vq_intr(void *); /* * I/O port read/write wrappers. */ -#define vtmmio_write_config_1(sc, o, v) \ - bus_write_1((sc)->res[0], (o), (v)); \ - VIRTIO_MMIO_NOTE(sc->platform, (o)) -#define vtmmio_write_config_2(sc, o, v) \ - bus_write_2((sc)->res[0], (o), (v)); \ - VIRTIO_MMIO_NOTE(sc->platform, (o)) -#define vtmmio_write_config_4(sc, o, v) \ - bus_write_4((sc)->res[0], (o), (v)); \ - VIRTIO_MMIO_NOTE(sc->platform, (o)) +#define vtmmio_write_config_1(sc, o, v) \ +do { \ + bus_write_1((sc)->res[0], (o), (v)); \ + if (sc->platform != NULL) \ + VIRTIO_MMIO_NOTE(sc->platform, (o)); \ +} while (0) +#define vtmmio_write_config_2(sc, o, v) \ +do { \ + bus_write_2((sc)->res[0], (o), (v)); \ + if (sc->platform != NULL) \ + VIRTIO_MMIO_NOTE(sc->platform, (o)); \ +} while (0) +#define vtmmio_write_config_4(sc, o, v) \ +do { \ + bus_write_4((sc)->res[0], (o), (v)); \ + if (sc->platform != NULL) \ + VIRTIO_MMIO_NOTE(sc->platform, (o)); \ +} while (0) #define vtmmio_read_config_1(sc, o) \ bus_read_1((sc)->res[0], (o)) @@ -200,11 +213,13 @@ vtmmio_setup_intr(device_t dev, enum int sc = device_get_softc(dev); - err = VIRTIO_MMIO_SETUP_INTR(sc->platform, sc->dev, - vtmmio_vq_intr, sc); - if (err == 0) { - /* Okay we have backend-specific interrupts */ - return (0); + if (sc->platform != NULL) { + err = VIRTIO_MMIO_SETUP_INTR(sc->platform, sc->dev, + vtmmio_vq_intr, sc); + if (err == 0) { + /* Okay we have backend-specific interrupts */ + return (0); + } } rid = 0; @@ -473,8 +488,8 @@ vtmmio_alloc_virtqueues(device_t dev, in struct vq_alloc_info *info; struct vtmmio_softc *sc; struct virtqueue *vq; + uint32_t size; int idx, error; - uint16_t size; sc = device_get_softc(dev); @@ -492,8 +507,10 @@ vtmmio_alloc_virtqueues(device_t dev, in vqx = &sc->vtmmio_vqs[idx]; info = &vq_info[idx]; + vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_SEL, idx); + vtmmio_select_virtqueue(sc, idx); - size = vtmmio_read_config_2(sc, VIRTIO_MMIO_QUEUE_NUM); + size = vtmmio_read_config_4(sc, VIRTIO_MMIO_QUEUE_NUM_MAX); error = virtqueue_alloc(dev, idx, size, VIRTIO_MMIO_VRING_ALIGN, 0xFFFFFFFFUL, info, &vq); @@ -503,6 +520,10 @@ vtmmio_alloc_virtqueues(device_t dev, in idx, error); break; } + + vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_NUM, size); + vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_ALIGN, + VIRTIO_MMIO_VRING_ALIGN); #if 0 device_printf(dev, "virtqueue paddr 0x%08lx\n", (uint64_t)virtqueue_paddr(vq)); @@ -572,7 +593,7 @@ vtmmio_notify_virtqueue(device_t dev, ui sc = device_get_softc(dev); - vtmmio_write_config_2(sc, VIRTIO_MMIO_QUEUE_NOTIFY, queue); + vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_NOTIFY, queue); } static uint8_t @@ -582,7 +603,7 @@ vtmmio_get_status(device_t dev) sc = device_get_softc(dev); - return (vtmmio_read_config_1(sc, VIRTIO_MMIO_STATUS)); + return (vtmmio_read_config_4(sc, VIRTIO_MMIO_STATUS)); } static void @@ -595,7 +616,7 @@ vtmmio_set_status(device_t dev, uint8_t if (status != VIRTIO_CONFIG_STATUS_RESET) status |= vtmmio_get_status(dev); - vtmmio_write_config_1(sc, VIRTIO_MMIO_STATUS, status); + vtmmio_write_config_4(sc, VIRTIO_MMIO_STATUS, status); } static void @@ -611,13 +632,16 @@ vtmmio_read_dev_config(device_t dev, bus off = VIRTIO_MMIO_CONFIG + offset; for (d = dst; length > 0; d += size, off += size, length -= size) { +#ifdef ALLOW_WORD_ALIGNED_ACCESS if (length >= 4) { size = 4; *(uint32_t *)d = vtmmio_read_config_4(sc, off); } else if (length >= 2) { size = 2; *(uint16_t *)d = vtmmio_read_config_2(sc, off); - } else { + } else +#endif + { size = 1; *d = vtmmio_read_config_1(sc, off); } @@ -637,13 +661,16 @@ vtmmio_write_dev_config(device_t dev, bu off = VIRTIO_MMIO_CONFIG + offset; for (s = src; length > 0; s += size, off += size, length -= size) { +#ifdef ALLOW_WORD_ALIGNED_ACCESS if (length >= 4) { size = 4; vtmmio_write_config_4(sc, off, *(uint32_t *)s); } else if (length >= 2) { size = 2; vtmmio_write_config_2(sc, off, *(uint16_t *)s); - } else { + } else +#endif + { size = 1; vtmmio_write_config_1(sc, off, *s); } @@ -711,7 +738,7 @@ vtmmio_reinit_virtqueue(struct vtmmio_so KASSERT(vq != NULL, ("%s: vq %d not allocated", __func__, idx)); vtmmio_select_virtqueue(sc, idx); - size = vtmmio_read_config_2(sc, VIRTIO_MMIO_QUEUE_NUM); + size = vtmmio_read_config_4(sc, VIRTIO_MMIO_QUEUE_NUM_MAX); error = virtqueue_reinit(vq, size); if (error) @@ -778,7 +805,7 @@ static void vtmmio_select_virtqueue(struct vtmmio_softc *sc, int idx) { - vtmmio_write_config_2(sc, VIRTIO_MMIO_QUEUE_SEL, idx); + vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_SEL, idx); } static void @@ -787,14 +814,27 @@ vtmmio_vq_intr(void *arg) struct vtmmio_virtqueue *vqx; struct vtmmio_softc *sc; struct virtqueue *vq; + uint32_t status; int idx; sc = arg; + status = vtmmio_read_config_4(sc, VIRTIO_MMIO_INTERRUPT_STATUS); + vtmmio_write_config_4(sc, VIRTIO_MMIO_INTERRUPT_ACK, status); + + /* The config changed */ + if (status & VIRTIO_MMIO_INT_CONFIG) + if (sc->vtmmio_child_dev != NULL) + VIRTIO_CONFIG_CHANGE(sc->vtmmio_child_dev); + /* Notify all virtqueues. */ - for (idx = 0; idx < sc->vtmmio_nvqs; idx++) { - vqx = &sc->vtmmio_vqs[idx]; - vq = vqx->vtv_vq; - virtqueue_intr(vq); - }; + if (status & VIRTIO_MMIO_INT_VRING) { + for (idx = 0; idx < sc->vtmmio_nvqs; idx++) { + vqx = &sc->vtmmio_vqs[idx]; + if (vqx->vtv_no_intr == 0) { + vq = vqx->vtv_vq; + virtqueue_intr(vq); + } + } + } } From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 11:12:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C31D4446; Tue, 9 Dec 2014 11:12:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFAD53A6; Tue, 9 Dec 2014 11:12:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9BCP0x093840; Tue, 9 Dec 2014 11:12:25 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9BCPfT093839; Tue, 9 Dec 2014 11:12:25 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201412091112.sB9BCPfT093839@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Tue, 9 Dec 2014 11:12:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275641 - head/sys/x86/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 11:12:25 -0000 Author: royger Date: Tue Dec 9 11:12:24 2014 New Revision: 275641 URL: https://svnweb.freebsd.org/changeset/base/275641 Log: xen: notify ACPI about SCI override If the SCI is remapped to a non-ISA global interrupt notify the ACPI subsystem about the override. Reported by: David P. Discher Sponsored by: Citrix Systems R&D Modified: head/sys/x86/xen/pvcpu_enum.c Modified: head/sys/x86/xen/pvcpu_enum.c ============================================================================== --- head/sys/x86/xen/pvcpu_enum.c Tue Dec 9 10:31:35 2014 (r275640) +++ head/sys/x86/xen/pvcpu_enum.c Tue Dec 9 11:12:24 2014 (r275641) @@ -91,6 +91,15 @@ madt_parse_interrupt_override(ACPI_MADT_ madt_parse_interrupt_values(intr, &trig, &pol); + /* Remap the IRQ if it is mapped to a different interrupt vector. */ + if (intr->SourceIrq != intr->GlobalIrq && intr->GlobalIrq > 15 && + intr->SourceIrq == AcpiGbl_FADT.SciInterrupt) + /* + * If the SCI is remapped to a non-ISA global interrupt, + * then override the vector we use to setup. + */ + acpi_OverrideInterruptLevel(intr->GlobalIrq); + /* Register the IRQ with the polarity and trigger mode found. */ xen_register_pirq(intr->GlobalIrq, trig, pol); } From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 11:50:52 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AC517D41; Tue, 9 Dec 2014 11:50:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9774B900; Tue, 9 Dec 2014 11:50:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9Boqob011653; Tue, 9 Dec 2014 11:50:52 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9Bop6x011646; Tue, 9 Dec 2014 11:50:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201412091150.sB9Bop6x011646@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 9 Dec 2014 11:50:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275642 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 11:50:52 -0000 Author: trasz Date: Tue Dec 9 11:50:50 2014 New Revision: 275642 URL: https://svnweb.freebsd.org/changeset/base/275642 Log: MFC r274308: Add support for sending redirections to iSCSI target. MFC r274309: Fix several nits in redirection handling - don't use wrong CSG, and avoid use-after-free. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/ctl.conf.5 stable/10/usr.sbin/ctld/ctld.c stable/10/usr.sbin/ctld/ctld.h stable/10/usr.sbin/ctld/login.c stable/10/usr.sbin/ctld/parse.y stable/10/usr.sbin/ctld/token.l Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Tue Dec 9 11:12:24 2014 (r275641) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Tue Dec 9 11:50:50 2014 (r275642) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2014 +.Dd November 9, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -218,6 +218,17 @@ An IPv4 or IPv6 address and port to list .\".It Ic listen-iser Ar address .\"An IPv4 or IPv6 address and port to listen on for incoming connections .\"using iSER (iSCSI over RDMA) protocol. +.It Ic redirect Aq Ar address +IPv4 or IPv6 address to redirect initiators to. +When configured, all initiators attempting to connect to portal +belonging to this +.Sy portal-group +will get redirected using "Target moved temporarily" login response. +Redirection happens before authentication and any +.Sy initiator-name +or +.Sy initiator-portal +checks are skipped. .El .Ss target Context .Bl -tag -width indent @@ -296,6 +307,11 @@ The default portal group is .Qq Ar default , which makes the target available on TCP port 3260 on all configured IPv4 and IPv6 addresses. +.It Ic redirect Aq Ar address +IPv4 or IPv6 address to redirect initiators to. +When configured, all initiators attempting to connect to this target +will get redirected using "Target moved temporarily" login response. +Redirection happens after successful authentication. .It Ic lun Ar number Create a .Sy lun Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Tue Dec 9 11:12:24 2014 (r275641) +++ stable/10/usr.sbin/ctld/ctld.c Tue Dec 9 11:50:50 2014 (r275642) @@ -622,6 +622,7 @@ portal_group_delete(struct portal_group TAILQ_FOREACH_SAFE(portal, &pg->pg_portals, p_next, tmp) portal_delete(portal); free(pg->pg_name); + free(pg->pg_redirection); free(pg); } @@ -1000,6 +1001,22 @@ portal_group_set_filter(struct portal_gr return (0); } +int +portal_group_set_redirection(struct portal_group *pg, const char *addr) +{ + + if (pg->pg_redirection != NULL) { + log_warnx("cannot set redirection to \"%s\" for " + "portal-group \"%s\"; already defined", + addr, pg->pg_name); + return (1); + } + + pg->pg_redirection = checked_strdup(addr); + + return (0); +} + static bool valid_hex(const char ch) { @@ -1144,6 +1161,7 @@ target_delete(struct target *targ) TAILQ_FOREACH_SAFE(lun, &targ->t_luns, l_next, tmp) lun_delete(lun); free(targ->t_name); + free(targ->t_redirection); free(targ); } @@ -1160,6 +1178,22 @@ target_find(struct conf *conf, const cha return (NULL); } +int +target_set_redirection(struct target *target, const char *addr) +{ + + if (target->t_redirection != NULL) { + log_warnx("cannot set redirection to \"%s\" for " + "target \"%s\"; already defined", + addr, target->t_name); + return (1); + } + + target->t_redirection = checked_strdup(addr); + + return (0); +} + struct lun * lun_new(struct target *targ, int lun_id) { @@ -1486,10 +1520,15 @@ conf_verify(struct conf *conf) return (error); found = true; } - if (!found) { + if (!found && targ->t_redirection == NULL) { log_warnx("no LUNs defined for target \"%s\"", targ->t_name); } + if (found && targ->t_redirection != NULL) { + log_debugx("target \"%s\" contains luns, " + " but configured for redirection", + targ->t_name); + } } TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) { assert(pg->pg_name != NULL); @@ -1506,13 +1545,22 @@ conf_verify(struct conf *conf) if (targ->t_portal_group == pg) break; } - if (targ == NULL) { + if (pg->pg_redirection != NULL) { + if (targ != NULL) { + log_debugx("portal-group \"%s\" assigned " + "to target \"%s\", but configured " + "for redirection", + pg->pg_name, targ->t_name); + } + pg->pg_unassigned = false; + } else if (targ != NULL) { + pg->pg_unassigned = false; + } else { if (strcmp(pg->pg_name, "default") != 0) log_warnx("portal-group \"%s\" not assigned " "to any target", pg->pg_name); pg->pg_unassigned = true; - } else - pg->pg_unassigned = false; + } } TAILQ_FOREACH(ag, &conf->conf_auth_groups, ag_next) { if (ag->ag_name == NULL) Modified: stable/10/usr.sbin/ctld/ctld.h ============================================================================== --- stable/10/usr.sbin/ctld/ctld.h Tue Dec 9 11:12:24 2014 (r275641) +++ stable/10/usr.sbin/ctld/ctld.h Tue Dec 9 11:50:50 2014 (r275642) @@ -117,6 +117,7 @@ struct portal_group { int pg_discovery_filter; bool pg_unassigned; TAILQ_HEAD(, portal) pg_portals; + char *pg_redirection; uint16_t pg_tag; }; @@ -151,6 +152,7 @@ struct target { struct portal_group *t_portal_group; char *t_name; char *t_alias; + char *t_redirection; }; struct isns { @@ -301,6 +303,8 @@ int portal_group_add_listen(struct por const char *listen, bool iser); int portal_group_set_filter(struct portal_group *pg, const char *filter); +int portal_group_set_redirection(struct portal_group *pg, + const char *addr); int isns_new(struct conf *conf, const char *addr); void isns_delete(struct isns *is); @@ -312,6 +316,8 @@ struct target *target_new(struct conf * void target_delete(struct target *target); struct target *target_find(struct conf *conf, const char *name); +int target_set_redirection(struct target *target, + const char *addr); struct lun *lun_new(struct target *target, int lun_id); void lun_delete(struct lun *lun); Modified: stable/10/usr.sbin/ctld/login.c ============================================================================== --- stable/10/usr.sbin/ctld/login.c Tue Dec 9 11:12:24 2014 (r275641) +++ stable/10/usr.sbin/ctld/login.c Tue Dec 9 11:50:50 2014 (r275642) @@ -613,13 +613,72 @@ login_negotiate_key(struct pdu *request, } static void +login_redirect(struct pdu *request, const char *target_address) +{ + struct pdu *response; + struct iscsi_bhs_login_response *bhslr2; + struct keys *response_keys; + + response = login_new_response(request); + login_set_csg(response, login_csg(request)); + bhslr2 = (struct iscsi_bhs_login_response *)response->pdu_bhs; + bhslr2->bhslr_status_class = 0x01; + bhslr2->bhslr_status_detail = 0x01; + + response_keys = keys_new(); + keys_add(response_keys, "TargetAddress", target_address); + + keys_save(response_keys, response); + pdu_send(response); + pdu_delete(response); + keys_delete(response_keys); +} + +static bool +login_portal_redirect(struct connection *conn, struct pdu *request) +{ + const struct portal_group *pg; + + pg = conn->conn_portal->p_portal_group; + if (pg->pg_redirection == NULL) + return (false); + + log_debugx("portal-group \"%s\" configured to redirect to %s", + pg->pg_name, pg->pg_redirection); + login_redirect(request, pg->pg_redirection); + + return (true); +} + +static bool +login_target_redirect(struct connection *conn, struct pdu *request) +{ + const char *target_address; + + assert(conn->conn_portal->p_portal_group->pg_redirection == NULL); + + if (conn->conn_target == NULL) + return (false); + + target_address = conn->conn_target->t_redirection; + if (target_address == NULL) + return (false); + + log_debugx("target \"%s\" configured to redirect to %s", + conn->conn_target->t_name, target_address); + login_redirect(request, target_address); + + return (true); +} + +static void login_negotiate(struct connection *conn, struct pdu *request) { struct pdu *response; struct iscsi_bhs_login_response *bhslr2; struct keys *request_keys, *response_keys; int i; - bool skipped_security; + bool redirected, skipped_security; if (request == NULL) { log_debugx("beginning operational parameter negotiation; " @@ -629,6 +688,18 @@ login_negotiate(struct connection *conn, } else skipped_security = true; + /* + * RFC 3720, 10.13.5. Status-Class and Status-Detail, says + * the redirection SHOULD be accepted by the initiator before + * authentication, but MUST be be accepted afterwards; that's + * why we're doing it here and not earlier. + */ + redirected = login_target_redirect(conn, request); + if (redirected) { + log_debugx("initiator redirected; exiting"); + exit(0); + } + request_keys = keys_new(); keys_load(request_keys, request); @@ -680,6 +751,7 @@ login(struct connection *conn) struct portal_group *pg; const char *initiator_name, *initiator_alias, *session_type, *target_name, *auth_method; + bool redirected; /* * Handle the initial Login Request - figure out required authentication @@ -722,6 +794,12 @@ login(struct connection *conn) */ setproctitle("%s (%s)", conn->conn_initiator_addr, conn->conn_initiator_name); + redirected = login_portal_redirect(conn, request); + if (redirected) { + log_debugx("initiator redirected; exiting"); + exit(0); + } + initiator_alias = keys_find(request_keys, "InitiatorAlias"); if (initiator_alias != NULL) conn->conn_initiator_alias = checked_strdup(initiator_alias); Modified: stable/10/usr.sbin/ctld/parse.y ============================================================================== --- stable/10/usr.sbin/ctld/parse.y Tue Dec 9 11:12:24 2014 (r275641) +++ stable/10/usr.sbin/ctld/parse.y Tue Dec 9 11:50:50 2014 (r275642) @@ -61,7 +61,8 @@ extern void yyrestart(FILE *); %token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER %token INITIATOR_NAME INITIATOR_PORTAL ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %token LISTEN LISTEN_ISER LUN MAXPROC OPENING_BRACKET OPTION -%token PATH PIDFILE PORTAL_GROUP SEMICOLON SERIAL SIZE STR TARGET TIMEOUT +%token PATH PIDFILE PORTAL_GROUP REDIRECT SEMICOLON SERIAL SIZE STR +%token TARGET TIMEOUT %union { @@ -338,6 +339,8 @@ portal_group_entry: portal_group_listen | portal_group_listen_iser + | + portal_group_redirect ; portal_group_discovery_auth_group: DISCOVERY_AUTH_GROUP STR @@ -393,6 +396,17 @@ portal_group_listen_iser: LISTEN_ISER ST } ; +portal_group_redirect: REDIRECT STR + { + int error; + + error = portal_group_set_redirection(portal_group, $2); + free($2); + if (error != 0) + return (1); + } + ; + target: TARGET target_name OPENING_BRACKET target_entries CLOSING_BRACKET { @@ -433,6 +447,8 @@ target_entry: | target_portal_group | + target_redirect + | target_lun ; @@ -635,6 +651,17 @@ target_portal_group: PORTAL_GROUP STR } ; +target_redirect: REDIRECT STR + { + int error; + + error = target_set_redirection(target, $2); + free($2); + if (error != 0) + return (1); + } + ; + target_lun: LUN lun_number OPENING_BRACKET lun_entries CLOSING_BRACKET { Modified: stable/10/usr.sbin/ctld/token.l ============================================================================== --- stable/10/usr.sbin/ctld/token.l Tue Dec 9 11:12:24 2014 (r275641) +++ stable/10/usr.sbin/ctld/token.l Tue Dec 9 11:50:50 2014 (r275642) @@ -72,6 +72,7 @@ isns-server { return ISNS_SERVER; } isns-period { return ISNS_PERIOD; } isns-timeout { return ISNS_TIMEOUT; } portal-group { return PORTAL_GROUP; } +redirect { return REDIRECT; } serial { return SERIAL; } size { return SIZE; } target { return TARGET; } From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 11:52:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A6B9F88; Tue, 9 Dec 2014 11:52:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8659F9AB; Tue, 9 Dec 2014 11:52:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9Bqb3C014294; Tue, 9 Dec 2014 11:52:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9BqbFf014293; Tue, 9 Dec 2014 11:52:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201412091152.sB9BqbFf014293@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 9 Dec 2014 11:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275643 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 11:52:37 -0000 Author: trasz Date: Tue Dec 9 11:52:36 2014 New Revision: 275643 URL: https://svnweb.freebsd.org/changeset/base/275643 Log: MFC r274310: Add HISTORY section to ctld(8). Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/ctld.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctld.8 ============================================================================== --- stable/10/usr.sbin/ctld/ctld.8 Tue Dec 9 11:50:50 2014 (r275642) +++ stable/10/usr.sbin/ctld/ctld.8 Tue Dec 9 11:52:36 2014 (r275643) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 20, 2014 +.Dd November 9, 2014 .Dt CTLD 8 .Os .Sh NAME @@ -105,6 +105,11 @@ utility exits 0 on success, and >0 if an .Xr ctl 4 , .Xr ctl.conf 5 , .Xr ctladm 8 +.Sh HISTORY +The +.Nm +command appeared in +.Fx 10.0 . .Sh AUTHORS The .Nm From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 14:21:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B9E336A; Tue, 9 Dec 2014 14:21:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37F39AEC; Tue, 9 Dec 2014 14:21:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9ELij9092071; Tue, 9 Dec 2014 14:21:44 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9ELiXF092070; Tue, 9 Dec 2014 14:21:44 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201412091421.sB9ELiXF092070@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Tue, 9 Dec 2014 14:21:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275644 - head/gnu/usr.bin/gdb/kgdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 14:21:44 -0000 Author: dchagin Date: Tue Dec 9 14:21:43 2014 New Revision: 275644 URL: https://svnweb.freebsd.org/changeset/base/275644 Log: Skip calling CPU_ISSET for NOCPU as a short period of time we can have td_oncpu is NOCPU for thread in TDS_RUNNING state. Differential Revision: https://reviews.freebsd.org/D1283 Reviewed by: jhb MFC after: 1 Month 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 Tue Dec 9 11:52:36 2014 (r275643) +++ head/gnu/usr.bin/gdb/kgdb/kthr.c Tue Dec 9 14:21:43 2014 (r275644) @@ -96,7 +96,7 @@ kgdb_thr_add_procs(uintptr_t paddr) kt->kaddr = addr; if (td.td_tid == dumptid) kt->pcb = dumppcb; - else if (td.td_state == TDS_RUNNING && + else if (td.td_oncpu != NOCPU && CPU_ISSET(td.td_oncpu, &stopped_cpus)) kt->pcb = kgdb_trgt_core_pcb(td.td_oncpu); else From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 14:56:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D197D25; Tue, 9 Dec 2014 14:56:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 603E8EBA; Tue, 9 Dec 2014 14:56:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9Eu1uN008930; Tue, 9 Dec 2014 14:56:01 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9Eu1kX008929; Tue, 9 Dec 2014 14:56:01 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201412091456.sB9Eu1kX008929@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 9 Dec 2014 14:56:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275645 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 14:56:01 -0000 Author: pfg Date: Tue Dec 9 14:56:00 2014 New Revision: 275645 URL: https://svnweb.freebsd.org/changeset/base/275645 Log: ext2fs: Fix old out-of-bounds access. Overrunning buffer pointed to by (caddr_t)&oip->i_db[0] of 48 bytes by passing it to a function which accesses it at byte offset 59 using argument 60UL. The issue was inherited from an older FFS implementation and fixed there with by merging UFS2 in r98542. We follow the FFS fix. Discussed with: bde CID: 1007665 MFC after: 3 days Modified: head/sys/fs/ext2fs/ext2_inode.c Modified: head/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode.c Tue Dec 9 14:21:43 2014 (r275644) +++ head/sys/fs/ext2fs/ext2_inode.c Tue Dec 9 14:56:00 2014 (r275645) @@ -224,14 +224,18 @@ ext2_truncate(struct vnode *vp, off_t le * will be returned to the free list. lastiblock values are also * normalized to -1 for calls to ext2_indirtrunc below. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)oldblks, sizeof(oldblks)); - for (level = TRIPLE; level >= SINGLE; level--) + for (level = TRIPLE; level >= SINGLE; level--) { + oldblks[NDADDR + level] = oip->i_ib[level]; if (lastiblock[level] < 0) { oip->i_ib[level] = 0; lastiblock[level] = -1; } - for (i = NDADDR - 1; i > lastblock; i--) - oip->i_db[i] = 0; + } + for (i = 0; i < NDADDR; i++) { + oldblks[i] = oip->i_db[i]; + if (i > lastblock) + oip->i_db[i] = 0; + } oip->i_flag |= IN_CHANGE | IN_UPDATE; allerror = ext2_update(ovp, !DOINGASYNC(ovp)); @@ -241,8 +245,14 @@ ext2_truncate(struct vnode *vp, off_t le * Note that we save the new block configuration so we can check it * when we are done. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof(newblks)); - bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof(oldblks)); + for (i = 0; i < NDADDR; i++) { + newblks[i] = oip->i_db[i]; + oip->i_db[i] = oldblks[i]; + } + for (i = 0; i < NIADDR; i++) { + newblks[NDADDR + i] = oip->i_ib[i]; + oip->i_ib[i] = oldblks[NDADDR + i]; + } oip->i_size = osize; error = vtruncbuf(ovp, cred, length, (int)fs->e2fs_bsize); if (error && (allerror == 0)) From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 15:26:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5642A40B; Tue, 9 Dec 2014 15:26:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42AF2220; Tue, 9 Dec 2014 15:26:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9FQ5sP024266; Tue, 9 Dec 2014 15:26:05 GMT (envelope-from mp@FreeBSD.org) Received: (from mp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9FQ4Yw024264; Tue, 9 Dec 2014 15:26:04 GMT (envelope-from mp@FreeBSD.org) Message-Id: <201412091526.sB9FQ4Yw024264@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mp set sender to mp@FreeBSD.org using -f From: Mark Peek Date: Tue, 9 Dec 2014 15:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275646 - in head/sys/dev/usb: . wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 15:26:05 -0000 Author: mp Date: Tue Dec 9 15:26:04 2014 New Revision: 275646 URL: https://svnweb.freebsd.org/changeset/base/275646 Log: Rename NETGEAR WG111V2_2 to WG111V1_2 to reflect external naming. Reviewed by: kevlo Modified: head/sys/dev/usb/usbdevs head/sys/dev/usb/wlan/if_upgt.c Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Dec 9 14:56:00 2014 (r275645) +++ head/sys/dev/usb/usbdevs Tue Dec 9 15:26:04 2014 (r275646) @@ -3195,7 +3195,7 @@ product NETGEAR EA101X 0x1002 Ethernet product NETGEAR FA101 0x1020 Ethernet 10/100, USB1.1 product NETGEAR FA120 0x1040 USB 2.0 Ethernet product NETGEAR M4100 0x1100 M4100/M5300/M7100 series switch -product NETGEAR WG111V2_2 0x4240 PrismGT USB 2.0 WLAN +product NETGEAR WG111V1_2 0x4240 PrismGT USB 2.0 WLAN product NETGEAR WG111V3 0x4260 WG111v3 product NETGEAR WG111U 0x4300 WG111U product NETGEAR WG111U_NF 0x4301 WG111U (no firmware) Modified: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- head/sys/dev/usb/wlan/if_upgt.c Tue Dec 9 14:56:00 2014 (r275645) +++ head/sys/dev/usb/wlan/if_upgt.c Tue Dec 9 15:26:04 2014 (r275646) @@ -182,7 +182,7 @@ static const STRUCT_USB_HOST_ID upgt_dev UPGT_DEV(FSC, E5400), UPGT_DEV(GLOBESPAN, PRISM_GT_1), UPGT_DEV(GLOBESPAN, PRISM_GT_2), - UPGT_DEV(NETGEAR, WG111V2_2), + UPGT_DEV(NETGEAR, WG111V1_2), UPGT_DEV(INTERSIL, PRISM_GT), UPGT_DEV(SMC, 2862WG), UPGT_DEV(USR, USR5422), From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 16:39:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A6F5EED5; Tue, 9 Dec 2014 16:39:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90F37D02; Tue, 9 Dec 2014 16:39:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9GdOZv060038; Tue, 9 Dec 2014 16:39:24 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9GdMLe060022; Tue, 9 Dec 2014 16:39:22 GMT (envelope-from br@FreeBSD.org) Message-Id: <201412091639.sB9GdMLe060022@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 9 Dec 2014 16:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275647 - in head/sys: arm/altera/socfpga arm/conf boot/fdt/dts/arm dev/beri/virtio dev/beri/virtio/network dev/virtio/mmio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 16:39:24 -0000 Author: br Date: Tue Dec 9 16:39:21 2014 New Revision: 275647 URL: https://svnweb.freebsd.org/changeset/base/275647 Log: o Add BERI Virtio Networking Frontend (if_vtbe) o Move similar block/networking methods to common file o Follow r275640 and correct MMIO registers width o Pass value to MMIO platform_note method. Sponsored by: DARPA, AFRL Added: head/sys/dev/beri/virtio/network/ head/sys/dev/beri/virtio/network/if_vtbe.c (contents, props changed) Modified: head/sys/arm/altera/socfpga/files.socfpga head/sys/arm/conf/SOCKIT-BERI head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts head/sys/dev/beri/virtio/virtio.c head/sys/dev/beri/virtio/virtio.h head/sys/dev/beri/virtio/virtio_block.c head/sys/dev/beri/virtio/virtio_mmio_platform.c head/sys/dev/beri/virtio/virtio_mmio_platform.h head/sys/dev/virtio/mmio/virtio_mmio.c head/sys/dev/virtio/mmio/virtio_mmio_if.m Modified: head/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- head/sys/arm/altera/socfpga/files.socfpga Tue Dec 9 15:26:04 2014 (r275646) +++ head/sys/arm/altera/socfpga/files.socfpga Tue Dec 9 16:39:21 2014 (r275647) @@ -26,5 +26,6 @@ dev/mmc/host/dwmmc.c optional dwmmc # BERI specific dev/beri/beri_ring.c optional beri_ring dev/beri/beri_mem.c optional beri_mem -dev/beri/virtio/virtio.c optional beri_vtblk +dev/beri/virtio/virtio.c optional beri_vtblk | vtbe dev/beri/virtio/virtio_block.c optional beri_vtblk +dev/beri/virtio/network/if_vtbe.c optional vtbe Modified: head/sys/arm/conf/SOCKIT-BERI ============================================================================== --- head/sys/arm/conf/SOCKIT-BERI Tue Dec 9 15:26:04 2014 (r275646) +++ head/sys/arm/conf/SOCKIT-BERI Tue Dec 9 16:39:21 2014 (r275647) @@ -123,6 +123,7 @@ device spibus device beri_ring device beri_mem device beri_vtblk +device vtbe device altera_pio # Ethernet Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Tue Dec 9 15:26:04 2014 (r275646) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Tue Dec 9 16:39:21 2014 (r275647) @@ -39,7 +39,8 @@ compatible = "altr,socfpga-cyclone5", "altr,socfpga"; memreserve = < 0x00000000 0x1000 >, /* SMP trampoline */ - < 0x00001000 0x1000 >; /* virtio block */ + < 0x00001000 0x1000 >, /* virtio block */ + < 0x00002000 0x1000 >; /* virtio net */ memory { device_type = "memory"; @@ -111,6 +112,15 @@ pio-recv = <&pio0>; pio-send = <&pio1>; beri-mem = <&beri_mem0>; + status = "disabled"; + }; + + beri_vtnet: vtnet@00002000 { + compatible = "sri-cambridge,beri-vtnet"; + reg = <0x00002000 0x1000>; + pio-recv = <&pio0>; + pio-send = <&pio1>; + beri-mem = <&beri_mem0>; status = "okay"; }; Added: head/sys/dev/beri/virtio/network/if_vtbe.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/beri/virtio/network/if_vtbe.c Tue Dec 9 16:39:21 2014 (r275647) @@ -0,0 +1,655 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +/* + * BERI Virtio Networking Frontend + */ + +#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 +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include "pio_if.h" + +#define DPRINTF(fmt, args...) printf(fmt, ##args) + +#define READ4(_sc, _reg) \ + bus_read_4((_sc)->res[0], _reg) +#define WRITE4(_sc, _reg, _val) \ + bus_write_4((_sc)->res[0], _reg, _val) + +#define VTBE_LOCK(sc) mtx_lock(&(sc)->mtx) +#define VTBE_UNLOCK(sc) mtx_unlock(&(sc)->mtx) +#define VTBE_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED); +#define VTBE_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED); + +/* + * Driver data and defines. + */ +#define DESC_COUNT 256 + +struct vtbe_softc { + struct resource *res[2]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + device_t dev; + struct ifnet *ifp; + int if_flags; + struct mtx mtx; + boolean_t is_attached; + + int beri_mem_offset; + device_t pio_send; + device_t pio_recv; + int opened; + + struct vqueue_info vs_queues[2]; + int vs_curq; + int hdrsize; +}; + +static struct resource_spec vtbe_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static void vtbe_txfinish_locked(struct vtbe_softc *sc); +static void vtbe_rxfinish_locked(struct vtbe_softc *sc); +static void vtbe_stop_locked(struct vtbe_softc *sc); +static int pio_enable_irq(struct vtbe_softc *sc, int enable); + +static void +vtbe_txstart_locked(struct vtbe_softc *sc) +{ + struct virtio_net_hdr_mrg_rxbuf *vnh; + struct iovec iov[DESC_COUNT]; + struct vqueue_info *vq; + struct iovec *riov; + struct ifnet *ifp; + struct mbuf *m; + struct uio uio; + int enqueued; + int iolen; + int error; + int *addr; + int reg; + int len; + int n; + + VTBE_ASSERT_LOCKED(sc); + + /* RX queue */ + vq = &sc->vs_queues[0]; + if (!vq_has_descs(vq)) { + return; + } + + ifp = sc->ifp; + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + return; + } + + enqueued = 0; + + if (!vq_ring_ready(vq)) + return; + + vq->vq_save_used = be16toh(vq->vq_used->idx); + + for (;;) { + if (!vq_has_descs(vq)) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) { + break; + } + + n = vq_getchain(sc->beri_mem_offset, vq, iov, + DESC_COUNT, NULL); + + KASSERT(n >= 1 && n <= DESC_COUNT, + ("wrong descriptors num %d", n)); + + addr = iov[0].iov_base; + len = iov[0].iov_len; + + vnh = iov[0].iov_base; + memset(vnh, 0, sc->hdrsize); + vnh->num_buffers = htobe16(1); + + iov[0].iov_len -= sc->hdrsize; + iov[0].iov_base = (void *)((uintptr_t)iov[0].iov_base + + sc->hdrsize); + riov = &iov[0]; + + uio.uio_resid = iov[0].iov_len; + uio.uio_iov = riov; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_iovcnt = 1; + uio.uio_offset = 0; + uio.uio_rw = UIO_READ; + + error = m_mbuftouio(&uio, m, 0); + if (error) + panic("m_mbuftouio failed\n"); + + iolen = (len - iov[0].iov_len - sc->hdrsize); + vq_relchain(vq, iov, 0, iolen + sc->hdrsize); + paddr_unmap((void *)addr, len); + + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + + BPF_MTAP(ifp, m); + m_freem(m); + + ++enqueued; + } + + if (enqueued != 0) { + reg = htobe32(VIRTIO_MMIO_INT_VRING); + WRITE4(sc, VIRTIO_MMIO_INTERRUPT_STATUS, reg); + + PIO_SET(sc->pio_send, Q_INTR, 1); + } +} + +static void +vtbe_txstart(struct ifnet *ifp) +{ + struct vtbe_softc *sc = ifp->if_softc; + + VTBE_LOCK(sc); + vtbe_txstart_locked(sc); + VTBE_UNLOCK(sc); +} + +static void +vtbe_stop_locked(struct vtbe_softc *sc) +{ + struct ifnet *ifp; + + VTBE_ASSERT_LOCKED(sc); + + ifp = sc->ifp; + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); +} + +static void +vtbe_init_locked(struct vtbe_softc *sc) +{ + struct ifnet *ifp = sc->ifp; + + VTBE_ASSERT_LOCKED(sc); + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + return; + + ifp->if_drv_flags |= IFF_DRV_RUNNING; +} + +static void +vtbe_init(void *if_softc) +{ + struct vtbe_softc *sc = if_softc; + + VTBE_LOCK(sc); + vtbe_init_locked(sc); + VTBE_UNLOCK(sc); +} + +static int +vtbe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + struct ifmediareq *ifmr; + struct vtbe_softc *sc; + struct ifreq *ifr; + int mask, error; + + sc = ifp->if_softc; + ifr = (struct ifreq *)data; + + error = 0; + switch (cmd) { + case SIOCSIFFLAGS: + VTBE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + pio_enable_irq(sc, 1); + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + vtbe_init_locked(sc); + } + } else { + pio_enable_irq(sc, 0); + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + vtbe_stop_locked(sc); + } + } + sc->if_flags = ifp->if_flags; + VTBE_UNLOCK(sc); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + break; + case SIOCSIFMEDIA: + case SIOCGIFMEDIA: + ifmr = (struct ifmediareq *)data; + ifmr->ifm_count = 1; + ifmr->ifm_status = (IFM_AVALID | IFM_ACTIVE); + ifmr->ifm_active = (IFM_ETHER | IFM_10G_T | IFM_FDX); + ifmr->ifm_current = ifmr->ifm_active; + break; + case SIOCSIFCAP: + mask = ifp->if_capenable ^ ifr->ifr_reqcap; + if (mask & IFCAP_VLAN_MTU) { + ifp->if_capenable ^= IFCAP_VLAN_MTU; + } + break; + + case SIOCSIFADDR: + pio_enable_irq(sc, 1); + default: + error = ether_ioctl(ifp, cmd, data); + break; + } + + return (error); +} + +static void +vtbe_txfinish_locked(struct vtbe_softc *sc) +{ + struct ifnet *ifp; + + VTBE_ASSERT_LOCKED(sc); + + ifp = sc->ifp; +} + +static int +vq_init(struct vtbe_softc *sc) +{ + struct vqueue_info *vq; + uint8_t *base; + int size; + int reg; + int pfn; + + vq = &sc->vs_queues[sc->vs_curq]; + vq->vq_qsize = DESC_COUNT; + + reg = READ4(sc, VIRTIO_MMIO_QUEUE_PFN); + pfn = be32toh(reg); + vq->vq_pfn = pfn; + + size = vring_size(vq->vq_qsize, VRING_ALIGN); + base = paddr_map(sc->beri_mem_offset, + (pfn << PAGE_SHIFT), size); + + /* First pages are descriptors */ + vq->vq_desc = (struct vring_desc *)base; + base += vq->vq_qsize * sizeof(struct vring_desc); + + /* Then avail ring */ + vq->vq_avail = (struct vring_avail *)base; + base += (2 + vq->vq_qsize + 1) * sizeof(uint16_t); + + /* Then it's rounded up to the next page */ + base = (uint8_t *)roundup2((uintptr_t)base, VRING_ALIGN); + + /* And the last pages are the used ring */ + vq->vq_used = (struct vring_used *)base; + + /* Mark queue as allocated, and start at 0 when we use it. */ + vq->vq_flags = VQ_ALLOC; + vq->vq_last_avail = 0; + + return (0); +} + +static void +vtbe_proc_rx(struct vtbe_softc *sc, struct vqueue_info *vq) +{ + struct iovec iov[DESC_COUNT]; + struct ifnet *ifp; + struct uio uio; + struct mbuf *m; + int iolen; + int i; + int n; + + ifp = sc->ifp; + + n = vq_getchain(sc->beri_mem_offset, vq, iov, + DESC_COUNT, NULL); + + KASSERT(n >= 1 && n <= DESC_COUNT, + ("wrong n %d", n)); + + iolen = 0; + for (i = 1; i < n; i++) { + iolen += iov[i].iov_len; + } + + uio.uio_resid = iolen; + uio.uio_iov = &iov[1]; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_iovcnt = (n - 1); + uio.uio_rw = UIO_WRITE; + + if ((m = m_uiotombuf(&uio, M_NOWAIT, 0, ETHER_ALIGN, + M_PKTHDR)) == NULL) { + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + goto done; + } + + m->m_pkthdr.rcvif = ifp; + + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); + + CURVNET_SET(ifp->if_vnet); + VTBE_UNLOCK(sc); + (*ifp->if_input)(ifp, m); + VTBE_LOCK(sc); + CURVNET_RESTORE(); + +done: + vq_relchain(vq, iov, n, iolen + sc->hdrsize); +} + +static void +vtbe_rxfinish_locked(struct vtbe_softc *sc) +{ + struct vqueue_info *vq; + int reg; + + /* TX queue */ + vq = &sc->vs_queues[1]; + if (!vq_ring_ready(vq)) + return; + + /* Process new descriptors */ + vq->vq_save_used = be16toh(vq->vq_used->idx); + + while (vq_has_descs(vq)) { + vtbe_proc_rx(sc, vq); + } + + /* Interrupt the other side */ + reg = htobe32(VIRTIO_MMIO_INT_VRING); + WRITE4(sc, VIRTIO_MMIO_INTERRUPT_STATUS, reg); + + PIO_SET(sc->pio_send, Q_INTR, 1); +} + +static void +vtbe_intr(void *arg) +{ + struct vtbe_softc *sc; + int pending; + uint32_t reg; + + sc = arg; + + VTBE_LOCK(sc); + + reg = PIO_READ(sc->pio_recv); + + /* Ack */ + PIO_SET(sc->pio_recv, reg, 0); + + pending = htobe32(reg); + if (pending & Q_SEL) { + reg = READ4(sc, VIRTIO_MMIO_QUEUE_SEL); + sc->vs_curq = be32toh(reg); + } + + if (pending & Q_PFN) { + vq_init(sc); + } + + if (pending & Q_NOTIFY) { + /* beri rx / arm tx notify */ + vtbe_txfinish_locked(sc); + } + + if (pending & Q_NOTIFY1) { + vtbe_rxfinish_locked(sc); + } + + VTBE_UNLOCK(sc); +} + +static int +vtbe_get_hwaddr(struct vtbe_softc *sc, uint8_t *hwaddr) +{ + int rnd; + + /* + * Generate MAC address, use 'bsd' + random 24 low-order bits. + */ + + rnd = arc4random() & 0x00ffffff; + + hwaddr[0] = 'b'; + hwaddr[1] = 's'; + hwaddr[2] = 'd'; + hwaddr[3] = rnd >> 16; + hwaddr[4] = rnd >> 8; + hwaddr[5] = rnd >> 0; + + return (0); +} + +static int +pio_enable_irq(struct vtbe_softc *sc, int enable) +{ + + /* + * IRQ lines should be disabled while reprogram FPGA core. + */ + + if (enable) { + if (sc->opened == 0) { + sc->opened = 1; + PIO_SETUP_IRQ(sc->pio_recv, vtbe_intr, sc); + } + } else { + if (sc->opened == 1) { + PIO_TEARDOWN_IRQ(sc->pio_recv); + sc->opened = 0; + } + } + + return (0); +} + +static int +vtbe_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "sri-cambridge,beri-vtnet")) + return (ENXIO); + + device_set_desc(dev, "Virtio BERI Ethernet Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +vtbe_attach(device_t dev) +{ + uint8_t macaddr[ETHER_ADDR_LEN]; + struct vtbe_softc *sc; + struct ifnet *ifp; + int reg; + + sc = device_get_softc(dev); + sc->dev = dev; + + sc->hdrsize = sizeof(struct virtio_net_hdr_mrg_rxbuf); + + if (bus_alloc_resources(dev, vtbe_spec, sc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + /* Memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + mtx_init(&sc->mtx, device_get_nameunit(sc->dev), + MTX_NETWORK_LOCK, MTX_DEF); + + if (setup_offset(dev, &sc->beri_mem_offset) != 0) + return (ENXIO); + if (setup_pio(dev, "pio-send", &sc->pio_send) != 0) + return (ENXIO); + if (setup_pio(dev, "pio-recv", &sc->pio_recv) != 0) + return (ENXIO); + + /* Setup MMIO */ + + /* Specify that we provide network device */ + reg = htobe32(VIRTIO_ID_NETWORK); + WRITE4(sc, VIRTIO_MMIO_DEVICE_ID, reg); + + /* The number of desc we support */ + reg = htobe32(DESC_COUNT); + WRITE4(sc, VIRTIO_MMIO_QUEUE_NUM_MAX, reg); + + /* Our features */ + reg = htobe32(VIRTIO_NET_F_MAC | + VIRTIO_NET_F_MRG_RXBUF | + VIRTIO_F_NOTIFY_ON_EMPTY); + WRITE4(sc, VIRTIO_MMIO_HOST_FEATURES, reg); + + /* Get MAC */ + if (vtbe_get_hwaddr(sc, macaddr)) { + device_printf(sc->dev, "can't get mac\n"); + return (ENXIO); + } + + /* Set up the ethernet interface. */ + sc->ifp = ifp = if_alloc(IFT_ETHER); + ifp->if_baudrate = IF_Gbps(10); + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX | + IFF_MULTICAST | IFF_PROMISC); + ifp->if_capabilities = IFCAP_VLAN_MTU; + ifp->if_capenable = ifp->if_capabilities; + ifp->if_start = vtbe_txstart; + ifp->if_ioctl = vtbe_ioctl; + ifp->if_init = vtbe_init; + IFQ_SET_MAXLEN(&ifp->if_snd, DESC_COUNT - 1); + ifp->if_snd.ifq_drv_maxlen = DESC_COUNT - 1; + IFQ_SET_READY(&ifp->if_snd); + ifp->if_hdrlen = sizeof(struct ether_vlan_header); + + /* All ready to run, attach the ethernet interface. */ + ether_ifattach(ifp, macaddr); + + sc->is_attached = true; + + return (0); +} + +static device_method_t vtbe_methods[] = { + DEVMETHOD(device_probe, vtbe_probe), + DEVMETHOD(device_attach, vtbe_attach), + + { 0, 0 } +}; + +static driver_t vtbe_driver = { + "vtbe", + vtbe_methods, + sizeof(struct vtbe_softc), +}; + +static devclass_t vtbe_devclass; + +DRIVER_MODULE(vtbe, simplebus, vtbe_driver, vtbe_devclass, 0, 0); +MODULE_DEPEND(vtbe, ether, 1, 1, 1); Modified: head/sys/dev/beri/virtio/virtio.c ============================================================================== --- head/sys/dev/beri/virtio/virtio.c Tue Dec 9 15:26:04 2014 (r275646) +++ head/sys/dev/beri/virtio/virtio.c Tue Dec 9 16:39:21 2014 (r275647) @@ -58,10 +58,18 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include + #include #include #include #include +#include + +#include "pio_if.h" int vq_ring_ready(struct vqueue_info *vq) @@ -167,12 +175,13 @@ vq_relchain(struct vqueue_info *vq, stru int i; mask = vq->vq_qsize - 1; + vu = vq->vq_used; head = be16toh(vq->vq_avail->ring[vq->vq_last_avail++ & mask]); - vu = vq->vq_used; uidx = be16toh(vu->idx); vue = &vu->ring[uidx++ & mask]; - vue->id = htobe16(head); + vue->id = htobe32(head); + vue->len = htobe32(iolen); vu->idx = htobe16(uidx); @@ -181,3 +190,59 @@ vq_relchain(struct vqueue_info *vq, stru paddr_unmap((void *)iov[i].iov_base, iov[i].iov_len); } } + +int +setup_pio(device_t dev, char *name, device_t *pio_dev) +{ + phandle_t pio_node; + struct fdt_ic *ic; + phandle_t xref; + phandle_t node; + + if ((node = ofw_bus_get_node(dev)) == -1) + return (ENXIO); + + if (OF_searchencprop(node, name, &xref, + sizeof(xref)) == -1) { + return (ENXIO); + } + + pio_node = OF_node_from_xref(xref); + SLIST_FOREACH(ic, &fdt_ic_list_head, fdt_ics) { + if (ic->iph == pio_node) { + *pio_dev = ic->dev; + PIO_CONFIGURE(*pio_dev, PIO_OUT_ALL, + PIO_UNMASK_ALL); + return (0); + } + } + + return (ENXIO); +} + +int +setup_offset(device_t dev, uint32_t *offset) +{ + pcell_t dts_value[2]; + phandle_t mem_node; + phandle_t xref; + phandle_t node; + int len; + + if ((node = ofw_bus_get_node(dev)) == -1) + return (ENXIO); + + if (OF_searchencprop(node, "beri-mem", &xref, + sizeof(xref)) == -1) { + return (ENXIO); + } + + mem_node = OF_node_from_xref(xref); + if ((len = OF_getproplen(mem_node, "reg")) <= 0) + return (ENXIO); + OF_getencprop(mem_node, "reg", dts_value, len); + *offset = dts_value[0]; + + return (0); +} + Modified: head/sys/dev/beri/virtio/virtio.h ============================================================================== --- head/sys/dev/beri/virtio/virtio.h Tue Dec 9 15:26:04 2014 (r275646) +++ head/sys/dev/beri/virtio/virtio.h Tue Dec 9 16:39:21 2014 (r275647) @@ -41,14 +41,10 @@ #define PAGE_SHIFT 12 #define VRING_ALIGN 4096 -#define NUM_QUEUES 1 #define VQ_ALLOC 0x01 /* set once we have a pfn */ #define VQ_MAX_DESCRIPTORS 512 -#define VTBLK_BLK_ID_BYTES 20 -#define VTBLK_MAXSEGS 256 - struct vqueue_info { uint16_t vq_qsize; /* size of this queue (a power of 2) */ uint16_t vq_num; @@ -70,3 +66,5 @@ int vq_getchain(uint32_t beri_mem_offset struct iovec *iov, int n_iov, uint16_t *flags); void vq_relchain(struct vqueue_info *vq, struct iovec *iov, int n, uint32_t iolen); +int setup_pio(device_t dev, char *name, device_t *pio_dev); +int setup_offset(device_t dev, uint32_t *offset); Modified: head/sys/dev/beri/virtio/virtio_block.c ============================================================================== --- head/sys/dev/beri/virtio/virtio_block.c Tue Dec 9 15:26:04 2014 (r275646) +++ head/sys/dev/beri/virtio/virtio_block.c Tue Dec 9 16:39:21 2014 (r275647) @@ -74,6 +74,13 @@ __FBSDID("$FreeBSD$"); #define DPRINTF(fmt, ...) +/* We use indirect descriptors */ +#define NUM_DESCS 1 +#define NUM_QUEUES 1 + +#define VTBLK_BLK_ID_BYTES 20 +#define VTBLK_MAXSEGS 256 + struct beri_vtblk_softc { struct resource *res[1]; bus_space_tag_t bst; @@ -286,8 +293,12 @@ vtblk_notify(struct beri_vtblk_softc *sc while (vq_has_descs(vq)) vtblk_proc(sc, vq); - /* Interrupt other side */ - PIO_SET(sc->pio_send, Q_INTR, 1); + /* Interrupt the other side */ + if ((be16toh(vq->vq_avail->flags) & VRING_AVAIL_F_NO_INTERRUPT) == 0) { + reg = htobe32(VIRTIO_MMIO_INT_VRING); + WRITE4(sc, VIRTIO_MMIO_INTERRUPT_STATUS, reg); + PIO_SET(sc->pio_send, Q_INTR, 1); + } return (0); } @@ -302,7 +313,7 @@ vq_init(struct beri_vtblk_softc *sc) int pfn; vq = &sc->vs_queues[0]; - vq->vq_qsize = NUM_QUEUES; + vq->vq_qsize = NUM_DESCS; reg = READ4(sc, VIRTIO_MMIO_QUEUE_PFN); pfn = be32toh(reg); @@ -353,61 +364,6 @@ vtblk_thread(void *arg) } static int -setup_pio(struct beri_vtblk_softc *sc, char *name, device_t *dev) -{ - phandle_t pio_node; - struct fdt_ic *ic; - phandle_t xref; - phandle_t node; - - if ((node = ofw_bus_get_node(sc->dev)) == -1) - return (ENXIO); - - if (OF_searchencprop(node, name, &xref, - sizeof(xref)) == -1) { - return (ENXIO); - } - - pio_node = OF_node_from_xref(xref); - SLIST_FOREACH(ic, &fdt_ic_list_head, fdt_ics) { - if (ic->iph == pio_node) { - *dev = ic->dev; - PIO_CONFIGURE(*dev, PIO_OUT_ALL, - PIO_UNMASK_ALL); - return (0); - } - } - - return (ENXIO); -} - -static int -setup_offset(struct beri_vtblk_softc *sc) -{ - pcell_t dts_value[2]; - phandle_t mem_node; - phandle_t xref; - phandle_t node; - int len; - - if ((node = ofw_bus_get_node(sc->dev)) == -1) - return (ENXIO); - - if (OF_searchencprop(node, "beri-mem", &xref, - sizeof(xref)) == -1) { - return (ENXIO); - } - - mem_node = OF_node_from_xref(xref); - if ((len = OF_getproplen(mem_node, "reg")) <= 0) - return (ENXIO); - OF_getencprop(mem_node, "reg", dts_value, len); - sc->beri_mem_offset = dts_value[0]; - - return (0); -} - -static int backend_info(struct beri_vtblk_softc *sc) { struct virtio_blk_config *cfg; @@ -419,9 +375,9 @@ backend_info(struct beri_vtblk_softc *sc reg = htobe32(VIRTIO_ID_BLOCK); WRITE4(sc, VIRTIO_MMIO_DEVICE_ID, reg); - /* The number of queues we support */ - reg = htobe16(NUM_QUEUES); - WRITE2(sc, VIRTIO_MMIO_QUEUE_NUM, reg); + /* Queue size */ + reg = htobe32(NUM_DESCS); + WRITE4(sc, VIRTIO_MMIO_QUEUE_NUM_MAX, reg); /* Our features */ reg = htobe32(VIRTIO_RING_F_INDIRECT_DESC @@ -566,11 +522,11 @@ beri_vtblk_attach(device_t dev) return (ENXIO); } - if (setup_offset(sc) != 0) + if (setup_offset(dev, &sc->beri_mem_offset) != 0) return (ENXIO); - if (setup_pio(sc, "pio-send", &sc->pio_send) != 0) + if (setup_pio(dev, "pio-send", &sc->pio_send) != 0) return (ENXIO); - if (setup_pio(sc, "pio-recv", &sc->pio_recv) != 0) + if (setup_pio(dev, "pio-recv", &sc->pio_recv) != 0) return (ENXIO); sc->cdev = make_dev(&beri_cdevsw, 0, UID_ROOT, GID_WHEEL, Modified: head/sys/dev/beri/virtio/virtio_mmio_platform.c ============================================================================== --- head/sys/dev/beri/virtio/virtio_mmio_platform.c Tue Dec 9 15:26:04 2014 (r275646) +++ head/sys/dev/beri/virtio/virtio_mmio_platform.c Tue Dec 9 16:39:21 2014 (r275647) @@ -149,20 +149,49 @@ virtio_mmio_platform_attach(device_t dev } static int -platform_note(device_t dev, size_t offset) +platform_note(device_t dev, size_t offset, int val) { struct virtio_mmio_platform_softc *sc; + int note; + int i; sc = device_get_softc(dev); - if (offset == VIRTIO_MMIO_QUEUE_NOTIFY) { - mips_dcache_wbinv_all(); - PIO_SET(sc->pio_send, Q_NOTIFY, 1); + switch (offset) { + case (VIRTIO_MMIO_QUEUE_NOTIFY): + if (val == 0) + note = Q_NOTIFY; + else if (val == 1) + note = Q_NOTIFY1; + break; + case (VIRTIO_MMIO_QUEUE_PFN): + note = Q_PFN; + break; + case (VIRTIO_MMIO_QUEUE_SEL): + note = Q_SEL; + break; + default: + note = 0; } - if (offset == VIRTIO_MMIO_QUEUE_PFN) { + if (note) { mips_dcache_wbinv_all(); - PIO_SET(sc->pio_send, Q_PFN, 1); + + PIO_SET(sc->pio_send, note, 1); + + /* + * Wait until host ack the request. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 17:03:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AEABF94C; Tue, 9 Dec 2014 17:03:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F7C06D; Tue, 9 Dec 2014 17:03:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9H3FXG074165; Tue, 9 Dec 2014 17:03:15 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9H3Fct074164; Tue, 9 Dec 2014 17:03:15 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201412091703.sB9H3Fct074164@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Tue, 9 Dec 2014 17:03:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275648 - stable/10/sys/arm/ti X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 17:03:15 -0000 Author: rpaulo Date: Tue Dec 9 17:03:14 2014 New Revision: 275648 URL: https://svnweb.freebsd.org/changeset/base/275648 Log: MFC r275376: Allow multiple devices to mmap. It's impossible to prevent this with checks on the open/close functions. Modified: stable/10/sys/arm/ti/ti_pruss.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/ti/ti_pruss.c ============================================================================== --- stable/10/sys/arm/ti/ti_pruss.c Tue Dec 9 16:39:21 2014 (r275647) +++ stable/10/sys/arm/ti/ti_pruss.c Tue Dec 9 17:03:14 2014 (r275648) @@ -67,7 +67,6 @@ static device_attach_t ti_pruss_attach; static device_detach_t ti_pruss_detach; static void ti_pruss_intr(void *); static d_open_t ti_pruss_open; -static d_close_t ti_pruss_close; static d_mmap_t ti_pruss_mmap; static void ti_pruss_kq_read_detach(struct knote *); static int ti_pruss_kq_read_event(struct knote *, long); @@ -83,14 +82,12 @@ struct ti_pruss_softc { bus_space_handle_t sc_bh; struct cdev *sc_pdev; struct selinfo sc_selinfo; - uint32_t sc_inuse; }; static struct cdevsw ti_pruss_cdevsw = { .d_version = D_VERSION, .d_name = "ti_pruss", .d_open = ti_pruss_open, - .d_close = ti_pruss_close, .d_mmap = ti_pruss_mmap, .d_kqfilter = ti_pruss_kqfilter, }; @@ -187,11 +184,11 @@ ti_pruss_attach(device_t dev) for (i = 0; i < TI_PRUSS_IRQS; i++) { ti_pruss_irq_args[i].irq = i; ti_pruss_irq_args[i].sc = sc; - if (bus_setup_intr(dev, sc->sc_irq_res[i], + if (bus_setup_intr(dev, sc->sc_irq_res[i], INTR_MPSAFE | INTR_TYPE_MISC, - NULL, ti_pruss_intr, &ti_pruss_irq_args[i], + NULL, ti_pruss_intr, &ti_pruss_irq_args[i], &sc->sc_intr[i]) != 0) { - device_printf(dev, + device_printf(dev, "unable to setup the interrupt handler\n"); ti_pruss_detach(dev); return (ENXIO); @@ -220,7 +217,7 @@ ti_pruss_detach(device_t dev) if (sc->sc_intr[i]) bus_teardown_intr(dev, sc->sc_irq_res[i], sc->sc_intr[i]); if (sc->sc_irq_res[i]) - bus_release_resource(dev, SYS_RES_IRQ, + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->sc_irq_res[i]), sc->sc_irq_res[i]); } @@ -246,25 +243,9 @@ ti_pruss_intr(void *arg) } static int -ti_pruss_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) +ti_pruss_open(struct cdev *cdev __unused, int oflags __unused, + int devtype __unused, struct thread *td __unused) { - device_t dev = cdev->si_drv1; - struct ti_pruss_softc *sc = device_get_softc(dev); - - if (atomic_cmpset_32(&sc->sc_inuse, 0, 1) == 0) - return (EBUSY); - else - return (0); -} - -static int -ti_pruss_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) -{ - device_t dev = cdev->si_drv1; - struct ti_pruss_softc *sc = device_get_softc(dev); - - sc->sc_inuse = 0; - return (0); } From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 18:03:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 75D89FFF; Tue, 9 Dec 2014 18:03:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60787A9B; Tue, 9 Dec 2014 18:03:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9I3REs005721; Tue, 9 Dec 2014 18:03:27 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9I3QkM005715; Tue, 9 Dec 2014 18:03:26 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201412091803.sB9I3QkM005715@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Tue, 9 Dec 2014 18:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275649 - in head/sys: conf dev/xen/pci x86/xen xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 18:03:27 -0000 Author: royger Date: Tue Dec 9 18:03:25 2014 New Revision: 275649 URL: https://svnweb.freebsd.org/changeset/base/275649 Log: xen: create a new PCI bus override When running as a Xen PVH Dom0 we need to add custom buses that override some of the functionality present in the ACPI PCI Bus and the PCI Bus. We currently override the ACPI PCI Bus, but not the PCI Bus, so add a new override for the PCI Bus and share the generic functions between them. Reported by: David P. Discher Sponsored by: Citrix Systems R&D conf/files.amd64: - Add the new files. x86/xen/xen_pci_bus.c: - Generic file that contains the PCI overrides so they can be used by the several PCI specific buses. xen/xen_pci.h: - Prototypes for the generic overried functions. dev/xen/pci/xen_pci.c: - Xen specific override for the PCI bus. dev/xen/pci/xen_acpi_pci.c: - Xen specific override for the ACPI PCI bus. Added: head/sys/dev/xen/pci/ head/sys/dev/xen/pci/xen_acpi_pci.c (contents, props changed) head/sys/dev/xen/pci/xen_pci.c (contents, props changed) head/sys/x86/xen/xen_pci_bus.c - copied, changed from r275647, head/sys/x86/xen/xen_pci.c head/sys/xen/xen_pci.h (contents, props changed) Deleted: head/sys/x86/xen/xen_pci.c Modified: head/sys/conf/files.amd64 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Dec 9 17:03:14 2014 (r275648) +++ head/sys/conf/files.amd64 Tue Dec 9 18:03:25 2014 (r275649) @@ -336,6 +336,8 @@ dev/viawd/viawd.c optional viawd dev/vmware/vmxnet3/if_vmx.c optional vmx dev/wbwd/wbwd.c optional wbwd dev/wpi/if_wpi.c optional wpi +dev/xen/pci/xen_acpi_pci.c optional xenhvm +dev/xen/pci/xen_pci.c optional xenhvm dev/isci/isci.c optional isci dev/isci/isci_controller.c optional isci dev/isci/isci_domain.c optional isci @@ -572,4 +574,4 @@ x86/xen/xen_apic.c optional xenhvm x86/xen/xenpv.c optional xenhvm x86/xen/xen_nexus.c optional xenhvm x86/xen/xen_msi.c optional xenhvm -x86/xen/xen_pci.c optional xenhvm +x86/xen/xen_pci_bus.c optional xenhvm Added: head/sys/dev/xen/pci/xen_acpi_pci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xen/pci/xen_acpi_pci.c Tue Dec 9 18:03:25 2014 (r275649) @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2014 Roger Pau Monné + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "pcib_if.h" +#include "pci_if.h" + +static int +xen_acpi_pci_probe(device_t dev) +{ + + if (!xen_pv_domain()) + return (ENXIO); + if (acpi_get_handle(dev) == NULL) + return (ENXIO); + + device_set_desc(dev, "Xen ACPI PCI bus"); + + return (BUS_PROBE_SPECIFIC); +} + +static device_method_t xen_acpi_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, xen_acpi_pci_probe), + + /* PCI interface overwrites */ + DEVMETHOD(pci_enable_msi, xen_pci_enable_msi_method), + DEVMETHOD(pci_disable_msi, xen_pci_disable_msi_method), + DEVMETHOD(pci_child_added, xen_pci_child_added_method), + + DEVMETHOD_END +}; + +static devclass_t pci_devclass; + +DECLARE_CLASS(acpi_pci_driver); +DEFINE_CLASS_1(pci, xen_acpi_pci_driver, xen_acpi_pci_methods, + sizeof(struct pci_softc), acpi_pci_driver); +DRIVER_MODULE(xen_acpi_pci, pcib, xen_acpi_pci_driver, pci_devclass, 0, 0); +MODULE_DEPEND(xen_acpi_pci, pci, 1, 1, 1); +MODULE_DEPEND(xen_acpi_pci, acpi, 1, 1, 1); +MODULE_VERSION(xen_acpi_pci, 1); Added: head/sys/dev/xen/pci/xen_pci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xen/pci/xen_pci.c Tue Dec 9 18:03:25 2014 (r275649) @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2014 Roger Pau Monné + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "pcib_if.h" +#include "pci_if.h" + +static int +xen_pci_probe(device_t dev) +{ + + if (!xen_pv_domain()) + return (ENXIO); + + device_set_desc(dev, "Xen PCI bus"); + + return (BUS_PROBE_DEFAULT); +} + +static device_method_t xen_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, xen_pci_probe), + + /* PCI interface overwrites */ + DEVMETHOD(pci_enable_msi, xen_pci_enable_msi_method), + DEVMETHOD(pci_disable_msi, xen_pci_disable_msi_method), + DEVMETHOD(pci_child_added, xen_pci_child_added_method), + + DEVMETHOD_END +}; + +static devclass_t pci_devclass; + +DECLARE_CLASS(pci_driver); +DEFINE_CLASS_1(pci, xen_pci_driver, xen_pci_methods, sizeof(struct pci_softc), + pci_driver); +DRIVER_MODULE(xen_pci, pcib, xen_pci_driver, pci_devclass, 0, 0); +MODULE_DEPEND(xen_pci, pci, 1, 1, 1); +MODULE_VERSION(xen_pci, 1); Copied and modified: head/sys/x86/xen/xen_pci_bus.c (from r275647, head/sys/x86/xen/xen_pci.c) ============================================================================== --- head/sys/x86/xen/xen_pci.c Tue Dec 9 16:39:21 2014 (r275647, copy source) +++ head/sys/x86/xen/xen_pci_bus.c Tue Dec 9 18:03:25 2014 (r275649) @@ -31,8 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include @@ -41,52 +39,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "pcib_if.h" #include "pci_if.h" -static int xen_pci_probe(device_t dev); - -static void xen_pci_enable_msi_method(device_t dev, device_t child, - uint64_t address, uint16_t data); -static void xen_pci_disable_msi_method(device_t dev, device_t child); -static void xen_pci_child_added_method(device_t dev, device_t child); - -static device_method_t xen_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, xen_pci_probe), - - /* PCI interface overwrites */ - DEVMETHOD(pci_enable_msi, xen_pci_enable_msi_method), - DEVMETHOD(pci_disable_msi, xen_pci_disable_msi_method), - DEVMETHOD(pci_child_added, xen_pci_child_added_method), - - DEVMETHOD_END -}; - -static devclass_t pci_devclass; - -DECLARE_CLASS(acpi_pci_driver); -DEFINE_CLASS_1(pci, xen_pci_driver, xen_pci_methods, sizeof(struct pci_softc), - acpi_pci_driver); -DRIVER_MODULE(xen_pci, pcib, xen_pci_driver, pci_devclass, 0, 0); -MODULE_DEPEND(xen_pci, pci, 1, 1, 1); -MODULE_DEPEND(xen_pci, acpi, 1, 1, 1); -MODULE_VERSION(xen_pci, 1); - -static int -xen_pci_probe(device_t dev) -{ - - device_set_desc(dev, "Xen PCI bus"); - - if (!xen_pv_domain()) - return (ENXIO); - - return (BUS_PROBE_SPECIFIC); -} - -static void +void xen_pci_enable_msi_method(device_t dev, device_t child, uint64_t address, uint16_t data) { @@ -99,7 +57,7 @@ xen_pci_enable_msi_method(device_t dev, msi->msi_ctrl, 2); } -static void +void xen_pci_disable_msi_method(device_t dev, device_t child) { struct pci_devinfo *dinfo = device_get_ivars(child); @@ -110,7 +68,7 @@ xen_pci_disable_msi_method(device_t dev, msi->msi_ctrl, 2); } -static void +void xen_pci_child_added_method(device_t dev, device_t child) { struct pci_devinfo *dinfo; Added: head/sys/xen/xen_pci.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/xen_pci.h Tue Dec 9 18:03:25 2014 (r275649) @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014 Roger Pau Monné + * 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$ + */ + +#ifndef __XEN_PCI_H__ +#define __XEN_PCI_H__ + +void xen_pci_enable_msi_method(device_t dev, device_t child, uint64_t address, + uint16_t data); +void xen_pci_disable_msi_method(device_t dev, device_t child); +void xen_pci_child_added_method(device_t dev, device_t child); + +#endif /* !__XEN_PCI_H__ */ From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 19:50:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4476E1DD; Tue, 9 Dec 2014 19:50:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3101AB89; Tue, 9 Dec 2014 19:50:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9JopPe059735; Tue, 9 Dec 2014 19:50:51 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9JopEL059734; Tue, 9 Dec 2014 19:50:51 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201412091950.sB9JopEL059734@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Tue, 9 Dec 2014 19:50:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275650 - head/usr.sbin/mtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 19:50:51 -0000 Author: sjg Date: Tue Dec 9 19:50:50 2014 New Revision: 275650 URL: https://svnweb.freebsd.org/changeset/base/275650 Log: -u and -U are supposed to affect existing files too. Reviewed by: marcel Modified: head/usr.sbin/mtree/verify.c Modified: head/usr.sbin/mtree/verify.c ============================================================================== --- head/usr.sbin/mtree/verify.c Tue Dec 9 18:03:25 2014 (r275649) +++ head/usr.sbin/mtree/verify.c Tue Dec 9 19:50:50 2014 (r275650) @@ -233,7 +233,7 @@ miss(NODE *p, char *tail) miss(p->child, tp + 1); *tp = '\0'; - if (!create) + if (!create && !uflag) continue; if (chown(path, p->st_uid, p->st_gid) == -1) { serr = errno; From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 20:04:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A80E598; Tue, 9 Dec 2014 20:04:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B8A3CBB; Tue, 9 Dec 2014 20:04:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9K4RME066697; Tue, 9 Dec 2014 20:04:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9K4R5C066696; Tue, 9 Dec 2014 20:04:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412092004.sB9K4R5C066696@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 9 Dec 2014 20:04:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275651 - head/contrib/llvm/patches X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 20:04:27 -0000 Author: dim Date: Tue Dec 9 20:04:26 2014 New Revision: 275651 URL: https://svnweb.freebsd.org/changeset/base/275651 Log: Add llvm patch corresponding to r275633. Added: head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff Added: head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff Tue Dec 9 20:04:26 2014 (r275651) @@ -0,0 +1,71 @@ +Pull in r223171 from upstream llvm trunk (by Michael Zolotukhin): + + PR21302. Vectorize only bottom-tested loops. + + rdar://problem/18886083 + +This fixes a bug in the llvm vectorizer, which could sometimes cause +vectorized loops to perform an additional iteration, leading to possible +buffer overruns. Symptoms of this, which are usually segfaults, were +first noticed when building gcc ports, here: + +https://lists.freebsd.org/pipermail/freebsd-ports/2014-September/095466.html +https://lists.freebsd.org/pipermail/freebsd-toolchain/2014-September/001211.html + +Introduced here: http://svnweb.freebsd.org/changeset/base/275633 + +Index: lib/Transforms/Vectorize/LoopVectorize.cpp +=================================================================== +--- lib/Transforms/Vectorize/LoopVectorize.cpp (revision 21) ++++ lib/Transforms/Vectorize/LoopVectorize.cpp (revision 22) +@@ -2864,6 +2864,14 @@ bool LoopVectorizationLegality::canVectorize() { + if (!TheLoop->getExitingBlock()) + return false; + ++ // We only handle bottom-tested loops, i.e. loop in which the condition is ++ // checked at the end of each iteration. With that we can assume that all ++ // instructions in the loop are executed the same number of times. ++ if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch()) { ++ DEBUG(dbgs() << "LV: loop control flow is not understood by vectorizer\n"); ++ return false; ++ } ++ + // We need to have a loop header. + DEBUG(dbgs() << "LV: Found a loop: " << + TheLoop->getHeader()->getName() << '\n'); +Index: test/Transforms/LoopVectorize/loop-form.ll +=================================================================== +--- test/Transforms/LoopVectorize/loop-form.ll (revision 0) ++++ test/Transforms/LoopVectorize/loop-form.ll (revision 22) +@@ -0,0 +1,31 @@ ++; RUN: opt -S -loop-vectorize < %s | FileCheck %s ++target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" ++ ++; Check that we vectorize only bottom-tested loops. ++; This is a reduced testcase from PR21302. ++; ++; rdar://problem/18886083 ++ ++%struct.X = type { i32, i16 } ++; CHECK-LABEL: @foo( ++; CHECK-NOT: vector.body ++ ++define void @foo(i32 %n) { ++entry: ++ br label %for.cond ++ ++for.cond: ++ %i = phi i32 [ 0, %entry ], [ %inc, %for.body ] ++ %cmp = icmp slt i32 %i, %n ++ br i1 %cmp, label %for.body, label %if.end ++ ++for.body: ++ %iprom = sext i32 %i to i64 ++ %b = getelementptr inbounds %struct.X* undef, i64 %iprom, i32 1 ++ store i16 0, i16* %b, align 4 ++ %inc = add nsw i32 %i, 1 ++ br label %for.cond ++ ++if.end: ++ ret void ++} From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 20:36:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 878B5AF; Tue, 9 Dec 2014 20:36:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A3A072; Tue, 9 Dec 2014 20:36:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9Ka8Sc082746; Tue, 9 Dec 2014 20:36:08 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9Ka7dO082744; Tue, 9 Dec 2014 20:36:07 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201412092036.sB9Ka7dO082744@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Tue, 9 Dec 2014 20:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275653 - head/usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 20:36:08 -0000 Author: brd (doc committer) Date: Tue Dec 9 20:36:07 2014 New Revision: 275653 URL: https://svnweb.freebsd.org/changeset/base/275653 Log: Add more tests for pw(8) useradd. PR: 195832 Submitted by: Robert O'Neil Approved by: will Added: head/usr.sbin/pw/tests/pw_add.sh (contents, props changed) Modified: head/usr.sbin/pw/tests/Makefile Modified: head/usr.sbin/pw/tests/Makefile ============================================================================== --- head/usr.sbin/pw/tests/Makefile Tue Dec 9 20:05:05 2014 (r275652) +++ head/usr.sbin/pw/tests/Makefile Tue Dec 9 20:36:07 2014 (r275653) @@ -5,8 +5,9 @@ TESTSRC= ${.CURDIR}/../../../contrib/net TESTSDIR= ${TESTSBASE}/usr.sbin/pw -ATF_TESTS_SH= pw_delete pw_lock pw_modify pw_etcdir +ATF_TESTS_SH= pw_add pw_delete pw_etcdir pw_lock pw_modify +TEST_METADATA.pw_add+= required_user="root" TEST_METADATA.pw_delete+= required_user="root" TEST_METADATA.pw_modify+= required_user="root" Added: head/usr.sbin/pw/tests/pw_add.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/pw_add.sh Tue Dec 9 20:36:07 2014 (r275653) @@ -0,0 +1,40 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +# Test add user +atf_test_case user_add +user_add_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd test + atf_check -s exit:0 -o match:"^test:.*" \ + grep "^test:.*" $HOME/master.passwd +} + + +atf_test_case user_add_comments +user_add_comments_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd test -c "Test User,work,123,456" + atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \ + grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd +} + +atf_test_case user_add_comments_invalid +user_add_comments_invalid_body() { + populate_etc_skel + + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd test -c "Test User,work,123:456,456" + atf_check -s exit:1 -o empty \ + grep "^test:.*:Test User,work,123:456,456:" $HOME/master.passwd +} + +atf_init_test_cases() { + atf_add_test_case user_add + atf_add_test_case user_add_comments + atf_add_test_case user_add_comments_invalid +} From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 21:43:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D633F03; Tue, 9 Dec 2014 21:43:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDB0AA74; Tue, 9 Dec 2014 21:43:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9Lh4Jf017690; Tue, 9 Dec 2014 21:43:04 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9Lh3rI017679; Tue, 9 Dec 2014 21:43:03 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201412092143.sB9Lh3rI017679@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Tue, 9 Dec 2014 21:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275656 - head/usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 21:43:05 -0000 Author: brd (doc committer) Date: Tue Dec 9 21:43:03 2014 New Revision: 275656 URL: https://svnweb.freebsd.org/changeset/base/275656 Log: Break out the tests into a file per command and clean up some long lines Approved by: will Added: head/usr.sbin/pw/tests/pw_groupdel.sh (contents, props changed) head/usr.sbin/pw/tests/pw_groupmod.sh - copied unchanged from r275652, head/usr.sbin/pw/tests/pw_modify.sh head/usr.sbin/pw/tests/pw_useradd.sh - copied unchanged from r275655, head/usr.sbin/pw/tests/pw_add.sh head/usr.sbin/pw/tests/pw_userdel.sh - copied, changed from r275652, head/usr.sbin/pw/tests/pw_delete.sh Deleted: head/usr.sbin/pw/tests/pw_add.sh head/usr.sbin/pw/tests/pw_delete.sh head/usr.sbin/pw/tests/pw_modify.sh Modified: head/usr.sbin/pw/tests/Makefile Modified: head/usr.sbin/pw/tests/Makefile ============================================================================== --- head/usr.sbin/pw/tests/Makefile Tue Dec 9 20:46:17 2014 (r275655) +++ head/usr.sbin/pw/tests/Makefile Tue Dec 9 21:43:03 2014 (r275656) @@ -5,11 +5,11 @@ TESTSRC= ${.CURDIR}/../../../contrib/net TESTSDIR= ${TESTSBASE}/usr.sbin/pw -ATF_TESTS_SH= pw_add pw_delete pw_etcdir pw_lock pw_modify +ATF_TESTS_SH= pw_etcdir pw_lock pw_groupmod pw_useradd pw_userdel -TEST_METADATA.pw_add+= required_user="root" -TEST_METADATA.pw_delete+= required_user="root" -TEST_METADATA.pw_modify+= required_user="root" +TEST_METADATA.pw_groupmod+= required_user="root" +TEST_METADATA.pw_useradd+= required_user="root" +TEST_METADATA.pw_userdel+= required_user="root" FILES= group helper_functions.shin master.passwd FILESDIR= ${TESTSDIR} Added: head/usr.sbin/pw/tests/pw_groupdel.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/pw_groupdel.sh Tue Dec 9 21:43:03 2014 (r275656) @@ -0,0 +1,24 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + + +# Test to make sure we do not accidentially delete wheel when trying to delete +# an unknown group +atf_test_case group_do_not_delete_wheel_if_group_unknown +group_do_not_delete_wheel_if_group_unknown_head() { + atf_set "descr" "Make sure we do not consider gid 0 an unknown group" +} +group_do_not_delete_wheel_if_group_unknown_body() { + populate_etc_skel + atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel + atf_check -e inline:"pw: -g expects a number\n" -s exit:64 -x \ + ${PW} groupdel -g I_do_not_exist + atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel +} + + +atf_init_test_cases() { + atf_add_test_case group_do_not_delete_wheel_if_group_unknown +} Copied: head/usr.sbin/pw/tests/pw_groupmod.sh (from r275652, head/usr.sbin/pw/tests/pw_modify.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/pw_groupmod.sh Tue Dec 9 21:43:03 2014 (r275656, copy of r275652, head/usr.sbin/pw/tests/pw_modify.sh) @@ -0,0 +1,80 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + + +# Test adding & removing a user from a group +atf_test_case groupmod_user +groupmod_user_body() { + populate_etc_skel + atf_check -s exit:0 ${PW} addgroup test + atf_check -s exit:0 ${PW} groupmod test -m root + atf_check -s exit:0 -o match:"^test:\*:1001:root$" \ + grep "^test:\*:.*:root$" $HOME/group + atf_check -s exit:0 ${PW} groupmod test -d root + atf_check -s exit:0 -o match:"^test:\*:1001:$" \ + grep "^test:\*:.*:$" $HOME/group +} + + +# Test adding and removing a user that does not exist +atf_test_case groupmod_invalid_user +groupmod_invalid_user_body() { + populate_etc_skel + atf_check -s exit:0 ${PW} addgroup test + atf_check -s exit:67 -e match:"does not exist" ${PW} groupmod test -m foo + atf_check -s exit:0 ${PW} groupmod test -d foo +} + +atf_test_case groupmod_bug_193704 +groupmod_bug_193704_head() { + atf_set "descr" "Regression test for the #193704 bug" +} +groupmod_bug_193704_body() { + populate_etc_skel + atf_check -s exit:0 -x ${PW} groupadd test + atf_check -s exit:0 -x ${PW} groupmod test -l newgroupname + atf_check -s exit:65 -e match:"^pw: unknown group" -x ${PW} groupshow test +} + +atf_test_case usermod_bug_185666 +usermod_bug_185666_head() { + atf_set "descr" "Regression test for the #185666 bug" +} + +usermod_bug_185666_body() { + populate_etc_skel + atf_check -s exit:0 -x ${PW} useradd testuser + atf_check -s exit:0 -x ${PW} groupadd testgroup + atf_check -s exit:0 -x ${PW} groupadd testgroup2 + atf_check -s exit:0 -x ${PW} usermod testuser -G testgroup + atf_check -o inline:"testuser:*:1001:\n" -x ${PW} groupshow testuser + atf_check -o inline:"testgroup:*:1002:testuser\n" -x ${PW} groupshow testgroup + atf_check -o inline:"testgroup2:*:1003:\n" -x ${PW} groupshow testgroup2 + atf_check -s exit:0 -x ${PW} usermod testuser -G testgroup2 + atf_check -o inline:"testuser:*:1001:\n" -x ${PW} groupshow testuser + atf_check -o inline:"testgroup:*:1002:\n" -x ${PW} groupshow testgroup + atf_check -o inline:"testgroup2:*:1003:testuser\n" -x ${PW} groupshow testgroup2 +} + +atf_test_case do_not_duplicate_group_on_gid_change +do_not_duplicate_group_on_gid_change_head() { + atf_set "descr" "Do not duplicate group on gid change" +} + +do_not_duplicate_group_on_gid_change_body() { + populate_etc_skel + atf_check -s exit:0 -x ${PW} groupadd testgroup + atf_check -s exit:0 -x ${PW} groupmod testgroup -g 12345 + # use grep to see if the entry has not be duplicated + atf_check -o inline:"testgroup:*:12345:\n" -s exit:0 -x grep "^testgroup" ${HOME}/group +} + +atf_init_test_cases() { + atf_add_test_case groupmod_user + atf_add_test_case groupmod_invalid_user + atf_add_test_case groupmod_bug_193704 + atf_add_test_case usermod_bug_185666 + atf_add_test_case do_not_duplicate_group_on_gid_change +} Copied: head/usr.sbin/pw/tests/pw_useradd.sh (from r275655, head/usr.sbin/pw/tests/pw_add.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/pw_useradd.sh Tue Dec 9 21:43:03 2014 (r275656, copy of r275655, head/usr.sbin/pw/tests/pw_add.sh) @@ -0,0 +1,40 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +# Test add user +atf_test_case user_add +user_add_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd test + atf_check -s exit:0 -o match:"^test:.*" \ + grep "^test:.*" $HOME/master.passwd +} + + +atf_test_case user_add_comments +user_add_comments_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd test -c "Test User,work,123,456" + atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \ + grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd +} + +atf_test_case user_add_comments_invalid +user_add_comments_invalid_body() { + populate_etc_skel + + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd test -c "Test User,work,123:456,456" + atf_check -s exit:1 -o empty \ + grep "^test:.*:Test User,work,123:456,456:" $HOME/master.passwd +} + +atf_init_test_cases() { + atf_add_test_case user_add + atf_add_test_case user_add_comments + atf_add_test_case user_add_comments_invalid +} Copied and modified: head/usr.sbin/pw/tests/pw_userdel.sh (from r275652, head/usr.sbin/pw/tests/pw_delete.sh) ============================================================================== --- head/usr.sbin/pw/tests/pw_delete.sh Tue Dec 9 20:05:05 2014 (r275652, copy source) +++ head/usr.sbin/pw/tests/pw_userdel.sh Tue Dec 9 21:43:03 2014 (r275656) @@ -3,6 +3,7 @@ # Import helper functions . $(atf_get_srcdir)/helper_functions.shin + # Test that a user can be deleted when another user is part of this # user's default group and does not go into an infinate loop. # PR: 191427 @@ -18,30 +19,19 @@ rmuser_seperate_group_body() { ${PW} userdel test || atf_fail "Delete the test user" } -atf_test_case group_do_not_delete_wheel_if_group_unknown -group_do_not_delete_wheel_if_group_unknown_head() { - atf_set "descr" "Make sure we do not consider gid 0 an unknown group" -} - -group_do_not_delete_wheel_if_group_unknown_body() { - populate_etc_skel - atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel - atf_check -e inline:"pw: -g expects a number\n" -s exit:64 -x ${PW} groupdel -g I_do_not_exist - atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel -} atf_test_case user_do_not_try_to_delete_root_if_user_unknown user_do_not_try_to_delete_root_if_user_unknown_head() { - atf_set "descr" "Make sure not to try to remove root if deleting an unknown user" + atf_set "descr" \ + "Make sure not to try to remove root if deleting an unknown user" } - user_do_not_try_to_delete_root_if_user_unknown_body() { populate_etc_skel - atf_check -e inline:"pw: -u expects a number\n" -s exit:64 -x ${PW} userdel -u plop + atf_check -e inline:"pw: -u expects a number\n" -s exit:64 -x \ + ${PW} userdel -u plop } atf_init_test_cases() { atf_add_test_case rmuser_seperate_group - atf_add_test_case group_do_not_delete_wheel_if_group_unknown atf_add_test_case user_do_not_try_to_delete_root_if_user_unknown } From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 22:11:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EBE168AC; Tue, 9 Dec 2014 22:11:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD0A3D6F; Tue, 9 Dec 2014 22:11:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9MBvhL033088; Tue, 9 Dec 2014 22:11:57 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9MBvHO033086; Tue, 9 Dec 2014 22:11:57 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201412092211.sB9MBvHO033086@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Tue, 9 Dec 2014 22:11:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275657 - head/usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 22:11:58 -0000 Author: brd (doc committer) Date: Tue Dec 9 22:11:56 2014 New Revision: 275657 URL: https://svnweb.freebsd.org/changeset/base/275657 Log: Add some tests for user modification. [1] Fix a missing test in the Makefile from my previous commit. PR: 195834 [1] Submitted by: Robert O'Neil Approved by: will Added: head/usr.sbin/pw/tests/pw_usermod.sh (contents, props changed) Modified: head/usr.sbin/pw/tests/Makefile Modified: head/usr.sbin/pw/tests/Makefile ============================================================================== --- head/usr.sbin/pw/tests/Makefile Tue Dec 9 21:43:03 2014 (r275656) +++ head/usr.sbin/pw/tests/Makefile Tue Dec 9 22:11:56 2014 (r275657) @@ -5,11 +5,13 @@ TESTSRC= ${.CURDIR}/../../../contrib/net TESTSDIR= ${TESTSBASE}/usr.sbin/pw -ATF_TESTS_SH= pw_etcdir pw_lock pw_groupmod pw_useradd pw_userdel +ATF_TESTS_SH= pw_etcdir pw_lock pw_groupdel pw_groupmod pw_useradd pw_userdel pw_usermod +TEST_METADATA.pw_groupdel+= required_user="root" TEST_METADATA.pw_groupmod+= required_user="root" TEST_METADATA.pw_useradd+= required_user="root" TEST_METADATA.pw_userdel+= required_user="root" +TEST_METADATA.pw_usermod+= required_user="root" FILES= group helper_functions.shin master.passwd FILESDIR= ${TESTSDIR} Added: head/usr.sbin/pw/tests/pw_usermod.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/pw_usermod.sh Tue Dec 9 22:11:56 2014 (r275657) @@ -0,0 +1,56 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +# Test modifying a user +atf_test_case user_mod +user_mod_body() { + populate_etc_skel + + atf_check -s exit:67 -e match:"no such user" ${PW} usermod test + atf_check -s exit:0 ${PW} useradd test + atf_check -s exit:0 ${PW} usermod test + atf_check -s exit:0 -o match:"^test:.*" \ + grep "^test:.*" $HOME/master.passwd +} + +# Test modifying a user with comments +atf_test_case user_mod_comments +user_mod_comments_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd test -c "Test User,home,123,456" + atf_check -s exit:0 ${PW} usermod test -c "Test User,work,123,456" + atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \ + grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd +} + +# Test modifying a user with invalid comments +atf_test_case user_mod_comments_invalid +user_mod_comments_invalid_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd test + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} usermod test -c "Test User,work,123:456,456" + atf_check -s exit:1 -o empty \ + grep "^test:.*:Test User,work,123:456,456:" $HOME/master.passwd +} + +# Test modifying a user name with -l +atf_test_case user_mod_name +user_mod_name_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -l "bar" + atf_check -s exit:0 -o match:"^bar:.*" \ + grep "^bar:.*" $HOME/master.passwd +} +atf_init_test_cases() { + atf_add_test_case user_mod + atf_add_test_case user_mod_comments + atf_add_test_case user_mod_comments_invalid + atf_add_test_case user_mod_name +} From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 22:28:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 433FBC01; Tue, 9 Dec 2014 22:28:47 +0000 (UTC) Received: from mail-ie0-x22c.google.com (mail-ie0-x22c.google.com [IPv6:2607:f8b0:4001:c03::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B289EB3; Tue, 9 Dec 2014 22:28:47 +0000 (UTC) Received: by mail-ie0-f172.google.com with SMTP id tr6so1540494ieb.3 for ; Tue, 09 Dec 2014 14:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=wpdmrjJ3PhJfEqQZCZZIeP3NC3Mo2OotY9o1gZO/qV8=; b=igGNCFqitlIUUVgJexfJEaCeqfe8oryvHgXzOliCkB/LKoOCLpozCmzQDhEi0VhBZ1 alZXKrr4y6cE/xG4AcTA34ReFM4yqDsGrfMyiTemtkejHzyHd7sCWgV95a7znu9aSNk0 MbEi/rhhCYOux8g464JGlEO7E2ErkPDjoFAzrbM7HWfdcHv3tg8wagZwhe6VdYny3xGH Cwz4M+bk3VbPXWpxjimuQczE3XPMC8P2MjUa+sCqE+G4U7TlOY8e4KHvrYqAkEH7inbt 2/3XvSIxOwljP00KCMtWz/D8NSvHfc9uh8IdlIafsBgJ5Wazu4MPBTQ7ZUrQxSLKQ1X+ d49A== MIME-Version: 1.0 X-Received: by 10.107.18.208 with SMTP id 77mr807645ios.57.1418164126248; Tue, 09 Dec 2014 14:28:46 -0800 (PST) Received: by 10.50.4.170 with HTTP; Tue, 9 Dec 2014 14:28:46 -0800 (PST) In-Reply-To: <201412092211.sB9MBvHO033086@svn.freebsd.org> References: <201412092211.sB9MBvHO033086@svn.freebsd.org> Date: Tue, 9 Dec 2014 14:28:46 -0800 Message-ID: Subject: Re: svn commit: r275657 - head/usr.sbin/pw/tests From: NGie Cooper To: Brad Davis Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 22:28:47 -0000 Hi Brad! On Tue, Dec 9, 2014 at 2:11 PM, Brad Davis wrote: > Author: brd (doc committer) > Date: Tue Dec 9 22:11:56 2014 > New Revision: 275657 > URL: https://svnweb.freebsd.org/changeset/base/275657 > > Log: > Add some tests for user modification. [1] > Fix a missing test in the Makefile from my previous commit. > > PR: 195834 [1] > Submitted by: Robert O'Neil > Approved by: will > > Added: > head/usr.sbin/pw/tests/pw_usermod.sh (contents, props changed) > Modified: > head/usr.sbin/pw/tests/Makefile > > Modified: head/usr.sbin/pw/tests/Makefile > ============================================================================== > --- head/usr.sbin/pw/tests/Makefile Tue Dec 9 21:43:03 2014 (r275656) > +++ head/usr.sbin/pw/tests/Makefile Tue Dec 9 22:11:56 2014 (r275657) > @@ -5,11 +5,13 @@ TESTSRC= ${.CURDIR}/../../../contrib/net > > TESTSDIR= ${TESTSBASE}/usr.sbin/pw > > -ATF_TESTS_SH= pw_etcdir pw_lock pw_groupmod pw_useradd pw_userdel > +ATF_TESTS_SH= pw_etcdir pw_lock pw_groupdel pw_groupmod pw_useradd pw_userdel pw_usermod Please put this one item per-line so it's easier to backport and doesn't exceed 80 columns. > +TEST_METADATA.pw_groupdel+= required_user="root" > TEST_METADATA.pw_groupmod+= required_user="root" > TEST_METADATA.pw_useradd+= required_user="root" > TEST_METADATA.pw_userdel+= required_user="root" > +TEST_METADATA.pw_usermod+= required_user="root" This should probably just be a for-loop, e.g. .for tp in ${ATF_TESTS_SH} TEST_METADATA.${tp}+= required_user="root" .endif From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 23:26:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA5D4468; Tue, 9 Dec 2014 23:26:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B75396AB; Tue, 9 Dec 2014 23:26:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9NQmPH068033; Tue, 9 Dec 2014 23:26:48 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9NQmnt068032; Tue, 9 Dec 2014 23:26:48 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201412092326.sB9NQmnt068032@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Tue, 9 Dec 2014 23:26:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275658 - head/usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 23:26:48 -0000 Author: brd (doc committer) Date: Tue Dec 9 23:26:47 2014 New Revision: 275658 URL: https://svnweb.freebsd.org/changeset/base/275658 Log: Restructure to make it easier to extend in the future Reviewed by: will Suggested by: ngie Modified: head/usr.sbin/pw/tests/Makefile Modified: head/usr.sbin/pw/tests/Makefile ============================================================================== --- head/usr.sbin/pw/tests/Makefile Tue Dec 9 22:11:56 2014 (r275657) +++ head/usr.sbin/pw/tests/Makefile Tue Dec 9 23:26:47 2014 (r275658) @@ -5,13 +5,17 @@ TESTSRC= ${.CURDIR}/../../../contrib/net TESTSDIR= ${TESTSBASE}/usr.sbin/pw -ATF_TESTS_SH= pw_etcdir pw_lock pw_groupdel pw_groupmod pw_useradd pw_userdel pw_usermod - -TEST_METADATA.pw_groupdel+= required_user="root" -TEST_METADATA.pw_groupmod+= required_user="root" -TEST_METADATA.pw_useradd+= required_user="root" -TEST_METADATA.pw_userdel+= required_user="root" -TEST_METADATA.pw_usermod+= required_user="root" +ATF_TESTS_SH= pw_etcdir \ + pw_lock \ + pw_groupdel \ + pw_groupmod \ + pw_useradd \ + pw_userdel \ + pw_usermod + +.for tp in ${ATF_TESTS_SH} +TEST_METADATA.${tp}+= required_user="root" +.endfor FILES= group helper_functions.shin master.passwd FILESDIR= ${TESTSDIR} From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 23:27:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 37DF85AE; Tue, 9 Dec 2014 23:27:44 +0000 (UTC) Received: from valentine.liquidneon.com (cl-1479.chi-02.us.sixxs.net [IPv6:2001:4978:f:5c6::2]) by mx1.freebsd.org (Postfix) with ESMTP id 1030B6B7; Tue, 9 Dec 2014 23:27:43 +0000 (UTC) Received: by valentine.liquidneon.com (Postfix, from userid 1018) id ED4648FFCD; Tue, 9 Dec 2014 16:27:35 -0700 (MST) Date: Tue, 9 Dec 2014 16:27:35 -0700 From: Brad Davis To: NGie Cooper Subject: Re: svn commit: r275657 - head/usr.sbin/pw/tests Message-ID: <20141209232735.GD29350@valentine.liquidneon.com> References: <201412092211.sB9MBvHO033086@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Brad Davis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 09 Dec 2014 23:27:44 -0000 On Tue, Dec 09, 2014 at 02:28:46PM -0800, NGie Cooper wrote: > Hi Brad! > > On Tue, Dec 9, 2014 at 2:11 PM, Brad Davis wrote: > > Author: brd (doc committer) > > Date: Tue Dec 9 22:11:56 2014 > > New Revision: 275657 > > URL: https://svnweb.freebsd.org/changeset/base/275657 > > > > Log: > > Add some tests for user modification. [1] > > Fix a missing test in the Makefile from my previous commit. > > > > PR: 195834 [1] > > Submitted by: Robert O'Neil > > Approved by: will > > > > Added: > > head/usr.sbin/pw/tests/pw_usermod.sh (contents, props changed) > > Modified: > > head/usr.sbin/pw/tests/Makefile > > > > Modified: head/usr.sbin/pw/tests/Makefile > > ============================================================================== > > --- head/usr.sbin/pw/tests/Makefile Tue Dec 9 21:43:03 2014 (r275656) > > +++ head/usr.sbin/pw/tests/Makefile Tue Dec 9 22:11:56 2014 (r275657) > > @@ -5,11 +5,13 @@ TESTSRC= ${.CURDIR}/../../../contrib/net > > > > TESTSDIR= ${TESTSBASE}/usr.sbin/pw > > > > -ATF_TESTS_SH= pw_etcdir pw_lock pw_groupmod pw_useradd pw_userdel > > +ATF_TESTS_SH= pw_etcdir pw_lock pw_groupdel pw_groupmod pw_useradd pw_userdel pw_usermod > > Please put this one item per-line so it's easier to backport and > doesn't exceed 80 columns. > > > +TEST_METADATA.pw_groupdel+= required_user="root" > > TEST_METADATA.pw_groupmod+= required_user="root" > > TEST_METADATA.pw_useradd+= required_user="root" > > TEST_METADATA.pw_userdel+= required_user="root" > > +TEST_METADATA.pw_usermod+= required_user="root" > > This should probably just be a for-loop, e.g. > > .for tp in ${ATF_TESTS_SH} > TEST_METADATA.${tp}+= required_user="root" > .endif > Hi, Thanks for the suggestion! Comitted in r275658. Regards, Brad Davis From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 03:12:23 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5EC6765; Wed, 10 Dec 2014 03:12:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92E11129; Wed, 10 Dec 2014 03:12:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA3CNFw081571; Wed, 10 Dec 2014 03:12:23 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA3CNEm081570; Wed, 10 Dec 2014 03:12:23 GMT (envelope-from des@FreeBSD.org) Message-Id: <201412100312.sBA3CNEm081570@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Wed, 10 Dec 2014 03:12:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275659 - head/bin/freebsd-version X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 03:12:23 -0000 Author: des Date: Wed Dec 10 03:12:22 2014 New Revision: 275659 URL: https://svnweb.freebsd.org/changeset/base/275659 Log: Fix dependency on newvers.sh Noticed by: marck MFC after: 1 week Modified: head/bin/freebsd-version/Makefile Modified: head/bin/freebsd-version/Makefile ============================================================================== --- head/bin/freebsd-version/Makefile Tue Dec 9 23:26:47 2014 (r275658) +++ head/bin/freebsd-version/Makefile Wed Dec 10 03:12:22 2014 (r275659) @@ -5,8 +5,7 @@ MAN = freebsd-version.1 CLEANFILES = freebsd-version.sh NEWVERS = ${.CURDIR}/../../sys/conf/newvers.sh -freebsd-version.sh.in: ${NEWVERS} -freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in +freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in ${NEWVERS} eval $$(egrep '^(TYPE|REVISION|BRANCH)=' ${NEWVERS}) ; \ if ! sed -e "\ s/@@TYPE@@/$${TYPE}/g; \ From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 04:54:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DD952D77; Wed, 10 Dec 2014 04:54:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CAC80CF9; Wed, 10 Dec 2014 04:54:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA4shJX030674; Wed, 10 Dec 2014 04:54:43 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA4shNe030673; Wed, 10 Dec 2014 04:54:43 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201412100454.sBA4shNe030673@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Dec 2014 04:54:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275660 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 04:54:44 -0000 Author: ian Date: Wed Dec 10 04:54:43 2014 New Revision: 275660 URL: https://svnweb.freebsd.org/changeset/base/275660 Log: Fix the watchdog timeout calculation to prevent wrap. The RPi hardware can't do a timeout bigger than 15 seconds. The code wasn't checking for this and because bitmasking was involved the requested timeout was basically adjusted modulo-16. That led to things like a 128 second timeout actually being a 9 second timeout, which accidentally worked fine until watchdogd was changed to only pet the dog once every 10 seconds. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Wed Dec 10 03:12:22 2014 (r275659) +++ head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Wed Dec 10 04:54:43 2014 (r275660) @@ -142,14 +142,13 @@ bcmwd_watchdog_fn(void *private, u_int c if (cmd > 0) { sec = ((uint64_t)1 << (cmd & WD_INTERVAL)) / 1000000000; - ticks = (sec << 16) & BCM2835_WDOG_TIME_MASK; - if (ticks == 0) { + if (sec == 0 || sec > 15) { /* * Can't arm * disable watchdog as watchdog(9) requires */ device_printf(sc->dev, - "Can't arm, timeout is less than 1 second\n"); + "Can't arm, timeout must be between 1-15 seconds\n"); WRITE(sc, BCM2835_RSTC_REG, (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | BCM2835_RSTC_RESET); @@ -157,6 +156,7 @@ bcmwd_watchdog_fn(void *private, u_int c return; } + ticks = (sec << 16) & BCM2835_WDOG_TIME_MASK; reg = (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | ticks; WRITE(sc, BCM2835_WDOG_REG, reg); From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:18:23 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5DFBC4B7; Wed, 10 Dec 2014 08:18:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AF196CE; Wed, 10 Dec 2014 08:18:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8INs0028610; Wed, 10 Dec 2014 08:18:23 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8INOQ028609; Wed, 10 Dec 2014 08:18:23 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412100818.sBA8INOQ028609@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 10 Dec 2014 08:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275665 - head/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:18:23 -0000 Author: delphij Date: Wed Dec 10 08:18:22 2014 New Revision: 275665 URL: https://svnweb.freebsd.org/changeset/base/275665 Log: In r268924 __fflush was modified so that when write(2) was not successful, _p and _w are adjusted to account for the partial write (if any). However, _p and _w should not be unconditionally adjusted and should only be changed when we actually wrote some bytes, or the accumulated accounting error will eventually result in a heap buffer overflow. Reported by: adrian and alfred (Norse Corporation) Security: FreeBSD-SA-14:27.stdio Security: CVE-2014-8611 Modified: head/lib/libc/stdio/fflush.c Modified: head/lib/libc/stdio/fflush.c ============================================================================== --- head/lib/libc/stdio/fflush.c Wed Dec 10 06:43:16 2014 (r275664) +++ head/lib/libc/stdio/fflush.c Wed Dec 10 08:18:22 2014 (r275665) @@ -124,11 +124,13 @@ __sflush(FILE *fp) t = _swrite(fp, (char *)p, n); if (t <= 0) { /* Reset _p and _w. */ - if (p > fp->_p) /* Some was written. */ + if (p > fp->_p) { + /* Some was written. */ memmove(fp->_p, p, n); - fp->_p += n; - if ((fp->_flags & (__SLBF | __SNBF)) == 0) - fp->_w -= n; + fp->_p += n; + if ((fp->_flags & (__SLBF | __SNBF)) == 0) + fp->_w -= n; + } fp->_flags |= __SERR; return (EOF); } From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:19:57 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F3ED723; Wed, 10 Dec 2014 08:19:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B2A76E7; Wed, 10 Dec 2014 08:19:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8Jv7Y028881; Wed, 10 Dec 2014 08:19:57 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8JuQY028875; Wed, 10 Dec 2014 08:19:56 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412100819.sBA8JuQY028875@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 10 Dec 2014 08:19:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275666 - head/contrib/file/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:19:57 -0000 Author: delphij Date: Wed Dec 10 08:19:55 2014 New Revision: 275666 URL: https://svnweb.freebsd.org/changeset/base/275666 Log: Fix multiple vulnerabilities in file(1) and libmagic(3). Security: FreeBSD-SA-14:28.file Security: CVE-2014-3710, CVE-2014-8116, CVE-2014-8117 Modified: head/contrib/file/src/elfclass.h head/contrib/file/src/file.h head/contrib/file/src/funcs.c head/contrib/file/src/readelf.c head/contrib/file/src/softmagic.c Modified: head/contrib/file/src/elfclass.h ============================================================================== --- head/contrib/file/src/elfclass.h Wed Dec 10 08:18:22 2014 (r275665) +++ head/contrib/file/src/elfclass.h Wed Dec 10 08:19:55 2014 (r275666) @@ -35,10 +35,12 @@ switch (type) { #ifdef ELFCORE case ET_CORE: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); flags |= FLAGS_IS_CORE; if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) return -1; @@ -46,18 +48,24 @@ #endif case ET_EXEC: case ET_DYN: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), - fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) - == -1) + fsize, &flags, shnum) == -1) return -1; /*FALLTHROUGH*/ case ET_REL: + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), - elf_getu16(swap, elfhdr.e_shnum), + (off_t)elf_getu(swap, elfhdr.e_shoff), shnum, (size_t)elf_getu16(swap, elfhdr.e_shentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_machine), (int)elf_getu16(swap, elfhdr.e_shstrndx)) == -1) Modified: head/contrib/file/src/file.h ============================================================================== --- head/contrib/file/src/file.h Wed Dec 10 08:18:22 2014 (r275665) +++ head/contrib/file/src/file.h Wed Dec 10 08:19:55 2014 (r275666) @@ -482,6 +482,14 @@ protected int file_regexec(file_regex_t protected void file_regfree(file_regex_t *); protected void file_regerror(file_regex_t *, int, struct magic_set *); +typedef struct { + char *buf; + uint32_t offset; +} file_pushbuf_t; + +protected file_pushbuf_t *file_push_buffer(struct magic_set *); +protected char *file_pop_buffer(struct magic_set *, file_pushbuf_t *); + #ifndef COMPILE_ONLY extern const char *file_names[]; extern const size_t file_nnames; Modified: head/contrib/file/src/funcs.c ============================================================================== --- head/contrib/file/src/funcs.c Wed Dec 10 08:18:22 2014 (r275665) +++ head/contrib/file/src/funcs.c Wed Dec 10 08:19:55 2014 (r275666) @@ -491,3 +491,43 @@ file_regerror(file_regex_t *rx, int rc, file_magerror(ms, "regex error %d for `%s', (%s)", rc, rx->pat, errmsg); } + +protected file_pushbuf_t * +file_push_buffer(struct magic_set *ms) +{ + file_pushbuf_t *pb; + + if (ms->event_flags & EVENT_HAD_ERR) + return NULL; + + if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL) + return NULL; + + pb->buf = ms->o.buf; + pb->offset = ms->offset; + + ms->o.buf = NULL; + ms->offset = 0; + + return pb; +} + +protected char * +file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb) +{ + char *rbuf; + + if (ms->event_flags & EVENT_HAD_ERR) { + free(pb->buf); + free(pb); + return NULL; + } + + rbuf = ms->o.buf; + + ms->o.buf = pb->buf; + ms->offset = pb->offset; + + free(pb); + return rbuf; +} Modified: head/contrib/file/src/readelf.c ============================================================================== --- head/contrib/file/src/readelf.c Wed Dec 10 08:18:22 2014 (r275665) +++ head/contrib/file/src/readelf.c Wed Dec 10 08:19:55 2014 (r275666) @@ -60,6 +60,18 @@ private uint16_t getu16(int, uint16_t); private uint32_t getu32(int, uint32_t); private uint64_t getu64(int, uint64_t); +#define MAX_PHNUM 256 +#define MAX_SHNUM 1024 + +private int +toomany(struct magic_set *ms, const char *name, uint16_t num) +{ + if (file_printf(ms, ", too many %s header sections (%u)", name, num + ) == -1) + return -1; + return 0; +} + private uint16_t getu16(int swap, uint16_t value) { @@ -477,6 +489,13 @@ donote(struct magic_set *ms, void *vbuf, uint32_t namesz, descsz; unsigned char *nbuf = CAST(unsigned char *, vbuf); + if (xnh_sizeof + offset > size) { + /* + * We're out of note headers. + */ + return xnh_sizeof + offset; + } + (void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof); offset += xnh_sizeof; @@ -492,13 +511,13 @@ donote(struct magic_set *ms, void *vbuf, if (namesz & 0x80000000) { (void)file_printf(ms, ", bad note name size 0x%lx", (unsigned long)namesz); - return offset; + return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, ", bad note description size 0x%lx", (unsigned long)descsz); - return offset; + return 0; } @@ -900,6 +919,7 @@ doshn(struct magic_set *ms, int clazz, i Elf32_Shdr sh32; Elf64_Shdr sh64; int stripped = 1; + size_t nbadcap = 0; void *nbuf; off_t noff, coff, name_off; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ @@ -988,6 +1008,8 @@ doshn(struct magic_set *ms, int clazz, i goto skip; } + if (nbadcap > 5) + break; if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) { file_badseek(ms); return -1; @@ -1053,6 +1075,8 @@ doshn(struct magic_set *ms, int clazz, i (unsigned long long)xcap_tag, (unsigned long long)xcap_val) == -1) return -1; + if (nbadcap++ > 2) + coff = xsh_size; break; } } @@ -1233,7 +1257,7 @@ file_tryelf(struct magic_set *ms, int fd int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; - uint16_t type; + uint16_t type, phnum, shnum; if (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) return 0; Modified: head/contrib/file/src/softmagic.c ============================================================================== --- head/contrib/file/src/softmagic.c Wed Dec 10 08:18:22 2014 (r275665) +++ head/contrib/file/src/softmagic.c Wed Dec 10 08:19:55 2014 (r275666) @@ -67,6 +67,9 @@ private void cvt_32(union VALUETYPE *, c private void cvt_64(union VALUETYPE *, const struct magic *); #define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + +#define MAX_RECURSION_LEVEL 10 + /* * softmagic - lookup one file in parsed, in-memory copy of database * Passed the name and FILE * of one file to be typed. @@ -1193,14 +1196,15 @@ mget(struct magic_set *ms, const unsigne int flip, int recursion_level, int *printed_something, int *need_separator, int *returnval) { - uint32_t soffset, offset = ms->offset; + uint32_t offset = ms->offset; uint32_t lhs; + file_pushbuf_t *pb; int rv, oneed_separator, in_type; - char *sbuf, *rbuf; + char *rbuf; union VALUETYPE *p = &ms->ms_value; struct mlist ml; - if (recursion_level >= 20) { + if (recursion_level >= MAX_RECURSION_LEVEL) { file_error(ms, 0, "recursion nesting exceeded"); return -1; } @@ -1644,19 +1648,23 @@ mget(struct magic_set *ms, const unsigne case FILE_INDIRECT: if (offset == 0) return 0; + if (nbytes < offset) return 0; - sbuf = ms->o.buf; - soffset = ms->offset; - ms->o.buf = NULL; - ms->offset = 0; + + if ((pb = file_push_buffer(ms)) == NULL) + return -1; + rv = file_softmagic(ms, s + offset, nbytes - offset, recursion_level, BINTEST, text); + if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv); - rbuf = ms->o.buf; - ms->o.buf = sbuf; - ms->offset = soffset; + + rbuf = file_pop_buffer(ms, pb); + if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR) + return -1; + if (rv == 1) { if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && file_printf(ms, F(ms, m, "%u"), offset) == -1) { @@ -1674,13 +1682,13 @@ mget(struct magic_set *ms, const unsigne case FILE_USE: if (nbytes < offset) return 0; - sbuf = m->value.s; - if (*sbuf == '^') { - sbuf++; + rbuf = m->value.s; + if (*rbuf == '^') { + rbuf++; flip = !flip; } - if (file_magicfind(ms, sbuf, &ml) == -1) { - file_error(ms, 0, "cannot find entry `%s'", sbuf); + if (file_magicfind(ms, rbuf, &ml) == -1) { + file_error(ms, 0, "cannot find entry `%s'", rbuf); return -1; } From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:24:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 632688D8; Wed, 10 Dec 2014 08:24:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FC1280A; Wed, 10 Dec 2014 08:24:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8O3FV032982; Wed, 10 Dec 2014 08:24:03 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8O3U6032981; Wed, 10 Dec 2014 08:24:03 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412100824.sBA8O3U6032981@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 10 Dec 2014 08:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275667 - stable/10/lib/libc/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:24:03 -0000 Author: delphij Date: Wed Dec 10 08:24:02 2014 New Revision: 275667 URL: https://svnweb.freebsd.org/changeset/base/275667 Log: MFC r275665: Fix buffer overflow in stdio. Security: FreeBSD-SA-14:27.stdio Security: CVE-2014-8611 Modified: stable/10/lib/libc/stdio/fflush.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/fflush.c ============================================================================== --- stable/10/lib/libc/stdio/fflush.c Wed Dec 10 08:19:55 2014 (r275666) +++ stable/10/lib/libc/stdio/fflush.c Wed Dec 10 08:24:02 2014 (r275667) @@ -124,11 +124,13 @@ __sflush(FILE *fp) t = _swrite(fp, (char *)p, n); if (t <= 0) { /* Reset _p and _w. */ - if (p > fp->_p) /* Some was written. */ + if (p > fp->_p) { + /* Some was written. */ memmove(fp->_p, p, n); - fp->_p += n; - if ((fp->_flags & (__SLBF | __SNBF)) == 0) - fp->_w -= n; + fp->_p += n; + if ((fp->_flags & (__SLBF | __SNBF)) == 0) + fp->_w -= n; + } fp->_flags |= __SERR; return (EOF); } From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:26:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 21382B27; Wed, 10 Dec 2014 08:26:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BAF183C; Wed, 10 Dec 2014 08:26:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8QsmY033492; Wed, 10 Dec 2014 08:26:54 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8Qr2t033484; Wed, 10 Dec 2014 08:26:53 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412100826.sBA8Qr2t033484@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 10 Dec 2014 08:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275668 - stable/10/contrib/file/src X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:26:55 -0000 Author: delphij Date: Wed Dec 10 08:26:53 2014 New Revision: 275668 URL: https://svnweb.freebsd.org/changeset/base/275668 Log: MFC r275666: Fix multiple vulnerabilities in file(1) and libmagic(3). Security: FreeBSD-SA-14:28.file Security: CVE-2014-3710, CVE-2014-8116, CVE-2014-8117 Modified: stable/10/contrib/file/src/elfclass.h stable/10/contrib/file/src/file.h stable/10/contrib/file/src/funcs.c stable/10/contrib/file/src/readelf.c stable/10/contrib/file/src/softmagic.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/file/src/elfclass.h ============================================================================== --- stable/10/contrib/file/src/elfclass.h Wed Dec 10 08:24:02 2014 (r275667) +++ stable/10/contrib/file/src/elfclass.h Wed Dec 10 08:26:53 2014 (r275668) @@ -35,10 +35,12 @@ switch (type) { #ifdef ELFCORE case ET_CORE: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); flags |= FLAGS_IS_CORE; if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) return -1; @@ -46,18 +48,24 @@ #endif case ET_EXEC: case ET_DYN: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), - fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) - == -1) + fsize, &flags, shnum) == -1) return -1; /*FALLTHROUGH*/ case ET_REL: + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), - elf_getu16(swap, elfhdr.e_shnum), + (off_t)elf_getu(swap, elfhdr.e_shoff), shnum, (size_t)elf_getu16(swap, elfhdr.e_shentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_machine), (int)elf_getu16(swap, elfhdr.e_shstrndx)) == -1) Modified: stable/10/contrib/file/src/file.h ============================================================================== --- stable/10/contrib/file/src/file.h Wed Dec 10 08:24:02 2014 (r275667) +++ stable/10/contrib/file/src/file.h Wed Dec 10 08:26:53 2014 (r275668) @@ -482,6 +482,14 @@ protected int file_regexec(file_regex_t protected void file_regfree(file_regex_t *); protected void file_regerror(file_regex_t *, int, struct magic_set *); +typedef struct { + char *buf; + uint32_t offset; +} file_pushbuf_t; + +protected file_pushbuf_t *file_push_buffer(struct magic_set *); +protected char *file_pop_buffer(struct magic_set *, file_pushbuf_t *); + #ifndef COMPILE_ONLY extern const char *file_names[]; extern const size_t file_nnames; Modified: stable/10/contrib/file/src/funcs.c ============================================================================== --- stable/10/contrib/file/src/funcs.c Wed Dec 10 08:24:02 2014 (r275667) +++ stable/10/contrib/file/src/funcs.c Wed Dec 10 08:26:53 2014 (r275668) @@ -491,3 +491,43 @@ file_regerror(file_regex_t *rx, int rc, file_magerror(ms, "regex error %d for `%s', (%s)", rc, rx->pat, errmsg); } + +protected file_pushbuf_t * +file_push_buffer(struct magic_set *ms) +{ + file_pushbuf_t *pb; + + if (ms->event_flags & EVENT_HAD_ERR) + return NULL; + + if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL) + return NULL; + + pb->buf = ms->o.buf; + pb->offset = ms->offset; + + ms->o.buf = NULL; + ms->offset = 0; + + return pb; +} + +protected char * +file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb) +{ + char *rbuf; + + if (ms->event_flags & EVENT_HAD_ERR) { + free(pb->buf); + free(pb); + return NULL; + } + + rbuf = ms->o.buf; + + ms->o.buf = pb->buf; + ms->offset = pb->offset; + + free(pb); + return rbuf; +} Modified: stable/10/contrib/file/src/readelf.c ============================================================================== --- stable/10/contrib/file/src/readelf.c Wed Dec 10 08:24:02 2014 (r275667) +++ stable/10/contrib/file/src/readelf.c Wed Dec 10 08:26:53 2014 (r275668) @@ -60,6 +60,18 @@ private uint16_t getu16(int, uint16_t); private uint32_t getu32(int, uint32_t); private uint64_t getu64(int, uint64_t); +#define MAX_PHNUM 256 +#define MAX_SHNUM 1024 + +private int +toomany(struct magic_set *ms, const char *name, uint16_t num) +{ + if (file_printf(ms, ", too many %s header sections (%u)", name, num + ) == -1) + return -1; + return 0; +} + private uint16_t getu16(int swap, uint16_t value) { @@ -477,6 +489,13 @@ donote(struct magic_set *ms, void *vbuf, uint32_t namesz, descsz; unsigned char *nbuf = CAST(unsigned char *, vbuf); + if (xnh_sizeof + offset > size) { + /* + * We're out of note headers. + */ + return xnh_sizeof + offset; + } + (void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof); offset += xnh_sizeof; @@ -492,13 +511,13 @@ donote(struct magic_set *ms, void *vbuf, if (namesz & 0x80000000) { (void)file_printf(ms, ", bad note name size 0x%lx", (unsigned long)namesz); - return offset; + return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, ", bad note description size 0x%lx", (unsigned long)descsz); - return offset; + return 0; } @@ -900,6 +919,7 @@ doshn(struct magic_set *ms, int clazz, i Elf32_Shdr sh32; Elf64_Shdr sh64; int stripped = 1; + size_t nbadcap = 0; void *nbuf; off_t noff, coff, name_off; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ @@ -988,6 +1008,8 @@ doshn(struct magic_set *ms, int clazz, i goto skip; } + if (nbadcap > 5) + break; if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) { file_badseek(ms); return -1; @@ -1053,6 +1075,8 @@ doshn(struct magic_set *ms, int clazz, i (unsigned long long)xcap_tag, (unsigned long long)xcap_val) == -1) return -1; + if (nbadcap++ > 2) + coff = xsh_size; break; } } @@ -1233,7 +1257,7 @@ file_tryelf(struct magic_set *ms, int fd int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; - uint16_t type; + uint16_t type, phnum, shnum; if (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) return 0; Modified: stable/10/contrib/file/src/softmagic.c ============================================================================== --- stable/10/contrib/file/src/softmagic.c Wed Dec 10 08:24:02 2014 (r275667) +++ stable/10/contrib/file/src/softmagic.c Wed Dec 10 08:26:53 2014 (r275668) @@ -67,6 +67,9 @@ private void cvt_32(union VALUETYPE *, c private void cvt_64(union VALUETYPE *, const struct magic *); #define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + +#define MAX_RECURSION_LEVEL 10 + /* * softmagic - lookup one file in parsed, in-memory copy of database * Passed the name and FILE * of one file to be typed. @@ -1193,14 +1196,15 @@ mget(struct magic_set *ms, const unsigne int flip, int recursion_level, int *printed_something, int *need_separator, int *returnval) { - uint32_t soffset, offset = ms->offset; + uint32_t offset = ms->offset; uint32_t lhs; + file_pushbuf_t *pb; int rv, oneed_separator, in_type; - char *sbuf, *rbuf; + char *rbuf; union VALUETYPE *p = &ms->ms_value; struct mlist ml; - if (recursion_level >= 20) { + if (recursion_level >= MAX_RECURSION_LEVEL) { file_error(ms, 0, "recursion nesting exceeded"); return -1; } @@ -1644,19 +1648,23 @@ mget(struct magic_set *ms, const unsigne case FILE_INDIRECT: if (offset == 0) return 0; + if (nbytes < offset) return 0; - sbuf = ms->o.buf; - soffset = ms->offset; - ms->o.buf = NULL; - ms->offset = 0; + + if ((pb = file_push_buffer(ms)) == NULL) + return -1; + rv = file_softmagic(ms, s + offset, nbytes - offset, recursion_level, BINTEST, text); + if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv); - rbuf = ms->o.buf; - ms->o.buf = sbuf; - ms->offset = soffset; + + rbuf = file_pop_buffer(ms, pb); + if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR) + return -1; + if (rv == 1) { if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && file_printf(ms, F(ms, m, "%u"), offset) == -1) { @@ -1674,13 +1682,13 @@ mget(struct magic_set *ms, const unsigne case FILE_USE: if (nbytes < offset) return 0; - sbuf = m->value.s; - if (*sbuf == '^') { - sbuf++; + rbuf = m->value.s; + if (*rbuf == '^') { + rbuf++; flip = !flip; } - if (file_magicfind(ms, sbuf, &ml) == -1) { - file_error(ms, 0, "cannot find entry `%s'", sbuf); + if (file_magicfind(ms, rbuf, &ml) == -1) { + file_error(ms, 0, "cannot find entry `%s'", rbuf); return -1; } From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:31:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 79E92D4D; Wed, 10 Dec 2014 08:31:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63185902; Wed, 10 Dec 2014 08:31:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8VjRF037673; Wed, 10 Dec 2014 08:31:45 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8Vg2B037657; Wed, 10 Dec 2014 08:31:42 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412100831.sBA8Vg2B037657@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 10 Dec 2014 08:31:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275669 - in stable: 8/contrib/bind9 8/contrib/bind9/bin/named 8/contrib/bind9/lib/dns 8/contrib/bind9/lib/dns/include/dns 8/contrib/bind9/lib/export/isc 8/contrib/bind9/lib/isc 8/contr... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:31:45 -0000 Author: delphij Date: Wed Dec 10 08:31:41 2014 New Revision: 275669 URL: https://svnweb.freebsd.org/changeset/base/275669 Log: Fix multiple vulnerabilities in file(1) and libmagic(3). Security: FreeBSD-SA-14:28.file Security: CVE-2014-3710, CVE-2014-8116, CVE-2014-8117 Fix BIND remote denial of service vulnerability. Security: FreeBSD-SA-14:29.bind Security: CVE-2014-8500 Modified: stable/9/contrib/bind9/CHANGES stable/9/contrib/bind9/bin/named/config.c stable/9/contrib/bind9/bin/named/query.c stable/9/contrib/bind9/bin/named/server.c stable/9/contrib/bind9/lib/dns/adb.c stable/9/contrib/bind9/lib/dns/include/dns/adb.h stable/9/contrib/bind9/lib/dns/include/dns/resolver.h stable/9/contrib/bind9/lib/dns/resolver.c stable/9/contrib/bind9/lib/isccfg/namedconf.c stable/9/contrib/file/elfclass.h stable/9/contrib/file/readelf.c stable/9/contrib/file/softmagic.c Changes in other areas also in this revision: Added: stable/8/contrib/bind9/lib/isc/counter.c (contents, props changed) stable/8/contrib/bind9/lib/isc/include/isc/counter.h (contents, props changed) Modified: stable/8/contrib/bind9/CHANGES stable/8/contrib/bind9/bin/named/config.c stable/8/contrib/bind9/bin/named/query.c stable/8/contrib/bind9/bin/named/server.c stable/8/contrib/bind9/lib/dns/adb.c stable/8/contrib/bind9/lib/dns/include/dns/adb.h stable/8/contrib/bind9/lib/dns/include/dns/resolver.h stable/8/contrib/bind9/lib/dns/resolver.c stable/8/contrib/bind9/lib/export/isc/Makefile.in stable/8/contrib/bind9/lib/isc/Makefile.in stable/8/contrib/bind9/lib/isc/include/isc/Makefile.in stable/8/contrib/bind9/lib/isc/include/isc/types.h stable/8/contrib/bind9/lib/isccfg/namedconf.c stable/8/contrib/file/elfclass.h stable/8/contrib/file/readelf.c stable/8/contrib/file/softmagic.c stable/8/lib/bind/isc/Makefile Modified: stable/9/contrib/bind9/CHANGES ============================================================================== --- stable/9/contrib/bind9/CHANGES Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/bind9/CHANGES Wed Dec 10 08:31:41 2014 (r275669) @@ -1,3 +1,14 @@ +4006. [security] A flaw in delegation handling could be exploited + to put named into an infinite loop. This has + been addressed by placing limits on the number + of levels of recursion named will allow (default 7), + and the number of iterative queries that it will + send (default 50) before terminating a recursive + query (CVE-2014-8500). + + The recursion depth limit is configured via the + "max-recursion-depth" option. [RT #35780] + --- 9.9.5 released --- --- 9.9.5rc2 released --- Modified: stable/9/contrib/bind9/bin/named/config.c ============================================================================== --- stable/9/contrib/bind9/bin/named/config.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/bind9/bin/named/config.c Wed Dec 10 08:31:41 2014 (r275669) @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.c,v 1.123 2012/01/06 23:46:41 tbox Exp $ */ - /*! \file */ #include @@ -160,6 +158,7 @@ options {\n\ dnssec-accept-expired no;\n\ clients-per-query 10;\n\ max-clients-per-query 100;\n\ + max-recursion-depth 7;\n\ zero-no-soa-ttl-cache no;\n\ nsec3-test-zone no;\n\ allow-new-zones no;\n\ Modified: stable/9/contrib/bind9/bin/named/query.c ============================================================================== --- stable/9/contrib/bind9/bin/named/query.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/bind9/bin/named/query.c Wed Dec 10 08:31:41 2014 (r275669) @@ -3872,12 +3872,11 @@ query_recurse(ns_client_t *client, dns_r peeraddr = &client->peeraddr; else peeraddr = NULL; - result = dns_resolver_createfetch2(client->view->resolver, + result = dns_resolver_createfetch3(client->view->resolver, qname, qtype, qdomain, nameservers, NULL, peeraddr, client->message->id, - client->query.fetchoptions, - client->task, - query_resume, client, + client->query.fetchoptions, 0, + client->task, query_resume, client, rdataset, sigrdataset, &client->query.fetch); Modified: stable/9/contrib/bind9/bin/named/server.c ============================================================================== --- stable/9/contrib/bind9/bin/named/server.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/bind9/bin/named/server.c Wed Dec 10 08:31:41 2014 (r275669) @@ -3141,6 +3141,11 @@ configure_view(dns_view_t *view, cfg_obj cfg_obj_asuint32(obj), max_clients_per_query); + obj = NULL; + result = ns_config_get(maps, "max-recursion-depth", &obj); + INSIST(result == ISC_R_SUCCESS); + dns_resolver_setmaxdepth(view->resolver, cfg_obj_asuint32(obj)); + #ifdef ALLOW_FILTER_AAAA_ON_V4 obj = NULL; result = ns_config_get(maps, "filter-aaaa-on-v4", &obj); Modified: stable/9/contrib/bind9/lib/dns/adb.c ============================================================================== --- stable/9/contrib/bind9/lib/dns/adb.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/bind9/lib/dns/adb.c Wed Dec 10 08:31:41 2014 (r275669) @@ -201,6 +201,7 @@ struct dns_adbfetch { unsigned int magic; dns_fetch_t *fetch; dns_rdataset_t rdataset; + unsigned int depth; }; /*% @@ -301,7 +302,7 @@ static inline void violate_locking_hiera static isc_boolean_t clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static void clean_target(dns_adb_t *, dns_name_t *); static void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, - unsigned int); + isc_uint32_t, unsigned int); static isc_boolean_t check_expire_namehooks(dns_adbname_t *, isc_stdtime_t); static isc_boolean_t check_expire_entry(dns_adb_t *, dns_adbentry_t **, isc_stdtime_t); @@ -309,7 +310,7 @@ static void cancel_fetches_at_name(dns_a static isc_result_t dbfind_name(dns_adbname_t *, isc_stdtime_t, dns_rdatatype_t); static isc_result_t fetch_name(dns_adbname_t *, isc_boolean_t, - dns_rdatatype_t); + unsigned int, dns_rdatatype_t); static inline void check_exit(dns_adb_t *); static void destroy(dns_adb_t *); static isc_boolean_t shutdown_names(dns_adb_t *); @@ -982,7 +983,7 @@ kill_name(dns_adbname_t **n, isc_eventty * Clean up the name's various lists. These two are destructive * in that they will always empty the list. */ - clean_finds_at_name(name, ev, DNS_ADBFIND_ADDRESSMASK); + clean_finds_at_name(name, ev, 0, DNS_ADBFIND_ADDRESSMASK); result4 = clean_namehooks(adb, &name->v4); result6 = clean_namehooks(adb, &name->v6); clean_target(adb, &name->target); @@ -1407,7 +1408,7 @@ event_free(isc_event_t *event) { */ static void clean_finds_at_name(dns_adbname_t *name, isc_eventtype_t evtype, - unsigned int addrs) + isc_uint32_t qtotal, unsigned int addrs) { isc_event_t *ev; isc_task_t *task; @@ -1467,6 +1468,7 @@ clean_finds_at_name(dns_adbname_t *name, ev->ev_sender = find; find->result_v4 = find_err_map[name->fetch_err]; find->result_v6 = find_err_map[name->fetch6_err]; + find->qtotal += qtotal; ev->ev_type = evtype; ev->ev_destroy = event_free; ev->ev_destroy_arg = find; @@ -1821,6 +1823,7 @@ new_adbfind(dns_adb_t *adb) { h->flags = 0; h->result_v4 = ISC_R_UNEXPECTED; h->result_v6 = ISC_R_UNEXPECTED; + h->qtotal = 0; ISC_LINK_INIT(h, publink); ISC_LINK_INIT(h, plink); ISC_LIST_INIT(h->list); @@ -2770,6 +2773,19 @@ dns_adb_createfind(dns_adb_t *adb, isc_t isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **findp) { + return (dns_adb_createfind2(adb, task, action, arg, name, + qname, qtype, options, now, + target, port, 0, findp)); +} + +isc_result_t +dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, + void *arg, dns_name_t *name, dns_name_t *qname, + dns_rdatatype_t qtype, unsigned int options, + isc_stdtime_t now, dns_name_t *target, + in_port_t port, unsigned int depth, + dns_adbfind_t **findp) +{ dns_adbfind_t *find; dns_adbname_t *adbname; int bucket; @@ -3000,7 +3016,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_t * Start V4. */ if (WANT_INET(wanted_fetches) && - fetch_name(adbname, start_at_zone, + fetch_name(adbname, start_at_zone, depth, dns_rdatatype_a) == ISC_R_SUCCESS) { DP(DEF_LEVEL, "dns_adb_createfind: started A fetch for name %p", @@ -3011,7 +3027,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_t * Start V6. */ if (WANT_INET6(wanted_fetches) && - fetch_name(adbname, start_at_zone, + fetch_name(adbname, start_at_zone, depth, dns_rdatatype_aaaa) == ISC_R_SUCCESS) { DP(DEF_LEVEL, "dns_adb_createfind: " @@ -3627,6 +3643,7 @@ fetch_callback(isc_task_t *task, isc_eve isc_result_t result; unsigned int address_type; isc_boolean_t want_check_exit = ISC_FALSE; + isc_uint32_t qtotal = 0; UNUSED(task); @@ -3637,6 +3654,8 @@ fetch_callback(isc_task_t *task, isc_eve adb = name->adb; INSIST(DNS_ADB_VALID(adb)); + qtotal = dev->qtotal; + bucket = name->lock_bucket; LOCK(&adb->namelocks[bucket]); @@ -3754,6 +3773,12 @@ fetch_callback(isc_task_t *task, isc_eve DP(DEF_LEVEL, "adb: fetch of '%s' %s failed: %s", buf, address_type == DNS_ADBFIND_INET ? "A" : "AAAA", dns_result_totext(dev->result)); + /* + * Don't record a failure unless this is the initial + * fetch of a chain. + */ + if (fetch->depth > 1) + goto out; /* XXXMLG Don't pound on bad servers. */ if (address_type == DNS_ADBFIND_INET) { name->expire_v4 = ISC_MIN(name->expire_v4, now + 300); @@ -3785,15 +3810,14 @@ fetch_callback(isc_task_t *task, isc_eve free_adbfetch(adb, &fetch); isc_event_free(&ev); - clean_finds_at_name(name, ev_status, address_type); + clean_finds_at_name(name, ev_status, qtotal, address_type); UNLOCK(&adb->namelocks[bucket]); } static isc_result_t -fetch_name(dns_adbname_t *adbname, - isc_boolean_t start_at_zone, - dns_rdatatype_t type) +fetch_name(dns_adbname_t *adbname, isc_boolean_t start_at_zone, + unsigned int depth, dns_rdatatype_t type) { isc_result_t result; dns_adbfetch_t *fetch = NULL; @@ -3838,12 +3862,14 @@ fetch_name(dns_adbname_t *adbname, result = ISC_R_NOMEMORY; goto cleanup; } + fetch->depth = depth; - result = dns_resolver_createfetch(adb->view->resolver, &adbname->name, - type, name, nameservers, NULL, - options, adb->task, fetch_callback, - adbname, &fetch->rdataset, NULL, - &fetch->fetch); + result = dns_resolver_createfetch3(adb->view->resolver, &adbname->name, + type, name, nameservers, NULL, + NULL, 0, options, depth, adb->task, + fetch_callback, adbname, + &fetch->rdataset, NULL, + &fetch->fetch); if (result != ISC_R_SUCCESS) goto cleanup; Modified: stable/9/contrib/bind9/lib/dns/include/dns/adb.h ============================================================================== --- stable/9/contrib/bind9/lib/dns/include/dns/adb.h Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/bind9/lib/dns/include/dns/adb.h Wed Dec 10 08:31:41 2014 (r275669) @@ -118,6 +118,8 @@ struct dns_adbfind { isc_result_t result_v6; /*%< RO: v6 result */ ISC_LINK(dns_adbfind_t) publink; /*%< RW: client use */ + isc_uint32_t qtotal; + /* Private */ isc_mutex_t lock; /* locks all below */ in_port_t port; @@ -334,6 +336,12 @@ dns_adb_createfind(dns_adb_t *adb, isc_t dns_rdatatype_t qtype, unsigned int options, isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **find); +isc_result_t +dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, + void *arg, dns_name_t *name, dns_name_t *qname, + dns_rdatatype_t qtype, unsigned int options, + isc_stdtime_t now, dns_name_t *target, in_port_t port, + unsigned int depth, dns_adbfind_t **find); /*%< * Main interface for clients. The adb will look up the name given in * "name" and will build up a list of found addresses, and perhaps start Modified: stable/9/contrib/bind9/lib/dns/include/dns/resolver.h ============================================================================== --- stable/9/contrib/bind9/lib/dns/include/dns/resolver.h Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/bind9/lib/dns/include/dns/resolver.h Wed Dec 10 08:31:41 2014 (r275669) @@ -82,6 +82,7 @@ typedef struct dns_fetchevent { isc_sockaddr_t * client; dns_messageid_t id; isc_result_t vresult; + isc_uint32_t qtotal; } dns_fetchevent_t; /* @@ -274,6 +275,18 @@ dns_resolver_createfetch2(dns_resolver_t dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp); +isc_result_t +dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name, + dns_rdatatype_t type, + dns_name_t *domain, dns_rdataset_t *nameservers, + dns_forwarders_t *forwarders, + isc_sockaddr_t *client, isc_uint16_t id, + unsigned int options, unsigned int depth, + isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_rdataset_t *rdataset, + dns_rdataset_t *sigrdataset, + dns_fetch_t **fetchp); /*%< * Recurse to answer a question. * @@ -575,6 +588,18 @@ dns_resolver_printbadcache(dns_resolver_ * \li resolver to be valid. */ +void +dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth); +unsigned int +dns_resolver_getmaxdepth(dns_resolver_t *resolver); +/*% + * Get and set how many NS indirections will be followed when looking for + * nameserver addresses. + * + * Requires: + * \li resolver to be valid. + */ + ISC_LANG_ENDDECLS #endif /* DNS_RESOLVER_H */ Modified: stable/9/contrib/bind9/lib/dns/resolver.c ============================================================================== --- stable/9/contrib/bind9/lib/dns/resolver.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/bind9/lib/dns/resolver.c Wed Dec 10 08:31:41 2014 (r275669) @@ -131,6 +131,16 @@ #define MAXIMUM_QUERY_TIMEOUT 30 /* The maximum time in seconds for the whole query to live. */ #endif +/* The default maximum number of recursions to follow before giving up. */ +#ifndef DEFAULT_RECURSION_DEPTH +#define DEFAULT_RECURSION_DEPTH 7 +#endif + +/* The default maximum number of iterative queries to allow before giving up. */ +#ifndef DEFAULT_MAX_QUERIES +#define DEFAULT_MAX_QUERIES 50 +#endif + /*% * Maximum EDNS0 input packet size. */ @@ -297,6 +307,7 @@ struct fetchctx { isc_uint64_t duration; isc_boolean_t logged; unsigned int querysent; + unsigned int totalqueries; unsigned int referrals; unsigned int lamecount; unsigned int neterr; @@ -307,6 +318,7 @@ struct fetchctx { isc_boolean_t timeout; dns_adbaddrinfo_t *addrinfo; isc_sockaddr_t *client; + unsigned int depth; }; #define FCTX_MAGIC ISC_MAGIC('F', '!', '!', '!') @@ -418,6 +430,7 @@ struct dns_resolver { isc_timer_t * spillattimer; isc_boolean_t zero_no_soa_ttl; unsigned int query_timeout; + unsigned int maxdepth; /* Locked by lock. */ unsigned int references; @@ -1093,6 +1106,7 @@ fctx_sendevents(fetchctx_t *fctx, isc_re event->result == DNS_R_NCACHENXRRSET); } + event->qtotal = fctx->totalqueries; isc_task_sendanddetach(&task, ISC_EVENT_PTR(&event)); count++; } @@ -1533,7 +1547,9 @@ fctx_query(fetchctx_t *fctx, dns_adbaddr if (result != ISC_R_SUCCESS) goto cleanup_dispatch; } + fctx->querysent++; + fctx->totalqueries++; ISC_LIST_APPEND(fctx->queries, query, link); query->fctx->nqueries++; @@ -2186,9 +2202,10 @@ fctx_finddone(isc_task_t *task, isc_even */ INSIST(!SHUTTINGDOWN(fctx)); fctx->attributes &= ~FCTX_ATTR_ADDRWAIT; - if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) + if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) { want_try = ISC_TRUE; - else { + fctx->totalqueries += find->qtotal; + } else { fctx->findfail++; if (fctx->pending == 0) { /* @@ -2471,12 +2488,13 @@ findname(fetchctx_t *fctx, dns_name_t *n * See what we know about this address. */ find = NULL; - result = dns_adb_createfind(fctx->adb, - res->buckets[fctx->bucketnum].task, - fctx_finddone, fctx, name, - &fctx->name, fctx->type, - options, now, NULL, - res->view->dstport, &find); + result = dns_adb_createfind2(fctx->adb, + res->buckets[fctx->bucketnum].task, + fctx_finddone, fctx, name, + &fctx->name, fctx->type, + options, now, NULL, + res->view->dstport, + fctx->depth + 1, &find); if (result != ISC_R_SUCCESS) { if (result == DNS_R_ALIAS) { /* @@ -2584,6 +2602,11 @@ fctx_getaddresses(fetchctx_t *fctx, isc_ res = fctx->res; + if (fctx->depth > res->maxdepth) { + FCTXTRACE("too much NS indirection"); + return (DNS_R_SERVFAIL); + } + /* * Forwarders. */ @@ -3022,6 +3045,9 @@ fctx_try(fetchctx_t *fctx, isc_boolean_t REQUIRE(!ADDRWAIT(fctx)); + if (fctx->totalqueries > DEFAULT_MAX_QUERIES) + fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); + addrinfo = fctx_nextaddress(fctx); if (addrinfo == NULL) { /* @@ -3380,6 +3406,7 @@ fctx_start(isc_task_t *task, isc_event_t * Normal fctx startup. */ fctx->state = fetchstate_active; + fctx->totalqueries = 0; /* * Reset the control event for later use in shutting down * the fctx. @@ -3449,6 +3476,7 @@ fctx_join(fetchctx_t *fctx, isc_task_t * event->fetch = fetch; event->client = client; event->id = id; + event->qtotal = 0; dns_fixedname_init(&event->foundname); /* @@ -3485,7 +3513,8 @@ log_ns_ttl(fetchctx_t *fctx, const char static isc_result_t fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, dns_name_t *domain, dns_rdataset_t *nameservers, - unsigned int options, unsigned int bucketnum, fetchctx_t **fctxp) + unsigned int options, unsigned int bucketnum, unsigned int depth, + fetchctx_t **fctxp) { fetchctx_t *fctx; isc_result_t result; @@ -3537,6 +3566,7 @@ fctx_create(dns_resolver_t *res, dns_nam fctx->state = fetchstate_init; fctx->want_shutdown = ISC_FALSE; fctx->cloned = ISC_FALSE; + fctx->depth = depth; ISC_LIST_INIT(fctx->queries); ISC_LIST_INIT(fctx->finds); ISC_LIST_INIT(fctx->altfinds); @@ -3555,6 +3585,7 @@ fctx_create(dns_resolver_t *res, dns_nam fctx->pending = 0; fctx->restarts = 0; fctx->querysent = 0; + fctx->totalqueries = 0; fctx->referrals = 0; TIME_NOW(&fctx->start); fctx->timeouts = 0; @@ -7731,6 +7762,7 @@ dns_resolver_create(dns_view_t *view, res->spillattimer = NULL; res->zero_no_soa_ttl = ISC_FALSE; res->query_timeout = DEFAULT_QUERY_TIMEOUT; + res->maxdepth = DEFAULT_RECURSION_DEPTH; res->nbuckets = ntasks; res->activebuckets = ntasks; res->buckets = isc_mem_get(view->mctx, @@ -8169,9 +8201,9 @@ dns_resolver_createfetch(dns_resolver_t dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp) { - return (dns_resolver_createfetch2(res, name, type, domain, + return (dns_resolver_createfetch3(res, name, type, domain, nameservers, forwarders, NULL, 0, - options, task, action, arg, + options, 0, task, action, arg, rdataset, sigrdataset, fetchp)); } @@ -8187,6 +8219,25 @@ dns_resolver_createfetch2(dns_resolver_t dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp) { + return (dns_resolver_createfetch3(res, name, type, domain, + nameservers, forwarders, client, id, + options, 0, task, action, arg, + rdataset, sigrdataset, fetchp)); +} + +isc_result_t +dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name, + dns_rdatatype_t type, + dns_name_t *domain, dns_rdataset_t *nameservers, + dns_forwarders_t *forwarders, + isc_sockaddr_t *client, dns_messageid_t id, + unsigned int options, unsigned int depth, + isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_rdataset_t *rdataset, + dns_rdataset_t *sigrdataset, + dns_fetch_t **fetchp) +{ dns_fetch_t *fetch; fetchctx_t *fctx = NULL; isc_result_t result = ISC_R_SUCCESS; @@ -8273,11 +8324,12 @@ dns_resolver_createfetch2(dns_resolver_t if (fctx == NULL) { result = fctx_create(res, name, type, domain, nameservers, - options, bucketnum, &fctx); + options, bucketnum, depth, &fctx); if (result != ISC_R_SUCCESS) goto unlock; new_fctx = ISC_TRUE; - } + } else if (fctx->depth > depth) + fctx->depth = depth; result = fctx_join(fctx, task, client, id, action, arg, rdataset, sigrdataset, fetch); @@ -9049,3 +9101,15 @@ dns_resolver_settimeout(dns_resolver_t * resolver->query_timeout = seconds; } + +void +dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth) { + REQUIRE(VALID_RESOLVER(resolver)); + resolver->maxdepth = maxdepth; +} + +unsigned int +dns_resolver_getmaxdepth(dns_resolver_t *resolver) { + REQUIRE(VALID_RESOLVER(resolver)); + return (resolver->maxdepth); +} Modified: stable/9/contrib/bind9/lib/isccfg/namedconf.c ============================================================================== --- stable/9/contrib/bind9/lib/isccfg/namedconf.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/bind9/lib/isccfg/namedconf.c Wed Dec 10 08:31:41 2014 (r275669) @@ -1419,6 +1419,7 @@ view_clauses[] = { { "max-cache-ttl", &cfg_type_uint32, 0 }, { "max-clients-per-query", &cfg_type_uint32, 0 }, { "max-ncache-ttl", &cfg_type_uint32, 0 }, + { "max-recursion-depth", &cfg_type_uint32, 0 }, { "max-udp-size", &cfg_type_uint32, 0 }, { "min-roots", &cfg_type_uint32, CFG_CLAUSEFLAG_NOTIMP }, { "minimal-responses", &cfg_type_boolean, 0 }, Modified: stable/9/contrib/file/elfclass.h ============================================================================== --- stable/9/contrib/file/elfclass.h Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/file/elfclass.h Wed Dec 10 08:31:41 2014 (r275669) @@ -35,10 +35,12 @@ switch (type) { #ifdef ELFCORE case ET_CORE: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); flags |= FLAGS_IS_CORE; if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) return -1; @@ -46,18 +48,24 @@ #endif case ET_EXEC: case ET_DYN: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), - fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) - == -1) + fsize, &flags, shnum) == -1) return -1; /*FALLTHROUGH*/ case ET_REL: + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), - elf_getu16(swap, elfhdr.e_shnum), + (off_t)elf_getu(swap, elfhdr.e_shoff), shnum, (size_t)elf_getu16(swap, elfhdr.e_shentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_machine)) == -1) return -1; Modified: stable/9/contrib/file/readelf.c ============================================================================== --- stable/9/contrib/file/readelf.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/file/readelf.c Wed Dec 10 08:31:41 2014 (r275669) @@ -60,6 +60,18 @@ private uint16_t getu16(int, uint16_t); private uint32_t getu32(int, uint32_t); private uint64_t getu64(int, uint64_t); +#define MAX_PHNUM 256 +#define MAX_SHNUM 1024 + +private int +toomany(struct magic_set *ms, const char *name, uint16_t num) +{ + if (file_printf(ms, ", too many %s header sections (%u)", name, num + ) == -1) + return -1; + return 0; +} + private uint16_t getu16(int swap, uint16_t value) { @@ -384,13 +396,13 @@ donote(struct magic_set *ms, void *vbuf, if (namesz & 0x80000000) { (void)file_printf(ms, ", bad note name size 0x%lx", (unsigned long)namesz); - return offset; + return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, ", bad note description size 0x%lx", (unsigned long)descsz); - return offset; + return 0; } @@ -847,6 +859,7 @@ doshn(struct magic_set *ms, int clazz, i Elf32_Shdr sh32; Elf64_Shdr sh64; int stripped = 1; + size_t nbadcap = 0; void *nbuf; off_t noff, coff; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ @@ -919,6 +932,8 @@ doshn(struct magic_set *ms, int clazz, i free(nbuf); break; case SHT_SUNW_cap: + if (nbadcap > 5) + break; if (lseek(fd, (off_t)xsh_offset, SEEK_SET) == (off_t)-1) { file_badseek(ms); @@ -955,6 +970,8 @@ doshn(struct magic_set *ms, int clazz, i (unsigned long long)xcap_tag, (unsigned long long)xcap_val) == -1) return -1; + if (nbadcap++ > 2) + coff = xsh_size; break; } } @@ -1142,7 +1159,7 @@ file_tryelf(struct magic_set *ms, int fd int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; - uint16_t type; + uint16_t type, phnum, shnum; if (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) return 0; Modified: stable/9/contrib/file/softmagic.c ============================================================================== --- stable/9/contrib/file/softmagic.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/9/contrib/file/softmagic.c Wed Dec 10 08:31:41 2014 (r275669) @@ -61,6 +61,9 @@ private void cvt_32(union VALUETYPE *, c private void cvt_64(union VALUETYPE *, const struct magic *); #define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + +#define MAX_RECURSION_LEVEL 10 + /* * softmagic - lookup one file in parsed, in-memory copy of database * Passed the name and FILE * of one file to be typed. @@ -1027,7 +1030,7 @@ mget(struct magic_set *ms, const unsigne uint32_t count = m->str_range; union VALUETYPE *p = &ms->ms_value; - if (recursion_level >= 20) { + if (recursion_level >= MAX_RECURSION_LEVEL) { file_error(ms, 0, "recursion nesting exceeded"); return -1; } From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:31:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A0732E57; Wed, 10 Dec 2014 08:31:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89751905; Wed, 10 Dec 2014 08:31:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8VouO037707; Wed, 10 Dec 2014 08:31:50 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8VjLa037678; Wed, 10 Dec 2014 08:31:45 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412100831.sBA8VjLa037678@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 10 Dec 2014 08:31:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r275669 - in stable: 8/contrib/bind9 8/contrib/bind9/bin/named 8/contrib/bind9/lib/dns 8/contrib/bind9/lib/dns/include/dns 8/contrib/bind9/lib/export/isc 8/contrib/bind9/lib/isc 8/contr... X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:31:50 -0000 Author: delphij Date: Wed Dec 10 08:31:41 2014 New Revision: 275669 URL: https://svnweb.freebsd.org/changeset/base/275669 Log: Fix multiple vulnerabilities in file(1) and libmagic(3). Security: FreeBSD-SA-14:28.file Security: CVE-2014-3710, CVE-2014-8116, CVE-2014-8117 Fix BIND remote denial of service vulnerability. Security: FreeBSD-SA-14:29.bind Security: CVE-2014-8500 Added: stable/8/contrib/bind9/lib/isc/counter.c (contents, props changed) stable/8/contrib/bind9/lib/isc/include/isc/counter.h (contents, props changed) Modified: stable/8/contrib/bind9/CHANGES stable/8/contrib/bind9/bin/named/config.c stable/8/contrib/bind9/bin/named/query.c stable/8/contrib/bind9/bin/named/server.c stable/8/contrib/bind9/lib/dns/adb.c stable/8/contrib/bind9/lib/dns/include/dns/adb.h stable/8/contrib/bind9/lib/dns/include/dns/resolver.h stable/8/contrib/bind9/lib/dns/resolver.c stable/8/contrib/bind9/lib/export/isc/Makefile.in stable/8/contrib/bind9/lib/isc/Makefile.in stable/8/contrib/bind9/lib/isc/include/isc/Makefile.in stable/8/contrib/bind9/lib/isc/include/isc/types.h stable/8/contrib/bind9/lib/isccfg/namedconf.c stable/8/contrib/file/elfclass.h stable/8/contrib/file/readelf.c stable/8/contrib/file/softmagic.c stable/8/lib/bind/isc/Makefile Changes in other areas also in this revision: Modified: stable/9/contrib/bind9/CHANGES stable/9/contrib/bind9/bin/named/config.c stable/9/contrib/bind9/bin/named/query.c stable/9/contrib/bind9/bin/named/server.c stable/9/contrib/bind9/lib/dns/adb.c stable/9/contrib/bind9/lib/dns/include/dns/adb.h stable/9/contrib/bind9/lib/dns/include/dns/resolver.h stable/9/contrib/bind9/lib/dns/resolver.c stable/9/contrib/bind9/lib/isccfg/namedconf.c stable/9/contrib/file/elfclass.h stable/9/contrib/file/readelf.c stable/9/contrib/file/softmagic.c Modified: stable/8/contrib/bind9/CHANGES ============================================================================== --- stable/8/contrib/bind9/CHANGES Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/CHANGES Wed Dec 10 08:31:41 2014 (r275669) @@ -1,3 +1,15 @@ +4006. [security] A flaw in delegation handling could be exploited + to put named into an infinite loop. This has + been addressed by placing limits on the number + of levels of recursion named will allow (default 7), + and the number of iterative queries that it will + send (default 50) before terminating a recursive + query (CVE-2014-8500). + + The recursion depth limit is configured via the + "max-recursion-depth" option, and the query limit + via the "max-recursion-queries" option. [RT #37580] + --- 9.8.7 released --- --- 9.8.7rc2 released --- Modified: stable/8/contrib/bind9/bin/named/config.c ============================================================================== --- stable/8/contrib/bind9/bin/named/config.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/bin/named/config.c Wed Dec 10 08:31:41 2014 (r275669) @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.c,v 1.113.16.2 2011/02/28 01:19:58 tbox Exp $ */ - /*! \file */ #include @@ -159,6 +157,8 @@ options {\n\ dnssec-accept-expired no;\n\ clients-per-query 10;\n\ max-clients-per-query 100;\n\ + max-recursion-depth 7;\n\ + max-recursion-queries 50;\n\ zero-no-soa-ttl-cache no;\n\ nsec3-test-zone no;\n\ allow-new-zones no;\n\ Modified: stable/8/contrib/bind9/bin/named/query.c ============================================================================== --- stable/8/contrib/bind9/bin/named/query.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/bin/named/query.c Wed Dec 10 08:31:41 2014 (r275669) @@ -3802,12 +3802,11 @@ query_recurse(ns_client_t *client, dns_r peeraddr = &client->peeraddr; else peeraddr = NULL; - result = dns_resolver_createfetch2(client->view->resolver, + result = dns_resolver_createfetch3(client->view->resolver, qname, qtype, qdomain, nameservers, NULL, peeraddr, client->message->id, - client->query.fetchoptions, - client->task, - query_resume, client, + client->query.fetchoptions, 0, NULL, + client->task, query_resume, client, rdataset, sigrdataset, &client->query.fetch); Modified: stable/8/contrib/bind9/bin/named/server.c ============================================================================== --- stable/8/contrib/bind9/bin/named/server.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/bin/named/server.c Wed Dec 10 08:31:41 2014 (r275669) @@ -2949,6 +2949,16 @@ configure_view(dns_view_t *view, cfg_obj cfg_obj_asuint32(obj), max_clients_per_query); + obj = NULL; + result = ns_config_get(maps, "max-recursion-depth", &obj); + INSIST(result == ISC_R_SUCCESS); + dns_resolver_setmaxdepth(view->resolver, cfg_obj_asuint32(obj)); + + obj = NULL; + result = ns_config_get(maps, "max-recursion-queries", &obj); + INSIST(result == ISC_R_SUCCESS); + dns_resolver_setmaxqueries(view->resolver, cfg_obj_asuint32(obj)); + #ifdef ALLOW_FILTER_AAAA_ON_V4 obj = NULL; result = ns_config_get(maps, "filter-aaaa-on-v4", &obj); Modified: stable/8/contrib/bind9/lib/dns/adb.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/adb.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/lib/dns/adb.c Wed Dec 10 08:31:41 2014 (r275669) @@ -201,6 +201,7 @@ struct dns_adbfetch { unsigned int magic; dns_fetch_t *fetch; dns_rdataset_t rdataset; + unsigned int depth; }; /*% @@ -300,8 +301,7 @@ static inline isc_boolean_t dec_entry_re static inline void violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *); static isc_boolean_t clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static void clean_target(dns_adb_t *, dns_name_t *); -static void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, - unsigned int); +static void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, unsigned int); static isc_boolean_t check_expire_namehooks(dns_adbname_t *, isc_stdtime_t); static isc_boolean_t check_expire_entry(dns_adb_t *, dns_adbentry_t **, isc_stdtime_t); @@ -309,6 +309,7 @@ static void cancel_fetches_at_name(dns_a static isc_result_t dbfind_name(dns_adbname_t *, isc_stdtime_t, dns_rdatatype_t); static isc_result_t fetch_name(dns_adbname_t *, isc_boolean_t, + unsigned int, isc_counter_t *qc, dns_rdatatype_t); static inline void check_exit(dns_adb_t *); static void destroy(dns_adb_t *); @@ -2770,6 +2771,19 @@ dns_adb_createfind(dns_adb_t *adb, isc_t isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **findp) { + return (dns_adb_createfind2(adb, task, action, arg, name, + qname, qtype, options, now, + target, port, 0, NULL, findp)); +} + +isc_result_t +dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, + void *arg, dns_name_t *name, dns_name_t *qname, + dns_rdatatype_t qtype, unsigned int options, + isc_stdtime_t now, dns_name_t *target, + in_port_t port, unsigned int depth, isc_counter_t *qc, + dns_adbfind_t **findp) +{ dns_adbfind_t *find; dns_adbname_t *adbname; int bucket; @@ -3000,7 +3014,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_t * Start V4. */ if (WANT_INET(wanted_fetches) && - fetch_name(adbname, start_at_zone, + fetch_name(adbname, start_at_zone, depth, qc, dns_rdatatype_a) == ISC_R_SUCCESS) { DP(DEF_LEVEL, "dns_adb_createfind: started A fetch for name %p", @@ -3011,7 +3025,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_t * Start V6. */ if (WANT_INET6(wanted_fetches) && - fetch_name(adbname, start_at_zone, + fetch_name(adbname, start_at_zone, depth, qc, dns_rdatatype_aaaa) == ISC_R_SUCCESS) { DP(DEF_LEVEL, "dns_adb_createfind: " @@ -3754,6 +3768,12 @@ fetch_callback(isc_task_t *task, isc_eve DP(DEF_LEVEL, "adb: fetch of '%s' %s failed: %s", buf, address_type == DNS_ADBFIND_INET ? "A" : "AAAA", dns_result_totext(dev->result)); + /* + * Don't record a failure unless this is the initial + * fetch of a chain. + */ + if (fetch->depth > 1) + goto out; /* XXXMLG Don't pound on bad servers. */ if (address_type == DNS_ADBFIND_INET) { name->expire_v4 = ISC_MIN(name->expire_v4, now + 300); @@ -3791,9 +3811,8 @@ fetch_callback(isc_task_t *task, isc_eve } static isc_result_t -fetch_name(dns_adbname_t *adbname, - isc_boolean_t start_at_zone, - dns_rdatatype_t type) +fetch_name(dns_adbname_t *adbname, isc_boolean_t start_at_zone, + unsigned int depth, isc_counter_t *qc, dns_rdatatype_t type) { isc_result_t result; dns_adbfetch_t *fetch = NULL; @@ -3838,12 +3857,14 @@ fetch_name(dns_adbname_t *adbname, result = ISC_R_NOMEMORY; goto cleanup; } + fetch->depth = depth; - result = dns_resolver_createfetch(adb->view->resolver, &adbname->name, - type, name, nameservers, NULL, - options, adb->task, fetch_callback, - adbname, &fetch->rdataset, NULL, - &fetch->fetch); + result = dns_resolver_createfetch3(adb->view->resolver, &adbname->name, + type, name, nameservers, NULL, + NULL, 0, options, depth, qc, + adb->task, fetch_callback, adbname, + &fetch->rdataset, NULL, + &fetch->fetch); if (result != ISC_R_SUCCESS) goto cleanup; Modified: stable/8/contrib/bind9/lib/dns/include/dns/adb.h ============================================================================== --- stable/8/contrib/bind9/lib/dns/include/dns/adb.h Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/lib/dns/include/dns/adb.h Wed Dec 10 08:31:41 2014 (r275669) @@ -334,6 +334,13 @@ dns_adb_createfind(dns_adb_t *adb, isc_t dns_rdatatype_t qtype, unsigned int options, isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **find); +isc_result_t +dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, + void *arg, dns_name_t *name, dns_name_t *qname, + dns_rdatatype_t qtype, unsigned int options, + isc_stdtime_t now, dns_name_t *target, in_port_t port, + unsigned int depth, isc_counter_t *qc, + dns_adbfind_t **find); /*%< * Main interface for clients. The adb will look up the name given in * "name" and will build up a list of found addresses, and perhaps start Modified: stable/8/contrib/bind9/lib/dns/include/dns/resolver.h ============================================================================== --- stable/8/contrib/bind9/lib/dns/include/dns/resolver.h Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/lib/dns/include/dns/resolver.h Wed Dec 10 08:31:41 2014 (r275669) @@ -271,6 +271,18 @@ dns_resolver_createfetch2(dns_resolver_t dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp); +isc_result_t +dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name, + dns_rdatatype_t type, + dns_name_t *domain, dns_rdataset_t *nameservers, + dns_forwarders_t *forwarders, + isc_sockaddr_t *client, isc_uint16_t id, + unsigned int options, unsigned int depth, + isc_counter_t *qc, isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_rdataset_t *rdataset, + dns_rdataset_t *sigrdataset, + dns_fetch_t **fetchp); /*%< * Recurse to answer a question. * @@ -572,6 +584,30 @@ dns_resolver_printbadcache(dns_resolver_ * \li resolver to be valid. */ +void +dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth); +unsigned int +dns_resolver_getmaxdepth(dns_resolver_t *resolver); +/*% + * Get and set how many NS indirections will be followed when looking for + * nameserver addresses. + * + * Requires: + * \li resolver to be valid. + */ + +void +dns_resolver_setmaxqueries(dns_resolver_t *resolver, unsigned int queries); +unsigned int +dns_resolver_getmaxqueries(dns_resolver_t *resolver); +/*% + * Get and set how many iterative queries will be allowed before + * terminating a recursive query. + * + * Requires: + * \li resolver to be valid. + */ + ISC_LANG_ENDDECLS #endif /* DNS_RESOLVER_H */ Modified: stable/8/contrib/bind9/lib/dns/resolver.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/resolver.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/lib/dns/resolver.c Wed Dec 10 08:31:41 2014 (r275669) @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -130,6 +131,16 @@ #define MAXIMUM_QUERY_TIMEOUT 30 /* The maximum time in seconds for the whole query to live. */ #endif +/* The default maximum number of recursions to follow before giving up. */ +#ifndef DEFAULT_RECURSION_DEPTH +#define DEFAULT_RECURSION_DEPTH 7 +#endif + +/* The default maximum number of iterative queries to allow before giving up. */ +#ifndef DEFAULT_MAX_QUERIES +#define DEFAULT_MAX_QUERIES 50 +#endif + /*% * Maximum EDNS0 input packet size. */ @@ -232,12 +243,13 @@ struct fetchctx { isc_sockaddrlist_t edns; isc_sockaddrlist_t edns512; isc_sockaddrlist_t bad_edns; - dns_validator_t *validator; + dns_validator_t * validator; ISC_LIST(dns_validator_t) validators; dns_db_t * cache; dns_adb_t * adb; isc_boolean_t ns_ttl_ok; isc_uint32_t ns_ttl; + isc_counter_t * qc; /*% * The number of events we're waiting for. @@ -305,6 +317,7 @@ struct fetchctx { isc_boolean_t timeout; dns_adbaddrinfo_t *addrinfo; isc_sockaddr_t *client; + unsigned int depth; }; #define FCTX_MAGIC ISC_MAGIC('F', '!', '!', '!') @@ -417,6 +430,8 @@ struct dns_resolver { isc_timer_t * spillattimer; isc_boolean_t zero_no_soa_ttl; unsigned int query_timeout; + unsigned int maxdepth; + unsigned int maxqueries; /* Locked by lock. */ unsigned int references; @@ -1530,6 +1545,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddr if (result != ISC_R_SUCCESS) goto cleanup_dispatch; } + fctx->querysent++; ISC_LIST_APPEND(fctx->queries, query, link); @@ -2180,9 +2196,9 @@ fctx_finddone(isc_task_t *task, isc_even */ INSIST(!SHUTTINGDOWN(fctx)); fctx->attributes &= ~FCTX_ATTR_ADDRWAIT; - if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) + if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) { want_try = ISC_TRUE; - else { + } else { fctx->findfail++; if (fctx->pending == 0) { /* @@ -2211,7 +2227,7 @@ fctx_finddone(isc_task_t *task, isc_even else if (want_done) fctx_done(fctx, ISC_R_FAILURE, __LINE__); else if (destroy) { - fctx_destroy(fctx); + fctx_destroy(fctx); if (bucket_empty) empty_bucket(res); } @@ -2465,12 +2481,13 @@ findname(fetchctx_t *fctx, dns_name_t *n * See what we know about this address. */ find = NULL; - result = dns_adb_createfind(fctx->adb, - res->buckets[fctx->bucketnum].task, - fctx_finddone, fctx, name, - &fctx->name, fctx->type, - options, now, NULL, - res->view->dstport, &find); + result = dns_adb_createfind2(fctx->adb, + res->buckets[fctx->bucketnum].task, + fctx_finddone, fctx, name, + &fctx->name, fctx->type, + options, now, NULL, + res->view->dstport, + fctx->depth + 1, fctx->qc, &find); if (result != ISC_R_SUCCESS) { if (result == DNS_R_ALIAS) { /* @@ -2578,6 +2595,14 @@ fctx_getaddresses(fetchctx_t *fctx, isc_ res = fctx->res; + if (fctx->depth > res->maxdepth) { + isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(3), + "too much NS indirection resolving '%s'", + fctx->info); + return (DNS_R_SERVFAIL); + } + /* * Forwarders. */ @@ -3053,6 +3078,16 @@ fctx_try(fetchctx_t *fctx, isc_boolean_t } } + result = isc_counter_increment(fctx->qc); + if (result != ISC_R_SUCCESS) { + isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(3), + "exceeded max queries resolving '%s'", + fctx->info); + fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); + return; + } + result = fctx_query(fctx, addrinfo, fctx->options); if (result != ISC_R_SUCCESS) fctx_done(fctx, result, __LINE__); @@ -3151,6 +3186,7 @@ fctx_destroy(fetchctx_t *fctx) { isc_mem_put(fctx->mctx, sa, sizeof(*sa)); } + isc_counter_detach(&fctx->qc); isc_timer_detach(&fctx->timer); dns_message_destroy(&fctx->rmessage); dns_message_destroy(&fctx->qmessage); @@ -3479,7 +3515,8 @@ log_ns_ttl(fetchctx_t *fctx, const char static isc_result_t fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, dns_name_t *domain, dns_rdataset_t *nameservers, - unsigned int options, unsigned int bucketnum, fetchctx_t **fctxp) + unsigned int options, unsigned int bucketnum, unsigned int depth, + isc_counter_t *qc, fetchctx_t **fctxp) { fetchctx_t *fctx; isc_result_t result; @@ -3501,6 +3538,21 @@ fctx_create(dns_resolver_t *res, dns_nam fctx = isc_mem_get(mctx, sizeof(*fctx)); if (fctx == NULL) return (ISC_R_NOMEMORY); + + fctx->qc = NULL; + if (qc != NULL) { + isc_counter_attach(qc, &fctx->qc); + } else { + result = isc_counter_create(res->mctx, + res->maxqueries, &fctx->qc); + if (result != ISC_R_SUCCESS) + goto cleanup_fetch; + } + + /* + * Make fctx->info point to a copy of a formatted string + * "name/type". + */ dns_name_format(name, buf, sizeof(buf)); dns_rdatatype_format(type, typebuf, sizeof(typebuf)); strcat(buf, "/"); /* checked */ @@ -3508,7 +3560,7 @@ fctx_create(dns_resolver_t *res, dns_nam fctx->info = isc_mem_strdup(mctx, buf); if (fctx->info == NULL) { result = ISC_R_NOMEMORY; - goto cleanup_fetch; + goto cleanup_counter; } FCTXTRACE("create"); dns_name_init(&fctx->name, NULL); @@ -3531,6 +3583,7 @@ fctx_create(dns_resolver_t *res, dns_nam fctx->state = fetchstate_init; fctx->want_shutdown = ISC_FALSE; fctx->cloned = ISC_FALSE; + fctx->depth = depth; ISC_LIST_INIT(fctx->queries); ISC_LIST_INIT(fctx->finds); ISC_LIST_INIT(fctx->altfinds); @@ -3738,6 +3791,9 @@ fctx_create(dns_resolver_t *res, dns_nam cleanup_info: isc_mem_free(mctx, fctx->info); + cleanup_counter: + isc_counter_detach(&fctx->qc); + cleanup_fetch: isc_mem_put(mctx, fctx, sizeof(*fctx)); @@ -5651,7 +5707,7 @@ noanswer_response(fetchctx_t *fctx, dns_ char qbuf[DNS_NAME_FORMATSIZE]; char nbuf[DNS_NAME_FORMATSIZE]; char tbuf[DNS_RDATATYPE_FORMATSIZE]; - dns_rdatatype_format(fctx->type, tbuf, + dns_rdatatype_format(type, tbuf, sizeof(tbuf)); dns_name_format(name, nbuf, sizeof(nbuf)); @@ -5660,7 +5716,7 @@ noanswer_response(fetchctx_t *fctx, dns_ log_formerr(fctx, "unrelated %s %s in " "%s authority section", - tbuf, qbuf, nbuf); + tbuf, nbuf, qbuf); return (DNS_R_FORMERR); } if (type == dns_rdatatype_ns) { @@ -7725,6 +7781,8 @@ dns_resolver_create(dns_view_t *view, res->query_timeout = DEFAULT_QUERY_TIMEOUT; res->ndisps = 0; res->nextdisp = 0; /* meaningless at this point, but init it */ + res->maxdepth = DEFAULT_RECURSION_DEPTH; + res->maxqueries = DEFAULT_MAX_QUERIES; res->nbuckets = ntasks; res->activebuckets = ntasks; res->buckets = isc_mem_get(view->mctx, @@ -8164,9 +8222,9 @@ dns_resolver_createfetch(dns_resolver_t dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp) { - return (dns_resolver_createfetch2(res, name, type, domain, + return (dns_resolver_createfetch3(res, name, type, domain, nameservers, forwarders, NULL, 0, - options, task, action, arg, + options, 0, NULL, task, action, arg, rdataset, sigrdataset, fetchp)); } @@ -8182,6 +8240,25 @@ dns_resolver_createfetch2(dns_resolver_t dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp) { + return (dns_resolver_createfetch3(res, name, type, domain, + nameservers, forwarders, client, id, + options, 0, NULL, task, action, arg, + rdataset, sigrdataset, fetchp)); +} + +isc_result_t +dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name, + dns_rdatatype_t type, + dns_name_t *domain, dns_rdataset_t *nameservers, + dns_forwarders_t *forwarders, + isc_sockaddr_t *client, dns_messageid_t id, + unsigned int options, unsigned int depth, + isc_counter_t *qc, isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_rdataset_t *rdataset, + dns_rdataset_t *sigrdataset, + dns_fetch_t **fetchp) +{ dns_fetch_t *fetch; fetchctx_t *fctx = NULL; isc_result_t result = ISC_R_SUCCESS; @@ -8268,11 +8345,12 @@ dns_resolver_createfetch2(dns_resolver_t if (fctx == NULL) { result = fctx_create(res, name, type, domain, nameservers, - options, bucketnum, &fctx); + options, bucketnum, depth, qc, &fctx); if (result != ISC_R_SUCCESS) goto unlock; new_fctx = ISC_TRUE; - } + } else if (fctx->depth > depth) + fctx->depth = depth; result = fctx_join(fctx, task, client, id, action, arg, rdataset, sigrdataset, fetch); @@ -9044,3 +9122,27 @@ dns_resolver_settimeout(dns_resolver_t * resolver->query_timeout = seconds; } + +void +dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth) { + REQUIRE(VALID_RESOLVER(resolver)); + resolver->maxdepth = maxdepth; +} + +unsigned int +dns_resolver_getmaxdepth(dns_resolver_t *resolver) { + REQUIRE(VALID_RESOLVER(resolver)); + return (resolver->maxdepth); +} + +void +dns_resolver_setmaxqueries(dns_resolver_t *resolver, unsigned int queries) { + REQUIRE(VALID_RESOLVER(resolver)); + resolver->maxqueries = queries; +} + +unsigned int +dns_resolver_getmaxqueries(dns_resolver_t *resolver) { + REQUIRE(VALID_RESOLVER(resolver)); + return (resolver->maxqueries); +} Modified: stable/8/contrib/bind9/lib/export/isc/Makefile.in ============================================================================== --- stable/8/contrib/bind9/lib/export/isc/Makefile.in Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/lib/export/isc/Makefile.in Wed Dec 10 08:31:41 2014 (r275669) @@ -63,7 +63,7 @@ WIN32OBJS = win32/condition.@O@ win32/d # Alphabetically OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ backtrace.@O@ backtrace-emptytbl.@O@ base32.@O@ \ - base64.@O@ buffer.@O@ bufferlist.@O@ \ + base64.@O@ buffer.@O@ bufferlist.@O@ counter.@O@ \ error.@O@ event.@O@ \ hash.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ inet_aton.@O@ iterated_hash.@O@ lex.@O@ lfsr.@O@ log.@O@ \ @@ -85,7 +85,7 @@ ISCDRIVERSRCS = mem.c task.c lib.c timer SRCS = @ISC_EXTRA_SRCS@ \ assertions.c backtrace.c backtrace-emptytbl.c base32.c \ - base64.c buffer.c bufferlist.c \ + base64.c buffer.c bufferlist.c counter.c \ error.c event.c \ hash.c hex.c hmacmd5.c hmacsha.c \ inet_aton.c iterated_hash.c lex.c log.c lfsr.c \ Modified: stable/8/contrib/bind9/lib/isc/Makefile.in ============================================================================== --- stable/8/contrib/bind9/lib/isc/Makefile.in Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/lib/isc/Makefile.in Wed Dec 10 08:31:41 2014 (r275669) @@ -13,8 +13,6 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id$ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -53,7 +51,7 @@ WIN32OBJS = win32/condition.@O@ win32/d OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ backtrace.@O@ base32.@O@ base64.@O@ \ bitstring.@O@ buffer.@O@ bufferlist.@O@ commandline.@O@ \ - error.@O@ event.@O@ \ + counter.@O@ error.@O@ event.@O@ \ hash.@O@ heap.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ httpd.@O@ inet_aton.@O@ iterated_hash.@O@ \ lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \ @@ -70,8 +68,8 @@ SYMTBLOBJS = backtrace-emptytbl.@O@ # Alphabetically SRCS = @ISC_EXTRA_SRCS@ \ assertions.c backtrace.c base32.c base64.c bitstring.c \ - buffer.c bufferlist.c commandline.c error.c event.c \ - heap.c hex.c hmacmd5.c hmacsha.c \ + buffer.c bufferlist.c commandline.c counter.c \ + error.c event.c heap.c hex.c hmacmd5.c hmacsha.c \ httpd.c inet_aton.c iterated_hash.c \ lex.c lfsr.c lib.c log.c \ md5.c mem.c mutexblock.c \ Added: stable/8/contrib/bind9/lib/isc/counter.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/contrib/bind9/lib/isc/counter.c Wed Dec 10 08:31:41 2014 (r275669) @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/*! \file */ + +#include + +#include + +#include +#include +#include +#include + +#define COUNTER_MAGIC ISC_MAGIC('C', 'n', 't', 'r') +#define VALID_COUNTER(r) ISC_MAGIC_VALID(r, COUNTER_MAGIC) + +struct isc_counter { + unsigned int magic; + isc_mem_t *mctx; + isc_mutex_t lock; + unsigned int references; + unsigned int limit; + unsigned int used; +}; + +isc_result_t +isc_counter_create(isc_mem_t *mctx, int limit, isc_counter_t **counterp) { + isc_result_t result; + isc_counter_t *counter; + + REQUIRE(counterp != NULL && *counterp == NULL); + + counter = isc_mem_get(mctx, sizeof(*counter)); + if (counter == NULL) + return (ISC_R_NOMEMORY); + + result = isc_mutex_init(&counter->lock); + if (result != ISC_R_SUCCESS) { + isc_mem_put(mctx, counter, sizeof(*counter)); + return (result); + } + + counter->mctx = NULL; + isc_mem_attach(mctx, &counter->mctx); + + counter->references = 1; + counter->limit = limit; + counter->used = 0; + + counter->magic = COUNTER_MAGIC; + *counterp = counter; + return (ISC_R_SUCCESS); +} + +isc_result_t +isc_counter_increment(isc_counter_t *counter) { + isc_result_t result = ISC_R_SUCCESS; + + LOCK(&counter->lock); + counter->used++; + if (counter->limit != 0 && counter->used >= counter->limit) + result = ISC_R_QUOTA; + UNLOCK(&counter->lock); + + return (result); +} + +unsigned int +isc_counter_used(isc_counter_t *counter) { + REQUIRE(VALID_COUNTER(counter)); + + return (counter->used); +} + +void +isc_counter_setlimit(isc_counter_t *counter, int limit) { + REQUIRE(VALID_COUNTER(counter)); + + LOCK(&counter->lock); + counter->limit = limit; + UNLOCK(&counter->lock); +} + +void +isc_counter_attach(isc_counter_t *source, isc_counter_t **targetp) { + REQUIRE(VALID_COUNTER(source)); + REQUIRE(targetp != NULL && *targetp == NULL); + + LOCK(&source->lock); + source->references++; + INSIST(source->references > 0); + UNLOCK(&source->lock); + + *targetp = source; +} + +static void +destroy(isc_counter_t *counter) { + counter->magic = 0; + isc_mutex_destroy(&counter->lock); + isc_mem_putanddetach(&counter->mctx, counter, sizeof(*counter)); +} + +void +isc_counter_detach(isc_counter_t **counterp) { + isc_counter_t *counter; + isc_boolean_t want_destroy = ISC_FALSE; + + REQUIRE(counterp != NULL && *counterp != NULL); + counter = *counterp; + REQUIRE(VALID_COUNTER(counter)); + + *counterp = NULL; + + LOCK(&counter->lock); + INSIST(counter->references > 0); + counter->references--; + if (counter->references == 0) + want_destroy = ISC_TRUE; + UNLOCK(&counter->lock); + + if (want_destroy) + destroy(counter); +} Modified: stable/8/contrib/bind9/lib/isc/include/isc/Makefile.in ============================================================================== --- stable/8/contrib/bind9/lib/isc/include/isc/Makefile.in Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/lib/isc/include/isc/Makefile.in Wed Dec 10 08:31:41 2014 (r275669) @@ -13,8 +13,6 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id$ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -27,7 +25,8 @@ top_srcdir = @top_srcdir@ # install target below. # HEADERS = app.h assertions.h base64.h bind9.h bitstring.h boolean.h \ - buffer.h bufferlist.h commandline.h entropy.h error.h event.h \ + buffer.h bufferlist.h \ + commandline.h counter.h entropy.h error.h event.h \ eventclass.h file.h formatcheck.h fsaccess.h \ hash.h heap.h hex.h hmacmd5.h hmacsha.h \ httpd.h \ Added: stable/8/contrib/bind9/lib/isc/include/isc/counter.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/contrib/bind9/lib/isc/include/isc/counter.h Wed Dec 10 08:31:41 2014 (r275669) @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef ISC_COUNTER_H +#define ISC_COUNTER_H 1 + +/***** + ***** Module Info + *****/ + +/*! \file isc/counter.h + * + * \brief The isc_counter_t object is a simplified version of the + * isc_quota_t object; it tracks the consumption of limited + * resources, returning an error condition when the quota is + * exceeded. However, unlike isc_quota_t, attaching and detaching + * from a counter object does not increment or decrement the counter. + */ + +/*** + *** Imports. + ***/ + +#include +#include +#include + +/***** + ***** Types. + *****/ + +ISC_LANG_BEGINDECLS + +isc_result_t +isc_counter_create(isc_mem_t *mctx, int limit, isc_counter_t **counterp); +/*%< + * Allocate and initialize a counter object. + */ + +isc_result_t +isc_counter_increment(isc_counter_t *counter); +/*%< + * Increment the counter. + * + * If the counter limit is nonzero and has been reached, then + * return ISC_R_QUOTA, otherwise ISC_R_SUCCESS. (The counter is + * incremented regardless of return value.) + */ + +unsigned int +isc_counter_used(isc_counter_t *counter); +/*%< + * Return the current counter value. + */ + +void +isc_counter_setlimit(isc_counter_t *counter, int limit); +/*%< + * Set the counter limit. + */ + +void +isc_counter_attach(isc_counter_t *source, isc_counter_t **targetp); +/*%< + * Attach to a counter object, increasing its reference counter. + */ + +void +isc_counter_detach(isc_counter_t **counterp); +/*%< + * Detach (and destroy if reference counter has dropped to zero) + * a counter object. + */ + +ISC_LANG_ENDDECLS + +#endif /* ISC_COUNTER_H */ Modified: stable/8/contrib/bind9/lib/isc/include/isc/types.h ============================================================================== --- stable/8/contrib/bind9/lib/isc/include/isc/types.h Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/lib/isc/include/isc/types.h Wed Dec 10 08:31:41 2014 (r275669) @@ -50,6 +50,7 @@ typedef struct isc_buffer isc_buffer_t; typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; /*%< Buffer List */ typedef struct isc_constregion isc_constregion_t; /*%< Const region */ typedef struct isc_consttextregion isc_consttextregion_t; /*%< Const Text Region */ +typedef struct isc_counter isc_counter_t; /*%< Counter */ typedef struct isc_entropy isc_entropy_t; /*%< Entropy */ typedef struct isc_entropysource isc_entropysource_t; /*%< Entropy Source */ typedef struct isc_event isc_event_t; /*%< Event */ Modified: stable/8/contrib/bind9/lib/isccfg/namedconf.c ============================================================================== --- stable/8/contrib/bind9/lib/isccfg/namedconf.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/bind9/lib/isccfg/namedconf.c Wed Dec 10 08:31:41 2014 (r275669) @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file */ #include @@ -1354,6 +1352,8 @@ view_clauses[] = { { "max-cache-ttl", &cfg_type_uint32, 0 }, { "max-clients-per-query", &cfg_type_uint32, 0 }, { "max-ncache-ttl", &cfg_type_uint32, 0 }, + { "max-recursion-depth", &cfg_type_uint32, 0 }, + { "max-recursion-queries", &cfg_type_uint32, 0 }, { "max-udp-size", &cfg_type_uint32, 0 }, { "min-roots", &cfg_type_uint32, CFG_CLAUSEFLAG_NOTIMP }, { "minimal-responses", &cfg_type_boolean, 0 }, Modified: stable/8/contrib/file/elfclass.h ============================================================================== --- stable/8/contrib/file/elfclass.h Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/file/elfclass.h Wed Dec 10 08:31:41 2014 (r275669) @@ -35,9 +35,11 @@ switch (type) { #ifdef ELFCORE case ET_CORE: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) return -1; @@ -45,18 +47,24 @@ #endif case ET_EXEC: case ET_DYN: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), - fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) - == -1) + fsize, &flags, shnum) == -1) return -1; /*FALLTHROUGH*/ case ET_REL: + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), - elf_getu16(swap, elfhdr.e_shnum), + (off_t)elf_getu(swap, elfhdr.e_shoff), shnum, (size_t)elf_getu16(swap, elfhdr.e_shentsize), &flags, elf_getu16(swap, elfhdr.e_machine)) == -1) Modified: stable/8/contrib/file/readelf.c ============================================================================== --- stable/8/contrib/file/readelf.c Wed Dec 10 08:26:53 2014 (r275668) +++ stable/8/contrib/file/readelf.c Wed Dec 10 08:31:41 2014 (r275669) @@ -60,6 +60,18 @@ private uint16_t getu16(int, uint16_t); private uint32_t getu32(int, uint32_t); private uint64_t getu64(int, uint64_t); +#define MAX_PHNUM 256 +#define MAX_SHNUM 1024 + +private int +toomany(struct magic_set *ms, const char *name, uint16_t num) +{ + if (file_printf(ms, ", too many %s header sections (%u)", name, num + ) == -1) + return -1; + return 0; +} + private uint16_t getu16(int swap, uint16_t value) { @@ -391,13 +403,13 @@ donote(struct magic_set *ms, void *vbuf, if (namesz & 0x80000000) { (void)file_printf(ms, ", bad note name size 0x%lx", (unsigned long)namesz); - return offset; + return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, ", bad note description size 0x%lx", (unsigned long)descsz); - return offset; + return 0; } @@ -821,6 +833,7 @@ doshn(struct magic_set *ms, int clazz, i Elf32_Shdr sh32; Elf64_Shdr sh64; int stripped = 1; + size_t nbadcap = 0; void *nbuf; off_t noff; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ @@ -893,6 +906,8 @@ doshn(struct magic_set *ms, int clazz, i case SHT_SUNW_cap: { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:35:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C05DCD; Wed, 10 Dec 2014 08:35:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5258D945; Wed, 10 Dec 2014 08:35:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8ZwwL038452; Wed, 10 Dec 2014 08:35:58 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8ZuGg038443; Wed, 10 Dec 2014 08:35:56 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412100835.sBA8ZuGg038443@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 10 Dec 2014 08:35:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r275670 - in releng/10.1: . contrib/file/src lib/libc/stdio X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:35:58 -0000 Author: delphij Date: Wed Dec 10 08:35:55 2014 New Revision: 275670 URL: https://svnweb.freebsd.org/changeset/base/275670 Log: Fix buffer overflow in stdio. Security: FreeBSD-SA-14:27.stdio Security: CVE-2014-8611 Fix multiple vulnerabilities in file(1) and libmagic(3). Security: FreeBSD-SA-14:28.file Security: CVE-2014-3710, CVE-2014-8116, CVE-2014-8117 Approved by: so Modified: releng/10.1/UPDATING releng/10.1/contrib/file/src/elfclass.h releng/10.1/contrib/file/src/file.h releng/10.1/contrib/file/src/funcs.c releng/10.1/contrib/file/src/readelf.c releng/10.1/contrib/file/src/softmagic.c releng/10.1/lib/libc/stdio/fflush.c Modified: releng/10.1/UPDATING ============================================================================== --- releng/10.1/UPDATING Wed Dec 10 08:31:41 2014 (r275669) +++ releng/10.1/UPDATING Wed Dec 10 08:35:55 2014 (r275670) @@ -16,6 +16,14 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20141210: p1 FreeBSD-SA-14:27.stdio + FreeBSD-SA-14:28.file + + Fix buffer overflow in stdio. [SA-14:27] + + Fix multiple vulnerabilities in file(1) and libmagic(3). + [SA-14:28] + 20140904: The ofwfb driver, used to provide a graphics console on PowerPC when using vt(4), no longer allows mmap() of all of physical memory. This Modified: releng/10.1/contrib/file/src/elfclass.h ============================================================================== --- releng/10.1/contrib/file/src/elfclass.h Wed Dec 10 08:31:41 2014 (r275669) +++ releng/10.1/contrib/file/src/elfclass.h Wed Dec 10 08:35:55 2014 (r275670) @@ -35,10 +35,12 @@ switch (type) { #ifdef ELFCORE case ET_CORE: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); flags |= FLAGS_IS_CORE; if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) return -1; @@ -46,18 +48,24 @@ #endif case ET_EXEC: case ET_DYN: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), - fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) - == -1) + fsize, &flags, shnum) == -1) return -1; /*FALLTHROUGH*/ case ET_REL: + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), - elf_getu16(swap, elfhdr.e_shnum), + (off_t)elf_getu(swap, elfhdr.e_shoff), shnum, (size_t)elf_getu16(swap, elfhdr.e_shentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_machine), (int)elf_getu16(swap, elfhdr.e_shstrndx)) == -1) Modified: releng/10.1/contrib/file/src/file.h ============================================================================== --- releng/10.1/contrib/file/src/file.h Wed Dec 10 08:31:41 2014 (r275669) +++ releng/10.1/contrib/file/src/file.h Wed Dec 10 08:35:55 2014 (r275670) @@ -482,6 +482,14 @@ protected int file_regexec(file_regex_t protected void file_regfree(file_regex_t *); protected void file_regerror(file_regex_t *, int, struct magic_set *); +typedef struct { + char *buf; + uint32_t offset; +} file_pushbuf_t; + +protected file_pushbuf_t *file_push_buffer(struct magic_set *); +protected char *file_pop_buffer(struct magic_set *, file_pushbuf_t *); + #ifndef COMPILE_ONLY extern const char *file_names[]; extern const size_t file_nnames; Modified: releng/10.1/contrib/file/src/funcs.c ============================================================================== --- releng/10.1/contrib/file/src/funcs.c Wed Dec 10 08:31:41 2014 (r275669) +++ releng/10.1/contrib/file/src/funcs.c Wed Dec 10 08:35:55 2014 (r275670) @@ -491,3 +491,43 @@ file_regerror(file_regex_t *rx, int rc, file_magerror(ms, "regex error %d for `%s', (%s)", rc, rx->pat, errmsg); } + +protected file_pushbuf_t * +file_push_buffer(struct magic_set *ms) +{ + file_pushbuf_t *pb; + + if (ms->event_flags & EVENT_HAD_ERR) + return NULL; + + if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL) + return NULL; + + pb->buf = ms->o.buf; + pb->offset = ms->offset; + + ms->o.buf = NULL; + ms->offset = 0; + + return pb; +} + +protected char * +file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb) +{ + char *rbuf; + + if (ms->event_flags & EVENT_HAD_ERR) { + free(pb->buf); + free(pb); + return NULL; + } + + rbuf = ms->o.buf; + + ms->o.buf = pb->buf; + ms->offset = pb->offset; + + free(pb); + return rbuf; +} Modified: releng/10.1/contrib/file/src/readelf.c ============================================================================== --- releng/10.1/contrib/file/src/readelf.c Wed Dec 10 08:31:41 2014 (r275669) +++ releng/10.1/contrib/file/src/readelf.c Wed Dec 10 08:35:55 2014 (r275670) @@ -60,6 +60,18 @@ private uint16_t getu16(int, uint16_t); private uint32_t getu32(int, uint32_t); private uint64_t getu64(int, uint64_t); +#define MAX_PHNUM 256 +#define MAX_SHNUM 1024 + +private int +toomany(struct magic_set *ms, const char *name, uint16_t num) +{ + if (file_printf(ms, ", too many %s header sections (%u)", name, num + ) == -1) + return -1; + return 0; +} + private uint16_t getu16(int swap, uint16_t value) { @@ -477,6 +489,13 @@ donote(struct magic_set *ms, void *vbuf, uint32_t namesz, descsz; unsigned char *nbuf = CAST(unsigned char *, vbuf); + if (xnh_sizeof + offset > size) { + /* + * We're out of note headers. + */ + return xnh_sizeof + offset; + } + (void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof); offset += xnh_sizeof; @@ -492,13 +511,13 @@ donote(struct magic_set *ms, void *vbuf, if (namesz & 0x80000000) { (void)file_printf(ms, ", bad note name size 0x%lx", (unsigned long)namesz); - return offset; + return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, ", bad note description size 0x%lx", (unsigned long)descsz); - return offset; + return 0; } @@ -900,6 +919,7 @@ doshn(struct magic_set *ms, int clazz, i Elf32_Shdr sh32; Elf64_Shdr sh64; int stripped = 1; + size_t nbadcap = 0; void *nbuf; off_t noff, coff, name_off; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ @@ -988,6 +1008,8 @@ doshn(struct magic_set *ms, int clazz, i goto skip; } + if (nbadcap > 5) + break; if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) { file_badseek(ms); return -1; @@ -1053,6 +1075,8 @@ doshn(struct magic_set *ms, int clazz, i (unsigned long long)xcap_tag, (unsigned long long)xcap_val) == -1) return -1; + if (nbadcap++ > 2) + coff = xsh_size; break; } } @@ -1233,7 +1257,7 @@ file_tryelf(struct magic_set *ms, int fd int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; - uint16_t type; + uint16_t type, phnum, shnum; if (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) return 0; Modified: releng/10.1/contrib/file/src/softmagic.c ============================================================================== --- releng/10.1/contrib/file/src/softmagic.c Wed Dec 10 08:31:41 2014 (r275669) +++ releng/10.1/contrib/file/src/softmagic.c Wed Dec 10 08:35:55 2014 (r275670) @@ -67,6 +67,9 @@ private void cvt_32(union VALUETYPE *, c private void cvt_64(union VALUETYPE *, const struct magic *); #define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + +#define MAX_RECURSION_LEVEL 10 + /* * softmagic - lookup one file in parsed, in-memory copy of database * Passed the name and FILE * of one file to be typed. @@ -1193,14 +1196,15 @@ mget(struct magic_set *ms, const unsigne int flip, int recursion_level, int *printed_something, int *need_separator, int *returnval) { - uint32_t soffset, offset = ms->offset; + uint32_t offset = ms->offset; uint32_t lhs; + file_pushbuf_t *pb; int rv, oneed_separator, in_type; - char *sbuf, *rbuf; + char *rbuf; union VALUETYPE *p = &ms->ms_value; struct mlist ml; - if (recursion_level >= 20) { + if (recursion_level >= MAX_RECURSION_LEVEL) { file_error(ms, 0, "recursion nesting exceeded"); return -1; } @@ -1644,19 +1648,23 @@ mget(struct magic_set *ms, const unsigne case FILE_INDIRECT: if (offset == 0) return 0; + if (nbytes < offset) return 0; - sbuf = ms->o.buf; - soffset = ms->offset; - ms->o.buf = NULL; - ms->offset = 0; + + if ((pb = file_push_buffer(ms)) == NULL) + return -1; + rv = file_softmagic(ms, s + offset, nbytes - offset, recursion_level, BINTEST, text); + if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv); - rbuf = ms->o.buf; - ms->o.buf = sbuf; - ms->offset = soffset; + + rbuf = file_pop_buffer(ms, pb); + if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR) + return -1; + if (rv == 1) { if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && file_printf(ms, F(ms, m, "%u"), offset) == -1) { @@ -1674,13 +1682,13 @@ mget(struct magic_set *ms, const unsigne case FILE_USE: if (nbytes < offset) return 0; - sbuf = m->value.s; - if (*sbuf == '^') { - sbuf++; + rbuf = m->value.s; + if (*rbuf == '^') { + rbuf++; flip = !flip; } - if (file_magicfind(ms, sbuf, &ml) == -1) { - file_error(ms, 0, "cannot find entry `%s'", sbuf); + if (file_magicfind(ms, rbuf, &ml) == -1) { + file_error(ms, 0, "cannot find entry `%s'", rbuf); return -1; } Modified: releng/10.1/lib/libc/stdio/fflush.c ============================================================================== --- releng/10.1/lib/libc/stdio/fflush.c Wed Dec 10 08:31:41 2014 (r275669) +++ releng/10.1/lib/libc/stdio/fflush.c Wed Dec 10 08:35:55 2014 (r275670) @@ -124,11 +124,13 @@ __sflush(FILE *fp) t = _swrite(fp, (char *)p, n); if (t <= 0) { /* Reset _p and _w. */ - if (p > fp->_p) /* Some was written. */ + if (p > fp->_p) { + /* Some was written. */ memmove(fp->_p, p, n); - fp->_p += n; - if ((fp->_flags & (__SLBF | __SNBF)) == 0) - fp->_w -= n; + fp->_p += n; + if ((fp->_flags & (__SLBF | __SNBF)) == 0) + fp->_w -= n; + } fp->_flags |= __SERR; return (EOF); } From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:36:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D5411F2; Wed, 10 Dec 2014 08:36:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69836948; Wed, 10 Dec 2014 08:36:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8a9DX038554; Wed, 10 Dec 2014 08:36:09 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8a8B1038544; Wed, 10 Dec 2014 08:36:08 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412100836.sBA8a8B1038544@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 10 Dec 2014 08:36:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r275671 - in releng/10.0: . contrib/file sys/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:36:09 -0000 Author: delphij Date: Wed Dec 10 08:36:07 2014 New Revision: 275671 URL: https://svnweb.freebsd.org/changeset/base/275671 Log: Fix multiple vulnerabilities in file(1) and libmagic(3). Security: FreeBSD-SA-14:28.file Security: CVE-2014-3710, CVE-2014-8116, CVE-2014-8117 Approved by: so Modified: releng/10.0/UPDATING releng/10.0/contrib/file/elfclass.h releng/10.0/contrib/file/readelf.c releng/10.0/contrib/file/softmagic.c releng/10.0/sys/conf/newvers.sh Modified: releng/10.0/UPDATING ============================================================================== --- releng/10.0/UPDATING Wed Dec 10 08:35:55 2014 (r275670) +++ releng/10.0/UPDATING Wed Dec 10 08:36:07 2014 (r275671) @@ -16,6 +16,9 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20141210: p13 FreeBSD-SA-14:28.file + Fix multiple vulnerabilities in file(1) and libmagic(3). + 20141104: p12 FreeBSD-SA-14:24.sshd FreeBSD-SA-14:25.setlogin FreeBSD-SA-14:26.ftp Modified: releng/10.0/contrib/file/elfclass.h ============================================================================== --- releng/10.0/contrib/file/elfclass.h Wed Dec 10 08:35:55 2014 (r275670) +++ releng/10.0/contrib/file/elfclass.h Wed Dec 10 08:36:07 2014 (r275671) @@ -35,10 +35,12 @@ switch (type) { #ifdef ELFCORE case ET_CORE: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); flags |= FLAGS_IS_CORE; if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) return -1; @@ -46,18 +48,24 @@ #endif case ET_EXEC: case ET_DYN: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), - fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) - == -1) + fsize, &flags, shnum) == -1) return -1; /*FALLTHROUGH*/ case ET_REL: + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), - elf_getu16(swap, elfhdr.e_shnum), + (off_t)elf_getu(swap, elfhdr.e_shoff), shnum, (size_t)elf_getu16(swap, elfhdr.e_shentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_machine)) == -1) return -1; Modified: releng/10.0/contrib/file/readelf.c ============================================================================== --- releng/10.0/contrib/file/readelf.c Wed Dec 10 08:35:55 2014 (r275670) +++ releng/10.0/contrib/file/readelf.c Wed Dec 10 08:36:07 2014 (r275671) @@ -60,6 +60,18 @@ private uint16_t getu16(int, uint16_t); private uint32_t getu32(int, uint32_t); private uint64_t getu64(int, uint64_t); +#define MAX_PHNUM 256 +#define MAX_SHNUM 1024 + +private int +toomany(struct magic_set *ms, const char *name, uint16_t num) +{ + if (file_printf(ms, ", too many %s header sections (%u)", name, num + ) == -1) + return -1; + return 0; +} + private uint16_t getu16(int swap, uint16_t value) { @@ -384,13 +396,13 @@ donote(struct magic_set *ms, void *vbuf, if (namesz & 0x80000000) { (void)file_printf(ms, ", bad note name size 0x%lx", (unsigned long)namesz); - return offset; + return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, ", bad note description size 0x%lx", (unsigned long)descsz); - return offset; + return 0; } @@ -847,6 +859,7 @@ doshn(struct magic_set *ms, int clazz, i Elf32_Shdr sh32; Elf64_Shdr sh64; int stripped = 1; + size_t nbadcap = 0; void *nbuf; off_t noff, coff; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ @@ -919,6 +932,8 @@ doshn(struct magic_set *ms, int clazz, i free(nbuf); break; case SHT_SUNW_cap: + if (nbadcap > 5) + break; if (lseek(fd, (off_t)xsh_offset, SEEK_SET) == (off_t)-1) { file_badseek(ms); @@ -955,6 +970,8 @@ doshn(struct magic_set *ms, int clazz, i (unsigned long long)xcap_tag, (unsigned long long)xcap_val) == -1) return -1; + if (nbadcap++ > 2) + coff = xsh_size; break; } } @@ -1142,7 +1159,7 @@ file_tryelf(struct magic_set *ms, int fd int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; - uint16_t type; + uint16_t type, phnum, shnum; if (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) return 0; Modified: releng/10.0/contrib/file/softmagic.c ============================================================================== --- releng/10.0/contrib/file/softmagic.c Wed Dec 10 08:35:55 2014 (r275670) +++ releng/10.0/contrib/file/softmagic.c Wed Dec 10 08:36:07 2014 (r275671) @@ -61,6 +61,9 @@ private void cvt_32(union VALUETYPE *, c private void cvt_64(union VALUETYPE *, const struct magic *); #define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + +#define MAX_RECURSION_LEVEL 10 + /* * softmagic - lookup one file in parsed, in-memory copy of database * Passed the name and FILE * of one file to be typed. @@ -1027,7 +1030,7 @@ mget(struct magic_set *ms, const unsigne uint32_t count = m->str_range; union VALUETYPE *p = &ms->ms_value; - if (recursion_level >= 20) { + if (recursion_level >= MAX_RECURSION_LEVEL) { file_error(ms, 0, "recursion nesting exceeded"); return -1; } Modified: releng/10.0/sys/conf/newvers.sh ============================================================================== --- releng/10.0/sys/conf/newvers.sh Wed Dec 10 08:35:55 2014 (r275670) +++ releng/10.0/sys/conf/newvers.sh Wed Dec 10 08:36:07 2014 (r275671) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.0" -BRANCH="RELEASE-p12" +BRANCH="RELEASE-p13" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:36:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7C35330; Wed, 10 Dec 2014 08:36:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0C5495C; Wed, 10 Dec 2014 08:36:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8ajRL038696; Wed, 10 Dec 2014 08:36:45 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8aew3038671; Wed, 10 Dec 2014 08:36:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412100836.sBA8aew3038671@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 10 Dec 2014 08:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r275672 - in releng: 8.4 8.4/contrib/bind9 8.4/contrib/bind9/bin/named 8.4/contrib/bind9/lib/dns 8.4/contrib/bind9/lib/dns/include/dns 8.4/contrib/bind9/lib/export/isc 8.4/contrib/bind9... X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:36:45 -0000 Author: delphij Date: Wed Dec 10 08:36:40 2014 New Revision: 275672 URL: https://svnweb.freebsd.org/changeset/base/275672 Log: Fix multiple vulnerabilities in file(1) and libmagic(3). Security: FreeBSD-SA-14:28.file Security: CVE-2014-3710, CVE-2014-8116, CVE-2014-8117 Fix BIND remote denial of service vulnerability. Security: FreeBSD-SA-14:29.bind Security: CVE-2014-8500 Approved by: so Added: releng/8.4/contrib/bind9/lib/isc/counter.c (contents, props changed) releng/8.4/contrib/bind9/lib/isc/include/isc/counter.h (contents, props changed) releng/9.1/contrib/bind9/lib/isc/counter.c (contents, props changed) releng/9.1/contrib/bind9/lib/isc/include/isc/counter.h (contents, props changed) releng/9.2/contrib/bind9/lib/isc/counter.c (contents, props changed) releng/9.2/contrib/bind9/lib/isc/include/isc/counter.h (contents, props changed) Modified: releng/8.4/UPDATING releng/8.4/contrib/bind9/CHANGES releng/8.4/contrib/bind9/bin/named/config.c releng/8.4/contrib/bind9/bin/named/query.c releng/8.4/contrib/bind9/bin/named/server.c releng/8.4/contrib/bind9/lib/dns/adb.c releng/8.4/contrib/bind9/lib/dns/include/dns/adb.h releng/8.4/contrib/bind9/lib/dns/include/dns/resolver.h releng/8.4/contrib/bind9/lib/dns/resolver.c releng/8.4/contrib/bind9/lib/export/isc/Makefile.in releng/8.4/contrib/bind9/lib/isc/Makefile.in releng/8.4/contrib/bind9/lib/isc/include/isc/Makefile.in releng/8.4/contrib/bind9/lib/isc/include/isc/types.h releng/8.4/contrib/bind9/lib/isccfg/namedconf.c releng/8.4/contrib/file/elfclass.h releng/8.4/contrib/file/readelf.c releng/8.4/contrib/file/softmagic.c releng/8.4/lib/bind/isc/Makefile releng/8.4/sys/conf/newvers.sh releng/9.1/UPDATING releng/9.1/contrib/bind9/CHANGES releng/9.1/contrib/bind9/bin/named/config.c releng/9.1/contrib/bind9/bin/named/query.c releng/9.1/contrib/bind9/bin/named/server.c releng/9.1/contrib/bind9/lib/dns/adb.c releng/9.1/contrib/bind9/lib/dns/include/dns/adb.h releng/9.1/contrib/bind9/lib/dns/include/dns/resolver.h releng/9.1/contrib/bind9/lib/dns/resolver.c releng/9.1/contrib/bind9/lib/export/isc/Makefile.in releng/9.1/contrib/bind9/lib/isc/Makefile.in releng/9.1/contrib/bind9/lib/isc/include/isc/Makefile.in releng/9.1/contrib/bind9/lib/isc/include/isc/types.h releng/9.1/contrib/bind9/lib/isccfg/namedconf.c releng/9.1/contrib/file/elfclass.h releng/9.1/contrib/file/readelf.c releng/9.1/contrib/file/softmagic.c releng/9.1/lib/bind/isc/Makefile releng/9.1/sys/conf/newvers.sh releng/9.2/UPDATING releng/9.2/contrib/bind9/CHANGES releng/9.2/contrib/bind9/bin/named/config.c releng/9.2/contrib/bind9/bin/named/query.c releng/9.2/contrib/bind9/bin/named/server.c releng/9.2/contrib/bind9/lib/dns/adb.c releng/9.2/contrib/bind9/lib/dns/include/dns/adb.h releng/9.2/contrib/bind9/lib/dns/include/dns/resolver.h releng/9.2/contrib/bind9/lib/dns/resolver.c releng/9.2/contrib/bind9/lib/export/isc/Makefile.in releng/9.2/contrib/bind9/lib/isc/Makefile.in releng/9.2/contrib/bind9/lib/isc/include/isc/Makefile.in releng/9.2/contrib/bind9/lib/isc/include/isc/types.h releng/9.2/contrib/bind9/lib/isccfg/namedconf.c releng/9.2/contrib/file/elfclass.h releng/9.2/contrib/file/readelf.c releng/9.2/contrib/file/softmagic.c releng/9.2/lib/bind/isc/Makefile releng/9.2/sys/conf/newvers.sh releng/9.3/UPDATING releng/9.3/contrib/bind9/CHANGES releng/9.3/contrib/bind9/bin/named/config.c releng/9.3/contrib/bind9/bin/named/query.c releng/9.3/contrib/bind9/bin/named/server.c releng/9.3/contrib/bind9/lib/dns/adb.c releng/9.3/contrib/bind9/lib/dns/include/dns/adb.h releng/9.3/contrib/bind9/lib/dns/include/dns/resolver.h releng/9.3/contrib/bind9/lib/dns/resolver.c releng/9.3/contrib/bind9/lib/isccfg/namedconf.c releng/9.3/contrib/file/elfclass.h releng/9.3/contrib/file/readelf.c releng/9.3/contrib/file/softmagic.c releng/9.3/sys/conf/newvers.sh Modified: releng/8.4/UPDATING ============================================================================== --- releng/8.4/UPDATING Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/UPDATING Wed Dec 10 08:36:40 2014 (r275672) @@ -15,6 +15,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20141210: p20 FreeBSD-SA-14:28.file + FreeBSD-SA-14:29.bind + + Fix multiple vulnerabilities in file(1) and libmagic(3). + [SA-14:28] + + Fix BIND remote denial of service vulnerability. [SA-14:29] + 20141104: p19 FreeBSD-SA-14:25.setlogin FreeBSD-SA-14:26.ftp FreeBSD-EN-14:12.zfs Modified: releng/8.4/contrib/bind9/CHANGES ============================================================================== --- releng/8.4/contrib/bind9/CHANGES Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/CHANGES Wed Dec 10 08:36:40 2014 (r275672) @@ -1,3 +1,15 @@ +4006. [security] A flaw in delegation handling could be exploited + to put named into an infinite loop. This has + been addressed by placing limits on the number + of levels of recursion named will allow (default 7), + and the number of iterative queries that it will + send (default 50) before terminating a recursive + query (CVE-2014-8500). + + The recursion depth limit is configured via the + "max-recursion-depth" option, and the query limit + via the "max-recursion-queries" option. [RT #37580] + --- 9.8.4-P2 released --- 3516. [security] Removed the check for regex.h in configure in order Modified: releng/8.4/contrib/bind9/bin/named/config.c ============================================================================== --- releng/8.4/contrib/bind9/bin/named/config.c Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/bin/named/config.c Wed Dec 10 08:36:40 2014 (r275672) @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.c,v 1.113.16.2 2011/02/28 01:19:58 tbox Exp $ */ - /*! \file */ #include @@ -158,6 +156,8 @@ options {\n\ dnssec-accept-expired no;\n\ clients-per-query 10;\n\ max-clients-per-query 100;\n\ + max-recursion-depth 7;\n\ + max-recursion-queries 50;\n\ zero-no-soa-ttl-cache no;\n\ nsec3-test-zone no;\n\ allow-new-zones no;\n\ Modified: releng/8.4/contrib/bind9/bin/named/query.c ============================================================================== --- releng/8.4/contrib/bind9/bin/named/query.c Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/bin/named/query.c Wed Dec 10 08:36:40 2014 (r275672) @@ -3755,12 +3755,11 @@ query_recurse(ns_client_t *client, dns_r peeraddr = &client->peeraddr; else peeraddr = NULL; - result = dns_resolver_createfetch2(client->view->resolver, + result = dns_resolver_createfetch3(client->view->resolver, qname, qtype, qdomain, nameservers, NULL, peeraddr, client->message->id, - client->query.fetchoptions, - client->task, - query_resume, client, + client->query.fetchoptions, 0, NULL, + client->task, query_resume, client, rdataset, sigrdataset, &client->query.fetch); Modified: releng/8.4/contrib/bind9/bin/named/server.c ============================================================================== --- releng/8.4/contrib/bind9/bin/named/server.c Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/bin/named/server.c Wed Dec 10 08:36:40 2014 (r275672) @@ -2580,6 +2580,16 @@ configure_view(dns_view_t *view, cfg_obj cfg_obj_asuint32(obj), max_clients_per_query); + obj = NULL; + result = ns_config_get(maps, "max-recursion-depth", &obj); + INSIST(result == ISC_R_SUCCESS); + dns_resolver_setmaxdepth(view->resolver, cfg_obj_asuint32(obj)); + + obj = NULL; + result = ns_config_get(maps, "max-recursion-queries", &obj); + INSIST(result == ISC_R_SUCCESS); + dns_resolver_setmaxqueries(view->resolver, cfg_obj_asuint32(obj)); + #ifdef ALLOW_FILTER_AAAA_ON_V4 obj = NULL; result = ns_config_get(maps, "filter-aaaa-on-v4", &obj); Modified: releng/8.4/contrib/bind9/lib/dns/adb.c ============================================================================== --- releng/8.4/contrib/bind9/lib/dns/adb.c Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/lib/dns/adb.c Wed Dec 10 08:36:40 2014 (r275672) @@ -201,6 +201,7 @@ struct dns_adbfetch { unsigned int magic; dns_fetch_t *fetch; dns_rdataset_t rdataset; + unsigned int depth; }; /*% @@ -300,8 +301,7 @@ static inline isc_boolean_t dec_entry_re static inline void violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *); static isc_boolean_t clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static void clean_target(dns_adb_t *, dns_name_t *); -static void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, - unsigned int); +static void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, unsigned int); static isc_boolean_t check_expire_namehooks(dns_adbname_t *, isc_stdtime_t); static isc_boolean_t check_expire_entry(dns_adb_t *, dns_adbentry_t **, isc_stdtime_t); @@ -309,6 +309,7 @@ static void cancel_fetches_at_name(dns_a static isc_result_t dbfind_name(dns_adbname_t *, isc_stdtime_t, dns_rdatatype_t); static isc_result_t fetch_name(dns_adbname_t *, isc_boolean_t, + unsigned int, isc_counter_t *qc, dns_rdatatype_t); static inline void check_exit(dns_adb_t *); static void destroy(dns_adb_t *); @@ -2760,6 +2761,19 @@ dns_adb_createfind(dns_adb_t *adb, isc_t isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **findp) { + return (dns_adb_createfind2(adb, task, action, arg, name, + qname, qtype, options, now, + target, port, 0, NULL, findp)); +} + +isc_result_t +dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, + void *arg, dns_name_t *name, dns_name_t *qname, + dns_rdatatype_t qtype, unsigned int options, + isc_stdtime_t now, dns_name_t *target, + in_port_t port, unsigned int depth, isc_counter_t *qc, + dns_adbfind_t **findp) +{ dns_adbfind_t *find; dns_adbname_t *adbname; int bucket; @@ -2990,7 +3004,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_t * Start V4. */ if (WANT_INET(wanted_fetches) && - fetch_name(adbname, start_at_zone, + fetch_name(adbname, start_at_zone, depth, qc, dns_rdatatype_a) == ISC_R_SUCCESS) { DP(DEF_LEVEL, "dns_adb_createfind: started A fetch for name %p", @@ -3001,7 +3015,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_t * Start V6. */ if (WANT_INET6(wanted_fetches) && - fetch_name(adbname, start_at_zone, + fetch_name(adbname, start_at_zone, depth, qc, dns_rdatatype_aaaa) == ISC_R_SUCCESS) { DP(DEF_LEVEL, "dns_adb_createfind: " @@ -3744,6 +3758,12 @@ fetch_callback(isc_task_t *task, isc_eve DP(DEF_LEVEL, "adb: fetch of '%s' %s failed: %s", buf, address_type == DNS_ADBFIND_INET ? "A" : "AAAA", dns_result_totext(dev->result)); + /* + * Don't record a failure unless this is the initial + * fetch of a chain. + */ + if (fetch->depth > 1) + goto out; /* XXXMLG Don't pound on bad servers. */ if (address_type == DNS_ADBFIND_INET) { name->expire_v4 = ISC_MIN(name->expire_v4, now + 300); @@ -3781,9 +3801,8 @@ fetch_callback(isc_task_t *task, isc_eve } static isc_result_t -fetch_name(dns_adbname_t *adbname, - isc_boolean_t start_at_zone, - dns_rdatatype_t type) +fetch_name(dns_adbname_t *adbname, isc_boolean_t start_at_zone, + unsigned int depth, isc_counter_t *qc, dns_rdatatype_t type) { isc_result_t result; dns_adbfetch_t *fetch = NULL; @@ -3828,12 +3847,14 @@ fetch_name(dns_adbname_t *adbname, result = ISC_R_NOMEMORY; goto cleanup; } + fetch->depth = depth; - result = dns_resolver_createfetch(adb->view->resolver, &adbname->name, - type, name, nameservers, NULL, - options, adb->task, fetch_callback, - adbname, &fetch->rdataset, NULL, - &fetch->fetch); + result = dns_resolver_createfetch3(adb->view->resolver, &adbname->name, + type, name, nameservers, NULL, + NULL, 0, options, depth, qc, + adb->task, fetch_callback, adbname, + &fetch->rdataset, NULL, + &fetch->fetch); if (result != ISC_R_SUCCESS) goto cleanup; Modified: releng/8.4/contrib/bind9/lib/dns/include/dns/adb.h ============================================================================== --- releng/8.4/contrib/bind9/lib/dns/include/dns/adb.h Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/lib/dns/include/dns/adb.h Wed Dec 10 08:36:40 2014 (r275672) @@ -334,6 +334,13 @@ dns_adb_createfind(dns_adb_t *adb, isc_t dns_rdatatype_t qtype, unsigned int options, isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **find); +isc_result_t +dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, + void *arg, dns_name_t *name, dns_name_t *qname, + dns_rdatatype_t qtype, unsigned int options, + isc_stdtime_t now, dns_name_t *target, in_port_t port, + unsigned int depth, isc_counter_t *qc, + dns_adbfind_t **find); /*%< * Main interface for clients. The adb will look up the name given in * "name" and will build up a list of found addresses, and perhaps start Modified: releng/8.4/contrib/bind9/lib/dns/include/dns/resolver.h ============================================================================== --- releng/8.4/contrib/bind9/lib/dns/include/dns/resolver.h Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/lib/dns/include/dns/resolver.h Wed Dec 10 08:36:40 2014 (r275672) @@ -271,6 +271,18 @@ dns_resolver_createfetch2(dns_resolver_t dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp); +isc_result_t +dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name, + dns_rdatatype_t type, + dns_name_t *domain, dns_rdataset_t *nameservers, + dns_forwarders_t *forwarders, + isc_sockaddr_t *client, isc_uint16_t id, + unsigned int options, unsigned int depth, + isc_counter_t *qc, isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_rdataset_t *rdataset, + dns_rdataset_t *sigrdataset, + dns_fetch_t **fetchp); /*%< * Recurse to answer a question. * @@ -572,6 +584,30 @@ dns_resolver_printbadcache(dns_resolver_ * \li resolver to be valid. */ +void +dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth); +unsigned int +dns_resolver_getmaxdepth(dns_resolver_t *resolver); +/*% + * Get and set how many NS indirections will be followed when looking for + * nameserver addresses. + * + * Requires: + * \li resolver to be valid. + */ + +void +dns_resolver_setmaxqueries(dns_resolver_t *resolver, unsigned int queries); +unsigned int +dns_resolver_getmaxqueries(dns_resolver_t *resolver); +/*% + * Get and set how many iterative queries will be allowed before + * terminating a recursive query. + * + * Requires: + * \li resolver to be valid. + */ + ISC_LANG_ENDDECLS #endif /* DNS_RESOLVER_H */ Modified: releng/8.4/contrib/bind9/lib/dns/resolver.c ============================================================================== --- releng/8.4/contrib/bind9/lib/dns/resolver.c Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/lib/dns/resolver.c Wed Dec 10 08:36:40 2014 (r275672) @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -126,6 +127,16 @@ #define MAXIMUM_QUERY_TIMEOUT 30 /* The maximum time in seconds for the whole query to live. */ #endif +/* The default maximum number of recursions to follow before giving up. */ +#ifndef DEFAULT_RECURSION_DEPTH +#define DEFAULT_RECURSION_DEPTH 7 +#endif + +/* The default maximum number of iterative queries to allow before giving up. */ +#ifndef DEFAULT_MAX_QUERIES +#define DEFAULT_MAX_QUERIES 50 +#endif + /*% * Maximum EDNS0 input packet size. */ @@ -227,12 +238,13 @@ struct fetchctx { isc_sockaddrlist_t edns; isc_sockaddrlist_t edns512; isc_sockaddrlist_t bad_edns; - dns_validator_t *validator; + dns_validator_t * validator; ISC_LIST(dns_validator_t) validators; dns_db_t * cache; dns_adb_t * adb; isc_boolean_t ns_ttl_ok; isc_uint32_t ns_ttl; + isc_counter_t * qc; /*% * The number of events we're waiting for. @@ -300,6 +312,7 @@ struct fetchctx { isc_boolean_t timeout; dns_adbaddrinfo_t *addrinfo; isc_sockaddr_t *client; + unsigned int depth; }; #define FCTX_MAGIC ISC_MAGIC('F', '!', '!', '!') @@ -412,6 +425,8 @@ struct dns_resolver { isc_timer_t * spillattimer; isc_boolean_t zero_no_soa_ttl; unsigned int query_timeout; + unsigned int maxdepth; + unsigned int maxqueries; /* Locked by lock. */ unsigned int references; @@ -1569,6 +1584,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddr if (result != ISC_R_SUCCESS) goto cleanup_dispatch; } + fctx->querysent++; ISC_LIST_APPEND(fctx->queries, query, link); @@ -2210,9 +2226,9 @@ fctx_finddone(isc_task_t *task, isc_even */ INSIST(!SHUTTINGDOWN(fctx)); fctx->attributes &= ~FCTX_ATTR_ADDRWAIT; - if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) + if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) { want_try = ISC_TRUE; - else { + } else { fctx->findfail++; if (fctx->pending == 0) { /* @@ -2241,7 +2257,7 @@ fctx_finddone(isc_task_t *task, isc_even else if (want_done) fctx_done(fctx, ISC_R_FAILURE, __LINE__); else if (destroy) { - fctx_destroy(fctx); + fctx_destroy(fctx); if (bucket_empty) empty_bucket(res); } @@ -2495,12 +2511,13 @@ findname(fetchctx_t *fctx, dns_name_t *n * See what we know about this address. */ find = NULL; - result = dns_adb_createfind(fctx->adb, - res->buckets[fctx->bucketnum].task, - fctx_finddone, fctx, name, - &fctx->name, fctx->type, - options, now, NULL, - res->view->dstport, &find); + result = dns_adb_createfind2(fctx->adb, + res->buckets[fctx->bucketnum].task, + fctx_finddone, fctx, name, + &fctx->name, fctx->type, + options, now, NULL, + res->view->dstport, + fctx->depth + 1, fctx->qc, &find); if (result != ISC_R_SUCCESS) { if (result == DNS_R_ALIAS) { /* @@ -2608,6 +2625,14 @@ fctx_getaddresses(fetchctx_t *fctx, isc_ res = fctx->res; + if (fctx->depth > res->maxdepth) { + isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(3), + "too much NS indirection resolving '%s'", + fctx->info); + return (DNS_R_SERVFAIL); + } + /* * Forwarders. */ @@ -3083,6 +3108,16 @@ fctx_try(fetchctx_t *fctx, isc_boolean_t } } + result = isc_counter_increment(fctx->qc); + if (result != ISC_R_SUCCESS) { + isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(3), + "exceeded max queries resolving '%s'", + fctx->info); + fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); + return; + } + result = fctx_query(fctx, addrinfo, fctx->options); if (result != ISC_R_SUCCESS) fctx_done(fctx, result, __LINE__); @@ -3181,6 +3216,7 @@ fctx_destroy(fetchctx_t *fctx) { isc_mem_put(fctx->mctx, sa, sizeof(*sa)); } + isc_counter_detach(&fctx->qc); isc_timer_detach(&fctx->timer); dns_message_destroy(&fctx->rmessage); dns_message_destroy(&fctx->qmessage); @@ -3509,7 +3545,8 @@ log_ns_ttl(fetchctx_t *fctx, const char static isc_result_t fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, dns_name_t *domain, dns_rdataset_t *nameservers, - unsigned int options, unsigned int bucketnum, fetchctx_t **fctxp) + unsigned int options, unsigned int bucketnum, unsigned int depth, + isc_counter_t *qc, fetchctx_t **fctxp) { fetchctx_t *fctx; isc_result_t result; @@ -3531,6 +3568,21 @@ fctx_create(dns_resolver_t *res, dns_nam fctx = isc_mem_get(mctx, sizeof(*fctx)); if (fctx == NULL) return (ISC_R_NOMEMORY); + + fctx->qc = NULL; + if (qc != NULL) { + isc_counter_attach(qc, &fctx->qc); + } else { + result = isc_counter_create(res->mctx, + res->maxqueries, &fctx->qc); + if (result != ISC_R_SUCCESS) + goto cleanup_fetch; + } + + /* + * Make fctx->info point to a copy of a formatted string + * "name/type". + */ dns_name_format(name, buf, sizeof(buf)); dns_rdatatype_format(type, typebuf, sizeof(typebuf)); strcat(buf, "/"); /* checked */ @@ -3538,7 +3590,7 @@ fctx_create(dns_resolver_t *res, dns_nam fctx->info = isc_mem_strdup(mctx, buf); if (fctx->info == NULL) { result = ISC_R_NOMEMORY; - goto cleanup_fetch; + goto cleanup_counter; } FCTXTRACE("create"); dns_name_init(&fctx->name, NULL); @@ -3561,6 +3613,7 @@ fctx_create(dns_resolver_t *res, dns_nam fctx->state = fetchstate_init; fctx->want_shutdown = ISC_FALSE; fctx->cloned = ISC_FALSE; + fctx->depth = depth; ISC_LIST_INIT(fctx->queries); ISC_LIST_INIT(fctx->finds); ISC_LIST_INIT(fctx->altfinds); @@ -3766,6 +3819,9 @@ fctx_create(dns_resolver_t *res, dns_nam cleanup_info: isc_mem_free(mctx, fctx->info); + cleanup_counter: + isc_counter_detach(&fctx->qc); + cleanup_fetch: isc_mem_put(mctx, fctx, sizeof(*fctx)); @@ -5477,7 +5533,7 @@ noanswer_response(fetchctx_t *fctx, dns_ char qbuf[DNS_NAME_FORMATSIZE]; char nbuf[DNS_NAME_FORMATSIZE]; char tbuf[DNS_RDATATYPE_FORMATSIZE]; - dns_rdatatype_format(fctx->type, tbuf, + dns_rdatatype_format(type, tbuf, sizeof(tbuf)); dns_name_format(name, nbuf, sizeof(nbuf)); @@ -5486,7 +5542,7 @@ noanswer_response(fetchctx_t *fctx, dns_ log_formerr(fctx, "unrelated %s %s in " "%s authority section", - tbuf, qbuf, nbuf); + tbuf, nbuf, qbuf); return (DNS_R_FORMERR); } if (type == dns_rdatatype_ns) { @@ -7528,6 +7584,8 @@ dns_resolver_create(dns_view_t *view, res->query_timeout = DEFAULT_QUERY_TIMEOUT; res->ndisps = 0; res->nextdisp = 0; /* meaningless at this point, but init it */ + res->maxdepth = DEFAULT_RECURSION_DEPTH; + res->maxqueries = DEFAULT_MAX_QUERIES; res->nbuckets = ntasks; res->activebuckets = ntasks; res->buckets = isc_mem_get(view->mctx, @@ -7967,9 +8025,9 @@ dns_resolver_createfetch(dns_resolver_t dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp) { - return (dns_resolver_createfetch2(res, name, type, domain, + return (dns_resolver_createfetch3(res, name, type, domain, nameservers, forwarders, NULL, 0, - options, task, action, arg, + options, 0, NULL, task, action, arg, rdataset, sigrdataset, fetchp)); } @@ -7985,6 +8043,25 @@ dns_resolver_createfetch2(dns_resolver_t dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp) { + return (dns_resolver_createfetch3(res, name, type, domain, + nameservers, forwarders, client, id, + options, 0, NULL, task, action, arg, + rdataset, sigrdataset, fetchp)); +} + +isc_result_t +dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name, + dns_rdatatype_t type, + dns_name_t *domain, dns_rdataset_t *nameservers, + dns_forwarders_t *forwarders, + isc_sockaddr_t *client, dns_messageid_t id, + unsigned int options, unsigned int depth, + isc_counter_t *qc, isc_task_t *task, + isc_taskaction_t action, void *arg, + dns_rdataset_t *rdataset, + dns_rdataset_t *sigrdataset, + dns_fetch_t **fetchp) +{ dns_fetch_t *fetch; fetchctx_t *fctx = NULL; isc_result_t result = ISC_R_SUCCESS; @@ -8071,11 +8148,12 @@ dns_resolver_createfetch2(dns_resolver_t if (fctx == NULL) { result = fctx_create(res, name, type, domain, nameservers, - options, bucketnum, &fctx); + options, bucketnum, depth, qc, &fctx); if (result != ISC_R_SUCCESS) goto unlock; new_fctx = ISC_TRUE; - } + } else if (fctx->depth > depth) + fctx->depth = depth; result = fctx_join(fctx, task, client, id, action, arg, rdataset, sigrdataset, fetch); @@ -8847,3 +8925,27 @@ dns_resolver_settimeout(dns_resolver_t * resolver->query_timeout = seconds; } + +void +dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth) { + REQUIRE(VALID_RESOLVER(resolver)); + resolver->maxdepth = maxdepth; +} + +unsigned int +dns_resolver_getmaxdepth(dns_resolver_t *resolver) { + REQUIRE(VALID_RESOLVER(resolver)); + return (resolver->maxdepth); +} + +void +dns_resolver_setmaxqueries(dns_resolver_t *resolver, unsigned int queries) { + REQUIRE(VALID_RESOLVER(resolver)); + resolver->maxqueries = queries; +} + +unsigned int +dns_resolver_getmaxqueries(dns_resolver_t *resolver) { + REQUIRE(VALID_RESOLVER(resolver)); + return (resolver->maxqueries); +} Modified: releng/8.4/contrib/bind9/lib/export/isc/Makefile.in ============================================================================== --- releng/8.4/contrib/bind9/lib/export/isc/Makefile.in Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/lib/export/isc/Makefile.in Wed Dec 10 08:36:40 2014 (r275672) @@ -63,7 +63,7 @@ WIN32OBJS = win32/condition.@O@ win32/d # Alphabetically OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ backtrace.@O@ backtrace-emptytbl.@O@ base32.@O@ \ - base64.@O@ buffer.@O@ bufferlist.@O@ \ + base64.@O@ buffer.@O@ bufferlist.@O@ counter.@O@ \ error.@O@ event.@O@ \ hash.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ inet_aton.@O@ iterated_hash.@O@ lex.@O@ lfsr.@O@ log.@O@ \ @@ -86,7 +86,7 @@ ISCDRIVERSRCS = mem.c task.c lib.c timer SRCS = @ISC_EXTRA_SRCS@ \ assertions.c backtrace.c backtrace-emptytbl.c base32.c \ - base64.c buffer.c bufferlist.c \ + base64.c buffer.c bufferlist.c counter.c \ error.c event.c \ hash.c hex.c hmacmd5.c hmacsha.c \ inet_aton.c iterated_hash.c lex.c log.c lfsr.c \ Modified: releng/8.4/contrib/bind9/lib/isc/Makefile.in ============================================================================== --- releng/8.4/contrib/bind9/lib/isc/Makefile.in Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/lib/isc/Makefile.in Wed Dec 10 08:36:40 2014 (r275672) @@ -13,8 +13,6 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id$ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -53,7 +51,7 @@ WIN32OBJS = win32/condition.@O@ win32/d OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ backtrace.@O@ base32.@O@ base64.@O@ \ bitstring.@O@ buffer.@O@ bufferlist.@O@ commandline.@O@ \ - error.@O@ event.@O@ \ + counter.@O@ error.@O@ event.@O@ \ hash.@O@ heap.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ httpd.@O@ inet_aton.@O@ iterated_hash.@O@ \ lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \ @@ -69,8 +67,8 @@ SYMTBLOBJS = backtrace-emptytbl.@O@ # Alphabetically SRCS = @ISC_EXTRA_SRCS@ \ assertions.c backtrace.c base32.c base64.c bitstring.c \ - buffer.c bufferlist.c commandline.c error.c event.c \ - heap.c hex.c hmacmd5.c hmacsha.c \ + buffer.c bufferlist.c commandline.c counter.c \ + error.c event.c heap.c hex.c hmacmd5.c hmacsha.c \ httpd.c inet_aton.c iterated_hash.c \ lex.c lfsr.c lib.c log.c \ md5.c mem.c mutexblock.c \ Added: releng/8.4/contrib/bind9/lib/isc/counter.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/8.4/contrib/bind9/lib/isc/counter.c Wed Dec 10 08:36:40 2014 (r275672) @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/*! \file */ + +#include + +#include + +#include +#include +#include +#include + +#define COUNTER_MAGIC ISC_MAGIC('C', 'n', 't', 'r') +#define VALID_COUNTER(r) ISC_MAGIC_VALID(r, COUNTER_MAGIC) + +struct isc_counter { + unsigned int magic; + isc_mem_t *mctx; + isc_mutex_t lock; + unsigned int references; + unsigned int limit; + unsigned int used; +}; + +isc_result_t +isc_counter_create(isc_mem_t *mctx, int limit, isc_counter_t **counterp) { + isc_result_t result; + isc_counter_t *counter; + + REQUIRE(counterp != NULL && *counterp == NULL); + + counter = isc_mem_get(mctx, sizeof(*counter)); + if (counter == NULL) + return (ISC_R_NOMEMORY); + + result = isc_mutex_init(&counter->lock); + if (result != ISC_R_SUCCESS) { + isc_mem_put(mctx, counter, sizeof(*counter)); + return (result); + } + + counter->mctx = NULL; + isc_mem_attach(mctx, &counter->mctx); + + counter->references = 1; + counter->limit = limit; + counter->used = 0; + + counter->magic = COUNTER_MAGIC; + *counterp = counter; + return (ISC_R_SUCCESS); +} + +isc_result_t +isc_counter_increment(isc_counter_t *counter) { + isc_result_t result = ISC_R_SUCCESS; + + LOCK(&counter->lock); + counter->used++; + if (counter->limit != 0 && counter->used >= counter->limit) + result = ISC_R_QUOTA; + UNLOCK(&counter->lock); + + return (result); +} + +unsigned int +isc_counter_used(isc_counter_t *counter) { + REQUIRE(VALID_COUNTER(counter)); + + return (counter->used); +} + +void +isc_counter_setlimit(isc_counter_t *counter, int limit) { + REQUIRE(VALID_COUNTER(counter)); + + LOCK(&counter->lock); + counter->limit = limit; + UNLOCK(&counter->lock); +} + +void +isc_counter_attach(isc_counter_t *source, isc_counter_t **targetp) { + REQUIRE(VALID_COUNTER(source)); + REQUIRE(targetp != NULL && *targetp == NULL); + + LOCK(&source->lock); + source->references++; + INSIST(source->references > 0); + UNLOCK(&source->lock); + + *targetp = source; +} + +static void +destroy(isc_counter_t *counter) { + counter->magic = 0; + isc_mutex_destroy(&counter->lock); + isc_mem_putanddetach(&counter->mctx, counter, sizeof(*counter)); +} + +void +isc_counter_detach(isc_counter_t **counterp) { + isc_counter_t *counter; + isc_boolean_t want_destroy = ISC_FALSE; + + REQUIRE(counterp != NULL && *counterp != NULL); + counter = *counterp; + REQUIRE(VALID_COUNTER(counter)); + + *counterp = NULL; + + LOCK(&counter->lock); + INSIST(counter->references > 0); + counter->references--; + if (counter->references == 0) + want_destroy = ISC_TRUE; + UNLOCK(&counter->lock); + + if (want_destroy) + destroy(counter); +} Modified: releng/8.4/contrib/bind9/lib/isc/include/isc/Makefile.in ============================================================================== --- releng/8.4/contrib/bind9/lib/isc/include/isc/Makefile.in Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/lib/isc/include/isc/Makefile.in Wed Dec 10 08:36:40 2014 (r275672) @@ -13,8 +13,6 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id$ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -27,7 +25,8 @@ top_srcdir = @top_srcdir@ # install target below. # HEADERS = app.h assertions.h base64.h bind9.h bitstring.h boolean.h \ - buffer.h bufferlist.h commandline.h entropy.h error.h event.h \ + buffer.h bufferlist.h \ + commandline.h counter.h entropy.h error.h event.h \ eventclass.h file.h formatcheck.h fsaccess.h \ hash.h heap.h hex.h hmacmd5.h hmacsha.h \ httpd.h \ Added: releng/8.4/contrib/bind9/lib/isc/include/isc/counter.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/8.4/contrib/bind9/lib/isc/include/isc/counter.h Wed Dec 10 08:36:40 2014 (r275672) @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef ISC_COUNTER_H +#define ISC_COUNTER_H 1 + +/***** + ***** Module Info + *****/ + +/*! \file isc/counter.h + * + * \brief The isc_counter_t object is a simplified version of the + * isc_quota_t object; it tracks the consumption of limited + * resources, returning an error condition when the quota is + * exceeded. However, unlike isc_quota_t, attaching and detaching + * from a counter object does not increment or decrement the counter. + */ + +/*** + *** Imports. + ***/ + +#include +#include +#include + +/***** + ***** Types. + *****/ + +ISC_LANG_BEGINDECLS + +isc_result_t +isc_counter_create(isc_mem_t *mctx, int limit, isc_counter_t **counterp); +/*%< + * Allocate and initialize a counter object. + */ + +isc_result_t +isc_counter_increment(isc_counter_t *counter); +/*%< + * Increment the counter. + * + * If the counter limit is nonzero and has been reached, then + * return ISC_R_QUOTA, otherwise ISC_R_SUCCESS. (The counter is + * incremented regardless of return value.) + */ + +unsigned int +isc_counter_used(isc_counter_t *counter); +/*%< + * Return the current counter value. + */ + +void +isc_counter_setlimit(isc_counter_t *counter, int limit); +/*%< + * Set the counter limit. + */ + +void +isc_counter_attach(isc_counter_t *source, isc_counter_t **targetp); +/*%< + * Attach to a counter object, increasing its reference counter. + */ + +void +isc_counter_detach(isc_counter_t **counterp); +/*%< + * Detach (and destroy if reference counter has dropped to zero) + * a counter object. + */ + +ISC_LANG_ENDDECLS + +#endif /* ISC_COUNTER_H */ Modified: releng/8.4/contrib/bind9/lib/isc/include/isc/types.h ============================================================================== --- releng/8.4/contrib/bind9/lib/isc/include/isc/types.h Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/lib/isc/include/isc/types.h Wed Dec 10 08:36:40 2014 (r275672) @@ -50,6 +50,7 @@ typedef struct isc_buffer isc_buffer_t; typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; /*%< Buffer List */ typedef struct isc_constregion isc_constregion_t; /*%< Const region */ typedef struct isc_consttextregion isc_consttextregion_t; /*%< Const Text Region */ +typedef struct isc_counter isc_counter_t; /*%< Counter */ typedef struct isc_entropy isc_entropy_t; /*%< Entropy */ typedef struct isc_entropysource isc_entropysource_t; /*%< Entropy Source */ typedef struct isc_event isc_event_t; /*%< Event */ Modified: releng/8.4/contrib/bind9/lib/isccfg/namedconf.c ============================================================================== --- releng/8.4/contrib/bind9/lib/isccfg/namedconf.c Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/bind9/lib/isccfg/namedconf.c Wed Dec 10 08:36:40 2014 (r275672) @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file */ #include @@ -1348,6 +1346,8 @@ view_clauses[] = { { "max-cache-ttl", &cfg_type_uint32, 0 }, { "max-clients-per-query", &cfg_type_uint32, 0 }, { "max-ncache-ttl", &cfg_type_uint32, 0 }, + { "max-recursion-depth", &cfg_type_uint32, 0 }, + { "max-recursion-queries", &cfg_type_uint32, 0 }, { "max-udp-size", &cfg_type_uint32, 0 }, { "min-roots", &cfg_type_uint32, CFG_CLAUSEFLAG_NOTIMP }, { "minimal-responses", &cfg_type_boolean, 0 }, Modified: releng/8.4/contrib/file/elfclass.h ============================================================================== --- releng/8.4/contrib/file/elfclass.h Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/file/elfclass.h Wed Dec 10 08:36:40 2014 (r275672) @@ -35,9 +35,11 @@ switch (type) { #ifdef ELFCORE case ET_CORE: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) return -1; @@ -45,18 +47,24 @@ #endif case ET_EXEC: case ET_DYN: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), - fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) - == -1) + fsize, &flags, shnum) == -1) return -1; /*FALLTHROUGH*/ case ET_REL: + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), - elf_getu16(swap, elfhdr.e_shnum), + (off_t)elf_getu(swap, elfhdr.e_shoff), shnum, (size_t)elf_getu16(swap, elfhdr.e_shentsize), &flags, elf_getu16(swap, elfhdr.e_machine)) == -1) Modified: releng/8.4/contrib/file/readelf.c ============================================================================== --- releng/8.4/contrib/file/readelf.c Wed Dec 10 08:36:07 2014 (r275671) +++ releng/8.4/contrib/file/readelf.c Wed Dec 10 08:36:40 2014 (r275672) @@ -60,6 +60,18 @@ private uint16_t getu16(int, uint16_t); private uint32_t getu32(int, uint32_t); private uint64_t getu64(int, uint64_t); +#define MAX_PHNUM 256 +#define MAX_SHNUM 1024 + +private int +toomany(struct magic_set *ms, const char *name, uint16_t num) +{ + if (file_printf(ms, ", too many %s header sections (%u)", name, num + ) == -1) + return -1; + return 0; +} + private uint16_t getu16(int swap, uint16_t value) { @@ -391,13 +403,13 @@ donote(struct magic_set *ms, void *vbuf, if (namesz & 0x80000000) { (void)file_printf(ms, ", bad note name size 0x%lx", (unsigned long)namesz); - return offset; + return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, ", bad note description size 0x%lx", *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:52:49 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2F5FBCF6; Wed, 10 Dec 2014 08:52:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10B9EDD7; Wed, 10 Dec 2014 08:52:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8qmLt047853; Wed, 10 Dec 2014 08:52:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8qm5w047847; Wed, 10 Dec 2014 08:52:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201412100852.sBA8qm5w047847@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 10 Dec 2014 08:52:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275673 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:52:49 -0000 Author: mav Date: Wed Dec 10 08:52:47 2014 New Revision: 275673 URL: https://svnweb.freebsd.org/changeset/base/275673 Log: MFC r275446: Plug memory leaks on UNMAP and XCOPY with invalid parameters. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Wed Dec 10 08:36:40 2014 (r275672) +++ stable/10/sys/cam/ctl/ctl.c Wed Dec 10 08:52:47 2014 (r275673) @@ -6166,8 +6166,7 @@ ctl_unmap(struct ctl_scsiio *ctsio) /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); + goto done; } len = scsi_2btoul(hdr->desc_length); buf = (struct scsi_unmap_desc *)(hdr + 1); @@ -6194,8 +6193,7 @@ ctl_unmap(struct ctl_scsiio *ctsio) len = (uint8_t *)endnz - (uint8_t *)buf; if (len == 0) { ctl_set_success(ctsio); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); + goto done; } mtx_lock(&lun->lun_lock); @@ -6209,6 +6207,14 @@ ctl_unmap(struct ctl_scsiio *ctsio) retval = lun->backend->config_write((union ctl_io *)ctsio); return (retval); + +done: + if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) { + free(ctsio->kern_data_ptr, M_CTL); + ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED; + } + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); } /* Modified: stable/10/sys/cam/ctl/ctl_tpc.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_tpc.c Wed Dec 10 08:36:40 2014 (r275672) +++ stable/10/sys/cam/ctl/ctl_tpc.c Wed Dec 10 08:52:47 2014 (r275673) @@ -1678,6 +1678,10 @@ ctl_extended_copy_lid1(struct ctl_scsiio return (CTL_RETVAL_COMPLETE); done: + if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) { + free(ctsio->kern_data_ptr, M_CTL); + ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED; + } ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -1801,6 +1805,10 @@ ctl_extended_copy_lid4(struct ctl_scsiio return (CTL_RETVAL_COMPLETE); done: + if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) { + free(ctsio->kern_data_ptr, M_CTL); + ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED; + } ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -1978,8 +1986,10 @@ ctl_populate_token(struct ctl_scsiio *ct return (CTL_RETVAL_COMPLETE); done: - if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) + if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) { free(ctsio->kern_data_ptr, M_CTL); + ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED; + } ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -2103,8 +2113,10 @@ ctl_write_using_token(struct ctl_scsiio return (CTL_RETVAL_COMPLETE); done: - if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) + if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) { free(ctsio->kern_data_ptr, M_CTL); + ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED; + } ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 08:53:42 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1DAA5F47; Wed, 10 Dec 2014 08:53:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A6E9DF1; Wed, 10 Dec 2014 08:53:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA8rf85048037; Wed, 10 Dec 2014 08:53:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA8rfe0048036; Wed, 10 Dec 2014 08:53:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201412100853.sBA8rfe0048036@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 10 Dec 2014 08:53:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275674 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 08:53:42 -0000 Author: mav Date: Wed Dec 10 08:53:41 2014 New Revision: 275674 URL: https://svnweb.freebsd.org/changeset/base/275674 Log: MFC r275452: Do not corrupt the listen string when parsing it. This fixes problem with ctld reload when it is configured to listen on two portals with same IP, but different ports. Modified: stable/10/usr.sbin/ctld/ctld.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Wed Dec 10 08:52:47 2014 (r275673) +++ stable/10/usr.sbin/ctld/ctld.c Wed Dec 10 08:53:41 2014 (r275674) @@ -643,10 +643,11 @@ static int parse_addr_port(char *arg, const char *def_port, struct addrinfo **ai) { struct addrinfo hints; - char *addr, *ch; + char *str, *addr, *ch; const char *port; int error, colons = 0; + str = arg = strdup(arg); if (arg[0] == '[') { /* * IPv6 address in square brackets, perhaps with port. @@ -659,8 +660,10 @@ parse_addr_port(char *arg, const char *d port = def_port; } else if (arg[0] == ':') { port = arg + 1; - } else + } else { + free(str); return (1); + } } else { /* * Either IPv6 address without brackets - and without @@ -687,9 +690,8 @@ parse_addr_port(char *arg, const char *d hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; error = getaddrinfo(addr, port, &hints, ai); - if (error != 0) - return (1); - return (0); + free(str); + return ((error != 0) ? 1 : 0); } int From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 11:21:53 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D2780BCA; Wed, 10 Dec 2014 11:21:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD55F86; Wed, 10 Dec 2014 11:21:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBABLrdZ020170; Wed, 10 Dec 2014 11:21:53 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBABLrx2020167; Wed, 10 Dec 2014 11:21:53 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201412101121.sBABLrx2020167@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 10 Dec 2014 11:21:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275675 - in head/sys: conf dev/xen/grant_table xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 11:21:53 -0000 Author: royger Date: Wed Dec 10 11:21:52 2014 New Revision: 275675 URL: https://svnweb.freebsd.org/changeset/base/275675 Log: xen: move grant table code Mave the grant table code into the dev/xen folder in preparation for turning it into a device using the newbus interface. This is just code motion, no functional changes. Sponsored by: Citrix Systems R&D Added: head/sys/dev/xen/grant_table/ head/sys/dev/xen/grant_table/grant_table.c - copied unchanged from r275647, head/sys/xen/gnttab.c Deleted: head/sys/xen/gnttab.c Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Dec 10 08:53:41 2014 (r275674) +++ head/sys/conf/files Wed Dec 10 11:21:52 2014 (r275675) @@ -2651,6 +2651,7 @@ dev/xen/blkback/blkback.c optional xen | dev/xen/console/console.c optional xen | xenhvm dev/xen/console/xencons_ring.c optional xen | xenhvm dev/xen/control/control.c optional xen | xenhvm +dev/xen/grant_table/grant_table.c optional xen | xenhvm dev/xen/netback/netback.c optional xen | xenhvm dev/xen/netfront/netfront.c optional xen | xenhvm dev/xen/xenpci/xenpci.c optional xenpci @@ -4000,7 +4001,6 @@ vm/vm_reserv.c standard vm/vm_unix.c standard vm/vm_zeroidle.c standard vm/vnode_pager.c standard -xen/gnttab.c optional xen | xenhvm xen/features.c optional xen | xenhvm xen/xenbus/xenbus_if.m optional xen | xenhvm xen/xenbus/xenbus.c optional xen | xenhvm Copied: head/sys/dev/xen/grant_table/grant_table.c (from r275647, head/sys/xen/gnttab.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xen/grant_table/grant_table.c Wed Dec 10 11:21:52 2014 (r275675, copy of r275647, head/sys/xen/gnttab.c) @@ -0,0 +1,720 @@ +/****************************************************************************** + * gnttab.c + * + * Two sets of functionality: + * 1. Granting foreign access to our memory reservation. + * 2. Accessing others' memory reservations via grant references. + * (i.e., mechanisms for both sender and recipient of grant references) + * + * Copyright (c) 2005, Christopher Clark + * Copyright (c) 2004, K A Fraser + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_pmap.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#define cmpxchg(a, b, c) atomic_cmpset_int((volatile u_int *)(a),(b),(c)) + +/* External tools reserve first few grant table entries. */ +#define NR_RESERVED_ENTRIES 8 +#define GREFS_PER_GRANT_FRAME (PAGE_SIZE / sizeof(grant_entry_t)) + +static grant_ref_t **gnttab_list; +static unsigned int nr_grant_frames; +static unsigned int boot_max_nr_grant_frames; +static int gnttab_free_count; +static grant_ref_t gnttab_free_head; +static struct mtx gnttab_list_lock; + +#ifdef XENHVM +/* + * Resource representing allocated physical address space + * for the grant table metainfo + */ +static struct resource *gnttab_pseudo_phys_res; + +/* Resource id for allocated physical address space. */ +static int gnttab_pseudo_phys_res_id; +#endif + +static grant_entry_t *shared; + +static struct gnttab_free_callback *gnttab_free_callback_list = NULL; + +static int gnttab_expand(unsigned int req_entries); + +#define RPP (PAGE_SIZE / sizeof(grant_ref_t)) +#define gnttab_entry(entry) (gnttab_list[(entry) / RPP][(entry) % RPP]) + +static int +get_free_entries(int count, int *entries) +{ + int ref, error; + grant_ref_t head; + + mtx_lock(&gnttab_list_lock); + if ((gnttab_free_count < count) && + ((error = gnttab_expand(count - gnttab_free_count)) != 0)) { + mtx_unlock(&gnttab_list_lock); + return (error); + } + ref = head = gnttab_free_head; + gnttab_free_count -= count; + while (count-- > 1) + head = gnttab_entry(head); + gnttab_free_head = gnttab_entry(head); + gnttab_entry(head) = GNTTAB_LIST_END; + mtx_unlock(&gnttab_list_lock); + + *entries = ref; + return (0); +} + +static void +do_free_callbacks(void) +{ + struct gnttab_free_callback *callback, *next; + + callback = gnttab_free_callback_list; + gnttab_free_callback_list = NULL; + + while (callback != NULL) { + next = callback->next; + if (gnttab_free_count >= callback->count) { + callback->next = NULL; + callback->fn(callback->arg); + } else { + callback->next = gnttab_free_callback_list; + gnttab_free_callback_list = callback; + } + callback = next; + } +} + +static inline void +check_free_callbacks(void) +{ + if (__predict_false(gnttab_free_callback_list != NULL)) + do_free_callbacks(); +} + +static void +put_free_entry(grant_ref_t ref) +{ + + mtx_lock(&gnttab_list_lock); + gnttab_entry(ref) = gnttab_free_head; + gnttab_free_head = ref; + gnttab_free_count++; + check_free_callbacks(); + mtx_unlock(&gnttab_list_lock); +} + +/* + * Public grant-issuing interface functions + */ + +int +gnttab_grant_foreign_access(domid_t domid, unsigned long frame, int readonly, + grant_ref_t *result) +{ + int error, ref; + + error = get_free_entries(1, &ref); + + if (__predict_false(error)) + return (error); + + shared[ref].frame = frame; + shared[ref].domid = domid; + wmb(); + shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0); + + if (result) + *result = ref; + + return (0); +} + +void +gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, + unsigned long frame, int readonly) +{ + + shared[ref].frame = frame; + shared[ref].domid = domid; + wmb(); + shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0); +} + +int +gnttab_query_foreign_access(grant_ref_t ref) +{ + uint16_t nflags; + + nflags = shared[ref].flags; + + return (nflags & (GTF_reading|GTF_writing)); +} + +int +gnttab_end_foreign_access_ref(grant_ref_t ref) +{ + uint16_t flags, nflags; + + nflags = shared[ref].flags; + do { + if ( (flags = nflags) & (GTF_reading|GTF_writing) ) { + printf("%s: WARNING: g.e. still in use!\n", __func__); + return (0); + } + } while ((nflags = synch_cmpxchg(&shared[ref].flags, flags, 0)) != + flags); + + return (1); +} + +void +gnttab_end_foreign_access(grant_ref_t ref, void *page) +{ + if (gnttab_end_foreign_access_ref(ref)) { + put_free_entry(ref); + if (page != NULL) { + free(page, M_DEVBUF); + } + } + else { + /* XXX This needs to be fixed so that the ref and page are + placed on a list to be freed up later. */ + printf("%s: WARNING: leaking g.e. and page still in use!\n", + __func__); + } +} + +void +gnttab_end_foreign_access_references(u_int count, grant_ref_t *refs) +{ + grant_ref_t *last_ref; + grant_ref_t head; + grant_ref_t tail; + + head = GNTTAB_LIST_END; + tail = *refs; + last_ref = refs + count; + while (refs != last_ref) { + + if (gnttab_end_foreign_access_ref(*refs)) { + gnttab_entry(*refs) = head; + head = *refs; + } else { + /* + * XXX This needs to be fixed so that the ref + * is placed on a list to be freed up later. + */ + printf("%s: WARNING: leaking g.e. still in use!\n", + __func__); + count--; + } + refs++; + } + + if (count != 0) { + mtx_lock(&gnttab_list_lock); + gnttab_free_count += count; + gnttab_entry(tail) = gnttab_free_head; + gnttab_free_head = head; + mtx_unlock(&gnttab_list_lock); + } +} + +int +gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn, + grant_ref_t *result) +{ + int error, ref; + + error = get_free_entries(1, &ref); + if (__predict_false(error)) + return (error); + + gnttab_grant_foreign_transfer_ref(ref, domid, pfn); + + *result = ref; + return (0); +} + +void +gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid, + unsigned long pfn) +{ + shared[ref].frame = pfn; + shared[ref].domid = domid; + wmb(); + shared[ref].flags = GTF_accept_transfer; +} + +unsigned long +gnttab_end_foreign_transfer_ref(grant_ref_t ref) +{ + unsigned long frame; + uint16_t flags; + + /* + * If a transfer is not even yet started, try to reclaim the grant + * reference and return failure (== 0). + */ + while (!((flags = shared[ref].flags) & GTF_transfer_committed)) { + if ( synch_cmpxchg(&shared[ref].flags, flags, 0) == flags ) + return (0); + cpu_relax(); + } + + /* If a transfer is in progress then wait until it is completed. */ + while (!(flags & GTF_transfer_completed)) { + flags = shared[ref].flags; + cpu_relax(); + } + + /* Read the frame number /after/ reading completion status. */ + rmb(); + frame = shared[ref].frame; + KASSERT(frame != 0, ("grant table inconsistent")); + + return (frame); +} + +unsigned long +gnttab_end_foreign_transfer(grant_ref_t ref) +{ + unsigned long frame = gnttab_end_foreign_transfer_ref(ref); + + put_free_entry(ref); + return (frame); +} + +void +gnttab_free_grant_reference(grant_ref_t ref) +{ + + put_free_entry(ref); +} + +void +gnttab_free_grant_references(grant_ref_t head) +{ + grant_ref_t ref; + int count = 1; + + if (head == GNTTAB_LIST_END) + return; + + ref = head; + while (gnttab_entry(ref) != GNTTAB_LIST_END) { + ref = gnttab_entry(ref); + count++; + } + mtx_lock(&gnttab_list_lock); + gnttab_entry(ref) = gnttab_free_head; + gnttab_free_head = head; + gnttab_free_count += count; + check_free_callbacks(); + mtx_unlock(&gnttab_list_lock); +} + +int +gnttab_alloc_grant_references(uint16_t count, grant_ref_t *head) +{ + int ref, error; + + error = get_free_entries(count, &ref); + if (__predict_false(error)) + return (error); + + *head = ref; + return (0); +} + +int +gnttab_empty_grant_references(const grant_ref_t *private_head) +{ + + return (*private_head == GNTTAB_LIST_END); +} + +int +gnttab_claim_grant_reference(grant_ref_t *private_head) +{ + grant_ref_t g = *private_head; + + if (__predict_false(g == GNTTAB_LIST_END)) + return (g); + *private_head = gnttab_entry(g); + return (g); +} + +void +gnttab_release_grant_reference(grant_ref_t *private_head, grant_ref_t release) +{ + + gnttab_entry(release) = *private_head; + *private_head = release; +} + +void +gnttab_request_free_callback(struct gnttab_free_callback *callback, + void (*fn)(void *), void *arg, uint16_t count) +{ + + mtx_lock(&gnttab_list_lock); + if (callback->next) + goto out; + callback->fn = fn; + callback->arg = arg; + callback->count = count; + callback->next = gnttab_free_callback_list; + gnttab_free_callback_list = callback; + check_free_callbacks(); + out: + mtx_unlock(&gnttab_list_lock); + +} + +void +gnttab_cancel_free_callback(struct gnttab_free_callback *callback) +{ + struct gnttab_free_callback **pcb; + + mtx_lock(&gnttab_list_lock); + for (pcb = &gnttab_free_callback_list; *pcb; pcb = &(*pcb)->next) { + if (*pcb == callback) { + *pcb = callback->next; + break; + } + } + mtx_unlock(&gnttab_list_lock); +} + + +static int +grow_gnttab_list(unsigned int more_frames) +{ + unsigned int new_nr_grant_frames, extra_entries, i; + + new_nr_grant_frames = nr_grant_frames + more_frames; + extra_entries = more_frames * GREFS_PER_GRANT_FRAME; + + for (i = nr_grant_frames; i < new_nr_grant_frames; i++) + { + gnttab_list[i] = (grant_ref_t *) + malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT); + + if (!gnttab_list[i]) + goto grow_nomem; + } + + for (i = GREFS_PER_GRANT_FRAME * nr_grant_frames; + i < GREFS_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++) + gnttab_entry(i) = i + 1; + + gnttab_entry(i) = gnttab_free_head; + gnttab_free_head = GREFS_PER_GRANT_FRAME * nr_grant_frames; + gnttab_free_count += extra_entries; + + nr_grant_frames = new_nr_grant_frames; + + check_free_callbacks(); + + return (0); + +grow_nomem: + for ( ; i >= nr_grant_frames; i--) + free(gnttab_list[i], M_DEVBUF); + return (ENOMEM); +} + +static unsigned int +__max_nr_grant_frames(void) +{ + struct gnttab_query_size query; + int rc; + + query.dom = DOMID_SELF; + + rc = HYPERVISOR_grant_table_op(GNTTABOP_query_size, &query, 1); + if ((rc < 0) || (query.status != GNTST_okay)) + return (4); /* Legacy max supported number of frames */ + + return (query.max_nr_frames); +} + +static inline +unsigned int max_nr_grant_frames(void) +{ + unsigned int xen_max = __max_nr_grant_frames(); + + if (xen_max > boot_max_nr_grant_frames) + return (boot_max_nr_grant_frames); + return (xen_max); +} + +#ifdef notyet +/* + * XXX needed for backend support + * + */ +static int +map_pte_fn(pte_t *pte, struct page *pmd_page, + unsigned long addr, void *data) +{ + unsigned long **frames = (unsigned long **)data; + + set_pte_at(&init_mm, addr, pte, pfn_pte_ma((*frames)[0], PAGE_KERNEL)); + (*frames)++; + return 0; +} + +static int +unmap_pte_fn(pte_t *pte, struct page *pmd_page, + unsigned long addr, void *data) +{ + + set_pte_at(&init_mm, addr, pte, __pte(0)); + return 0; +} +#endif + +#ifndef XENHVM + +static int +gnttab_map(unsigned int start_idx, unsigned int end_idx) +{ + struct gnttab_setup_table setup; + u_long *frames; + + unsigned int nr_gframes = end_idx + 1; + int i, rc; + + frames = malloc(nr_gframes * sizeof(unsigned long), M_DEVBUF, M_NOWAIT); + if (!frames) + return (ENOMEM); + + setup.dom = DOMID_SELF; + setup.nr_frames = nr_gframes; + set_xen_guest_handle(setup.frame_list, frames); + + rc = HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1); + if (rc == -ENOSYS) { + free(frames, M_DEVBUF); + return (ENOSYS); + } + KASSERT(!(rc || setup.status), + ("unexpected result from grant_table_op")); + + if (shared == NULL) { + vm_offset_t area; + + area = kva_alloc(PAGE_SIZE * max_nr_grant_frames()); + KASSERT(area, ("can't allocate VM space for grant table")); + shared = (grant_entry_t *)area; + } + + for (i = 0; i < nr_gframes; i++) + PT_SET_MA(((caddr_t)shared) + i*PAGE_SIZE, + ((vm_paddr_t)frames[i]) << PAGE_SHIFT | PG_RW | PG_V); + + free(frames, M_DEVBUF); + + return (0); +} + +int +gnttab_resume(device_t dev) +{ + + if (max_nr_grant_frames() < nr_grant_frames) + return (ENOSYS); + return (gnttab_map(0, nr_grant_frames - 1)); +} + +int +gnttab_suspend(void) +{ + int i; + + for (i = 0; i < nr_grant_frames; i++) + pmap_kremove((vm_offset_t) shared + i * PAGE_SIZE); + + return (0); +} + +#else /* XENHVM */ + +static vm_paddr_t resume_frames; + +static int +gnttab_map(unsigned int start_idx, unsigned int end_idx) +{ + struct xen_add_to_physmap xatp; + unsigned int i = end_idx; + + /* + * Loop backwards, so that the first hypercall has the largest index, + * ensuring that the table will grow only once. + */ + do { + xatp.domid = DOMID_SELF; + xatp.idx = i; + xatp.space = XENMAPSPACE_grant_table; + xatp.gpfn = (resume_frames >> PAGE_SHIFT) + i; + if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) + panic("HYPERVISOR_memory_op failed to map gnttab"); + } while (i-- > start_idx); + + if (shared == NULL) { + vm_offset_t area; + + area = kva_alloc(PAGE_SIZE * max_nr_grant_frames()); + KASSERT(area, ("can't allocate VM space for grant table")); + shared = (grant_entry_t *)area; + } + + for (i = start_idx; i <= end_idx; i++) { + pmap_kenter((vm_offset_t) shared + i * PAGE_SIZE, + resume_frames + i * PAGE_SIZE); + } + + return (0); +} + +int +gnttab_resume(device_t dev) +{ + unsigned int max_nr_gframes, nr_gframes; + + nr_gframes = nr_grant_frames; + max_nr_gframes = max_nr_grant_frames(); + if (max_nr_gframes < nr_gframes) + return (ENOSYS); + + if (!resume_frames) { + KASSERT(dev != NULL, + ("No resume frames and no device provided")); + + gnttab_pseudo_phys_res = bus_alloc_resource(dev, + SYS_RES_MEMORY, &gnttab_pseudo_phys_res_id, 0, ~0, + PAGE_SIZE * max_nr_gframes, RF_ACTIVE); + if (gnttab_pseudo_phys_res == NULL) + panic("Unable to reserve physical memory for gnttab"); + resume_frames = rman_get_start(gnttab_pseudo_phys_res); + } + + return (gnttab_map(0, nr_gframes - 1)); +} + +#endif + +static int +gnttab_expand(unsigned int req_entries) +{ + int error; + unsigned int cur, extra; + + cur = nr_grant_frames; + extra = ((req_entries + (GREFS_PER_GRANT_FRAME-1)) / + GREFS_PER_GRANT_FRAME); + if (cur + extra > max_nr_grant_frames()) + return (ENOSPC); + + error = gnttab_map(cur, cur + extra - 1); + if (!error) + error = grow_gnttab_list(extra); + + return (error); +} + +int +gnttab_init(device_t dev) +{ + int i; + unsigned int max_nr_glist_frames; + unsigned int nr_init_grefs; + + if (!is_running_on_xen()) + return (ENODEV); + + nr_grant_frames = 1; + boot_max_nr_grant_frames = __max_nr_grant_frames(); + + /* Determine the maximum number of frames required for the + * grant reference free list on the current hypervisor. + */ + max_nr_glist_frames = (boot_max_nr_grant_frames * + GREFS_PER_GRANT_FRAME / + (PAGE_SIZE / sizeof(grant_ref_t))); + + gnttab_list = malloc(max_nr_glist_frames * sizeof(grant_ref_t *), + M_DEVBUF, M_NOWAIT); + + if (gnttab_list == NULL) + return (ENOMEM); + + for (i = 0; i < nr_grant_frames; i++) { + gnttab_list[i] = (grant_ref_t *) + malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT); + if (gnttab_list[i] == NULL) + goto ini_nomem; + } + + if (gnttab_resume(dev)) + return (ENODEV); + + nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; + + for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++) + gnttab_entry(i) = i + 1; + + gnttab_entry(nr_init_grefs - 1) = GNTTAB_LIST_END; + gnttab_free_count = nr_init_grefs - NR_RESERVED_ENTRIES; + gnttab_free_head = NR_RESERVED_ENTRIES; + + if (bootverbose) + printf("Grant table initialized\n"); + + return (0); + +ini_nomem: + for (i--; i >= 0; i--) + free(gnttab_list[i], M_DEVBUF); + free(gnttab_list, M_DEVBUF); + return (ENOMEM); + +} + +MTX_SYSINIT(gnttab, &gnttab_list_lock, "GNTTAB LOCK", MTX_DEF); From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 11:35:11 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3285E1F7; Wed, 10 Dec 2014 11:35:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F8C31D9; Wed, 10 Dec 2014 11:35:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBABZAVT026473; Wed, 10 Dec 2014 11:35:10 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBABZAG8026472; Wed, 10 Dec 2014 11:35:10 GMT (envelope-from br@FreeBSD.org) Message-Id: <201412101135.sBABZAG8026472@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 10 Dec 2014 11:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275676 - head/sys/dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 11:35:11 -0000 Author: br Date: Wed Dec 10 11:35:10 2014 New Revision: 275676 URL: https://svnweb.freebsd.org/changeset/base/275676 Log: o Put () for p to avoid unexpected macro expansion o style(9) fix Submitted by: Yonghyeon PYUN Modified: head/sys/dev/mii/micphy.c Modified: head/sys/dev/mii/micphy.c ============================================================================== --- head/sys/dev/mii/micphy.c Wed Dec 10 11:21:52 2014 (r275675) +++ head/sys/dev/mii/micphy.c Wed Dec 10 11:35:10 2014 (r275676) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); #define MII_KSZPHY_RX_DATA_PAD_SKEW 0x105 #define MII_KSZPHY_TX_DATA_PAD_SKEW 0x106 -#define PS_TO_REG(p) (p / 200) +#define PS_TO_REG(p) ((p) / 200) static int micphy_probe(device_t); static int micphy_attach(device_t); @@ -104,7 +104,8 @@ static const struct mii_phy_funcs micphy mii_phy_reset }; -static void micphy_write(struct mii_softc *sc, uint32_t reg, uint32_t val) +static void +micphy_write(struct mii_softc *sc, uint32_t reg, uint32_t val) { PHY_WRITE(sc, MII_KSZPHY_EXTREG, KSZPHY_EXTREG_WRITE | reg); From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 11:35:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4649E337; Wed, 10 Dec 2014 11:35:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31FD91E0; Wed, 10 Dec 2014 11:35:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBABZhf2026591; Wed, 10 Dec 2014 11:35:43 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBABZgS3026588; Wed, 10 Dec 2014 11:35:42 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201412101135.sBABZgS3026588@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 10 Dec 2014 11:35:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275677 - in head/sys: dev/xen/grant_table x86/xen xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 11:35:43 -0000 Author: royger Date: Wed Dec 10 11:35:41 2014 New Revision: 275677 URL: https://svnweb.freebsd.org/changeset/base/275677 Log: xen: convert the Grant-table code to a NewBus device This allows the Grant-table code to attach directly to the xenpv bus, allowing us to remove the grant-table initialization done in xenpv. Sponsored by: Citrix Systems R&D Modified: head/sys/dev/xen/grant_table/grant_table.c head/sys/x86/xen/xenpv.c head/sys/xen/gnttab.h Modified: head/sys/dev/xen/grant_table/grant_table.c ============================================================================== --- head/sys/dev/xen/grant_table/grant_table.c Wed Dec 10 11:35:10 2014 (r275676) +++ head/sys/dev/xen/grant_table/grant_table.c Wed Dec 10 11:35:41 2014 (r275677) @@ -659,16 +659,59 @@ gnttab_expand(unsigned int req_entries) return (error); } -int -gnttab_init(device_t dev) +MTX_SYSINIT(gnttab, &gnttab_list_lock, "GNTTAB LOCK", MTX_DEF); + +/*------------------ Private Device Attachment Functions --------------------*/ +/** + * \brief Identify instances of this device type in the system. + * + * \param driver The driver performing this identify action. + * \param parent The NewBus parent device for any devices this method adds. + */ +static void +granttable_identify(driver_t *driver __unused, device_t parent) +{ + + KASSERT(xen_domain(), + ("Trying to attach grant-table device on non Xen domain")); + /* + * A single device instance for our driver is always present + * in a system operating under Xen. + */ + if (BUS_ADD_CHILD(parent, 0, driver->name, 0) == NULL) + panic("unable to attach Xen Grant-table device"); +} + +/** + * \brief Probe for the existence of the Xen Grant-table device + * + * \param dev NewBus device_t for this instance. + * + * \return Always returns 0 indicating success. + */ +static int +granttable_probe(device_t dev) +{ + + device_set_desc(dev, "Xen Grant-table Device"); + return (BUS_PROBE_NOWILDCARD); +} + +/** + * \brief Attach the Xen Grant-table device. + * + * \param dev NewBus device_t for this instance. + * + * \return On success, 0. Otherwise an errno value indicating the + * type of failure. + */ +static int +granttable_attach(device_t dev) { int i; unsigned int max_nr_glist_frames; unsigned int nr_init_grefs; - if (!is_running_on_xen()) - return (ENODEV); - nr_grant_frames = 1; boot_max_nr_grant_frames = __max_nr_grant_frames(); @@ -714,7 +757,20 @@ ini_nomem: free(gnttab_list[i], M_DEVBUF); free(gnttab_list, M_DEVBUF); return (ENOMEM); - } -MTX_SYSINIT(gnttab, &gnttab_list_lock, "GNTTAB LOCK", MTX_DEF); +/*-------------------- Private Device Attachment Data -----------------------*/ +static device_method_t granttable_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, granttable_identify), + DEVMETHOD(device_probe, granttable_probe), + DEVMETHOD(device_attach, granttable_attach), + + DEVMETHOD_END +}; + +DEFINE_CLASS_0(granttable, granttable_driver, granttable_methods, 0); +devclass_t granttable_devclass; + +DRIVER_MODULE_ORDERED(granttable, xenpv, granttable_driver, granttable_devclass, + NULL, NULL, SI_ORDER_FIRST); Modified: head/sys/x86/xen/xenpv.c ============================================================================== --- head/sys/x86/xen/xenpv.c Wed Dec 10 11:35:10 2014 (r275676) +++ head/sys/x86/xen/xenpv.c Wed Dec 10 11:35:41 2014 (r275677) @@ -66,15 +66,6 @@ static int xenpv_attach(device_t dev) { device_t child; - int error; - - /* Initialize grant table before any Xen specific device is attached */ - error = gnttab_init(dev); - if (error != 0) { - device_printf(dev, "error initializing grant table: %d\n", - error); - return (error); - } /* * Let our child drivers identify any child devices that they Modified: head/sys/xen/gnttab.h ============================================================================== --- head/sys/xen/gnttab.h Wed Dec 10 11:35:10 2014 (r275676) +++ head/sys/xen/gnttab.h Wed Dec 10 11:35:41 2014 (r275677) @@ -51,8 +51,6 @@ struct gnttab_free_callback { uint16_t count; }; -int gnttab_init(device_t); - /* * Allocate a grant table reference and return it in *result. Returns * zero on success or errno on error. From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 11:42:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 46F82620; Wed, 10 Dec 2014 11:42:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B31A2F0; Wed, 10 Dec 2014 11:42:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBABg28b031092; Wed, 10 Dec 2014 11:42:02 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBABg2Id031091; Wed, 10 Dec 2014 11:42:02 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201412101142.sBABg2Id031091@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 10 Dec 2014 11:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275678 - head/sys/x86/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 11:42:03 -0000 Author: royger Date: Wed Dec 10 11:42:02 2014 New Revision: 275678 URL: https://svnweb.freebsd.org/changeset/base/275678 Log: xen: mask event channels while binding them to a vCPU Mask the event channel source before trying to bind it to a CPU, this prevents stray interrupts from firing while assigning them and hitting the KASSERT in xen_intr_handle_upcall. Sponsored by: Citrix Systems R&D Modified: head/sys/x86/xen/xen_intr.c Modified: head/sys/x86/xen/xen_intr.c ============================================================================== --- head/sys/x86/xen/xen_intr.c Wed Dec 10 11:35:41 2014 (r275677) +++ head/sys/x86/xen/xen_intr.c Wed Dec 10 11:42:02 2014 (r275678) @@ -851,7 +851,7 @@ xen_intr_assign_cpu(struct intsrc *base_ struct evtchn_bind_vcpu bind_vcpu; struct xenisrc *isrc; u_int to_cpu, vcpu_id; - int error; + int error, masked; #ifdef XENHVM if (xen_vector_callback_enabled == 0) @@ -869,6 +869,11 @@ xen_intr_assign_cpu(struct intsrc *base_ return (EINVAL); } + /* + * Mask the event channel while binding it to prevent interrupt + * delivery with an inconsistent state in isrc->xi_cpu. + */ + masked = evtchn_test_and_set_mask(isrc->xi_port); if ((isrc->xi_type == EVTCHN_TYPE_VIRQ) || (isrc->xi_type == EVTCHN_TYPE_IPI)) { /* @@ -879,29 +884,25 @@ xen_intr_assign_cpu(struct intsrc *base_ evtchn_cpu_mask_port(isrc->xi_cpu, isrc->xi_port); isrc->xi_cpu = to_cpu; evtchn_cpu_unmask_port(isrc->xi_cpu, isrc->xi_port); - mtx_unlock(&xen_intr_isrc_lock); - return (0); + goto out; } bind_vcpu.port = isrc->xi_port; bind_vcpu.vcpu = vcpu_id; - /* - * Allow interrupts to be fielded on the new VCPU before - * we ask the hypervisor to deliver them there. - */ - evtchn_cpu_unmask_port(to_cpu, isrc->xi_port); error = HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu); if (isrc->xi_cpu != to_cpu) { if (error == 0) { /* Commit to new binding by removing the old one. */ evtchn_cpu_mask_port(isrc->xi_cpu, isrc->xi_port); isrc->xi_cpu = to_cpu; - } else { - /* Roll-back to previous binding. */ - evtchn_cpu_mask_port(to_cpu, isrc->xi_port); + evtchn_cpu_unmask_port(isrc->xi_cpu, isrc->xi_port); } } + +out: + if (masked == 0) + evtchn_unmask_port(isrc->xi_port); mtx_unlock(&xen_intr_isrc_lock); return (0); #else From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 13:25:22 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7B2E27A; Wed, 10 Dec 2014 13:25:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93D0F7F; Wed, 10 Dec 2014 13:25:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBADPMTn081974; Wed, 10 Dec 2014 13:25:22 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBADPMgZ081973; Wed, 10 Dec 2014 13:25:22 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201412101325.sBADPMgZ081973@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 10 Dec 2014 13:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275679 - head/sys/x86/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 13:25:22 -0000 Author: royger Date: Wed Dec 10 13:25:21 2014 New Revision: 275679 URL: https://svnweb.freebsd.org/changeset/base/275679 Log: xen/intr: balance dynamic interrupts across available vCPUs By default Xen binds all event channels to vCPU#0, and FreeBSD only shuffles the interrupt sources once, at the end of the boot process. Since new event channels might be created after this point (because new devices or backends are added), try to automatically shuffle them at creation time. This does not affect VIRQ or IPI event channels, that are already bound to a specific vCPU as requested by the caller. Sponsored by: Citrix Systems R&D Modified: head/sys/x86/xen/xen_intr.c Modified: head/sys/x86/xen/xen_intr.c ============================================================================== --- head/sys/x86/xen/xen_intr.c Wed Dec 10 11:42:02 2014 (r275678) +++ head/sys/x86/xen/xen_intr.c Wed Dec 10 13:25:21 2014 (r275679) @@ -425,6 +425,17 @@ xen_intr_bind_isrc(struct xenisrc **isrc /* Assign the opaque handler (the event channel port) */ *port_handlep = &isrc->xi_port; +#ifdef SMP + if (type == EVTCHN_TYPE_PORT) { + /* + * By default all interrupts are assigned to vCPU#0 + * unless specified otherwise, so shuffle them to balance + * the interrupt load. + */ + xen_intr_assign_cpu(&isrc->xi_intsrc, intr_next_cpu()); + } +#endif + if (filter == NULL && handler == NULL) { /* * No filter/handler provided, leave the event channel From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 14:14:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD354455; Wed, 10 Dec 2014 14:14:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B73F2878; Wed, 10 Dec 2014 14:14:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAEEKxt007384; Wed, 10 Dec 2014 14:14:20 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAEEHdk007363; Wed, 10 Dec 2014 14:14:17 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201412101414.sBAEEHdk007363@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 10 Dec 2014 14:14:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275680 - in head: contrib/file/doc sbin/mount usr.sbin usr.sbin/fstyp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 14:14:20 -0000 Author: trasz Date: Wed Dec 10 14:14:16 2014 New Revision: 275680 URL: https://svnweb.freebsd.org/changeset/base/275680 Log: Add fstyp(8). This utility, named after its SVR4 counterpart, detects filesystems. It differs from file(1) in that it gives machine-parseable output, it outputs filesystem labels, doesn't get confused by other formats metadata, and runs in Capsicum sandbox. Differential Revision: https://reviews.freebsd.org/D1255 Relnotes: yes Sponsored by: The FreeBSD Foundation Added: head/usr.sbin/fstyp/ head/usr.sbin/fstyp/Makefile (contents, props changed) head/usr.sbin/fstyp/cd9660.c (contents, props changed) head/usr.sbin/fstyp/ext2fs.c (contents, props changed) head/usr.sbin/fstyp/fstyp.8 (contents, props changed) head/usr.sbin/fstyp/fstyp.c (contents, props changed) head/usr.sbin/fstyp/fstyp.h (contents, props changed) head/usr.sbin/fstyp/msdosfs.c (contents, props changed) head/usr.sbin/fstyp/msdosfs.h (contents, props changed) head/usr.sbin/fstyp/ntfs.c (contents, props changed) head/usr.sbin/fstyp/ufs.c (contents, props changed) Modified: head/contrib/file/doc/file.man head/sbin/mount/mount.8 head/usr.sbin/Makefile Modified: head/contrib/file/doc/file.man ============================================================================== --- head/contrib/file/doc/file.man Wed Dec 10 13:25:21 2014 (r275679) +++ head/contrib/file/doc/file.man Wed Dec 10 14:14:16 2014 (r275680) @@ -1,5 +1,5 @@ .\" $File: file.man,v 1.106 2014/03/07 23:11:51 christos Exp $ -.Dd January 30, 2014 +.Dd December 3, 2014 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -385,6 +385,7 @@ options. .Xr hexdump 1 , .Xr od 1 , .Xr strings 1 , +.Xr fstyp 8 .Sh STANDARDS CONFORMANCE This program is believed to exceed the System V Interface Definition of FILE(CMD), as near as one can determine from the vague language Modified: head/sbin/mount/mount.8 ============================================================================== --- head/sbin/mount/mount.8 Wed Dec 10 13:25:21 2014 (r275679) +++ head/sbin/mount/mount.8 Wed Dec 10 14:14:16 2014 (r275680) @@ -28,7 +28,7 @@ .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" $FreeBSD$ .\" -.Dd November 22, 2014 +.Dd December 3, 2014 .Dt MOUNT 8 .Os .Sh NAME @@ -549,6 +549,7 @@ support for a particular file system mig .Xr fstab 5 , .Xr procfs 5 , .Xr automount 8 , +.Xr fstyp 8 , .Xr kldload 8 , .Xr mount_cd9660 8 , .Xr mount_msdosfs 8 , Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Wed Dec 10 13:25:21 2014 (r275679) +++ head/usr.sbin/Makefile Wed Dec 10 14:14:16 2014 (r275680) @@ -29,6 +29,7 @@ SUBDIR= adduser \ extattr \ extattrctl \ fifolog \ + fstyp \ fwcontrol \ getfmac \ getpmac \ Added: head/usr.sbin/fstyp/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/Makefile Wed Dec 10 14:14:16 2014 (r275680) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG= fstyp +SRCS= fstyp.c ext2fs.c cd9660.c msdosfs.c ntfs.c ufs.c +MAN= fstyp.8 + +WARNS= 6 + +.include Added: head/usr.sbin/fstyp/cd9660.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/cd9660.c Wed Dec 10 14:14:16 2014 (r275680) @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 2004 Pawel Jakub Dawidek + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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 AUTHORS 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 AUTHORS 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include "fstyp.h" + +#define G_LABEL_ISO9660_DIR "iso9660" + +#define ISO9660_MAGIC "\x01" "CD001" "\x01\x00" +#define ISO9660_OFFSET 0x8000 +#define VOLUME_LEN 32 + +int +fstyp_cd9660(FILE *fp, char *label, size_t size) +{ + char *sector, *volume; + int i; + + sector = read_buf(fp, ISO9660_OFFSET, 512); + if (sector == NULL) + return (1); + if (bcmp(sector, ISO9660_MAGIC, sizeof(ISO9660_MAGIC) - 1) != 0) { + free(sector); + return (1); + } + volume = sector + 0x28; + bzero(label, size); + strlcpy(label, volume, MIN(size, VOLUME_LEN)); + free(sector); + for (i = size - 1; i > 0; i--) { + if (label[i] == '\0') + continue; + else if (label[i] == ' ') + label[i] = '\0'; + else + break; + } + return (0); +} Added: head/usr.sbin/fstyp/ext2fs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/ext2fs.c Wed Dec 10 14:14:16 2014 (r275680) @@ -0,0 +1,90 @@ +/*- + * Copyright (c) 2005 Stanislav Sedov + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include "fstyp.h" + +#define EXT2FS_SB_OFFSET 1024 +#define EXT2_SUPER_MAGIC 0xef53 +#define EXT2_DYNAMIC_REV 1 + +typedef struct e2sb { + uint8_t fake1[56]; + uint16_t s_magic; + uint8_t fake2[18]; + uint32_t s_rev_level; + uint8_t fake3[40]; + char s_volume_name[16]; +} e2sb_t; + +int +fstyp_ext2fs(FILE *fp, char *label, size_t size) +{ + e2sb_t *fs; + char *s_volume_name; + + fs = (e2sb_t *)read_buf(fp, EXT2FS_SB_OFFSET, 512); + if (fs == NULL) + return (1); + + /* Check for magic and versio n*/ + if (fs->s_magic == EXT2_SUPER_MAGIC && + fs->s_rev_level == EXT2_DYNAMIC_REV) { + //G_LABEL_DEBUG(1, "ext2fs file system detected on %s.", + // pp->name); + } else { + free(fs); + return (1); + } + + s_volume_name = fs->s_volume_name; + /* Terminate label */ + s_volume_name[sizeof(fs->s_volume_name) - 1] = '\0'; + + if (s_volume_name[0] == '/') + s_volume_name += 1; + + /* Check for volume label */ + if (s_volume_name[0] == '\0') { + free(fs); + return (1); + } + + strlcpy(label, s_volume_name, size); + + return (0); +} Added: head/usr.sbin/fstyp/fstyp.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/fstyp.8 Wed Dec 10 14:14:16 2014 (r275680) @@ -0,0 +1,97 @@ +.\" Copyright (c) 2014 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This software was developed by Edward Tomasz Napierala under sponsorship +.\" from the FreeBSD Foundation. +.\" +.\" 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 AUTHORS 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 AUTHORS 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 December 6, 2014 +.Dt FSTYP 8 +.Os +.Sh NAME +.Nm fstyp +.Nd determine filesystem type +.Sh SYNOPSIS +.Nm +.Op Fl l +.Op Fl s +.Ar special +.Sh DESCRIPTION +The +.Nm +utility is used to determine the filesystem type on a given device. +It can recognize ISO-9660, Ext2, FAT, NTFS, and UFS filesystems. +The filesystem name is printed to the standard output +as, respectively, +.Li cd9660 , +.Li ext2fs , +.Li msdosfs , +.Li ntfs , +or +.Li ufs . +.Pp +Because +.Nm +is built specifically to detect filesystem types, it differs from +.Xr file 1 +in several ways. +The output is machine-parsable, filesystem labels are supported, +and only filesystems are identified. +Security is improved with +.Xr capsicum 4 . +.Pp +These options are available: +.Bl -tag -width ".Fl l" +.It Fl l +In addition to filesystem type, print filesystem label if available. +.It Fl s +Ignore file type. +By default, +.Nm +only works on regular files and disk-like device nodes. +Trying to read other file types might have unexpected consequences or hang +indefinitely. +.El +.Sh EXIT STATUS +The +.Nm +utility exits 0 on success, and >0 if an error occurs or the filesystem +type is not recognized. +.Sh SEE ALSO +.Xr file 1 , +.Xr capsicum 4 , +.Xr glabel 8 , +.Xr mount 8 +.Sh HISTORY +The +.Nm +command appeared in +.Fx 11.0 . +.Sh AUTHORS +The +.Nm +utility was developed by +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org +under sponsorship from the FreeBSD Foundation. Added: head/usr.sbin/fstyp/fstyp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/fstyp.c Wed Dec 10 14:14:16 2014 (r275680) @@ -0,0 +1,210 @@ +/*- + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fstyp.h" + +#define LABEL_LEN 256 + +typedef int (*fstyp_function)(FILE *, char *, size_t); + +static struct { + const char *name; + fstyp_function function; +} fstypes[] = { + { "cd9660", &fstyp_cd9660 }, + { "ext2fs", &fstyp_ext2fs }, + { "msdosfs", &fstyp_msdosfs }, + { "ntfs", &fstyp_ntfs }, + { "ufs", &fstyp_ufs }, + { NULL, NULL } +}; + +void * +read_buf(FILE *fp, off_t off, size_t len) +{ + int error; + size_t nread; + void *buf; + + error = fseek(fp, off, SEEK_SET); + if (error != 0) { + warn("cannot seek to %jd", (uintmax_t)off); + return (NULL); + } + + buf = malloc(len); + if (buf == 0) { + warn("cannot malloc %zd bytes of memory", len); + return (NULL); + } + + nread = fread(buf, len, 1, fp); + if (nread != 1) { + free(buf); + if (feof(fp) == 0) + warn("fread"); + return (NULL); + } + + return (buf); +} + +char * +checked_strdup(const char *s) +{ + char *c; + + c = strdup(s); + if (c == NULL) + err(1, "strdup"); + return (c); +} + +static void +usage(void) +{ + + fprintf(stderr, "usage: fstyp [-l][-s] special\n"); + exit(1); +} + +static void +type_check(const char *path, FILE *fp) +{ + int error, fd; + off_t mediasize; + struct stat sb; + + fd = fileno(fp); + + error = fstat(fd, &sb); + if (error != 0) + err(1, "%s: fstat", path); + + if (S_ISREG(sb.st_mode)) + return; + + error = ioctl(fd, DIOCGMEDIASIZE, &mediasize); + if (error != 0) + errx(1, "%s: not a disk", path); +} + +int +main(int argc, char **argv) +{ + int ch, error, i, nbytes; + bool ignore_type = false, show_label = false; + char label[LABEL_LEN + 1], strvised[LABEL_LEN * 4 + 1]; + char *path; + FILE *fp; + fstyp_function fstyp_f; + + while ((ch = getopt(argc, argv, "ls")) != -1) { + switch (ch) { + case 'l': + show_label = true; + break; + case 's': + ignore_type = true; + break; + default: + usage(); + } + } + + argc -= optind; + argv += optind; + if (argc != 1) + usage(); + + path = argv[0]; + + fp = fopen(path, "r"); + if (fp == NULL) + err(1, "%s", path); + + error = cap_enter(); + if (error != 0 && errno != ENOSYS) + err(1, "cap_enter"); + + if (ignore_type == false) + type_check(path, fp); + + memset(label, '\0', sizeof(label)); + + for (i = 0;; i++) { + fstyp_f = fstypes[i].function; + if (fstyp_f == NULL) + break; + + error = fstyp_f(fp, label, sizeof(label)); + if (error == 0) + break; + } + + if (fstypes[i].name == NULL) { + warnx("%s: filesystem not recognized", path); + return (1); + } + + if (show_label && label[0] != '\0') { + /* + * XXX: I'd prefer VIS_HTTPSTYLE, but it unconditionally + * encodes spaces. + */ + nbytes = strsnvis(strvised, sizeof(strvised), label, + VIS_GLOB | VIS_NL, "\"'$"); + if (nbytes == -1) + err(1, "strsnvis"); + + printf("%s %s\n", fstypes[i].name, strvised); + } else { + printf("%s\n", fstypes[i].name); + } + + return (0); +} Added: head/usr.sbin/fstyp/fstyp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/fstyp.h Wed Dec 10 14:14:16 2014 (r275680) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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$ + */ + +#ifndef FSTYP_H +#define FSTYP_H + +#define MIN(a,b) (((a)<(b))?(a):(b)) + +void *read_buf(FILE *fp, off_t off, size_t len); +char *checked_strdup(const char *s); + +int fstyp_cd9660(FILE *fp, char *label, size_t size); +int fstyp_ext2fs(FILE *fp, char *label, size_t size); +int fstyp_msdosfs(FILE *fp, char *label, size_t size); +int fstyp_ntfs(FILE *fp, char *label, size_t size); +int fstyp_ufs(FILE *fp, char *label, size_t size); + +#endif /* !FSTYP_H */ Added: head/usr.sbin/fstyp/msdosfs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/msdosfs.c Wed Dec 10 14:14:16 2014 (r275680) @@ -0,0 +1,183 @@ +/*- + * Copyright (c) 2004 Pawel Jakub Dawidek + * Copyright (c) 2006 Tobias Reifenberger + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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 AUTHORS 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 AUTHORS 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include "fstyp.h" +#include "msdosfs.h" + +#define LABEL_NO_NAME "NO NAME " + +int +fstyp_msdosfs(FILE *fp, char *label, size_t size) +{ + FAT_BSBPB *pfat_bsbpb; + FAT32_BSBPB *pfat32_bsbpb; + FAT_DES *pfat_entry; + uint8_t *sector0, *sector; + uint32_t i; + + sector0 = NULL; + sector = NULL; + + /* Load 1st sector with boot sector and boot parameter block. */ + sector0 = (uint8_t *)read_buf(fp, 0, 512); + if (sector0 == NULL) + return (1); + + /* Check for the FAT boot sector signature. */ + if (sector0[510] != 0x55 || sector0[511] != 0xaa) { + goto error; + } + + /* + * Test if this is really a FAT volume and determine the FAT type. + */ + + pfat_bsbpb = (FAT_BSBPB *)sector0; + pfat32_bsbpb = (FAT32_BSBPB *)sector0; + + if (UINT16BYTES(pfat_bsbpb->BPB_FATSz16) != 0) { + /* + * If the BPB_FATSz16 field is not zero and the string "FAT" is + * at the right place, this should be a FAT12 or FAT16 volume. + */ + if (strncmp(pfat_bsbpb->BS_FilSysType, "FAT", 3) != 0) { + goto error; + } + + /* A volume with no name should have "NO NAME " as label. */ + if (strncmp(pfat_bsbpb->BS_VolLab, LABEL_NO_NAME, + sizeof(pfat_bsbpb->BS_VolLab)) == 0) { + goto endofchecks; + } + strlcpy(label, pfat_bsbpb->BS_VolLab, + MIN(size, sizeof(pfat_bsbpb->BS_VolLab) + 1)); + } else if (UINT32BYTES(pfat32_bsbpb->BPB_FATSz32) != 0) { + uint32_t fat_FirstDataSector, fat_BytesPerSector, offset; + + /* + * If the BPB_FATSz32 field is not zero and the string "FAT" is + * at the right place, this should be a FAT32 volume. + */ + if (strncmp(pfat32_bsbpb->BS_FilSysType, "FAT", 3) != 0) { + goto error; + } + + /* + * If the volume label is not "NO NAME " we're done. + */ + if (strncmp(pfat32_bsbpb->BS_VolLab, LABEL_NO_NAME, + sizeof(pfat32_bsbpb->BS_VolLab)) != 0) { + strlcpy(label, pfat32_bsbpb->BS_VolLab, + MIN(size, sizeof(pfat32_bsbpb->BS_VolLab) + 1)); + goto endofchecks; + } + + /* + * If the volume label "NO NAME " is in the boot sector, the + * label of FAT32 volumes may be stored as a special entry in + * the root directory. + */ + fat_FirstDataSector = + UINT16BYTES(pfat32_bsbpb->BPB_RsvdSecCnt) + + (pfat32_bsbpb->BPB_NumFATs * + UINT32BYTES(pfat32_bsbpb->BPB_FATSz32)); + fat_BytesPerSector = UINT16BYTES(pfat32_bsbpb->BPB_BytsPerSec); + + // fat_FirstDataSector, fat_BytesPerSector); + + for (offset = fat_BytesPerSector * fat_FirstDataSector;; + offset += fat_BytesPerSector) { + sector = (uint8_t *)read_buf(fp, offset, fat_BytesPerSector); + if (sector == NULL) + goto error; + + pfat_entry = (FAT_DES *)sector; + do { + /* No more entries available. */ + if (pfat_entry->DIR_Name[0] == 0) { + goto endofchecks; + } + + /* Skip empty or long name entries. */ + if (pfat_entry->DIR_Name[0] == 0xe5 || + (pfat_entry->DIR_Attr & + FAT_DES_ATTR_LONG_NAME) == + FAT_DES_ATTR_LONG_NAME) { + continue; + } + + /* + * The name of the entry is the volume label if + * ATTR_VOLUME_ID is set. + */ + if (pfat_entry->DIR_Attr & + FAT_DES_ATTR_VOLUME_ID) { + strlcpy(label, pfat_entry->DIR_Name, + MIN(size, + sizeof(pfat_entry->DIR_Name) + 1)); + goto endofchecks; + } + } while((uint8_t *)(++pfat_entry) < + (uint8_t *)(sector + fat_BytesPerSector)); + free(sector); + } + } else { + goto error; + } + +endofchecks: + for (i = size - 1; i > 0; i--) { + if (label[i] == '\0') + continue; + else if (label[i] == ' ') + label[i] = '\0'; + else + break; + } + + free(sector0); + free(sector); + + return (0); + +error: + free(sector0); + free(sector); + + return (1); +} Added: head/usr.sbin/fstyp/msdosfs.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/msdosfs.h Wed Dec 10 14:14:16 2014 (r275680) @@ -0,0 +1,140 @@ +/*- + * Copyright (c) 2006 Tobias Reifenberger + * 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +/* + * Conversion macros for little endian encoded unsigned integers + * in byte streams to the local unsigned integer format. + */ +#define UINT16BYTES(p) ((uint32_t)((p)[0] + (256*(p)[1]))) +#define UINT32BYTES(p) ((uint32_t)((p)[0] + (256*(p)[1]) + \ + (65536*(p)[2]) + (16777216*(p)[3]))) + +/* + * All following structures are according to: + * + * Microsoft Extensible Firmware Initiative FAT32 File System Specification + * FAT: General Overview of On-Disk Format + * Version 1.03, December 6, 2000 + * Microsoft Corporation + */ + +/* + * FAT boot sector and boot parameter block for + * FAT12 and FAT16 volumes + */ +typedef struct fat_bsbpb { + /* common fields */ + uint8_t BS_jmpBoot[3]; + uint8_t BS_OEMName[8]; + uint8_t BPB_BytsPerSec[2]; + uint8_t BPB_SecPerClus; + uint8_t BPB_RsvdSecCnt[2]; + uint8_t BPB_NumFATs; + uint8_t BPB_RootEntCnt[2]; + uint8_t BPB_TotSec16[2]; + uint8_t BPB_Media; + uint8_t BPB_FATSz16[2]; + uint8_t BPB_SecPerTrack[2]; + uint8_t BPB_NumHeads[2]; + uint8_t BPB_HiddSec[4]; + uint8_t BPB_TotSec32[4]; + /* FAT12/FAT16 only fields */ + uint8_t BS_DrvNum; + uint8_t BS_Reserved1; + uint8_t BS_BootSig; + uint8_t BS_VolID[4]; + uint8_t BS_VolLab[11]; + uint8_t BS_FilSysType[8]; +} FAT_BSBPB; /* 62 bytes */ + +/* + * FAT boot sector and boot parameter block for + * FAT32 volumes + */ +typedef struct fat32_bsbpb { + /* common fields */ + uint8_t BS_jmpBoot[3]; + uint8_t BS_OEMName[8]; + uint8_t BPB_BytsPerSec[2]; + uint8_t BPB_SecPerClus; + uint8_t BPB_RsvdSecCnt[2]; + uint8_t BPB_NumFATs; + uint8_t BPB_RootEntCnt[2]; + uint8_t BPB_TotSec16[2]; + uint8_t BPB_Media; + uint8_t BPB_FATSz16[2]; + uint8_t BPB_SecPerTrack[2]; + uint8_t BPB_NumHeads[2]; + uint8_t BPB_HiddSec[4]; + uint8_t BPB_TotSec32[4]; + /* FAT32 only fields */ + uint8_t BPB_FATSz32[4]; + uint8_t BPB_ExtFlags[2]; + uint8_t BPB_FSVer[2]; + uint8_t BPB_RootClus[4]; + uint8_t BPB_FSInfo[2]; + uint8_t BPB_BkBootSec[2]; + uint8_t BPB_Reserved[12]; + uint8_t BS_DrvNum; + uint8_t BS_Reserved1; + uint8_t BS_BootSig; + uint8_t BS_VolID[4]; + uint8_t BS_VolLab[11]; + uint8_t BS_FilSysType[8]; +} FAT32_BSBPB; /* 90 bytes */ + +/* + * FAT directory entry structure + */ +#define FAT_DES_ATTR_READ_ONLY 0x01 +#define FAT_DES_ATTR_HIDDEN 0x02 +#define FAT_DES_ATTR_SYSTEM 0x04 +#define FAT_DES_ATTR_VOLUME_ID 0x08 +#define FAT_DES_ATTR_DIRECTORY 0x10 +#define FAT_DES_ATTR_ARCHIVE 0x20 +#define FAT_DES_ATTR_LONG_NAME (FAT_DES_ATTR_READ_ONLY | \ + FAT_DES_ATTR_HIDDEN | \ + FAT_DES_ATTR_SYSTEM | \ + FAT_DES_ATTR_VOLUME_ID) + +typedef struct fat_des { + uint8_t DIR_Name[11]; + uint8_t DIR_Attr; + uint8_t DIR_NTRes; + uint8_t DIR_CrtTimeTenth; + uint8_t DIR_CrtTime[2]; + uint8_t DIR_CrtDate[2]; + uint8_t DIR_LstAccDate[2]; + uint8_t DIR_FstClusHI[2]; + uint8_t DIR_WrtTime[2]; + uint8_t DIR_WrtDate[2]; + uint8_t DIR_FstClusLO[2]; + uint8_t DIR_FileSize[4]; +} FAT_DES; Added: head/usr.sbin/fstyp/ntfs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/fstyp/ntfs.c Wed Dec 10 14:14:16 2014 (r275680) @@ -0,0 +1,165 @@ +/*- + * Copyright (c) 2005 Takanori Watanabe + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include "fstyp.h" + +#define NTFS_A_VOLUMENAME 0x60 +#define NTFS_FILEMAGIC ((uint32_t)(0x454C4946)) +#define NTFS_VOLUMEINO 3 + +#define G_LABEL_NTFS_DIR "ntfs" + +struct ntfs_attr { + uint32_t a_type; + uint32_t reclen; + uint8_t a_flag; + uint8_t a_namelen; + uint8_t a_nameoff; + uint8_t reserved1; + uint8_t a_compression; + uint8_t reserved2; + uint16_t a_index; + uint16_t a_datalen; + uint16_t reserved3; + uint16_t a_dataoff; + uint16_t a_indexed; +} __packed; + +struct ntfs_filerec { + uint32_t fr_hdrmagic; + uint16_t fr_hdrfoff; + uint16_t fr_hdrfnum; + uint8_t reserved[8]; + uint16_t fr_seqnum; + uint16_t fr_nlink; + uint16_t fr_attroff; + uint16_t fr_flags; + uint32_t fr_size; + uint32_t fr_allocated; + uint64_t fr_mainrec; + uint16_t fr_attrnum; +} __packed; + +struct ntfs_bootfile { + uint8_t reserved1[3]; + uint8_t bf_sysid[8]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 14:36:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 689ACCE3; Wed, 10 Dec 2014 14:36:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53E12ACE; Wed, 10 Dec 2014 14:36:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAEakJ3017900; Wed, 10 Dec 2014 14:36:46 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAEajZc017892; Wed, 10 Dec 2014 14:36:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201412101436.sBAEajZc017892@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 10 Dec 2014 14:36:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275681 - in head: etc etc/autofs usr.sbin/autofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 14:36:46 -0000 Author: trasz Date: Wed Dec 10 14:36:44 2014 New Revision: 275681 URL: https://svnweb.freebsd.org/changeset/base/275681 Log: Add "-media" autofs map, to access data on removable media, such as CD drives or flash keys. It can be enabled by uncommenting a single entry in default /etc/auto_master. It can also be easily modified to use fuse-based filesystems instead of in-kernel ones. There is still one deficiency - the mountpoints are permanent, they don't disappear when user removes the media. Fixing it needs some autofs changes. Differential Revision: https://reviews.freebsd.org/D1210 MFC after: 1 month Sponsored by: The FreeBSD Foundation Added: head/etc/autofs/special_media (contents, props changed) Modified: head/etc/auto_master head/etc/autofs/Makefile head/etc/devd.conf head/usr.sbin/autofs/auto_master.5 Modified: head/etc/auto_master ============================================================================== --- head/etc/auto_master Wed Dec 10 14:14:16 2014 (r275680) +++ head/etc/auto_master Wed Dec 10 14:36:44 2014 (r275681) @@ -3,3 +3,6 @@ # Automounter master map, see auto_master(5) for details. # /net -hosts -nobrowse,nosuid +# When using the -media special map, make sure to edit devd.conf(5) +# to move the call to "automount -c" out of the comments section. +#/media -media -nosuid Modified: head/etc/autofs/Makefile ============================================================================== --- head/etc/autofs/Makefile Wed Dec 10 14:14:16 2014 (r275680) +++ head/etc/autofs/Makefile Wed Dec 10 14:36:44 2014 (r275681) @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= include_ldap special_hosts special_null +FILES= include_ldap special_hosts special_media special_null NO_OBJ= FILESDIR= /etc/autofs Added: head/etc/autofs/special_media ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/autofs/special_media Wed Dec 10 14:36:44 2014 (r275681) @@ -0,0 +1,93 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# Print newline-separated list of devices available for mounting. +# If there is a filesystem label - use it, otherwise use device name. +print_available() { + local _fstype _fstype_and_label _label _p + + for _p in ${providers}; do + _fstype_and_label="$(fstyp -l "/dev/${_p}" 2> /dev/null)" + if [ $? -ne 0 ]; then + # Ignore devices for which we were unable + # to determine filesystem type. + continue + fi + + _fstype="${_fstype_and_label%% *}" + if [ "${_fstype}" != "${_fstype_and_label}" ]; then + _label="${_fstype_and_label#* }" + echo "${_label}" + continue + fi + + echo "${_p}" + done +} + +# Print a single map entry. +print_one() { + local _fstype _fstype_and_label _label _key _p + + _key="$1" + + _fstype="$(fstyp "/dev/${_key}" 2> /dev/null)" + if [ $? -eq 0 ]; then + echo "-fstype=${_fstype},nosuid :/dev/${_key}" + return + fi + + for _p in ${providers}; do + _fstype_and_label="$(fstyp -l "/dev/${_p}" 2> /dev/null)" + if [ $? -ne 0 ]; then + # Ignore devices for which we were unable + # to determine filesystem type. + continue + fi + + _fstype="${_fstype_and_label%% *}" + if [ "${_fstype}" = "${_fstype_and_label}" ]; then + # No label, try another device. + continue + fi + + _label="${_fstype_and_label#* }" + if [ "${_label}" != "${_key}" ]; then + # Labels don't match, try another device. + continue + fi + + echo "-fstype=${_fstype},nosuid :/dev/${_p}" + done + + # No matching device - don't print anything, autofs will handle it. +} + +# Obtain a list of (geom-provider-name, access-count) pairs, turning this: +# +# z0xfffff80005085d00 [shape=hexagon,label="ada0\nr2w2e3\nerr#0\nsector=512\nstripe=0"]; +# +# Into this: +# +# ada0 r2w2e3 +# +# XXX: It would be easier to use kern.geom.conftxt instead, but it lacks +# access counts. +pairs=$(sysctl kern.geom.confdot | sed -n 's/^.*hexagon,label="\([^\]*\)\\n\([^\]*\).*/\1 \2/p') + +# Obtain a list of GEOM providers that are not already open - not mounted, +# and without other GEOM class, such as gpart, attached. In other words, +# grep for "r0w0e0". Skip providers with names containing slashes; we're +# not interested in geom_label(4) creations. +providers=$(echo "$pairs" | awk '$2 == "r0w0e0" && $1 !~ /\// { print $1 }') + +if [ $# -eq 0 ]; then + print_available + exit 0 +fi + +print_one "$1" +exit 0 + Modified: head/etc/devd.conf ============================================================================== --- head/etc/devd.conf Wed Dec 10 14:14:16 2014 (r275680) +++ head/etc/devd.conf Wed Dec 10 14:36:44 2014 (r275681) @@ -318,4 +318,16 @@ notify 0 { action "/usr/local/etc/rc.d/postgresql restart"; }; +# Discard autofs caches, useful for the -media special map. The one +# second delay is for GEOM to finish tasting. +# +# XXX: We should probably have a devctl(4) event that fires after GEOM +# tasting. +# +notify 100 { + match "system" "DEVFS"; + match "cdev" "(da|mmcsd)[0-9]+"; + action "sleep 1 && /usr/sbin/automount -c"; +}; + */ Modified: head/usr.sbin/autofs/auto_master.5 ============================================================================== --- head/usr.sbin/autofs/auto_master.5 Wed Dec 10 14:14:16 2014 (r275680) +++ head/usr.sbin/autofs/auto_master.5 Wed Dec 10 14:36:44 2014 (r275681) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 21, 2014 +.Dd November 22, 2014 .Dt AUTO_MASTER 5 .Os .Sh NAME @@ -213,14 +213,17 @@ Supported special maps are: .Pp .Bl -tag -width "-hosts" -compact .It Li -hosts -This map queries the remote NFS server and maps exported volumes. -It is traditionally mounted on +Query the remote NFS server and map exported shares. +This map is traditionally mounted on .Pa /net . -It enables access to files on a remote NFS server by accessing +Access to files on a remote NFS server is provided through the .Pa /net/nfs-server-ip/share-name/ -directory, without the need for any further configuration. +directory without any additional configuration. +.It Li -media +Query devices that are not yet mounted, but contain valid filesystems. +Generally used to access files on removable media. .It Li -null -This map prevents the +Prevent .Xr automountd 8 from mounting anything on the mountpoint. .El From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 14:50:57 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DFB9C9C2; Wed, 10 Dec 2014 14:50:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBF7AC41; Wed, 10 Dec 2014 14:50:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAEovH0024710; Wed, 10 Dec 2014 14:50:57 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAEovva024709; Wed, 10 Dec 2014 14:50:57 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201412101450.sBAEovva024709@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 10 Dec 2014 14:50:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275682 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 14:50:58 -0000 Author: tuexen Date: Wed Dec 10 14:50:57 2014 New Revision: 275682 URL: https://svnweb.freebsd.org/changeset/base/275682 Log: Fix a typo reported by Lennart Grahl. MFC after: 3 days Modified: head/lib/libc/net/sctp_sys_calls.c Modified: head/lib/libc/net/sctp_sys_calls.c ============================================================================== --- head/lib/libc/net/sctp_sys_calls.c Wed Dec 10 14:36:44 2014 (r275681) +++ head/lib/libc/net/sctp_sys_calls.c Wed Dec 10 14:50:57 2014 (r275682) @@ -886,7 +886,7 @@ sctp_recvv(int sd, struct sctp_rcvinfo *rcvinfo; struct sctp_nxtinfo *nxtinfo; - if (((info != NULL) && (infolen == NULL)) | + if (((info != NULL) && (infolen == NULL)) || ((info == NULL) && (infolen != NULL) && (*infolen != 0)) || ((info != NULL) && (infotype == NULL))) { errno = EINVAL; From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 18:13:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 35E5719F; Wed, 10 Dec 2014 18:13:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22647CAF; Wed, 10 Dec 2014 18:13:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAIDF83028956; Wed, 10 Dec 2014 18:13:15 GMT (envelope-from andreast@FreeBSD.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAIDEQ1028955; Wed, 10 Dec 2014 18:13:14 GMT (envelope-from andreast@FreeBSD.org) Message-Id: <201412101813.sBAIDEQ1028955@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andreast set sender to andreast@FreeBSD.org using -f From: Andreas Tobler Date: Wed, 10 Dec 2014 18:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275683 - head/sys/powerpc/aim X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 18:13:15 -0000 Author: andreast Date: Wed Dec 10 18:13:14 2014 New Revision: 275683 URL: https://svnweb.freebsd.org/changeset/base/275683 Log: Fix build for powerpc(32|64) kernels. Modified: head/sys/powerpc/aim/trap.c Modified: head/sys/powerpc/aim/trap.c ============================================================================== --- head/sys/powerpc/aim/trap.c Wed Dec 10 14:50:57 2014 (r275682) +++ head/sys/powerpc/aim/trap.c Wed Dec 10 18:13:14 2014 (r275683) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 18:41:26 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C8225BBD; Wed, 10 Dec 2014 18:41:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B53A651; Wed, 10 Dec 2014 18:41:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAIfQee043000; Wed, 10 Dec 2014 18:41:26 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAIfQGq042999; Wed, 10 Dec 2014 18:41:26 GMT (envelope-from des@FreeBSD.org) Message-Id: <201412101841.sBAIfQGq042999@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Wed, 10 Dec 2014 18:41:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r275684 - releng/10.1/sys/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 18:41:26 -0000 Author: des Date: Wed Dec 10 18:41:25 2014 New Revision: 275684 URL: https://svnweb.freebsd.org/changeset/base/275684 Log: Bump BRANCH (forgotten in r275670) Approved by: so Modified: releng/10.1/sys/conf/newvers.sh Modified: releng/10.1/sys/conf/newvers.sh ============================================================================== --- releng/10.1/sys/conf/newvers.sh Wed Dec 10 18:13:14 2014 (r275683) +++ releng/10.1/sys/conf/newvers.sh Wed Dec 10 18:41:25 2014 (r275684) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.1" -BRANCH="RELEASE" +BRANCH="RELEASE-p1" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 20:17:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43F1460D; Wed, 10 Dec 2014 20:17:41 +0000 (UTC) Received: from aslan.scsiguy.com (mail.scsiguy.com [70.89.174.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D5DFD17; Wed, 10 Dec 2014 20:17:40 +0000 (UTC) Received: from [192.168.6.155] (slboulder.spectralogic.com [192.30.190.3] (may be forged)) (authenticated bits=0) by aslan.scsiguy.com (8.14.9/8.14.9) with ESMTP id sBAKHXYT060457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 10 Dec 2014 13:17:34 -0700 (MST) (envelope-from gibbs@scsiguy.com) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: svn commit: r275679 - head/sys/x86/xen From: "Justin T. Gibbs" In-Reply-To: <201412101325.sBADPMgZ081973@svn.freebsd.org> Date: Wed, 10 Dec 2014 13:17:28 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201412101325.sBADPMgZ081973@svn.freebsd.org> To: Roger Pau MonnXX X-Mailer: Apple Mail (2.1993) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 20:17:41 -0000 On Dec 10, 2014, at 6:25 AM, Roger Pau MonnXX = wrote: >=20 > Author: royger > Date: Wed Dec 10 13:25:21 2014 > New Revision: 275679 > URL: https://svnweb.freebsd.org/changeset/base/275679 >=20 > Log: > xen/intr: balance dynamic interrupts across available vCPUs >=20 > By default Xen binds all event channels to vCPU#0, and FreeBSD only = shuffles > the interrupt sources once, at the end of the boot process. Since new = event > channels might be created after this point (because new devices or = backends > are added), try to automatically shuffle them at creation time.=20 >=20 > This does not affect VIRQ or IPI event channels, that are already = bound to a > specific vCPU as requested by the caller. >=20 > Sponsored by: Citrix Systems R&D >=20 > Modified: > head/sys/x86/xen/xen_intr.c >=20 > Modified: head/sys/x86/xen/xen_intr.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/x86/xen/xen_intr.c Wed Dec 10 11:42:02 2014 = (r275678) > +++ head/sys/x86/xen/xen_intr.c Wed Dec 10 13:25:21 2014 = (r275679) > @@ -425,6 +425,17 @@ xen_intr_bind_isrc(struct xenisrc **isrc > /* Assign the opaque handler (the event channel port) */ > *port_handlep =3D &isrc->xi_port; >=20 > +#ifdef SMP > + if (type =3D=3D EVTCHN_TYPE_PORT) { > + /* > + * By default all interrupts are assigned to vCPU#0 > + * unless specified otherwise, so shuffle them to = balance > + * the interrupt load. > + */ > + xen_intr_assign_cpu(&isrc->xi_intsrc, intr_next_cpu()); > + } > +#endif > + Shouldn't this only happen for new interrupt source objects, not those = that are being reclaimed/reused? =E2=80=94 Justin= From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 20:23:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A73E96A; Wed, 10 Dec 2014 20:23:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77271DEE; Wed, 10 Dec 2014 20:23:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAKNKhi094086; Wed, 10 Dec 2014 20:23:20 GMT (envelope-from andreast@FreeBSD.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAKNKp8094085; Wed, 10 Dec 2014 20:23:20 GMT (envelope-from andreast@FreeBSD.org) Message-Id: <201412102023.sBAKNKp8094085@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andreast set sender to andreast@FreeBSD.org using -f From: Andreas Tobler Date: Wed, 10 Dec 2014 20:23:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275686 - head/sys/powerpc/booke X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 20:23:20 -0000 Author: andreast Date: Wed Dec 10 20:23:19 2014 New Revision: 275686 URL: https://svnweb.freebsd.org/changeset/base/275686 Log: Fix kernel build for booke. Modified: head/sys/powerpc/booke/trap.c Modified: head/sys/powerpc/booke/trap.c ============================================================================== --- head/sys/powerpc/booke/trap.c Wed Dec 10 19:24:42 2014 (r275685) +++ head/sys/powerpc/booke/trap.c Wed Dec 10 20:23:19 2014 (r275686) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 20:29:32 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0074AB67; Wed, 10 Dec 2014 20:29:31 +0000 (UTC) Received: from aslan.scsiguy.com (mail.scsiguy.com [70.89.174.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA813E3B; Wed, 10 Dec 2014 20:29:31 +0000 (UTC) Received: from [192.168.6.155] (slboulder.spectralogic.com [192.30.190.3] (may be forged)) (authenticated bits=0) by aslan.scsiguy.com (8.14.9/8.14.9) with ESMTP id sBAKTTEO060895 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 10 Dec 2014 13:29:30 -0700 (MST) (envelope-from gibbs@scsiguy.com) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: svn commit: r275551 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb From: "Justin T. Gibbs" In-Reply-To: <201412060050.sB60oxYu045859@svn.freebsd.org> Date: Wed, 10 Dec 2014 13:29:24 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201412060050.sB60oxYu045859@svn.freebsd.org> To: Xin LI X-Mailer: Apple Mail (2.1993) Cc: svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-vendor@freebsd.org, will@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 20:29:32 -0000 What=E2=80=99s the policy for the commit log on vendor imports from = illumos? Since illumos does not allow =E2=80=9CFreeBSD style=E2=80=9D = commit messages, I=E2=80=99ve been putting that data into the = corresponding illumos issue that I create. So this information isn=E2=80=99= t lost during the merge to FreeBSD, I think we should pull the issue = data into our commit messages in addition to data taken from the git = commit in illumos-gate. One minor gripe about the illumos issue tracker is that I=E2=80=99ve = found it hard to keep it from mangling the formatting of text. For = example, look at the commit log I put into the history section of = https://www.illumos.org/issues/5314. Instead of fighting with that, = I=E2=80=99ve been pushing my =E2=80=9CFreeBSD commit log=E2=80=9D as the = description of the review associated with the bug and just linking the = issue to the review. You can see that in the next big change from = Spectra that is currently going through the review process: https://www.illumos.org/issues/5056 https://reviews.csiden.org/r/131/ =E2=80=94 Justin > On Dec 5, 2014, at 5:50 PM, Xin LI wrote: >=20 > Author: delphij > Date: Sat Dec 6 00:50:57 2014 > New Revision: 275551 > URL: https://svnweb.freebsd.org/changeset/base/275551 >=20 > Log: > 5314 Remove "dbuf phys" db->db_data pointer aliases in ZFS > Reviewed by: Andriy Gapon > Reviewed by: Matthew Ahrens > Reviewed by: Will Andrews > Approved by: Dan McDonald > Author: Justin T. Gibbs >=20 > illumos/illumos-gate@c1379625401dfbe1c39b79136dd384a571d47fde >=20 > Modified: > vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_synctask.c > vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c > vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c > vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c > vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c > vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h > vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h > vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h > vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dir.h > vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap_impl.h > vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap_leaf.h > vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c > vendor-sys/illumos/dist/uts/common/fs/zfs/zap_leaf.c > vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c > vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c >=20 > Changes in other areas also in this revision: > Modified: > vendor/illumos/dist/cmd/zdb/zdb.c >=20 > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Sat Dec 6 = 00:47:31 2014 (r275550) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Sat Dec 6 = 00:50:57 2014 (r275551) > @@ -223,11 +223,8 @@ dbuf_evict_user(dmu_buf_impl_t *db) > if (db->db_level !=3D 0 || db->db_evict_func =3D=3D NULL) > return; >=20 > - if (db->db_user_data_ptr_ptr) > - *db->db_user_data_ptr_ptr =3D db->db.db_data; > db->db_evict_func(&db->db, db->db_user_ptr); > db->db_user_ptr =3D NULL; > - db->db_user_data_ptr_ptr =3D NULL; > db->db_evict_func =3D NULL; > } >=20 > @@ -418,16 +415,6 @@ dbuf_verify(dmu_buf_impl_t *db) > #endif >=20 > static void > -dbuf_update_data(dmu_buf_impl_t *db) > -{ > - ASSERT(MUTEX_HELD(&db->db_mtx)); > - if (db->db_level =3D=3D 0 && db->db_user_data_ptr_ptr) { > - ASSERT(!refcount_is_zero(&db->db_holds)); > - *db->db_user_data_ptr_ptr =3D db->db.db_data; > - } > -} > - > -static void > dbuf_set_data(dmu_buf_impl_t *db, arc_buf_t *buf) > { > ASSERT(MUTEX_HELD(&db->db_mtx)); > @@ -437,7 +424,6 @@ dbuf_set_data(dmu_buf_impl_t *db, arc_bu > db->db.db_data =3D buf->b_data; > if (!arc_released(buf)) > arc_set_callback(buf, dbuf_do_evict, db); > - dbuf_update_data(db); > } else { > dbuf_evict_user(db); > db->db.db_data =3D NULL; > @@ -543,7 +529,6 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t > if (bonuslen) > bcopy(DN_BONUS(dn->dn_phys), db->db.db_data, = bonuslen); > DB_DNODE_EXIT(db); > - dbuf_update_data(db); > db->db_state =3D DB_CACHED; > mutex_exit(&db->db_mtx); > return; > @@ -1726,7 +1711,6 @@ dbuf_create(dnode_t *dn, uint8_t level,=20 > db->db_blkptr =3D blkptr; >=20 > db->db_user_ptr =3D NULL; > - db->db_user_data_ptr_ptr =3D NULL; > db->db_evict_func =3D NULL; > db->db_immediate_evict =3D 0; > db->db_freed_in_flight =3D 0; > @@ -1971,7 +1955,6 @@ top: > } >=20 > (void) refcount_add(&db->db_holds, tag); > - dbuf_update_data(db); > DBUF_VERIFY(db); > mutex_exit(&db->db_mtx); >=20 > @@ -2182,27 +2165,25 @@ dbuf_refcount(dmu_buf_impl_t *db) > } >=20 > void * > -dmu_buf_set_user(dmu_buf_t *db_fake, void *user_ptr, void = *user_data_ptr_ptr, > +dmu_buf_set_user(dmu_buf_t *db_fake, void *user_ptr, > dmu_buf_evict_func_t *evict_func) > { > - return (dmu_buf_update_user(db_fake, NULL, user_ptr, > - user_data_ptr_ptr, evict_func)); > + return (dmu_buf_update_user(db_fake, NULL, user_ptr, = evict_func)); > } >=20 > void * > -dmu_buf_set_user_ie(dmu_buf_t *db_fake, void *user_ptr, void = *user_data_ptr_ptr, > +dmu_buf_set_user_ie(dmu_buf_t *db_fake, void *user_ptr, > dmu_buf_evict_func_t *evict_func) > { > dmu_buf_impl_t *db =3D (dmu_buf_impl_t *)db_fake; >=20 > db->db_immediate_evict =3D TRUE; > - return (dmu_buf_update_user(db_fake, NULL, user_ptr, > - user_data_ptr_ptr, evict_func)); > + return (dmu_buf_update_user(db_fake, NULL, user_ptr, = evict_func)); > } >=20 > void * > dmu_buf_update_user(dmu_buf_t *db_fake, void *old_user_ptr, void = *user_ptr, > - void *user_data_ptr_ptr, dmu_buf_evict_func_t *evict_func) > + dmu_buf_evict_func_t *evict_func) > { > dmu_buf_impl_t *db =3D (dmu_buf_impl_t *)db_fake; > ASSERT(db->db_level =3D=3D 0); > @@ -2213,10 +2194,7 @@ dmu_buf_update_user(dmu_buf_t *db_fake,=20 >=20 > if (db->db_user_ptr =3D=3D old_user_ptr) { > db->db_user_ptr =3D user_ptr; > - db->db_user_data_ptr_ptr =3D user_data_ptr_ptr; > db->db_evict_func =3D evict_func; > - > - dbuf_update_data(db); > } else { > old_user_ptr =3D db->db_user_ptr; > } >=20 > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c Sat Dec = 6 00:47:31 2014 (r275550) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c Sat Dec = 6 00:50:57 2014 (r275551) > @@ -194,7 +194,7 @@ dmu_diff(const char *tosnap_name, const=20 > return (SET_ERROR(EXDEV)); > } >=20 > - fromtxg =3D fromsnap->ds_phys->ds_creation_txg; > + fromtxg =3D dsl_dataset_phys(fromsnap)->ds_creation_txg; > dsl_dataset_rele(fromsnap, FTAG); >=20 > dsl_dataset_long_hold(tosnap, FTAG); >=20 > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Sat Dec = 6 00:47:31 2014 (r275550) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Sat Dec = 6 00:50:57 2014 (r275551) > @@ -1479,12 +1479,12 @@ dmu_snapshot_realname(objset_t *os, char > dsl_dataset_t *ds =3D os->os_dsl_dataset; > uint64_t ignored; >=20 > - if (ds->ds_phys->ds_snapnames_zapobj =3D=3D 0) > + if (dsl_dataset_phys(ds)->ds_snapnames_zapobj =3D=3D 0) > return (SET_ERROR(ENOENT)); >=20 > return (zap_lookup_norm(ds->ds_dir->dd_pool->dp_meta_objset, > - ds->ds_phys->ds_snapnames_zapobj, name, 8, 1, &ignored, = MT_FIRST, > - real, maxlen, conflict)); > + dsl_dataset_phys(ds)->ds_snapnames_zapobj, name, 8, 1, = &ignored, > + MT_FIRST, real, maxlen, conflict)); > } >=20 > int > @@ -1497,12 +1497,12 @@ dmu_snapshot_list_next(objset_t *os, int >=20 > ASSERT(dsl_pool_config_held(dmu_objset_pool(os))); >=20 > - if (ds->ds_phys->ds_snapnames_zapobj =3D=3D 0) > + if (dsl_dataset_phys(ds)->ds_snapnames_zapobj =3D=3D 0) > return (SET_ERROR(ENOENT)); >=20 > zap_cursor_init_serialized(&cursor, > ds->ds_dir->dd_pool->dp_meta_objset, > - ds->ds_phys->ds_snapnames_zapobj, *offp); > + dsl_dataset_phys(ds)->ds_snapnames_zapobj, *offp); >=20 > if (zap_cursor_retrieve(&cursor, &attr) !=3D 0) { > zap_cursor_fini(&cursor); > @@ -1536,12 +1536,12 @@ dmu_dir_list_next(objset_t *os, int name >=20 > /* there is no next dir on a snapshot! */ > if (os->os_dsl_dataset->ds_object !=3D > - dd->dd_phys->dd_head_dataset_obj) > + dsl_dir_phys(dd)->dd_head_dataset_obj) > return (SET_ERROR(ENOENT)); >=20 > zap_cursor_init_serialized(&cursor, > dd->dd_pool->dp_meta_objset, > - dd->dd_phys->dd_child_dir_zapobj, *offp); > + dsl_dir_phys(dd)->dd_child_dir_zapobj, *offp); >=20 > if (zap_cursor_retrieve(&cursor, &attr) !=3D 0) { > zap_cursor_fini(&cursor); > @@ -1589,7 +1589,7 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint6 > return (0); > } >=20 > - thisobj =3D dd->dd_phys->dd_head_dataset_obj; > + thisobj =3D dsl_dir_phys(dd)->dd_head_dataset_obj; > attr =3D kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP); >=20 > /* > @@ -1597,7 +1597,7 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint6 > */ > if (flags & DS_FIND_CHILDREN) { > for (zap_cursor_init(&zc, dp->dp_meta_objset, > - dd->dd_phys->dd_child_dir_zapobj); > + dsl_dir_phys(dd)->dd_child_dir_zapobj); > zap_cursor_retrieve(&zc, attr) =3D=3D 0; > (void) zap_cursor_advance(&zc)) { > ASSERT3U(attr->za_integer_length, =3D=3D, > @@ -1626,7 +1626,9 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint6 > err =3D dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds); >=20 > if (err =3D=3D 0) { > - uint64_t snapobj =3D = ds->ds_phys->ds_snapnames_zapobj; > + uint64_t snapobj; > + > + snapobj =3D = dsl_dataset_phys(ds)->ds_snapnames_zapobj; > dsl_dataset_rele(ds, FTAG); >=20 > for (zap_cursor_init(&zc, dp->dp_meta_objset, = snapobj); > @@ -1701,7 +1703,7 @@ dmu_objset_find_impl(spa_t *spa, const c > return (0); > } >=20 > - thisobj =3D dd->dd_phys->dd_head_dataset_obj; > + thisobj =3D dsl_dir_phys(dd)->dd_head_dataset_obj; > attr =3D kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP); >=20 > /* > @@ -1709,7 +1711,7 @@ dmu_objset_find_impl(spa_t *spa, const c > */ > if (flags & DS_FIND_CHILDREN) { > for (zap_cursor_init(&zc, dp->dp_meta_objset, > - dd->dd_phys->dd_child_dir_zapobj); > + dsl_dir_phys(dd)->dd_child_dir_zapobj); > zap_cursor_retrieve(&zc, attr) =3D=3D 0; > (void) zap_cursor_advance(&zc)) { > ASSERT3U(attr->za_integer_length, =3D=3D, > @@ -1742,7 +1744,9 @@ dmu_objset_find_impl(spa_t *spa, const c > err =3D dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds); >=20 > if (err =3D=3D 0) { > - uint64_t snapobj =3D = ds->ds_phys->ds_snapnames_zapobj; > + uint64_t snapobj; > + > + snapobj =3D = dsl_dataset_phys(ds)->ds_snapnames_zapobj; > dsl_dataset_rele(ds, FTAG); >=20 > for (zap_cursor_init(&zc, dp->dp_meta_objset, = snapobj); >=20 > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c Sat Dec = 6 00:47:31 2014 (r275550) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c Sat Dec = 6 00:50:57 2014 (r275551) > @@ -598,12 +598,12 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, > featureflags); >=20 > drr->drr_u.drr_begin.drr_creation_time =3D > - ds->ds_phys->ds_creation_time; > + dsl_dataset_phys(ds)->ds_creation_time; > drr->drr_u.drr_begin.drr_type =3D dmu_objset_type(os); > if (is_clone) > drr->drr_u.drr_begin.drr_flags |=3D DRR_FLAG_CLONE; > - drr->drr_u.drr_begin.drr_toguid =3D ds->ds_phys->ds_guid; > - if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET) > + drr->drr_u.drr_begin.drr_toguid =3D = dsl_dataset_phys(ds)->ds_guid; > + if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) > drr->drr_u.drr_begin.drr_flags |=3D DRR_FLAG_CI_DATA; >=20 > if (fromzb !=3D NULL) { > @@ -624,7 +624,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, > dsp->dsa_proc =3D curproc; > dsp->dsa_os =3D os; > dsp->dsa_off =3D off; > - dsp->dsa_toguid =3D ds->ds_phys->ds_guid; > + dsp->dsa_toguid =3D dsl_dataset_phys(ds)->ds_guid; > ZIO_SET_CHECKSUM(&dsp->dsa_zc, 0, 0, 0, 0); > dsp->dsa_pending_op =3D PENDING_NONE; > dsp->dsa_incremental =3D (fromzb !=3D NULL); > @@ -710,9 +710,10 @@ dmu_send_obj(const char *pool, uint64_t=20 > } > if (!dsl_dataset_is_before(ds, fromds, 0)) > err =3D SET_ERROR(EXDEV); > - zb.zbm_creation_time =3D = fromds->ds_phys->ds_creation_time; > - zb.zbm_creation_txg =3D = fromds->ds_phys->ds_creation_txg; > - zb.zbm_guid =3D fromds->ds_phys->ds_guid; > + zb.zbm_creation_time =3D > + dsl_dataset_phys(fromds)->ds_creation_time; > + zb.zbm_creation_txg =3D = dsl_dataset_phys(fromds)->ds_creation_txg; > + zb.zbm_guid =3D dsl_dataset_phys(fromds)->ds_guid; > is_clone =3D (fromds->ds_dir !=3D ds->ds_dir); > dsl_dataset_rele(fromds, FTAG); > err =3D dmu_send_impl(FTAG, dp, ds, &zb, is_clone, > @@ -779,10 +780,10 @@ dmu_send(const char *tosnap, const char=20 > if (!dsl_dataset_is_before(ds, fromds, = 0)) > err =3D SET_ERROR(EXDEV); > zb.zbm_creation_time =3D > - fromds->ds_phys->ds_creation_time; > + = dsl_dataset_phys(fromds)->ds_creation_time; > zb.zbm_creation_txg =3D > - fromds->ds_phys->ds_creation_txg; > - zb.zbm_guid =3D = fromds->ds_phys->ds_guid; > + = dsl_dataset_phys(fromds)->ds_creation_txg; > + zb.zbm_guid =3D = dsl_dataset_phys(fromds)->ds_guid; > is_clone =3D (ds->ds_dir !=3D = fromds->ds_dir); > dsl_dataset_rele(fromds, FTAG); > } > @@ -829,7 +830,7 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl >=20 > /* Get uncompressed size estimate of changed data. */ > if (fromds =3D=3D NULL) { > - size =3D ds->ds_phys->ds_uncompressed_bytes; > + size =3D dsl_dataset_phys(ds)->ds_uncompressed_bytes; > } else { > uint64_t used, comp; > err =3D dsl_dataset_space_written(fromds, ds, > @@ -884,15 +885,15 @@ recv_begin_check_existing_impl(dmu_recv_ >=20 > /* temporary clone name must not exist */ > error =3D zap_lookup(dp->dp_meta_objset, > - ds->ds_dir->dd_phys->dd_child_dir_zapobj, recv_clone_name, > + dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, = recv_clone_name, > 8, 1, &val); > if (error !=3D ENOENT) > return (error =3D=3D 0 ? EBUSY : error); >=20 > /* new snapshot name must not exist */ > error =3D zap_lookup(dp->dp_meta_objset, > - ds->ds_phys->ds_snapnames_zapobj, = drba->drba_cookie->drc_tosnap, > - 8, 1, &val); > + dsl_dataset_phys(ds)->ds_snapnames_zapobj, > + drba->drba_cookie->drc_tosnap, 8, 1, &val); > if (error !=3D ENOENT) > return (error =3D=3D 0 ? EEXIST : error); >=20 > @@ -912,7 +913,7 @@ recv_begin_check_existing_impl(dmu_recv_ >=20 > if (fromguid !=3D 0) { > dsl_dataset_t *snap; > - uint64_t obj =3D ds->ds_phys->ds_prev_snap_obj; > + uint64_t obj =3D dsl_dataset_phys(ds)->ds_prev_snap_obj; >=20 > /* Find snapshot in this dir that matches fromguid. */ > while (obj !=3D 0) { > @@ -924,9 +925,9 @@ recv_begin_check_existing_impl(dmu_recv_ > dsl_dataset_rele(snap, FTAG); > return (SET_ERROR(ENODEV)); > } > - if (snap->ds_phys->ds_guid =3D=3D fromguid) > + if (dsl_dataset_phys(snap)->ds_guid =3D=3D = fromguid) > break; > - obj =3D snap->ds_phys->ds_prev_snap_obj; > + obj =3D = dsl_dataset_phys(snap)->ds_prev_snap_obj; > dsl_dataset_rele(snap, FTAG); > } > if (obj =3D=3D 0) > @@ -949,9 +950,9 @@ recv_begin_check_existing_impl(dmu_recv_ > dsl_dataset_rele(snap, FTAG); > } else { > /* if full, most recent snapshot must be $ORIGIN */ > - if (ds->ds_phys->ds_prev_snap_txg >=3D TXG_INITIAL) > + if (dsl_dataset_phys(ds)->ds_prev_snap_txg >=3D = TXG_INITIAL) > return (SET_ERROR(ENODEV)); > - drba->drba_snapobj =3D ds->ds_phys->ds_prev_snap_obj; > + drba->drba_snapobj =3D = dsl_dataset_phys(ds)->ds_prev_snap_obj; > } >=20 > return (0); > @@ -1069,7 +1070,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t > dsl_dataset_rele(ds, FTAG); > return (SET_ERROR(EINVAL)); > } > - if (origin->ds_phys->ds_guid !=3D fromguid) { > + if (dsl_dataset_phys(origin)->ds_guid !=3D = fromguid) { > dsl_dataset_rele(origin, FTAG); > dsl_dataset_rele(ds, FTAG); > return (SET_ERROR(ENODEV)); > @@ -1140,7 +1141,7 @@ dmu_recv_begin_sync(void *arg, dmu_tx_t=20 > } >=20 > dmu_buf_will_dirty(newds->ds_dbuf, tx); > - newds->ds_phys->ds_flags |=3D DS_FLAG_INCONSISTENT; > + dsl_dataset_phys(newds)->ds_flags |=3D DS_FLAG_INCONSISTENT; >=20 > /* > * If we actually created a non-clone, we need to create the > @@ -1777,7 +1778,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc,=20 > */ > VERIFY0(dmu_objset_from_ds(drc->drc_ds, &os)); >=20 > - ASSERT(drc->drc_ds->ds_phys->ds_flags & DS_FLAG_INCONSISTENT); > + ASSERT(dsl_dataset_phys(drc->drc_ds)->ds_flags & = DS_FLAG_INCONSISTENT); >=20 > featureflags =3D = DMU_GET_FEATUREFLAGS(drc->drc_drrb->drr_versioninfo); >=20 > @@ -1940,8 +1941,11 @@ dmu_recv_end_check(void *arg, dmu_tx_t * > * the snap before drc_ds, because drc_ds can = not > * have any snaps of its own). > */ > - uint64_t obj =3D = origin_head->ds_phys->ds_prev_snap_obj; > - while (obj !=3D = drc->drc_ds->ds_phys->ds_prev_snap_obj) { > + uint64_t obj; > + > + obj =3D = dsl_dataset_phys(origin_head)->ds_prev_snap_obj; > + while (obj !=3D > + = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj) { > dsl_dataset_t *snap; > error =3D dsl_dataset_hold_obj(dp, obj, = FTAG, > &snap); > @@ -1953,7 +1957,7 @@ dmu_recv_end_check(void *arg, dmu_tx_t * > error =3D = dsl_destroy_snapshot_check_impl( > snap, B_FALSE); > } > - obj =3D snap->ds_phys->ds_prev_snap_obj; > + obj =3D = dsl_dataset_phys(snap)->ds_prev_snap_obj; > dsl_dataset_rele(snap, FTAG); > if (error !=3D 0) > return (error); > @@ -1999,13 +2003,16 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t > * Destroy any snapshots of drc_tofs = (origin_head) > * after the origin (the snap before drc_ds). > */ > - uint64_t obj =3D = origin_head->ds_phys->ds_prev_snap_obj; > - while (obj !=3D = drc->drc_ds->ds_phys->ds_prev_snap_obj) { > + uint64_t obj; > + > + obj =3D = dsl_dataset_phys(origin_head)->ds_prev_snap_obj; > + while (obj !=3D > + = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj) { > dsl_dataset_t *snap; > VERIFY0(dsl_dataset_hold_obj(dp, obj, = FTAG, > &snap)); > ASSERT3P(snap->ds_dir, =3D=3D, = origin_head->ds_dir); > - obj =3D snap->ds_phys->ds_prev_snap_obj; > + obj =3D = dsl_dataset_phys(snap)->ds_prev_snap_obj; > dsl_destroy_snapshot_sync_impl(snap, > B_FALSE, tx); > dsl_dataset_rele(snap, FTAG); > @@ -2021,15 +2028,16 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t >=20 > /* set snapshot's creation time and guid */ > dmu_buf_will_dirty(origin_head->ds_prev->ds_dbuf, tx); > - origin_head->ds_prev->ds_phys->ds_creation_time =3D > + dsl_dataset_phys(origin_head->ds_prev)->ds_creation_time = =3D > drc->drc_drrb->drr_creation_time; > - origin_head->ds_prev->ds_phys->ds_guid =3D > + dsl_dataset_phys(origin_head->ds_prev)->ds_guid =3D > drc->drc_drrb->drr_toguid; > - origin_head->ds_prev->ds_phys->ds_flags &=3D > + dsl_dataset_phys(origin_head->ds_prev)->ds_flags &=3D > ~DS_FLAG_INCONSISTENT; >=20 > dmu_buf_will_dirty(origin_head->ds_dbuf, tx); > - origin_head->ds_phys->ds_flags &=3D = ~DS_FLAG_INCONSISTENT; > + dsl_dataset_phys(origin_head)->ds_flags &=3D > + ~DS_FLAG_INCONSISTENT; >=20 > dsl_dataset_rele(origin_head, FTAG); > dsl_destroy_head_sync_impl(drc->drc_ds, tx); > @@ -2043,15 +2051,17 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t >=20 > /* set snapshot's creation time and guid */ > dmu_buf_will_dirty(ds->ds_prev->ds_dbuf, tx); > - ds->ds_prev->ds_phys->ds_creation_time =3D > + dsl_dataset_phys(ds->ds_prev)->ds_creation_time =3D > drc->drc_drrb->drr_creation_time; > - ds->ds_prev->ds_phys->ds_guid =3D = drc->drc_drrb->drr_toguid; > - ds->ds_prev->ds_phys->ds_flags &=3D = ~DS_FLAG_INCONSISTENT; > + dsl_dataset_phys(ds->ds_prev)->ds_guid =3D > + drc->drc_drrb->drr_toguid; > + dsl_dataset_phys(ds->ds_prev)->ds_flags &=3D > + ~DS_FLAG_INCONSISTENT; >=20 > dmu_buf_will_dirty(ds->ds_dbuf, tx); > - ds->ds_phys->ds_flags &=3D ~DS_FLAG_INCONSISTENT; > + dsl_dataset_phys(ds)->ds_flags &=3D = ~DS_FLAG_INCONSISTENT; > } > - drc->drc_newsnapobj =3D drc->drc_ds->ds_phys->ds_prev_snap_obj; > + drc->drc_newsnapobj =3D = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj; > /* > * Release the hold from dmu_recv_begin. This must be done = before > * we return to open context, so that when we free the dataset's = dnode, > @@ -2077,7 +2087,7 @@ add_ds_to_guidmap(const char *name, avl_ > gmep =3D kmem_alloc(sizeof (*gmep), KM_SLEEP); > err =3D dsl_dataset_hold_obj(dp, snapobj, gmep, &snapds); > if (err =3D=3D 0) { > - gmep->guid =3D snapds->ds_phys->ds_guid; > + gmep->guid =3D dsl_dataset_phys(snapds)->ds_guid; > gmep->gme_ds =3D snapds; > avl_add(guid_map, gmep); > dsl_dataset_long_hold(snapds, gmep); >=20 > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c Sat Dec = 6 00:47:31 2014 (r275550) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c Sat Dec = 6 00:50:57 2014 (r275551) > @@ -579,7 +579,7 @@ traverse_dataset(dsl_dataset_t *ds, uint > blkptr_cb_t func, void *arg) > { > return (traverse_impl(ds->ds_dir->dd_pool->dp_spa, ds, = ds->ds_object, > - &ds->ds_phys->ds_bp, txg_start, NULL, flags, func, arg)); > + &dsl_dataset_phys(ds)->ds_bp, txg_start, NULL, flags, func, = arg)); > } >=20 > int > @@ -634,8 +634,8 @@ traverse_pool(spa_t *spa, uint64_t txg_s > continue; > break; > } > - if (ds->ds_phys->ds_prev_snap_txg > txg) > - txg =3D ds->ds_phys->ds_prev_snap_txg; > + if (dsl_dataset_phys(ds)->ds_prev_snap_txg > = txg) > + txg =3D = dsl_dataset_phys(ds)->ds_prev_snap_txg; > err =3D traverse_dataset(ds, txg, flags, func, = arg); > dsl_dataset_rele(ds, FTAG); > if (err !=3D 0) >=20 > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Sat Dec = 6 00:47:31 2014 (r275550) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Sat Dec = 6 00:50:57 2014 (r275551) > @@ -713,6 +713,7 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t o > { > dmu_tx_hold_t *txh; > dnode_t *dn; > + dsl_dataset_phys_t *ds_phys; > uint64_t nblocks; > int epbs, err; >=20 > @@ -787,8 +788,9 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t o > * we'll have to modify an indirect twig for each. > */ > epbs =3D dn->dn_indblkshift - SPA_BLKPTRSHIFT; > + ds_phys =3D dsl_dataset_phys(dn->dn_objset->os_dsl_dataset); > for (nblocks =3D dn->dn_maxblkid >> epbs; nblocks !=3D 0; = nblocks >>=3D epbs) > - if = (dn->dn_objset->os_dsl_dataset->ds_phys->ds_prev_snap_obj) > + if (ds_phys->ds_prev_snap_obj) > txh->txh_space_towrite +=3D 3 << = dn->dn_indblkshift; > else > txh->txh_space_tooverwrite +=3D 3 << = dn->dn_indblkshift; >=20 > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Sat Dec 6 = 00:47:31 2014 (r275550) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Sat Dec 6 = 00:50:57 2014 (r275551) > @@ -1116,7 +1116,7 @@ dnode_hold_impl(objset_t *os, uint64_t o > zrl_init(&dnh[i].dnh_zrlock); > dnh[i].dnh_dnode =3D NULL; > } > - if (winner =3D dmu_buf_set_user(&db->db, = children_dnodes, NULL, > + if (winner =3D dmu_buf_set_user(&db->db, = children_dnodes, > dnode_buf_pageout)) { >=20 > for (i =3D 0; i < epb; i++) { >=20 > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c Sat Dec = 6 00:47:31 2014 (r275550) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c Sat Dec = 6 00:50:57 2014 (r275551) > @@ -65,7 +65,7 @@ dsl_dataset_bmark_lookup(dsl_dataset_t * > if (bmark_zapobj =3D=3D 0) > return (SET_ERROR(ESRCH)); >=20 > - if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET) > + if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) > mt =3D MT_FIRST; > else > mt =3D MT_EXACT; > @@ -208,10 +208,11 @@ dsl_bookmark_create_sync(void *arg, dmu_ > &bmark_fs->ds_bookmarks, tx)); > } >=20 > - bmark_phys.zbm_guid =3D snapds->ds_phys->ds_guid; > - bmark_phys.zbm_creation_txg =3D = snapds->ds_phys->ds_creation_txg; > + bmark_phys.zbm_guid =3D = dsl_dataset_phys(snapds)->ds_guid; > + bmark_phys.zbm_creation_txg =3D > + dsl_dataset_phys(snapds)->ds_creation_txg; > bmark_phys.zbm_creation_time =3D > - snapds->ds_phys->ds_creation_time; > + dsl_dataset_phys(snapds)->ds_creation_time; >=20 > VERIFY0(zap_add(mos, bmark_fs->ds_bookmarks, > shortname, sizeof (uint64_t), > @@ -340,7 +341,7 @@ dsl_dataset_bookmark_remove(dsl_dataset_ > uint64_t bmark_zapobj =3D ds->ds_bookmarks; > matchtype_t mt; >=20 > - if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET) > + if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) > mt =3D MT_FIRST; > else > mt =3D MT_EXACT; >=20 > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Sat Dec = 6 00:47:31 2014 (r275550) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Sat Dec = 6 00:50:57 2014 (r275551) > @@ -70,6 +70,9 @@ int zfs_max_recordsize =3D 1 * 1024 * 1024 >=20 > #define DS_REF_MAX (1ULL << 62) >=20 > +extern inline dsl_dataset_phys_t *dsl_dataset_phys(dsl_dataset_t = *ds); > +extern inline boolean_t dsl_dataset_is_snapshot(dsl_dataset_t *ds); > + > /* > * Figure out how much of this delta should be propogated to the = dsl_dir > * layer. If there's a refreservation, that space has already been > @@ -78,13 +81,15 @@ int zfs_max_recordsize =3D 1 * 1024 * 1024 > static int64_t > parent_delta(dsl_dataset_t *ds, int64_t delta) > { > + dsl_dataset_phys_t *ds_phys; > uint64_t old_bytes, new_bytes; >=20 > if (ds->ds_reserved =3D=3D 0) > return (delta); >=20 > - old_bytes =3D MAX(ds->ds_phys->ds_unique_bytes, = ds->ds_reserved); > - new_bytes =3D MAX(ds->ds_phys->ds_unique_bytes + delta, = ds->ds_reserved); > + ds_phys =3D dsl_dataset_phys(ds); > + old_bytes =3D MAX(ds_phys->ds_unique_bytes, ds->ds_reserved); > + new_bytes =3D MAX(ds_phys->ds_unique_bytes + delta, = ds->ds_reserved); >=20 > ASSERT3U(ABS((int64_t)(new_bytes - old_bytes)), <=3D, = ABS(delta)); > return (new_bytes - old_bytes); > @@ -115,10 +120,10 @@ dsl_dataset_block_born(dsl_dataset_t *ds > dmu_buf_will_dirty(ds->ds_dbuf, tx); > mutex_enter(&ds->ds_lock); > delta =3D parent_delta(ds, used); > - ds->ds_phys->ds_referenced_bytes +=3D used; > - ds->ds_phys->ds_compressed_bytes +=3D compressed; > - ds->ds_phys->ds_uncompressed_bytes +=3D uncompressed; > - ds->ds_phys->ds_unique_bytes +=3D used; > + dsl_dataset_phys(ds)->ds_referenced_bytes +=3D used; > + dsl_dataset_phys(ds)->ds_compressed_bytes +=3D compressed; > + dsl_dataset_phys(ds)->ds_uncompressed_bytes +=3D uncompressed; > + dsl_dataset_phys(ds)->ds_unique_bytes +=3D used; > if (BP_GET_LSIZE(bp) > SPA_OLD_MAXBLOCKSIZE) > ds->ds_need_large_blocks =3D B_TRUE; > mutex_exit(&ds->ds_lock); > @@ -153,17 +158,17 @@ dsl_dataset_block_kill(dsl_dataset_t *ds > ASSERT(!dsl_dataset_is_snapshot(ds)); > dmu_buf_will_dirty(ds->ds_dbuf, tx); >=20 > - if (bp->blk_birth > ds->ds_phys->ds_prev_snap_txg) { > + if (bp->blk_birth > dsl_dataset_phys(ds)->ds_prev_snap_txg) { > int64_t delta; >=20 > dprintf_bp(bp, "freeing ds=3D%llu", ds->ds_object); > dsl_free(tx->tx_pool, tx->tx_txg, bp); >=20 > mutex_enter(&ds->ds_lock); > - ASSERT(ds->ds_phys->ds_unique_bytes >=3D used || > + ASSERT(dsl_dataset_phys(ds)->ds_unique_bytes >=3D used = || > !DS_UNIQUE_IS_ACCURATE(ds)); > delta =3D parent_delta(ds, -used); > - ds->ds_phys->ds_unique_bytes -=3D used; > + dsl_dataset_phys(ds)->ds_unique_bytes -=3D used; > mutex_exit(&ds->ds_lock); > dsl_dir_diduse_space(ds->ds_dir, DD_USED_HEAD, > delta, -compressed, -uncompressed, tx); > @@ -184,15 +189,15 @@ dsl_dataset_block_kill(dsl_dataset_t *ds > dsl_deadlist_insert(&ds->ds_deadlist, bp, tx); > } > ASSERT3U(ds->ds_prev->ds_object, =3D=3D, > - ds->ds_phys->ds_prev_snap_obj); > - ASSERT(ds->ds_prev->ds_phys->ds_num_children > 0); > + dsl_dataset_phys(ds)->ds_prev_snap_obj); > + ASSERT(dsl_dataset_phys(ds->ds_prev)->ds_num_children > = 0); > /* if (bp->blk_birth > prev prev snap txg) prev unique = +=3D bs */ > - if (ds->ds_prev->ds_phys->ds_next_snap_obj =3D=3D > + if (dsl_dataset_phys(ds->ds_prev)->ds_next_snap_obj =3D=3D= > ds->ds_object && bp->blk_birth > > - ds->ds_prev->ds_phys->ds_prev_snap_txg) { > + dsl_dataset_phys(ds->ds_prev)->ds_prev_snap_txg) { > dmu_buf_will_dirty(ds->ds_prev->ds_dbuf, tx); > mutex_enter(&ds->ds_prev->ds_lock); > - ds->ds_prev->ds_phys->ds_unique_bytes +=3D used; > + dsl_dataset_phys(ds->ds_prev)->ds_unique_bytes = +=3D used; > mutex_exit(&ds->ds_prev->ds_lock); > } > if (bp->blk_birth > ds->ds_dir->dd_origin_txg) { > @@ -201,12 +206,12 @@ dsl_dataset_block_kill(dsl_dataset_t *ds > } > } > mutex_enter(&ds->ds_lock); > - ASSERT3U(ds->ds_phys->ds_referenced_bytes, >=3D, used); > - ds->ds_phys->ds_referenced_bytes -=3D used; > - ASSERT3U(ds->ds_phys->ds_compressed_bytes, >=3D, compressed); > - ds->ds_phys->ds_compressed_bytes -=3D compressed; > - ASSERT3U(ds->ds_phys->ds_uncompressed_bytes, >=3D, = uncompressed); > - ds->ds_phys->ds_uncompressed_bytes -=3D uncompressed; > + ASSERT3U(dsl_dataset_phys(ds)->ds_referenced_bytes, >=3D, used); > + dsl_dataset_phys(ds)->ds_referenced_bytes -=3D used; > + ASSERT3U(dsl_dataset_phys(ds)->ds_compressed_bytes, >=3D, = compressed); > + dsl_dataset_phys(ds)->ds_compressed_bytes -=3D compressed; > + ASSERT3U(dsl_dataset_phys(ds)->ds_uncompressed_bytes, >=3D, = uncompressed); > + dsl_dataset_phys(ds)->ds_uncompressed_bytes -=3D uncompressed; > mutex_exit(&ds->ds_lock); >=20 > return (used); > @@ -232,7 +237,7 @@ dsl_dataset_prev_snap_txg(dsl_dataset_t=20 > if (ds->ds_trysnap_txg > > spa_last_synced_txg(ds->ds_dir->dd_pool->dp_spa)) > trysnap =3D ds->ds_trysnap_txg; > - return (MAX(ds->ds_phys->ds_prev_snap_txg, trysnap)); > + return (MAX(dsl_dataset_phys(ds)->ds_prev_snap_txg, trysnap)); > } >=20 > boolean_t > @@ -267,7 +272,7 @@ dsl_dataset_evict(dmu_buf_t *db, void *d > } >=20 > bplist_destroy(&ds->ds_pending_deadlist); > - if (ds->ds_phys->ds_deadlist_obj !=3D 0) > + if (dsl_dataset_phys(ds)->ds_deadlist_obj !=3D 0) > dsl_deadlist_close(&ds->ds_deadlist); > if (ds->ds_dir) > dsl_dir_rele(ds->ds_dir, ds); > @@ -293,10 +298,10 @@ dsl_dataset_get_snapname(dsl_dataset_t * >=20 > if (ds->ds_snapname[0]) > return (0); > - if (ds->ds_phys->ds_next_snap_obj =3D=3D 0) > + if (dsl_dataset_phys(ds)->ds_next_snap_obj =3D=3D 0) > return (0); >=20 > - err =3D dmu_bonus_hold(mos, = ds->ds_dir->dd_phys->dd_head_dataset_obj, > + err =3D dmu_bonus_hold(mos, = dsl_dir_phys(ds->ds_dir)->dd_head_dataset_obj, > FTAG, &headdbuf); > if (err !=3D 0) > return (err); > @@ -311,11 +316,11 @@ int > dsl_dataset_snap_lookup(dsl_dataset_t *ds, const char *name, uint64_t = *value) > { > objset_t *mos =3D ds->ds_dir->dd_pool->dp_meta_objset; > - uint64_t snapobj =3D ds->ds_phys->ds_snapnames_zapobj; > + uint64_t snapobj =3D dsl_dataset_phys(ds)->ds_snapnames_zapobj; > matchtype_t mt; > int err; >=20 > - if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET) > + if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) > mt =3D MT_FIRST; > else > mt =3D MT_EXACT; > @@ -332,13 +337,13 @@ dsl_dataset_snap_remove(dsl_dataset_t *d > boolean_t adj_cnt) > { > objset_t *mos =3D ds->ds_dir->dd_pool->dp_meta_objset; > - uint64_t snapobj =3D ds->ds_phys->ds_snapnames_zapobj; > + uint64_t snapobj =3D dsl_dataset_phys(ds)->ds_snapnames_zapobj; > matchtype_t mt; > int err; >=20 > dsl_dir_snap_cmtime_update(ds->ds_dir); >=20 > - if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET) > + if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) > mt =3D MT_FIRST; > else > mt =3D MT_EXACT; > @@ -384,7 +389,6 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin > ds =3D kmem_zalloc(sizeof (dsl_dataset_t), KM_SLEEP); > ds->ds_dbuf =3D dbuf; > ds->ds_object =3D dsobj; > - ds->ds_phys =3D dbuf->db_data; >=20 > mutex_init(&ds->ds_lock, NULL, MUTEX_DEFAULT, NULL); > mutex_init(&ds->ds_opening_lock, NULL, MUTEX_DEFAULT, = NULL); > @@ -393,7 +397,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin >=20 > bplist_create(&ds->ds_pending_deadlist); > dsl_deadlist_open(&ds->ds_deadlist, > - mos, ds->ds_phys->ds_deadlist_obj); > + mos, dsl_dataset_phys(ds)->ds_deadlist_obj); >=20 > list_create(&ds->ds_sendstreams, sizeof (dmu_sendarg_t), > offsetof(dmu_sendarg_t, dsa_link)); > @@ -408,7 +412,8 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin >=20 > if (err =3D=3D 0) { > err =3D dsl_dir_hold_obj(dp, > - ds->ds_phys->ds_dir_obj, NULL, ds, = &ds->ds_dir); > + dsl_dataset_phys(ds)->ds_dir_obj, NULL, ds, > + &ds->ds_dir); > } > if (err !=3D 0) { > mutex_destroy(&ds->ds_lock); > @@ -424,9 +429,9 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin >=20 > if (!dsl_dataset_is_snapshot(ds)) { > ds->ds_snapname[0] =3D '\0'; > - if (ds->ds_phys->ds_prev_snap_obj !=3D 0) { > + if (dsl_dataset_phys(ds)->ds_prev_snap_obj !=3D = 0) { > err =3D dsl_dataset_hold_obj(dp, > - ds->ds_phys->ds_prev_snap_obj, > + = dsl_dataset_phys(ds)->ds_prev_snap_obj, > ds, &ds->ds_prev); > } > if (doi.doi_type =3D=3D DMU_OTN_ZAP_METADATA) { > @@ -440,10 +445,11 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin > } else { > if (zfs_flags & ZFS_DEBUG_SNAPNAMES) > err =3D dsl_dataset_get_snapname(ds); > - if (err =3D=3D 0 && ds->ds_phys->ds_userrefs_obj = !=3D 0) { > + if (err =3D=3D 0 && > + dsl_dataset_phys(ds)->ds_userrefs_obj !=3D = 0) { > err =3D zap_count( > ds->ds_dir->dd_pool->dp_meta_objset, > - ds->ds_phys->ds_userrefs_obj, > + = dsl_dataset_phys(ds)->ds_userrefs_obj, > &ds->ds_userrefs); > } > } > @@ -462,7 +468,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin > } >=20 > if (err !=3D 0 || (winner =3D dmu_buf_set_user_ie(dbuf, = ds, > - &ds->ds_phys, dsl_dataset_evict)) !=3D NULL) { > + dsl_dataset_evict)) !=3D NULL) { > bplist_destroy(&ds->ds_pending_deadlist); > dsl_deadlist_close(&ds->ds_deadlist); > if (ds->ds_prev) > @@ -480,12 +486,12 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin > ds =3D winner; > } else { > ds->ds_fsid_guid =3D > - unique_insert(ds->ds_phys->ds_fsid_guid); > + = unique_insert(dsl_dataset_phys(ds)->ds_fsid_guid); > } > } > ASSERT3P(ds->ds_dbuf, =3D=3D, dbuf); > - ASSERT3P(ds->ds_phys, =3D=3D, dbuf->db_data); > - ASSERT(ds->ds_phys->ds_prev_snap_obj !=3D 0 || > + ASSERT3P(dsl_dataset_phys(ds), =3D=3D, dbuf->db_data); > + ASSERT(dsl_dataset_phys(ds)->ds_prev_snap_obj !=3D 0 || > spa_version(dp->dp_spa) < SPA_VERSION_ORIGIN || > dp->dp_origin_snap =3D=3D NULL || ds =3D=3D = dp->dp_origin_snap); > *dsp =3D ds; > @@ -506,7 +512,7 @@ dsl_dataset_hold(dsl_pool_t *dp, const c > return (err); >=20 > ASSERT(dsl_pool_config_held(dp)); > - obj =3D dd->dd_phys->dd_head_dataset_obj; > + obj =3D dsl_dir_phys(dd)->dd_head_dataset_obj; > if (obj !=3D 0) > err =3D dsl_dataset_hold_obj(dp, obj, tag, dsp); > else > @@ -673,9 +679,9 @@ dsl_dataset_create_sync_dd(dsl_dir_t *dd > origin =3D dp->dp_origin_snap; >=20 > ASSERT(origin =3D=3D NULL || origin->ds_dir->dd_pool =3D=3D dp); > - ASSERT(origin =3D=3D NULL || origin->ds_phys->ds_num_children > = 0); > + ASSERT(origin =3D=3D NULL || = dsl_dataset_phys(origin)->ds_num_children > 0); > ASSERT(dmu_tx_is_syncing(tx)); > - ASSERT(dd->dd_phys->dd_head_dataset_obj =3D=3D 0); > + ASSERT(dsl_dir_phys(dd)->dd_head_dataset_obj =3D=3D 0); >=20 > dsobj =3D dmu_object_alloc(mos, DMU_OT_DSL_DATASET, 0, > DMU_OT_DSL_DATASET, sizeof (dsl_dataset_phys_t), tx); > @@ -701,55 +707,58 @@ dsl_dataset_create_sync_dd(dsl_dir_t *dd >=20 > dsphys->ds_prev_snap_obj =3D origin->ds_object; > dsphys->ds_prev_snap_txg =3D > - origin->ds_phys->ds_creation_txg; > + dsl_dataset_phys(origin)->ds_creation_txg; > dsphys->ds_referenced_bytes =3D > - origin->ds_phys->ds_referenced_bytes; > + dsl_dataset_phys(origin)->ds_referenced_bytes; > dsphys->ds_compressed_bytes =3D > - origin->ds_phys->ds_compressed_bytes; > + dsl_dataset_phys(origin)->ds_compressed_bytes; > dsphys->ds_uncompressed_bytes =3D > - origin->ds_phys->ds_uncompressed_bytes; > - dsphys->ds_bp =3D origin->ds_phys->ds_bp; > + dsl_dataset_phys(origin)->ds_uncompressed_bytes; > + dsphys->ds_bp =3D dsl_dataset_phys(origin)->ds_bp; >=20 > /* > * Inherit flags that describe the dataset's contents > * (INCONSISTENT) or properties (Case Insensitive). > */ > - dsphys->ds_flags |=3D origin->ds_phys->ds_flags & > + dsphys->ds_flags |=3D dsl_dataset_phys(origin)->ds_flags = & > (DS_FLAG_INCONSISTENT | DS_FLAG_CI_DATASET); >=20 > if (origin->ds_large_blocks) > = dsl_dataset_activate_large_blocks_sync_impl(dsobj, tx); >=20 > dmu_buf_will_dirty(origin->ds_dbuf, tx); > - origin->ds_phys->ds_num_children++; > + dsl_dataset_phys(origin)->ds_num_children++; >=20 > VERIFY0(dsl_dataset_hold_obj(dp, > - origin->ds_dir->dd_phys->dd_head_dataset_obj, FTAG, = &ohds)); > + dsl_dir_phys(origin->ds_dir)->dd_head_dataset_obj, > + FTAG, &ohds)); > dsphys->ds_deadlist_obj =3D = dsl_deadlist_clone(&ohds->ds_deadlist, > dsphys->ds_prev_snap_txg, dsphys->ds_prev_snap_obj, = tx); > dsl_dataset_rele(ohds, FTAG); >=20 > if (spa_version(dp->dp_spa) >=3D = SPA_VERSION_NEXT_CLONES) { > - if (origin->ds_phys->ds_next_clones_obj =3D=3D = 0) { > - origin->ds_phys->ds_next_clones_obj =3D > + if (dsl_dataset_phys(origin)->ds_next_clones_obj = =3D=3D 0) { > + = dsl_dataset_phys(origin)->ds_next_clones_obj =3D > zap_create(mos, > DMU_OT_NEXT_CLONES, DMU_OT_NONE, 0, = tx); > } > VERIFY0(zap_add_int(mos, > - origin->ds_phys->ds_next_clones_obj, dsobj, = tx)); > + = dsl_dataset_phys(origin)->ds_next_clones_obj, > + dsobj, tx)); > } >=20 > dmu_buf_will_dirty(dd->dd_dbuf, tx); > - dd->dd_phys->dd_origin_obj =3D origin->ds_object; > + dsl_dir_phys(dd)->dd_origin_obj =3D origin->ds_object; > if (spa_version(dp->dp_spa) >=3D SPA_VERSION_DIR_CLONES) = { > - if (origin->ds_dir->dd_phys->dd_clones =3D=3D 0) = { > + if (dsl_dir_phys(origin->ds_dir)->dd_clones =3D=3D= 0) { > = dmu_buf_will_dirty(origin->ds_dir->dd_dbuf, tx); > - origin->ds_dir->dd_phys->dd_clones =3D > + dsl_dir_phys(origin->ds_dir)->dd_clones = =3D > zap_create(mos, > DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, = tx); > } > VERIFY0(zap_add_int(mos, > - origin->ds_dir->dd_phys->dd_clones, dsobj, = tx)); > + dsl_dir_phys(origin->ds_dir)->dd_clones, > + dsobj, tx)); > } > } >=20 > @@ -759,7 +768,7 @@ dsl_dataset_create_sync_dd(dsl_dir_t *dd > dmu_buf_rele(dbuf, FTAG); >=20 > dmu_buf_will_dirty(dd->dd_dbuf, tx); > - dd->dd_phys->dd_head_dataset_obj =3D dsobj; > + dsl_dir_phys(dd)->dd_head_dataset_obj =3D dsobj; >=20 > return (dsobj); > } > @@ -841,20 +850,20 @@ dsl_dataset_recalc_head_uniq(dsl_dataset >=20 > ASSERT(!dsl_dataset_is_snapshot(ds)); >=20 > - if (ds->ds_phys->ds_prev_snap_obj !=3D 0) > - mrs_used =3D ds->ds_prev->ds_phys->ds_referenced_bytes; > + if (dsl_dataset_phys(ds)->ds_prev_snap_obj !=3D 0) > + mrs_used =3D = dsl_dataset_phys(ds->ds_prev)->ds_referenced_bytes; > else > mrs_used =3D 0; >=20 > dsl_deadlist_space(&ds->ds_deadlist, &dlused, &dlcomp, = &dluncomp); >=20 > ASSERT3U(dlused, <=3D, mrs_used); > - ds->ds_phys->ds_unique_bytes =3D > - ds->ds_phys->ds_referenced_bytes - (mrs_used - dlused); > + dsl_dataset_phys(ds)->ds_unique_bytes =3D > + dsl_dataset_phys(ds)->ds_referenced_bytes - (mrs_used - = dlused); >=20 > if (spa_version(ds->ds_dir->dd_pool->dp_spa) >=3D > SPA_VERSION_UNIQUE_ACCURATE) > - ds->ds_phys->ds_flags |=3D DS_FLAG_UNIQUE_ACCURATE; > + dsl_dataset_phys(ds)->ds_flags |=3D = DS_FLAG_UNIQUE_ACCURATE; > } >=20 > void > @@ -865,8 +874,9 @@ dsl_dataset_remove_from_next_clones(dsl_ > uint64_t count; > int err; >=20 > - ASSERT(ds->ds_phys->ds_num_children >=3D 2); > - err =3D zap_remove_int(mos, ds->ds_phys->ds_next_clones_obj, = obj, tx); > + ASSERT(dsl_dataset_phys(ds)->ds_num_children >=3D 2); > + err =3D zap_remove_int(mos, = dsl_dataset_phys(ds)->ds_next_clones_obj, > + obj, tx); > /* > * The err should not be ENOENT, but a bug in a previous version > * of the code could cause upgrade_clones_cb() to not set > @@ -879,16 +889,16 @@ dsl_dataset_remove_from_next_clones(dsl_ > */ > if (err !=3D ENOENT) > VERIFY0(err); > - ASSERT0(zap_count(mos, ds->ds_phys->ds_next_clones_obj, > + ASSERT0(zap_count(mos, dsl_dataset_phys(ds)->ds_next_clones_obj, > &count)); > - ASSERT3U(count, <=3D, ds->ds_phys->ds_num_children - 2); > + ASSERT3U(count, <=3D, dsl_dataset_phys(ds)->ds_num_children - = 2); > } >=20 >=20 > blkptr_t * > dsl_dataset_get_blkptr(dsl_dataset_t *ds) > { > - return (&ds->ds_phys->ds_bp); > + return (&dsl_dataset_phys(ds)->ds_bp); > } >=20 > void > @@ -900,7 +910,7 @@ dsl_dataset_set_blkptr(dsl_dataset_t *ds > tx->tx_pool->dp_meta_rootbp =3D *bp; > } else { > dmu_buf_will_dirty(ds->ds_dbuf, tx); > - ds->ds_phys->ds_bp =3D *bp; > + dsl_dataset_phys(ds)->ds_bp =3D *bp; > } > } >=20 > @@ -920,7 +930,7 @@ dsl_dataset_dirty(dsl_dataset_t *ds, dmu >=20 > ASSERT(ds->ds_objset !=3D NULL); >=20 > - if (ds->ds_phys->ds_next_snap_obj !=3D 0) > + if (dsl_dataset_phys(ds)->ds_next_snap_obj !=3D 0) > panic("dirtying snapshot!"); >=20 > dp =3D ds->ds_dir->dd_pool; > @@ -956,7 +966,7 @@ dsl_dataset_snapshot_reserve_space(dsl_d > * outside of the reservation. > */ > ASSERT(ds->ds_reserved =3D=3D 0 || DS_UNIQUE_IS_ACCURATE(ds)); > - asize =3D MIN(ds->ds_phys->ds_unique_bytes, ds->ds_reserved); > + asize =3D MIN(dsl_dataset_phys(ds)->ds_unique_bytes, = ds->ds_reserved); > if (asize > dsl_dir_space_available(ds->ds_dir, NULL, 0, TRUE)) > return (SET_ERROR(ENOSPC)); >=20 > @@ -993,7 +1003,7 @@ dsl_dataset_snapshot_check_impl(dsl_data > * We don't allow multiple snapshots of the same txg. If there > * is already one, try again. > */ > - if (ds->ds_phys->ds_prev_snap_txg >=3D tx->tx_txg) > + if (dsl_dataset_phys(ds)->ds_prev_snap_txg >=3D tx->tx_txg) > return (SET_ERROR(EAGAIN)); >=20 > /* > @@ -1219,35 +1229,38 @@ dsl_dataset_snapshot_sync_impl(dsl_datas > dsphys->ds_fsid_guid =3D unique_create(); > (void) random_get_pseudo_bytes((void*)&dsphys->ds_guid, > sizeof (dsphys->ds_guid)); > - dsphys->ds_prev_snap_obj =3D ds->ds_phys->ds_prev_snap_obj; >=20 > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >=20 >=20 From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 20:40:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32138E79; Wed, 10 Dec 2014 20:40:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CD53F48; Wed, 10 Dec 2014 20:40:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAKe5bd000406; Wed, 10 Dec 2014 20:40:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAKe4xL000352; Wed, 10 Dec 2014 20:40:04 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412102040.sBAKe4xL000352@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 10 Dec 2014 20:40:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275687 - head/share/termcap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 20:40:05 -0000 Author: ngie Date: Wed Dec 10 20:40:03 2014 New Revision: 275687 URL: https://svnweb.freebsd.org/changeset/base/275687 Log: Remove termcap entry reordering; install the file verbatim instead termcap entry reordering requires ex (which is available via usr.bin/vi), which breaks on build hosts where installworld is run with MK_VI == no (or when make delete-old is run on ^/projects/building-blocks as vi, et al, are removed on the branch when the knob is tweaked to => "no") Reordering termcap was believed to improve performance, but the file is now accessed via /etc/termcap.db, so /etc/termcap (and /usr/share/misc/termcap by proxy) access is less preferred. Reordering the file broke the historical comment <-> entry mapping as well, which could muddle the purpose of entries in the file, so it could be potentially harmful to readers in its reordered state. Discussion took place on hackers@ here: https://lists.freebsd.org/pipermail/freebsd-hackers/2014-December/046657.html Discussed with: -hackers, mp MFC after: 1 month Sponsored by: EMC / Isilon Storage Division Added: head/share/termcap/termcap - copied unchanged from r275685, head/share/termcap/termcap.src Deleted: head/share/termcap/reorder head/share/termcap/termcap.src Modified: head/share/termcap/Makefile head/share/termcap/README Modified: head/share/termcap/Makefile ============================================================================== --- head/share/termcap/Makefile Wed Dec 10 20:23:19 2014 (r275686) +++ head/share/termcap/Makefile Wed Dec 10 20:40:03 2014 (r275687) @@ -9,10 +9,7 @@ MAN= termcap.5 FILES= termcap termcap.db FILESDIR= ${BINDIR}/misc -CLEANFILES+= termcap termcap.db - -termcap: reorder termcap.src - TERM=dumb TERMCAP=dumb: ex - ${.CURDIR}/termcap.src < ${.CURDIR}/reorder +CLEANFILES+= termcap.db .include .if ${TARGET_ENDIANNESS} == "1234" Modified: head/share/termcap/README ============================================================================== --- head/share/termcap/README Wed Dec 10 20:23:19 2014 (r275686) +++ head/share/termcap/README Wed Dec 10 20:40:03 2014 (r275687) @@ -1,4 +1,6 @@ # @(#)README 8.1 (Berkeley) 6/8/93 +# +# $FreeBSD$ << 12 May 1983 >> To install this directory on your system: @@ -19,7 +21,7 @@ common and really should go near the fro Third, if you are not a super user and cannot create the directory /usr/lib/tabset, make a corresponding directory somewhere you can and add a line to reorder to globally change all /usr/lib/tabset's to your own -path name. This change is better than just changing the termcap.src file +path name. This change is better than just changing the termcap file because it makes it easier to diff it from newer distributed versions. Try to keep the source as is whenever possible, and put mungings into reorder. Copied: head/share/termcap/termcap (from r275685, head/share/termcap/termcap.src) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/termcap/termcap Wed Dec 10 20:40:03 2014 (r275687, copy of r275685, head/share/termcap/termcap.src) @@ -0,0 +1,4667 @@ +# Copyright (c) 1980, 1985, 1989, 1993 +# The Regents of the University of California. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# 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. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the University of +# California, Berkeley and its contributors. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. +# +# @(#)termcap.src 8.2 (Berkeley) 11/17/93 +# $FreeBSD$ + +# Termcap source file +# John Kunze, Berkeley +# Craig Leres, Berkeley +# +# Please submit changes via https://bugs.freebsd.org/submit/ +# +# << EOH - after reordering, above header lines survive and this line dies >> +# +# DESCRIPTION: +# This file describes capabilities of various terminals, as needed by +# software such as screen editors. It does not attempt to describe +# printing terminals very well, nor graphics terminals. Someday. +# See termcap(5) in the Unix Programmers Manual for documentation. +# +# Conventions: First entry is canonical name for model or mode, last entry +# is verbose description. Others are mnemonic synonyms for the terminal. +# +# Terminal naming conventions: +# Terminal names look like - +# Certain abbreviations (e.g. c100 for concept100) are also allowed +# for upward compatibility. The part to the left of the dash, if a +# dash is present, describes the particular hardware of the terminal. +# The part to the right can be used for flags indicating special ROM's, +# extra memory, particular terminal modes, or user preferences. +# All names should be in lower case, for consistency in typing. +# +# The following are conventionally used flags: +# rv Terminal in reverse video mode (black on white) +# 2p Has two pages of memory. Likewise 4p, 8p, etc. +# w Wide - in 132 column mode. +# pp Has a printer port which is used. +# na No arrow keys - termcap ignores arrow keys which are +# actually there on the terminal, so the user can use +# the arrow keys locally. +# +# To easily test a new terminal description, put it in $HOME/.termcap +# and programs will look there before looking in /etc/termcap. +# You can also setenv TERMPATH to a list of full pathnames (separated +# by spaces or colons) to be searched by tgetent() in the order listed. +# The TERMCAP environment variable is usually set to the termcap +# entry itself to avoid reading files when starting up a program. +# +# If you absolutely MUST check for a specific terminal (this is discouraged) +# check for the 2nd entry (the canonical form) since all other codes are +# subject to change. We would much rather put in special capabilities +# to describe your terminal than have you key on the name. +# +# Special manufacturer codes: +# A: hardcopy daisy wheel terminals +# M: Misc. (with only a few terminals) +# q: Homemade +# s: special (dialup, etc.) +# +# Comments in this file begin with # - they cannot appear in the middle +# of a termcap entry. Individual entries are commented out by +# placing a period between the colon and the capability name. +# +# To add a termcap entry under FreeBSD for a new terminal type, insert +# the entry in the appropriate location in /etc/termcap then issue this +# command: +# +# cap_mkdb -f /usr/share/misc/termcap /etc/termcap +# +# Terminfo source entries can be converted to termcap entries with the +# tic program that is part of the ncurses distribution, see the ports +# section. +# +# +# This file is to be installed with an editor script (reorder) +# that moves the most common terminals to the front of the file. +# # -------------------------------- +# +# A: DAISY WHEEL PRINTERS +# +# The A manufacturer represents Diablo, DTC, Xerox, Qume, and other Daisy +# wheel terminals until such time as termcap distinguishes between them +# enough to justify separate codes. +# This is an "experimental" entry for the SRI Agiles. +# It has been tried in a minimal way -- the Agile did not blow up! +# However, it has not been exhaustively tested. +# Anyone who tries it and finds it wanting should get in touch with: +# Ralph Keirstead (ralph@sri-unix); +# EK352; SRI International; 333 Ravenswood Avenue; Menlo Park, CA 94025 +agile|agiles|sri agiles:\ + :bs:hc:os:pl:co#132:do=^J:kb=^H:up=\E\n:\ + :hu=\E0:hd=\E9:if=/usr/share/tabset/std:is=\EE\EF\EJ: +1620|1720|450|ipsi|diablo 1620:\ + :do=^J:ct=\E2:st=\E1:ch=\E\t%i%.:\ + :if=/usr/share/tabset/xerox1720:\ + :kb=^H:le=^H:bs:co#132:hc:hu=\EU:hd=\ED:os:pt:up=\E\n: +1620-m8|1640-m8|diablo 1620 w/8 column left margin:\ + :do=^J:co#124:is=\r \E9:tc=1620: +1640|1740|630|1730|x1700|diablo|xerox|diablo 1640:\ + :if=/usr/share/tabset/xerox1730:\ + :us=\EE:ue=\ER:so=\EW:se=\E&:tc=1620: +1640-lm|1740-lm|630-lm|1730-lm|x1700-lm|diablo-lm|xerox-lm|\ + diablo 1640 with indented left margin:\ + :if=/usr/share/tabset/xerox1730-lm:\ + :co#124:us=\EE:ue=\ER:so=\EW:se=\E&:tc=1620: +# DTC 382 with VDU. Has no cd so we fake it with ce. Standout works but +# won't go away without dynamite. The terminal has tabs, but I'm getting +# tired of fighting the braindamage. If no tab is set or the terminal's +# in a bad mood, it glitches the screen around all of memory. Note that +# return puts a blank ("a return character") in the space the cursor was +# at, so we use ^P return (and thus ^P newline for newline). Note also +# that if you turn off pt and let Unix expand tabs, curses won't work +# (current version) because it doesn't turn off this bit, and cursor +# addressing sends a tab for row/column 9. What a losing terminal! I +# have been unable to get tabs set in all 96 lines - it always leaves at +# least one line with no tabs in it, and once you tab through that line, +# it completely weirds out. +dtc|ps|dtc382|382:\ + :do=^J:al=^P^Z:am:le=^H:\ + :bs:co#80:ce=^P^U:cl=20^P^]:cm=%r^P^Q%.%.:dc=^X:\ + :dl=^P^S:ei=^Pi:ho=^P^R:im=^PI:ve=^Pb:vs=^PB:pc=\177:te=20^P^]:\ + :li#24:nd=^PR:.se=^P \200:.so=^P \002^PF:us=^P \020:ue=^P \200:\ + :up=^P^L:nc:xr:xs:da:db:.pt:cr=^P^M:cd=^P^U^P^S^P^S:\ + :if=/usr/share/tabset/dtc382: +dtc300s|300|300s|dtc 300s:\ + :ct=\E3:st=\E1:do=^J:\ + :kb=^h:le=^H:bs:co#132:hc:hu=\EH:hd=\Eh:os:pt:up=^Z: +gsi:\ + :le=^H:bs:co#132:hc:hd=\Eh:hu=\EH:os:pt:up=^Z:do=^J: +# This used to have :pl: - maybe they meant :pt:? +aj830|aj832|aj|anderson jacobson:\ + :do=^J:le=^H:bs:hc:hd=\E9:hu=\E8:os:up=\E7: +# From Chris Torek Thu, 7 Nov 85 18:21:58 EST +aj510|AJ510|Anderson-Jacobson model 510:\ + :ip=.1*:so=\E"I:us=\E"U:cd=\E'P:ce=\E'L:cl=^L:cm=\E#%+ %+ :\ + :dl=2*\E&D:ue=\E"U:co#80:li#24:se=\E"I:al=2*\E&I:im=\E'I:ei=\E'J:\ + :dc=.1*\E'D:up=\EY:nd=\EX:bs:am:mi:ti=\E"N:te=\E"N:\ + :ku=\EY:kd=\EZ:kl=\EW:kr=\EX:pc=\177: +# From cbosg!ucbvax!pur-ee!cincy!chris Thu Aug 20 09:09:18 1981 +# This is incomplete, but it's a start. +5520|nec|spinwriter|nec 5520:\ + :ct=\E3:st=\E1:do=^J:kb=^h:le=^H:bs:co#132:hc:hu=\E]s\E9\E]W:\ + :hd=\E]s\n\E]W:os:pt:up=\E9: +qume5|qume|Qume Sprint 5:\ + :ct=\E3:st=\E1:do=^J:\ + :kb=^h:le=^H:bs:co#80:hc:hu=\EH:hd=\Eh:os:pt:up=^Z: +q102|qume102|Qume 102:\ + :al=\EE:am:bs:bt=\EI:\ + :cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :co#80:ct=\E3:\ + :dc=\EW:dl=\ER:do=^J:ho=^^:ic=\EQ:\ + :k0=^A@\r:k1=^AA\r:k2=^AB\r:k3=^AC\r:kd=^J:kl=^H:kr=^L:ku=^K:\ + :le=^H:li#24:ma=^K^P^L :nd=^L:\ + :se=\EG0:sg#1:so=\EG4:st=\E1:\ + :ue=\EG0:ug#1:up=^K:us=\EG8: +# From ucbvax!mtxinu!sybase!tim (Tim Wood) Fri Sep 27 10:25:24 PDT 1985 +# This entry supports line and character insert and delete, scroll up and +# down and the arrow keys. To use it, perform the following on your qvt-101 +# 1) enter SET-UP mode, select the SET 3 line; +# 2) move the cursor to the EMULATION item and hit SPACE +# until QVT-101B appears +# 3) enter SHIFT-S +# 4) exit SET-UP - the terminal is now configured +q101|qvt101|qvt-101|Qume 101 $310 special:\ + :al=\EE:am:bt=\EI:ce=\Et:cl=\E*:dc=\EW:\ + :dl=\ER:do=^J:ic=\EQ:md=\E(:me=\EG0:mh=\E):\ + :le=^H:bs:cm=\E=%+ %+ :cl=1^Z:co#80:ho=^^:li#24:ma=^K^P:nd=^L:ku=^K:\ + :vs=\EM4\040\200\200\200:mr=\EG4:ms:so=\EG4:se=\EG1: +# I suspect the xerox1720 is the same as the diablo 1620. +x1720|1700|x1750|xerox 1720:\ + :co#132:le=^H:bs:hc:os:pt:do=^J:ct=\E2:st=\E1: +# # -------------------------------- +# +# B: AT&T ATT +# +# AT&T Teletype 5410 Terminal (a.k.a. 4410) +# From: carvalho%kepler@Berkeley.EDU (Marcio de Carvalho) +# Date: Thu, 26 Feb 87 09:16:50 PST +# +# Although the 5410 supports labels, it blanks the screen after +# each label is programmed creating to much visual activity. +# To use the labels, use FL=\E[%d;00q%-16s +# +5410|4410|tty5410|att4410|AT&T Teletype 5410 terminal with 80 columns:\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ + :cm=5\E[%i%2;%2H:co#80:dc=\E[P:dl=\E[M:ic=\E[@:\ + :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ + :li#24:nd=\E[C:se=\E[m:so=\E[2;7m:sr=\EM:\ + :ue=\E[m:up=\E[A:us=\E[4m:EE=\E[m:BO=\E[0;7m:DS=\E[2m:\ + :KM=/usr/lib/ua/kmap.5410:is=\E[0m^O\E[?6l:kn#8:\ + :k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k4=\EOg:k6=\EOh:\ + :k7=\EOi:k8=\EOj:ko=nd,up,ho: +# AT&T 630 MTG DMD from muller%sdcc7@ucsd.edu (Keith Muller) +att630|dmd630|ATT630|630DMD|630dmd|630MTG|AT&T 630 windowing terminal:\ + :am:da:db:ms:bs:co#80:it#8:li#60:lm#0:\ + :up=\E[A:do=\E[B:nd=\E[C:le=\b:UP=\E[%dA:DO=\E[%dB:RI=\E[%dC:\ + :LE=\E[%dD:cm=\E[%i%d;%dH:ho=\E[H:bt=\E[Z:\ + :sf=\n:sr=\EM:SF=\E[%dS:SR=\E[%dT:us=\E[4m:ue=\E[m:so=\E[7m:se=\E[m:\ + :mr=\E[7m:mh=\E[2m:mb=\E[5m:me=\E[m:ce=\E[K:cd=\E[J:cl=\E[H\E[J:\ + :dc=\E[P:dl=\E[M:al=\E[L:DC=\E[%dP:DL=\E[%dM:AL=\E[%dL:\ + :ic=\E[@:IC=\E[%d@:sc=\E7:rc=\E8:i2=\E[m:rs=\Ec:\ + :pf=\E[?4i:po=\E[?5i:\ + :kb=\b:kC=\E[2J:kh=\E[H:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D: +dmd630-24|att630-24|ATT630-24|630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines:\ + :li#24:tc=att630: +dmd615|att615|ATT615|615DMD|615MTG|AT&T 615 windowing terminal 80 column:\ + :li#24:tc=att630: +dmd615-w|att615-w|ATT615-w|615DMD-w|615MTG-w|AT&T 615 windowing terminal 132 column:\ + :li#24:co#132:tc=att630: +dmd620|att620|ATT620|620DMD|620MTG|AT&T 620 windowing terminal 80 column:\ + :li#24:tc=att630: +dmd620-w|att620-w|ATT620-w|620DMD-w|620MTG-w|AT&T 620 windowing terminal 132 column:\ + :li#24:co#132:tc=att630: +# AT&T Teletype 5420 Terminal (a.k.a. 4415) June 5, 1985 +5420|4415|tty5420|att4415|AT&T Teletype 5420 terminal:\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ + :cm=\E[%i%2;%2H:co#80:dc=\E[P:dl=\E[M:im=\E[4h:ei=\E[4l:\ + :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ + :li#24:nd=\E[C:se=\E[m:so=\E[2;7m:sr=\EM:\ + :ue=\E[m:up=\E[A:us=\E[4m:EE=\E[m:BO=\E[0;7m:DS=\E[2m:\ + :KM=/usr/lib/ua/kmap.5420:\ + :is=\E[0m^O\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[25;1j\212\E[8;0j\E[9;0j\E[10;0j\E[19;1j:\ + :db:mi:pt:kn#8:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:\ + :k7=\EOi:k8=\EOj:ve=\E[11;0j:\ + :vs=\E[11;1j:ko=bt,nd,up,dc,dl,ho,im,al: +# AT&T Teletype 5425 Terminal (a.k.a 4425) June 5, 1985 +5425|4425|tty5425|att4425|AT&T Teletype 5425:\ + :FL=\E[%d;00q%-16s\E~:FE=\E|:KM=/usr/lib/ua/kmap.5425:\ + :is=\E[0m^O\E[1;2;3;4;6l\E[12;13;14;20l\E[?6l\E[?7h\E[4i\E[9;0j\E[10;0j\E[11;0j\E[21;1j\E[25;1j\212:\ + :ve=\E[12;0j:vs=\E[12;1j:tc=5420: +t4|4420|tty4420|Teletype 4420:\ + :vs=\ER:ve=\ER:am:da:db:mi:cr=\EG:\ + :nl=\EG\EB:li#23:\ + :co#80:cl=\EH\EJ:cd=\EJ:cm=\EY%+ %+ :\ + :bs:up=\E7:do=\EB:nd=\EC:al=\EL:\ + :dl=\EM:dc=\EP:ic=\E\136:sf=\EH\EM\EY5 :sr=\ET:kb=^H: +pc6300plus|6300|6300plus:\ + :al=\E[1L:am:bs:cd=\E[0J:ce=\E[0K:cl=\E[2J\E[H:cm=\E[%i%2;%2H:co#80:\ + :dc=\E[1P:dl=\E[1M:do=\E[B:ho=\E[H:\ + :ic=\E[1@:kb=\10:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:li#24:\ + :k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:\ + :k9=\EOk:k10=\EOu:nd=\E[C:se=\E[m:so=\E[7m:ue=\E[m:up=\E[A:us=\E[4m:\ + :EE=\E[m:BO=\E[0;7m:CV=\E[=C:CI=\E[=1C:KM=/usr/lib/ua/kmap.s5: +# AT&T 6386 decompiled and hacked from SVR3.1 terminfo +# From: caron@polya.Stanford.EDU (Ilan G. Caron) +# Problems: (1) The mode lines are screwed up - they're not in standout +# (an extraneous ESC-RD sequence is prepended to each mode line). +# (2) Cursor addressing into the mode line is often off-by-one, +# in particular, when the percentage indicator is updated. +# (3) When reverting to a single window (C-x 1), the display +# needs refreshing (an extraneous ESC-S seems to be generated). +# (The above 3 might be manifestations of the same problem). +# (4) Deletes sometime don't, especially when done fast - does this +# suggest that I need to pad something? +AT386|at386|386AT|386at|at/386 console:\ + :am:bw:eo:xo:Co#8:NC#3:co#80:li#25:pa#64:kn#6:\ + :@7=\E[Y:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:\ + :F1=\EOZ:F2=\EOA:IC=\E[%d@:LE=\E[%dD:RI=\E[%dC:\ + :SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\ + :ac=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~:\ + :ae=\E[10m:al=\E[1L:as=\E[12m:bl=^G:cd=\E[J:ce=\E[K:\ + :cl=\E[2J\E[H:cm=\E[%i%2;%2H:cr=\r:dc=\E[P:dl=\E[1M:\ + :do=\E[B:ho=\E[H:ic=\E[1@:is=\E[0;10;39m:k1=\EOP:\ + :k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:\ + :k8=\EOW:k9=\EOX:k;=\EOY:kB=^]:kC=\E[2J:kD=\E[P:\ + :kI=\E[@:kM=\E0:kN=\E[U:kP=\E[V:kb=\b:kd=\E[B:kh=\E[H:\ + :kl=\E[D:kr=\E[C:ku=\E[A:le=\E[D:mb=\E[5m:md=\E[1m:\ + :me=\E[0;10m:mk=\E[9m:mr=\E[7m:nd=\E[C:op=\E[0m:\ + :se=\E[m:sf=\E[S:so=\E[43;30m:ta=\t:ue=\E[m:up=\E[A:\ + :sr=\E[T:TC=\E[%d@:IC=\E[%d@:\ + :us=\E[4m:vb=^G:bc=\E[D: +s4|PC7300|unixpc|pc7300|7300|3b1|Safari 4:\ + :so=\E[2;7m:DS=\E[2m:XS=\E[9m:KM=/usr/lib/ua/kmap.s4:tc=pc6300plus: +# AT&T Teletype 610 Terminal +b610|610|610bct|tty610:\ + :CV=\E[25h:CI=\E[25l:KM=/usr/lib/ua/kmap.s4:\ + :FL=\E[%d;00q%-16s\E[0p:FE=\E[2p:cl=\E[1;1H\E[J:\ + :is=\E[0m^O\E[25;1|^J\E[8;0|\E[4;13;20l\E[?5l\E[12h\E[?7h\E[?4i:\ + :ve=\E[?12l:vs=\E[?12h:tc=5420: +# # -------------------------------- +# +# C: CONTROL DATA +# +cdc456|cdc:\ + :do=^J:li#24:co#80:cl=^Y^X:nd=^L:up=^Z:le=^H:bs:\ + :cm=\E1%+ %+ :ho=^Y:al=\E\114:dl=\E\112:ce=^V:cd=^X:am: +cdc456tst:\ + :do=^J:li#24:co#80:cl=^y^x:le=^H:bs:cm=\E1%+ %+ :am: +# # -------------------------------- +# +# D: DATAMEDIA +# +dm1520|dm1521|1521|1520|datamedia 1520:\ + :do=^J:am:le=^H:bs:cd=^K:ce=^]:cl=^L:cm=^^%r%+ %+ :co#80:ho=^Y:\ + :ku=^_:kd=^J:kl=^H:kr=^\:kh=^Y:\ + :li#24:nd=^\:up=^_:xn:ma=^\ ^_^P^YH:pt: +dm2500|datamedia2500|2500|datamedia 2500:\ + :do=^J:al=15^P\n^X^]^X^]:le=^H:bs:ce=^W:cl=^^^^\177:\ + :cm=^L%r%n%.%.:co#80:dc=10*^P\b^X^]:dl=10*^P^Z^X^]:\ + :dm=^P:ed=^X^]:ei=10\377\377^X^]:ho=^B:ic=10*^P^\^X^]:\ + :im=^P:li#24:nc:nd=^\:pc=\377:so@=^N:se=^X^]:up=^Z: +dm3025|datamedia 3025a:\ + :MT:is=\EQ\EU\EV:do=^J:\ + :al=130\EP\n\EQ:le=^H:bs:cd=2\EJ:ce=\EK:cl=2\EM:cm=\EY%r%+ %+ :\ + :co#80:dc=6\b:dl=130\EP\EA\EQ:dm=\EP:ed=\EQ:ei=\EQ:ho=\EH:\ + :im=\EP:ip=6:li#24:nd=\EC:pt:so=\EO1:se=\EO0:up=\EA: +3045|dm3045|datamedia 3045a:\ + :is=\EU\EV:do=^J:\ + :am:le=^H:bs:cd=2\EJ:ce=\EK:cl=2\EM:cm=\EY%r%+ %+ :co#80:\ + :dc=6\EB:ei=\EP:ho=\EH:im=\EP:ip=6:\ + :k0=\Ey\r:k1=\Ep\r:k2=\Eq\r:k3=\Er\r:k4=\Es\r:\ + :k5=\Et\r:k6=\Eu\r:k7=\Ev\r:k8=\Ew\r:k9=\Ex\r:\ + :kh=\EH:ku=\EA:kr=\EC:li#24:nd=\EC:pc=\177:pt:eo:ul:up=\EA:xn: +# dt80/1 is a vt100 lookalike, but it doesn't seem to need any padding. +dt80|dmdt80|dm80|datamedia dt80/1:\ + :do=^J:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=%i\E[%d;%dH:ho=\E[H:\ + :nd=\E[C:sr=\EM:so=\E[7m:se=\E[m:up=\E[A:us=\E[4m:ue=\E[m:tc=vt100: +# except in 132 column mode, where it needs a little padding. +# This is still less padding than the vt100, and you can always turn on +# the ^S/^Q handshaking, so you can use vt100 flavors for things like +# reverse video. +dt80w|dmdt80w|dm80w|datamedia dt80/1 in 132 char mode:\ + :do=^J:cd=20\E[0J:co#132:ce=20\E[0K:\ + :cm=5\E[%i%d;%dH:cl=50\E[H\E[2J:up=5\E[A:tc=dmdt80: +# # -------------------------------- +# +# H: HAZELTINE +# +# Since nd is blank, when you want to erase something you +# are out of luck. You will have to do ^L's a lot to +# redraw the screen. h1000 is untested. It doesn't work in +# vi - this terminal is too dumb for even vi. (The code is +# there but it isn't debugged for this case.) +h1000|hazeltine 1000:\ + :le=^H:bs:ho=^K:cl=^L:nd= :co#80:li#12:do=^J: +# Note: the h1552 appears to be the first Hazeltine terminal which +# is not braindamaged. It has tildes and backprimes and everything! +# Be sure the auto lf/cr switch is set to cr. +h1552|hazeltine 1552:\ + :do=^J:al=\EE:dl=\EO:k1=\EP:l1=blue:k2=\EQ:\ + :l2=red:k3=\ER:l3=green:tc=vt52: +h1552rv|hazeltine 1552 reverse video:\ + :do=^J:so=\ES:se=\ET:tc=h1552: +# From cbosg!ucbvax!pur-ee!cincy!chris Thu Aug 20 09:09:18 1981 +h1420|hazeltine 1420:\ + :do=^J:le=^H:bs:am:li#24:co#80:al=\E^Z:dl=\E^S:cd=\E^X:cl=\E\034:\ + :up=\E^L:nd=^P:ce=\E^O:ta=^N:cm=\E^Q%r%.%+ :so=\E\037:se=\E^Y: +# New "safe" cursor movement (11/87) from cgs@umd5. Prevents freakout with +# out-of-range args and tn3270. No hz since it needs to receive ~'s. +h1500|hazeltine 1500:\ + :al=40~^Z:am:bs:cd=10~^X:ce=~^O:cl=~^\:cm=~^Q%r%>^^ %+`%+`:\ + :co#80:dl=40~^S:do=~^K:ho=~^R:kh=~^R:kr=^P:ku=~^L:kd=^J:kl=^H:\ + :le=^H:li#24:nd=^P:so=~^_:se=~^Y:up=~^L:.cm=~^Q%r%.%.: +# h1510 assumed to be in sane escape mode. Else use h1500. +h1510|hazeltine 1510:\ + :do=^J:al=\E^Z:am:le=^H:bs:cd=\E^X:ce=\E^O:cl=\E^\:cm=\E^Q%r%.%.:\ + :co#80:dl=\E^S:do=\E^K:hz:li#24:nd=^P:.se=\E^_:.so=\E^Y:up=\E^L: +h1520|hazeltine 1520:\ + :do=^J:al=~^Z:am:le=^H:bs:cd=~^X:ce=~^O:cl=~\034:cm=~^Q%r%.%.\200:\ + :co#80:dl=~^S:do=~^K:hz:li#24:nd=^P:se=~^Y:so=~\037:up=~^L:ho=~^R: +# Note: h2000 won't work well because of a clash between upper case and ~'s. +h2000|hazeltine 2000:\ + :do=^J:al=6~^z:am:le=^H:bs:cl=6~^\:cm=~^q%r%.%.:co#74:\ + :dl=6~^s:ho=~^r:li#27:nc:pc=\177: +# Hazeltine esprit entries from Univ of Utah Tue Feb 1 06:39:37 1983 +# J.Lepreau, lepreau@utah-cs, harpo!utah-cs!lepreau +esprit|hazeltine esprit:\ + :al=40\E^Z:bs:cd=5\E^X:ce=\E^O:cl=\E^\:cm=\E^Q%r%>^^ %+`%+`:co#80:\ + :dl=40\E^S:do=\E^K:ho=\E^R:li#24:nd=^P:se=\E^Y:so=\E^_:up=\E^L: +esprit-am|hazeltine esprit auto-margin:\ + :am:tc=esprit: +# # -------------------------------- +# +# I: IBM +# +# ibm61 and ibm63 from Warren Gish (cswarren@violet.berkeley.edu). +# installed 12-17-86. +# 3161 only opens a new line if a null line exists on the screen. +# To ensure a null line exists, an SBA is performed, positioning the +# Buffer Address in column 0 of the last line. The last line is then +# cleared to nulls, BA mode is canceled, and the new line is opened +# at the cursor position. +ibm61|ibm3161|3161|IBM 3161-11:\ + :am:bs:bw:cl=\EL:li#24:co#80:cd=\EJ:al=\EX7 \EI\E Z\EN:\ + :ce=\EI:cm=\EY%+\040%+\040:nd=\EC:up=\EA:do=\EB:\ + :dl=\EO:dc=\EQ:kd=\EB:ku=\EA:kl=\ED:kr=\EC:kh=\EH:\ + :us=\E4\102:ue=\E4\100:so=\E4\110:se=\E4\100: +# From seth@sirius.ctr.columbia.edu Sun May 20 11:02:34 1990 +ibm3163|ibm63|i3163|3163|IBM 3163:\ + :al=\EN:am:bs:bt=\E2:cd=\EJ:ce=\EI:cl=\EL:\ + :cm=\EY%+\040%+\040:co#80:ct=\E 1:dc=\EQ:\ + :dl=\EO:do=\EB:ds=\E#\072:es:fs=\E=:ho=\EH:\ + :hs:ic=\EP:kA=\EN:kB=\E2:kC=\EQ:\ + :kD=\EQ:kE=\EI:kI=\EI:kL=\EO:kS=\EJ:\ + :kb=^H:kd=\EB:kl=\ED:kr=\EC:ku=\EA:kh=\EH:\ + :le=\ED:li#24:mb=\E4D:md=\E4H:me=\E4@:\ + :mk=\E4P:mr=\E4A:nd=\EC:\ + :ds=\E#\::es:fs=\E=\E#;:hs:ts=\E=:ws#80:\ + :se=\E4@:so=\E4I:ue=\E4@:up=\EA:us=\E4B: +ibm|ibm3101|3101|i3101|IBM 3101-10:\ + :do=^J:ct=\EH:st=\E0:\ + :if=/usr/share/tabset/ibm3101:\ + :am:le=^H:bs:cl=\EK:li#24:co#80:nd=\EC:up=\EA:cd=\EJ:ce=\EI:\ + :kd=\EB:kl=\ED:kr=\EC:ku=\EA:ho=\EH:cm=\EY%+\40%+\40:pt: +ibm327-789|ibm-3277-2|ibm-3278-2|ibm-3278-3|ibm-3278-4|ibm-3278-5|ibm-3279-2|ibm-3279-3:\ + :tc=ibm327-56: +ibm327-56|ibm-3275-2|ibm-3276-2|ibm-3276-3|ibm-3276-4|line mode IBM 3270 style:\ + :gn:ce=\r:cl=\r\n:ho=\r: +ibm-apl|apl|IBM apl terminal simulator:\ + :li#25:tc=dm1520: +# ibmapa* and ibmmono entries come from ACIS 4.3 distribution +rtpc|ibmapa16|ibm6155|IBM 6155 Extended Monochrome Graphics Display:\ + :ts=\Ej\EY@%+ \Eo:ds=\Ej\EY@\40\EI\Ek:li#32:tc=ibmconsole: +# Advanced Monochrome (6153) and Color (6154) Graphics Display: +ibmapa8c|ibmapa8|ibm6154|ibm6153|IBM 6153/4 Advanced Graphics Display:\ + :ts=\Ej\EY?%+ \Eo:ds=\Ej\EY?\40\EI\Ek:li#31:tc=ibmconsole: +ibmapa8c-c|ibm6154-c|IBM 6154 Advanced Color Graphics Display color termcap:\ + :ts=\Ej\EY?%+ \Eo:ds=\Ej\EY?\40\EI\Ek:li#31:mh=\EF\Ef7;:tc=ibmega-c: +ibmmono|ibmconsole|ibm5151|IBM workstation monochrome:\ + :se=\Ez:so=\EZ:sr=\EA:al=\EL:dl=\EM:\ + :kb=^H:us=\EW:ue=\Ew:\ + :k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:k6=\EP:k7=\EQ:k8=\ER:k9=\EY:\ + :k0=\E<:I0=f10:kI=\000:kh=\EH:kR=\EG:kP=\Eg:kF=\EE:kN=\EE:\ + :md=\EZ:me=\Ew\Eq\Ez\EB:mk=\EF\Ef0;\Eb0;:mr=\Ep:\ + :ts=\Ej\EY8%+ \Eo:fs=\Ek:ds=\Ej\EY8\40\EI\Ek:es:hs:sb:tc=ibm3101: +ibmega-c|ibm5154-c|IBM Enhanced Color Display color termcap:\ + :se=\EB:so=\EF\Ef3;:ue=\EB:us=\EF\Ef2;:tc=ibmconsole: +# from marc pawliger--marc@ibminet.awdpa.ibm.com +# also in /usr/lpp/bos/bsdsysadmin. +hft-c|ibm8512|ibm8513|IBM High Function Terminal:\ + :co#80:li#25:am:ht:\ + :cm=\E[%i%d;%dH:ti=\E[20;4l\E[?7h\Eb:te=\E[20h:\ + :nd=\E[C:up=\E[A:do=^J:ho=\E[H:\ + :ec=\E[%dX:\ + :cl=\E[H\E[J:cd=\E[J:el=\E[K:\ + :AL=\E[%dL:DL=\E[%dM:al=\E[L:dl=\E[M:\ + :im=\E[4h:ei=\E[4l:mi:\ + :dm=\E[4h:ed=\E[4l:\ + :so=\E[7m:se=\E[m:ul=\E[4m:ue=\E[m:ms:\ + :md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:\ + :as=^N:ae=^O:sc=\E[s:rc=\E[u:\ + :kb=\E[D:kf=\E[C:ku=\E[A:kd=\E[B:kh=\E[H:\ + :k1=\E[001q:k2=\E[002q:k3=\E[003q:k4=\E[004q:k5=\E[005q:\ + :k6=\E[006q:k7=\E[007q:k8=\E[008q:k9=\E[009q:k0=\E[010q:\ + :is=\Eb\E[m^O\E[?7h:rs=\Eb\E[m^O\E[?7h\E[H\E[J: +hft|AIWS High Function Terminal:\ + :al=\E[L:cr=^M:do=^J:sf=^J:bl=^G:am:le=^H:cd=\E[J:\ + :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:co#80:li#25:\ + :dc=\E[P:dl=\E[M:ho=\E[H:\ + :ic=\E[@:im=\E6:ei=\E6:\ + :md=\E[1m:mr=\E[7m:mb=\E[5m:mk=\E[8m:me=\E[0m:\ + :ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:kh=\E[H:kb=^H:\ + :nd=\E[C:ta=^I:up=\E[A:xo:\ + :ue=\E[m:us=\E[4m:se=\E[m:so=\E[7m:\ + :kP=\E[159q:kN=\E[153q:\ + :k1=\E[001q:k2=\E[002q:k3=\E[003q:k4=\E[004q:\ + :k5=\E[005q:k6=\E[006q:k7=\E[007q:k8=\E[008q:\ + :k9=\E[009q:ka=\E[010q: +# From pryor@math.berkeley.edu +ibm5081|ibmmpel|IBM 5081 1024x1024 256/4096 color display:\ + :ts=\Ej\EYA%+ \Eo:fs=\Ek:ds=\Ej\EYA\40\EI\Ek:es:hs:\ + :li#33:tc=ibmconsole: +ibm5081-c|ibmmpel-c|IBM 5081 1024x1024 256/4096 enhanced color display:\ + :ts=\Ej\EYA%+ \Eo:fs=\Ek:ds=\Ej\EYA\40\EI\Ek:es:hs:\ + :li#33:tc=ibmega-c: +# ibm3151 and ibm3151-25 are modified from a Usenet posting +# from http://www.cs.utk.edu/~shuford/terminal/ibm_3161.termcap.txt +# Newsgroups: comp.terminals Message-ID: <1rkqgnINNdso@uwm.edu> +ibm3151|ibm3152|ibm3162|Ibm3162|ibm3151-pc:\ + :am:mi:ms:\ + :co#80:li#24:kn#9:\ + :cd=\EJ:ce=\EI:cl=\EH\EJ:cm=\EY%+ %+ :dc=\EQ:dl=\EO:\ + :ho=\EH:k1=\Ea\n:k2=\Eb\n:k3=\Ec\n:k4=\Ed\n:k5=\Ee\n:\ + :k6=\Ef\n:k7=\Eg\n:k8=\Eh\n:k9=\Ei\n:kb=\b:kd=\EB:\ + :kh=\EH:kl=\ED:kr=\EC:ku=\EA:nd=\EC:se=\E4>b:so=\E4!a:\ + :te=\E>A:ti=\E>B:ue=\E4=b:up=\EA:us=\E4"a:bc=\ED:\ + :U8=\Eb:so=\E4!a:\ + :te=\E>A:ti=\E>B:ue=\E4=b:up=\EA:us=\E4"a:bc=\ED:\ + :U8=\E\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\ + :ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:kb=^H:\ + :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:vt#3:xn:\ + :sc=\E7:rc=\E8:cs=\E[%i%d;%dr: +# luna's BMC terminal emulator +luna|luna68k|LUNA68K Bitmap console:\ + :li#46:co#88:tc=ansi: +# SCO console and SOS-Syscons console for 386bsd +scoansi|SCO Extended ANSI standard crt:\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:co#80:\ + :dc=\E[P:dl=\E[M:do=\E[B:bt=\E[Z:ho=\E[H:ic=\E[@:li#25:\ + :nd=\E[C:pt:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:up=\E[A:\ + :k1=\E[M:k2=\E[N:k3=\E[O:k4=\E[P:k5=\E[Q:k6=\E[R:\ + :k7=\E[S:k8=\E[T:k9=\E[U:k0=\E[V:\ + :kb=^h:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:eo:sf=\E[S:sr=\E[T:\ + :mb=\E[5m:md=\E[1m:me=\E[m:\ + :GS=\E[12m:GE=\E[10m:GV=\63:GH=D:\ + :GC=E:GL=\64:GR=C:RT=^J:G1=?:G2=Z:G3=@:G4=Y:G5=;:G6=I:G7=H:G8=<:\ + :GU=A:GD=B:\ + :CW=\E[M:NU=\E[N:RF=\E[O:RC=\E[P:\ + :WL=\E[S:WR=\E[T:CL=\E[U:CR=\E[V:\ + :HM=\E[H:EN=\E[F:PU=\E[I:PD=\E[G:\ + :Gc=N:Gd=K:Gh=M:Gl=L:Gu=J:Gv=\072: +trs80|trs-80|radio shack trs-80 Model I:\ + :do=^J:am:le=^H:bs:co#64:li#16: +d800|Direct 800/A:\ + :do=^J:co#80:li#24:am:cl=\E[1;1H\E[2J:le=^H:bs:cm=\E[%i%d;%dH:\ + :nd=\E[C:up=\E[A:ce=\E[K:cd=\E[J:\ + :so=\E[7m:se=\E[0m:us=\E[4m:ue=\E[0m:xs:vs=\E[>12l:ve=\E[>12h:\ + :sf=\ED:sr=\EM:da:db:as=\E[1m:ae=\E[0m:ms:pt:\ + :kl=\E[D:kr=\E[C:ku=\E[A:kd=\E[B:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ + :k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW: +vc404|volker-craig 404:\ + :do=^J:am:le=^H:bs:cd=40^W:ce=20^V:cl=40^X:cm=^P%+ %+ :co#80:\ + :ho=40^Y:kd=^J:kl=^H:kr=^U:ku=^Z:li#24:ma=^Z^P^U :nd=^U:up=^Z: +vc404-s|volker-craig 404 w/standout mode:\ + :do=^J:se=^O:so=^N:tc=vc404: +vc404-na|volker-craig 404 w/no arrow keys:\ + :ma@:kr@:ku@:tc=vc404: +vc404-s-na|volker-craig 404 w/standout mode and no arrow keys:\ + :se=^O:so=^N:tc=vc404-na: +# From: wolfgang@cs.sfu.ca +vc414|vc414h|Volker-Craig 414H in sane escape mode.:\ + :am:ic=\E\072:dc=\E\063:so=\E\031:se=\E\037:\ + :kl=^H:kr=^P:ku=\E^L:kd=\E^K:kh=\E^R:\ + :k0=\EA:k1=\EB:k2=\EC:k3=\ED:k4=\EE:k5=\EF:k6=\EG:k7=\EH:\ + :l0=PF1:l1=PF2:l2=PF3:l3=PF4:l4=PF5:l5=PF6:l6=PF7:l7=PF8:\ + :al=40\E^Z:bs:cd=\E^X:ce=10\E^O:cl=40\E^\:co#80:\ + :do=\E^K:li#24:nd=^P:up=\E^L: +vc414h-noxon:\ + :dl=40\E^S:cm=40\E^Q%r%.%.:ho=\E^R:\ + :tc=vc414h: +# missing in vc303a and vc303 descriptions: they scroll 2 lines at a time +vc303a|vc403a|volker-craig 303a:\ + :do=^J:am:le=^H:bs:ce=20^V:cl=40^X:co#80:ho=40^Y:kd=^J:kl=^H::kr=^U:\ + :ku=^Z:li#24:ll=^P^@W:nd=^U:ns:up=^Z: +vc303|vc103|vc203|volker-craig 303:\ + :do=^J:am:le=^H:bs:cl=40^L:co#80:ho=40^K:kd=^J:kl=^H:\ + :kr=^I:ku=^N:li#24:ll=^O\200W:nd=^I:ns:up=^N: +# Test version for Falco ts-1. See "arpavax.hickman@ucb" for info +falco|ts1|ts-1|falco ts-1:is=\Eu\E3:\ + :do=^J:al=\EE:am:bs:ce=\ET\EG0^h:cm=\E=%+ %+ :cl=\E*:cd=\EY:co#80:\ + :dc=\EW:dl=\ER:ei=\Er:ho=^^:im=\Eq:k0=^A0\r:kd=^J:kl=^H:pt:\ + :kr=^L:ku=^K:li#24:nd=^L:se=\Eg0:so=\Eg1:up=^K:us=\Eg1:ue=\Eg0: +falco-p|falco ts-1sp|falco with paging option:\ + :is=\EZ\E3\E_c:\ + :al=\EE:am:bs:ce=\ET\EG0^H\Eg0:cl=\E*:cd=\EY:co#80:dc=\EW:\ + :dl=\ER:kd=\E[B:kl=\E[D:ei=\Er:im=\Eq:pt:db:\ + :kr=\E[C:ku=\E[A:li#24:nd=\E[C:se=\Eg0:so=\Eg4:\ + :up=\E[A:us=\Eg1:ti=\E_d:te=\E_b:\ + :ue=\Eg0:do=\E[B:cm=\E=%+ %+ :ms:kh=\E[H:da:mi:bt=\EI: +# NOTE: bg can scroll, it just would rather not (ns) - rwells 3/13/81. +# (Shouldn't you take out ns and put in an nl instead? - mrh) +bitgraph|BBN BitGraph terminal:\ + :do=^J:al=2*\E[L:bs:cd=150\E[J:ce=2\E[K:\ + :cl=150\E[H\E[J:cm=%i\E[%d;%dH:co#85:\ + :dl=2*\E[M:k0=\EP:k1=\EQ:k2=\ER:k3=\ES:kd=\EB:ke=\E>:kl=\ED:kr=\EC:\ + :ks=\E=:ku=\EA:li#64:nd=\E[C:ns:pt:se=\E[0m:so=\E[7m:up=\E[A:sf=280\n: +d132|datagraphix|datagraphix 132a:\ + :do=^J:co#80:li#30:cl=^l:ho=\Et:da:db:sf=\Ev:sr=\Ew:\ + :up=\Ek:nd=\El:vs=\ex:ve=\Em\En:\ + :al=\E3:ic=\E5:dc=\E6:in:ic=\E5: +soroc|Soroc 120:\ + :do=^J:cd=\EY:ce=\ET:cl=2\E*:ma=^K^P^R^L^L :\ + :kl=^H:ku=^K:kr=^L:kd=^J:tc=adm3a: +# From: ma179abu%sdcc3@sdcsvax.ucsd.edu (Bill Houle) +iq140|soroc140|Soroc IQ140 with inverse & dim:\ + :ic=\EQ:dc=\EW:al=\EE:dl=\ER:ce=\ET:cd=\EY:cl=\E+:cm=\E=%+ %+ :\ + :up=^K:do=^J:le=^H:nd=^L:ho=^^:ta=\Ei:ma=^Kk^Jj^Hh^Ll^^h:am:bs:\ + :co#80:li#24:kb=^H:kh=^^:ku=^K:kd=^J:kl=^H:kr=^L:\ + :k0=^AI:k1=^A@:k2=^AA:k3=^AB:k4=^AC:k5=^AD:k6=^AE:k7=^AF:\ + :k8=^AG:k9=^AH:se=\E^?:so=\E^?:us=\E):ue=\E(: +# tec is untested, and taken from CB/Unix virtual terminal driver. +# Upper case terminal, uses lower case for control sequences!!! +# The driver shows the C ~ operator used on CM coordinates. +# Without the terminal in front of me, I can't figure out what's +# going on, so I've dotted out the cm. Note there is no ~ in tgoto. +tec400|tec scope:\ + :do=^J:.cm=l%r%.%.:up=x:do=h:nd=g:le=w:ho=i:so={:se=|:sg#1:\ + :cl=f:al=e:dl=u:ic=d:dc=t:ce=c:cd=s: +# From ucbvax!geoff Mon Sep 21 21:15:45 1981 +# This entry has been tested. +tec500|tec 500:\ + :do=^J:am:le=^H:bs:cm=\E=%+ %+ :cl=20^Z:\ + :co#80:ho=^^:li#24:nd=^L:up=^K:so=^]:se=^\: +# I would appreciate more information on this terminal, such as the +# manufacturer and the model number. There are too many tecs in here. +tec:\ + :li#24:co#80:cl=^l:up=^k:nd=\037:\ + :am:le=^H:bs:ho=\036:ma=^K^P^_ :do=^J: +teletec|Teletec Datascreen:\ + :do=^J:am:le=^H:bs:co#80:cl=^l:ho=^^:li#24:nd=^_:up=^k: +# From cbosg!ucbvax!SRC:george Fri Sep 11 22:38:32 1981 +ampex|d80|dialogue|dialogue80|ampex dialogue 80:\ + :ct=\E3:st=\E1:do=^J:is=\EA:us=\El:ue=\Em:\ + :am:le=^H:bs:pt:cl=75\E*:cm=\E=%+ %+ :\ + :al=5*\EE:bt=\EI:ic=\EQ:dl=5*\ER:dc=\EW:\ + :ce=\Et:cd=\Ey:so=\Ej:se=\Ek:li#24:co#80:nd=^L:up=^K: +# From: atd!dsd!rcb@ucbvax.berkeley.edu (Richard Bascove) +a210|210|ampex210|ampex a210:\ + :am:bs:cl=\E*:cm=\E=%+ %+ :al=\EE:bt=\EI:ic=\EQ:\ + :dl=\ER:dc=\EW:ho=^^:xn:ce=\Et:cd=\Ey:li#24:co#80:nd=^L:up=^K:\ + :pt:if=/usr/share/tabset/std:is=\EC\Eu\E'\E(\El\EA\E%\E{\E.2\EG0\Ed\En:\ + :kl=^H:kr=^L:kd=^V:ku=^K:kh=^^:hs:ts=\E.0\Eg\E}\Ef:fs=\E.2:\ + :kn#10:k0=^A0^M:k1=^A1^M:k2=^A2^M:k3=^A3^M:k4=^A4^M:k5=^A5^M:\ + :vb=\EU\EX\EU\EX\EU\EX\EU\EX:k6=^A6^M:k7=^A7^M:k8=^A8^M:k9=^A9^M:\ + :so=\EG4:se=\EG0:us=\EG8:ue=\EG0:ug#1:sg#1: +digilog|333|digilog 333:\ + :le=^H:bs:co#80:ce=\030:ho=^n:li#16:nd=^i:up=^o:do=^J: +ep48|ep4080|execuport 4080:\ + :am:le=^H:bs:os:co#80:hu=\036:hd=\034:do=^J: +ep40|ep4000|execuport 4000:\ + :am:le=^H:bs:os:co#136:hu=\036:hd=\034:do=^J: +terminet1200|terminet300|tn1200|tn300|terminet|GE terminet 1200:\ + :co#120:hc:os:do=^J: +# AED 512 +# by giles Billingsley (gilesb%ucbcad@berkeley) +# rewritten 8/82 for newer AEDs and better operation of vi,etc. +aed|AED|aed512|AED512|aed 512:\ + :db:co#64:li#40:cl=^L:bs:nd=\Ei0800\001:\ + :up=^K:ve=\E\E\E\E\E\E\E\072004=000200??\001:\ + :vb=\EK0001??0000K0001202080\001:\ + :us=\E\07200>8000140\001:ue=\E\07200>8000100\001:\ + :uc=\Ei???>l0800i0102\001:\ + :ti=\E\07200>8000140{<04<0??00001010L<0\072004=0002??00\001:\ + :te=\E\07200>8000100{804<0??00001000L80\072004=000200??\001:\ + :so=\E\07200>8000140[80C00\001:se=\E[00C80\001:\ + :is=\EG1MMM.`40K0001202080K8001????00^L\EC80L80{80^L\EK010100????K0601??0000c818100\EG1HHH.\07210000019A27FD006A280D002A200A52429FE8524861086118612861360N031B4C3F3F1800N041B0C1B4C38301800N001B3B313030301800N011B3B313030341800N021B3B313030381800N050800N061B3B313335301800\07211000015A58E8D5011A58F8D5111A5908D5211A5918D531160\07212000015AD5011858EAD5111858FAD52118590AD5311859160\0721300004B2071C5858E0A18658E0A0A858EA900858F268FA5278590A50A29018591A9F51865908590A90165918591A59038E58E8590A591E58F290185912071C5180A0A0A0901858EA900858F268F60\0721350000BA9472031DEA9502031DE60\E\E\E\EG1MMM.^A: +aed-ucb|AED-UCB|aed512-ucb|AED512-UCB|aed 512 w/o UCB ROM:\ + :db:co#64:li#40:cl=^L:bs:nd=\Ei0800\001:up=^K:\ + :ve=\E\E\E\E\E\E\E\072004=000200??\001:\ + :vb=\EK0001??0000K0001202080\001:\ + :us=\E\07200>8000140\001:ue=\E\07200>8000100\001:\ + :uc=\Ei???>l0800i0102\001:\ + :ti=\E\07200>8000140{<04<0??00001010L<0\072004=0002??00\001:\ + :te=\E\07200>8000100{804<0??00001000L80\072004=000200??\001:\ + :so=\E\07200>8000140[80C00\001:se=\E[00C80\001:\ + :if=/usr/share/tabset/aed512: +# CIT 80 - vt 100 emulator, the termcap has been modified to remove +# the delay times and do an auto tab set rather than the indirect +# file used in vt100. +cit80|cit 80|Citoh 80:\ + :co#80:li#24:am:cl=\E[;H\EJ:bs:cm=\E[%i%2;%2H:nd=\E[C:up=\E[A:\ + :ce=\EK:cd=\EJ:is=\E>:ks=\E[?1h\E=:ke=\E[?1l\E>:\ + :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD: +# From mtxinu!sybase!tim (Tim Wood) Fri Sep 27 09:39:12 PDT 1985 +# Alternate cit101 (vt100 em) file used in vt100. +# Uses 23 lines so can run citsys (like h19sys). +# 24 May 85 (mtxinu!sybase!tim) - removed 2-byte limit on 'cm' cursor +# coordinates otherwise there is garbling on long lines in +# co#132 mode; also added support for multipage memory on the Itoh. +citc|Citoh fast vt100:\ + :co#80:li#23:am:cl=\E[;H\E[2J:bs:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\ + :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\ + :is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[3g\E[>5g:\ + :ks=\E[?1h\E=:ke=\E[?1l\E>:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:\ + :vb=\E[?5h\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\E[?5l:\ + :dc=\E[P:al=\E[L:dl=\E[M:ic=\E[@:vs=\E7\E[U:ve=\E[V\E8:xn: +cita:\ + :co#80:li#23:am:cl=\E[;H\E[2J:bs:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\ + :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\ + :is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[3g\E[>5g:\ + :ks=\E[?1h\E=:ke=\E[?1l\E>:\ + :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:vs=\E7\E[U:ve=\E[V\E8:\ + :vb=\E[?5h\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\E[?5l:xn: +cit101:li#24:vb@:tc=citc: +cit101b:li#24:tc=citc: +cit500|cit-500|cit 500:\ + :co#80:li#40:cl=50\E[;H\E[2J:bs:am:cm=5\E[%i%2;%2H:nd=2\E[C:up=2\E[A:\ + :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ + :is=\E(B\E)0\E>\E[?3l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\ + :if=/usr/share/tabset/vt100:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:\ + :kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:xn:\ + :do=\ED:al=\E[L:dc=\E[P:dl=\E[M: +# Note several versions of blit. I don't know exactly what is what +# so please send me any corrections to this -- mrh +# From research!ikeya!rob Tue Aug 31 23:41 EDT 1982 +blit|jerq|blit-pb|blit running teletype rom:\ + :do=^J:IC=\Ef%+ :DC=\Ee%+ :AL=\EF%+ :DL=\EE%+ :\ + :mi:dl=\EE!:ic=\Ef!:dc=\Ee!:al=\EF!:\ + :ce=\EK:cl=^L:cm=\EY%r%+ %+ :co#87:li#72:nd=\EC:\ + :up=\EA:ku=\EA:kd=\EB:kr=\EC:kl=\ED:kb=^H:am:ul:pt:eo: +cbblit|columbus enhanced tty blit:\ + :vb=\E^G:so=\EU!:se=\EV!:us=\EU":ue=\EV":cd=\EJ:\ + :im=\EQ:ei=\ER:ic@:co#88:sf=\EG:tc=blit: +oblit|ojerq|first version of blit rom:\ + :do=^J:AL=\Ef%+ :DL=\Ee%+ :mi:dl=\EE:ei=\ER:im=\EQ:dc=\EO:da:db:\ + :al=\EF:cd=\EJ:ce=\EK:cl=^L:cm=\EY%r%+ %+ :co#88:li#72:nd=\EC:\ + :up=\EA:vb=\E^G:am:ul:pt:eo: +daleblit|daleterm|blit running Dale DeJager's ROM:\ + :ku=\EA:kd=\EB:kr=\EC:kl=\ED:so=\EU!:se=\EV!:us=\EU":ue=\EV":\ + :da@:db@:tc=oblit: +datapoint|dp3|dp3360|datapoint 3360:\ + :do=^J:am:le=^H:bs:cd=^_:ce=^^:cl=^]^_:co#82:ho=^]:li#25:nd=^x:up=^z: +# From: cbosgd!utcs!romwa@ucbvax.berkeley.edu (mark dornfeld) +# This termcap is for the LANPAR Technologies VISION 3220 +# terminal. The function key definitions k0-k5 represent the +# edit keypad: FIND, INSERT HERE, REMOVE, SELECT, PREV SCREEN, +# NEXT SCREEN. The key definitions k6-k9 represent the PF1 to +# PF4 keys. +v3220|LANPAR Vision II model 3220/3221/3222:\ + :co#80:li#24:cl=\E[H\E[J:bs:am:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\ + :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\ + :is=\E>\E[?3l\E[?7h\E[?8h\E[p:ks=\E=:ke=\E>:\ + :kn#10:k0=\E[1~:k1=\E[2~:k2=\E[3~:k3=\E[4~:k4=\E[5~:k5=\E[6~:\ + :k6=\E[OP:k7=\E[OQ:k8=\E[OR:k9=\E[OS:\ + :ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\ + :kh=\E[H:pt:sr=\EM:xn:\ + :dl=\E[M:dc=\E[P:ei=\E[4l:al=\E[L:im=\E[4h:mi: +# From ucbvax!faletti (Faletti@Berkeley) +# FREEDOM 100 by Liberty Electronics USA, SF. +# :kh=^^: left out because it precludes using change-to-alternate-file in vi. +# Basic Freedom 100 entry, works with VI at 1200 baud. +f100|freedom100|freedom|freedom 100 no padding:\ + :am:bs:bw:mi:ms:pt:co#80:kn#20:li#24:\ + :ct=\E3:st=\E1:is=\Eg\Ef\r\Ed:kr=^L:\ + :cl=^Z:do=^J:ho=^^:kb=^H:kl=^H:\:kd=^V:\ + :ko=dc,al,dl,cl,bt,ce,cd:ku=^K:le=^H:nd=^L:\ + :ch=\E]%+ :cm=\E=%+ %+ :cv=\E[%+ :sr=\Ej:up=^K:\ + :al=\EE:bt=\EI:cd=\EY:ce=\ET:dc=\EW:dl=\ER:ei=\Er:im=\Eq:\ + :se=\EG0:so=\EG4:ue=\EG0:us=\EG8:as=\E$:ae=\E%:\ + :vb=\Eb\200\200\Ed:\ + :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:\ + :k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:k0=^AI\r:\ + :hs:ts=\Eg\Ef:fs=\r:ds=\Eg\Ef\r: +f100-rv|freedom100-rv|freedom-rv|freedom100 with reverse video at 1200:\ + :is=\Eg\Ef\r\Eb:vb=\Ed\200\200\Eb:tc=freedom100: +# VI at 9600 baud (or EMACS at 1200 -- but may be more than is needed for emacs) +f100-v|freedom100-v|freedom-v|freedom100 for 9600 vi or 1200 emacs:\ + :al=6.5*\EE:dl=11.5*\ER:\ + :vb=\Eb\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Ed:\ + :tc=freedom100: +f100-v-rv|freedom100-v-rv|freedom-v-rv|freedom100 rev. vid. for 9600 vi:\ + :al=6.5*\EE:dl=11.5*\ER:is=\Eg\Ef\r\Eb:\ + :vb=\Ed\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Eb:\ + :tc=freedom100: +# EMACS at 9600 baud -- this still needs some more work on the padding +f100-e|freedom100-e|freedom-e|freedom100 for 9600 emacs:\ + :al=8.5*\EE:dl=11.5*\ER:ip=6:\ + :vb=\Eb\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Ed:\ + :tc=freedom100: +f100-e-rv|freedom100-e-rv|freedom-e-rv|freedom100 rev. vid. for emacs 9600:\ + :al=8.5*\EE:dl=11.5*\ER:ip=6:is=\Eg\Ef\r\Eb:\ + :vb=\Ed\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Eb:\ + :tc=freedom100: +f110-v|freedom110-v|freedom110 for 9600 vi or 1200 emacs:\ + :is=\Eg\Ef\r\Ed\EO:dc=\EO\EW:im=\EO\Eq:\ + :al=6.5*\EE:dl=11.5*\ER:\ + :vb=\Eb\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Ed:\ + :tc=freedom100: +# (from kerch@lll-crg) +f200|freedom200| Freedom 200 VDT by Liberty Electronics :\ + :if=/usr/share/tabset/stdcrt:al=\EE:am:bs:bt=\EI:cd=\EY:\ + :ce=\ET:cl=^Z:cm=\E=%+ %+ :co#80:dc=\EW:dl=\ER:do=^V:\ + :ds=\Eh:ei=\Er:im=\Eq:is=\Eg\El\E\041\062:\ + :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:\ + :k6=^AE\r:k7=^AE\r:k8=^AF\r:k9=^AG\r:kd=^V:kr=L:\ + :ku=^K:li#24:ms:nd=^L:se=\EG0:so=\EG4:sr=\Ej:\ + :te=\EJ\E\\2\E|\041\061^L^Y:ti=\E\\1\EK\E|\041\061L^Y:\ + :ts=\Ef:ue=\EG0:up=^K:us=\EG8:vb=\Eb\Ed:hs:i2=\E^O\Eg:\ + :ts=\Ef:fs=^M:ds=\E^N: +dg6053|data general 6053:\ + :do=^J:am:le=^H:bs:cm=^P%r%.%.:cl=^L:ho=^H:nd=^S:\ + :up=^W:ce=^K:co#80:li#24: +# dg450 and dg200 from cornell +dg450|dg6134|data general 6134:\ + :nd=\030:bs@:tc=dg200: +dg200|data general Dasher 200:\ + :am:bc=^Y:bs=0:ce=^K:cl=^L:cm=^P%r%+\200%+\200:co#80:do=^Z:\ + :ho=^H:li#24:\ + :ll=\036FP\017:se=\036E:so=\036D:up=^W:\ + :is=\036O\036FQ2\036FB000\036FE\036FA\036FQ2: +# Note: lesser Dasher terminals will not work with vi because vi insists upon +# having a command to move straight down from any position on the bottom line +# and scroll the screen up, or a direct vertical scroll command. The 460 and +# above have both, the D210/211, for instance, has neither. We must use ANSI +# mode rather than DG mode because standard UNIX tty drivers assume that ^H is +# backspace on all terminals. This is not so in DG mode. +dg460-ansi|Data General Dasher 460, ANSI-mode:\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=\E[2J:\ + :cm=\E[%i%2;%2H:co#80:dc=\E[P:dl=\E[M:do=\E[B:\ + :ho=\E[H:ic=\E[@:ue=\E[05:ul:up=\E[A:us=\E[4m:is=\036F@:\ + :k0=\E[001z:k1=\E[002z:k2=\E[003z:k3=\E[004z:k4=\E[005z:k5=\E[006z:\ + :k6=\E[007z:k7=\E[008z:k8=\E[009z:k9=\E[00\:z:\ + :kb=\E[D:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:kn#6:\ + :l0=f1:l1=f2:l2=f3:l3=f4:l4=f5:l5=f6:l6=f7:l7=f8:l9=f10:\ + :le=^H:li#24:mb=\E[5m:me=\E[0m:mh=\E[2m:mr=\E[7m:ms:mu=\EW:\ + :nd=\E[C:nl=\ED:pt:se=\E[0m:sf=\E[S:so=\E[7m:sr=\E[T: +v603|visual603|603|Visual model 603:\ + :hs:ts=\EP2~:fs=\E\\:ds=\EP2;1~\E\\:\ + :im=\E[4h:ei=\E[4l:mi:dc=\E[P:al=\E[L:dl=\E[M:\ + :cs=\E[%i%d;%dr:sf=\ED:sr=\EM:sb=\EM:\ + :ce=\E[K:cl=\E[H\E[J:cd=\E[J:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\ + :so=\E[7m:se=\E[27m:us=\E[4m:ue=\E[24m:\ + :md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:\ + :is=\E>\E[?3l\E[?4l\E[?7h\E[?8h\E[1;24r\E[24;1H:\ + :rs=\E>\E[?3l\E[?4l\E[?7h\E[?8h:\ + :tc=vt100: +cdi|cdi1203:\ + :am:le=^H:bs:hc:os:co#80:dC#200:do=^J: +# ^S is an arrow key! Boy is this guy in for a surprise on v7! +sol:\ + :do=^J:am:le=^Y:ho=^H:bs:cm=\E^1%.\E^2%.:cl=^K:ho=^N:co#64:li#16:\ + :nd=^S:up=^W:kl=^A:kr=^S:ku=^W:kd=^Z:ma=^A^H^S ^W^P^Z^N: +xl83|Cybernex XL-83:\ + :do=^J:am:le=^H:bs:cd=62^P:ce=3^O:cl=62^L:cm=^W%+ %+ :co#80:ho=^K:\ + :kd=^J:kl=^H:ku=^N:li#24:up=^N:nd=^I: +omron|Omron 8025AG:\ + :do=^J:al=\EL:am:le=^H:bs:cd=\ER:co#80:ce=\EK:cl=\EJ:\ + :da:db:dc=\EP:dl=\EM:ho=\EH:li#24:nd=\EC:se=\E4:sf=\ES:\ + :so=\Ef:sr=\ET:up=\EA:ve=:vs=\EN: +plasma|plasma panel:\ + :am:le=^H:bs:cl=^L:co#85:ho=^^:li#45:nd=\030:up=\026:do=^J: +pty|pseudo teletype:\ + :do=^J:co#80:li#24:am:cl=\EJ:le=^H:bs:cm=\EG%+ %+ :nd=\EC:\ + :up=\EA:ce=\EK:cd=\EL:al=\EP:dl=\EN:ic=\EO:\ + :so=\Ea$:se=\Eb$:us=\Ea!:ue=\Eb!: +remote|virtual remote terminal:\ + :co#79:am@:nl@:tc=virtual: +swtp|ct82|southwest technical products ct82:\ + :do=^J:am:le=^d:bc=^d:\ + :al=^\^y:cd=^v:ce=^F:cl=^L:cm=%r^k%.%.:co#82:li#20:\ + :dl=^z:nd=^s:up=^a:so=^^^v:se=^^^F:dc=^\^h:ic=^\^x:ho=^p:\ + :sf=^n:sr=^o:ll=^c:\ + :is=^\^r^^^s^^^d^]^w^i^s^^^]^^^o^]^w^r^i: +terak|Terak emulating Datamedia 1520:\ + :tc=dm1520: +# :is resets scrolling region in case a previous user had used "tset vt100" +sun|Sun Microsystems Workstation console:\ + :li#34:co#80:cl=^L:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\ + :am:bs:mi:ms:pt:km:\ + :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:is=\E[1r:rs=\E[1r:\ + :kd=\E[B:kl=\E[D:ku=\E[A:kr=\E[C:kh=\E[H:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ + :al=\E[L:dl=\E[M:ic=\E[@:dc=\E[P:\ + :AL=\E[%dL:DL=\E[%dM:IC=\E[%d@:DC=\E[%dP: +# From john@ucbrenoir Tue Sep 24 13:14:44 1985 +sun-s|Sun Microsystems Workstation window with status line:\ + :hs:ts=\E]l:fs=\E\\:ds=\E]l\E\\:tc=sun: +sun-e-s|sun-s-e|Sun Microsystems Workstation with status hacked for emacs:\ + :hs:ts=\E]l:fs=\E\\:ds=\E]l\E\\:tc=sun-e: +sun-48|Sun 48-line window:\ + :li#48:co#80:tc=sun: +sun-34|Sun 34-line window:\ + :li#34:co#80:tc=sun: +sun-24|Sun 24-line window:\ + :li#24:co#80:tc=sun: +sun-17|Sun 17-line window:\ + :li#17:co#80:tc=sun: +sun-12|Sun 12-line window:\ + :li#12:co#80:tc=sun: +sun-1|Sun 1-line window for sysline:\ + :li#1:co#80:es:hs:ts=\r:fs=\E[K:ds=^L:tc=sun: +sun-e|sun-nic|sune|Sun Microsystems Workstation without insert character:\ + :ic@:im@:ei@:tc=sun: +sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history:\ + :te=\E[>4h:ti=\E[>4l:tc=sun: +# The terminal mvterm is a full color terminal emulation that seems to be +# specific to a terminal program on Sun workstations called SwitchTerm. It +# is vt100 compatible with minor changes. +# Daniel Rudy +mvterm|vv100|mvterm emulator with ANSI colors:\ + :pa#64:Co#8:AF=\E[3%dm:AB=\E[4%dm:op=\E[100m:tc=vt102: +# For NeWS's psterm from Eric Messick & Hugh Daniel +psterm|psterm-basic|psterm-80x34:\ + :am:bs:al=\EA:cd=\EB:ce=\EC:cl=^L:cm=\E%d;%d;:cs=\EE%d;%d;:\ + :dc=\EF:dl=\EK:do=\EP:ei=\ENi:el=\ENl:fs=\ENl:\ + :ho=\ER:hs:im=\EOi:is=\EN*:km:kd=\E[B:ku=\E[A:kr=\E[C:kl=\E[D:\ + :mb=\EOb:md=\EOd:me=\EN*:mr=\EOr:nd=\EV:pt:rc=\034:rs=\EN*:sc=\035:\ + :se=\ENo:sf=\EW:sl=\EOl:so=\EOo:sr=\EX:te=\ENt:ti=\EOt:ts=\EOl:\ + :ue=\ENu:le=\ET:ll=\EU:ul:up=\EY:us=\EOu:vb=\EZ:co#80:li#34: +psterm-96x48:\ + :co#96:li#48:tc=psterm-basic: +psterm-90x28:\ + :co#90:li#28:tc=psterm-basic: +psterm-80x24:\ + :co#80:li#24:tc=psterm-basic: +# This is a faster termcap for psterm. Warning: if you use this termcap, +# some control characters you type will do strange things to the screen. +psterm-fast:\ + :am:bs:al=^A:cd=^B:ce=^C:cl=^L:cm=^D%d;%d;:cs=^E%d;%d;:\ + :dc=^F:dl=^K:do=^P:ei=^Ni:el=^Nl:fs=^Nl:\ + :ho=^R:hs:im=^Oi:is=^N*:km:kd=\E[B:ku=\E[A:kr=\E[C:kl=\E[D:\ + :mb=^Ob:md=^Od:me=^N*:mr=^Or:nd=^V:pt:rc=\034:rs=^N*:sc=\035:\ + :se=^No:sf=^W:sl=^Ol:so=^Oo:sr=^X:te=^Nt:ti=^Ot:ts=^Ol:ue=^Nu:\ + :le=^T:ll=^U:ul:up=^Y:us=^Ou:vb=^Z:co#80:li#34: +apollo:\ + :al=\EI:am:bs:cd=\EJ:ce=\EK:ch=\EN%d:cl=^L:cm=\EM%+ %d):\ + :cv=\EO+ :dc=\EP:dl=\EL:do=\EB:ei=\ER:im=\EQ:mi:nd=\EC:se=\ET:sf=\EE:\ + :so=\ES:sr=\ED:te=\EX:ti=\EW:ue=\EV:up=\EA:us=\EU:co#88:li#53: +# Apollo termcaps from Gary Darland, goodmanc@garnet +apollo_15P|apollo 15 inch display:\ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 20:44:33 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6E4E31AF; Wed, 10 Dec 2014 20:44:33 +0000 (UTC) Received: from mail-qa0-x22b.google.com (mail-qa0-x22b.google.com [IPv6:2607:f8b0:400d:c00::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27F1A51; Wed, 10 Dec 2014 20:44:33 +0000 (UTC) Received: by mail-qa0-f43.google.com with SMTP id bm13so2566019qab.2 for ; Wed, 10 Dec 2014 12:44:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=RSDNDxaqm/fNP9Ha3tRhAQ3Wqglruu5f066LKh4ycGA=; b=IwXEVeiCUG+hDGSAi8fWQlP5AQWYc9X7JxgH1YoumGCL+bjVu/0muNPKcyKpUIcAsl vmidu31o5XeJSQBzkOU+PixAt9LnanAHEg2v3fJXK4mev/gTjitNQcmrCHzU4Lph8gDg xyuxpRqiJNB3ZaOxHkx59Wv3p5czwpeTL/ivlqATDer8tXLzAokqGPwQnuLZ+hFBnJPW QjKlvxwOGFJpOlELMjIwuafA3tWgd7rWh0EPnco50pB+l3C8AuojLzJn0N4bz/QtHXPd JNTbxc7uEV4iboStZ5NFMpOv4ABROd7mlaybrGdUpEk+K5tS4nwpjx+bIO69/39M6yRR JvBw== MIME-Version: 1.0 X-Received: by 10.224.135.138 with SMTP id n10mr12722365qat.45.1418244272284; Wed, 10 Dec 2014 12:44:32 -0800 (PST) Sender: hiren.panchasara@gmail.com Received: by 10.96.25.65 with HTTP; Wed, 10 Dec 2014 12:44:32 -0800 (PST) In-Reply-To: <201412081714.sB8HE2oZ033280@svn.freebsd.org> References: <201412081714.sB8HE2oZ033280@svn.freebsd.org> Date: Wed, 10 Dec 2014 12:44:32 -0800 X-Google-Sender-Auth: JyBrxoqRHe2Lp2WTfxMawdx7EG4 Message-ID: Subject: Re: svn commit: r275621 - head/tools/bsdbox From: hiren panchasara To: Sean Bruno Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head , svn-src-all , src-committers X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 20:44:33 -0000 On Mon, Dec 8, 2014 at 9:14 AM, Sean Bruno wrote: > Author: sbruno > Date: Mon Dec 8 17:14:01 2014 > New Revision: 275621 > URL: https://svnweb.freebsd.org/changeset/base/275621 > > Log: > Add -lxo (for df) and -lgpio(for gpioctl) to bsdbox. This will allow the picostation > build to work again. Thank you! cheers, Hiren From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 20:54:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7F91586; Wed, 10 Dec 2014 20:54:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3ED2172; Wed, 10 Dec 2014 20:54:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAKsO5C009320; Wed, 10 Dec 2014 20:54:24 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAKsOB3009317; Wed, 10 Dec 2014 20:54:24 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201412102054.sBAKsOB3009317@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 10 Dec 2014 20:54:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275690 - stable/10/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 20:54:24 -0000 Author: cy Date: Wed Dec 10 20:54:23 2014 New Revision: 275690 URL: https://svnweb.freebsd.org/changeset/base/275690 Log: MFC r275199. Correctly define constants. Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c stable/10/sys/contrib/ipfilter/netinet/ip_frag.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/fil.c Wed Dec 10 20:44:51 2014 (r275689) +++ stable/10/sys/contrib/ipfilter/netinet/fil.c Wed Dec 10 20:54:23 2014 (r275690) @@ -252,7 +252,7 @@ static const struct optlist ipopts[20] = }; #ifdef USE_INET6 -static struct optlist ip6exthdr[] = { +static const struct optlist ip6exthdr[] = { { IPPROTO_HOPOPTS, 0x000001 }, { IPPROTO_IPV6, 0x000002 }, { IPPROTO_ROUTING, 0x000004 }, Modified: stable/10/sys/contrib/ipfilter/netinet/ip_frag.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_frag.c Wed Dec 10 20:44:51 2014 (r275689) +++ stable/10/sys/contrib/ipfilter/netinet/ip_frag.c Wed Dec 10 20:54:23 2014 (r275690) @@ -112,7 +112,7 @@ static void ipf_frag_free __P((ipf_frag_ static frentry_t ipfr_block; -ipftuneable_t ipf_tuneables[] = { +const ipftuneable_t ipf_tuneables[] = { { { (void *)offsetof(ipf_frag_softc_t, ipfr_size) }, "frag_size", 1, 0x7fffffff, stsizeof(ipf_frag_softc_t, ipfr_size), From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 20:56:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 96E9E76D; Wed, 10 Dec 2014 20:56:15 +0000 (UTC) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "anubis.delphij.net", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 77EEB18C; Wed, 10 Dec 2014 20:56:15 +0000 (UTC) Received: from zeta.ixsystems.com (unknown [12.229.62.2]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id 3605C18EE7; Wed, 10 Dec 2014 12:56:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphij.net; s=anubis; t=1418244975; x=1418259375; bh=ZdYK9SeHHLBqv8aJVveTT1A9aHi5TRh/1cKeV0/qNIk=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=raZD4W+L4grcxl67lnGJEOKhWxFzRgkoWKnamEOwsMCwtVFXfSXP2MMghxyE4eTlV yh4uXx81OL3vaNQW1FVVWMjqligC6naTyR26WPxmf+Zsg528PPfueYwsKw6yBDeva4 LVKgzxD4lDyJcnQrr+W9fV3vs7ZcJ9NonhjLTGpg= Message-ID: <5488B36E.4060307@delphij.net> Date: Wed, 10 Dec 2014 12:56:14 -0800 From: Xin Li Reply-To: d@delphij.net Organization: The FreeBSD Project MIME-Version: 1.0 To: "Justin T. Gibbs" , Xin LI Subject: Re: svn commit: r275551 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb References: <201412060050.sB60oxYu045859@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-vendor@freebsd.org, will@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 20:56:15 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 12/10/14 12:29, Justin T. Gibbs wrote: > What’s the policy for the commit log on vendor imports from > illumos? Since illumos does not allow “FreeBSD style” commit > messages, I’ve been putting that data into the corresponding > illumos issue that I create. So this information isn’t lost during > the merge to FreeBSD, I think we should pull the issue data into > our commit messages in addition to data taken from the git commit > in illumos-gate. > > One minor gripe about the illumos issue tracker is that I’ve found > it hard to keep it from mangling the formatting of text. For > example, look at the commit log I put into the history section of > https://www.illumos.org/issues/5314. Instead of fighting with > that, I’ve been pushing my “FreeBSD commit log” as the description > of the review associated with the bug and just linking the issue to > the review. You can see that in the next big change from Spectra > that is currently going through the review process: > > https://www.illumos.org/issues/5056 > https://reviews.csiden.org/r/131/ I think we traditionally do imports as-is, including the commit message, to vendor[-sys]/ area. This is mainly to make future cross-referencing easy, i.e. what does that "MFV 275551" reference to an Illumos commit? Should Illumos change to a different SCM in the future, we will still be able to find the commit by looking up the commit logs of theirs. However when merging to head/ we should use FreeBSD style commit (i.e. your commit messages) to give more information about the change. Normally we will reference the vendor import revision and Illumos ticket as well. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.1.0 (FreeBSD) iQIcBAEBCgAGBQJUiLNqAAoJEJW2GBstM+nsJVcP/j3vDqLb+NV0RYYoUzFUnz7z muU/HIECPo/3vt1ujUX6MROFYWLIotgEtpVFmHgXVqzus3q4qSI2bMrXjSzD0Gze X9d8uTzlg5W62/1FiREK7BTFewggoCKTvySfJlQ0gw+d03mcNVCESIRhdCRz8c1v aYYZv684z0k2BpSPfNFbFe2r/xOTDcVviRT36msRaRGjH//uQRs9itP7mZBGjwxi BlcEJ1U+y/h0SpDex48rNG9ItxpZfrUZA3lsvhqJNOFn9cEwvyVQadueTBBQTCLh tjN2yqRraZ+eYKjDx1+mVXzzq84GTYnAZQzAHqDzffwASG7rovY4UFwcCvOErSwK uUSXTe8H94iWWNkD/YCXfyAxQH3GLdfwvwtJ0EtRhu/U4LCd+9gakvxASfOB16Q7 VF08okZzsviP5MqyJh5npr0G+5DLKLNFj2uoL+cqRd8u7C6//taywb6yofsneWkC d8iLHZVl52XuhO0KBcQUMMv8oX99y5pXrkpo6aeQ5eELiCuBm6aYo/fCxJ13EIxd ld5Rfk01aq1LJhFS7LWMIUpY2D1HGqTwaE/l0zmdTvIN74DVJIllGy5oKRtRoQEN VRGWGBl541cs7I1FxGaFyjY3UT38a2MjM3OdkzA/E+cOjrCagTc/Lr5BuJjEgz08 HxI5axE2CuSTP1xrFgl7 =iadt -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Wed Dec 10 23:18:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1BB689C6; Wed, 10 Dec 2014 23:18:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08BB2302; Wed, 10 Dec 2014 23:18:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBANIBNE083328; Wed, 10 Dec 2014 23:18:11 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBANIBTk083327; Wed, 10 Dec 2014 23:18:11 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412102318.sBANIBTk083327@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 10 Dec 2014 23:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275692 - head/share/termcap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 10 Dec 2014 23:18:12 -0000 Author: ngie Date: Wed Dec 10 23:18:11 2014 New Revision: 275692 URL: https://svnweb.freebsd.org/changeset/base/275692 Log: Fix building termcap.db when make obj is run beforehand from a clean tree by using make variables for the filenames, which helps resolve pathing appropriately when running cap_mkdb X-MFC with: r275687 Pointyhat to: me Modified: head/share/termcap/Makefile Modified: head/share/termcap/Makefile ============================================================================== --- head/share/termcap/Makefile Wed Dec 10 22:33:57 2014 (r275691) +++ head/share/termcap/Makefile Wed Dec 10 23:18:11 2014 (r275692) @@ -21,7 +21,7 @@ CAP_MKDB_ENDIAN= .endif termcap.db: termcap - cap_mkdb ${CAP_MKDB_ENDIAN} termcap + cap_mkdb ${CAP_MKDB_ENDIAN} -f ${.TARGET:R} ${.ALLSRC} etc-termcap: ln -fs ${BINDIR}/misc/termcap ${DESTDIR}/etc/termcap From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 00:25:26 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA7A45FB; Thu, 11 Dec 2014 00:25:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6735C70; Thu, 11 Dec 2014 00:25:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB0PQml019962; Thu, 11 Dec 2014 00:25:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB0PQJZ019961; Thu, 11 Dec 2014 00:25:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201412110025.sBB0PQJZ019961@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 11 Dec 2014 00:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275694 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 00:25:26 -0000 Author: mav Date: Thu Dec 11 00:25:26 2014 New Revision: 275694 URL: https://svnweb.freebsd.org/changeset/base/275694 Log: MFC r275478: Swap resource count scopes for used/available space. Used count should be reported as per-LUN, while available should not. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Wed Dec 10 23:30:18 2014 (r275693) +++ stable/10/sys/cam/ctl/ctl.c Thu Dec 11 00:25:26 2014 (r275694) @@ -7153,7 +7153,7 @@ ctl_lbp_log_sense_handler(struct ctl_scs phdr->param_len = 8; data = (uint8_t *)(phdr + 1); scsi_ulto4b(val >> CTL_LBP_EXPONENT, data); - data[4] = 0x01; /* per-LUN */ + data[4] = 0x02; /* per-pool */ data += phdr->param_len; } @@ -7166,7 +7166,7 @@ ctl_lbp_log_sense_handler(struct ctl_scs phdr->param_len = 8; data = (uint8_t *)(phdr + 1); scsi_ulto4b(val >> CTL_LBP_EXPONENT, data); - data[4] = 0x02; /* per-pool */ + data[4] = 0x01; /* per-LUN */ data += phdr->param_len; } From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 00:41:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8673EC05; Thu, 11 Dec 2014 00:41:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 730D1E16; Thu, 11 Dec 2014 00:41:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB0ftxY030058; Thu, 11 Dec 2014 00:41:55 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB0ftwC030057; Thu, 11 Dec 2014 00:41:55 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201412110041.sBB0ftwC030057@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Dec 2014 00:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275695 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 00:41:55 -0000 Author: markj Date: Thu Dec 11 00:41:54 2014 New Revision: 275695 URL: https://svnweb.freebsd.org/changeset/base/275695 Log: Fix a bug in r266857: nd6_dad_find() must return NULL if it doesn't find a matching element in the DAD queue. Reported by: Holger Hans Peter Freyther MFC after: 3 days Modified: head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Thu Dec 11 00:25:26 2014 (r275694) +++ head/sys/netinet6/nd6_nbr.c Thu Dec 11 00:41:54 2014 (r275695) @@ -1210,11 +1210,12 @@ nd6_dad_find(struct ifaddr *ifa) TAILQ_FOREACH(dp, &V_dadq, dad_list) if (dp->dad_ifa == ifa) { refcount_acquire(&dp->dad_refcnt); - break; + DADQ_RUNLOCK(); + return (dp); } DADQ_RUNLOCK(); - return (dp); + return (NULL); } static void From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 06:07:11 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74D80853; Thu, 11 Dec 2014 06:07:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 473491CA; Thu, 11 Dec 2014 06:07:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB67BoT092287; Thu, 11 Dec 2014 06:07:11 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB67BQ6092286; Thu, 11 Dec 2014 06:07:11 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412110607.sBB67BQ6092286@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 11 Dec 2014 06:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r275697 - vendor/file/5.21 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 06:07:11 -0000 Author: delphij Date: Thu Dec 11 06:07:10 2014 New Revision: 275697 URL: https://svnweb.freebsd.org/changeset/base/275697 Log: Tag file 5.21 import. Added: vendor/file/5.21/ - copied from r275696, vendor/file/dist/ From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 06:00:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 99F8670C; Thu, 11 Dec 2014 06:00:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8401BFB; Thu, 11 Dec 2014 06:00:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB60wQi088480; Thu, 11 Dec 2014 06:00:58 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB60r7O088453; Thu, 11 Dec 2014 06:00:53 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412110600.sBB60r7O088453@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 11 Dec 2014 06:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r275696 - in vendor/file/dist: . doc magic magic/Magdir python src tests X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 06:00:58 -0000 Author: delphij Date: Thu Dec 11 06:00:53 2014 New Revision: 275696 URL: https://svnweb.freebsd.org/changeset/base/275696 Log: Vendor import of file 5.21. Added: vendor/file/dist/magic/Magdir/kerberos vendor/file/dist/magic/Magdir/meteorological Deleted: vendor/file/dist/magic/Magdir/rinex Modified: vendor/file/dist/ChangeLog vendor/file/dist/Makefile.in vendor/file/dist/TODO vendor/file/dist/aclocal.m4 vendor/file/dist/config.h.in vendor/file/dist/configure vendor/file/dist/configure.ac vendor/file/dist/doc/Makefile.in vendor/file/dist/doc/file.man vendor/file/dist/doc/libmagic.man vendor/file/dist/magic/Localstuff vendor/file/dist/magic/Magdir/android vendor/file/dist/magic/Magdir/animation vendor/file/dist/magic/Magdir/archive vendor/file/dist/magic/Magdir/blender vendor/file/dist/magic/Magdir/commands vendor/file/dist/magic/Magdir/compress vendor/file/dist/magic/Magdir/database vendor/file/dist/magic/Magdir/elf vendor/file/dist/magic/Magdir/filesystems vendor/file/dist/magic/Magdir/images vendor/file/dist/magic/Magdir/jpeg vendor/file/dist/magic/Magdir/linux vendor/file/dist/magic/Magdir/macintosh vendor/file/dist/magic/Magdir/msooxml vendor/file/dist/magic/Magdir/netbsd vendor/file/dist/magic/Magdir/pascal vendor/file/dist/magic/Magdir/pgp vendor/file/dist/magic/Magdir/python vendor/file/dist/magic/Magdir/riff vendor/file/dist/magic/Magdir/sequent vendor/file/dist/magic/Magdir/sereal vendor/file/dist/magic/Magdir/ssh vendor/file/dist/magic/Magdir/vms vendor/file/dist/magic/Magdir/vorbis vendor/file/dist/magic/Magdir/windows vendor/file/dist/magic/Makefile.am vendor/file/dist/magic/Makefile.in vendor/file/dist/missing vendor/file/dist/python/Makefile.in vendor/file/dist/src/Makefile.in vendor/file/dist/src/apprentice.c vendor/file/dist/src/ascmagic.c vendor/file/dist/src/cdf.c vendor/file/dist/src/cdf.h vendor/file/dist/src/compress.c vendor/file/dist/src/elfclass.h vendor/file/dist/src/encoding.c vendor/file/dist/src/file.c vendor/file/dist/src/file.h vendor/file/dist/src/file_opts.h vendor/file/dist/src/fsmagic.c vendor/file/dist/src/funcs.c vendor/file/dist/src/getline.c vendor/file/dist/src/magic.c vendor/file/dist/src/magic.h vendor/file/dist/src/magic.h.in vendor/file/dist/src/pread.c vendor/file/dist/src/readcdf.c vendor/file/dist/src/readelf.c vendor/file/dist/src/softmagic.c vendor/file/dist/src/vasprintf.c vendor/file/dist/tests/Makefile.in Modified: vendor/file/dist/ChangeLog ============================================================================== --- vendor/file/dist/ChangeLog Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/ChangeLog Thu Dec 11 06:00:53 2014 (r275696) @@ -1,3 +1,69 @@ +2014-12-10 20:01 Christos Zoulas + + * release 5.21 + +2014-11-27 18:40 Christos Zoulas + + * Allow setting more parameters from the command line. + * Split name/use and indirect magic recursion limits. + +2014-11-27 11:12 Christos Zoulas + + * Adjust ELF parameters and the default recursion + level. + * Allow setting the recursion level dynamically. + +2014-11-24 8:55 Christos Zoulas + + * The following fixes resulted from Thomas Jarosch's fuzzing + tests that revealed severe performance issues on pathological + input: + - limit number of elf program and sections processing + - abort elf note processing quickly + - reduce the number of recursion levels from 20 to 10 + - preserve error messages in indirect magic handling + +2014-11-12 10:30 Christos Zoulas + + * fix bogus free in the user buffer case. + +2014-11-11 12:35 Christos Zoulas + + * fix out of bounds read for pascal strings + * fix memory leak (not freeing the head of each mlist) + +2014-11-07 10:25 Christos Zoulas + + * When printing strings from a file, convert them to printable + on a byte by byte basis, so that we don't get issues with + locale's trying to interpret random byte streams as UTF-8 and + having printf error out with EILSEQ. + +2014-10-17 11:48 Christos Zoulas + + * fix bounds in note reading (Francisco Alonso / Red Hat) + +2014-10-11 15:02 Christos Zoulas + + * fix autoconf glue for setlocale and locale_t; some OS's + have locale_t in xlocale.h + +2014-10-10 15:01 Christos Zoulas + + * release 5.20 + +2014-08-17 10:01 Christos Zoulas + + * recognize encrypted CDF documents + +2014-08-04 9:18 Christos Zoulas + + * add magic_load_buffers from Brooks Davis + +2014-07-24 16:40 Christos Zoulas + + * add thumbs.db support + 2014-06-12 12:28 Christos Zoulas * release 5.19 Modified: vendor/file/dist/Makefile.in ============================================================================== --- vendor/file/dist/Makefile.in Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/Makefile.in Thu Dec 11 06:00:53 2014 (r275696) @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -618,9 +618,10 @@ distcheck: dist && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + && ../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ Modified: vendor/file/dist/TODO ============================================================================== --- vendor/file/dist/TODO Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/TODO Thu Dec 11 06:00:53 2014 (r275696) @@ -15,3 +15,5 @@ small amount of C is needed (because fas required for soft magic, not the more detailed information given by hard-wired routines). In this regard, note that hplip, which is BSD-licensed, has a magic reimplementation in Python. + +Read the kerberos magic entry for more ideas. Modified: vendor/file/dist/aclocal.m4 ============================================================================== --- vendor/file/dist/aclocal.m4 Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/aclocal.m4 Thu Dec 11 06:00:53 2014 (r275696) @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.14 -*- Autoconf -*- +# generated automatically by aclocal 1.14.1 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. @@ -21,7 +21,7 @@ If you have problems, you may need to re To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # visibility.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008, 2010-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -113,7 +113,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.14' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14], [], +m4_if([$1], [1.14.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -129,7 +129,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14])dnl +[AM_AUTOMAKE_VERSION([1.14.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) Modified: vendor/file/dist/config.h.in ============================================================================== --- vendor/file/dist/config.h.in Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/config.h.in Thu Dec 11 06:00:53 2014 (r275696) @@ -44,6 +44,9 @@ /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK +/* Define to 1 if you have the `freelocale' function. */ +#undef HAVE_FREELOCALE + /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO @@ -95,9 +98,15 @@ /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP +/* Define to 1 if you have the `newlocale' function. */ +#undef HAVE_NEWLOCALE + /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H @@ -182,6 +191,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `uselocale' function. */ +#undef HAVE_USELOCALE + /* Define to 1 if you have the `utime' function. */ #undef HAVE_UTIME @@ -219,6 +231,9 @@ /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK +/* Define to 1 if you have the header file. */ +#undef HAVE_XLOCALE_H + /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H Modified: vendor/file/dist/configure ============================================================================== --- vendor/file/dist/configure Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/configure Thu Dec 11 06:00:53 2014 (r275696) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.19. +# Generated by GNU Autoconf 2.69 for file 5.21. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.19' -PACKAGE_STRING='file 5.19' +PACKAGE_VERSION='5.21' +PACKAGE_STRING='file 5.21' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.19 to adapt to many kinds of systems. +\`configure' configures file 5.21 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1397,7 +1397,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.19:";; + short | recursive ) echo "Configuration of file 5.21:";; esac cat <<\_ACEOF @@ -1507,7 +1507,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.19 +file configure 5.21 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2163,7 +2163,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.19, which was +It was created by file $as_me 5.21, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3029,7 +3029,7 @@ fi # Define the identity of the package. PACKAGE='file' - VERSION='5.19' + VERSION='5.21' cat >>confdefs.h <<_ACEOF @@ -12785,7 +12785,7 @@ fi done -for ac_header in getopt.h err.h +for ac_header in getopt.h err.h xlocale.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -14191,7 +14191,7 @@ fi fi -for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof +for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -14998,7 +14998,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.19, which was +This file was extended by file $as_me 5.21, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15064,7 +15064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.19 +file config.status 5.21 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: vendor/file/dist/configure.ac ============================================================================== --- vendor/file/dist/configure.ac Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/configure.ac Thu Dec 11 06:00:53 2014 (r275696) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.19],[christos@astron.com]) +AC_INIT([file],[5.21],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -82,7 +82,7 @@ AC_HEADER_MAJOR AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) -AC_CHECK_HEADERS(getopt.h err.h) +AC_CHECK_HEADERS(getopt.h err.h xlocale.h) AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) AC_CHECK_HEADERS(zlib.h) @@ -138,7 +138,7 @@ else fi]) dnl Checks for functions -AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof) +AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) dnl Provide implementation of some required functions if necessary AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck) Modified: vendor/file/dist/doc/Makefile.in ============================================================================== --- vendor/file/dist/doc/Makefile.in Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/doc/Makefile.in Thu Dec 11 06:00:53 2014 (r275696) @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. Modified: vendor/file/dist/doc/file.man ============================================================================== --- vendor/file/dist/doc/file.man Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/doc/file.man Thu Dec 11 06:00:53 2014 (r275696) @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.106 2014/03/07 23:11:51 christos Exp $ -.Dd January 30, 2014 +.\" $File: file.man,v 1.110 2014/11/28 02:46:39 christos Exp $ +.Dd November 27, 2014 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -16,6 +16,7 @@ .Op Fl F Ar separator .Op Fl f Ar namefile .Op Fl m Ar magicfiles +.Op Fl P Ar name=value .Ar .Ek .Nm @@ -303,6 +304,15 @@ or attempt to preserve the access time of files analyzed, to pretend that .Nm never read them. +.It Fl P , Fl Fl parameter Ar name=value +Set various parameter limits. +.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent +.It Sy "Name" Ta Sy "Default" Ta Sy "Explanation" +.It Li indir Ta 15 Ta recursion limit for indirect magic +.It Li name Ta 30 Ta use count limit for name/use magic +.It Li elf_phnum Ta 128 Ta max ELF program sections processed +.It Li elf_shnum Ta 32768 Ta max ELF sections processed +.El .It Fl r , Fl Fl raw Don't translate unprintable characters to \eooo. Normally Modified: vendor/file/dist/doc/libmagic.man ============================================================================== --- vendor/file/dist/doc/libmagic.man Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/doc/libmagic.man Thu Dec 11 06:00:53 2014 (r275696) @@ -1,4 +1,4 @@ -.\" $File: libmagic.man,v 1.28 2014/03/02 14:47:16 christos Exp $ +.\" $File: libmagic.man,v 1.33 2014/11/28 02:46:39 christos Exp $ .\" .\" Copyright (c) Christos Zoulas 2003. .\" All Rights Reserved. @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 6, 2012 +.Dd November 27, 2014 .Dt LIBMAGIC 3 .Os .Sh NAME @@ -40,6 +40,9 @@ .Nm magic_compile , .Nm magic_list , .Nm magic_load , +.Nm magic_load_buffers , +.Nm magic_setparam , +.Nm magic_getparam , .Nm magic_version .Nd Magic number recognition library .Sh LIBRARY @@ -71,6 +74,12 @@ .Ft int .Fn magic_load "magic_t cookie" "const char *filename" .Ft int +.Fn magic_load_buffers "magic_t cookie" "void **buffers" "size_t *sizes" "size_t nbuffers" +.Ft int +.Fn magic_getparam "magic_t cookie" "int param" "void *value" +.Ft int +.Fn magic_setparam "magic_t cookie" "int param" "const void *value" +.Ft int .Fn magic_version "void" .Sh DESCRIPTION These functions @@ -253,6 +262,55 @@ adds to the database filename as appropriate. .Pp The +.Fn magic_load_buffers +function takes an array of size +.Fa nbuffers +of +.Fa buffers +with a respective size for each in the array of +.Fa sizes +loaded with the contents of the magic databases from the filesystem. +This function can be used in environment where the magic library does +not have direct access to the filesystem, but can access the magic +database via shared memory or other IPC means. +.Pp +The +.Fn magic_getparam +and +.Fn magic_setparam +allow getting and setting various limits related to the the magic +library. +.Bl -column "MAGIC_PARAM_ELF_PHNUM_MAX" "size_t" "Default" -offset indent +.It Sy "Parameter" Ta Sy "Type" Ta Sy "Default" +.It Li MAGIC_PARAM_INDIR_MAX Ta size_t Ta 15 +.It Li MAGIC_PARAM_NAME_MAX Ta size_t Ta 30 +.It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128 +.It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768 +.El +.Pp +The +.Dv MAGIC_PARAM_INDIR_RECURSION +parameter controls how many levels of recursion will be followed for +indirect magic entries. +.Pp +The +.Dv MAGIC_PARAM_NAME_RECURSION +parameter controls how many levels of recursion will be followed for +for name/use calls. +.Pp +The +.Dv MAGIC_PARAM_NAME_MAX +parameter controls the maximum number of calls for name/use. +.Pp +The +.Dv MAGIC_PARAM_PHNUM_MAX +parameter controls how many elf program sections will be processed. +.Pp +The +.Dv MAGIC_PARAM_SHNUM_MAX +parameter controls how many elf sections will be processed. +.Pp +The .Fn magic_version command returns the version number of this library which is compiled into the shared library using the constant Modified: vendor/file/dist/magic/Localstuff ============================================================================== --- vendor/file/dist/magic/Localstuff Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/magic/Localstuff Thu Dec 11 06:00:53 2014 (r275696) @@ -2,6 +2,6 @@ #------------------------------------------------------------------------------ # Localstuff: file(1) magic for locally observed files # -# $File: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $ +# $File: Localstuff,v 1.5 2007/01/12 17:38:27 christos Exp $ # Add any locally observed files here. Remember: # text if readable, executable if runnable binary, data if unreadable. Modified: vendor/file/dist/magic/Magdir/android ============================================================================== --- vendor/file/dist/magic/Magdir/android Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/magic/Magdir/android Thu Dec 11 06:00:53 2014 (r275696) @@ -1,6 +1,6 @@ #------------------------------------------------------------ -# $File: android,v 1.4 2014/06/03 19:01:34 christos Exp $ +# $File: android,v 1.7 2014/11/10 05:08:23 christos Exp $ # Various android related magic entries #------------------------------------------------------------ @@ -15,54 +15,11 @@ >0 regex dey\n[0-9]{2}\0 Dalvik dex file (optimized for host) >4 string >000 version %s -# http://android.stackexchange.com/questions/23357/\ -# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\ -# 23608#23608 -0 string ANDROID\040BACKUP\n Android Backup ->15 string 1\n \b, version 1 ->17 string 0\n \b, uncompressed ->17 string 1\n \b, compressed ->19 string none\n \b, unencrypted ->19 string AES-256\n \b, encrypted AES-256 - -# Android bootimg format -# From https://android.googlesource.com/\ -# platform/system/core/+/master/mkbootimg/bootimg.h -0 string ANDROID! Android bootimg ->8 lelong >0 \b, kernel ->>12 lelong >0 \b (0x%x) ->16 lelong >0 \b, ramdisk ->>20 lelong >0 \b (0x%x) ->24 lelong >0 \b, second stage ->>28 lelong >0 \b (0x%x) ->36 lelong >0 \b, page size: %d ->38 string >0 \b, name: %s ->64 string >0 \b, cmdline (%s) -# Dalvik .dex format. http://retrodev.com/android/dexformat.html -# From "Mike Fleming" -# Fixed to avoid regexec 17 errors on some dex files -# From "Tim Strazzere" -0 string dex\n ->0 regex dex\n[0-9]{2}\0 Dalvik dex file ->4 string >000 version %s -0 string dey\n ->0 regex dey\n[0-9]{2}\0 Dalvik dex file (optimized for host) ->4 string >000 version %s - -# http://android.stackexchange.com/questions/23357/\ -# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\ -# 23608#23608 -0 string ANDROID\040BACKUP\n Android Backup ->15 string 1\n \b, version 1 ->17 string 0\n \b, uncompressed ->17 string 1\n \b, compressed ->19 string none\n \b, unencrypted ->19 string AES-256\n \b, encrypted AES-256 - # Android bootimg format # From https://android.googlesource.com/\ # platform/system/core/+/master/mkbootimg/bootimg.h 0 string ANDROID! Android bootimg +>1024 string LOKI\01 \b, LOKI'd >8 lelong >0 \b, kernel >>12 lelong >0 \b (0x%x) >16 lelong >0 \b, ramdisk @@ -98,3 +55,85 @@ #>>>>>&1 regex/1l .* \b, PBKDF2 rounds: %s #>>>>>>&1 regex/1l .* \b, IV: %s #>>>>>>>&1 regex/1l .* \b, Key: %s + +# *.pit files by Joerg Jenderek +# http://forum.xda-developers.com/showthread.php?p=9122369 +# http://forum.xda-developers.com/showthread.php?t=816449 +# Partition Information Table for Samsung's smartphone with Android +# used by flash software Odin +0 ulelong 0x12349876 +# 1st pit entry marker +>0x01C ulequad&0xFFFFFFFCFFFFFFFC =0x0000000000000000 +# minimal 13 and maximal 18 PIT entries found +>>4 ulelong <128 Partition Information Table for Samsung smartphone +>>>4 ulelong x \b, %d entries +# 1. pit entry +>>>4 ulelong >0 \b; #1 +>>>0x01C use PIT-entry +>>>4 ulelong >1 \b; #2 +>>>0x0A0 use PIT-entry +>>>4 ulelong >2 \b; #3 +>>>0x124 use PIT-entry +>>>4 ulelong >3 \b; #4 +>>>0x1A8 use PIT-entry +>>>4 ulelong >4 \b; #5 +>>>0x22C use PIT-entry +>>>4 ulelong >5 \b; #6 +>>>0x2B0 use PIT-entry +>>>4 ulelong >6 \b; #7 +>>>0x334 use PIT-entry +>>>4 ulelong >7 \b; #8 +>>>0x3B8 use PIT-entry +>>>4 ulelong >8 \b; #9 +>>>0x43C use PIT-entry +>>>4 ulelong >9 \b; #10 +>>>0x4C0 use PIT-entry +>>>4 ulelong >10 \b; #11 +>>>0x544 use PIT-entry +>>>4 ulelong >11 \b; #12 +>>>0x5C8 use PIT-entry +>>>4 ulelong >12 \b; #13 +>>>>0x64C use PIT-entry +# 14. pit entry +>>>4 ulelong >13 \b; #14 +>>>>0x6D0 use PIT-entry +>>>4 ulelong >14 \b; #15 +>>>0x754 use PIT-entry +>>>4 ulelong >15 \b; #16 +>>>0x7D8 use PIT-entry +>>>4 ulelong >16 \b; #17 +>>>0x85C use PIT-entry +# 18. pit entry +>>>4 ulelong >17 \b; #18 +>>>0x8E0 use PIT-entry + +0 name PIT-entry +# garbage value implies end of pit entries +>0x00 ulequad&0xFFFFFFFCFFFFFFFC =0x0000000000000000 +# skip empty partition name +>>0x24 ubyte !0 +# partition name +>>>0x24 string >\0 %-.32s +# flags +>>>0x0C ulelong&0x00000002 2 \b+RW +# partition ID: +# 0~IPL,MOVINAND,GANG;1~PIT,GPT;2~HIDDEN;3~SBL,HIDDEN;4~SBL2,HIDDEN;5~BOOT;6~KENREl,RECOVER,misc;7~RECOVER +# ;11~MODEM;20~efs;21~PARAM;22~FACTORY,SYSTEM;23~DBDATAFS,USERDATA;24~CACHE;80~BOOTLOADER;81~TZSW +>>>0x08 ulelong x (0x%x) +# filename +>>>0x44 string >\0 "%-.64s" +#>>>0x18 ulelong >0 +# blocksize in 512 byte units ? +#>>>>0x18 ulelong x \b, %db +# partition size in blocks ? +#>>>>0x22 ulelong x \b*%d + +# Android bootimg format +# From https://android.googlesource.com/\ +# platform/system/core/+/master/libsparse/sparse_format.h +0 lelong 0xed26ff3a Android sparse image +>4 leshort x \b, version: %d +>6 leshort x \b.%d +>16 lelong x \b, Total of %d +>12 lelong x \b %d-byte output blocks in +>20 lelong x \b %d input chunks. Modified: vendor/file/dist/magic/Magdir/animation ============================================================================== --- vendor/file/dist/magic/Magdir/animation Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/magic/Magdir/animation Thu Dec 11 06:00:53 2014 (r275696) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: animation,v 1.53 2014/04/30 21:41:02 christos Exp $ +# $File: animation,v 1.56 2014/10/23 23:12:51 christos Exp $ # animation: file(1) magic for animation/movie formats # # animation formats @@ -32,43 +32,155 @@ !:mime application/x-quicktime-player 4 string/W jP JPEG 2000 image !:mime image/jp2 +# http://www.ftyps.com/ with local additions 4 string ftyp ISO Media ->8 string isom \b, MPEG v4 system, version 1 -!:mime video/mp4 ->8 string iso2 \b, MPEG v4 system, part 12 revision ->8 string mp41 \b, MPEG v4 system, version 1 -!:mime video/mp4 ->8 string mp42 \b, MPEG v4 system, version 2 -!:mime video/mp4 ->8 string mp7t \b, MPEG v4 system, MPEG v7 XML ->8 string mp7b \b, MPEG v4 system, MPEG v7 binary XML ->8 string/W jp2 \b, JPEG 2000 -!:mime image/jp2 +>8 string 3g2 \b, MPEG v4 system, 3GPP2 +!:mime video/3gpp2 +>>11 byte 4 \b v4 (H.263/AMR GSM 6.10) +>>11 byte 5 \b v5 (H.263/AMR GSM 6.10) +>>11 byte 6 \b v6 (ITU H.264/AMR GSM 6.10) +>>11 byte a \b C.S0050-0 V1.0 +>>11 byte b \b C.S0050-0-A V1.0.0 +>>11 byte c \b C.S0050-0-B V1.0 >8 string 3ge \b, MPEG v4 system, 3GPP !:mime video/3gpp +>>11 byte 6 \b, Release 6 MBMS Extended Presentations +>>11 byte 7 \b, Release 7 MBMS Extended Presentations >8 string 3gg \b, MPEG v4 system, 3GPP +>11 byte 6 \b, Release 6 General Profile !:mime video/3gpp >8 string 3gp \b, MPEG v4 system, 3GPP +>11 byte 1 \b, Release %d (non existent) +>11 byte 2 \b, Release %d (non existent) +>11 byte 3 \b, Release %d (non existent) +>11 byte 4 \b, Release %d +>11 byte 5 \b, Release %d +>11 byte 6 \b, Release %d +>11 byte 7 \b, Release %d Streaming Servers !:mime video/3gpp >8 string 3gs \b, MPEG v4 system, 3GPP +>11 byte 7 \b, Release %d Streaming Servers !:mime video/3gpp ->8 string 3g2 \b, MPEG v4 system, 3GPP2 +>8 string avc1 \b, MPEG v4 system, 3GPP JVT AVC [ISO 14496-12:2005] +!:mime video/mp4 +>8 string/W qt \b, Apple QuickTime movie +!:mime video/quicktime +>8 string CAEP \b, Canon Digital Camera +>8 string caqv \b, Casio Digital Camera +>8 string CDes \b, Convergent Design +>8 string da0a \b, DMB MAF w/ MPEG Layer II aud, MOT slides, DLS, JPG/PNG/MNG +>8 string da0b \b, DMB MAF, ext DA0A, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string da1a \b, DMB MAF audio with ER-BSAC audio, JPG/PNG/MNG images +>8 string da1b \b, DMB MAF, ext da1a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string da2a \b, DMB MAF aud w/ HE-AAC v2 aud, MOT slides, DLS, JPG/PNG/MNG +>8 string da2b \b, DMB MAF, ext da2a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string da3a \b, DMB MAF aud with HE-AAC aud, JPG/PNG/MNG images +>8 string da3b \b, DMB MAF, ext da3a w/ BIFS, 3GPP, DID, TVA, REL, IPMP +>8 string dmb1 \b, DMB MAF supporting all the components defined in the spec +>8 string dmpf \b, Digital Media Project +>8 string drc1 \b, Dirac (wavelet compression), encap in ISO base media (MP4) +>8 string dv1a \b, DMB MAF vid w/ AVC vid, ER-BSAC aud, BIFS, JPG/PNG/MNG, TS +>8 string dv1b \b, DMB MAF, ext dv1a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string dv2a \b, DMB MAF vid w/ AVC vid, HE-AAC v2 aud, BIFS, JPG/PNG/MNG, TS +>8 string dv2b \b, DMB MAF, ext dv2a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string dv3a \b, DMB MAF vid w/ AVC vid, HE-AAC aud, BIFS, JPG/PNG/MNG, TS +>8 string dv3b \b, DMB MAF, ext dv3a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string dvr1 \b, DVB (.DVB) over RTP +!:mime video/vnd.dvb.file +>8 string dvt1 \b, DVB (.DVB) over MPEG-2 Transport Stream +!:mime video/vnd.dvb.file +>8 string F4V \b, Video for Adobe Flash Player 9+ (.F4V) +!:mime video/mp4 +>8 string F4P \b, Protected Video for Adobe Flash Player 9+ (.F4P) +!:mime video/mp4 +>8 string F4A \b, Audio for Adobe Flash Player 9+ (.F4A) +!:mime audio/mp4 +>8 string F4B \b, Audio Book for Adobe Flash Player 9+ (.F4B) +!:mime audio/mp4 +>8 string isc2 \b, ISMACryp 2.0 Encrypted File +# ?/enc-isoff-generic +>8 string iso2 \b, MP4 Base Media v2 [ISO 14496-12:2005] +!:mime video/mp4 +>8 string isom \b, MP4 Base Media v1 [IS0 14496-12:2003] +!:mime video/mp4 +>8 string/W jp2 \b, JPEG 2000 +!:mime image/jp2 +>8 string JP2 \b, JPEG 2000 Image (.JP2) [ISO 15444-1 ?] +!:mime image/jp2 +>8 string JP20 \b, Unknown, from GPAC samples (prob non-existent) +>8 string jpm \b, JPEG 2000 Compound Image (.JPM) [ISO 15444-6] +!:mime image/jpm +>8 string jpx \b, JPEG 2000 w/ extensions (.JPX) [ISO 15444-2] +!:mime image/jpx +>8 string KDDI \b, 3GPP2 EZmovie for KDDI 3G cellphones !:mime video/3gpp2 ->>11 byte 4 \b v4 (H.263/AMR GSM 6.10) ->>11 byte 5 \b v5 (H.263/AMR GSM 6.10) ->>11 byte 6 \b v6 (ITU H.264/AMR GSM 6.10) +>8 string M4A \b, Apple iTunes ALAC/AAC-LC (.M4A) Audio +!:mime audio/x-m4a +>8 string M4B \b, Apple iTunes ALAC/AAC-LC (.M4B) Audio Book +!:mime audio/mp4 +>8 string M4P \b, Apple iTunes ALAC/AAC-LC (.M4P) AES Protected Audio +!:mime video/mp4 +>8 string M4V \b, Apple iTunes Video (.M4V) Video +!:mime video/x-m4v +>8 string M4VH \b, Apple TV (.M4V) +!:mime video/x-m4v +>8 string M4VP \b, Apple iPhone (.M4V) +!:mime video/x-m4v +>8 string mj2s \b, Motion JPEG 2000 [ISO 15444-3] Simple Profile +!:mime video/mj2 +>8 string mjp2 \b, Motion JPEG 2000 [ISO 15444-3] General Profile +!:mime video/mj2 +>8 string mmp4 \b, MPEG-4/3GPP Mobile Profile (.MP4 / .3GP) (for NTT) +!:mime video/mp4 +>8 string mobi \b, MPEG-4, MOBI format +!:mime video/mp4 +>8 string mp21 \b, MPEG-21 [ISO/IEC 21000-9] +>8 string mp41 \b, MP4 v1 [ISO 14496-1:ch13] +!:mime video/mp4 +>8 string mp42 \b, MP4 v2 [ISO 14496-14] +!:mime video/mp4 +>8 string mp71 \b, MP4 w/ MPEG-7 Metadata [per ISO 14496-12] +>8 string mp7t \b, MPEG v4 system, MPEG v7 XML +>8 string mp7b \b, MPEG v4 system, MPEG v7 binary XML >8 string mmp4 \b, MPEG v4 system, 3GPP Mobile !:mime video/mp4 ->8 string avc1 \b, MPEG v4 system, 3GPP JVT AVC -!:mime video/3gpp ->8 string/W M4A \b, MPEG v4 system, iTunes AAC-LC +>8 string MPPI \b, Photo Player, MAF [ISO/IEC 23000-3] +>8 string mqt \b, Sony / Mobile QuickTime (.MQV) US Pat 7,477,830 +!:mime video/quicktime +>8 string MSNV \b, MPEG-4 (.MP4) for SonyPSP +!:mime audio/mp4 +>8 string NDAS \b, MP4 v2 [ISO 14496-14] Nero Digital AAC Audio !:mime audio/mp4 ->8 string/W M4V \b, MPEG v4 system, iTunes AVC-LC +>8 string NDSC \b, MPEG-4 (.MP4) Nero Cinema Profile !:mime video/mp4 ->8 string/W M4P \b, MPEG v4 system, iTunes AES encrypted ->8 string/W M4B \b, MPEG v4 system, iTunes bookmarked ->8 string/W qt \b, Apple QuickTime movie +>8 string NDSH \b, MPEG-4 (.MP4) Nero HDTV Profile +!:mime video/mp4 +>8 string NDSM \b, MPEG-4 (.MP4) Nero Mobile Profile +!:mime video/mp4 +>8 string NDSP \b, MPEG-4 (.MP4) Nero Portable Profile +!:mime video/mp4 +>8 string NDSS \b, MPEG-4 (.MP4) Nero Standard Profile +!:mime video/mp4 +>8 string NDXC \b, H.264/MPEG-4 AVC (.MP4) Nero Cinema Profile +!:mime video/mp4 +>8 string NDXH \b, H.264/MPEG-4 AVC (.MP4) Nero HDTV Profile +!:mime video/mp4 +>8 string NDXM \b, H.264/MPEG-4 AVC (.MP4) Nero Mobile Profile +!:mime video/mp4 +>8 string NDXP \b, H.264/MPEG-4 AVC (.MP4) Nero Portable Profile +!:mime video/mp4 +>8 string NDXS \b, H.264/MPEG-4 AVC (.MP4) Nero Standard Profile +!:mime video/mp4 +>8 string odcf \b, OMA DCF DRM Format 2.0 (OMA-TS-DRM-DCF-V2_0-20060303-A) +>8 string opf2 \b, OMA PDCF DRM Format 2.1 (OMA-TS-DRM-DCF-V2_1-20070724-C) +>8 string opx2 \b, OMA PDCF DRM + XBS ext (OMA-TS-DRM_XBS-V1_0-20070529-C) +>8 string pana \b, Panasonic Digital Camera +>8 string qt \b, Apple QuickTime (.MOV/QT) !:mime video/quicktime +>8 string ROSS \b, Ross Video +>8 string sdv \b, SD Memory Card Video +>8 string ssc1 \b, Samsung stereo, single stream (patent pending) +>8 string ssc2 \b, Samsung stereo, dual stream (patent pending) # MPEG sequences # Scans for all common MPEG header start codes Modified: vendor/file/dist/magic/Magdir/archive ============================================================================== --- vendor/file/dist/magic/Magdir/archive Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/magic/Magdir/archive Thu Dec 11 06:00:53 2014 (r275696) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: archive,v 1.87 2014/06/03 19:15:58 christos Exp $ +# $File: archive,v 1.88 2014/08/16 10:42:17 christos Exp $ # archive: file(1) magic for archive formats (see also "msdos" for self- # extracting compressed archives) # @@ -954,34 +954,3 @@ >0xE08 search/7776 \x55\xAA >>&-512 indirect x \b; contains -# Symantec GHOST image by Joerg Jenderek at May 2014 -# http://us.norton.com/ghost/ -# http://www.garykessler.net/library/file_sigs.html -0 ubelong&0xFFFFf7f0 0xFEEF0100 Norton GHost image -# *.GHO ->2 ubyte&0x08 0x00 \b, first file -# *.GHS or *.[0-9] with cns program option ->2 ubyte&0x08 0x08 \b, split file -# part of split index interesting for *.ghs ->>4 ubyte x id=0x%x -# compression tag minus one equals numeric compression command line switch z[1-9] ->3 ubyte 0 \b, no compression ->3 ubyte 2 \b, fast compression (Z1) ->3 ubyte 3 \b, medium compression (Z2) ->3 ubyte >3 ->>3 ubyte <11 \b, compression (Z%d-1) ->2 ubyte&0x08 0x00 -# ~ 30 byte password field only for *.gho ->>12 ubequad !0 \b, password protected ->>44 ubyte !1 -# 1~Image All, sector-by-sector only for *.gho ->>>10 ubyte 1 \b, sector copy -# 1~Image Boot track only for *.gho ->>>43 ubyte 1 \b, boot track -# 1~Image Disc only for *.gho implies Image Boot track and sector copy ->>44 ubyte 1 \b, disc sector copy -# optional image description only *.gho ->>0xff string >\0 "%-.254s" -# look for DOS sector end sequence ->0xE08 search/7776 \x55\xAA ->>&-512 indirect x \b; contains Modified: vendor/file/dist/magic/Magdir/blender ============================================================================== --- vendor/file/dist/magic/Magdir/blender Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/magic/Magdir/blender Thu Dec 11 06:00:53 2014 (r275696) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: blender,v 1.5 2009/09/19 16:28:08 christos Exp $ +# $File: blender,v 1.6 2014/08/30 08:34:17 christos Exp $ # blender: file(1) magic for Blender 3D related files # # Native format rule v1.2. For questions use the developers list @@ -35,5 +35,5 @@ >>>0x44 string =GLOB \b. >>>>0x60 beshort x \b%.4d -# Scripts that run in the embeded Python interpreter +# Scripts that run in the embedded Python interpreter 0 string #!BPY Blender3D BPython script Modified: vendor/file/dist/magic/Magdir/commands ============================================================================== --- vendor/file/dist/magic/Magdir/commands Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/magic/Magdir/commands Thu Dec 11 06:00:53 2014 (r275696) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: commands,v 1.50 2014/05/30 16:48:44 christos Exp $ +# $File: commands,v 1.51 2014/09/27 00:12:55 christos Exp $ # commands: file(1) magic for various shells and interpreters # #0 string/w : shell archive or script for antique kernel text @@ -56,7 +56,7 @@ !:mime text/x-awk 0 string/wt #!\ /usr/bin/awk awk script text executable !:mime text/x-awk -0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text +0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk or perl script text # AT&T Bell Labs' Plan 9 shell 0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable Modified: vendor/file/dist/magic/Magdir/compress ============================================================================== --- vendor/file/dist/magic/Magdir/compress Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/magic/Magdir/compress Thu Dec 11 06:00:53 2014 (r275696) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: compress,v 1.58 2014/05/07 19:36:59 christos Exp $ +# $File: compress,v 1.62 2014/09/13 14:27:12 christos Exp $ # compress: file(1) magic for pure-compression formats (no archives) # # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc. @@ -251,3 +251,13 @@ # http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt 0 string \377\006\0\0sNaPpY snappy framed data !:mime application/x-snappy-framed + +# qpress, http://www.quicklz.com/ +0 string qpress10 qpress compressed data +!:mime application/x-qpress + +# Zlib https://www.ietf.org/rfc/rfc6713.txt +0 beshort%31 =0 +>0 byte&0xf =8 +>>0 byte&0x80 =0 zlib compressed data +!:mime application/zlib Modified: vendor/file/dist/magic/Magdir/database ============================================================================== --- vendor/file/dist/magic/Magdir/database Thu Dec 11 00:41:54 2014 (r275695) +++ vendor/file/dist/magic/Magdir/database Thu Dec 11 06:00:53 2014 (r275696) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: database,v 1.41 2014/06/03 19:17:27 christos Exp $ +# $File: database,v 1.43 2014/10/28 15:47:39 christos Exp $ # database: file(1) magic for various databases # # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk) @@ -9,9 +9,17 @@ # GDBM magic numbers # Will be maintained as part of the GDBM distribution in the future. # -0 belong 0x13579ace GNU dbm 1.x or ndbm database, big endian +0 belong 0x13579acd GNU dbm 1.x or ndbm database, big endian, 32-bit !:mime application/x-gdbm -0 lelong 0x13579ace GNU dbm 1.x or ndbm database, little endian +0 belong 0x13579ace GNU dbm 1.x or ndbm database, big endian, old +!:mime application/x-gdbm +0 belong 0x13579acf GNU dbm 1.x or ndbm database, big endian, 64-bit +!:mime application/x-gdbm +0 lelong 0x13579acd GNU dbm 1.x or ndbm database, little endian, 32-bit +!:mime application/x-gdbm +0 lelong 0x13579ace GNU dbm 1.x or ndbm database, little endian, old +!:mime application/x-gdbm +0 lelong 0x13579acf GNU dbm 1.x or ndbm database, little endian, 64-bit !:mime application/x-gdbm 0 string GDBM GNU dbm 2.x database !:mime application/x-gdbm @@ -202,27 +210,27 @@ # for multiple index files (*.MDX) Production flag,tag numbers(<=0x30),tag length(<=0x20), reserverd (NULL) >>>>>>>24 ubelong&0x0133f7ff >0 # test for reserved NULL byte ->>>>>>>>47 ubyte x +>>>>>>>>47 ubyte 0 # test for valid TAG key format (0x10 or 0) >>>>>>>>>559 ubyte&0xeF 0 # test MM <= 12 ->>>>>>>>>45 ubeshort <0x0C20 ->>>>>>>>>>45 ubyte >0 ->>>>>>>>>>>46 ubyte <32 ->>>>>>>>>>>>46 ubyte >0 +>>>>>>>>>>45 ubeshort <0x0C20 +>>>>>>>>>>>45 ubyte >0 +>>>>>>>>>>>>46 ubyte <32 +>>>>>>>>>>>>>46 ubyte >0 #!:mime application/x-mdx ->>>>>>>>>>>>>0 use xbase-type ->>>>>>>>>>>>>0 ubyte x \b MDX ->>>>>>>>>>>>>1 ubyte x \b, creation-date ->>>>>>>>>>>>>1 use xbase-date ->>>>>>>>>>>>>44 ubyte x \b, update-date ->>>>>>>>>>>>>44 use xbase-date +>>>>>>>>>>>>>>0 use xbase-type +>>>>>>>>>>>>>>0 ubyte x \b MDX +>>>>>>>>>>>>>>1 ubyte x \b, creation-date +>>>>>>>>>>>>>>1 use xbase-date +>>>>>>>>>>>>>>44 ubyte x \b, update-date +>>>>>>>>>>>>>>44 use xbase-date # No.of tags in use (1,2,5,12) ->>>>>>>>>>>>>28 uleshort x \b, %d +>>>>>>>>>>>>>>28 uleshort x \b, %d # No. of entries in tag (0x30) ->>>>>>>>>>>>>25 ubyte x \b/%d tags +>>>>>>>>>>>>>>25 ubyte x \b/%d tags # Length of tag ->>>>>>>>>>>>>26 ubyte x * %d +>>>>>>>>>>>>>>26 ubyte x * %d # 1st tag name_ >>>>>>>>>>>>>548 string x \b, 1st tag "%.11s" # 2nd tag name @@ -337,60 +345,103 @@ # dBASE III >>>>>>16 ubyte 3 # dBASE III DBT ->>>>>>>0 use xbase-memo-print -# dBASE IV DBT , FoxPro FPT or many PNG , ZIP , DBF garbage +>>>>>>>0 use dbase3-memo-print +# dBASE III DBT without version, dBASE IV DBT , FoxPro FPT , or many ZIP , DBF garbage >>>>>>16 ubyte 0 -# dBASE IV DBT with DBF name or DBF garbage ->>>>>>>8 ubelong >0x40000000 -# skip DBF and catch dBASE IV DBT with DBF name and with non big index of next free block ->>>>>>>>0 ulelong <0x01010002 ->>>>>>>>>0 use xbase-memo-print ->>>>>>>8 ubelong 0 +# unusual dBASE III DBT like angest.dbt, dBASE IV DBT with block size 0 , FoxPro FPT , or garbage PCX DBF +>>>>>>>20 uleshort 0 +# FoxPro FPT , unusual dBASE III DBT like biblio.dbt or garbage +>>>>>>>>8 ulong =0 +>>>>>>>>>6 ubeshort >0 +# skip emacs.PIF +>>>>>>>>>>4 ushort 0 +>>>>>>>>>>>0 use foxpro-memo-print +# dBASE III DBT , garbage +>>>>>>>>>6 ubeshort 0 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 06:52:16 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55CE1C02; Thu, 11 Dec 2014 06:52:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DE9161C; Thu, 11 Dec 2014 06:52:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB6qGxw013807; Thu, 11 Dec 2014 06:52:16 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB6qBIw013782; Thu, 11 Dec 2014 06:52:11 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412110652.sBB6qBIw013782@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 11 Dec 2014 06:52:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275698 - in head: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/python contrib/file/src contrib/file/tests lib/libmagic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 06:52:16 -0000 Author: delphij Date: Thu Dec 11 06:52:10 2014 New Revision: 275698 URL: https://svnweb.freebsd.org/changeset/base/275698 Log: MFV r275696: file 5.21. MFC after: 2 weeks Added: head/contrib/file/magic/Magdir/kerberos - copied unchanged from r275696, vendor/file/dist/magic/Magdir/kerberos head/contrib/file/magic/Magdir/meteorological - copied unchanged from r275696, vendor/file/dist/magic/Magdir/meteorological Deleted: head/contrib/file/magic/Magdir/rinex Modified: head/contrib/file/ChangeLog head/contrib/file/Makefile.in head/contrib/file/TODO head/contrib/file/aclocal.m4 head/contrib/file/config.h.in head/contrib/file/configure head/contrib/file/configure.ac head/contrib/file/doc/Makefile.in head/contrib/file/doc/file.man head/contrib/file/doc/libmagic.man head/contrib/file/magic/Localstuff head/contrib/file/magic/Magdir/android head/contrib/file/magic/Magdir/animation head/contrib/file/magic/Magdir/archive head/contrib/file/magic/Magdir/blender head/contrib/file/magic/Magdir/commands head/contrib/file/magic/Magdir/compress head/contrib/file/magic/Magdir/database head/contrib/file/magic/Magdir/elf head/contrib/file/magic/Magdir/filesystems head/contrib/file/magic/Magdir/images head/contrib/file/magic/Magdir/jpeg head/contrib/file/magic/Magdir/linux head/contrib/file/magic/Magdir/macintosh head/contrib/file/magic/Magdir/msooxml head/contrib/file/magic/Magdir/netbsd head/contrib/file/magic/Magdir/pascal head/contrib/file/magic/Magdir/pgp head/contrib/file/magic/Magdir/python head/contrib/file/magic/Magdir/riff head/contrib/file/magic/Magdir/sequent head/contrib/file/magic/Magdir/sereal head/contrib/file/magic/Magdir/ssh head/contrib/file/magic/Magdir/vms head/contrib/file/magic/Magdir/vorbis head/contrib/file/magic/Magdir/windows head/contrib/file/magic/Makefile.am head/contrib/file/magic/Makefile.in head/contrib/file/missing head/contrib/file/python/Makefile.in head/contrib/file/src/Makefile.in head/contrib/file/src/apprentice.c head/contrib/file/src/ascmagic.c head/contrib/file/src/cdf.c head/contrib/file/src/cdf.h head/contrib/file/src/compress.c head/contrib/file/src/elfclass.h head/contrib/file/src/encoding.c head/contrib/file/src/file.c head/contrib/file/src/file.h head/contrib/file/src/file_opts.h head/contrib/file/src/fsmagic.c head/contrib/file/src/funcs.c head/contrib/file/src/getline.c head/contrib/file/src/magic.c head/contrib/file/src/magic.h head/contrib/file/src/magic.h.in head/contrib/file/src/pread.c head/contrib/file/src/readcdf.c head/contrib/file/src/readelf.c head/contrib/file/src/softmagic.c head/contrib/file/src/vasprintf.c head/contrib/file/tests/Makefile.in head/lib/libmagic/config.h Directory Properties: head/contrib/file/ (props changed) Modified: head/contrib/file/ChangeLog ============================================================================== --- head/contrib/file/ChangeLog Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/ChangeLog Thu Dec 11 06:52:10 2014 (r275698) @@ -1,3 +1,69 @@ +2014-12-10 20:01 Christos Zoulas + + * release 5.21 + +2014-11-27 18:40 Christos Zoulas + + * Allow setting more parameters from the command line. + * Split name/use and indirect magic recursion limits. + +2014-11-27 11:12 Christos Zoulas + + * Adjust ELF parameters and the default recursion + level. + * Allow setting the recursion level dynamically. + +2014-11-24 8:55 Christos Zoulas + + * The following fixes resulted from Thomas Jarosch's fuzzing + tests that revealed severe performance issues on pathological + input: + - limit number of elf program and sections processing + - abort elf note processing quickly + - reduce the number of recursion levels from 20 to 10 + - preserve error messages in indirect magic handling + +2014-11-12 10:30 Christos Zoulas + + * fix bogus free in the user buffer case. + +2014-11-11 12:35 Christos Zoulas + + * fix out of bounds read for pascal strings + * fix memory leak (not freeing the head of each mlist) + +2014-11-07 10:25 Christos Zoulas + + * When printing strings from a file, convert them to printable + on a byte by byte basis, so that we don't get issues with + locale's trying to interpret random byte streams as UTF-8 and + having printf error out with EILSEQ. + +2014-10-17 11:48 Christos Zoulas + + * fix bounds in note reading (Francisco Alonso / Red Hat) + +2014-10-11 15:02 Christos Zoulas + + * fix autoconf glue for setlocale and locale_t; some OS's + have locale_t in xlocale.h + +2014-10-10 15:01 Christos Zoulas + + * release 5.20 + +2014-08-17 10:01 Christos Zoulas + + * recognize encrypted CDF documents + +2014-08-04 9:18 Christos Zoulas + + * add magic_load_buffers from Brooks Davis + +2014-07-24 16:40 Christos Zoulas + + * add thumbs.db support + 2014-06-12 12:28 Christos Zoulas * release 5.19 Modified: head/contrib/file/Makefile.in ============================================================================== --- head/contrib/file/Makefile.in Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/Makefile.in Thu Dec 11 06:52:10 2014 (r275698) @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -618,9 +618,10 @@ distcheck: dist && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + && ../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ Modified: head/contrib/file/TODO ============================================================================== --- head/contrib/file/TODO Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/TODO Thu Dec 11 06:52:10 2014 (r275698) @@ -15,3 +15,5 @@ small amount of C is needed (because fas required for soft magic, not the more detailed information given by hard-wired routines). In this regard, note that hplip, which is BSD-licensed, has a magic reimplementation in Python. + +Read the kerberos magic entry for more ideas. Modified: head/contrib/file/aclocal.m4 ============================================================================== --- head/contrib/file/aclocal.m4 Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/aclocal.m4 Thu Dec 11 06:52:10 2014 (r275698) @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.14 -*- Autoconf -*- +# generated automatically by aclocal 1.14.1 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. @@ -21,7 +21,7 @@ If you have problems, you may need to re To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # visibility.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008, 2010-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -113,7 +113,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.14' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14], [], +m4_if([$1], [1.14.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -129,7 +129,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14])dnl +[AM_AUTOMAKE_VERSION([1.14.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) Modified: head/contrib/file/config.h.in ============================================================================== --- head/contrib/file/config.h.in Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/config.h.in Thu Dec 11 06:52:10 2014 (r275698) @@ -44,6 +44,9 @@ /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK +/* Define to 1 if you have the `freelocale' function. */ +#undef HAVE_FREELOCALE + /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO @@ -95,9 +98,15 @@ /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP +/* Define to 1 if you have the `newlocale' function. */ +#undef HAVE_NEWLOCALE + /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H @@ -182,6 +191,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `uselocale' function. */ +#undef HAVE_USELOCALE + /* Define to 1 if you have the `utime' function. */ #undef HAVE_UTIME @@ -219,6 +231,9 @@ /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK +/* Define to 1 if you have the header file. */ +#undef HAVE_XLOCALE_H + /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H Modified: head/contrib/file/configure ============================================================================== --- head/contrib/file/configure Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/configure Thu Dec 11 06:52:10 2014 (r275698) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.19. +# Generated by GNU Autoconf 2.69 for file 5.21. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.19' -PACKAGE_STRING='file 5.19' +PACKAGE_VERSION='5.21' +PACKAGE_STRING='file 5.21' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.19 to adapt to many kinds of systems. +\`configure' configures file 5.21 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1397,7 +1397,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.19:";; + short | recursive ) echo "Configuration of file 5.21:";; esac cat <<\_ACEOF @@ -1507,7 +1507,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.19 +file configure 5.21 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2163,7 +2163,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.19, which was +It was created by file $as_me 5.21, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3029,7 +3029,7 @@ fi # Define the identity of the package. PACKAGE='file' - VERSION='5.19' + VERSION='5.21' cat >>confdefs.h <<_ACEOF @@ -12785,7 +12785,7 @@ fi done -for ac_header in getopt.h err.h +for ac_header in getopt.h err.h xlocale.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -14191,7 +14191,7 @@ fi fi -for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof +for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -14998,7 +14998,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.19, which was +This file was extended by file $as_me 5.21, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15064,7 +15064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.19 +file config.status 5.21 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/file/configure.ac ============================================================================== --- head/contrib/file/configure.ac Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/configure.ac Thu Dec 11 06:52:10 2014 (r275698) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.19],[christos@astron.com]) +AC_INIT([file],[5.21],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -82,7 +82,7 @@ AC_HEADER_MAJOR AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) -AC_CHECK_HEADERS(getopt.h err.h) +AC_CHECK_HEADERS(getopt.h err.h xlocale.h) AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) AC_CHECK_HEADERS(zlib.h) @@ -138,7 +138,7 @@ else fi]) dnl Checks for functions -AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof) +AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) dnl Provide implementation of some required functions if necessary AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck) Modified: head/contrib/file/doc/Makefile.in ============================================================================== --- head/contrib/file/doc/Makefile.in Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/doc/Makefile.in Thu Dec 11 06:52:10 2014 (r275698) @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. Modified: head/contrib/file/doc/file.man ============================================================================== --- head/contrib/file/doc/file.man Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/doc/file.man Thu Dec 11 06:52:10 2014 (r275698) @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.106 2014/03/07 23:11:51 christos Exp $ -.Dd December 3, 2014 +.\" $File: file.man,v 1.110 2014/11/28 02:46:39 christos Exp $ +.Dd November 27, 2014 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -16,6 +16,7 @@ .Op Fl F Ar separator .Op Fl f Ar namefile .Op Fl m Ar magicfiles +.Op Fl P Ar name=value .Ar .Ek .Nm @@ -303,6 +304,15 @@ or attempt to preserve the access time of files analyzed, to pretend that .Nm never read them. +.It Fl P , Fl Fl parameter Ar name=value +Set various parameter limits. +.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent +.It Sy "Name" Ta Sy "Default" Ta Sy "Explanation" +.It Li indir Ta 15 Ta recursion limit for indirect magic +.It Li name Ta 30 Ta use count limit for name/use magic +.It Li elf_phnum Ta 128 Ta max ELF program sections processed +.It Li elf_shnum Ta 32768 Ta max ELF sections processed +.El .It Fl r , Fl Fl raw Don't translate unprintable characters to \eooo. Normally Modified: head/contrib/file/doc/libmagic.man ============================================================================== --- head/contrib/file/doc/libmagic.man Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/doc/libmagic.man Thu Dec 11 06:52:10 2014 (r275698) @@ -1,4 +1,4 @@ -.\" $File: libmagic.man,v 1.28 2014/03/02 14:47:16 christos Exp $ +.\" $File: libmagic.man,v 1.33 2014/11/28 02:46:39 christos Exp $ .\" .\" Copyright (c) Christos Zoulas 2003. .\" All Rights Reserved. @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 6, 2012 +.Dd November 27, 2014 .Dt LIBMAGIC 3 .Os .Sh NAME @@ -40,6 +40,9 @@ .Nm magic_compile , .Nm magic_list , .Nm magic_load , +.Nm magic_load_buffers , +.Nm magic_setparam , +.Nm magic_getparam , .Nm magic_version .Nd Magic number recognition library .Sh LIBRARY @@ -71,6 +74,12 @@ .Ft int .Fn magic_load "magic_t cookie" "const char *filename" .Ft int +.Fn magic_load_buffers "magic_t cookie" "void **buffers" "size_t *sizes" "size_t nbuffers" +.Ft int +.Fn magic_getparam "magic_t cookie" "int param" "void *value" +.Ft int +.Fn magic_setparam "magic_t cookie" "int param" "const void *value" +.Ft int .Fn magic_version "void" .Sh DESCRIPTION These functions @@ -253,6 +262,55 @@ adds to the database filename as appropriate. .Pp The +.Fn magic_load_buffers +function takes an array of size +.Fa nbuffers +of +.Fa buffers +with a respective size for each in the array of +.Fa sizes +loaded with the contents of the magic databases from the filesystem. +This function can be used in environment where the magic library does +not have direct access to the filesystem, but can access the magic +database via shared memory or other IPC means. +.Pp +The +.Fn magic_getparam +and +.Fn magic_setparam +allow getting and setting various limits related to the the magic +library. +.Bl -column "MAGIC_PARAM_ELF_PHNUM_MAX" "size_t" "Default" -offset indent +.It Sy "Parameter" Ta Sy "Type" Ta Sy "Default" +.It Li MAGIC_PARAM_INDIR_MAX Ta size_t Ta 15 +.It Li MAGIC_PARAM_NAME_MAX Ta size_t Ta 30 +.It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128 +.It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768 +.El +.Pp +The +.Dv MAGIC_PARAM_INDIR_RECURSION +parameter controls how many levels of recursion will be followed for +indirect magic entries. +.Pp +The +.Dv MAGIC_PARAM_NAME_RECURSION +parameter controls how many levels of recursion will be followed for +for name/use calls. +.Pp +The +.Dv MAGIC_PARAM_NAME_MAX +parameter controls the maximum number of calls for name/use. +.Pp +The +.Dv MAGIC_PARAM_PHNUM_MAX +parameter controls how many elf program sections will be processed. +.Pp +The +.Dv MAGIC_PARAM_SHNUM_MAX +parameter controls how many elf sections will be processed. +.Pp +The .Fn magic_version command returns the version number of this library which is compiled into the shared library using the constant Modified: head/contrib/file/magic/Localstuff ============================================================================== --- head/contrib/file/magic/Localstuff Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/magic/Localstuff Thu Dec 11 06:52:10 2014 (r275698) @@ -2,6 +2,6 @@ #------------------------------------------------------------------------------ # Localstuff: file(1) magic for locally observed files # -# $File: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $ +# $File: Localstuff,v 1.5 2007/01/12 17:38:27 christos Exp $ # Add any locally observed files here. Remember: # text if readable, executable if runnable binary, data if unreadable. Modified: head/contrib/file/magic/Magdir/android ============================================================================== --- head/contrib/file/magic/Magdir/android Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/magic/Magdir/android Thu Dec 11 06:52:10 2014 (r275698) @@ -1,6 +1,6 @@ #------------------------------------------------------------ -# $File: android,v 1.4 2014/06/03 19:01:34 christos Exp $ +# $File: android,v 1.7 2014/11/10 05:08:23 christos Exp $ # Various android related magic entries #------------------------------------------------------------ @@ -15,54 +15,11 @@ >0 regex dey\n[0-9]{2}\0 Dalvik dex file (optimized for host) >4 string >000 version %s -# http://android.stackexchange.com/questions/23357/\ -# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\ -# 23608#23608 -0 string ANDROID\040BACKUP\n Android Backup ->15 string 1\n \b, version 1 ->17 string 0\n \b, uncompressed ->17 string 1\n \b, compressed ->19 string none\n \b, unencrypted ->19 string AES-256\n \b, encrypted AES-256 - -# Android bootimg format -# From https://android.googlesource.com/\ -# platform/system/core/+/master/mkbootimg/bootimg.h -0 string ANDROID! Android bootimg ->8 lelong >0 \b, kernel ->>12 lelong >0 \b (0x%x) ->16 lelong >0 \b, ramdisk ->>20 lelong >0 \b (0x%x) ->24 lelong >0 \b, second stage ->>28 lelong >0 \b (0x%x) ->36 lelong >0 \b, page size: %d ->38 string >0 \b, name: %s ->64 string >0 \b, cmdline (%s) -# Dalvik .dex format. http://retrodev.com/android/dexformat.html -# From "Mike Fleming" -# Fixed to avoid regexec 17 errors on some dex files -# From "Tim Strazzere" -0 string dex\n ->0 regex dex\n[0-9]{2}\0 Dalvik dex file ->4 string >000 version %s -0 string dey\n ->0 regex dey\n[0-9]{2}\0 Dalvik dex file (optimized for host) ->4 string >000 version %s - -# http://android.stackexchange.com/questions/23357/\ -# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\ -# 23608#23608 -0 string ANDROID\040BACKUP\n Android Backup ->15 string 1\n \b, version 1 ->17 string 0\n \b, uncompressed ->17 string 1\n \b, compressed ->19 string none\n \b, unencrypted ->19 string AES-256\n \b, encrypted AES-256 - # Android bootimg format # From https://android.googlesource.com/\ # platform/system/core/+/master/mkbootimg/bootimg.h 0 string ANDROID! Android bootimg +>1024 string LOKI\01 \b, LOKI'd >8 lelong >0 \b, kernel >>12 lelong >0 \b (0x%x) >16 lelong >0 \b, ramdisk @@ -98,3 +55,85 @@ #>>>>>&1 regex/1l .* \b, PBKDF2 rounds: %s #>>>>>>&1 regex/1l .* \b, IV: %s #>>>>>>>&1 regex/1l .* \b, Key: %s + +# *.pit files by Joerg Jenderek +# http://forum.xda-developers.com/showthread.php?p=9122369 +# http://forum.xda-developers.com/showthread.php?t=816449 +# Partition Information Table for Samsung's smartphone with Android +# used by flash software Odin +0 ulelong 0x12349876 +# 1st pit entry marker +>0x01C ulequad&0xFFFFFFFCFFFFFFFC =0x0000000000000000 +# minimal 13 and maximal 18 PIT entries found +>>4 ulelong <128 Partition Information Table for Samsung smartphone +>>>4 ulelong x \b, %d entries +# 1. pit entry +>>>4 ulelong >0 \b; #1 +>>>0x01C use PIT-entry +>>>4 ulelong >1 \b; #2 +>>>0x0A0 use PIT-entry +>>>4 ulelong >2 \b; #3 +>>>0x124 use PIT-entry +>>>4 ulelong >3 \b; #4 +>>>0x1A8 use PIT-entry +>>>4 ulelong >4 \b; #5 +>>>0x22C use PIT-entry +>>>4 ulelong >5 \b; #6 +>>>0x2B0 use PIT-entry +>>>4 ulelong >6 \b; #7 +>>>0x334 use PIT-entry +>>>4 ulelong >7 \b; #8 +>>>0x3B8 use PIT-entry +>>>4 ulelong >8 \b; #9 +>>>0x43C use PIT-entry +>>>4 ulelong >9 \b; #10 +>>>0x4C0 use PIT-entry +>>>4 ulelong >10 \b; #11 +>>>0x544 use PIT-entry +>>>4 ulelong >11 \b; #12 +>>>0x5C8 use PIT-entry +>>>4 ulelong >12 \b; #13 +>>>>0x64C use PIT-entry +# 14. pit entry +>>>4 ulelong >13 \b; #14 +>>>>0x6D0 use PIT-entry +>>>4 ulelong >14 \b; #15 +>>>0x754 use PIT-entry +>>>4 ulelong >15 \b; #16 +>>>0x7D8 use PIT-entry +>>>4 ulelong >16 \b; #17 +>>>0x85C use PIT-entry +# 18. pit entry +>>>4 ulelong >17 \b; #18 +>>>0x8E0 use PIT-entry + +0 name PIT-entry +# garbage value implies end of pit entries +>0x00 ulequad&0xFFFFFFFCFFFFFFFC =0x0000000000000000 +# skip empty partition name +>>0x24 ubyte !0 +# partition name +>>>0x24 string >\0 %-.32s +# flags +>>>0x0C ulelong&0x00000002 2 \b+RW +# partition ID: +# 0~IPL,MOVINAND,GANG;1~PIT,GPT;2~HIDDEN;3~SBL,HIDDEN;4~SBL2,HIDDEN;5~BOOT;6~KENREl,RECOVER,misc;7~RECOVER +# ;11~MODEM;20~efs;21~PARAM;22~FACTORY,SYSTEM;23~DBDATAFS,USERDATA;24~CACHE;80~BOOTLOADER;81~TZSW +>>>0x08 ulelong x (0x%x) +# filename +>>>0x44 string >\0 "%-.64s" +#>>>0x18 ulelong >0 +# blocksize in 512 byte units ? +#>>>>0x18 ulelong x \b, %db +# partition size in blocks ? +#>>>>0x22 ulelong x \b*%d + +# Android bootimg format +# From https://android.googlesource.com/\ +# platform/system/core/+/master/libsparse/sparse_format.h +0 lelong 0xed26ff3a Android sparse image +>4 leshort x \b, version: %d +>6 leshort x \b.%d +>16 lelong x \b, Total of %d +>12 lelong x \b %d-byte output blocks in +>20 lelong x \b %d input chunks. Modified: head/contrib/file/magic/Magdir/animation ============================================================================== --- head/contrib/file/magic/Magdir/animation Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/magic/Magdir/animation Thu Dec 11 06:52:10 2014 (r275698) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: animation,v 1.53 2014/04/30 21:41:02 christos Exp $ +# $File: animation,v 1.56 2014/10/23 23:12:51 christos Exp $ # animation: file(1) magic for animation/movie formats # # animation formats @@ -32,43 +32,155 @@ !:mime application/x-quicktime-player 4 string/W jP JPEG 2000 image !:mime image/jp2 +# http://www.ftyps.com/ with local additions 4 string ftyp ISO Media ->8 string isom \b, MPEG v4 system, version 1 -!:mime video/mp4 ->8 string iso2 \b, MPEG v4 system, part 12 revision ->8 string mp41 \b, MPEG v4 system, version 1 -!:mime video/mp4 ->8 string mp42 \b, MPEG v4 system, version 2 -!:mime video/mp4 ->8 string mp7t \b, MPEG v4 system, MPEG v7 XML ->8 string mp7b \b, MPEG v4 system, MPEG v7 binary XML ->8 string/W jp2 \b, JPEG 2000 -!:mime image/jp2 +>8 string 3g2 \b, MPEG v4 system, 3GPP2 +!:mime video/3gpp2 +>>11 byte 4 \b v4 (H.263/AMR GSM 6.10) +>>11 byte 5 \b v5 (H.263/AMR GSM 6.10) +>>11 byte 6 \b v6 (ITU H.264/AMR GSM 6.10) +>>11 byte a \b C.S0050-0 V1.0 +>>11 byte b \b C.S0050-0-A V1.0.0 +>>11 byte c \b C.S0050-0-B V1.0 >8 string 3ge \b, MPEG v4 system, 3GPP !:mime video/3gpp +>>11 byte 6 \b, Release 6 MBMS Extended Presentations +>>11 byte 7 \b, Release 7 MBMS Extended Presentations >8 string 3gg \b, MPEG v4 system, 3GPP +>11 byte 6 \b, Release 6 General Profile !:mime video/3gpp >8 string 3gp \b, MPEG v4 system, 3GPP +>11 byte 1 \b, Release %d (non existent) +>11 byte 2 \b, Release %d (non existent) +>11 byte 3 \b, Release %d (non existent) +>11 byte 4 \b, Release %d +>11 byte 5 \b, Release %d +>11 byte 6 \b, Release %d +>11 byte 7 \b, Release %d Streaming Servers !:mime video/3gpp >8 string 3gs \b, MPEG v4 system, 3GPP +>11 byte 7 \b, Release %d Streaming Servers !:mime video/3gpp ->8 string 3g2 \b, MPEG v4 system, 3GPP2 +>8 string avc1 \b, MPEG v4 system, 3GPP JVT AVC [ISO 14496-12:2005] +!:mime video/mp4 +>8 string/W qt \b, Apple QuickTime movie +!:mime video/quicktime +>8 string CAEP \b, Canon Digital Camera +>8 string caqv \b, Casio Digital Camera +>8 string CDes \b, Convergent Design +>8 string da0a \b, DMB MAF w/ MPEG Layer II aud, MOT slides, DLS, JPG/PNG/MNG +>8 string da0b \b, DMB MAF, ext DA0A, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string da1a \b, DMB MAF audio with ER-BSAC audio, JPG/PNG/MNG images +>8 string da1b \b, DMB MAF, ext da1a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string da2a \b, DMB MAF aud w/ HE-AAC v2 aud, MOT slides, DLS, JPG/PNG/MNG +>8 string da2b \b, DMB MAF, ext da2a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string da3a \b, DMB MAF aud with HE-AAC aud, JPG/PNG/MNG images +>8 string da3b \b, DMB MAF, ext da3a w/ BIFS, 3GPP, DID, TVA, REL, IPMP +>8 string dmb1 \b, DMB MAF supporting all the components defined in the spec +>8 string dmpf \b, Digital Media Project +>8 string drc1 \b, Dirac (wavelet compression), encap in ISO base media (MP4) +>8 string dv1a \b, DMB MAF vid w/ AVC vid, ER-BSAC aud, BIFS, JPG/PNG/MNG, TS +>8 string dv1b \b, DMB MAF, ext dv1a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string dv2a \b, DMB MAF vid w/ AVC vid, HE-AAC v2 aud, BIFS, JPG/PNG/MNG, TS +>8 string dv2b \b, DMB MAF, ext dv2a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string dv3a \b, DMB MAF vid w/ AVC vid, HE-AAC aud, BIFS, JPG/PNG/MNG, TS +>8 string dv3b \b, DMB MAF, ext dv3a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string dvr1 \b, DVB (.DVB) over RTP +!:mime video/vnd.dvb.file +>8 string dvt1 \b, DVB (.DVB) over MPEG-2 Transport Stream +!:mime video/vnd.dvb.file +>8 string F4V \b, Video for Adobe Flash Player 9+ (.F4V) +!:mime video/mp4 +>8 string F4P \b, Protected Video for Adobe Flash Player 9+ (.F4P) +!:mime video/mp4 +>8 string F4A \b, Audio for Adobe Flash Player 9+ (.F4A) +!:mime audio/mp4 +>8 string F4B \b, Audio Book for Adobe Flash Player 9+ (.F4B) +!:mime audio/mp4 +>8 string isc2 \b, ISMACryp 2.0 Encrypted File +# ?/enc-isoff-generic +>8 string iso2 \b, MP4 Base Media v2 [ISO 14496-12:2005] +!:mime video/mp4 +>8 string isom \b, MP4 Base Media v1 [IS0 14496-12:2003] +!:mime video/mp4 +>8 string/W jp2 \b, JPEG 2000 +!:mime image/jp2 +>8 string JP2 \b, JPEG 2000 Image (.JP2) [ISO 15444-1 ?] +!:mime image/jp2 +>8 string JP20 \b, Unknown, from GPAC samples (prob non-existent) +>8 string jpm \b, JPEG 2000 Compound Image (.JPM) [ISO 15444-6] +!:mime image/jpm +>8 string jpx \b, JPEG 2000 w/ extensions (.JPX) [ISO 15444-2] +!:mime image/jpx +>8 string KDDI \b, 3GPP2 EZmovie for KDDI 3G cellphones !:mime video/3gpp2 ->>11 byte 4 \b v4 (H.263/AMR GSM 6.10) ->>11 byte 5 \b v5 (H.263/AMR GSM 6.10) ->>11 byte 6 \b v6 (ITU H.264/AMR GSM 6.10) +>8 string M4A \b, Apple iTunes ALAC/AAC-LC (.M4A) Audio +!:mime audio/x-m4a +>8 string M4B \b, Apple iTunes ALAC/AAC-LC (.M4B) Audio Book +!:mime audio/mp4 +>8 string M4P \b, Apple iTunes ALAC/AAC-LC (.M4P) AES Protected Audio +!:mime video/mp4 +>8 string M4V \b, Apple iTunes Video (.M4V) Video +!:mime video/x-m4v +>8 string M4VH \b, Apple TV (.M4V) +!:mime video/x-m4v +>8 string M4VP \b, Apple iPhone (.M4V) +!:mime video/x-m4v +>8 string mj2s \b, Motion JPEG 2000 [ISO 15444-3] Simple Profile +!:mime video/mj2 +>8 string mjp2 \b, Motion JPEG 2000 [ISO 15444-3] General Profile +!:mime video/mj2 +>8 string mmp4 \b, MPEG-4/3GPP Mobile Profile (.MP4 / .3GP) (for NTT) +!:mime video/mp4 +>8 string mobi \b, MPEG-4, MOBI format +!:mime video/mp4 +>8 string mp21 \b, MPEG-21 [ISO/IEC 21000-9] +>8 string mp41 \b, MP4 v1 [ISO 14496-1:ch13] +!:mime video/mp4 +>8 string mp42 \b, MP4 v2 [ISO 14496-14] +!:mime video/mp4 +>8 string mp71 \b, MP4 w/ MPEG-7 Metadata [per ISO 14496-12] +>8 string mp7t \b, MPEG v4 system, MPEG v7 XML +>8 string mp7b \b, MPEG v4 system, MPEG v7 binary XML >8 string mmp4 \b, MPEG v4 system, 3GPP Mobile !:mime video/mp4 ->8 string avc1 \b, MPEG v4 system, 3GPP JVT AVC -!:mime video/3gpp ->8 string/W M4A \b, MPEG v4 system, iTunes AAC-LC +>8 string MPPI \b, Photo Player, MAF [ISO/IEC 23000-3] +>8 string mqt \b, Sony / Mobile QuickTime (.MQV) US Pat 7,477,830 +!:mime video/quicktime +>8 string MSNV \b, MPEG-4 (.MP4) for SonyPSP +!:mime audio/mp4 +>8 string NDAS \b, MP4 v2 [ISO 14496-14] Nero Digital AAC Audio !:mime audio/mp4 ->8 string/W M4V \b, MPEG v4 system, iTunes AVC-LC +>8 string NDSC \b, MPEG-4 (.MP4) Nero Cinema Profile !:mime video/mp4 ->8 string/W M4P \b, MPEG v4 system, iTunes AES encrypted ->8 string/W M4B \b, MPEG v4 system, iTunes bookmarked ->8 string/W qt \b, Apple QuickTime movie +>8 string NDSH \b, MPEG-4 (.MP4) Nero HDTV Profile +!:mime video/mp4 +>8 string NDSM \b, MPEG-4 (.MP4) Nero Mobile Profile +!:mime video/mp4 +>8 string NDSP \b, MPEG-4 (.MP4) Nero Portable Profile +!:mime video/mp4 +>8 string NDSS \b, MPEG-4 (.MP4) Nero Standard Profile +!:mime video/mp4 +>8 string NDXC \b, H.264/MPEG-4 AVC (.MP4) Nero Cinema Profile +!:mime video/mp4 +>8 string NDXH \b, H.264/MPEG-4 AVC (.MP4) Nero HDTV Profile +!:mime video/mp4 +>8 string NDXM \b, H.264/MPEG-4 AVC (.MP4) Nero Mobile Profile +!:mime video/mp4 +>8 string NDXP \b, H.264/MPEG-4 AVC (.MP4) Nero Portable Profile +!:mime video/mp4 +>8 string NDXS \b, H.264/MPEG-4 AVC (.MP4) Nero Standard Profile +!:mime video/mp4 +>8 string odcf \b, OMA DCF DRM Format 2.0 (OMA-TS-DRM-DCF-V2_0-20060303-A) +>8 string opf2 \b, OMA PDCF DRM Format 2.1 (OMA-TS-DRM-DCF-V2_1-20070724-C) +>8 string opx2 \b, OMA PDCF DRM + XBS ext (OMA-TS-DRM_XBS-V1_0-20070529-C) +>8 string pana \b, Panasonic Digital Camera +>8 string qt \b, Apple QuickTime (.MOV/QT) !:mime video/quicktime +>8 string ROSS \b, Ross Video +>8 string sdv \b, SD Memory Card Video +>8 string ssc1 \b, Samsung stereo, single stream (patent pending) +>8 string ssc2 \b, Samsung stereo, dual stream (patent pending) # MPEG sequences # Scans for all common MPEG header start codes Modified: head/contrib/file/magic/Magdir/archive ============================================================================== --- head/contrib/file/magic/Magdir/archive Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/magic/Magdir/archive Thu Dec 11 06:52:10 2014 (r275698) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: archive,v 1.87 2014/06/03 19:15:58 christos Exp $ +# $File: archive,v 1.88 2014/08/16 10:42:17 christos Exp $ # archive: file(1) magic for archive formats (see also "msdos" for self- # extracting compressed archives) # @@ -954,34 +954,3 @@ >0xE08 search/7776 \x55\xAA >>&-512 indirect x \b; contains -# Symantec GHOST image by Joerg Jenderek at May 2014 -# http://us.norton.com/ghost/ -# http://www.garykessler.net/library/file_sigs.html -0 ubelong&0xFFFFf7f0 0xFEEF0100 Norton GHost image -# *.GHO ->2 ubyte&0x08 0x00 \b, first file -# *.GHS or *.[0-9] with cns program option ->2 ubyte&0x08 0x08 \b, split file -# part of split index interesting for *.ghs ->>4 ubyte x id=0x%x -# compression tag minus one equals numeric compression command line switch z[1-9] ->3 ubyte 0 \b, no compression ->3 ubyte 2 \b, fast compression (Z1) ->3 ubyte 3 \b, medium compression (Z2) ->3 ubyte >3 ->>3 ubyte <11 \b, compression (Z%d-1) ->2 ubyte&0x08 0x00 -# ~ 30 byte password field only for *.gho ->>12 ubequad !0 \b, password protected ->>44 ubyte !1 -# 1~Image All, sector-by-sector only for *.gho ->>>10 ubyte 1 \b, sector copy -# 1~Image Boot track only for *.gho ->>>43 ubyte 1 \b, boot track -# 1~Image Disc only for *.gho implies Image Boot track and sector copy ->>44 ubyte 1 \b, disc sector copy -# optional image description only *.gho ->>0xff string >\0 "%-.254s" -# look for DOS sector end sequence ->0xE08 search/7776 \x55\xAA ->>&-512 indirect x \b; contains Modified: head/contrib/file/magic/Magdir/blender ============================================================================== --- head/contrib/file/magic/Magdir/blender Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/magic/Magdir/blender Thu Dec 11 06:52:10 2014 (r275698) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: blender,v 1.5 2009/09/19 16:28:08 christos Exp $ +# $File: blender,v 1.6 2014/08/30 08:34:17 christos Exp $ # blender: file(1) magic for Blender 3D related files # # Native format rule v1.2. For questions use the developers list @@ -35,5 +35,5 @@ >>>0x44 string =GLOB \b. >>>>0x60 beshort x \b%.4d -# Scripts that run in the embeded Python interpreter +# Scripts that run in the embedded Python interpreter 0 string #!BPY Blender3D BPython script Modified: head/contrib/file/magic/Magdir/commands ============================================================================== --- head/contrib/file/magic/Magdir/commands Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/magic/Magdir/commands Thu Dec 11 06:52:10 2014 (r275698) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: commands,v 1.50 2014/05/30 16:48:44 christos Exp $ +# $File: commands,v 1.51 2014/09/27 00:12:55 christos Exp $ # commands: file(1) magic for various shells and interpreters # #0 string/w : shell archive or script for antique kernel text @@ -56,7 +56,7 @@ !:mime text/x-awk 0 string/wt #!\ /usr/bin/awk awk script text executable !:mime text/x-awk -0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text +0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk or perl script text # AT&T Bell Labs' Plan 9 shell 0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable Modified: head/contrib/file/magic/Magdir/compress ============================================================================== --- head/contrib/file/magic/Magdir/compress Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/magic/Magdir/compress Thu Dec 11 06:52:10 2014 (r275698) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: compress,v 1.58 2014/05/07 19:36:59 christos Exp $ +# $File: compress,v 1.62 2014/09/13 14:27:12 christos Exp $ # compress: file(1) magic for pure-compression formats (no archives) # # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc. @@ -251,3 +251,13 @@ # http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt 0 string \377\006\0\0sNaPpY snappy framed data !:mime application/x-snappy-framed + +# qpress, http://www.quicklz.com/ +0 string qpress10 qpress compressed data +!:mime application/x-qpress + +# Zlib https://www.ietf.org/rfc/rfc6713.txt +0 beshort%31 =0 +>0 byte&0xf =8 +>>0 byte&0x80 =0 zlib compressed data +!:mime application/zlib Modified: head/contrib/file/magic/Magdir/database ============================================================================== --- head/contrib/file/magic/Magdir/database Thu Dec 11 06:07:10 2014 (r275697) +++ head/contrib/file/magic/Magdir/database Thu Dec 11 06:52:10 2014 (r275698) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: database,v 1.41 2014/06/03 19:17:27 christos Exp $ +# $File: database,v 1.43 2014/10/28 15:47:39 christos Exp $ # database: file(1) magic for various databases # # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk) @@ -9,9 +9,17 @@ # GDBM magic numbers # Will be maintained as part of the GDBM distribution in the future. # -0 belong 0x13579ace GNU dbm 1.x or ndbm database, big endian +0 belong 0x13579acd GNU dbm 1.x or ndbm database, big endian, 32-bit !:mime application/x-gdbm -0 lelong 0x13579ace GNU dbm 1.x or ndbm database, little endian +0 belong 0x13579ace GNU dbm 1.x or ndbm database, big endian, old +!:mime application/x-gdbm +0 belong 0x13579acf GNU dbm 1.x or ndbm database, big endian, 64-bit +!:mime application/x-gdbm +0 lelong 0x13579acd GNU dbm 1.x or ndbm database, little endian, 32-bit +!:mime application/x-gdbm +0 lelong 0x13579ace GNU dbm 1.x or ndbm database, little endian, old +!:mime application/x-gdbm +0 lelong 0x13579acf GNU dbm 1.x or ndbm database, little endian, 64-bit !:mime application/x-gdbm 0 string GDBM GNU dbm 2.x database !:mime application/x-gdbm @@ -202,27 +210,27 @@ # for multiple index files (*.MDX) Production flag,tag numbers(<=0x30),tag length(<=0x20), reserverd (NULL) >>>>>>>24 ubelong&0x0133f7ff >0 # test for reserved NULL byte ->>>>>>>>47 ubyte x +>>>>>>>>47 ubyte 0 # test for valid TAG key format (0x10 or 0) >>>>>>>>>559 ubyte&0xeF 0 # test MM <= 12 ->>>>>>>>>45 ubeshort <0x0C20 ->>>>>>>>>>45 ubyte >0 ->>>>>>>>>>>46 ubyte <32 ->>>>>>>>>>>>46 ubyte >0 +>>>>>>>>>>45 ubeshort <0x0C20 +>>>>>>>>>>>45 ubyte >0 +>>>>>>>>>>>>46 ubyte <32 +>>>>>>>>>>>>>46 ubyte >0 #!:mime application/x-mdx ->>>>>>>>>>>>>0 use xbase-type ->>>>>>>>>>>>>0 ubyte x \b MDX ->>>>>>>>>>>>>1 ubyte x \b, creation-date ->>>>>>>>>>>>>1 use xbase-date ->>>>>>>>>>>>>44 ubyte x \b, update-date ->>>>>>>>>>>>>44 use xbase-date +>>>>>>>>>>>>>>0 use xbase-type +>>>>>>>>>>>>>>0 ubyte x \b MDX +>>>>>>>>>>>>>>1 ubyte x \b, creation-date +>>>>>>>>>>>>>>1 use xbase-date +>>>>>>>>>>>>>>44 ubyte x \b, update-date +>>>>>>>>>>>>>>44 use xbase-date # No.of tags in use (1,2,5,12) ->>>>>>>>>>>>>28 uleshort x \b, %d +>>>>>>>>>>>>>>28 uleshort x \b, %d # No. of entries in tag (0x30) ->>>>>>>>>>>>>25 ubyte x \b/%d tags +>>>>>>>>>>>>>>25 ubyte x \b/%d tags # Length of tag ->>>>>>>>>>>>>26 ubyte x * %d +>>>>>>>>>>>>>>26 ubyte x * %d # 1st tag name_ >>>>>>>>>>>>>548 string x \b, 1st tag "%.11s" # 2nd tag name @@ -337,60 +345,103 @@ # dBASE III >>>>>>16 ubyte 3 # dBASE III DBT ->>>>>>>0 use xbase-memo-print -# dBASE IV DBT , FoxPro FPT or many PNG , ZIP , DBF garbage +>>>>>>>0 use dbase3-memo-print +# dBASE III DBT without version, dBASE IV DBT , FoxPro FPT , or many ZIP , DBF garbage >>>>>>16 ubyte 0 -# dBASE IV DBT with DBF name or DBF garbage ->>>>>>>8 ubelong >0x40000000 -# skip DBF and catch dBASE IV DBT with DBF name and with non big index of next free block ->>>>>>>>0 ulelong <0x01010002 ->>>>>>>>>0 use xbase-memo-print ->>>>>>>8 ubelong 0 +# unusual dBASE III DBT like angest.dbt, dBASE IV DBT with block size 0 , FoxPro FPT , or garbage PCX DBF +>>>>>>>20 uleshort 0 +# FoxPro FPT , unusual dBASE III DBT like biblio.dbt or garbage +>>>>>>>>8 ulong =0 +>>>>>>>>>6 ubeshort >0 +# skip emacs.PIF +>>>>>>>>>>4 ushort 0 +>>>>>>>>>>>0 use foxpro-memo-print +# dBASE III DBT , garbage +>>>>>>>>>6 ubeshort 0 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 08:06:00 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A64DF45F; Thu, 11 Dec 2014 08:06:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FE726AC36; Thu, 11 Dec 2014 08:06:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB860uS049168; Thu, 11 Dec 2014 08:06:00 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB860S0049165; Thu, 11 Dec 2014 08:06:00 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412110806.sBB860S0049165@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 11 Dec 2014 08:06:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275699 - in stable: 10/contrib/gcc/cp 7/contrib/gcc/cp 8/contrib/gcc/cp 9/contrib/gcc/cp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 08:06:00 -0000 Author: dim Date: Thu Dec 11 08:05:59 2014 New Revision: 275699 URL: https://svnweb.freebsd.org/changeset/base/275699 Log: MFC r275477: Pull in r174303 from upstream gcc trunk (by Jason Merrill): PR c++/48211 * name-lookup.h (cp_class_binding): Make base a pointer. * name-lookup.c (new_class_binding): Adjust. (poplevel_class): Adjust. This fixes a potential segfault when compiling gold, a part of the devel/binutils port, with gcc. See also the upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48211 Thanks to Jason Merrill, Tom Callaway and Red Hat legal for approving the use of this patch under the GNU GPL, version 2 or later. Modified: stable/9/contrib/gcc/cp/name-lookup.c stable/9/contrib/gcc/cp/name-lookup.h Directory Properties: stable/9/contrib/gcc/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/gcc/cp/name-lookup.c stable/10/contrib/gcc/cp/name-lookup.h stable/7/contrib/gcc/cp/name-lookup.c stable/7/contrib/gcc/cp/name-lookup.h stable/8/contrib/gcc/cp/name-lookup.c stable/8/contrib/gcc/cp/name-lookup.h Directory Properties: stable/10/ (props changed) stable/7/contrib/gcc/ (props changed) stable/8/contrib/gcc/ (props changed) Modified: stable/9/contrib/gcc/cp/name-lookup.c ============================================================================== --- stable/9/contrib/gcc/cp/name-lookup.c Thu Dec 11 06:52:10 2014 (r275698) +++ stable/9/contrib/gcc/cp/name-lookup.c Thu Dec 11 08:05:59 2014 (r275699) @@ -301,35 +301,11 @@ new_class_binding (tree name, tree value cp_class_binding *cb; cxx_binding *binding; - if (VEC_length (cp_class_binding, scope->class_shadowed)) - { - cp_class_binding *old_base; - old_base = VEC_index (cp_class_binding, scope->class_shadowed, 0); - if (VEC_reserve (cp_class_binding, gc, scope->class_shadowed, 1)) - { - /* Fixup the current bindings, as they might have moved. */ - size_t i; - - for (i = 0; - VEC_iterate (cp_class_binding, scope->class_shadowed, i, cb); - i++) - { - cxx_binding **b; - b = &IDENTIFIER_BINDING (cb->identifier); - while (*b != &old_base[i].base) - b = &((*b)->previous); - *b = &cb->base; - } - } - cb = VEC_quick_push (cp_class_binding, scope->class_shadowed, NULL); - } - else cb = VEC_safe_push (cp_class_binding, gc, scope->class_shadowed, NULL); cb->identifier = name; - binding = &cb->base; + cb->base = binding = cxx_binding_make (value, type); binding->scope = scope; - cxx_binding_init (binding, value, type); return binding; } @@ -2479,7 +2455,10 @@ poplevel_class (void) for (i = 0; VEC_iterate (cp_class_binding, level->class_shadowed, i, cb); ++i) - IDENTIFIER_BINDING (cb->identifier) = cb->base.previous; + { + IDENTIFIER_BINDING (cb->identifier) = cb->base->previous; + cxx_binding_free (cb->base); + } ggc_free (level->class_shadowed); level->class_shadowed = NULL; } Modified: stable/9/contrib/gcc/cp/name-lookup.h ============================================================================== --- stable/9/contrib/gcc/cp/name-lookup.h Thu Dec 11 06:52:10 2014 (r275698) +++ stable/9/contrib/gcc/cp/name-lookup.h Thu Dec 11 08:05:59 2014 (r275699) @@ -142,7 +142,7 @@ typedef enum tag_scope { typedef struct cp_class_binding GTY(()) { - cxx_binding base; + cxx_binding *base; /* The bound name. */ tree identifier; } cp_class_binding; From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 08:15:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 088E886B; Thu, 11 Dec 2014 08:15:51 +0000 (UTC) Received: from mail-wg0-x22a.google.com (mail-wg0-x22a.google.com [IPv6:2a00:1450:400c:c00::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 893EE6AD1C; Thu, 11 Dec 2014 08:15:50 +0000 (UTC) Received: by mail-wg0-f42.google.com with SMTP id z12so5716090wgg.1 for ; Thu, 11 Dec 2014 00:15:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=rSm6jTKklD/bYb0TWtrYUMXpxbLUhhwpX/B3824k4Yk=; b=wKuq+YrEqCcfcwDlbf+mKtCXRodSkvljCdGrGZZndyqW0XzxGOyr5nToChO4BONqp0 2zSGitdGwlxNy/CANm1MVXvU0DJFaix2YsfUzZ6qDGexVBqRX9Y0lMf3zgNF0HUFhTn/ 3bnkWio68xM2Ed8EN6/P2Ld5vUhY6mnVSeNamL/tg2i0HDKqDtWcLGAKWqPIEZZ8R/6S 4NEutW15ik/mttXp1izcUzDMMd13yln5wg9fcPQ0lCBncmky2EJ90iGF+OSn+Do6Jkqa 9Xh9Y1oJJ2RhtMBiyeOSxfBfhZk8whhbkFYK4wrPw/Zo+KVV48usLtKhl3dcRVdlj3kJ V0lA== X-Received: by 10.194.71.45 with SMTP id r13mr13773216wju.128.1418285748818; Thu, 11 Dec 2014 00:15:48 -0800 (PST) Received: from [172.16.1.30] (37.Red-2-136-30.dynamicIP.rima-tde.net. [2.136.30.37]) by mx.google.com with ESMTPSA id gy8sm1915117wib.23.2014.12.11.00.15.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Dec 2014 00:15:48 -0800 (PST) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Message-ID: <548952AB.7060804@FreeBSD.org> Date: Thu, 11 Dec 2014 09:15:39 +0100 From: =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: "Justin T. Gibbs" Subject: Re: svn commit: r275679 - head/sys/x86/xen References: <201412101325.sBADPMgZ081973@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 08:15:51 -0000 El 10/12/14 a les 21.17, Justin T. Gibbs ha escrit: > On Dec 10, 2014, at 6:25 AM, Roger Pau MonnXX wrote: >> >> Author: royger >> Date: Wed Dec 10 13:25:21 2014 >> New Revision: 275679 >> URL: https://svnweb.freebsd.org/changeset/base/275679 >> >> Log: >> xen/intr: balance dynamic interrupts across available vCPUs >> >> By default Xen binds all event channels to vCPU#0, and FreeBSD only shuffles >> the interrupt sources once, at the end of the boot process. Since new event >> channels might be created after this point (because new devices or backends >> are added), try to automatically shuffle them at creation time. >> >> This does not affect VIRQ or IPI event channels, that are already bound to a >> specific vCPU as requested by the caller. >> >> Sponsored by: Citrix Systems R&D >> >> Modified: >> head/sys/x86/xen/xen_intr.c >> >> Modified: head/sys/x86/xen/xen_intr.c >> ============================================================================== >> --- head/sys/x86/xen/xen_intr.c Wed Dec 10 11:42:02 2014 (r275678) >> +++ head/sys/x86/xen/xen_intr.c Wed Dec 10 13:25:21 2014 (r275679) >> @@ -425,6 +425,17 @@ xen_intr_bind_isrc(struct xenisrc **isrc >> /* Assign the opaque handler (the event channel port) */ >> *port_handlep = &isrc->xi_port; >> >> +#ifdef SMP >> + if (type == EVTCHN_TYPE_PORT) { >> + /* >> + * By default all interrupts are assigned to vCPU#0 >> + * unless specified otherwise, so shuffle them to balance >> + * the interrupt load. >> + */ >> + xen_intr_assign_cpu(&isrc->xi_intsrc, intr_next_cpu()); >> + } >> +#endif >> + > > Shouldn't this only happen for new interrupt source objects, not those that are being reclaimed/reused? No, because the vCPU binding is done based on the event channel port, which changes when the event channel is allocated/setup. What I realize now is that I should probably have used intr_event_bind instead of directly calling xen_intr_assign_cpu, so that the ithread cpu mask is also correctly set. Roger. From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 08:06:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 892D9460; Thu, 11 Dec 2014 08:06:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 731BC6AC37; Thu, 11 Dec 2014 08:06:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB861AO049193; Thu, 11 Dec 2014 08:06:01 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB861jF049179; Thu, 11 Dec 2014 08:06:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412110806.sBB861jF049179@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 11 Dec 2014 08:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r275699 - in stable: 10/contrib/gcc/cp 7/contrib/gcc/cp 8/contrib/gcc/cp 9/contrib/gcc/cp X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 08:06:01 -0000 Author: dim Date: Thu Dec 11 08:05:59 2014 New Revision: 275699 URL: https://svnweb.freebsd.org/changeset/base/275699 Log: MFC r275477: Pull in r174303 from upstream gcc trunk (by Jason Merrill): PR c++/48211 * name-lookup.h (cp_class_binding): Make base a pointer. * name-lookup.c (new_class_binding): Adjust. (poplevel_class): Adjust. This fixes a potential segfault when compiling gold, a part of the devel/binutils port, with gcc. See also the upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48211 Thanks to Jason Merrill, Tom Callaway and Red Hat legal for approving the use of this patch under the GNU GPL, version 2 or later. Modified: stable/8/contrib/gcc/cp/name-lookup.c stable/8/contrib/gcc/cp/name-lookup.h Directory Properties: stable/8/contrib/gcc/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/gcc/cp/name-lookup.c stable/10/contrib/gcc/cp/name-lookup.h stable/7/contrib/gcc/cp/name-lookup.c stable/7/contrib/gcc/cp/name-lookup.h stable/9/contrib/gcc/cp/name-lookup.c stable/9/contrib/gcc/cp/name-lookup.h Directory Properties: stable/10/ (props changed) stable/7/contrib/gcc/ (props changed) stable/9/contrib/gcc/ (props changed) Modified: stable/8/contrib/gcc/cp/name-lookup.c ============================================================================== --- stable/8/contrib/gcc/cp/name-lookup.c Thu Dec 11 06:52:10 2014 (r275698) +++ stable/8/contrib/gcc/cp/name-lookup.c Thu Dec 11 08:05:59 2014 (r275699) @@ -301,35 +301,11 @@ new_class_binding (tree name, tree value cp_class_binding *cb; cxx_binding *binding; - if (VEC_length (cp_class_binding, scope->class_shadowed)) - { - cp_class_binding *old_base; - old_base = VEC_index (cp_class_binding, scope->class_shadowed, 0); - if (VEC_reserve (cp_class_binding, gc, scope->class_shadowed, 1)) - { - /* Fixup the current bindings, as they might have moved. */ - size_t i; - - for (i = 0; - VEC_iterate (cp_class_binding, scope->class_shadowed, i, cb); - i++) - { - cxx_binding **b; - b = &IDENTIFIER_BINDING (cb->identifier); - while (*b != &old_base[i].base) - b = &((*b)->previous); - *b = &cb->base; - } - } - cb = VEC_quick_push (cp_class_binding, scope->class_shadowed, NULL); - } - else cb = VEC_safe_push (cp_class_binding, gc, scope->class_shadowed, NULL); cb->identifier = name; - binding = &cb->base; + cb->base = binding = cxx_binding_make (value, type); binding->scope = scope; - cxx_binding_init (binding, value, type); return binding; } @@ -2479,7 +2455,10 @@ poplevel_class (void) for (i = 0; VEC_iterate (cp_class_binding, level->class_shadowed, i, cb); ++i) - IDENTIFIER_BINDING (cb->identifier) = cb->base.previous; + { + IDENTIFIER_BINDING (cb->identifier) = cb->base->previous; + cxx_binding_free (cb->base); + } ggc_free (level->class_shadowed); level->class_shadowed = NULL; } Modified: stable/8/contrib/gcc/cp/name-lookup.h ============================================================================== --- stable/8/contrib/gcc/cp/name-lookup.h Thu Dec 11 06:52:10 2014 (r275698) +++ stable/8/contrib/gcc/cp/name-lookup.h Thu Dec 11 08:05:59 2014 (r275699) @@ -142,7 +142,7 @@ typedef enum tag_scope { typedef struct cp_class_binding GTY(()) { - cxx_binding base; + cxx_binding *base; /* The bound name. */ tree identifier; } cp_class_binding; From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 08:44:57 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0F17EC19; Thu, 11 Dec 2014 08:44:57 +0000 (UTC) Received: from butcher-nb.yandex.net (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id E77C821B1; Thu, 11 Dec 2014 08:44:55 +0000 (UTC) Message-ID: <5489597C.80707@FreeBSD.org> Date: Thu, 11 Dec 2014 11:44:44 +0300 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r275695 - head/sys/netinet6 References: <201412110041.sBB0ftwC030057@svn.freebsd.org> In-Reply-To: <201412110041.sBB0ftwC030057@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 08:44:57 -0000 On 11.12.2014 03:41, Mark Johnston wrote: > Author: markj > Date: Thu Dec 11 00:41:54 2014 > New Revision: 275695 > URL: https://svnweb.freebsd.org/changeset/base/275695 > > Log: > Fix a bug in r266857: nd6_dad_find() must return NULL if it doesn't find > a matching element in the DAD queue. If there was no matching element, TAILQ_FOREACH will stop the loop with dp == NULL. If there is bug somewhere, it isn't here. -- WBR, Andrey V. Elsukov From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 08:06:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3667D535; Thu, 11 Dec 2014 08:06:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F9616AC39; Thu, 11 Dec 2014 08:06:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB8620B049265; Thu, 11 Dec 2014 08:06:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB8628V049260; Thu, 11 Dec 2014 08:06:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412110806.sBB8628V049260@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 11 Dec 2014 08:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r275699 - in stable: 10/contrib/gcc/cp 7/contrib/gcc/cp 8/contrib/gcc/cp 9/contrib/gcc/cp X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 08:06:03 -0000 Author: dim Date: Thu Dec 11 08:05:59 2014 New Revision: 275699 URL: https://svnweb.freebsd.org/changeset/base/275699 Log: MFC r275477: Pull in r174303 from upstream gcc trunk (by Jason Merrill): PR c++/48211 * name-lookup.h (cp_class_binding): Make base a pointer. * name-lookup.c (new_class_binding): Adjust. (poplevel_class): Adjust. This fixes a potential segfault when compiling gold, a part of the devel/binutils port, with gcc. See also the upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48211 Thanks to Jason Merrill, Tom Callaway and Red Hat legal for approving the use of this patch under the GNU GPL, version 2 or later. Modified: stable/7/contrib/gcc/cp/name-lookup.c stable/7/contrib/gcc/cp/name-lookup.h Directory Properties: stable/7/contrib/gcc/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/gcc/cp/name-lookup.c stable/10/contrib/gcc/cp/name-lookup.h stable/8/contrib/gcc/cp/name-lookup.c stable/8/contrib/gcc/cp/name-lookup.h stable/9/contrib/gcc/cp/name-lookup.c stable/9/contrib/gcc/cp/name-lookup.h Directory Properties: stable/10/ (props changed) stable/8/contrib/gcc/ (props changed) stable/9/contrib/gcc/ (props changed) Modified: stable/7/contrib/gcc/cp/name-lookup.c ============================================================================== --- stable/7/contrib/gcc/cp/name-lookup.c Thu Dec 11 06:52:10 2014 (r275698) +++ stable/7/contrib/gcc/cp/name-lookup.c Thu Dec 11 08:05:59 2014 (r275699) @@ -302,35 +302,11 @@ new_class_binding (tree name, tree value cp_class_binding *cb; cxx_binding *binding; - if (VEC_length (cp_class_binding, scope->class_shadowed)) - { - cp_class_binding *old_base; - old_base = VEC_index (cp_class_binding, scope->class_shadowed, 0); - if (VEC_reserve (cp_class_binding, gc, scope->class_shadowed, 1)) - { - /* Fixup the current bindings, as they might have moved. */ - size_t i; - - for (i = 0; - VEC_iterate (cp_class_binding, scope->class_shadowed, i, cb); - i++) - { - cxx_binding **b; - b = &IDENTIFIER_BINDING (cb->identifier); - while (*b != &old_base[i].base) - b = &((*b)->previous); - *b = &cb->base; - } - } - cb = VEC_quick_push (cp_class_binding, scope->class_shadowed, NULL); - } - else cb = VEC_safe_push (cp_class_binding, gc, scope->class_shadowed, NULL); cb->identifier = name; - binding = &cb->base; + cb->base = binding = cxx_binding_make (value, type); binding->scope = scope; - cxx_binding_init (binding, value, type); return binding; } @@ -2447,7 +2423,10 @@ poplevel_class (void) for (i = 0; VEC_iterate (cp_class_binding, level->class_shadowed, i, cb); ++i) - IDENTIFIER_BINDING (cb->identifier) = cb->base.previous; + { + IDENTIFIER_BINDING (cb->identifier) = cb->base->previous; + cxx_binding_free (cb->base); + } ggc_free (level->class_shadowed); level->class_shadowed = NULL; } Modified: stable/7/contrib/gcc/cp/name-lookup.h ============================================================================== --- stable/7/contrib/gcc/cp/name-lookup.h Thu Dec 11 06:52:10 2014 (r275698) +++ stable/7/contrib/gcc/cp/name-lookup.h Thu Dec 11 08:05:59 2014 (r275699) @@ -142,7 +142,7 @@ typedef enum tag_scope { typedef struct cp_class_binding GTY(()) { - cxx_binding base; + cxx_binding *base; /* The bound name. */ tree identifier; } cp_class_binding; From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 08:06:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 72BEE463; Thu, 11 Dec 2014 08:06:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CBBC6AC38; Thu, 11 Dec 2014 08:06:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB862Ip049255; Thu, 11 Dec 2014 08:06:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB8616O049245; Thu, 11 Dec 2014 08:06:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412110806.sBB8616O049245@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 11 Dec 2014 08:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275699 - in stable: 10/contrib/gcc/cp 7/contrib/gcc/cp 8/contrib/gcc/cp 9/contrib/gcc/cp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 08:06:02 -0000 Author: dim Date: Thu Dec 11 08:05:59 2014 New Revision: 275699 URL: https://svnweb.freebsd.org/changeset/base/275699 Log: MFC r275477: Pull in r174303 from upstream gcc trunk (by Jason Merrill): PR c++/48211 * name-lookup.h (cp_class_binding): Make base a pointer. * name-lookup.c (new_class_binding): Adjust. (poplevel_class): Adjust. This fixes a potential segfault when compiling gold, a part of the devel/binutils port, with gcc. See also the upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48211 Thanks to Jason Merrill, Tom Callaway and Red Hat legal for approving the use of this patch under the GNU GPL, version 2 or later. Modified: stable/10/contrib/gcc/cp/name-lookup.c stable/10/contrib/gcc/cp/name-lookup.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/gcc/cp/name-lookup.c stable/7/contrib/gcc/cp/name-lookup.h stable/8/contrib/gcc/cp/name-lookup.c stable/8/contrib/gcc/cp/name-lookup.h stable/9/contrib/gcc/cp/name-lookup.c stable/9/contrib/gcc/cp/name-lookup.h Directory Properties: stable/7/contrib/gcc/ (props changed) stable/8/contrib/gcc/ (props changed) stable/9/contrib/gcc/ (props changed) Modified: stable/10/contrib/gcc/cp/name-lookup.c ============================================================================== --- stable/10/contrib/gcc/cp/name-lookup.c Thu Dec 11 06:52:10 2014 (r275698) +++ stable/10/contrib/gcc/cp/name-lookup.c Thu Dec 11 08:05:59 2014 (r275699) @@ -319,35 +319,11 @@ new_class_binding (tree name, tree value cp_class_binding *cb; cxx_binding *binding; - if (VEC_length (cp_class_binding, scope->class_shadowed)) - { - cp_class_binding *old_base; - old_base = VEC_index (cp_class_binding, scope->class_shadowed, 0); - if (VEC_reserve (cp_class_binding, gc, scope->class_shadowed, 1)) - { - /* Fixup the current bindings, as they might have moved. */ - size_t i; - - for (i = 0; - VEC_iterate (cp_class_binding, scope->class_shadowed, i, cb); - i++) - { - cxx_binding **b; - b = &IDENTIFIER_BINDING (cb->identifier); - while (*b != &old_base[i].base) - b = &((*b)->previous); - *b = &cb->base; - } - } - cb = VEC_quick_push (cp_class_binding, scope->class_shadowed, NULL); - } - else cb = VEC_safe_push (cp_class_binding, gc, scope->class_shadowed, NULL); cb->identifier = name; - binding = &cb->base; + cb->base = binding = cxx_binding_make (value, type); binding->scope = scope; - cxx_binding_init (binding, value, type); return binding; } @@ -2501,7 +2477,10 @@ poplevel_class (void) for (i = 0; VEC_iterate (cp_class_binding, level->class_shadowed, i, cb); ++i) - IDENTIFIER_BINDING (cb->identifier) = cb->base.previous; + { + IDENTIFIER_BINDING (cb->identifier) = cb->base->previous; + cxx_binding_free (cb->base); + } ggc_free (level->class_shadowed); level->class_shadowed = NULL; } Modified: stable/10/contrib/gcc/cp/name-lookup.h ============================================================================== --- stable/10/contrib/gcc/cp/name-lookup.h Thu Dec 11 06:52:10 2014 (r275698) +++ stable/10/contrib/gcc/cp/name-lookup.h Thu Dec 11 08:05:59 2014 (r275699) @@ -144,7 +144,7 @@ typedef enum tag_scope { typedef struct cp_class_binding GTY(()) { - cxx_binding base; + cxx_binding *base; /* The bound name. */ tree identifier; } cp_class_binding; From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 09:05:52 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B4AD4E51; Thu, 11 Dec 2014 09:05:52 +0000 (UTC) Received: from mail-pa0-x230.google.com (mail-pa0-x230.google.com [IPv6:2607:f8b0:400e:c03::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8031A223; Thu, 11 Dec 2014 09:05:52 +0000 (UTC) Received: by mail-pa0-f48.google.com with SMTP id rd3so4669096pab.21 for ; Thu, 11 Dec 2014 01:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=geF746n2Lz+iDyvXO2O7ihwEJIdUtBg+cZZasIJVxtA=; b=yaQF4HUzED4ADWArYpBE5mK+PKUJTWLezryqEEBo3UDAA3FL8XZr2XJNEkd/+3c8Y8 68pDn0pOAAaFYVwtUnWmiX3p2TN+EesUVk3/PhLVysfdKaYMLtausOJv8d6kJPhooX02 B2OI8SYh1UVNMti0FXDRcl4HjCE/Dhy6we7qnR8gXnJcLrpgpAydZqz0QYS0XJI82Cpn ZT8PRHVJvIboqnPfs23LuPlIBtvYFgbdnag+8iHUcH7JeaMgbMovtyS4nLyGqYzw9bbm qIrMv+ah6wAkqdXECQ36NT6u9sNWkukvKpGLXNr7QJowEInrxUih6Az4rW/fwBQzhJIA A+oA== X-Received: by 10.68.97.225 with SMTP id ed1mr14667313pbb.153.1418288752023; Thu, 11 Dec 2014 01:05:52 -0800 (PST) Received: from raichu ([198.244.104.6]) by mx.google.com with ESMTPSA id e9sm732136pdp.59.2014.12.11.01.05.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Dec 2014 01:05:50 -0800 (PST) Sender: Mark Johnston Date: Thu, 11 Dec 2014 01:05:42 -0800 From: Mark Johnston To: "Andrey V. Elsukov" Subject: Re: svn commit: r275695 - head/sys/netinet6 Message-ID: <20141211090542.GA34208@raichu> References: <201412110041.sBB0ftwC030057@svn.freebsd.org> <5489597C.80707@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5489597C.80707@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 09:05:52 -0000 On Thu, Dec 11, 2014 at 11:44:44AM +0300, Andrey V. Elsukov wrote: > On 11.12.2014 03:41, Mark Johnston wrote: > > Author: markj > > Date: Thu Dec 11 00:41:54 2014 > > New Revision: 275695 > > URL: https://svnweb.freebsd.org/changeset/base/275695 > > > > Log: > > Fix a bug in r266857: nd6_dad_find() must return NULL if it doesn't find > > a matching element in the DAD queue. > > If there was no matching element, TAILQ_FOREACH will stop the loop with > dp == NULL. If there is bug somewhere, it isn't here. You're right - sorry for the noise. :( I somehow managed to convince myself that TAILQ_FOREACH() wouldn't set dp to NULL at end of a non-empty list. I'll revert the change now. From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 09:16:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8254B7C; Thu, 11 Dec 2014 09:16:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DDF135C; Thu, 11 Dec 2014 09:16:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB9Glk3022987; Thu, 11 Dec 2014 09:16:47 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB9GlJ2022986; Thu, 11 Dec 2014 09:16:47 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201412110916.sBB9GlJ2022986@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Dec 2014 09:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275700 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 09:16:47 -0000 Author: markj Date: Thu Dec 11 09:16:45 2014 New Revision: 275700 URL: https://svnweb.freebsd.org/changeset/base/275700 Log: Revert r275695: nd6_dad_find() was already correct. Reported by: ae, kib Pointy hat to: markj Modified: head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Thu Dec 11 08:05:59 2014 (r275699) +++ head/sys/netinet6/nd6_nbr.c Thu Dec 11 09:16:45 2014 (r275700) @@ -1210,12 +1210,11 @@ nd6_dad_find(struct ifaddr *ifa) TAILQ_FOREACH(dp, &V_dadq, dad_list) if (dp->dad_ifa == ifa) { refcount_acquire(&dp->dad_refcnt); - DADQ_RUNLOCK(); - return (dp); + break; } DADQ_RUNLOCK(); - return (NULL); + return (dp); } static void From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 10:47:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D607EC8E; Thu, 11 Dec 2014 10:47:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C114AEC0; Thu, 11 Dec 2014 10:47:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBAlpGx065675; Thu, 11 Dec 2014 10:47:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBAlp2R065674; Thu, 11 Dec 2014 10:47:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201412111047.sBBAlp2R065674@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 11 Dec 2014 10:47:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275701 - head/sys/ofed/drivers/net/mlx4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 10:47:51 -0000 Author: hselasky Date: Thu Dec 11 10:47:50 2014 New Revision: 275701 URL: https://svnweb.freebsd.org/changeset/base/275701 Log: Make sure callbacks being freed are not pending when the "mlx4_en_deactivate_cq()" function returns. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/net/mlx4/en_cq.c Modified: head/sys/ofed/drivers/net/mlx4/en_cq.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_cq.c Thu Dec 11 09:16:45 2014 (r275700) +++ head/sys/ofed/drivers/net/mlx4/en_cq.c Thu Dec 11 10:47:50 2014 (r275701) @@ -190,7 +190,7 @@ void mlx4_en_deactivate_cq(struct mlx4_e taskqueue_drain(cq->tq, &cq->cq_task); if (cq->is_tx) - del_timer(&cq->timer); + del_timer_sync(&cq->timer); mlx4_cq_free(mdev->dev, &cq->mcq); } From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 14:43:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B59C7B5B; Thu, 11 Dec 2014 14:43:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0A0DD55; Thu, 11 Dec 2014 14:43:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBEhjPn082367; Thu, 11 Dec 2014 14:43:45 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBEhjJo082364; Thu, 11 Dec 2014 14:43:45 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111443.sBBEhjJo082364@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 14:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275702 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 14:43:45 -0000 Author: ae Date: Thu Dec 11 14:43:44 2014 New Revision: 275702 URL: https://svnweb.freebsd.org/changeset/base/275702 Log: Remove check for presence of PACKET_TAG_IPSEC_PENDING_TDB and PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED mbuf tags. They aren't used in FreeBSD. Instead check presence of PACKET_TAG_IPSEC_OUT_DONE mbuf tag. If it is found, bypass security policy lookup as described in the comment. PACKET_TAG_IPSEC_OUT_DONE tag added to mbuf when IPSEC code finishes ESP/AH processing. Since it was already finished, this means the security policy placed in the tdb_ident was already checked. And there is no reason to check it again here. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet/ip_ipsec.c head/sys/netinet6/ip6_ipsec.c Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Thu Dec 11 10:47:50 2014 (r275701) +++ head/sys/netinet/ip_ipsec.c Thu Dec 11 14:43:44 2014 (r275702) @@ -217,9 +217,7 @@ ip_ipsec_mtu(struct mbuf *m, int mtu) int ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error) { - struct secpolicy *sp = NULL; - struct tdb_ident *tdbi; - struct m_tag *mtag; + struct secpolicy *sp; /* * Check the security policy (SP) for the packet and, if * required, do IPsec-related processing. There are two @@ -229,17 +227,11 @@ ip_ipsec_output(struct mbuf **m, struct * AH, ESP, etc. processing), there will be a tag to bypass * the lookup and related policy checking. */ - mtag = m_tag_find(*m, PACKET_TAG_IPSEC_PENDING_TDB, NULL); - if (mtag != NULL) { - tdbi = (struct tdb_ident *)(mtag + 1); - sp = ipsec_getpolicy(tdbi, IPSEC_DIR_OUTBOUND); - if (sp == NULL) - *error = -EINVAL; /* force silent drop */ - m_tag_delete(*m, mtag); - } else { - sp = ipsec4_checkpolicy(*m, IPSEC_DIR_OUTBOUND, *flags, - error, inp); + if (m_tag_find(*m, PACKET_TAG_IPSEC_OUT_DONE, NULL) != NULL) { + *error = 0; + return (0); } + sp = ipsec4_checkpolicy(*m, IPSEC_DIR_OUTBOUND, *flags, error, inp); /* * There are four return cases: * sp != NULL apply IPsec policy @@ -248,40 +240,6 @@ ip_ipsec_output(struct mbuf **m, struct * sp == NULL, error != 0 discard packet, report error */ if (sp != NULL) { - /* Loop detection, check if ipsec processing already done */ - KASSERT(sp->req != NULL, ("ip_output: no ipsec request")); - for (mtag = m_tag_first(*m); mtag != NULL; - mtag = m_tag_next(*m, mtag)) { - if (mtag->m_tag_cookie != MTAG_ABI_COMPAT) - continue; - if (mtag->m_tag_id != PACKET_TAG_IPSEC_OUT_DONE && - mtag->m_tag_id != PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED) - continue; - /* - * Check if policy has an SA associated with it. - * This can happen when an SP has yet to acquire - * an SA; e.g. on first reference. If it occurs, - * then we let ipsec4_process_packet do its thing. - */ - if (sp->req->sav == NULL) - break; - tdbi = (struct tdb_ident *)(mtag + 1); - if (tdbi->spi == sp->req->sav->spi && - tdbi->proto == sp->req->sav->sah->saidx.proto && - bcmp(&tdbi->dst, &sp->req->sav->sah->saidx.dst, - sizeof (union sockaddr_union)) == 0) { - /* - * No IPsec processing is needed, free - * reference to SP. - * - * NB: null pointer to avoid free at - * done: below. - */ - KEY_FREESP(&sp), sp = NULL; - goto done; - } - } - /* * Do delayed checksums now because we send before * this is done in the normal processing path. @@ -332,9 +290,8 @@ ip_ipsec_output(struct mbuf **m, struct if (*error == -EINVAL) *error = 0; goto bad; - } else { - /* No IPsec processing for this packet. */ } + /* No IPsec processing for this packet. */ } done: if (sp != NULL) Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Thu Dec 11 10:47:50 2014 (r275701) +++ head/sys/netinet6/ip6_ipsec.c Thu Dec 11 14:43:44 2014 (r275702) @@ -223,23 +223,23 @@ ip6_ipsec_output(struct mbuf **m, struct struct ifnet **ifp) { #ifdef IPSEC - struct secpolicy *sp = NULL; - struct tdb_ident *tdbi; - struct m_tag *mtag; - /* XXX int s; */ - mtag = m_tag_find(*m, PACKET_TAG_IPSEC_PENDING_TDB, NULL); - if (mtag != NULL) { - tdbi = (struct tdb_ident *)(mtag + 1); - sp = ipsec_getpolicy(tdbi, IPSEC_DIR_OUTBOUND); - if (sp == NULL) - *error = -EINVAL; /* force silent drop */ - m_tag_delete(*m, mtag); - } else { - sp = ipsec4_checkpolicy(*m, IPSEC_DIR_OUTBOUND, *flags, - error, inp); - } + struct secpolicy *sp; /* + * Check the security policy (SP) for the packet and, if + * required, do IPsec-related processing. There are two + * cases here; the first time a packet is sent through + * it will be untagged and handled by ipsec4_checkpolicy. + * If the packet is resubmitted to ip6_output (e.g. after + * AH, ESP, etc. processing), there will be a tag to bypass + * the lookup and related policy checking. + */ + if (m_tag_find(*m, PACKET_TAG_IPSEC_OUT_DONE, NULL) != NULL) { + *error = 0; + return (0); + } + sp = ipsec4_checkpolicy(*m, IPSEC_DIR_OUTBOUND, *flags, error, inp); + /* * There are four return cases: * sp != NULL apply IPsec policy * sp == NULL, error == 0 no IPsec handling needed @@ -247,36 +247,6 @@ ip6_ipsec_output(struct mbuf **m, struct * sp == NULL, error != 0 discard packet, report error */ if (sp != NULL) { - /* Loop detection, check if ipsec processing already done */ - KASSERT(sp->req != NULL, ("ip_output: no ipsec request")); - for (mtag = m_tag_first(*m); mtag != NULL; - mtag = m_tag_next(*m, mtag)) { - if (mtag->m_tag_cookie != MTAG_ABI_COMPAT) - continue; - if (mtag->m_tag_id != PACKET_TAG_IPSEC_OUT_DONE && - mtag->m_tag_id != PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED) - continue; - /* - * Check if policy has no SA associated with it. - * This can happen when an SP has yet to acquire - * an SA; e.g. on first reference. If it occurs, - * then we let ipsec4_process_packet do its thing. - */ - if (sp->req->sav == NULL) - break; - tdbi = (struct tdb_ident *)(mtag + 1); - if (tdbi->spi == sp->req->sav->spi && - tdbi->proto == sp->req->sav->sah->saidx.proto && - bcmp(&tdbi->dst, &sp->req->sav->sah->saidx.dst, - sizeof (union sockaddr_union)) == 0) { - /* - * No IPsec processing is needed, free - * reference to SP. - */ - goto done; - } - } - /* * Do delayed checksums now because we send before * this is done in the normal processing path. @@ -333,9 +303,8 @@ ip6_ipsec_output(struct mbuf **m, struct if (*error == -EINVAL) *error = 0; goto bad; - } else { - /* No IPsec processing for this packet. */ } + /* No IPsec processing for this packet. */ } done: if (sp != NULL) From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 14:58:57 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE285DD8; Thu, 11 Dec 2014 14:58:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE0EFEC2; Thu, 11 Dec 2014 14:58:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBEwvKJ088222; Thu, 11 Dec 2014 14:58:57 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBEwuav088218; Thu, 11 Dec 2014 14:58:56 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111458.sBBEwuav088218@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 14:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275703 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 14:58:57 -0000 Author: ae Date: Thu Dec 11 14:58:55 2014 New Revision: 275703 URL: https://svnweb.freebsd.org/changeset/base/275703 Log: Remove PACKET_TAG_IPSEC_IN_DONE mbuf tag lookup and usage of its security policy. The changed block of code in ip*_ipsec_input() is called when packet has ESP/AH header. Presence of PACKET_TAG_IPSEC_IN_DONE mbuf tag in the same time means that packet was already handled by IPSEC and reinjected in the netisr, and it has another ESP/AH headers (encrypted twice?). Since it was already processed by IPSEC code, the AH/ESP headers was already stripped (and probably outer IP header was stripped too) and security policy from the tdb_ident was applied to those headers. It is incorrect to apply this security policy to current headers. Also make ip_ipsec_input() prototype similar to ip6_ipsec_input(). Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet/ip_input.c head/sys/netinet/ip_ipsec.c head/sys/netinet/ip_ipsec.h head/sys/netinet6/ip6_ipsec.c Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Thu Dec 11 14:43:44 2014 (r275702) +++ head/sys/netinet/ip_input.c Thu Dec 11 14:58:55 2014 (r275703) @@ -785,7 +785,7 @@ ours: * note that we do not visit this with protocols with pcb layer * code - like udp/tcp/raw ip. */ - if (ip_ipsec_input(m)) + if (ip_ipsec_input(m, ip->ip_p) != 0) goto bad; #endif /* IPSEC */ Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Thu Dec 11 14:43:44 2014 (r275702) +++ head/sys/netinet/ip_ipsec.c Thu Dec 11 14:58:55 2014 (r275703) @@ -146,11 +146,8 @@ ip_ipsec_fwd(struct mbuf *m) * 1 = drop packet, 0 = continue processing packet. */ int -ip_ipsec_input(struct mbuf *m) +ip_ipsec_input(struct mbuf *m, int nxt) { - struct ip *ip = mtod(m, struct ip *); - struct m_tag *mtag; - struct tdb_ident *tdbi; struct secpolicy *sp; int error; /* @@ -158,21 +155,9 @@ ip_ipsec_input(struct mbuf *m) * note that we do not visit this with protocols with pcb layer * code - like udp/tcp/raw ip. */ - if ((inetsw[ip_protox[ip->ip_p]].pr_flags & PR_LASTHDR) != 0) { - /* - * Check if the packet has already had IPsec processing - * done. If so, then just pass it along. This tag gets - * set during AH, ESP, etc. input handling, before the - * packet is returned to the ip input queue for delivery. - */ - mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL); - if (mtag != NULL) { - tdbi = (struct tdb_ident *)(mtag + 1); - sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND); - } else { - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, - IP_FORWARDING, &error); - } + if ((inetsw[ip_protox[nxt]].pr_flags & PR_LASTHDR) != 0) { + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, + IP_FORWARDING, &error); if (sp != NULL) { /* * Check security policy against packet attributes. @@ -183,12 +168,11 @@ ip_ipsec_input(struct mbuf *m) /* XXX error stat??? */ error = EINVAL; DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/ - return 1; } - if (error) - return 1; + if (error != 0) + return (1); } - return 0; + return (0); } /* Modified: head/sys/netinet/ip_ipsec.h ============================================================================== --- head/sys/netinet/ip_ipsec.h Thu Dec 11 14:43:44 2014 (r275702) +++ head/sys/netinet/ip_ipsec.h Thu Dec 11 14:58:55 2014 (r275703) @@ -34,7 +34,7 @@ int ip_ipsec_filtertunnel(struct mbuf *); int ip_ipsec_fwd(struct mbuf *); -int ip_ipsec_input(struct mbuf *); +int ip_ipsec_input(struct mbuf *, int); int ip_ipsec_mtu(struct mbuf *, int); int ip_ipsec_output(struct mbuf **, struct inpcb *, int *, int *); #endif Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Thu Dec 11 14:43:44 2014 (r275702) +++ head/sys/netinet6/ip6_ipsec.c Thu Dec 11 14:58:55 2014 (r275703) @@ -167,8 +167,6 @@ int ip6_ipsec_input(struct mbuf *m, int nxt) { #ifdef IPSEC - struct m_tag *mtag; - struct tdb_ident *tdbi; struct secpolicy *sp; int error; /* @@ -178,21 +176,8 @@ ip6_ipsec_input(struct mbuf *m, int nxt) */ if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0 && ipsec6_in_reject(m, NULL)) { - - /* - * Check if the packet has already had IPsec processing - * done. If so, then just pass it along. This tag gets - * set during AH, ESP, etc. input handling, before the - * packet is returned to the ip input queue for delivery. - */ - mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL); - if (mtag != NULL) { - tdbi = (struct tdb_ident *)(mtag + 1); - sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND); - } else { - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, - IP_FORWARDING, &error); - } + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, + IP_FORWARDING, &error); if (sp != NULL) { /* * Check security policy against packet attributes. @@ -203,13 +188,12 @@ ip6_ipsec_input(struct mbuf *m, int nxt) /* XXX error stat??? */ error = EINVAL; DPRINTF(("%s: no SP, packet discarded\n", __func__));/*XXX*/ - return 1; } - if (error) - return 1; + if (error != 0) + return (1); } #endif /* IPSEC */ - return 0; + return (0); } /* From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 17:34:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4CF4ADFE; Thu, 11 Dec 2014 17:34:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3802136A; Thu, 11 Dec 2014 17:34:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBHYpFe067816; Thu, 11 Dec 2014 17:34:51 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBHYoRA067813; Thu, 11 Dec 2014 17:34:50 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111734.sBBHYoRA067813@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 17:34:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275708 - in head/sys: netinet netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 17:34:51 -0000 Author: ae Date: Thu Dec 11 17:34:49 2014 New Revision: 275708 URL: https://svnweb.freebsd.org/changeset/base/275708 Log: Remove flags and tunalready arguments from ipsec4_process_packet() and make its prototype similar to ipsec6_process_packet. The flags argument isn't used here, tunalready is always zero. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet/ip_ipsec.c head/sys/netipsec/ipsec.h head/sys/netipsec/ipsec_output.c Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Thu Dec 11 17:14:49 2014 (r275707) +++ head/sys/netinet/ip_ipsec.c Thu Dec 11 17:34:49 2014 (r275708) @@ -228,7 +228,7 @@ ip_ipsec_output(struct mbuf **m, struct #endif /* NB: callee frees mbuf */ - *error = ipsec4_process_packet(*m, sp->req, *flags, 0); + *error = ipsec4_process_packet(*m, sp->req); if (*error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Thu Dec 11 17:14:49 2014 (r275707) +++ head/sys/netipsec/ipsec.h Thu Dec 11 17:34:49 2014 (r275708) @@ -354,8 +354,7 @@ extern int ipcomp4_input(struct mbuf **m extern int ipsec4_common_input(struct mbuf *m, ...); extern int ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int protoff); -extern int ipsec4_process_packet(struct mbuf *, struct ipsecrequest *, - int, int); +extern int ipsec4_process_packet(struct mbuf *, struct ipsecrequest *); extern int ipsec_process_done(struct mbuf *, struct ipsecrequest *); extern struct mbuf *ipsec_copypkt(struct mbuf *); Modified: head/sys/netipsec/ipsec_output.c ============================================================================== --- head/sys/netipsec/ipsec_output.c Thu Dec 11 17:14:49 2014 (r275707) +++ head/sys/netipsec/ipsec_output.c Thu Dec 11 17:34:49 2014 (r275708) @@ -169,7 +169,7 @@ ipsec_process_done(struct mbuf *m, struc #ifdef INET case AF_INET: IPSECSTAT_INC(ips_out_bundlesa); - return ipsec4_process_packet(m, isr->next, 0, 0); + return ipsec4_process_packet(m, isr->next); /* NOTREACHED */ #endif #ifdef notyet @@ -424,16 +424,13 @@ bad: * IPsec output logic for IPv4. */ int -ipsec4_process_packet( - struct mbuf *m, - struct ipsecrequest *isr, - int flags, - int tunalready) +ipsec4_process_packet(struct mbuf *m, struct ipsecrequest *isr) { + union sockaddr_union *dst; struct secasindex saidx; struct secasvar *sav; struct ip *ip; - int error, i, off; + int error, i, off, setdf; IPSEC_ASSERT(m != NULL, ("null mbuf")); IPSEC_ASSERT(isr != NULL, ("null isr")); @@ -448,7 +445,13 @@ ipsec4_process_packet( } sav = isr->sav; - + if (m->m_len < sizeof(struct ip) && + (m = m_pullup(m, sizeof (struct ip))) == NULL) { + error = ENOBUFS; + goto bad; + } + ip = mtod(m, struct ip *); + dst = &sav->sah->saidx.dst; #ifdef DEV_ENC if_inc_counter(encif, IFCOUNTER_OPACKETS, 1); if_inc_counter(encif, IFCOUNTER_OBYTES, m->m_pkthdr.len); @@ -459,95 +462,53 @@ ipsec4_process_packet( if ((error = ipsec_filter(&m, PFIL_OUT, ENC_OUT|ENC_BEFORE)) != 0) goto bad; #endif - - if (!tunalready) { - union sockaddr_union *dst = &sav->sah->saidx.dst; - int setdf; - - /* - * Collect IP_DF state from the outer header. - */ - if (dst->sa.sa_family == AF_INET) { - if (m->m_len < sizeof (struct ip) && - (m = m_pullup(m, sizeof (struct ip))) == NULL) { - error = ENOBUFS; - goto bad; - } - ip = mtod(m, struct ip *); - /* Honor system-wide control of how to handle IP_DF */ - switch (V_ip4_ipsec_dfbit) { - case 0: /* clear in outer header */ - case 1: /* set in outer header */ - setdf = V_ip4_ipsec_dfbit; - break; - default: /* propagate to outer header */ - setdf = ntohs(ip->ip_off & IP_DF); - break; - } - } else { - ip = NULL; /* keep compiler happy */ - setdf = 0; - } - /* Do the appropriate encapsulation, if necessary */ - if (isr->saidx.mode == IPSEC_MODE_TUNNEL || /* Tunnel requ'd */ - dst->sa.sa_family != AF_INET || /* PF mismatch */ + /* Do the appropriate encapsulation, if necessary */ + if (isr->saidx.mode == IPSEC_MODE_TUNNEL || /* Tunnel requ'd */ + dst->sa.sa_family != AF_INET || /* PF mismatch */ #if 0 (sav->flags & SADB_X_SAFLAGS_TUNNEL) || /* Tunnel requ'd */ sav->tdb_xform->xf_type == XF_IP4 || /* ditto */ #endif - (dst->sa.sa_family == AF_INET && /* Proxy */ - dst->sin.sin_addr.s_addr != INADDR_ANY && - dst->sin.sin_addr.s_addr != ip->ip_dst.s_addr)) { - struct mbuf *mp; - - /* Fix IPv4 header checksum and length */ - if (m->m_len < sizeof (struct ip) && - (m = m_pullup(m, sizeof (struct ip))) == NULL) { - error = ENOBUFS; - goto bad; - } - ip = mtod(m, struct ip *); - if (ip->ip_v == IPVERSION) { - ip->ip_len = htons(m->m_pkthdr.len); - ip->ip_sum = 0; - ip->ip_sum = in_cksum(m, ip->ip_hl << 2); - } + (dst->sa.sa_family == AF_INET && /* Proxy */ + dst->sin.sin_addr.s_addr != INADDR_ANY && + dst->sin.sin_addr.s_addr != ip->ip_dst.s_addr)) { + struct mbuf *mp; - /* Encapsulate the packet */ - error = ipip_output(m, isr, &mp, 0, 0); - if (mp == NULL && !error) { - /* Should never happen. */ - DPRINTF(("%s: ipip_output returns no mbuf and " - "no error!", __func__)); - error = EFAULT; - } - if (error) { - if (mp) { - /* XXX: Should never happen! */ - m_freem(mp); - } - m = NULL; /* ipip_output() already freed it */ - goto bad; - } - m = mp, mp = NULL; - /* - * ipip_output clears IP_DF in the new header. If - * we need to propagate IP_DF from the outer header, - * then we have to do it here. - * - * XXX shouldn't assume what ipip_output does. - */ - if (dst->sa.sa_family == AF_INET && setdf) { - if (m->m_len < sizeof (struct ip) && - (m = m_pullup(m, sizeof (struct ip))) == NULL) { - error = ENOBUFS; - goto bad; - } - ip = mtod(m, struct ip *); - ip->ip_off = ntohs(ip->ip_off); - ip->ip_off |= IP_DF; - ip->ip_off = htons(ip->ip_off); - } + /* Fix IPv4 header checksum and length */ + ip->ip_len = htons(m->m_pkthdr.len); + ip->ip_sum = 0; + ip->ip_sum = in_cksum(m, ip->ip_hl << 2); + /* + * Collect IP_DF state from the outer header + * and honor system-wide control of how to handle it. + */ + switch (V_ip4_ipsec_dfbit) { + case 0: /* clear in outer header */ + case 1: /* set in outer header */ + setdf = V_ip4_ipsec_dfbit; + break; + default: /* propagate to outer header */ + setdf = ntohs(ip->ip_off & IP_DF); + } + /* Encapsulate the packet */ + error = ipip_output(m, isr, &mp, 0, 0); + if (error != 0) { + m = NULL; /* ipip_output() already freed it */ + goto bad; + } + m = mp; + /* + * ipip_output clears IP_DF in the new header. If + * we need to propagate IP_DF from the outer header, + * then we have to do it here. + * + * XXX shouldn't assume what ipip_output does. + */ + if (dst->sa.sa_family == AF_INET && setdf) { + ip = mtod(m, struct ip *); + ip->ip_off = ntohs(ip->ip_off); + ip->ip_off |= IP_DF; + ip->ip_off = htons(ip->ip_off); } } From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 16:53:31 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 673D831E; Thu, 11 Dec 2014 16:53:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 528C1E46; Thu, 11 Dec 2014 16:53:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBGrVb9047186; Thu, 11 Dec 2014 16:53:31 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBGrUng047182; Thu, 11 Dec 2014 16:53:30 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111653.sBBGrUng047182@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 16:53:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275704 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 16:53:31 -0000 Author: ae Date: Thu Dec 11 16:53:29 2014 New Revision: 275704 URL: https://svnweb.freebsd.org/changeset/base/275704 Log: Move ip_ipsec_fwd() from ip_input() into ip_forward(). Remove check for presence PACKET_TAG_IPSEC_IN_DONE mbuf tag from ip_ipsec_fwd(). PACKET_TAG_IPSEC_IN_DONE tag means that packet is already handled by IPSEC code. This means that before IPSEC processing it was destined to our address and security policy was checked in the ip_ipsec_input(). After IPSEC processing packet has new IP addresses and destination address isn't our own. So, anyway we can't check security policy from the mbuf tag, because it corresponds to different addresses. We should check security policy that corresponds to packet attributes in both cases - when it has a mbuf tag and when it has not. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet/ip_input.c head/sys/netinet/ip_ipsec.c head/sys/netinet6/ip6_ipsec.c Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Thu Dec 11 14:58:55 2014 (r275703) +++ head/sys/netinet/ip_input.c Thu Dec 11 16:53:29 2014 (r275704) @@ -747,10 +747,6 @@ passin: IPSTAT_INC(ips_cantforward); m_freem(m); } else { -#ifdef IPSEC - if (ip_ipsec_fwd(m)) - goto bad; -#endif /* IPSEC */ ip_forward(m, dchg); } return; @@ -1452,6 +1448,13 @@ ip_forward(struct mbuf *m, int srcrt) m_freem(m); return; } +#ifdef IPSEC + if (ip_ipsec_fwd(m) != 0) { + IPSTAT_INC(ips_cantforward); + m_freem(m); + return; + } +#endif /* IPSEC */ #ifdef IPSTEALTH if (!V_ipstealth) { #endif Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Thu Dec 11 14:58:55 2014 (r275703) +++ head/sys/netinet/ip_ipsec.c Thu Dec 11 16:53:29 2014 (r275704) @@ -101,41 +101,27 @@ ip_ipsec_filtertunnel(struct mbuf *m) /* * Check if this packet has an active SA and needs to be dropped instead * of forwarded. - * Called from ip_input(). + * Called from ip_forward(). * 1 = drop packet, 0 = forward packet. */ int ip_ipsec_fwd(struct mbuf *m) { - struct m_tag *mtag; - struct tdb_ident *tdbi; struct secpolicy *sp; int error; - mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL); - if (mtag != NULL) { - tdbi = (struct tdb_ident *)(mtag + 1); - sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND); - } else { - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, - IP_FORWARDING, &error); - } - if (sp == NULL) { /* NB: can happen if error */ - /*XXX error stat???*/ - DPRINTF(("ip_input: no SP for forwarding\n")); /*XXX*/ - return 1; - } - - /* - * Check security policy against packet attributes. - */ - error = ipsec_in_reject(sp, m); - KEY_FREESP(&sp); - if (error) { - IPSTAT_INC(ips_cantforward); - return 1; + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, + IP_FORWARDING, &error); + if (sp != NULL) { + /* + * Check security policy against packet attributes. + */ + error = ipsec_in_reject(sp, m); + KEY_FREESP(&sp); } - return 0; + if (error != 0) + return (1); + return (0); } /* Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Thu Dec 11 14:58:55 2014 (r275703) +++ head/sys/netinet6/ip6_ipsec.c Thu Dec 11 16:53:29 2014 (r275704) @@ -125,35 +125,22 @@ int ip6_ipsec_fwd(struct mbuf *m) { #ifdef IPSEC - struct m_tag *mtag; - struct tdb_ident *tdbi; struct secpolicy *sp; int error; - mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL); - if (mtag != NULL) { - tdbi = (struct tdb_ident *)(mtag + 1); - sp = ipsec_getpolicy(tdbi, IPSEC_DIR_INBOUND); - } else { - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, - IP_FORWARDING, &error); - } - if (sp == NULL) { /* NB: can happen if error */ - /*XXX error stat???*/ - DPRINTF(("%s: no SP for forwarding\n", __func__)); /*XXX*/ - return 1; - } - /* - * Check security policy against packet attributes. - */ - error = ipsec_in_reject(sp, m); - KEY_FREESP(&sp); - if (error) { - IP6STAT_INC(ip6s_cantforward); - return 1; + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, + IP_FORWARDING, &error); + if (sp != NULL) { + /* + * Check security policy against packet attributes. + */ + error = ipsec_in_reject(sp, m); + KEY_FREESP(&sp); } + if (error != 0) + return (1); #endif /* IPSEC */ - return 0; + return (0); } /* From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 17:01:54 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86420593; Thu, 11 Dec 2014 17:01:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72B0FF4B; Thu, 11 Dec 2014 17:01:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBH1slD050504; Thu, 11 Dec 2014 17:01:54 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBH1sBW050484; Thu, 11 Dec 2014 17:01:54 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111701.sBBH1sBW050484@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 17:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275705 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 17:01:54 -0000 Author: ae Date: Thu Dec 11 17:01:53 2014 New Revision: 275705 URL: https://svnweb.freebsd.org/changeset/base/275705 Log: Remove unused mtag variable. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Thu Dec 11 16:53:29 2014 (r275704) +++ head/sys/netipsec/xform_ipcomp.c Thu Dec 11 17:01:53 2014 (r275705) @@ -227,7 +227,6 @@ ipcomp_input_cb(struct cryptop *crp) struct cryptodesc *crd; struct tdb_crypto *tc; int skip, protoff; - struct mtag *mtag; struct mbuf *m; struct secasvar *sav; struct secasindex *saidx; @@ -241,7 +240,6 @@ ipcomp_input_cb(struct cryptop *crp) IPSEC_ASSERT(tc != NULL, ("null opaque crypto data area!")); skip = tc->tc_skip; protoff = tc->tc_protoff; - mtag = (struct mtag *) tc->tc_ptr; m = (struct mbuf *) crp->crp_buf; sav = tc->tc_sav; From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 17:07:23 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 22600880; Thu, 11 Dec 2014 17:07:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D384FA3; Thu, 11 Dec 2014 17:07:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBH7Mo5053285; Thu, 11 Dec 2014 17:07:22 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBH7Mcm053281; Thu, 11 Dec 2014 17:07:22 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111707.sBBH7Mcm053281@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 17:07:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275706 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 17:07:23 -0000 Author: ae Date: Thu Dec 11 17:07:21 2014 New Revision: 275706 URL: https://svnweb.freebsd.org/changeset/base/275706 Log: Remove code related to PACKET_TAG_IPSEC_IN_CRYPTO_DONE mbuf tag. It isn't used in FreeBSD. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Thu Dec 11 17:01:53 2014 (r275705) +++ head/sys/netipsec/xform_ah.c Thu Dec 11 17:07:21 2014 (r275706) @@ -568,11 +568,9 @@ static int ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff) { struct auth_hash *ahx; - struct tdb_ident *tdbi; struct tdb_crypto *tc; - struct m_tag *mtag; struct newah *ah; - int hl, rplen, authsize; + int hl, rplen, authsize, error; struct cryptodesc *crda; struct cryptop *crp; @@ -640,27 +638,9 @@ ah_input(struct mbuf *m, struct secasvar crda->crd_klen = _KEYBITS(sav->key_auth); crda->crd_key = sav->key_auth->key_data; - /* Find out if we've already done crypto. */ - for (mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_CRYPTO_DONE, NULL); - mtag != NULL; - mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_CRYPTO_DONE, mtag)) { - tdbi = (struct tdb_ident *) (mtag + 1); - if (tdbi->proto == sav->sah->saidx.proto && - tdbi->spi == sav->spi && - !bcmp(&tdbi->dst, &sav->sah->saidx.dst, - sizeof (union sockaddr_union))) - break; - } - /* Allocate IPsec-specific opaque crypto info. */ - if (mtag == NULL) { - tc = (struct tdb_crypto *) malloc(sizeof (struct tdb_crypto) + - skip + rplen + authsize, M_XDATA, M_NOWAIT|M_ZERO); - } else { - /* Hash verification has already been done successfully. */ - tc = (struct tdb_crypto *) malloc(sizeof (struct tdb_crypto), - M_XDATA, M_NOWAIT|M_ZERO); - } + tc = (struct tdb_crypto *) malloc(sizeof (struct tdb_crypto) + + skip + rplen + authsize, M_XDATA, M_NOWAIT | M_ZERO); if (tc == NULL) { DPRINTF(("%s: failed to allocate tdb_crypto\n", __func__)); AHSTAT_INC(ahs_crypto); @@ -669,29 +649,24 @@ ah_input(struct mbuf *m, struct secasvar return ENOBUFS; } - /* Only save information if crypto processing is needed. */ - if (mtag == NULL) { - int error; - - /* - * Save the authenticator, the skipped portion of the packet, - * and the AH header. - */ - m_copydata(m, 0, skip + rplen + authsize, (caddr_t)(tc+1)); + /* + * Save the authenticator, the skipped portion of the packet, + * and the AH header. + */ + m_copydata(m, 0, skip + rplen + authsize, (caddr_t)(tc+1)); - /* Zeroize the authenticator on the packet. */ - m_copyback(m, skip + rplen, authsize, ipseczeroes); + /* Zeroize the authenticator on the packet. */ + m_copyback(m, skip + rplen, authsize, ipseczeroes); - /* "Massage" the packet headers for crypto processing. */ - error = ah_massage_headers(&m, sav->sah->saidx.dst.sa.sa_family, - skip, ahx->type, 0); - if (error != 0) { - /* NB: mbuf is free'd by ah_massage_headers */ - AHSTAT_INC(ahs_hdrops); - free(tc, M_XDATA); - crypto_freereq(crp); - return error; - } + /* "Massage" the packet headers for crypto processing. */ + error = ah_massage_headers(&m, sav->sah->saidx.dst.sa.sa_family, + skip, ahx->type, 0); + if (error != 0) { + /* NB: mbuf is free'd by ah_massage_headers */ + AHSTAT_INC(ahs_hdrops); + free(tc, M_XDATA); + crypto_freereq(crp); + return (error); } /* Crypto operation descriptor. */ @@ -709,14 +684,9 @@ ah_input(struct mbuf *m, struct secasvar tc->tc_nxt = ah->ah_nxt; tc->tc_protoff = protoff; tc->tc_skip = skip; - tc->tc_ptr = (caddr_t) mtag; /* Save the mtag we've identified. */ KEY_ADDREFSA(sav); tc->tc_sav = sav; - - if (mtag == NULL) - return crypto_dispatch(crp); - else - return ah_input_cb(crp); + return (crypto_dispatch(crp)); } /* @@ -731,7 +701,6 @@ ah_input_cb(struct cryptop *crp) struct cryptodesc *crd; struct auth_hash *ahx; struct tdb_crypto *tc; - struct m_tag *mtag; struct secasvar *sav; struct secasindex *saidx; u_int8_t nxt; @@ -745,7 +714,6 @@ ah_input_cb(struct cryptop *crp) skip = tc->tc_skip; nxt = tc->tc_nxt; protoff = tc->tc_protoff; - mtag = (struct m_tag *) tc->tc_ptr; m = (struct mbuf *) crp->crp_buf; sav = tc->tc_sav; @@ -791,34 +759,22 @@ ah_input_cb(struct cryptop *crp) /* Copy authenticator off the packet. */ m_copydata(m, skip + rplen, authsize, calc); - /* - * If we have an mtag, we don't need to verify the authenticator -- - * it has been verified by an IPsec-aware NIC. - */ - if (mtag == NULL) { - ptr = (caddr_t) (tc + 1); - - /* Verify authenticator. */ - if (bcmp(ptr + skip + rplen, calc, authsize)) { - DPRINTF(("%s: authentication hash mismatch for packet " - "in SA %s/%08lx\n", __func__, - ipsec_address(&saidx->dst), - (u_long) ntohl(sav->spi))); - AHSTAT_INC(ahs_badauth); - error = EACCES; - goto bad; - } - - /* Fix the Next Protocol field. */ - ((u_int8_t *) ptr)[protoff] = nxt; - - /* Copyback the saved (uncooked) network headers. */ - m_copyback(m, 0, skip, ptr); - } else { - /* Fix the Next Protocol field. */ - m_copyback(m, protoff, sizeof(u_int8_t), &nxt); + /* Verify authenticator. */ + ptr = (caddr_t) (tc + 1); + if (bcmp(ptr + skip + rplen, calc, authsize)) { + DPRINTF(("%s: authentication hash mismatch for packet " + "in SA %s/%08lx\n", __func__, + ipsec_address(&saidx->dst), + (u_long) ntohl(sav->spi))); + AHSTAT_INC(ahs_badauth); + error = EACCES; + goto bad; } + /* Fix the Next Protocol field. */ + ((u_int8_t *) ptr)[protoff] = nxt; + /* Copyback the saved (uncooked) network headers. */ + m_copyback(m, 0, skip, ptr); free(tc, M_XDATA), tc = NULL; /* No longer needed */ /* @@ -856,12 +812,12 @@ ah_input_cb(struct cryptop *crp) switch (saidx->dst.sa.sa_family) { #ifdef INET6 case AF_INET6: - error = ipsec6_common_input_cb(m, sav, skip, protoff, mtag); + error = ipsec6_common_input_cb(m, sav, skip, protoff, NULL); break; #endif #ifdef INET case AF_INET: - error = ipsec4_common_input_cb(m, sav, skip, protoff, mtag); + error = ipsec4_common_input_cb(m, sav, skip, protoff, NULL); break; #endif default: Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Thu Dec 11 17:01:53 2014 (r275705) +++ head/sys/netipsec/xform_esp.c Thu Dec 11 17:07:21 2014 (r275706) @@ -270,18 +270,16 @@ esp_input(struct mbuf *m, struct secasva { struct auth_hash *esph; struct enc_xform *espx; - struct tdb_ident *tdbi; struct tdb_crypto *tc; int plen, alen, hlen; - struct m_tag *mtag; struct newesp *esp; - struct cryptodesc *crde; struct cryptop *crp; IPSEC_ASSERT(sav != NULL, ("null SA")); IPSEC_ASSERT(sav->tdb_encalgxform != NULL, ("null encoding xform")); + alen = 0; /* Valid IP Packet length ? */ if ( (skip&3) || (m->m_pkthdr.len&3) ){ DPRINTF(("%s: misaligned packet, skip %u pkt len %u", @@ -314,8 +312,7 @@ esp_input(struct mbuf *m, struct secasva alen = AH_HMAC_HASHLEN; break; } - }else - alen = 0; + } /* * Verify payload length is multiple of encryption algorithm @@ -340,7 +337,8 @@ esp_input(struct mbuf *m, struct secasva /* * Check sequence number. */ - if (esph && sav->replay && !ipsec_chkreplay(ntohl(esp->esp_seq), sav)) { + if (esph != NULL && sav->replay != NULL && + !ipsec_chkreplay(ntohl(esp->esp_seq), sav)) { DPRINTF(("%s: packet replay check for %s\n", __func__, ipsec_logsastr(sav))); /*XXX*/ ESPSTAT_INC(esps_replay); @@ -351,18 +349,6 @@ esp_input(struct mbuf *m, struct secasva /* Update the counters */ ESPSTAT_ADD(esps_ibytes, m->m_pkthdr.len - (skip + hlen + alen)); - /* Find out if we've already done crypto */ - for (mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_CRYPTO_DONE, NULL); - mtag != NULL; - mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_CRYPTO_DONE, mtag)) { - tdbi = (struct tdb_ident *) (mtag + 1); - if (tdbi->proto == sav->sah->saidx.proto && - tdbi->spi == sav->spi && - !bcmp(&tdbi->dst, &sav->sah->saidx.dst, - sizeof(union sockaddr_union))) - break; - } - /* Get crypto descriptors */ crp = crypto_getreq(esph && espx ? 2 : 1); if (crp == NULL) { @@ -374,12 +360,8 @@ esp_input(struct mbuf *m, struct secasva } /* Get IPsec-specific opaque pointer */ - if (esph == NULL || mtag != NULL) - tc = (struct tdb_crypto *) malloc(sizeof(struct tdb_crypto), - M_XDATA, M_NOWAIT|M_ZERO); - else - tc = (struct tdb_crypto *) malloc(sizeof(struct tdb_crypto) + alen, - M_XDATA, M_NOWAIT|M_ZERO); + tc = (struct tdb_crypto *) malloc(sizeof(struct tdb_crypto) + alen, + M_XDATA, M_NOWAIT | M_ZERO); if (tc == NULL) { crypto_freereq(crp); DPRINTF(("%s: failed to allocate tdb_crypto\n", __func__)); @@ -388,9 +370,7 @@ esp_input(struct mbuf *m, struct secasva return ENOBUFS; } - tc->tc_ptr = (caddr_t) mtag; - - if (esph) { + if (esph != NULL) { struct cryptodesc *crda = crp->crp_desc; IPSEC_ASSERT(crda != NULL, ("null ah crypto descriptor")); @@ -405,9 +385,8 @@ esp_input(struct mbuf *m, struct secasva crda->crd_klen = _KEYBITS(sav->key_auth); /* Copy the authenticator */ - if (mtag == NULL) - m_copydata(m, m->m_pkthdr.len - alen, alen, - (caddr_t) (tc + 1)); + m_copydata(m, m->m_pkthdr.len - alen, alen, + (caddr_t) (tc + 1)); /* Chain authentication request */ crde = crda->crd_next; @@ -433,22 +412,17 @@ esp_input(struct mbuf *m, struct secasva tc->tc_sav = sav; /* Decryption descriptor */ - if (espx) { - IPSEC_ASSERT(crde != NULL, ("null esp crypto descriptor")); - crde->crd_skip = skip + hlen; - crde->crd_len = m->m_pkthdr.len - (skip + hlen + alen); - crde->crd_inject = skip + hlen - sav->ivlen; - - crde->crd_alg = espx->type; - crde->crd_key = sav->key_enc->key_data; - crde->crd_klen = _KEYBITS(sav->key_enc); - /* XXX Rounds ? */ - } + IPSEC_ASSERT(crde != NULL, ("null esp crypto descriptor")); + crde->crd_skip = skip + hlen; + crde->crd_len = m->m_pkthdr.len - (skip + hlen + alen); + crde->crd_inject = skip + hlen - sav->ivlen; + + crde->crd_alg = espx->type; + crde->crd_key = sav->key_enc->key_data; + crde->crd_klen = _KEYBITS(sav->key_enc); + /* XXX Rounds ? */ - if (mtag == NULL) - return crypto_dispatch(crp); - else - return esp_input_cb(crp); + return (crypto_dispatch(crp)); } /* @@ -464,7 +438,6 @@ esp_input_cb(struct cryptop *crp) struct auth_hash *esph; struct enc_xform *espx; struct tdb_crypto *tc; - struct m_tag *mtag; struct secasvar *sav; struct secasindex *saidx; caddr_t ptr; @@ -476,7 +449,6 @@ esp_input_cb(struct cryptop *crp) IPSEC_ASSERT(tc != NULL, ("null opaque crypto data area!")); skip = tc->tc_skip; protoff = tc->tc_protoff; - mtag = (struct m_tag *) tc->tc_ptr; m = (struct mbuf *) crp->crp_buf; sav = tc->tc_sav; @@ -526,30 +498,20 @@ esp_input_cb(struct cryptop *crp) alen = AH_HMAC_HASHLEN; break; } - /* - * If we have a tag, it means an IPsec-aware NIC did - * the verification for us. Otherwise we need to - * check the authentication calculation. - */ AHSTAT_INC(ahs_hist[sav->alg_auth]); - if (mtag == NULL) { - /* Copy the authenticator from the packet */ - m_copydata(m, m->m_pkthdr.len - alen, - alen, aalg); - - ptr = (caddr_t) (tc + 1); - - /* Verify authenticator */ - if (bcmp(ptr, aalg, alen) != 0) { - DPRINTF(("%s: " - "authentication hash mismatch for packet in SA %s/%08lx\n", - __func__, - ipsec_address(&saidx->dst), - (u_long) ntohl(sav->spi))); - ESPSTAT_INC(esps_badauth); - error = EACCES; - goto bad; - } + /* Copy the authenticator from the packet */ + m_copydata(m, m->m_pkthdr.len - alen, alen, aalg); + ptr = (caddr_t) (tc + 1); + + /* Verify authenticator */ + if (bcmp(ptr, aalg, alen) != 0) { + DPRINTF(("%s: authentication hash mismatch for " + "packet in SA %s/%08lx\n", __func__, + ipsec_address(&saidx->dst), + (u_long) ntohl(sav->spi))); + ESPSTAT_INC(esps_badauth); + error = EACCES; + goto bad; } /* Remove trailing authenticator */ @@ -635,12 +597,12 @@ esp_input_cb(struct cryptop *crp) switch (saidx->dst.sa.sa_family) { #ifdef INET6 case AF_INET6: - error = ipsec6_common_input_cb(m, sav, skip, protoff, mtag); + error = ipsec6_common_input_cb(m, sav, skip, protoff, NULL); break; #endif #ifdef INET case AF_INET: - error = ipsec4_common_input_cb(m, sav, skip, protoff, mtag); + error = ipsec4_common_input_cb(m, sav, skip, protoff, NULL); break; #endif default: From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 17:14:52 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 35301A28; Thu, 11 Dec 2014 17:14:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 206F5F3; Thu, 11 Dec 2014 17:14:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBHEpR5057841; Thu, 11 Dec 2014 17:14:51 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBHEoXC057831; Thu, 11 Dec 2014 17:14:50 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111714.sBBHEoXC057831@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 17:14:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275707 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 17:14:52 -0000 Author: ae Date: Thu Dec 11 17:14:49 2014 New Revision: 275707 URL: https://svnweb.freebsd.org/changeset/base/275707 Log: Remove now unused mtag argument from ipsec*_common_input_cb. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netipsec/ipsec.h head/sys/netipsec/ipsec6.h head/sys/netipsec/ipsec_input.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Thu Dec 11 17:07:21 2014 (r275706) +++ head/sys/netipsec/ipsec.h Thu Dec 11 17:14:49 2014 (r275707) @@ -353,7 +353,7 @@ extern void esp4_ctlinput(int cmd, struc extern int ipcomp4_input(struct mbuf **mp, int *offp, int proto); extern int ipsec4_common_input(struct mbuf *m, ...); extern int ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, - int skip, int protoff, struct m_tag *mt); + int skip, int protoff); extern int ipsec4_process_packet(struct mbuf *, struct ipsecrequest *, int, int); extern int ipsec_process_done(struct mbuf *, struct ipsecrequest *); Modified: head/sys/netipsec/ipsec6.h ============================================================================== --- head/sys/netipsec/ipsec6.h Thu Dec 11 17:07:21 2014 (r275706) +++ head/sys/netipsec/ipsec6.h Thu Dec 11 17:14:49 2014 (r275707) @@ -64,7 +64,7 @@ extern int ipsec6_in_reject(struct mbuf struct m_tag; extern int ipsec6_common_input(struct mbuf **mp, int *offp, int proto); extern int ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, - int skip, int protoff, struct m_tag *mt); + int skip, int protoff); extern void esp6_ctlinput(int, struct sockaddr *, void *); extern int ipsec6_process_packet(struct mbuf *, struct ipsecrequest *); #endif /*_KERNEL*/ Modified: head/sys/netipsec/ipsec_input.c ============================================================================== --- head/sys/netipsec/ipsec_input.c Thu Dec 11 17:07:21 2014 (r275706) +++ head/sys/netipsec/ipsec_input.c Thu Dec 11 17:14:49 2014 (r275707) @@ -317,8 +317,8 @@ ipcomp4_input(struct mbuf **mp, int *off * the processed packet. */ int -ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, - int skip, int protoff, struct m_tag *mt) +ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, + int protoff) { int prot, af, sproto, isr_prot; struct ip *ip; @@ -475,13 +475,9 @@ ipsec4_common_input_cb(struct mbuf *m, s /* * Record what we've done to the packet (under what SA it was - * processed). If we've been passed an mtag, it means the packet - * was already processed by an ethernet/crypto combo card and - * thus has a tag attached with all the right information, but - * with a PACKET_TAG_IPSEC_IN_CRYPTO_DONE as opposed to - * PACKET_TAG_IPSEC_IN_DONE type; in that case, just change the type. + * processed). */ - if (mt == NULL && sproto != IPPROTO_IPCOMP) { + if (sproto != IPPROTO_IPCOMP) { mtag = m_tag_get(PACKET_TAG_IPSEC_IN_DONE, sizeof(struct tdb_ident), M_NOWAIT); if (mtag == NULL) { @@ -500,9 +496,6 @@ ipsec4_common_input_cb(struct mbuf *m, s tdbi->alg_enc = sav->alg_enc; m_tag_prepend(m, mtag); - } else if (mt != NULL) { - mt->m_tag_id = PACKET_TAG_IPSEC_IN_DONE; - /* XXX do we need to mark m_flags??? */ } key_sa_recordxfer(sav, m); /* record data transfer */ @@ -619,8 +612,8 @@ ipsec6_common_input(struct mbuf **mp, in * filtering and other sanity checks on the processed packet. */ int -ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int protoff, - struct m_tag *mt) +ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, + int protoff) { int prot, af, sproto; struct ip6_hdr *ip6; @@ -764,13 +757,9 @@ ipsec6_common_input_cb(struct mbuf *m, s /* * Record what we've done to the packet (under what SA it was - * processed). If we've been passed an mtag, it means the packet - * was already processed by an ethernet/crypto combo card and - * thus has a tag attached with all the right information, but - * with a PACKET_TAG_IPSEC_IN_CRYPTO_DONE as opposed to - * PACKET_TAG_IPSEC_IN_DONE type; in that case, just change the type. + * processed). */ - if (mt == NULL && sproto != IPPROTO_IPCOMP) { + if (sproto != IPPROTO_IPCOMP) { mtag = m_tag_get(PACKET_TAG_IPSEC_IN_DONE, sizeof(struct tdb_ident), M_NOWAIT); if (mtag == NULL) { @@ -789,10 +778,6 @@ ipsec6_common_input_cb(struct mbuf *m, s tdbi->alg_enc = sav->alg_enc; m_tag_prepend(m, mtag); - } else { - if (mt != NULL) - mt->m_tag_id = PACKET_TAG_IPSEC_IN_DONE; - /* XXX do we need to mark m_flags??? */ } key_sa_recordxfer(sav, m); Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Thu Dec 11 17:07:21 2014 (r275706) +++ head/sys/netipsec/xform_ah.c Thu Dec 11 17:14:49 2014 (r275707) @@ -812,12 +812,12 @@ ah_input_cb(struct cryptop *crp) switch (saidx->dst.sa.sa_family) { #ifdef INET6 case AF_INET6: - error = ipsec6_common_input_cb(m, sav, skip, protoff, NULL); + error = ipsec6_common_input_cb(m, sav, skip, protoff); break; #endif #ifdef INET case AF_INET: - error = ipsec4_common_input_cb(m, sav, skip, protoff, NULL); + error = ipsec4_common_input_cb(m, sav, skip, protoff); break; #endif default: Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Thu Dec 11 17:07:21 2014 (r275706) +++ head/sys/netipsec/xform_esp.c Thu Dec 11 17:14:49 2014 (r275707) @@ -597,12 +597,12 @@ esp_input_cb(struct cryptop *crp) switch (saidx->dst.sa.sa_family) { #ifdef INET6 case AF_INET6: - error = ipsec6_common_input_cb(m, sav, skip, protoff, NULL); + error = ipsec6_common_input_cb(m, sav, skip, protoff); break; #endif #ifdef INET case AF_INET: - error = ipsec4_common_input_cb(m, sav, skip, protoff, NULL); + error = ipsec4_common_input_cb(m, sav, skip, protoff); break; #endif default: Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Thu Dec 11 17:07:21 2014 (r275706) +++ head/sys/netipsec/xform_ipcomp.c Thu Dec 11 17:14:49 2014 (r275707) @@ -309,12 +309,12 @@ ipcomp_input_cb(struct cryptop *crp) switch (saidx->dst.sa.sa_family) { #ifdef INET6 case AF_INET6: - error = ipsec6_common_input_cb(m, sav, skip, protoff, NULL); + error = ipsec6_common_input_cb(m, sav, skip, protoff); break; #endif #ifdef INET case AF_INET: - error = ipsec4_common_input_cb(m, sav, skip, protoff, NULL); + error = ipsec4_common_input_cb(m, sav, skip, protoff); break; #endif default: From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 18:08:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD33E412; Thu, 11 Dec 2014 18:08:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98FD0912; Thu, 11 Dec 2014 18:08:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBI8tFI083619; Thu, 11 Dec 2014 18:08:55 GMT (envelope-from emax@FreeBSD.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBI8tA6083618; Thu, 11 Dec 2014 18:08:55 GMT (envelope-from emax@FreeBSD.org) Message-Id: <201412111808.sBBI8tA6083618@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emax set sender to emax@FreeBSD.org using -f From: Maksim Yevmenkin Date: Thu, 11 Dec 2014 18:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275709 - head/usr.sbin/bluetooth/bthidd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 18:08:55 -0000 Author: emax Date: Thu Dec 11 18:08:54 2014 New Revision: 275709 URL: https://svnweb.freebsd.org/changeset/base/275709 Log: handle "Kana" and "Eisu" keys on Apple Wireless Keyboard (JIS) PR: 187470 Submitted by: naito.yuichiro MFC after: 1 week Modified: head/usr.sbin/bluetooth/bthidd/kbd.c Modified: head/usr.sbin/bluetooth/bthidd/kbd.c ============================================================================== --- head/usr.sbin/bluetooth/bthidd/kbd.c Thu Dec 11 17:34:49 2014 (r275708) +++ head/usr.sbin/bluetooth/bthidd/kbd.c Thu Dec 11 18:08:54 2014 (r275709) @@ -225,8 +225,8 @@ static int32_t const x[] = /* Keyboard Int'l 7 8D */ -1, /* Unassigned */ /* Keyboard Int'l 8 8E */ -1, /* Unassigned */ /* Keyboard Int'l 9 8F */ -1, /* Unassigned */ -/* Keyboard Lang 1 90 */ NOBREAK|0xF2, /* None */ -/* Keyboard Lang 2 91 */ NOBREAK|0xF1, /* None */ +/* Keyboard Lang 1 90 */ 0x71, /* eisu */ +/* Keyboard Lang 2 91 */ 0x72, /* kana */ /* Keyboard Lang 3 92 */ 0x78, /* F8 */ /* Keyboard Lang 4 93 */ 0x77, /* F7 */ /* Keyboard Lang 5 94 */ 0x76, /* F6 */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 18:40:57 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E1CDA12; Thu, 11 Dec 2014 18:40:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A5F8CF2; Thu, 11 Dec 2014 18:40:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBIevb5001659; Thu, 11 Dec 2014 18:40:57 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBIevI6001658; Thu, 11 Dec 2014 18:40:57 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111840.sBBIevI6001658@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 18:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275711 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 18:40:57 -0000 Author: ae Date: Thu Dec 11 18:40:56 2014 New Revision: 275711 URL: https://svnweb.freebsd.org/changeset/base/275711 Log: Initialize error variable. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netipsec/ipsec.c Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Thu Dec 11 18:35:34 2014 (r275710) +++ head/sys/netipsec/ipsec.c Thu Dec 11 18:40:56 2014 (r275711) @@ -428,6 +428,7 @@ ipsec_getpolicybyaddr(struct mbuf *m, u_ ("invalid direction %u", dir)); sp = NULL; + *error = 0; if (key_havesp(dir)) { /* Make an index to look for a policy. */ *error = ipsec_setspidx(m, &spidx, 0); From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 18:35:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 832808BD; Thu, 11 Dec 2014 18:35:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D58DC1C; Thu, 11 Dec 2014 18:35:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBIZcNi097920; Thu, 11 Dec 2014 18:35:38 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBIZZUk097901; Thu, 11 Dec 2014 18:35:36 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111835.sBBIZZUk097901@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 18:35:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275710 - in head/sys: netinet netinet6 netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 18:35:38 -0000 Author: ae Date: Thu Dec 11 18:35:34 2014 New Revision: 275710 URL: https://svnweb.freebsd.org/changeset/base/275710 Log: Remove flag/flags argument from the following functions: ipsec_getpolicybyaddr() ipsec4_checkpolicy() ip_ipsec_output() ip6_ipsec_output() The only flag used here was IP_FORWARDING. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet/ip_ipsec.c head/sys/netinet/ip_ipsec.h head/sys/netinet/ip_output.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_ipsec.c head/sys/netinet6/ip6_ipsec.h head/sys/netinet6/ip6_output.c head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec.h Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Thu Dec 11 18:08:54 2014 (r275709) +++ head/sys/netinet/ip_ipsec.c Thu Dec 11 18:35:34 2014 (r275710) @@ -110,8 +110,7 @@ ip_ipsec_fwd(struct mbuf *m) struct secpolicy *sp; int error; - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, - IP_FORWARDING, &error); + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error); if (sp != NULL) { /* * Check security policy against packet attributes. @@ -142,8 +141,7 @@ ip_ipsec_input(struct mbuf *m, int nxt) * code - like udp/tcp/raw ip. */ if ((inetsw[ip_protox[nxt]].pr_flags & PR_LASTHDR) != 0) { - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, - IP_FORWARDING, &error); + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error); if (sp != NULL) { /* * Check security policy against packet attributes. @@ -185,7 +183,7 @@ ip_ipsec_mtu(struct mbuf *m, int mtu) * -1 = packet was reinjected and stop processing packet */ int -ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error) +ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *error) { struct secpolicy *sp; /* @@ -201,7 +199,7 @@ ip_ipsec_output(struct mbuf **m, struct *error = 0; return (0); } - sp = ipsec4_checkpolicy(*m, IPSEC_DIR_OUTBOUND, *flags, error, inp); + sp = ipsec4_checkpolicy(*m, IPSEC_DIR_OUTBOUND, error, inp); /* * There are four return cases: * sp != NULL apply IPsec policy Modified: head/sys/netinet/ip_ipsec.h ============================================================================== --- head/sys/netinet/ip_ipsec.h Thu Dec 11 18:08:54 2014 (r275709) +++ head/sys/netinet/ip_ipsec.h Thu Dec 11 18:35:34 2014 (r275710) @@ -36,5 +36,5 @@ int ip_ipsec_filtertunnel(struct mbuf *) int ip_ipsec_fwd(struct mbuf *); int ip_ipsec_input(struct mbuf *, int); int ip_ipsec_mtu(struct mbuf *, int); -int ip_ipsec_output(struct mbuf **, struct inpcb *, int *, int *); +int ip_ipsec_output(struct mbuf **, struct inpcb *, int *); #endif Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Dec 11 18:08:54 2014 (r275709) +++ head/sys/netinet/ip_output.c Thu Dec 11 18:35:34 2014 (r275710) @@ -461,7 +461,7 @@ again: sendit: #ifdef IPSEC - switch(ip_ipsec_output(&m, inp, &flags, &error)) { + switch(ip_ipsec_output(&m, inp, &error)) { case 1: goto bad; case -1: Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Thu Dec 11 18:08:54 2014 (r275709) +++ head/sys/netinet6/ip6_forward.c Thu Dec 11 18:35:34 2014 (r275710) @@ -177,8 +177,7 @@ ip6_forward(struct mbuf *m, int srcrt) #ifdef IPSEC /* get a security policy for this packet */ - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_OUTBOUND, - IP_FORWARDING, &error); + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_OUTBOUND, &error); if (sp == NULL) { IPSEC6STAT_INC(ips_out_inval); IP6STAT_INC(ip6s_cantforward); Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Thu Dec 11 18:08:54 2014 (r275709) +++ head/sys/netinet6/ip6_ipsec.c Thu Dec 11 18:35:34 2014 (r275710) @@ -128,8 +128,7 @@ ip6_ipsec_fwd(struct mbuf *m) struct secpolicy *sp; int error; - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, - IP_FORWARDING, &error); + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error); if (sp != NULL) { /* * Check security policy against packet attributes. @@ -163,8 +162,7 @@ ip6_ipsec_input(struct mbuf *m, int nxt) */ if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0 && ipsec6_in_reject(m, NULL)) { - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, - IP_FORWARDING, &error); + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error); if (sp != NULL) { /* * Check security policy against packet attributes. @@ -190,8 +188,7 @@ ip6_ipsec_input(struct mbuf *m, int nxt) */ int -ip6_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error, - struct ifnet **ifp) +ip6_ipsec_output(struct mbuf **m, struct inpcb *inp, int *error) { #ifdef IPSEC struct secpolicy *sp; @@ -209,7 +206,7 @@ ip6_ipsec_output(struct mbuf **m, struct *error = 0; return (0); } - sp = ipsec4_checkpolicy(*m, IPSEC_DIR_OUTBOUND, *flags, error, inp); + sp = ipsec4_checkpolicy(*m, IPSEC_DIR_OUTBOUND, error, inp); /* * There are four return cases: * sp != NULL apply IPsec policy Modified: head/sys/netinet6/ip6_ipsec.h ============================================================================== --- head/sys/netinet6/ip6_ipsec.h Thu Dec 11 18:08:54 2014 (r275709) +++ head/sys/netinet6/ip6_ipsec.h Thu Dec 11 18:35:34 2014 (r275710) @@ -35,8 +35,7 @@ int ip6_ipsec_filtertunnel(struct mbuf *); int ip6_ipsec_fwd(struct mbuf *); int ip6_ipsec_input(struct mbuf *, int); -int ip6_ipsec_output(struct mbuf **, struct inpcb *, int *, int *, - struct ifnet **); +int ip6_ipsec_output(struct mbuf **, struct inpcb *, int *); #if 0 int ip6_ipsec_mtu(struct mbuf *); #endif Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Dec 11 18:08:54 2014 (r275709) +++ head/sys/netinet6/ip6_output.c Thu Dec 11 18:35:34 2014 (r275710) @@ -303,8 +303,9 @@ ip6_output(struct mbuf *m0, struct ip6_p /* * IPSec checking which handles several cases. * FAST IPSEC: We re-injected the packet. + * XXX: need scope argument. */ - switch(ip6_ipsec_output(&m, inp, &flags, &error, &ifp)) + switch(ip6_ipsec_output(&m, inp, &error)) { case 1: /* Bad packet */ goto freehdrs; Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Thu Dec 11 18:08:54 2014 (r275709) +++ head/sys/netipsec/ipsec.c Thu Dec 11 18:35:34 2014 (r275710) @@ -417,7 +417,7 @@ ipsec_getpolicybysock(struct mbuf *m, u_ * others : error occured. */ struct secpolicy * -ipsec_getpolicybyaddr(struct mbuf *m, u_int dir, int flag, int *error) +ipsec_getpolicybyaddr(struct mbuf *m, u_int dir, int *error) { struct secpolicyindex spidx; struct secpolicy *sp; @@ -430,15 +430,13 @@ ipsec_getpolicybyaddr(struct mbuf *m, u_ sp = NULL; if (key_havesp(dir)) { /* Make an index to look for a policy. */ - *error = ipsec_setspidx(m, &spidx, - (flag & IP_FORWARDING) ? 0 : 1); + *error = ipsec_setspidx(m, &spidx, 0); if (*error != 0) { - DPRINTF(("%s: setpidx failed, dir %u flag %u\n", - __func__, dir, flag)); + DPRINTF(("%s: setpidx failed, dir %u\n", + __func__, dir)); return (NULL); } spidx.dir = dir; - sp = KEY_ALLOCSP(&spidx, dir); } if (sp == NULL) /* No SP found, use system default. */ @@ -448,14 +446,13 @@ ipsec_getpolicybyaddr(struct mbuf *m, u_ } struct secpolicy * -ipsec4_checkpolicy(struct mbuf *m, u_int dir, u_int flag, int *error, - struct inpcb *inp) +ipsec4_checkpolicy(struct mbuf *m, u_int dir, int *error, struct inpcb *inp) { struct secpolicy *sp; *error = 0; if (inp == NULL) - sp = ipsec_getpolicybyaddr(m, dir, flag, error); + sp = ipsec_getpolicybyaddr(m, dir, error); else sp = ipsec_getpolicybysock(m, dir, inp, error); if (sp == NULL) { @@ -1276,13 +1273,9 @@ ipsec46_in_reject(struct mbuf *m, struct IPSEC_ASSERT(m != NULL, ("null mbuf")); - /* - * Get SP for this packet. - * When we are called from ip_forward(), we call - * ipsec_getpolicybyaddr() with IP_FORWARDING flag. - */ + /* Get SP for this packet. */ if (inp == NULL) - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, IP_FORWARDING, &error); + sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error); else sp = ipsec_getpolicybysock(m, IPSEC_DIR_INBOUND, inp, &error); @@ -1408,12 +1401,9 @@ ipsec_hdrsiz(struct mbuf *m, u_int dir, IPSEC_ASSERT(m != NULL, ("null mbuf")); - /* Get SP for this packet. - * When we are called from ip_forward(), we call - * ipsec_getpolicybyaddr() with IP_FORWARDING flag. - */ + /* Get SP for this packet. */ if (inp == NULL) - sp = ipsec_getpolicybyaddr(m, dir, IP_FORWARDING, &error); + sp = ipsec_getpolicybyaddr(m, dir, &error); else sp = ipsec_getpolicybysock(m, dir, inp, &error); Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Thu Dec 11 18:08:54 2014 (r275709) +++ head/sys/netipsec/ipsec.h Thu Dec 11 18:35:34 2014 (r275710) @@ -313,10 +313,9 @@ extern void ipsec_delisr(struct ipsecreq struct tdb_ident; extern struct secpolicy *ipsec_getpolicy(struct tdb_ident*, u_int); struct inpcb; -extern struct secpolicy *ipsec4_checkpolicy(struct mbuf *, u_int, u_int, +extern struct secpolicy *ipsec4_checkpolicy(struct mbuf *, u_int, int *, struct inpcb *); -extern struct secpolicy * ipsec_getpolicybyaddr(struct mbuf *, u_int, - int, int *); +extern struct secpolicy * ipsec_getpolicybyaddr(struct mbuf *, u_int, int *); struct inpcb; extern int ipsec_init_policy(struct socket *so, struct inpcbpolicy **); From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 18:46:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BE130B5B; Thu, 11 Dec 2014 18:46:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA224D35; Thu, 11 Dec 2014 18:46:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBIkCY9002844; Thu, 11 Dec 2014 18:46:12 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBIkCnb002843; Thu, 11 Dec 2014 18:46:12 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111846.sBBIkCnb002843@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 18:46:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275712 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 18:46:12 -0000 Author: ae Date: Thu Dec 11 18:46:11 2014 New Revision: 275712 URL: https://svnweb.freebsd.org/changeset/base/275712 Log: Treat errors when retrieving security policy as policy violation. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netipsec/ipsec.c Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Thu Dec 11 18:40:56 2014 (r275711) +++ head/sys/netipsec/ipsec.c Thu Dec 11 18:46:11 2014 (r275712) @@ -1265,6 +1265,9 @@ ipsec_in_reject(struct secpolicy *sp, st return (0); /* Valid. */ } +/* + * Non zero return value means security policy DISCARD or policy violation. + */ static int ipsec46_in_reject(struct mbuf *m, struct inpcb *inp) { @@ -1284,8 +1287,7 @@ ipsec46_in_reject(struct mbuf *m, struct result = ipsec_in_reject(sp, m); KEY_FREESP(&sp); } else { - result = 0; /* XXX Should be panic? - * -> No, there may be error. */ + result = 1; /* treat errors as policy violation */ } return (result); } From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 18:58:23 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F02DE4E; Thu, 11 Dec 2014 18:58:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AB34E63; Thu, 11 Dec 2014 18:58:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBIwNFm007741; Thu, 11 Dec 2014 18:58:23 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBIwN4u007740; Thu, 11 Dec 2014 18:58:23 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201412111858.sBBIwN4u007740@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Thu, 11 Dec 2014 18:58:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275714 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 18:58:23 -0000 Author: rpaulo Date: Thu Dec 11 18:58:22 2014 New Revision: 275714 URL: https://svnweb.freebsd.org/changeset/base/275714 Log: Add myself. Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Thu Dec 11 18:55:54 2014 (r275713) +++ head/share/misc/committers-ports.dot Thu Dec 11 18:58:22 2014 (r275714) @@ -189,6 +189,7 @@ rnoland [label="Robert Noland\nrnoland@F robak [label="Bartek Rutkowski\nrobak@FreeBSD.org\n2014/06/10"] rodrigo [label="Rodrigo Osorio\nrodrigo@FreeBSD.org\n2014/01/15"] romain [label="Romain Tartiere\nromain@FreeBSD.org\n2010/01/24"] +rpaulo [label="Rui Paulo\nrpaulo@FreeBSD.org\n2014/07/15"] sahil [label="Sahil Tandon\nsahil@FreeBSD.org\n2010/04/11"] sat [label="Andrew Pantyukhin\nsat@FreeBSD.org\n2006/05/06"] sbruno [label="Sean Bruno\nsbruno@FreeBSD.org\n2014/09/14"] @@ -268,6 +269,7 @@ bapt -> jlaffaye bapt -> marius bapt -> marino bapt -> rodrigo +bapt -> rpaulo bapt -> sbruno beat -> decke @@ -543,6 +545,7 @@ swills -> feld swills -> milki swills -> pclin swills -> robak +swills -> rpaulo swills -> xmj tabthorpe -> ashish From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 19:20:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5EEE32E0; Thu, 11 Dec 2014 19:20:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AA75F0; Thu, 11 Dec 2014 19:20:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBJKF37018659; Thu, 11 Dec 2014 19:20:15 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBJKDOC018653; Thu, 11 Dec 2014 19:20:13 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111920.sBBJKDOC018653@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 19:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275716 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 19:20:15 -0000 Author: ae Date: Thu Dec 11 19:20:13 2014 New Revision: 275716 URL: https://svnweb.freebsd.org/changeset/base/275716 Log: Do not count security policy violation twice. ipsec*_in_reject() do this by their own. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet/sctp_input.c head/sys/netinet/tcp_input.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/raw_ip6.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Thu Dec 11 19:09:57 2014 (r275715) +++ head/sys/netinet/sctp_input.c Thu Dec 11 19:20:13 2014 (r275716) @@ -5698,7 +5698,6 @@ sctp_common_input_processing(struct mbuf #ifdef INET case AF_INET: if (ipsec4_in_reject(m, &inp->ip_inp.inp)) { - IPSECSTAT_INC(ips_in_polvio); SCTP_STAT_INCR(sctps_hdrops); goto out; } @@ -5707,7 +5706,6 @@ sctp_common_input_processing(struct mbuf #ifdef INET6 case AF_INET6: if (ipsec6_in_reject(m, &inp->ip_inp.inp)) { - IPSEC6STAT_INC(ips_in_polvio); SCTP_STAT_INCR(sctps_hdrops); goto out; } Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Dec 11 19:09:57 2014 (r275715) +++ head/sys/netinet/tcp_input.c Thu Dec 11 19:20:13 2014 (r275716) @@ -894,12 +894,10 @@ findpcb: #ifdef IPSEC #ifdef INET6 if (isipv6 && ipsec6_in_reject(m, inp)) { - IPSEC6STAT_INC(ips_in_polvio); goto dropunlock; } else #endif /* INET6 */ if (ipsec4_in_reject(m, inp) != 0) { - IPSECSTAT_INC(ips_in_polvio); goto dropunlock; } #endif /* IPSEC */ Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Thu Dec 11 19:09:57 2014 (r275715) +++ head/sys/netinet/udp_usrreq.c Thu Dec 11 19:20:13 2014 (r275716) @@ -323,7 +323,6 @@ udp_append(struct inpcb *inp, struct ip /* Check AH/ESP integrity. */ if (ipsec4_in_reject(n, inp)) { m_freem(n); - IPSECSTAT_INC(ips_in_polvio); return; } #ifdef IPSEC_NAT_T Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Thu Dec 11 19:09:57 2014 (r275715) +++ head/sys/netinet6/raw_ip6.c Thu Dec 11 19:20:13 2014 (r275716) @@ -264,7 +264,6 @@ rip6_input(struct mbuf **mp, int *offp, */ if (n && ipsec6_in_reject(n, last)) { m_freem(n); - IPSEC6STAT_INC(ips_in_polvio); /* Do not inject data into pcb. */ } else #endif /* IPSEC */ @@ -296,7 +295,6 @@ rip6_input(struct mbuf **mp, int *offp, */ if ((last != NULL) && ipsec6_in_reject(m, last)) { m_freem(m); - IPSEC6STAT_INC(ips_in_polvio); IP6STAT_DEC(ip6s_delivered); /* Do not inject data into pcb. */ INP_RUNLOCK(last); Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Dec 11 19:09:57 2014 (r275715) +++ head/sys/netinet6/udp6_usrreq.c Thu Dec 11 19:20:13 2014 (r275716) @@ -158,7 +158,6 @@ udp6_append(struct inpcb *inp, struct mb /* Check AH/ESP integrity. */ if (ipsec6_in_reject(n, inp)) { m_freem(n); - IPSEC6STAT_INC(ips_in_polvio); return; } #endif /* IPSEC */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 19:09:59 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31866FA; Thu, 11 Dec 2014 19:09:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CF80F94; Thu, 11 Dec 2014 19:09:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBJ9w5Z012686; Thu, 11 Dec 2014 19:09:58 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBJ9wbG012684; Thu, 11 Dec 2014 19:09:58 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111909.sBBJ9wbG012684@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 19:09:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275715 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 19:09:59 -0000 Author: ae Date: Thu Dec 11 19:09:57 2014 New Revision: 275715 URL: https://svnweb.freebsd.org/changeset/base/275715 Log: Use ipsec6_in_reject() to simplify ip6_ipsec_fwd() and ip6_ipsec_input(). ipsec6_in_reject() does the same things, also it counts policy violation errors. Do IPSEC check in the ip6_forward() after addresses checks. Also use ip6_ipsec_fwd() to make code similar to IPv4 implementation. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_ipsec.c Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Thu Dec 11 18:58:22 2014 (r275714) +++ head/sys/netinet6/ip6_forward.c Thu Dec 11 19:09:57 2014 (r275715) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef IPSEC +#include #include #include #include @@ -109,21 +110,6 @@ ip6_forward(struct mbuf *m, int srcrt) struct m_tag *fwd_tag; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; -#ifdef IPSEC - /* - * Check AH/ESP integrity. - */ - /* - * Don't increment ip6s_cantforward because this is the check - * before forwarding packet actually. - */ - if (ipsec6_in_reject(m, NULL)) { - IPSEC6STAT_INC(ips_in_polvio); - m_freem(m); - return; - } -#endif /* IPSEC */ - /* * Do not forward packets to multicast destination (should be handled * by ip6_mforward(). @@ -148,6 +134,17 @@ ip6_forward(struct mbuf *m, int srcrt) m_freem(m); return; } +#ifdef IPSEC + /* + * Check if this packet has an active SA and needs to be dropped + * instead of forwarded. + */ + if (ip6_ipsec_fwd(m) != 0) { + IP6STAT_INC(ip6s_cantforward); + m_freem(m); + return; + } +#endif /* IPSEC */ #ifdef IPSTEALTH if (!V_ip6stealth) { Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Thu Dec 11 18:58:22 2014 (r275714) +++ head/sys/netinet6/ip6_ipsec.c Thu Dec 11 19:09:57 2014 (r275715) @@ -118,28 +118,18 @@ ip6_ipsec_filtertunnel(struct mbuf *m) /* * Check if this packet has an active SA and needs to be dropped instead * of forwarded. - * Called from ip6_input(). + * Called from ip6_forward(). * 1 = drop packet, 0 = forward packet. */ int ip6_ipsec_fwd(struct mbuf *m) { -#ifdef IPSEC - struct secpolicy *sp; - int error; - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error); - if (sp != NULL) { - /* - * Check security policy against packet attributes. - */ - error = ipsec_in_reject(sp, m); - KEY_FREESP(&sp); - } - if (error != 0) - return (1); -#endif /* IPSEC */ +#ifdef IPSEC + return (ipsec6_in_reject(m, NULL)); +#else return (0); +#endif /* !IPSEC */ } /* @@ -152,31 +142,15 @@ ip6_ipsec_fwd(struct mbuf *m) int ip6_ipsec_input(struct mbuf *m, int nxt) { + #ifdef IPSEC - struct secpolicy *sp; - int error; /* * enforce IPsec policy checking if we are seeing last header. * note that we do not visit this with protocols with pcb layer * code - like udp/tcp/raw ip. */ - if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0 && - ipsec6_in_reject(m, NULL)) { - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error); - if (sp != NULL) { - /* - * Check security policy against packet attributes. - */ - error = ipsec_in_reject(sp, m); - KEY_FREESP(&sp); - } else { - /* XXX error stat??? */ - error = EINVAL; - DPRINTF(("%s: no SP, packet discarded\n", __func__));/*XXX*/ - } - if (error != 0) - return (1); - } + if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0) + return (ipsec6_in_reject(m, NULL)); #endif /* IPSEC */ return (0); } From owner-svn-src-all@FreeBSD.ORG Thu Dec 11 18:55:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F29B9D31; Thu, 11 Dec 2014 18:55:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4853E3F; Thu, 11 Dec 2014 18:55:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBIttMp007417; Thu, 11 Dec 2014 18:55:55 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBIttPF007416; Thu, 11 Dec 2014 18:55:55 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412111855.sBBIttPF007416@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 11 Dec 2014 18:55:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275713 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 11 Dec 2014 18:55:56 -0000 Author: ae Date: Thu Dec 11 18:55:54 2014 New Revision: 275713 URL: https://svnweb.freebsd.org/changeset/base/275713 Log: Use ipsec4_in_reject() to simplify ip_ipsec_fwd() and ip_ipsec_input(). ipsec4_in_reject() does the same things, also it counts policy violation errors. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet/ip_ipsec.c Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Thu Dec 11 18:46:11 2014 (r275712) +++ head/sys/netinet/ip_ipsec.c Thu Dec 11 18:55:54 2014 (r275713) @@ -107,20 +107,8 @@ ip_ipsec_filtertunnel(struct mbuf *m) int ip_ipsec_fwd(struct mbuf *m) { - struct secpolicy *sp; - int error; - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error); - if (sp != NULL) { - /* - * Check security policy against packet attributes. - */ - error = ipsec_in_reject(sp, m); - KEY_FREESP(&sp); - } - if (error != 0) - return (1); - return (0); + return (ipsec4_in_reject(m, NULL)); } /* @@ -133,29 +121,13 @@ ip_ipsec_fwd(struct mbuf *m) int ip_ipsec_input(struct mbuf *m, int nxt) { - struct secpolicy *sp; - int error; /* * enforce IPsec policy checking if we are seeing last header. * note that we do not visit this with protocols with pcb layer * code - like udp/tcp/raw ip. */ - if ((inetsw[ip_protox[nxt]].pr_flags & PR_LASTHDR) != 0) { - sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error); - if (sp != NULL) { - /* - * Check security policy against packet attributes. - */ - error = ipsec_in_reject(sp, m); - KEY_FREESP(&sp); - } else { - /* XXX error stat??? */ - error = EINVAL; - DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/ - } - if (error != 0) - return (1); - } + if ((inetsw[ip_protox[nxt]].pr_flags & PR_LASTHDR) != 0) + return (ipsec4_in_reject(m, NULL)); return (0); } From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 03:58:53 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43DF0F42; Fri, 12 Dec 2014 03:58:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DC7F6D4; Fri, 12 Dec 2014 03:58:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC3wrVl074264; Fri, 12 Dec 2014 03:58:53 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC3wq8J074256; Fri, 12 Dec 2014 03:58:52 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201412120358.sBC3wq8J074256@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 12 Dec 2014 03:58:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275718 - in head: contrib/binutils/bfd contrib/binutils/include/elf gnu/usr.bin/binutils/libbfd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 03:58:53 -0000 Author: jhibbits Date: Fri Dec 12 03:58:51 2014 New Revision: 275718 URL: https://svnweb.freebsd.org/changeset/base/275718 Log: Add new PowerPC relocations to binutils Summary: LLVM/Clang generates relocations that our binutils doesn't understand, but newer binutils does. I got permission from the author of a series of patches to relicense them as GPLv2 for use in FreeBSD. The upstream git hashes are: ac2df442ac7901f00af15b272fc48b594b433713 2b95367962dc14f69d3c338c4d54195266e2e169 102890f04c44b64cf5cef4588267dd9f24086ac7 b7fcf6f6bb53b5027e111107f5416769cb9a5798 1d483afedd5a628dc84fb58d1d570f79fdfbfa7b 90aecf7a80c1cefeb45fc10a6cd02c8338e34b4c 3a71aa26df2a372a58e9c11ef9ba51fd0e83320a 727fc41e077139570ea8b8ddfd6c546b2a55627c With the import of clang 3.5, and a few backported patches, we should be able to move powerpc and powerpc64 to clang-as-cc soon. Test Plan: Passes make tinderbox, so no regressions. Binaries built with clang run on powerpc64. Reviewers: #committers, dim Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D1297 Obtained from: Alan Modra, upstream binutils-gdb git MFC after: 3 weeks Relnotes: yes Modified: head/contrib/binutils/bfd/ChangeLog head/contrib/binutils/bfd/bfd-in2.h head/contrib/binutils/bfd/ecoff.c head/contrib/binutils/bfd/elf32-ppc.c head/contrib/binutils/bfd/elf64-ppc.c head/contrib/binutils/bfd/libbfd.h head/contrib/binutils/bfd/reloc.c head/contrib/binutils/bfd/section.c head/contrib/binutils/include/elf/ChangeLog head/contrib/binutils/include/elf/ppc.h head/contrib/binutils/include/elf/ppc64.h head/gnu/usr.bin/binutils/libbfd/bfd.h Modified: head/contrib/binutils/bfd/ChangeLog ============================================================================== --- head/contrib/binutils/bfd/ChangeLog Thu Dec 11 19:27:27 2014 (r275717) +++ head/contrib/binutils/bfd/ChangeLog Fri Dec 12 03:58:51 2014 (r275718) @@ -1,3 +1,49 @@ +2009-02-15 Alan Modra + + * elf64-ppc.c (struct _ppc64_elf_section_data): Delete t_symndx, + add toc.symndx and toc.add. + (ppc64_elf_check_relocs): Don't set htab->tls_get_addr here. + Set up toc.add. + (get_tls_mask): Add toc_addend param, set from toc.add. Adjust all + callers. + (ppc64_elf_tls_setup): Set htab->tls_get_addr and tls_get_addr_fd. + (branch_reloc_hash_match): New function, extracted from.. + (ppc64_elf_tls_optimize): ..here. + (ppc64_elf_relocate_section): Properly set addends when optimizing + tls sequences. Avoid unnecessary reading and writing of insns. + Only redo reloc when symbol changed. Bypass symbol checks when + using tlsld_got. + * elf32-ppc.c (ppc_elf_tls_setup): Correct comment. + (branch_reloc_hash_match): New function, extracted from.. + (ppc_elf_tls_optimize): ..here. + (ppc_elf_relocate_section): Avoid unnecessary reading of insns. + Don't clear addend on zapped __tls_get_addr reloc. + +2008-08-11 Alan Modra + + * elf64-ppc.c (toc_adjusting_stub_needed): Any call via the plt + needs r2 valid, not just those to external syms. + +2007-11-06 Alan Modra + + * elf32-ppc.c (ppc_elf_check_relocs): Don't refcount tlsld_got here.. + (ppc_elf_gc_sweep_hook): ..or here.. + (ppc_elf_tls_optimize): ..or here. Make two passes through the + relocs, ensuring that tls_get_addr calls follow gd and ld relocs. + (allocate_dynrelocs): Refcount tlsld_got here. + (ppc_elf_size_dynamic_sections): Call allocate_dynrelocs before + allocating tlsld_got. + (ppc_elf_relocate_section): Remove check that a tls_get_addr + call follows gd and ld relocs. + +2007-08-13 Alan Modra + + * elf64-ppc.c (ADDI_R12_R12, LD_R11_0R2, LD_R2_0R2): Define. + Update stub comments. + (build_plt_stub): Build two variants, one without "addis". + (ppc_build_one_stub): Build stubs without "addis" if possible. + (ppc_size_one_stub): Size new stubs. + 2007-07-02 Joseph Myers * elfxx-mips.c (mips_elf_calculate_relocation): Handle Modified: head/contrib/binutils/bfd/bfd-in2.h ============================================================================== --- head/contrib/binutils/bfd/bfd-in2.h Thu Dec 11 19:27:27 2014 (r275717) +++ head/contrib/binutils/bfd/bfd-in2.h Fri Dec 12 03:58:51 2014 (r275718) @@ -1380,6 +1380,9 @@ typedef struct bfd_section /* Nonzero if this section has TLS related relocations. */ unsigned int has_tls_reloc:1; + /* Nonzero if this section has a call to __tls_get_addr. */ + unsigned int has_tls_get_addr_call:1; + /* Nonzero if this section has a gp reloc. */ unsigned int has_gp_reloc:1; @@ -1640,11 +1643,11 @@ extern asection bfd_ind_section; /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \ 0, 0, 0, 0, \ \ - /* has_gp_reloc, need_finalize_relax, reloc_done, */ \ - 0, 0, 0, \ + /* has_tls_get_addr_call, has_gp_reloc, need_finalize_relax, */ \ + 0, 0, 0, \ \ - /* vma, lma, size, rawsize */ \ - 0, 0, 0, 0, \ + /* reloc_done, vma, lma, size, rawsize */ \ + 0, 0, 0, 0, 0, \ \ /* output_offset, output_section, alignment_power, */ \ 0, (struct bfd_section *) &SEC, 0, \ @@ -2896,6 +2899,8 @@ in the instruction. */ /* PowerPC and PowerPC64 thread-local storage relocations. */ BFD_RELOC_PPC_TLS, + BFD_RELOC_PPC_TLSGD, + BFD_RELOC_PPC_TLSLD, BFD_RELOC_PPC_DTPMOD, BFD_RELOC_PPC_TPREL16, BFD_RELOC_PPC_TPREL16_LO, Modified: head/contrib/binutils/bfd/ecoff.c ============================================================================== --- head/contrib/binutils/bfd/ecoff.c Thu Dec 11 19:27:27 2014 (r275717) +++ head/contrib/binutils/bfd/ecoff.c Fri Dec 12 03:58:51 2014 (r275718) @@ -58,10 +58,10 @@ static asection bfd_debug_section = 0, 0, 1, 0, /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ 0, 0, 0, 0, - /* has_gp_reloc, need_finalize_relax, reloc_done, */ - 0, 0, 0, - /* vma, lma, size, rawsize, */ - 0, 0, 0, 0, + /* has_tls_get_addr_call, has_gp_reloc, need_finalize_relax, */ + 0, 0, 0, + /* reloc_done, vma, lma, size, rawsize, */ + 0, 0, 0, 0, 0, /* output_offset, output_section, alignment_power, */ 0, NULL, 0, /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ Modified: head/contrib/binutils/bfd/elf32-ppc.c ============================================================================== --- head/contrib/binutils/bfd/elf32-ppc.c Thu Dec 11 19:27:27 2014 (r275717) +++ head/contrib/binutils/bfd/elf32-ppc.c Fri Dec 12 03:58:51 2014 (r275718) @@ -746,7 +746,7 @@ static reloc_howto_type ppc_elf_howto_ra 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Marker reloc for TLS. */ + /* Marker relocs for TLS. */ HOWTO (R_PPC_TLS, 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -761,6 +761,34 @@ static reloc_howto_type ppc_elf_howto_ra 0, /* dst_mask */ FALSE), /* pcrel_offset */ + HOWTO (R_PPC_TLSGD, + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_TLSGD", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPC_TLSLD, + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_TLSLD", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* Computes the load module index of the load module that contains the definition of its TLS sym. */ HOWTO (R_PPC_DTPMOD32, @@ -1524,6 +1552,8 @@ ppc_elf_reloc_type_lookup (bfd *abfd ATT case BFD_RELOC_CTOR: r = R_PPC_ADDR32; break; case BFD_RELOC_PPC_TOC16: r = R_PPC_TOC16; break; case BFD_RELOC_PPC_TLS: r = R_PPC_TLS; break; + case BFD_RELOC_PPC_TLSGD: r = R_PPC_TLSGD; break; + case BFD_RELOC_PPC_TLSLD: r = R_PPC_TLSLD; break; case BFD_RELOC_PPC_DTPMOD: r = R_PPC_DTPMOD32; break; case BFD_RELOC_PPC_TPREL16: r = R_PPC_TPREL16; break; case BFD_RELOC_PPC_TPREL16_LO: r = R_PPC_TPREL16_LO; break; @@ -2345,16 +2375,34 @@ struct plt_entry bfd_vma glink_offset; }; -/* Of those relocs that might be copied as dynamic relocs, this macro +/* Of those relocs that might be copied as dynamic relocs, this function selects those that must be copied when linking a shared library, even when the symbol is local. */ -#define MUST_BE_DYN_RELOC(RTYPE) \ - ((RTYPE) != R_PPC_REL24 \ - && (RTYPE) != R_PPC_REL14 \ - && (RTYPE) != R_PPC_REL14_BRTAKEN \ - && (RTYPE) != R_PPC_REL14_BRNTAKEN \ - && (RTYPE) != R_PPC_REL32) +static int +must_be_dyn_reloc (struct bfd_link_info *info, + enum elf_ppc_reloc_type r_type) +{ + switch (r_type) + { + default: + return 1; + + case R_PPC_REL24: + case R_PPC_REL14: + case R_PPC_REL14_BRTAKEN: + case R_PPC_REL14_BRNTAKEN: + case R_PPC_REL32: + return 0; + + case R_PPC_TPREL32: + case R_PPC_TPREL16: + case R_PPC_TPREL16_LO: + case R_PPC_TPREL16_HI: + case R_PPC_TPREL16_HA: + return !info->executable; + } +} /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid copying dynamic variables from a shared lib into an app's dynbss @@ -2421,7 +2469,7 @@ struct ppc_elf_link_hash_table /* The .got.plt section (VxWorks only)*/ asection *sgotplt; - /* Shortcut to .__tls_get_addr. */ + /* Shortcut to __tls_get_addr. */ struct elf_link_hash_entry *tls_get_addr; /* The bfd that forced an old-style PLT. */ @@ -3040,6 +3088,7 @@ ppc_elf_check_relocs (bfd *abfd, const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; asection *got2, *sreloc; + struct elf_link_hash_entry *tga; if (info->relocatable) return TRUE; @@ -3063,6 +3112,8 @@ ppc_elf_check_relocs (bfd *abfd, ppc_elf_howto_init (); htab = ppc_elf_hash_table (info); + tga = elf_link_hash_lookup (&htab->elf, "__tls_get_addr", + FALSE, FALSE, TRUE); symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); got2 = bfd_get_section_by_name (abfd, ".got2"); @@ -3074,7 +3125,7 @@ ppc_elf_check_relocs (bfd *abfd, unsigned long r_symndx; enum elf_ppc_reloc_type r_type; struct elf_link_hash_entry *h; - int tls_type = 0; + int tls_type; r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx < symtab_hdr->sh_info) @@ -3101,14 +3152,48 @@ ppc_elf_check_relocs (bfd *abfd, BFD_ASSERT (h == htab->elf.hgot); } + tls_type = 0; r_type = ELF32_R_TYPE (rel->r_info); + if (h != NULL && h == tga) + switch (r_type) + { + default: + break; + + case R_PPC_PLTREL24: + case R_PPC_LOCAL24PC: + case R_PPC_REL24: + case R_PPC_REL14: + case R_PPC_REL14_BRTAKEN: + case R_PPC_REL14_BRNTAKEN: + case R_PPC_ADDR24: + case R_PPC_ADDR14: + case R_PPC_ADDR14_BRTAKEN: + case R_PPC_ADDR14_BRNTAKEN: + if (rel != relocs + && (ELF32_R_TYPE (rel[-1].r_info) == R_PPC_TLSGD + || ELF32_R_TYPE (rel[-1].r_info) == R_PPC_TLSLD)) + /* We have a new-style __tls_get_addr call with a marker + reloc. */ + ; + else + /* Mark this section as having an old-style call. */ + sec->has_tls_get_addr_call = 1; + break; + } + switch (r_type) { + case R_PPC_TLSGD: + case R_PPC_TLSLD: + /* These special tls relocs tie a call to __tls_get_addr with + its parameter symbol. */ + break; + case R_PPC_GOT_TLSLD16: case R_PPC_GOT_TLSLD16_LO: case R_PPC_GOT_TLSLD16_HI: case R_PPC_GOT_TLSLD16_HA: - htab->tlsld_got.refcount += 1; tls_type = TLS_TLS | TLS_LD; goto dogottls; @@ -3123,7 +3208,7 @@ ppc_elf_check_relocs (bfd *abfd, case R_PPC_GOT_TPREL16_LO: case R_PPC_GOT_TPREL16_HI: case R_PPC_GOT_TPREL16_HA: - if (info->shared) + if (!info->executable) info->flags |= DF_STATIC_TLS; tls_type = TLS_TLS | TLS_TPREL; goto dogottls; @@ -3358,7 +3443,7 @@ ppc_elf_check_relocs (bfd *abfd, /* This refers only to functions defined in the shared library. */ case R_PPC_LOCAL24PC: - if (h && h == htab->elf.hgot && htab->plt_type == PLT_UNSET) + if (h != NULL && h == htab->elf.hgot && htab->plt_type == PLT_UNSET) { htab->plt_type = PLT_OLD; htab->old_bfd = abfd; @@ -3381,7 +3466,11 @@ ppc_elf_check_relocs (bfd *abfd, /* We shouldn't really be seeing these. */ case R_PPC_TPREL32: - if (info->shared) + case R_PPC_TPREL16: + case R_PPC_TPREL16_LO: + case R_PPC_TPREL16_HI: + case R_PPC_TPREL16_HA: + if (!info->executable) info->flags |= DF_STATIC_TLS; goto dodyn; @@ -3390,14 +3479,6 @@ ppc_elf_check_relocs (bfd *abfd, case R_PPC_DTPREL32: goto dodyn; - case R_PPC_TPREL16: - case R_PPC_TPREL16_LO: - case R_PPC_TPREL16_HI: - case R_PPC_TPREL16_HA: - if (info->shared) - info->flags |= DF_STATIC_TLS; - goto dodyn; - case R_PPC_REL32: if (h == NULL && got2 != NULL @@ -3488,7 +3569,7 @@ ppc_elf_check_relocs (bfd *abfd, dynamic library if we manage to avoid copy relocs for the symbol. */ if ((info->shared - && (MUST_BE_DYN_RELOC (r_type) + && (must_be_dyn_reloc (info, r_type) || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak @@ -3583,7 +3664,7 @@ ppc_elf_check_relocs (bfd *abfd, } p->count += 1; - if (!MUST_BE_DYN_RELOC (r_type)) + if (!must_be_dyn_reloc (info, r_type)) p->pc_count += 1; } @@ -3903,9 +3984,6 @@ ppc_elf_gc_sweep_hook (bfd *abfd, case R_PPC_GOT_TLSLD16_LO: case R_PPC_GOT_TLSLD16_HI: case R_PPC_GOT_TLSLD16_HA: - htab->tlsld_got.refcount -= 1; - /* Fall thru */ - case R_PPC_GOT_TLSGD16: case R_PPC_GOT_TLSGD16_LO: case R_PPC_GOT_TLSGD16_HI: @@ -3979,7 +4057,8 @@ ppc_elf_gc_sweep_hook (bfd *abfd, return TRUE; } -/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */ +/* Set plt output section type, htab->tls_get_addr, and call the + generic ELF tls_setup function. */ asection * ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) @@ -4000,6 +4079,43 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd return _bfd_elf_tls_setup (obfd, info); } +/* Return TRUE iff REL is a branch reloc with a global symbol matching + HASH. */ + +static bfd_boolean +branch_reloc_hash_match (const bfd *ibfd, + const Elf_Internal_Rela *rel, + const struct elf_link_hash_entry *hash) +{ + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + enum elf_ppc_reloc_type r_type = ELF32_R_TYPE (rel->r_info); + unsigned int r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_symndx >= symtab_hdr->sh_info + && (r_type == R_PPC_PLTREL24 + || r_type == R_PPC_LOCAL24PC + || r_type == R_PPC_REL14 + || r_type == R_PPC_REL14_BRTAKEN + || r_type == R_PPC_REL14_BRNTAKEN + || r_type == R_PPC_REL24 + || r_type == R_PPC_ADDR24 + || r_type == R_PPC_ADDR14 + || r_type == R_PPC_ADDR14_BRTAKEN + || r_type == R_PPC_ADDR14_BRNTAKEN)) + { + struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (ibfd); + struct elf_link_hash_entry *h; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h == hash) + return TRUE; + } + return FALSE; +} + /* Run through all the TLS relocs looking for optimization opportunities. */ @@ -4010,187 +4126,204 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUT bfd *ibfd; asection *sec; struct ppc_elf_link_hash_table *htab; + int pass; - if (info->relocatable || info->shared) + if (info->relocatable || !info->executable) return TRUE; htab = ppc_elf_hash_table (info); - for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) - { - Elf_Internal_Sym *locsyms = NULL; - Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; - - for (sec = ibfd->sections; sec != NULL; sec = sec->next) - if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section)) - { - Elf_Internal_Rela *relstart, *rel, *relend; - int expecting_tls_get_addr; + /* Make two passes through the relocs. First time check that tls + relocs involved in setting up a tls_get_addr call are indeed + followed by such a call. If they are not, exclude them from + the optimizations done on the second pass. */ + for (pass = 0; pass < 2; ++pass) + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + Elf_Internal_Sym *locsyms = NULL; + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; - /* Read the relocations. */ - relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, - info->keep_memory); - if (relstart == NULL) - return FALSE; + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section)) + { + Elf_Internal_Rela *relstart, *rel, *relend; - expecting_tls_get_addr = 0; - relend = relstart + sec->reloc_count; - for (rel = relstart; rel < relend; rel++) - { - enum elf_ppc_reloc_type r_type; - unsigned long r_symndx; - struct elf_link_hash_entry *h = NULL; - char *tls_mask; - char tls_set, tls_clear; - bfd_boolean is_local; + /* Read the relocations. */ + relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, + info->keep_memory); + if (relstart == NULL) + return FALSE; - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - struct elf_link_hash_entry **sym_hashes; + relend = relstart + sec->reloc_count; + for (rel = relstart; rel < relend; rel++) + { + enum elf_ppc_reloc_type r_type; + unsigned long r_symndx; + struct elf_link_hash_entry *h = NULL; + char *tls_mask; + char tls_set, tls_clear; + bfd_boolean is_local; + int expecting_tls_get_addr; + bfd_signed_vma *got_count; - sym_hashes = elf_sym_hashes (ibfd); - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - } + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf_link_hash_entry **sym_hashes; - is_local = FALSE; - if (h == NULL - || !h->def_dynamic) - is_local = TRUE; + sym_hashes = elf_sym_hashes (ibfd); + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } - r_type = ELF32_R_TYPE (rel->r_info); - switch (r_type) - { - case R_PPC_GOT_TLSLD16: - case R_PPC_GOT_TLSLD16_LO: - case R_PPC_GOT_TLSLD16_HI: - case R_PPC_GOT_TLSLD16_HA: - /* These relocs should never be against a symbol - defined in a shared lib. Leave them alone if - that turns out to be the case. */ - expecting_tls_get_addr = 0; - htab->tlsld_got.refcount -= 1; - if (!is_local) - continue; + expecting_tls_get_addr = 0; + is_local = FALSE; + if (h == NULL + || !h->def_dynamic) + is_local = TRUE; - /* LD -> LE */ - tls_set = 0; - tls_clear = TLS_LD; - expecting_tls_get_addr = 1; - break; + r_type = ELF32_R_TYPE (rel->r_info); + switch (r_type) + { + case R_PPC_GOT_TLSLD16: + case R_PPC_GOT_TLSLD16_LO: + expecting_tls_get_addr = 1; + /* Fall thru */ + + case R_PPC_GOT_TLSLD16_HI: + case R_PPC_GOT_TLSLD16_HA: + /* These relocs should never be against a symbol + defined in a shared lib. Leave them alone if + that turns out to be the case. */ + if (!is_local) + continue; - case R_PPC_GOT_TLSGD16: - case R_PPC_GOT_TLSGD16_LO: - case R_PPC_GOT_TLSGD16_HI: - case R_PPC_GOT_TLSGD16_HA: - if (is_local) - /* GD -> LE */ + /* LD -> LE */ tls_set = 0; - else - /* GD -> IE */ - tls_set = TLS_TLS | TLS_TPRELGD; - tls_clear = TLS_GD; - expecting_tls_get_addr = 1; - break; + tls_clear = TLS_LD; + break; - case R_PPC_GOT_TPREL16: - case R_PPC_GOT_TPREL16_LO: - case R_PPC_GOT_TPREL16_HI: - case R_PPC_GOT_TPREL16_HA: - expecting_tls_get_addr = 0; - if (is_local) - { - /* IE -> LE */ + case R_PPC_GOT_TLSGD16: + case R_PPC_GOT_TLSGD16_LO: + expecting_tls_get_addr = 1; + /* Fall thru */ + + case R_PPC_GOT_TLSGD16_HI: + case R_PPC_GOT_TLSGD16_HA: + if (is_local) + /* GD -> LE */ tls_set = 0; - tls_clear = TLS_TPREL; - break; - } - else + else + /* GD -> IE */ + tls_set = TLS_TLS | TLS_TPRELGD; + tls_clear = TLS_GD; + break; + + case R_PPC_GOT_TPREL16: + case R_PPC_GOT_TPREL16_LO: + case R_PPC_GOT_TPREL16_HI: + case R_PPC_GOT_TPREL16_HA: + if (is_local) + { + /* IE -> LE */ + tls_set = 0; + tls_clear = TLS_TPREL; + break; + } + else + continue; + + default: continue; + } - case R_PPC_REL14: - case R_PPC_REL14_BRTAKEN: - case R_PPC_REL14_BRNTAKEN: - case R_PPC_REL24: - if (expecting_tls_get_addr - && h != NULL - && h == htab->tls_get_addr) - { - struct plt_entry *ent = find_plt_ent (h, NULL, 0); - if (ent != NULL && ent->plt.refcount > 0) - ent->plt.refcount -= 1; - } - expecting_tls_get_addr = 0; - continue; + if (pass == 0) + { + if (!expecting_tls_get_addr + || !sec->has_tls_get_addr_call) + continue; + + if (rel + 1 < relend + && branch_reloc_hash_match (ibfd, rel + 1, + htab->tls_get_addr)) + continue; + + /* Uh oh, we didn't find the expected call. We + could just mark this symbol to exclude it + from tls optimization but it's safer to skip + the entire section. */ + sec->has_tls_reloc = 0; + break; + } - default: - expecting_tls_get_addr = 0; - continue; - } + if (h != NULL) + { + tls_mask = &ppc_elf_hash_entry (h)->tls_mask; + got_count = &h->got.refcount; + } + else + { + Elf_Internal_Sym *sym; + bfd_signed_vma *lgot_refs; + char *lgot_masks; - if (h != NULL) - { - if (tls_set == 0) - { - /* We managed to get rid of a got entry. */ - if (h->got.refcount > 0) - h->got.refcount -= 1; - } - tls_mask = &ppc_elf_hash_entry (h)->tls_mask; - } - else - { - Elf_Internal_Sym *sym; - bfd_signed_vma *lgot_refs; - char *lgot_masks; + if (locsyms == NULL) + { + locsyms = (Elf_Internal_Sym *) symtab_hdr->contents; + if (locsyms == NULL) + locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, + symtab_hdr->sh_info, + 0, NULL, NULL, NULL); + if (locsyms == NULL) + { + if (elf_section_data (sec)->relocs != relstart) + free (relstart); + return FALSE; + } + } + sym = locsyms + r_symndx; + lgot_refs = elf_local_got_refcounts (ibfd); + if (lgot_refs == NULL) + abort (); + lgot_masks = (char *) (lgot_refs + symtab_hdr->sh_info); + tls_mask = &lgot_masks[r_symndx]; + got_count = &lgot_refs[r_symndx]; + } - if (locsyms == NULL) - { - locsyms = (Elf_Internal_Sym *) symtab_hdr->contents; - if (locsyms == NULL) - locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, - symtab_hdr->sh_info, - 0, NULL, NULL, NULL); - if (locsyms == NULL) - { - if (elf_section_data (sec)->relocs != relstart) - free (relstart); - return FALSE; - } - } - sym = locsyms + r_symndx; - lgot_refs = elf_local_got_refcounts (ibfd); - if (lgot_refs == NULL) - abort (); - if (tls_set == 0) - { - /* We managed to get rid of a got entry. */ - if (lgot_refs[r_symndx] > 0) - lgot_refs[r_symndx] -= 1; - } - lgot_masks = (char *) (lgot_refs + symtab_hdr->sh_info); - tls_mask = &lgot_masks[r_symndx]; - } + if (tls_set == 0) + { + /* We managed to get rid of a got entry. */ + if (*got_count > 0) + *got_count -= 1; + } - *tls_mask |= tls_set; - *tls_mask &= ~tls_clear; - } + if (expecting_tls_get_addr) + { + struct plt_entry *ent; - if (elf_section_data (sec)->relocs != relstart) - free (relstart); - } + ent = find_plt_ent (htab->tls_get_addr, NULL, 0); + if (ent != NULL && ent->plt.refcount > 0) + ent->plt.refcount -= 1; + } - if (locsyms != NULL - && (symtab_hdr->contents != (unsigned char *) locsyms)) - { - if (!info->keep_memory) - free (locsyms); - else - symtab_hdr->contents = (unsigned char *) locsyms; - } - } + *tls_mask |= tls_set; + *tls_mask &= ~tls_clear; + } + + if (elf_section_data (sec)->relocs != relstart) + free (relstart); + } + + if (locsyms != NULL + && (symtab_hdr->contents != (unsigned char *) locsyms)) + { + if (!info->keep_memory) + free (locsyms); + else + symtab_hdr->contents = (unsigned char *) locsyms; + } + } return TRUE; } @@ -4615,8 +4748,11 @@ allocate_dynrelocs (struct elf_link_hash if (eh->tls_mask == (TLS_TLS | TLS_LD) && !eh->elf.def_dynamic) - /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */ - eh->elf.got.offset = (bfd_vma) -1; + { + /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */ + htab->tlsld_got.refcount += 1; + eh->elf.got.offset = (bfd_vma) -1; + } else { bfd_boolean dyn; @@ -4664,7 +4800,7 @@ allocate_dynrelocs (struct elf_link_hash if (info->shared) { /* Relocs that use pc_count are those that appear on a call insn, - or certain REL relocs (see MUST_BE_DYN_RELOC) that can be + or certain REL relocs (see must_be_dyn_reloc) that can be generated via assembly. We want calls to protected symbols to resolve directly to the function rather than going via the plt. If people want function pointer comparisons to work as expected @@ -4891,6 +5027,9 @@ ppc_elf_size_dynamic_sections (bfd *outp *local_got = (bfd_vma) -1; } + /* Allocate space for global sym dynamic relocs. */ + elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info); + if (htab->tlsld_got.refcount > 0) { htab->tlsld_got.offset = allocate_got (htab, 8); @@ -4900,9 +5039,6 @@ ppc_elf_size_dynamic_sections (bfd *outp else htab->tlsld_got.offset = (bfd_vma) -1; - /* Allocate space for global sym dynamic relocs. */ - elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info); - if (htab->got != NULL && htab->plt_type != PLT_VXWORKS) { unsigned int g_o_t = 32768; @@ -5754,16 +5890,13 @@ ppc_elf_relocate_section (bfd *output_bf for the final instruction stream. */ tls_mask = 0; tls_gd = 0; - if (IS_PPC_TLS_RELOC (r_type)) - { - if (h != NULL) - tls_mask = ((struct ppc_elf_link_hash_entry *) h)->tls_mask; - else if (local_got_offsets != NULL) - { - char *lgot_masks; - lgot_masks = (char *) (local_got_offsets + symtab_hdr->sh_info); - tls_mask = lgot_masks[r_symndx]; - } + if (h != NULL) + tls_mask = ((struct ppc_elf_link_hash_entry *) h)->tls_mask; + else if (local_got_offsets != NULL) + { + char *lgot_masks; + lgot_masks = (char *) (local_got_offsets + symtab_hdr->sh_info); + tls_mask = lgot_masks[r_symndx]; } /* Ensure reloc mapping code below stays sane. */ @@ -5870,85 +6003,147 @@ ppc_elf_relocate_section (bfd *output_bf case R_PPC_GOT_TLSGD16_LO: tls_gd = TLS_TPRELGD; if (tls_mask != 0 && (tls_mask & TLS_GD) == 0) - goto tls_get_addr_check; + goto tls_ldgd_opt; break; case R_PPC_GOT_TLSLD16: case R_PPC_GOT_TLSLD16_LO: if (tls_mask != 0 && (tls_mask & TLS_LD) == 0) { - tls_get_addr_check: - if (rel + 1 < relend) - { - enum elf_ppc_reloc_type r_type2; - unsigned long r_symndx2; - struct elf_link_hash_entry *h2; - bfd_vma insn1, insn2; - bfd_vma offset; - - /* The next instruction should be a call to - __tls_get_addr. Peek at the reloc to be sure. */ - r_type2 = ELF32_R_TYPE (rel[1].r_info); - r_symndx2 = ELF32_R_SYM (rel[1].r_info); - if (r_symndx2 < symtab_hdr->sh_info - || (r_type2 != R_PPC_REL14 - && r_type2 != R_PPC_REL14_BRTAKEN - && r_type2 != R_PPC_REL14_BRNTAKEN - && r_type2 != R_PPC_REL24 - && r_type2 != R_PPC_PLTREL24)) - break; + unsigned int insn1, insn2; + bfd_vma offset; - h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info]; - while (h2->root.type == bfd_link_hash_indirect - || h2->root.type == bfd_link_hash_warning) - h2 = (struct elf_link_hash_entry *) h2->root.u.i.link; - if (h2 == NULL || h2 != htab->tls_get_addr) - break; - - /* OK, it checks out. Replace the call. */ - offset = rel[1].r_offset; + tls_ldgd_opt: + offset = (bfd_vma) -1; + /* If not using the newer R_PPC_TLSGD/LD to mark + __tls_get_addr calls, we must trust that the call + stays with its arg setup insns, ie. that the next + reloc is the __tls_get_addr call associated with + the current reloc. Edit both insns. */ + if (input_section->has_tls_get_addr_call + && rel + 1 < relend + && branch_reloc_hash_match (input_bfd, rel + 1, + htab->tls_get_addr)) + offset = rel[1].r_offset; + if ((tls_mask & tls_gd) != 0) + { + /* IE */ insn1 = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset); - if ((tls_mask & tls_gd) != 0) + insn1 &= (1 << 26) - 1; + insn1 |= 32 << 26; /* lwz */ + if (offset != (bfd_vma) -1) { - /* IE */ - insn1 &= (1 << 26) - 1; - insn1 |= 32 << 26; /* lwz */ + rel[1].r_info + = ELF32_R_INFO (ELF32_R_SYM (rel[1].r_info), + R_PPC_NONE); insn2 = 0x7c631214; /* add 3,3,2 */ - rel[1].r_info = ELF32_R_INFO (r_symndx2, R_PPC_NONE); - rel[1].r_addend = 0; - r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3) - + R_PPC_GOT_TPREL16); - rel->r_info = ELF32_R_INFO (r_symndx, r_type); + bfd_put_32 (output_bfd, insn2, contents + offset); } - else + r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3) + + R_PPC_GOT_TPREL16); + rel->r_info = ELF32_R_INFO (r_symndx, r_type); + } + else + { + /* LE */ + insn1 = 0x3c620000; /* addis 3,2,0 */ + if (tls_gd == 0) { - /* LE */ - insn1 = 0x3c620000; /* addis 3,2,0 */ - insn2 = 0x38630000; /* addi 3,3,0 */ - if (tls_gd == 0) - { - /* Was an LD reloc. */ - r_symndx = 0; - rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; - } - r_type = R_PPC_TPREL16_HA; - rel->r_info = ELF32_R_INFO (r_symndx, r_type); - rel[1].r_info = ELF32_R_INFO (r_symndx, - R_PPC_TPREL16_LO); - rel[1].r_offset += d_offset; - rel[1].r_addend = rel->r_addend; + /* Was an LD reloc. */ + for (r_symndx = 0; + r_symndx < symtab_hdr->sh_info; + r_symndx++) + if (local_sections[r_symndx] == sec) + break; + if (r_symndx >= symtab_hdr->sh_info) + r_symndx = 0; + rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; + if (r_symndx != 0) + rel->r_addend -= (local_syms[r_symndx].st_value + + sec->output_offset + + sec->output_section->vma); } - bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - d_offset); - bfd_put_32 (output_bfd, insn2, contents + offset); - if (tls_gd == 0) + r_type = R_PPC_TPREL16_HA; + rel->r_info = ELF32_R_INFO (r_symndx, r_type); + if (offset != (bfd_vma) -1) { - /* We changed the symbol on an LD reloc. Start over - in order to get h, sym, sec etc. right. */ - rel--; - continue; + rel[1].r_info = ELF32_R_INFO (r_symndx, R_PPC_TPREL16_LO); + rel[1].r_offset = offset + d_offset; + rel[1].r_addend = rel->r_addend; + insn2 = 0x38630000; /* addi 3,3,0 */ + bfd_put_32 (output_bfd, insn2, contents + offset); } } + bfd_put_32 (output_bfd, insn1, + contents + rel->r_offset - d_offset); + if (tls_gd == 0) + { + /* We changed the symbol on an LD reloc. Start over + in order to get h, sym, sec etc. right. */ + rel--; + continue; + } + } + break; + + case R_PPC_TLSGD: + if (tls_mask != 0 && (tls_mask & TLS_GD) == 0) + { + unsigned int insn2; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 04:10:54 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C57BF20D; Fri, 12 Dec 2014 04:10:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE1668B6; Fri, 12 Dec 2014 04:10:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC4AsvM080014; Fri, 12 Dec 2014 04:10:54 GMT (envelope-from gshapiro@FreeBSD.org) Received: (from gshapiro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC4AoXA079991; Fri, 12 Dec 2014 04:10:50 GMT (envelope-from gshapiro@FreeBSD.org) Message-Id: <201412120410.sBC4AoXA079991@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gshapiro set sender to gshapiro@FreeBSD.org using -f From: Gregory Neil Shapiro Date: Fri, 12 Dec 2014 04:10:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r275719 - in vendor/sendmail/dist: . cf cf/cf cf/feature cf/hack cf/m4 contrib devtools/bin doc/op editmap include/sendmail include/sm libmilter libsm libsmdb src X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 04:10:54 -0000 Author: gshapiro Date: Fri Dec 12 04:10:50 2014 New Revision: 275719 URL: https://svnweb.freebsd.org/changeset/base/275719 Log: Import sendmail 8.15.1 Added: vendor/sendmail/dist/cf/feature/bcc.m4 (contents, props changed) vendor/sendmail/dist/cf/feature/nopercenthack.m4 (contents, props changed) vendor/sendmail/dist/cf/feature/prefixmod.m4 (contents, props changed) vendor/sendmail/dist/cf/hack/xconnect.m4 (contents, props changed) vendor/sendmail/dist/contrib/AuthRealm.p0 (contents, props changed) Deleted: vendor/sendmail/dist/libsm/path.c Modified: vendor/sendmail/dist/FAQ vendor/sendmail/dist/INSTALL vendor/sendmail/dist/KNOWNBUGS vendor/sendmail/dist/README vendor/sendmail/dist/RELEASE_NOTES vendor/sendmail/dist/cf/README vendor/sendmail/dist/cf/cf/generic-bsd4.4.cf vendor/sendmail/dist/cf/cf/generic-hpux10.cf vendor/sendmail/dist/cf/cf/generic-hpux9.cf vendor/sendmail/dist/cf/cf/generic-linux.cf vendor/sendmail/dist/cf/cf/generic-mpeix.cf vendor/sendmail/dist/cf/cf/generic-nextstep3.3.cf vendor/sendmail/dist/cf/cf/generic-osf1.cf vendor/sendmail/dist/cf/cf/generic-solaris.cf vendor/sendmail/dist/cf/cf/generic-sunos4.1.cf vendor/sendmail/dist/cf/cf/generic-ultrix4.cf vendor/sendmail/dist/cf/cf/submit.cf vendor/sendmail/dist/cf/feature/ldap_routing.m4 vendor/sendmail/dist/cf/m4/proto.m4 vendor/sendmail/dist/cf/m4/version.m4 vendor/sendmail/dist/devtools/bin/Build vendor/sendmail/dist/doc/op/op.me vendor/sendmail/dist/doc/op/op.ps vendor/sendmail/dist/editmap/editmap.c vendor/sendmail/dist/include/sendmail/sendmail.h vendor/sendmail/dist/include/sm/bdb.h vendor/sendmail/dist/include/sm/cdefs.h vendor/sendmail/dist/include/sm/conf.h vendor/sendmail/dist/include/sm/errstring.h vendor/sendmail/dist/include/sm/fdset.h vendor/sendmail/dist/libmilter/engine.c vendor/sendmail/dist/libmilter/handler.c vendor/sendmail/dist/libmilter/listener.c vendor/sendmail/dist/libmilter/signal.c vendor/sendmail/dist/libmilter/worker.c vendor/sendmail/dist/libsm/Makefile.m4 vendor/sendmail/dist/libsm/errstring.c vendor/sendmail/dist/libsm/local.h vendor/sendmail/dist/libsm/mbdb.c vendor/sendmail/dist/libsm/refill.c vendor/sendmail/dist/libsm/stdio.c vendor/sendmail/dist/libsm/vfprintf.c vendor/sendmail/dist/libsmdb/smdb.c vendor/sendmail/dist/src/README vendor/sendmail/dist/src/TRACEFLAGS vendor/sendmail/dist/src/TUNING vendor/sendmail/dist/src/bf.c vendor/sendmail/dist/src/collect.c vendor/sendmail/dist/src/conf.c vendor/sendmail/dist/src/daemon.c vendor/sendmail/dist/src/deliver.c vendor/sendmail/dist/src/envelope.c vendor/sendmail/dist/src/err.c vendor/sendmail/dist/src/headers.c vendor/sendmail/dist/src/main.c vendor/sendmail/dist/src/map.c vendor/sendmail/dist/src/mci.c vendor/sendmail/dist/src/milter.c vendor/sendmail/dist/src/parseaddr.c vendor/sendmail/dist/src/queue.c vendor/sendmail/dist/src/readcf.c vendor/sendmail/dist/src/recipient.c vendor/sendmail/dist/src/savemail.c vendor/sendmail/dist/src/sendmail.0 vendor/sendmail/dist/src/sendmail.8 vendor/sendmail/dist/src/sendmail.h vendor/sendmail/dist/src/sfsasl.c vendor/sendmail/dist/src/sm_resolve.c vendor/sendmail/dist/src/srvrsmtp.c vendor/sendmail/dist/src/tls.c vendor/sendmail/dist/src/usersmtp.c vendor/sendmail/dist/src/util.c vendor/sendmail/dist/src/version.c Modified: vendor/sendmail/dist/FAQ ============================================================================== --- vendor/sendmail/dist/FAQ Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/FAQ Fri Dec 12 04:10:50 2014 (r275719) @@ -1,8 +1,4 @@ The FAQ is no longer maintained with the sendmail release. It is available at http://www.sendmail.org/faq/ . -A plain-text version of the questions only, with URLs referring to -the answers, is posted to comp.mail.sendmail on the 10th and 25th -of each month. - -$Revision: 8.24 $, Last updated $Date: 1999-02-07 03:21:03 $ +$Revision: 8.25 $, Last updated $Date: 2014-01-27 12:49:52 $ Modified: vendor/sendmail/dist/INSTALL ============================================================================== --- vendor/sendmail/dist/INSTALL Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/INSTALL Fri Dec 12 04:10:50 2014 (r275719) @@ -28,8 +28,9 @@ sendmail/SECURITY for more installation /etc/mail/submit.cf. This can be done in the cf/cf by using "sh ./Build install-cf". - Please read sendmail/SECURITY before continuing; you have to create a - new user smmsp and a new group smmsp for the default installation. + Please read sendmail/SECURITY before continuing; you may have to create + a new user smmsp and a new group smmsp for the default installation + if you are updating from a really old version. Then install the sendmail binary built in step 3 by cd-ing back to sendmail/ and running "sh ./Build install". Modified: vendor/sendmail/dist/KNOWNBUGS ============================================================================== --- vendor/sendmail/dist/KNOWNBUGS Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/KNOWNBUGS Fri Dec 12 04:10:50 2014 (r275719) @@ -62,9 +62,9 @@ This list is not guaranteed to be comple libmilter and hence the communication fails. This can be avoided by increasing the constant MILTER_CHUNK_SIZE in include/libmilter/mfdef.h and recompiling sendmail, libmilter, and - all (statically linked) milters (or by using an undocumented compile - time option: _FFR_MAXDATASIZE; you have to read the source code in - order to use this properly). + all (statically linked) milters (or by using undocumented compile + time options: _FFR_MAXDATASIZE/_FFR_MDS_NEGOTIATE; you have to + read the source code in order to use these properly). * Sender addresses whose domain part cause a temporary A record lookup failure but have a valid MX record will be temporarily rejected in @@ -102,6 +102,11 @@ Kresolve sequence dnsmx canon Header addresses that have the \231 character (and possibly others in the range \201 - \237) behave in odd and usually unexpected ways. +* AuthRealm for Cyrus SASL may not work as expected. The man page + and the actual usage for sasl_server_new() seem to differ. + Feedback for the "correct" usage is welcome, a patch to match + the description of the man page is in contrib/AuthRealm.p0. + * accept() problem on SVR4. Apparently, the sendmail daemon loop (doing accept()s on the network) @@ -252,7 +257,7 @@ Kresolve sequence dnsmx canon * Race condition for delivery to set-user-ID files - Sendmail will deliver to a fail if the file is owned by the DefaultUser + Sendmail will deliver to a file if the file is owned by the DefaultUser or has the set-user-ID bit set. Unfortunately, some systems clear that bit when a file is modified. Sendmail compensates by resetting the file mode back to it's original settings. Unfortunately, there's still a Modified: vendor/sendmail/dist/README ============================================================================== --- vendor/sendmail/dist/README Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/README Fri Dec 12 04:10:50 2014 (r275719) @@ -211,29 +211,11 @@ There are other files you should read. +--------------+ There are several related RFCs that you may wish to read -- they are -available via anonymous FTP to several sites. For a list of the -primary repositories see: - - http://www.isi.edu/in-notes/rfc-retrieval.txt - -They are also online at: +available from several sites, see + http://www.rfc-editor.org/ http://www.ietf.org/ -They can also be retrieved via electronic mail by sending -email to one of: - - mail-server@nisc.sri.com - Put "send rfcNNN" in message body - nis-info@nis.nsf.net - Put "send RFCnnn.TXT-1" in message body - sendrfc@jvnc.net - Put "RFCnnn" as Subject: line - -For further instructions see: - - http://www.isi.edu/in-notes/rfc-editor/rfc-info - Important RFCs for electronic mail are: RFC821 SMTP protocol Modified: vendor/sendmail/dist/RELEASE_NOTES ============================================================================== --- vendor/sendmail/dist/RELEASE_NOTES Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/RELEASE_NOTES Fri Dec 12 04:10:50 2014 (r275719) @@ -5,6 +5,124 @@ This listing shows the version of the se of the sendmail configuration files, the date of release, and a summary of the changes in that release. +8.15.1/8.15.1 2014/12/06 + SECURITY: Properly set the close-on-exec flag for file descriptors + (except stdin, stdout, and stderr) before executing mailers. + If header rewriting fails due to a temporary map lookup failure, + queue the mail for later retry instead of sending it + without rewriting the header. Note: this is done + while the mail is being sent and hence the transaction + is aborted, which only works for SMTP/LMTP mailers + hence the handling of temporary map failures is + suppressed for other mailers. SMTP/LMTP servers may + complain about aborted transactions when this problem + occurs. + See also "DNS Lookups" in sendmail/TUNING. + Incompatible Change: Use uncompressed IPv6 addresses by default, + i.e., they will not contain "::". For example, + instead of ::1 it will be 0:0:0:0:0:0:0:1. This + permits a zero subnet to have a more specific match, + such as different map entries for IPv6:0:0 vs IPv6:0. + This change requires that configuration data + (including maps, files, classes, custom ruleset, + etc) must use the same format, so make certain such + configuration data is updated before using 8.15. + As a very simple check search for patterns like + 'IPv6:[0-9a-fA-F:]*::' and 'IPv6::'. If necessary, + the prior format can be retained by compiling with: + APPENDDEF(`conf_sendmail_ENVDEF', `-DIPV6_FULL=0') + in your devtools/Site/site.config.m4 file. + If debugging is turned on (-d0.14) also print the OpenSSL + versions, both build time and run time + (provided STARTTLS is compiled in). + If a connection to the MTA is dropped by the client before its + hostname can be validated, treat it as "may be forged", + so that the unvalidated hostname is not passed to a + milter in xxfi_connect(). + Add a timeout for communication with socket map servers + which can be specified using the -d option. + Add a compile time option HESIOD_ALLOW_NUMERIC_LOGIN to allow + numeric logins even if HESIOD is enabled. + The new option CertFingerprintAlgorithm specifies the finger- + print algorithm (digest) to use for the presented cert. + If the option is not set, md5 is used and the macro + {cert_md5} contains the cert fingerprint. + However, if the option is set, the specified algorithm + (e.g., sha1) is used and the macro {cert_fp} contains + the cert fingerprint. + That is, as long as the option is not set, the behaviour + does not change, but otherwise, {cert_md5} is superseded + by {cert_fp} even if you set CertFingerprintAlgorithm + to md5. + The options ServerSSLOptions and ClientSSLOptions can be used + to set SSL options for the server and client side + respectively. See SSL_CTX_set_options(3) for a list. + Note: this change turns on SSL_OP_NO_SSLv2 and + SSL_OP_NO_TICKET for the client. See doc/op/op.me + for details. + The option CipherList sets the list of ciphers for STARTTLS. + See ciphers(1) for possible values. + Do not log "STARTTLS: internal error: tls_verify_cb: ssl == NULL" + if a CRLFfile is in use (and LogLevel is 14 or higher.) + Store a more specific TLS protocol version in ${tls_version} + instead of a generic one, e.g., TLSv1 instead of + TLSv1/SSLv3. + Properly set {client_port} value on little endian machines. + Patch from Kelsey Cummings of Sonic.net. + Per RFC 3848, indicate in the Received: header whether SSL or + SMTP AUTH was negotiated by setting the protocol clause + to ESMTPS, ESMTPA, or ESMTPSA instead of ESMTP. + If the 'C' flag is listed as TLSSrvOptions the requirement for the + TLS server to have a cert is removed. This only works + under very specific circumstances and should only be used + if the consequences are understood, e.g., clients + may not work with a server using this. + The options ClientCertFile, ClientKeyFile, ServerCertFile, and + ServerKeyFile can take a second file name, which must be + separated from the first with a comma (note: do not use + any spaces) to set up a second cert/key pair. This can + be used to have certs of different types, e.g., RSA + and DSA. + A new map type "arpa" is available to reverse an IP (IPv4 or IPv6) + address. It returns the string for the PTR lookup, but + without trailing {ip6,in-addr}.arpa. + New operation mode 'C' just checks the configuration file, e.g., + sendmail -C new.cf -bC + will perform a basic syntax/consistency check of new.cf. + The mailer flag 'I' is deprecated and will be removed in a + future version. + Allow local (not just TCP) socket connections to the server, e.g., + O DaemonPortOptions=Family=local, Addr=/var/mta/server.sock + can be used. + If the new option MaxQueueAge is set to a value greater than zero, + entries in the queue will be retried during a queue run + only if the individual retry time has been reached which + is doubled for each attempt. The maximum retry time is + limited by the specified value. + New DontBlameSendmail option GroupReadableDefaultAuthInfoFile + to relax requirement for DefaultAuthInfo file. + Reset timeout after receiving a message to appropriate value if + STARTTLS is in use. Based on patch by Kelsey Cummings + of Sonic.net. + Report correct error messages from the LDAP library for a range of + small negative return values covering those used by OpenLDAP. + Fix compilation with Berkeley DB 5.0 and 6.0. Patch from + Allan E Johannesen of Worcester Polytechnic Institute. + CONFIG: FEATURE(`nopercenthack') takes one parameter: reject or + nospecial which describes whether to disallow "%" in the + local part of an address. + DEVTOOLS: Fix regression in auto-detection of libraries when only + shared libraries are available. Problem reported by + Bryan Costales. + LIBMILTER: Mark communication socket as close-on-exec in case + a user's filter starts other applications. + Based on patch from Paul Howarth. + Portability: + SunOS 5.12 has changed the API for sigwait(2) to conform + with XPG7. Based on patch from Roger Faulkner of Oracle. + Deleted Files: + libsm/path.c + 8.14.9/8.14.9 2014/05/21 SECURITY: Properly set the close-on-exec flag for file descriptors (except stdin, stdout, and stderr) before executing mailers. @@ -681,7 +799,7 @@ summary of the changes in that release. LIBMILTER: The "hostname" argument of the xxfi_connect() callback previously was the equivalent of {client_ptr}. However, this did not match the documentation of the function, hence - it has been changed to {client_name}. See doc/op/op.* + it has been changed to {client_name}. See doc/op/op.me about these macros. 8.13.7/8.13.7 2006/06/14 @@ -3509,11 +3627,11 @@ summary of the changes in that release. Add new STARTTLS related options CACERTPath, CACERTFile, ClientCertFile, ClientKeyFile, DHParameters, RandFile, ServerCertFile, and ServerKeyFile. These are documented in - cf/README and doc/op/op.*. + cf/README and doc/op/op.me. New STARTTLS related macros: ${cert_issuer}, ${cert_subject}, ${tls_version}, ${cipher}, ${cipher_bits}, ${verify}, ${server_name}, and ${server_addr}. These are documented - in cf/README and doc/op/op.*. + in cf/README and doc/op/op.me. Add support for the Entropy Gathering Daemon (EGD) for better random data. New DontBlameSendmail option InsufficientEntropy for systems which Modified: vendor/sendmail/dist/cf/README ============================================================================== --- vendor/sendmail/dist/cf/README Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/cf/README Fri Dec 12 04:10:50 2014 (r275719) @@ -397,6 +397,10 @@ SMTP_MAILER_CHARSET [undefined] If defin that ARRIVE from an address that resolves to one of the SMTP mailers and which are converted to MIME will be labeled with this character set. +RELAY_MAILER_CHARSET [undefined] If defined, messages containing 8-bit data + that ARRIVE from an address that resolves to the + relay mailers and which are converted to MIME will + be labeled with this character set. SMTP_MAILER_LL [990] The maximum line length for SMTP mailers (except the relay mailer). RELAY_MAILER_LL [2040] The maximum line length for the relay mailer. @@ -743,6 +747,16 @@ nouucp Don't route UUCP addresses. Thi 2. don't remove "!" from OperatorChars if `reject' is given as parameter. +nopercenthack Don't treat % as routing character. This feature takes one + parameter: + `reject': reject addresses which have % in the local + part unless it originates from a system + that is allowed to relay. + `nospecial': don't do anything special with %. + Warnings: 1. See the notice in the anti-spam section. + 2. Don't remove % from OperatorChars if `reject' is + given as parameter. + nocanonify Don't pass addresses to $[ ... $] for canonification by default, i.e., host/domain names are considered canonical, except for unqualified names, which must not be used in this @@ -2442,17 +2456,19 @@ should only be used for sites which have that they provide a gateway for. Use this FEATURE with caution as it can allow spammers to relay through your server if not setup properly. -NOTICE: It is possible to relay mail through a system which the anti-relay -rules do not prevent: the case of a system that does use FEATURE(`nouucp', -`nospecial') (system A) and relays local messages to a mail hub (e.g., via -LOCAL_RELAY or LUSER_RELAY) (system B). If system B doesn't use -FEATURE(`nouucp') at all, addresses of the form - would be relayed to . -System A doesn't recognize `!' as an address separator and therefore -forwards it to the mail hub which in turns relays it because it came from -a trusted local host. So if a mailserver allows UUCP (bang-format) -addresses, all systems from which it allows relaying should do the same -or reject those addresses. +NOTICE: It is possible to relay mail through a system which the +anti-relay rules do not prevent: the case of a system that does use +FEATURE(`nouucp', `nospecial') / FEATURE(`nopercenthack', `nospecial') +(system A) and relays local messages to a mail hub (e.g., via +LOCAL_RELAY or LUSER_RELAY) (system B). If system B doesn't use the +same feature (nouucp / nopercenthack) at all, addresses of the form + / +would be relayed to . +System A doesn't recognize `!' / `%' as an address separator and +therefore forwards it to the mail hub which in turns relays it +because it came from a trusted local host. So if a mailserver +allows UUCP (bang-format) / %-hack addresses, all systems from which +it allows relaying should do the same or reject those addresses. As of 8.9, sendmail will refuse mail if the MAIL FROM: parameter has an unresolvable domain (i.e., one that DNS, your local name service, @@ -3990,6 +4006,13 @@ confWORK_TIME_FACTOR RetryFactor [90000] confQUEUE_SORT_ORDER QueueSortOrder [Priority] Queue sort algorithm: Priority, Host, Filename, Random, Modification, or Time. +confMAX_QUEUE_AGE MaxQueueAge [undefined] If set to a value greater + than zero, entries in the queue + will be retried during a queue run + only if the individual retry time + has been reached which is doubled + for each attempt. The maximum retry + time is limited by the specified value. confMIN_QUEUE_AGE MinQueueAge [0] The minimum amount of time a job must sit in the queue between queue runs. This allows you to set the @@ -4208,7 +4231,7 @@ confAUTH_MECHANISMS AuthMechanisms [GSSA confAUTH_REALM AuthRealm [undefined] The authentication realm that is passed to the Cyrus SASL library. If no realm is specified, - $j is used. + $j is used. See KNOWNBUGS. confDEF_AUTH_INFO DefaultAuthInfo [undefined] Name of file that contains authentication information for outgoing connections. This file must @@ -4241,6 +4264,14 @@ confTLS_SRV_OPTIONS TLSSrvOptions If thi verification is performed, i.e., the server doesn't ask for a certificate. +confSERVER_SSL_OPTIONS ServerSSLOptions [undefined] SSL related + options for server side. See + SSL_CTX_set_options(3) for a list. +confCLIENT_SSL_OPTIONS ClientSSLOptions [undefined] SSL related + options for client side. See + SSL_CTX_set_options(3) for a list. +confCIPHER_LIST CipherList [undefined] Cipher list for TLS. + See ciphers(1) for possible values. confLDAP_DEFAULT_SPEC LDAPDefaultSpec [undefined] Default map specification for LDAP maps. The value should only contain LDAP @@ -4281,6 +4312,10 @@ confRAND_FILE RandFile [undefined] File requires this option if the compile flag HASURANDOM is not set (see sendmail/README). +confCERT_FINGERPRINT_ALGORITHM CertFingerprintAlgorithm + [undefined] The fingerprint algorithm + (digest) to use for the presented + cert. confNICE_QUEUE_RUN NiceQueueRun [undefined] If set, the priority of queue runners is set the given value (nice(3)). Modified: vendor/sendmail/dist/cf/cf/generic-bsd4.4.cf ============================================================================== --- vendor/sendmail/dist/cf/cf/generic-bsd4.4.cf Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/cf/cf/generic-bsd4.4.cf Fri Dec 12 04:10:50 2014 (r275719) @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@lab.smi.sendmail.com on Tue May 20 12:12:51 PDT 2014 -##### in /home/ca/sm8.git/sendmail/OpenSource/sendmail-8.14.9/cf/cf +##### built by ca@sandman.dev-lab.sendmail.com on Tue Dec 2 16:21:20 PST 2014 +##### in /x/ca/sm8.git/sendmail/OpenSource/sendmail-8.15.1/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -122,7 +122,7 @@ DnMAILER-DAEMON CPREDIRECT # Configuration version number -DZ8.14.9 +DZ8.15.1 ############### @@ -259,6 +259,9 @@ O PrivacyOptions=authwarnings # minimum time in queue before retry #O MinQueueAge=30m +# maximum time in queue before retry (if > 0; only for exponential delay) +#O MaxQueueAge + # how many jobs can you process in the queue? #O MaxQueueRunSize=0 @@ -509,6 +512,12 @@ O MaxHeadersLength=32768 # SMTP STARTTLS server options #O TLSSrvOptions +# SSL cipherlist +#O CipherList +# server side SSL options +#O ServerSSLOptions +# client side SSL options +#O ClientSSLOptions # Input mail filters #O InputMailFilters @@ -532,6 +541,8 @@ O MaxHeadersLength=32768 #O DHParameters # Random data source (required for systems without /dev/urandom under OpenSSL) #O RandFile +# fingerprint algorithm (digest) to use for the presented cert +#O CertFingerprintAlgorithm # Maximum number of "useless" commands before slowing down #O MaxNOOPCommands=20 @@ -539,6 +550,8 @@ O MaxHeadersLength=32768 # Name to use for EHLO (defaults to $j) #O HeloName + + ############################ # QUEUE GROUP DEFINITIONS # ############################ @@ -651,6 +664,7 @@ R$* % $* $1 @ $2 First make them all R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish + # else we must be a local name R$* $@ $>Canonify2 $1 @@ -783,6 +797,7 @@ R$* $=O $* < @ *LOCAL* > $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ... R$* < @ *LOCAL* > $: $1 + # # Parse1 -- the bottom half of ruleset 0. # @@ -820,6 +835,8 @@ R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ R$=L $#local $: @ $1 special local names R$+ $#local $: $1 regular local names + + ########################################################################### ### Ruleset 5 -- special rewriting after aliases have been expanded ### ########################################################################### Modified: vendor/sendmail/dist/cf/cf/generic-hpux10.cf ============================================================================== --- vendor/sendmail/dist/cf/cf/generic-hpux10.cf Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/cf/cf/generic-hpux10.cf Fri Dec 12 04:10:50 2014 (r275719) @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@lab.smi.sendmail.com on Tue May 20 12:12:51 PDT 2014 -##### in /home/ca/sm8.git/sendmail/OpenSource/sendmail-8.14.9/cf/cf +##### built by ca@sandman.dev-lab.sendmail.com on Tue Dec 2 16:21:20 PST 2014 +##### in /x/ca/sm8.git/sendmail/OpenSource/sendmail-8.15.1/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -123,7 +123,7 @@ DnMAILER-DAEMON CPREDIRECT # Configuration version number -DZ8.14.9 +DZ8.15.1 ############### @@ -260,6 +260,9 @@ O PrivacyOptions=authwarnings # minimum time in queue before retry #O MinQueueAge=30m +# maximum time in queue before retry (if > 0; only for exponential delay) +#O MaxQueueAge + # how many jobs can you process in the queue? #O MaxQueueRunSize=0 @@ -510,6 +513,12 @@ O MaxHeadersLength=32768 # SMTP STARTTLS server options #O TLSSrvOptions +# SSL cipherlist +#O CipherList +# server side SSL options +#O ServerSSLOptions +# client side SSL options +#O ClientSSLOptions # Input mail filters #O InputMailFilters @@ -533,6 +542,8 @@ O MaxHeadersLength=32768 #O DHParameters # Random data source (required for systems without /dev/urandom under OpenSSL) #O RandFile +# fingerprint algorithm (digest) to use for the presented cert +#O CertFingerprintAlgorithm # Maximum number of "useless" commands before slowing down #O MaxNOOPCommands=20 @@ -540,6 +551,8 @@ O MaxHeadersLength=32768 # Name to use for EHLO (defaults to $j) #O HeloName + + ############################ # QUEUE GROUP DEFINITIONS # ############################ @@ -652,6 +665,7 @@ R$* % $* $1 @ $2 First make them all R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish + # else we must be a local name R$* $@ $>Canonify2 $1 @@ -784,6 +798,7 @@ R$* $=O $* < @ *LOCAL* > $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ... R$* < @ *LOCAL* > $: $1 + # # Parse1 -- the bottom half of ruleset 0. # @@ -821,6 +836,8 @@ R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ R$=L $#local $: @ $1 special local names R$+ $#local $: $1 regular local names + + ########################################################################### ### Ruleset 5 -- special rewriting after aliases have been expanded ### ########################################################################### Modified: vendor/sendmail/dist/cf/cf/generic-hpux9.cf ============================================================================== --- vendor/sendmail/dist/cf/cf/generic-hpux9.cf Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/cf/cf/generic-hpux9.cf Fri Dec 12 04:10:50 2014 (r275719) @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@lab.smi.sendmail.com on Tue May 20 12:12:51 PDT 2014 -##### in /home/ca/sm8.git/sendmail/OpenSource/sendmail-8.14.9/cf/cf +##### built by ca@sandman.dev-lab.sendmail.com on Tue Dec 2 16:21:20 PST 2014 +##### in /x/ca/sm8.git/sendmail/OpenSource/sendmail-8.15.1/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -123,7 +123,7 @@ DnMAILER-DAEMON CPREDIRECT # Configuration version number -DZ8.14.9 +DZ8.15.1 ############### @@ -260,6 +260,9 @@ O PrivacyOptions=authwarnings # minimum time in queue before retry #O MinQueueAge=30m +# maximum time in queue before retry (if > 0; only for exponential delay) +#O MaxQueueAge + # how many jobs can you process in the queue? #O MaxQueueRunSize=0 @@ -510,6 +513,12 @@ O MaxHeadersLength=32768 # SMTP STARTTLS server options #O TLSSrvOptions +# SSL cipherlist +#O CipherList +# server side SSL options +#O ServerSSLOptions +# client side SSL options +#O ClientSSLOptions # Input mail filters #O InputMailFilters @@ -533,6 +542,8 @@ O MaxHeadersLength=32768 #O DHParameters # Random data source (required for systems without /dev/urandom under OpenSSL) #O RandFile +# fingerprint algorithm (digest) to use for the presented cert +#O CertFingerprintAlgorithm # Maximum number of "useless" commands before slowing down #O MaxNOOPCommands=20 @@ -540,6 +551,8 @@ O MaxHeadersLength=32768 # Name to use for EHLO (defaults to $j) #O HeloName + + ############################ # QUEUE GROUP DEFINITIONS # ############################ @@ -652,6 +665,7 @@ R$* % $* $1 @ $2 First make them all R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish + # else we must be a local name R$* $@ $>Canonify2 $1 @@ -784,6 +798,7 @@ R$* $=O $* < @ *LOCAL* > $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ... R$* < @ *LOCAL* > $: $1 + # # Parse1 -- the bottom half of ruleset 0. # @@ -821,6 +836,8 @@ R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ R$=L $#local $: @ $1 special local names R$+ $#local $: $1 regular local names + + ########################################################################### ### Ruleset 5 -- special rewriting after aliases have been expanded ### ########################################################################### Modified: vendor/sendmail/dist/cf/cf/generic-linux.cf ============================================================================== --- vendor/sendmail/dist/cf/cf/generic-linux.cf Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/cf/cf/generic-linux.cf Fri Dec 12 04:10:50 2014 (r275719) @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@lab.smi.sendmail.com on Tue May 20 12:12:51 PDT 2014 -##### in /home/ca/sm8.git/sendmail/OpenSource/sendmail-8.14.9/cf/cf +##### built by ca@sandman.dev-lab.sendmail.com on Tue Dec 2 16:21:20 PST 2014 +##### in /x/ca/sm8.git/sendmail/OpenSource/sendmail-8.15.1/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -127,7 +127,7 @@ DnMAILER-DAEMON CPREDIRECT # Configuration version number -DZ8.14.9 +DZ8.15.1 ############### @@ -264,6 +264,9 @@ O PrivacyOptions=authwarnings # minimum time in queue before retry #O MinQueueAge=30m +# maximum time in queue before retry (if > 0; only for exponential delay) +#O MaxQueueAge + # how many jobs can you process in the queue? #O MaxQueueRunSize=0 @@ -514,6 +517,12 @@ O MaxHeadersLength=32768 # SMTP STARTTLS server options #O TLSSrvOptions +# SSL cipherlist +#O CipherList +# server side SSL options +#O ServerSSLOptions +# client side SSL options +#O ClientSSLOptions # Input mail filters #O InputMailFilters @@ -537,6 +546,8 @@ O MaxHeadersLength=32768 #O DHParameters # Random data source (required for systems without /dev/urandom under OpenSSL) #O RandFile +# fingerprint algorithm (digest) to use for the presented cert +#O CertFingerprintAlgorithm # Maximum number of "useless" commands before slowing down #O MaxNOOPCommands=20 @@ -544,6 +555,8 @@ O MaxHeadersLength=32768 # Name to use for EHLO (defaults to $j) #O HeloName + + ############################ # QUEUE GROUP DEFINITIONS # ############################ @@ -656,6 +669,7 @@ R$* % $* $1 @ $2 First make them all R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish + # else we must be a local name R$* $@ $>Canonify2 $1 @@ -788,6 +802,7 @@ R$* $=O $* < @ *LOCAL* > $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ... R$* < @ *LOCAL* > $: $1 + # # Parse1 -- the bottom half of ruleset 0. # @@ -825,6 +840,8 @@ R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ R$=L $#local $: @ $1 special local names R$+ $#local $: $1 regular local names + + ########################################################################### ### Ruleset 5 -- special rewriting after aliases have been expanded ### ########################################################################### Modified: vendor/sendmail/dist/cf/cf/generic-mpeix.cf ============================================================================== --- vendor/sendmail/dist/cf/cf/generic-mpeix.cf Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/cf/cf/generic-mpeix.cf Fri Dec 12 04:10:50 2014 (r275719) @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@lab.smi.sendmail.com on Tue May 20 12:12:51 PDT 2014 -##### in /home/ca/sm8.git/sendmail/OpenSource/sendmail-8.14.9/cf/cf +##### built by ca@sandman.dev-lab.sendmail.com on Tue Dec 2 16:21:20 PST 2014 +##### in /x/ca/sm8.git/sendmail/OpenSource/sendmail-8.15.1/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -123,7 +123,7 @@ DnMAILER-DAEMON CPREDIRECT # Configuration version number -DZ8.14.9 +DZ8.15.1 ############### @@ -260,6 +260,9 @@ O PrivacyOptions=authwarnings # minimum time in queue before retry #O MinQueueAge=30m +# maximum time in queue before retry (if > 0; only for exponential delay) +#O MaxQueueAge + # how many jobs can you process in the queue? #O MaxQueueRunSize=0 @@ -510,6 +513,12 @@ O MaxHeadersLength=32768 # SMTP STARTTLS server options #O TLSSrvOptions +# SSL cipherlist +#O CipherList +# server side SSL options +#O ServerSSLOptions +# client side SSL options +#O ClientSSLOptions # Input mail filters #O InputMailFilters @@ -533,6 +542,8 @@ O MaxHeadersLength=32768 #O DHParameters # Random data source (required for systems without /dev/urandom under OpenSSL) #O RandFile +# fingerprint algorithm (digest) to use for the presented cert +#O CertFingerprintAlgorithm # Maximum number of "useless" commands before slowing down #O MaxNOOPCommands=20 @@ -540,6 +551,8 @@ O MaxHeadersLength=32768 # Name to use for EHLO (defaults to $j) #O HeloName + + ############################ # QUEUE GROUP DEFINITIONS # ############################ @@ -652,6 +665,7 @@ R$* % $* $1 @ $2 First make them all R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish + # else we must be a local name R$* $@ $>Canonify2 $1 @@ -784,6 +798,7 @@ R$* $=O $* < @ *LOCAL* > $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ... R$* < @ *LOCAL* > $: $1 + # # Parse1 -- the bottom half of ruleset 0. # @@ -821,6 +836,8 @@ R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ R$=L $#local $: @ $1 special local names R$+ $#local $: $1 regular local names + + ########################################################################### ### Ruleset 5 -- special rewriting after aliases have been expanded ### ########################################################################### Modified: vendor/sendmail/dist/cf/cf/generic-nextstep3.3.cf ============================================================================== --- vendor/sendmail/dist/cf/cf/generic-nextstep3.3.cf Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/cf/cf/generic-nextstep3.3.cf Fri Dec 12 04:10:50 2014 (r275719) @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@lab.smi.sendmail.com on Tue May 20 12:12:51 PDT 2014 -##### in /home/ca/sm8.git/sendmail/OpenSource/sendmail-8.14.9/cf/cf +##### built by ca@sandman.dev-lab.sendmail.com on Tue Dec 2 16:21:20 PST 2014 +##### in /x/ca/sm8.git/sendmail/OpenSource/sendmail-8.15.1/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -122,7 +122,7 @@ DnMAILER-DAEMON CPREDIRECT # Configuration version number -DZ8.14.9 +DZ8.15.1 ############### @@ -259,6 +259,9 @@ O PrivacyOptions=authwarnings # minimum time in queue before retry #O MinQueueAge=30m +# maximum time in queue before retry (if > 0; only for exponential delay) +#O MaxQueueAge + # how many jobs can you process in the queue? #O MaxQueueRunSize=0 @@ -509,6 +512,12 @@ O MaxHeadersLength=32768 # SMTP STARTTLS server options #O TLSSrvOptions +# SSL cipherlist +#O CipherList +# server side SSL options +#O ServerSSLOptions +# client side SSL options +#O ClientSSLOptions # Input mail filters #O InputMailFilters @@ -532,6 +541,8 @@ O MaxHeadersLength=32768 #O DHParameters # Random data source (required for systems without /dev/urandom under OpenSSL) #O RandFile +# fingerprint algorithm (digest) to use for the presented cert +#O CertFingerprintAlgorithm # Maximum number of "useless" commands before slowing down #O MaxNOOPCommands=20 @@ -539,6 +550,8 @@ O MaxHeadersLength=32768 # Name to use for EHLO (defaults to $j) #O HeloName + + ############################ # QUEUE GROUP DEFINITIONS # ############################ @@ -651,6 +664,7 @@ R$* % $* $1 @ $2 First make them all R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish + # else we must be a local name R$* $@ $>Canonify2 $1 @@ -783,6 +797,7 @@ R$* $=O $* < @ *LOCAL* > $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ... R$* < @ *LOCAL* > $: $1 + # # Parse1 -- the bottom half of ruleset 0. # @@ -820,6 +835,8 @@ R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ R$=L $#local $: @ $1 special local names R$+ $#local $: $1 regular local names + + ########################################################################### ### Ruleset 5 -- special rewriting after aliases have been expanded ### ########################################################################### Modified: vendor/sendmail/dist/cf/cf/generic-osf1.cf ============================================================================== --- vendor/sendmail/dist/cf/cf/generic-osf1.cf Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/cf/cf/generic-osf1.cf Fri Dec 12 04:10:50 2014 (r275719) @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@lab.smi.sendmail.com on Tue May 20 12:12:52 PDT 2014 -##### in /home/ca/sm8.git/sendmail/OpenSource/sendmail-8.14.9/cf/cf +##### built by ca@sandman.dev-lab.sendmail.com on Tue Dec 2 16:21:20 PST 2014 +##### in /x/ca/sm8.git/sendmail/OpenSource/sendmail-8.15.1/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -123,7 +123,7 @@ DnMAILER-DAEMON CPREDIRECT # Configuration version number -DZ8.14.9 +DZ8.15.1 ############### @@ -260,6 +260,9 @@ O PrivacyOptions=authwarnings # minimum time in queue before retry #O MinQueueAge=30m +# maximum time in queue before retry (if > 0; only for exponential delay) +#O MaxQueueAge + # how many jobs can you process in the queue? #O MaxQueueRunSize=0 @@ -510,6 +513,12 @@ O MaxHeadersLength=32768 # SMTP STARTTLS server options #O TLSSrvOptions +# SSL cipherlist +#O CipherList +# server side SSL options +#O ServerSSLOptions +# client side SSL options +#O ClientSSLOptions # Input mail filters #O InputMailFilters @@ -533,6 +542,8 @@ O MaxHeadersLength=32768 #O DHParameters # Random data source (required for systems without /dev/urandom under OpenSSL) #O RandFile +# fingerprint algorithm (digest) to use for the presented cert +#O CertFingerprintAlgorithm # Maximum number of "useless" commands before slowing down #O MaxNOOPCommands=20 @@ -540,6 +551,8 @@ O MaxHeadersLength=32768 # Name to use for EHLO (defaults to $j) #O HeloName + + ############################ # QUEUE GROUP DEFINITIONS # ############################ @@ -652,6 +665,7 @@ R$* % $* $1 @ $2 First make them all R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish + # else we must be a local name R$* $@ $>Canonify2 $1 @@ -784,6 +798,7 @@ R$* $=O $* < @ *LOCAL* > $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ... R$* < @ *LOCAL* > $: $1 + # # Parse1 -- the bottom half of ruleset 0. # @@ -821,6 +836,8 @@ R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ R$=L $#local $: @ $1 special local names R$+ $#local $: $1 regular local names + + ########################################################################### ### Ruleset 5 -- special rewriting after aliases have been expanded ### ########################################################################### Modified: vendor/sendmail/dist/cf/cf/generic-solaris.cf ============================================================================== --- vendor/sendmail/dist/cf/cf/generic-solaris.cf Fri Dec 12 03:58:51 2014 (r275718) +++ vendor/sendmail/dist/cf/cf/generic-solaris.cf Fri Dec 12 04:10:50 2014 (r275719) @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@lab.smi.sendmail.com on Tue May 20 12:12:52 PDT 2014 -##### in /home/ca/sm8.git/sendmail/OpenSource/sendmail-8.14.9/cf/cf +##### built by ca@sandman.dev-lab.sendmail.com on Tue Dec 2 16:21:20 PST 2014 +##### in /x/ca/sm8.git/sendmail/OpenSource/sendmail-8.15.1/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -122,7 +122,7 @@ DnMAILER-DAEMON CPREDIRECT # Configuration version number -DZ8.14.9 +DZ8.15.1 ############### @@ -259,6 +259,9 @@ O PrivacyOptions=authwarnings # minimum time in queue before retry #O MinQueueAge=30m +# maximum time in queue before retry (if > 0; only for exponential delay) +#O MaxQueueAge *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 04:12:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 255D634E; Fri, 12 Dec 2014 04:12:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBE0A8C8; Fri, 12 Dec 2014 04:12:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC4CIOS083226; Fri, 12 Dec 2014 04:12:18 GMT (envelope-from gshapiro@FreeBSD.org) Received: (from gshapiro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC4CIjT083225; Fri, 12 Dec 2014 04:12:18 GMT (envelope-from gshapiro@FreeBSD.org) Message-Id: <201412120412.sBC4CIjT083225@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gshapiro set sender to gshapiro@FreeBSD.org using -f From: Gregory Neil Shapiro Date: Fri, 12 Dec 2014 04:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r275720 - vendor/sendmail/8.15.1 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 04:12:19 -0000 Author: gshapiro Date: Fri Dec 12 04:12:18 2014 New Revision: 275720 URL: https://svnweb.freebsd.org/changeset/base/275720 Log: Tag sendmail 8.15.1 Added: vendor/sendmail/8.15.1/ - copied from r275719, vendor/sendmail/dist/ From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 06:13:32 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EF4C3300; Fri, 12 Dec 2014 06:13:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C24583E5; Fri, 12 Dec 2014 06:13:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC6DWAr042055; Fri, 12 Dec 2014 06:13:32 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC6DWeG042053; Fri, 12 Dec 2014 06:13:32 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201412120613.sBC6DWeG042053@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Fri, 12 Dec 2014 06:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275721 - head/usr.bin/mkimg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 06:13:33 -0000 Author: marcel Date: Fri Dec 12 06:13:31 2014 New Revision: 275721 URL: https://svnweb.freebsd.org/changeset/base/275721 Log: The size of the first level reference count table is given in terms of the number of clusters it occupies. It's not the number of entries in the table, as it is for the L1 cluster table. For small images, the two are the same. With the unit tests based on small images, this change has therefore no effect on the unit test. For larger images (like the FreeBSD 10.1-RELEASE image), this gives a discrepancy that actually shows up when running "qemu-img check". Bump the version number of mkimg. While here, fix a white-space bug. MFC after: 1 week Modified: head/usr.bin/mkimg/Makefile head/usr.bin/mkimg/qcow.c Modified: head/usr.bin/mkimg/Makefile ============================================================================== --- head/usr.bin/mkimg/Makefile Fri Dec 12 04:12:18 2014 (r275720) +++ head/usr.bin/mkimg/Makefile Fri Dec 12 06:13:31 2014 (r275721) @@ -6,7 +6,7 @@ PROG= mkimg SRCS= format.c image.c mkimg.c scheme.c MAN= mkimg.1 -MKIMG_VERSION=20141003 +MKIMG_VERSION=20141211 mkimg.o: Makefile CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION} Modified: head/usr.bin/mkimg/qcow.c ============================================================================== --- head/usr.bin/mkimg/qcow.c Fri Dec 12 04:12:18 2014 (r275720) +++ head/usr.bin/mkimg/qcow.c Fri Dec 12 06:13:31 2014 (r275721) @@ -71,7 +71,7 @@ struct qcow_header { uint32_t l1_entries; uint64_t l1_offset; uint64_t refcnt_offset; - uint32_t refcnt_entries; + uint32_t refcnt_clstrs; uint32_t snapshot_count; uint64_t snapshot_offset; } v2; @@ -139,7 +139,7 @@ qcow_write(int fd, u_int version) uint64_t n, imagesz, nclstrs, ofs, ofsflags; lba_t blk, blkofs, blk_imgsz; u_int l1clno, l2clno, rcclno; - u_int blk_clstrsz; + u_int blk_clstrsz, refcnt_clstrs; u_int clstrsz, l1idx, l2idx; int error; @@ -199,14 +199,15 @@ qcow_write(int fd, u_int version) be32enc(&hdr->u.v2.l1_entries, clstr_l2tbls); be64enc(&hdr->u.v2.l1_offset, clstrsz * l1clno); be64enc(&hdr->u.v2.refcnt_offset, clstrsz * rcclno); - be32enc(&hdr->u.v2.refcnt_entries, clstr_rcblks); + refcnt_clstrs = round_clstr(clstr_rcblks * 8) >> clstr_log2sz; + be32enc(&hdr->u.v2.refcnt_clstrs, refcnt_clstrs); break; default: return (EDOOFUS); } if (sparse_write(fd, hdr, clstrsz) < 0) { - error = errno; + error = errno; goto out; } From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 07:41:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4057B13A; Fri, 12 Dec 2014 07:41:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B690DD9; Fri, 12 Dec 2014 07:41:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC7f9Hx083351; Fri, 12 Dec 2014 07:41:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC7f973083350; Fri, 12 Dec 2014 07:41:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201412120741.sBC7f973083350@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 12 Dec 2014 07:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275722 - stable/10/sys/cam/scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 07:41:09 -0000 Author: mav Date: Fri Dec 12 07:41:08 2014 New Revision: 275722 URL: https://svnweb.freebsd.org/changeset/base/275722 Log: MFC r274411: Improve CAM's reaction on asymmetric access errors. Modified: stable/10/sys/cam/scsi/scsi_all.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_all.c Fri Dec 12 06:13:31 2014 (r275721) +++ stable/10/sys/cam/scsi/scsi_all.c Fri Dec 12 07:41:08 2014 (r275722) @@ -1106,13 +1106,13 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ "Logical unit not ready, self-test in progress") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x0A, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x0A, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | ENXIO, "Logical unit not accessible, asymmetric access state transition")}, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x0B, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x0B, SS_FATAL | ENXIO, "Logical unit not accessible, target port in standby state") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x0C, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x0C, SS_FATAL | ENXIO, "Logical unit not accessible, target port in unavailable state") }, /* F */ { SST(0x04, 0x0D, SS_RDEF, /* XXX TBD */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 07:42:07 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D267026A; Fri, 12 Dec 2014 07:42:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDA80E6B; Fri, 12 Dec 2014 07:42:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC7g7BV085882; Fri, 12 Dec 2014 07:42:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC7g76n085881; Fri, 12 Dec 2014 07:42:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201412120742.sBC7g76n085881@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 12 Dec 2014 07:42:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275723 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 07:42:07 -0000 Author: mav Date: Fri Dec 12 07:42:06 2014 New Revision: 275723 URL: https://svnweb.freebsd.org/changeset/base/275723 Log: MFC r274411: Improve CAM's reaction on asymmetric access errors. Modified: stable/9/sys/cam/scsi/scsi_all.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Fri Dec 12 07:41:08 2014 (r275722) +++ stable/9/sys/cam/scsi/scsi_all.c Fri Dec 12 07:42:06 2014 (r275723) @@ -1103,13 +1103,13 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ "Logical unit not ready, self-test in progress") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x0A, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x0A, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | ENXIO, "Logical unit not accessible, asymmetric access state transition")}, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x0B, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x0B, SS_FATAL | ENXIO, "Logical unit not accessible, target port in standby state") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x0C, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x0C, SS_FATAL | ENXIO, "Logical unit not accessible, target port in unavailable state") }, /* F */ { SST(0x04, 0x0D, SS_RDEF, /* XXX TBD */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 07:59:07 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0003456F; Fri, 12 Dec 2014 07:59:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEDABF7F; Fri, 12 Dec 2014 07:59:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC7x6Y2091813; Fri, 12 Dec 2014 07:59:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC7x6FZ091812; Fri, 12 Dec 2014 07:59:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201412120759.sBC7x6FZ091812@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 12 Dec 2014 07:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275724 - stable/10/sys/ofed/include/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 07:59:07 -0000 Author: hselasky Date: Fri Dec 12 07:59:05 2014 New Revision: 275724 URL: https://svnweb.freebsd.org/changeset/base/275724 Log: MFC r275636: Move OFED init a bit earlier so that PXE boot works. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/include/linux/module.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/module.h ============================================================================== --- stable/10/sys/ofed/include/linux/module.h Fri Dec 12 07:42:06 2014 (r275723) +++ stable/10/sys/ofed/include/linux/module.h Fri Dec 12 07:59:05 2014 (r275724) @@ -49,9 +49,9 @@ #define EXPORT_SYMBOL_GPL(name) /* OFED pre-module initialization */ -#define SI_SUB_OFED_PREINIT (SI_SUB_KTHREAD_INIT - 2) +#define SI_SUB_OFED_PREINIT (SI_SUB_ROOT_CONF - 2) /* OFED default module initialization */ -#define SI_SUB_OFED_MODINIT (SI_SUB_KTHREAD_INIT - 1) +#define SI_SUB_OFED_MODINIT (SI_SUB_ROOT_CONF - 1) #include From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 08:00:57 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 874D4783; Fri, 12 Dec 2014 08:00:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 725A48E; Fri, 12 Dec 2014 08:00:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC80vYY093358; Fri, 12 Dec 2014 08:00:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC80vIb093357; Fri, 12 Dec 2014 08:00:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201412120800.sBC80vIb093357@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 12 Dec 2014 08:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275725 - stable/9/sys/ofed/include/linux X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 08:00:57 -0000 Author: hselasky Date: Fri Dec 12 08:00:56 2014 New Revision: 275725 URL: https://svnweb.freebsd.org/changeset/base/275725 Log: MFC r275636: Move OFED init a bit earlier so that PXE boot works. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/linux/module.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/linux/module.h ============================================================================== --- stable/9/sys/ofed/include/linux/module.h Fri Dec 12 07:59:05 2014 (r275724) +++ stable/9/sys/ofed/include/linux/module.h Fri Dec 12 08:00:56 2014 (r275725) @@ -49,9 +49,9 @@ #define EXPORT_SYMBOL_GPL(name) /* OFED pre-module initialization */ -#define SI_SUB_OFED_PREINIT (SI_SUB_KTHREAD_INIT - 2) +#define SI_SUB_OFED_PREINIT (SI_SUB_ROOT_CONF - 2) /* OFED default module initialization */ -#define SI_SUB_OFED_MODINIT (SI_SUB_KTHREAD_INIT - 1) +#define SI_SUB_OFED_MODINIT (SI_SUB_ROOT_CONF - 1) #include From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 09:22:53 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D1055833; Fri, 12 Dec 2014 09:22:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC314AF8; Fri, 12 Dec 2014 09:22:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC9Mrmp035463; Fri, 12 Dec 2014 09:22:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC9MrB7035461; Fri, 12 Dec 2014 09:22:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412120922.sBC9MrB7035461@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Dec 2014 09:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275726 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 09:22:53 -0000 Author: kib Date: Fri Dec 12 09:22:52 2014 New Revision: 275726 URL: https://svnweb.freebsd.org/changeset/base/275726 Log: MFC r275513: When the last reference on the vnode' vm object is dropped, read the vp->v_vflag without taking vnode lock and without bypass. Modified: stable/10/sys/vm/vm_object.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_object.c ============================================================================== --- stable/10/sys/vm/vm_object.c Fri Dec 12 08:00:56 2014 (r275725) +++ stable/10/sys/vm/vm_object.c Fri Dec 12 09:22:52 2014 (r275726) @@ -468,7 +468,12 @@ vm_object_vndeallocate(vm_object_t objec } #endif - if (object->ref_count > 1) { + /* + * The test for text of vp vnode does not need a bypass to + * reach right VV_TEXT there, since it is obtained from + * object->handle. + */ + if (object->ref_count > 1 || (vp->v_vflag & VV_TEXT) == 0) { object->ref_count--; VM_OBJECT_WUNLOCK(object); /* vrele may need the vnode lock. */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 09:37:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5A364BFA; Fri, 12 Dec 2014 09:37:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45FD1C3F; Fri, 12 Dec 2014 09:37:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBC9bJlT041072; Fri, 12 Dec 2014 09:37:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBC9bJdc041071; Fri, 12 Dec 2014 09:37:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412120937.sBC9bJdc041071@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Dec 2014 09:37:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275727 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 09:37:19 -0000 Author: kib Date: Fri Dec 12 09:37:18 2014 New Revision: 275727 URL: https://svnweb.freebsd.org/changeset/base/275727 Log: For architectures where time_t is wide enough, in particular, 64bit platforms, avoid overflow after year 2038 in clock_ct_to_ts(). PR: 195868 Reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/subr_clock.c Modified: head/sys/kern/subr_clock.c ============================================================================== --- head/sys/kern/subr_clock.c Fri Dec 12 09:22:52 2014 (r275726) +++ head/sys/kern/subr_clock.c Fri Dec 12 09:37:18 2014 (r275727) @@ -133,7 +133,6 @@ print_ct(struct clocktime *ct) int clock_ct_to_ts(struct clocktime *ct, struct timespec *ts) { - time_t secs; int i, year, days; year = ct->year; @@ -167,11 +166,10 @@ clock_ct_to_ts(struct clocktime *ct, str days += days_in_month(year, i); days += (ct->day - 1); - /* Add hours, minutes, seconds. */ - secs = ((days * 24 + ct->hour) * 60 + ct->min) * 60 + ct->sec; - - ts->tv_sec = secs; + ts->tv_sec = (((time_t)days * 24 + ct->hour) * 60 + ct->min) * 60 + + ct->sec; ts->tv_nsec = ct->nsec; + if (ct_debug) printf(" = %ld.%09ld\n", (long)ts->tv_sec, (long)ts->tv_nsec); return (0); From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 11:19:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DDBB62DD; Fri, 12 Dec 2014 11:19:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C977B8F5; Fri, 12 Dec 2014 11:19:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBCBJCfB089996; Fri, 12 Dec 2014 11:19:12 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBCBJBVu089985; Fri, 12 Dec 2014 11:19:11 GMT (envelope-from br@FreeBSD.org) Message-Id: <201412121119.sBCBJBVu089985@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 12 Dec 2014 11:19:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275728 - in head/sys/dev: beri/virtio virtio virtio/mmio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 11:19:13 -0000 Author: br Date: Fri Dec 12 11:19:10 2014 New Revision: 275728 URL: https://svnweb.freebsd.org/changeset/base/275728 Log: Add virtio bus 'poll' method allowing us to inform backend we are going to poll virtqueue. Use on BERI soft-core to invalidate cpu caches. Reviewed by: bryanv Sponsored by: DARPA, AFRL Modified: head/sys/dev/beri/virtio/virtio_mmio_platform.c head/sys/dev/virtio/mmio/virtio_mmio.c head/sys/dev/virtio/mmio/virtio_mmio_if.m head/sys/dev/virtio/virtio_bus_if.m head/sys/dev/virtio/virtqueue.c Modified: head/sys/dev/beri/virtio/virtio_mmio_platform.c ============================================================================== --- head/sys/dev/beri/virtio/virtio_mmio_platform.c Fri Dec 12 09:37:18 2014 (r275727) +++ head/sys/dev/beri/virtio/virtio_mmio_platform.c Fri Dec 12 11:19:10 2014 (r275728) @@ -234,12 +234,22 @@ platform_setup_intr(device_t dev, device return (0); } +static int +platform_poll(device_t dev) +{ + + mips_dcache_wbinv_all(); + + return (0); +} + static device_method_t virtio_mmio_platform_methods[] = { DEVMETHOD(device_probe, virtio_mmio_platform_probe), DEVMETHOD(device_attach, virtio_mmio_platform_attach), /* virtio_mmio_if.h */ DEVMETHOD(virtio_mmio_note, platform_note), + DEVMETHOD(virtio_mmio_poll, platform_poll), DEVMETHOD(virtio_mmio_setup_intr, platform_setup_intr), DEVMETHOD_END }; Modified: head/sys/dev/virtio/mmio/virtio_mmio.c ============================================================================== --- head/sys/dev/virtio/mmio/virtio_mmio.c Fri Dec 12 09:37:18 2014 (r275727) +++ head/sys/dev/virtio/mmio/virtio_mmio.c Fri Dec 12 11:19:10 2014 (r275728) @@ -114,6 +114,7 @@ static int vtmmio_alloc_virtqueues(devic struct vq_alloc_info *); static int vtmmio_setup_intr(device_t, enum intr_type); static void vtmmio_stop(device_t); +static void vtmmio_poll(device_t); static int vtmmio_reinit(device_t, uint64_t); static void vtmmio_reinit_complete(device_t); static void vtmmio_notify_virtqueue(device_t, uint16_t); @@ -182,6 +183,7 @@ static device_method_t vtmmio_methods[] DEVMETHOD(virtio_bus_alloc_virtqueues, vtmmio_alloc_virtqueues), DEVMETHOD(virtio_bus_setup_intr, vtmmio_setup_intr), DEVMETHOD(virtio_bus_stop, vtmmio_stop), + DEVMETHOD(virtio_bus_poll, vtmmio_poll), DEVMETHOD(virtio_bus_reinit, vtmmio_reinit), DEVMETHOD(virtio_bus_reinit_complete, vtmmio_reinit_complete), DEVMETHOD(virtio_bus_notify_vq, vtmmio_notify_virtqueue), @@ -550,6 +552,17 @@ vtmmio_stop(device_t dev) vtmmio_reset(device_get_softc(dev)); } +static void +vtmmio_poll(device_t dev) +{ + struct vtmmio_softc *sc; + + sc = device_get_softc(dev); + + if (sc->platform != NULL) + VIRTIO_MMIO_POLL(sc->platform); +} + static int vtmmio_reinit(device_t dev, uint64_t features) { Modified: head/sys/dev/virtio/mmio/virtio_mmio_if.m ============================================================================== --- head/sys/dev/virtio/mmio/virtio_mmio_if.m Fri Dec 12 09:37:18 2014 (r275727) +++ head/sys/dev/virtio/mmio/virtio_mmio_if.m Fri Dec 12 11:19:10 2014 (r275728) @@ -67,6 +67,13 @@ METHOD int note { } DEFAULT virtio_mmio_note; # +# Inform backend we are going to poll virtqueue. +# +METHOD int poll { + device_t dev; +}; + +# # Setup backend-specific interrupts. # METHOD int setup_intr { Modified: head/sys/dev/virtio/virtio_bus_if.m ============================================================================== --- head/sys/dev/virtio/virtio_bus_if.m Fri Dec 12 09:37:18 2014 (r275727) +++ head/sys/dev/virtio/virtio_bus_if.m Fri Dec 12 11:19:10 2014 (r275728) @@ -87,3 +87,8 @@ METHOD void write_device_config { void *src; int len; }; + +METHOD void poll { + device_t dev; +}; + Modified: head/sys/dev/virtio/virtqueue.c ============================================================================== --- head/sys/dev/virtio/virtqueue.c Fri Dec 12 09:37:18 2014 (r275727) +++ head/sys/dev/virtio/virtqueue.c Fri Dec 12 11:19:10 2014 (r275728) @@ -567,8 +567,11 @@ virtqueue_poll(struct virtqueue *vq, uin { void *cookie; - while ((cookie = virtqueue_dequeue(vq, len)) == NULL) + VIRTIO_BUS_POLL(vq->vq_dev); + while ((cookie = virtqueue_dequeue(vq, len)) == NULL) { cpu_spinwait(); + VIRTIO_BUS_POLL(vq->vq_dev); + } return (cookie); } From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 11:29:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D4CD2E74; Fri, 12 Dec 2014 11:29:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C13B9A25; Fri, 12 Dec 2014 11:29:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBCBTtwp096362; Fri, 12 Dec 2014 11:29:55 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBCBTtgv096361; Fri, 12 Dec 2014 11:29:55 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201412121129.sBCBTtgv096361@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 12 Dec 2014 11:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275729 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 11:29:55 -0000 Author: ae Date: Fri Dec 12 11:29:54 2014 New Revision: 275729 URL: https://svnweb.freebsd.org/changeset/base/275729 Log: Increase the buffer size to keep the list of programm names when parsing programm specification. It is safe to not check out of bounds access, because !isprint(p[i]) check will stop reading, when '\0' character will be read from the input string. Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Fri Dec 12 11:19:10 2014 (r275728) +++ head/usr.sbin/syslogd/syslogd.c Fri Dec 12 11:29:54 2014 (r275729) @@ -1542,7 +1542,7 @@ init(int signo) struct filed *f, *next, **nextp; char *p; char cline[LINE_MAX]; - char prog[NAME_MAX+1]; + char prog[LINE_MAX]; char host[MAXHOSTNAMELEN]; char oldLocalHostName[MAXHOSTNAMELEN]; char hostMsg[2*MAXHOSTNAMELEN+40]; @@ -1664,7 +1664,7 @@ init(int signo) (void)strlcpy(prog, "*", sizeof(prog)); continue; } - for (i = 0; i < NAME_MAX; i++) { + for (i = 0; i < LINE_MAX - 1; i++) { if (!isprint(p[i]) || isspace(p[i])) break; prog[i] = p[i]; From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 16:10:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F40A279A; Fri, 12 Dec 2014 16:10:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0570D57; Fri, 12 Dec 2014 16:10:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBCGAhxd034334; Fri, 12 Dec 2014 16:10:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBCGAhXu034333; Fri, 12 Dec 2014 16:10:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201412121610.sBCGAhXu034333@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Dec 2014 16:10:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275730 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 16:10:44 -0000 Author: jhb Date: Fri Dec 12 16:10:42 2014 New Revision: 275730 URL: https://svnweb.freebsd.org/changeset/base/275730 Log: Provide a dead version of if_get_counter. Submitted by: glebius Reported by: np Modified: head/sys/net/if_dead.c Modified: head/sys/net/if_dead.c ============================================================================== --- head/sys/net/if_dead.c Fri Dec 12 11:29:54 2014 (r275729) +++ head/sys/net/if_dead.c Fri Dec 12 16:10:42 2014 (r275730) @@ -93,6 +93,13 @@ ifdead_transmit(struct ifnet *ifp, struc return (ENXIO); } +static uint64_t +ifdead_get_counter(struct ifnet *ifp, ift_counter cnt) +{ + + return (0); +} + void if_dead(struct ifnet *ifp) { @@ -104,4 +111,5 @@ if_dead(struct ifnet *ifp) ifp->if_resolvemulti = ifdead_resolvemulti; ifp->if_qflush = ifdead_qflush; ifp->if_transmit = ifdead_transmit; + ifp->if_get_counter = ifdead_get_counter; } From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 16:21:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CCFDFA82; Fri, 12 Dec 2014 16:21:08 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7073E98; Fri, 12 Dec 2014 16:21:08 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 80DACB94B; Fri, 12 Dec 2014 11:21:07 -0500 (EST) From: John Baldwin To: src-committers@freebsd.org Subject: Re: svn commit: r275730 - head/sys/net Date: Fri, 12 Dec 2014 11:21:06 -0500 Message-ID: <2066842.DrQSZnthHb@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <201412121610.sBCGAhXu034333@svn.freebsd.org> References: <201412121610.sBCGAhXu034333@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 12 Dec 2014 11:21:07 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 16:21:08 -0000 On Friday, December 12, 2014 04:10:43 PM John Baldwin wrote: > Author: jhb > Date: Fri Dec 12 16:10:42 2014 > New Revision: 275730 > URL: https://svnweb.freebsd.org/changeset/base/275730 > > Log: > Provide a dead version of if_get_counter. > > Submitted by: glebius > Reported by: np Should be "Reviewed by" and I forgot to include the review URL: https://reviews.freebsd.org/D1282 -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 16:49:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 00EAC220; Fri, 12 Dec 2014 16:49:11 +0000 (UTC) Received: from smtpout1.timeweb.ru (smtpout1.timeweb.ru [92.53.117.15]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3AFF17B; Fri, 12 Dec 2014 16:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=amdmi3.ru; s=dkim; h=Content-Transfer-Encoding:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=J6CSl47MJFpKqFXsyxYACvU2VyBSphrxirqCe4WYvvU=; b=LG/1IPGWZhh+samuYBNbMusDm9rDTPMw/g0KEZQBLIdC6zqG7vjmMpCj4QoluQGE8etLW1iuMIL8hSRMfa8pX7CzpxtDNjI+pQkWhtCiUMbvw2sd3q/Q5wudcE61rSWvKyJJ0UqzXq30GRd2QkqCmZM9RM3WLsKbsz6aDeJQego=; Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1XzTOo-000BmH-1p; Fri, 12 Dec 2014 19:49:02 +0300 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id 803969FA; Fri, 12 Dec 2014 19:49:01 +0300 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id 5A82C2B34D; Fri, 12 Dec 2014 19:49:01 +0300 (MSK) Date: Fri, 12 Dec 2014 19:49:01 +0300 From: Dmitry Marakasov To: Dag-Erling =?utf-8?B?U23DuHJncmF2?= Subject: Re: svn commit: r275659 - head/bin/freebsd-version Message-ID: <20141212164901.GB65403@hades.panopticon> Mail-Followup-To: Dag-Erling =?utf-8?B?U23DuHJncmF2?= , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201412100312.sBA3CNEm081570@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201412100312.sBA3CNEm081570@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 16:49:12 -0000 * Dag-Erling Sm=C3=B8rgrav (des@FreeBSD.org) wrote: > Log: > Fix dependency on newvers.sh > =20 > Noticed by: marck > MFC after: 1 week This is wrong. Target uses ${.ALLSRC} to which you've appended ${NEWVERS}= , and now the target appends newvers.sh contents to freebsd-version script. > Modified: > head/bin/freebsd-version/Makefile >=20 > Modified: head/bin/freebsd-version/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/bin/freebsd-version/Makefile Tue Dec 9 23:26:47 2014 (r275658= ) > +++ head/bin/freebsd-version/Makefile Wed Dec 10 03:12:22 2014 (r275659= ) > @@ -5,8 +5,7 @@ MAN =3D freebsd-version.1 > CLEANFILES =3D freebsd-version.sh > NEWVERS =3D ${.CURDIR}/../../sys/conf/newvers.sh > =20 > -freebsd-version.sh.in: ${NEWVERS} > -freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in > +freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in ${NEWVERS} > eval $$(egrep '^(TYPE|REVISION|BRANCH)=3D' ${NEWVERS}) ; \ > if ! sed -e "\ > s/@@TYPE@@/$${TYPE}/g; \ --=20 Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 18:54:32 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B6BAC9B; Fri, 12 Dec 2014 18:54:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87E12141; Fri, 12 Dec 2014 18:54:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBCIsW3E018422; Fri, 12 Dec 2014 18:54:32 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBCIsWKV018420; Fri, 12 Dec 2014 18:54:32 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201412121854.sBCIsWKV018420@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Dec 2014 18:54:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275731 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 18:54:32 -0000 Author: imp Date: Fri Dec 12 18:54:31 2014 New Revision: 275731 URL: https://svnweb.freebsd.org/changeset/base/275731 Log: Fix typo in comments. Noticed by: brooks@ Modified: head/share/mk/bsd.opts.mk head/share/mk/src.opts.mk Modified: head/share/mk/bsd.opts.mk ============================================================================== --- head/share/mk/bsd.opts.mk Fri Dec 12 16:10:42 2014 (r275730) +++ head/share/mk/bsd.opts.mk Fri Dec 12 18:54:31 2014 (r275731) @@ -11,7 +11,7 @@ # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish # to omit from that make. # -# Makefiles must include bsd.srcpot.mk before they test the value of any MK_FOO +# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO # variable. # # Makefiles may also assume that this file is included by bsd.own.mk should it Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Dec 12 16:10:42 2014 (r275730) +++ head/share/mk/src.opts.mk Fri Dec 12 18:54:31 2014 (r275731) @@ -11,7 +11,7 @@ # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish # to omit from that make. # -# Makefiles must include bsd.srcpot.mk before they test the value of any MK_FOO +# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO # variable. # # Makefiles may also assume that this file is included by src.opts.mk should it From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 19:56:40 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C4299DF; Fri, 12 Dec 2014 19:56:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63E51A71; Fri, 12 Dec 2014 19:56:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBCJueJ6048489; Fri, 12 Dec 2014 19:56:40 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBCJucpj048475; Fri, 12 Dec 2014 19:56:38 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201412121956.sBCJucpj048475@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Fri, 12 Dec 2014 19:56:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275732 - in head: etc/mtree share/man/man4 share/man/man7 share/man/man9 sys/conf sys/crypto/aesni sys/crypto/via sys/geom/eli sys/libkern sys/mips/rmi/dev/sec sys/modules/aesni sys/mo... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 19:56:40 -0000 Author: jmg Date: Fri Dec 12 19:56:36 2014 New Revision: 275732 URL: https://svnweb.freebsd.org/changeset/base/275732 Log: Add some new modes to OpenCrypto. These modes are AES-ICM (can be used for counter mode), and AES-GCM. Both of these modes have been added to the aesni module. Included is a set of tests to validate that the software and aesni module calculate the correct values. These use the NIST KAT test vectors. To run the test, you will need to install a soon to be committed port, nist-kat that will install the vectors. Using a port is necessary as the test vectors are around 25MB. All the man pages were updated. I have added a new man page, crypto.7, which includes a description of how to use each mode. All the new modes and some other AES modes are present. It would be good for someone else to go through and document the other modes. A new ioctl was added to support AEAD modes which AES-GCM is one of them. Without this ioctl, it is not possible to test AEAD modes from userland. Add a timing safe bcmp for use to compare MACs. Previously we were using bcmp which could leak timing info and result in the ability to forge messages. Add a minor optimization to the aesni module so that single segment mbufs don't get copied and instead are updated in place. The aesni module needs to be updated to support blocked IO so segmented mbufs don't have to be copied. We require that the IV be specified for all calls for both GCM and ICM. This is to ensure proper use of these functions. Obtained from: p4: //depot/projects/opencrypto Relnotes: yes Sponsored by: FreeBSD Foundation Sponsored by: NetGate Added: head/share/man/man7/crypto.7 (contents, props changed) head/sys/crypto/aesni/aesni_ghash.c (contents, props changed) head/sys/libkern/timingsafe_bcmp.c (contents, props changed) head/sys/opencrypto/gfmult.c (contents, props changed) head/sys/opencrypto/gfmult.h (contents, props changed) head/sys/opencrypto/gmac.c (contents, props changed) head/sys/opencrypto/gmac.h (contents, props changed) head/tests/sys/opencrypto/ head/tests/sys/opencrypto/Makefile (contents, props changed) head/tests/sys/opencrypto/cryptodev.py (contents, props changed) head/tests/sys/opencrypto/cryptodevh.py (contents, props changed) head/tests/sys/opencrypto/cryptotest.py (contents, props changed) head/tests/sys/opencrypto/dpkt.py (contents, props changed) head/tests/sys/opencrypto/runtests.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/share/man/man4/crypto.4 head/share/man/man7/Makefile head/share/man/man9/crypto.9 head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/crypto/aesni/aesni.c head/sys/crypto/aesni/aesni.h head/sys/crypto/aesni/aesni_wrap.c head/sys/crypto/via/padlock_hash.c head/sys/geom/eli/g_eli_crypto.c head/sys/geom/eli/g_eli_integrity.c head/sys/geom/eli/g_eli_privacy.c head/sys/mips/rmi/dev/sec/rmisec.c head/sys/modules/aesni/Makefile head/sys/modules/crypto/Makefile head/sys/opencrypto/criov.c head/sys/opencrypto/crypto.c head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/xform.c head/sys/opencrypto/xform.h head/sys/sys/libkern.h head/sys/sys/param.h head/tests/sys/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Fri Dec 12 18:54:31 2014 (r275731) +++ head/etc/mtree/BSD.tests.dist Fri Dec 12 19:56:36 2014 (r275732) @@ -205,6 +205,8 @@ .. netinet .. + opencrypto + .. pjdfstest chflags .. Modified: head/share/man/man4/crypto.4 ============================================================================== --- head/share/man/man4/crypto.4 Fri Dec 12 18:54:31 2014 (r275731) +++ head/share/man/man4/crypto.4 Fri Dec 12 19:56:36 2014 (r275732) @@ -1,8 +1,16 @@ -.\" $OpenBSD: crypto.4,v 1.4 2002/09/12 07:15:03 deraadt Exp $ +.\" $NetBSD: crypto.4,v 1.24 2014/01/27 21:23:59 pgoyette Exp $ .\" -.\" Copyright (c) 2001 Theo de Raadt +.\" Copyright (c) 2008 The NetBSD Foundation, Inc. +.\" Copyright (c) 2014 The FreeBSD Foundation .\" All rights reserved. .\" +.\" Portions of this documentation were written by John-Mark Gurney +.\" under sponsorship of the FreeBSD Foundation and +.\" Rubicon Communications, LLC (Netgate). +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Coyote Point Systems, Inc. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -11,99 +19,378 @@ .\" 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 +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. .\" +.\" +.\" +.\" Copyright (c) 2004 +.\" Jonathan Stone . 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 Jonathan Stone 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 Jonathan Stone OR THE VOICES IN HIS HEAD +.\" 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 September 7, 2010 +.Dd December 12, 2014 .Dt CRYPTO 4 .Os .Sh NAME .Nm crypto , .Nm cryptodev -.Nd hardware crypto access driver +.Nd user-mode access to hardware-accelerated cryptography .Sh SYNOPSIS .Cd device crypto .Cd device cryptodev +.Pp +.In sys/ioctl.h +.In sys/time.h +.In crypto/cryptodev.h .Sh DESCRIPTION The .Nm -driver provides a device-independent framework to support -cryptographic operations in the kernel. +driver gives user-mode applications access to hardware-accelerated +cryptographic transforms, as implemented by the +.Xr opencrypto 9 +in-kernel interface. +.Pp The -.Nm cryptodev -driver provides userland applications access to this support -through the .Pa /dev/crypto -device. -This node primarily operates in an +special device provides an +.Xr ioctl 2 +based interface. +User-mode applications should open the special device, +then issue .Xr ioctl 2 -based model, permitting a variety of applications to query device capabilities, -submit transactions, and get results. +calls on the descriptor. +User-mode access to +.Pa /dev/crypto +is controlled by three +.Xr sysctl 8 +variables, +.Ic kern.userasymcrypto +and +.Ic kern.cryptodevallowsoft . +See +.Xr sysctl 7 +for additional details. .Pp -If -.Ar count -given in the specification, and is greater than 0, a maximum of one +The .Nm -device is created. +device provides two distinct modes of operation: one mode for +symmetric-keyed cryptographic requests, and a second mode for +both asymmetric-key (public-key/private-key) requests, and for +modular arithmetic (for Diffie-Hellman key exchange and other +cryptographic protocols). +The two modes are described separately below. +.Sh THEORY OF OPERATION +Regardless of whether symmetric-key or asymmetric-key operations are +to be performed, use of the device requires a basic series of steps: .Pp -The following +.Bl -enum +.It +Open a file descriptor for the device. +See +.Xr open 2 . +.It +If any symmetric operation will be performed, +create one session, with +.Dv CIOCGSESSION . +Most applications will require at least one symmetric session. +Since cipher and MAC keys are tied to sessions, many +applications will require more. +Asymmetric operations do not use sessions. +.It +Submit requests, synchronously with +.Dv CIOCCRYPT +(symmetric) +or +.Dv CIOCKEY +(asymmetric). +.It +Destroy one session with +.Dv CIOCFSESSION . +.It +Close the device with +.Xr close 2 . +.El +.Sh SYMMETRIC-KEY OPERATION +The symmetric-key operation mode provides a context-based API +to traditional symmetric-key encryption (or privacy) algorithms, +or to keyed and unkeyed one-way hash (HMAC and MAC) algorithms. +The symmetric-key mode also permits fused operation, +where the hardware performs both a privacy algorithm and an integrity-check +algorithm in a single pass over the data: either a fused +encrypt/HMAC-generate operation, or a fused HMAC-verify/decrypt operation. +.Pp +To use symmetric mode, you must first create a session specifying +the algorithm(s) and key(s) to use; then issue encrypt or decrypt +requests against the session. +.Ss Algorithms +For a list of supported algorithms, see +.Xr crypto 7 +and +.Xr crypto 9 . +.Ss IOCTL Request Descriptions +.\" +.Bl -tag -width CIOCGSESSION +.\" +.It Dv CRIOGET Fa int *fd +Clone the fd argument to +.Xr ioctl 2 , +yielding a new file descriptor for the creation of sessions. +.\" +.It Dv CIOCFINDDEV Fa struct crypt_find_op *fop +.Bd -literal +struct crypt_find_op { + int crid; /* driver id + flags */ + char name[32]; /* device/driver name */ +}; + +.Ed +If +.Fa crid +is -1, then find the driver named +.Fa name +and return the id in +.Fa crid . +If +.Fa crid +is not -1, return the name of the driver with +.Fa crid +in +.Fa name . +In either case, if the driver is not found, +.Dv ENOENT +is returned. +.It Dv CIOCGSESSION Fa struct session_op *sessp +.Bd -literal +struct session_op { + u_int32_t cipher; /* e.g. CRYPTO_DES_CBC */ + u_int32_t mac; /* e.g. CRYPTO_MD5_HMAC */ + + u_int32_t keylen; /* cipher key */ + void * key; + int mackeylen; /* mac key */ + void * mackey; + + u_int32_t ses; /* returns: ses # */ +}; + +.Ed +Create a new cryptographic session on a file descriptor for the device; +that is, a persistent object specific to the chosen +privacy algorithm, integrity algorithm, and keys specified in +.Fa sessp . +The special value 0 for either privacy or integrity +is reserved to indicate that the indicated operation (privacy or integrity) +is not desired for this session. +.Pp +Multiple sessions may be bound to a single file descriptor. +The session ID returned in +.Fa sessp-\*[Gt]ses +is supplied as a required field in the symmetric-operation structure +.Fa crypt_op +for future encryption or hashing requests. +.\" .Pp +.\" This implementation will never return a session ID of 0 for a successful +.\" creation of a session, which is a +.\" .Nx +.\" extension. +.Pp +For non-zero symmetric-key privacy algorithms, the privacy algorithm +must be specified in +.Fa sessp-\*[Gt]cipher , +the key length in +.Fa sessp-\*[Gt]keylen , +and the key value in the octets addressed by +.Fa sessp-\*[Gt]key . +.Pp +For keyed one-way hash algorithms, the one-way hash must be specified +in +.Fa sessp-\*[Gt]mac , +the key length in +.Fa sessp-\*[Gt]mackey , +and the key value in the octets addressed by +.Fa sessp-\*[Gt]mackeylen . +.\" +.Pp +Support for a specific combination of fused privacy and +integrity-check algorithms depends on whether the underlying +hardware supports that combination. +Not all combinations are supported +by all hardware, even if the hardware supports each operation as a +stand-alone non-fused operation. +.It Dv CIOCCRYPT Fa struct crypt_op *cr_op +.Bd -literal +struct crypt_op { + u_int32_t ses; + u_int16_t op; /* e.g. COP_ENCRYPT */ + u_int16_t flags; + u_int len; + caddr_t src, dst; + caddr_t mac; /* must be large enough for result */ + caddr_t iv; +}; + +.Ed +Request a symmetric-key (or hash) operation. +The file descriptor argument to .Xr ioctl 2 -calls apply only to the -.Nm -devices: -.Bl -tag -width ".Dv CIOCGSESSION" -.It Dv CIOCGSESSION -Setup a new crypto session for a new type of operation. -.It Dv CIOCFSESSION -Free a previously established session. -.It Dv CIOCCRYPT -Perform a crypto operation against a previously setup session. +must have been bound to a valid session. +To encrypt, set +.Fa cr_op-\*[Gt]op +to +.Dv COP_ENCRYPT . +To decrypt, set +.Fa cr_op-\*[Gt]op +to +.Dv COP_DECRYPT . +The field +.Fa cr_op-\*[Gt]len +supplies the length of the input buffer; the fields +.Fa cr_op-\*[Gt]src , +.Fa cr_op-\*[Gt]dst , +.Fa cr_op-\*[Gt]mac , +.Fa cr_op-\*[Gt]iv +supply the addresses of the input buffer, output buffer, +one-way hash, and initialization vector, respectively. +.It Dv CIOCCRYPTAEAD Fa struct crypt_aead *cr_aead +.Bd -literal +struct crypt_aead { + u_int32_t ses; + u_int16_t op; /* e.g. COP_ENCRYPT */ + u_int16_t flags; + u_int len; + u_int aadlen; + u_int ivlen; + caddr_t src, dst; + caddr_t aad; + caddr_t tag; /* must be large enough for result */ + caddr_t iv; +}; + +.Ed +The +.Dv CIOCCRYPTAEAD +is similar to the +.Dv CIOCCRYPT +but provides additional data in +.Fa cr_aead-\*[Gt]aad +to include in the authentication mode. +.It Dv CIOCFSESSION Fa u_int32_t ses_id +Destroys the /dev/crypto session associated with the file-descriptor +argument. +.It Dv CIOCNFSESSION Fa struct crypt_sfop *sfop ; +.Bd -literal +struct crypt_sfop { + size_t count; + u_int32_t *sesid; +}; + +.Ed +Destroys the +.Fa sfop-\*[Gt]count +sessions specified by the +.Fa sfop +array of session identifiers. .El -.Sh FEATURES -Depending on hardware being present, the following symmetric and -asymmetric cryptographic features are potentially available from -.Pa /dev/crypto : -.Pp -.Bl -tag -width ".Dv CRYPTO_RIPEMD160_HMAC" -offset indent -compact -.It Dv CRYPTO_DES_CBC -.It Dv CRYPTO_3DES_CBC -.It Dv CRYPTO_BLF_CBC -.It Dv CRYPTO_CAMELLIA_CBC -.It Dv CRYPTO_CAST_CBC -.It Dv CRYPTO_SKIPJACK_CBC -.It Dv CRYPTO_MD5_HMAC -.It Dv CRYPTO_SHA1_HMAC -.It Dv CRYPTO_RIPEMD160_HMAC -.It Dv CRYPTO_MD5_KPDK -.It Dv CRYPTO_SHA1_KPDK -.It Dv CRYPTO_AES_CBC -.It Dv CRYPTO_ARC4 -.It Dv CRYPTO_MD5 -.It Dv CRYPTO_SHA1 -.It Dv CRK_MOD_EXP -.It Dv CRK_MOD_EXP_CRT -.It Dv CRK_DSA_SIGN -.It Dv CRK_DSA_VERIFY -.It Dv CRK_DH_COMPUTE_KEY +.\" +.Sh ASYMMETRIC-KEY OPERATION +.Ss Asymmetric-key algorithms +Contingent upon hardware support, the following asymmetric +(public-key/private-key; or key-exchange subroutine) operations may +also be available: +.Pp +.Bl -column "CRK_DH_COMPUTE_KEY" "Input parameter" "Output parameter" -offset indent -compact +.It Em "Algorithm" Ta "Input parameter" Ta "Output parameter" +.It Em " " Ta "Count" Ta "Count" +.It Dv CRK_MOD_EXP Ta 3 Ta 1 +.It Dv CRK_MOD_EXP_CRT Ta 6 Ta 1 +.It Dv CRK_DSA_SIGN Ta 5 Ta 2 +.It Dv CRK_DSA_VERIFY Ta 7 Ta 0 +.It Dv CRK_DH_COMPUTE_KEY Ta 3 Ta 1 .El -.Sh FILES -.Bl -tag -width ".Pa /dev/crypto" -compact -.It Pa /dev/crypto -crypto access device +.Pp +See below for discussion of the input and output parameter counts. +.Ss Asymmetric-key commands +.Bl -tag -width CIOCKEY +.It Dv CIOCASYMFEAT Fa int *feature_mask +Returns a bitmask of supported asymmetric-key operations. +Each of the above-listed asymmetric operations is present +if and only if the bit position numbered by the code for that operation +is set. +For example, +.Dv CRK_MOD_EXP +is available if and only if the bit +.Pq 1 \*[Lt]\*[Lt] Dv CRK_MOD_EXP +is set. +.It Dv CIOCKEY Fa struct crypt_kop *kop +.Bd -literal +struct crypt_kop { + u_int crk_op; /* e.g. CRK_MOD_EXP */ + u_int crk_status; /* return status */ + u_short crk_iparams; /* # of input params */ + u_short crk_oparams; /* # of output params */ + u_int crk_pad1; + struct crparam crk_param[CRK_MAXPARAM]; +}; + +/* Bignum parameter, in packed bytes. */ +struct crparam { + void * crp_p; + u_int crp_nbits; +}; + +.Ed +Performs an asymmetric-key operation from the list above. +The specific operation is supplied in +.Fa kop-\*[Gt]crk_op ; +final status for the operation is returned in +.Fa kop-\*[Gt]crk_status . +The number of input arguments and the number of output arguments +is specified in +.Fa kop-\*[Gt]crk_iparams +and +.Fa kop-\*[Gt]crk_iparams , +respectively. +The field +.Fa crk_param[] +must be filled in with exactly +.Fa kop-\*[Gt]crk_iparams + kop-\*[Gt]crk_oparams +arguments, each encoded as a +.Fa struct crparam +(address, bitlength) pair. +.Pp +The semantics of these arguments are currently undocumented. .El .Sh SEE ALSO .Xr aesni 4 , @@ -112,6 +399,7 @@ crypto access device .Xr padlock 4 , .Xr safe 4 , .Xr ubsec 4 , +.Xr crypto 7 , .Xr geli 8 , .Xr crypto 9 .Sh HISTORY @@ -123,3 +411,24 @@ The .Nm driver was imported to .Fx 5.0 . +.Sh BUGS +Error checking and reporting is weak. +.Pp +The values specified for symmetric-key key sizes to +.Dv CIOCGSESSION +must exactly match the values expected by +.Xr opencrypto 9 . +The output buffer and MAC buffers supplied to +.Dv CIOCCRYPT +must follow whether privacy or integrity algorithms were specified for +session: if you request a +.No non- Ns Dv NULL +algorithm, you must supply a suitably-sized buffer. +.Pp +The scheme for passing arguments for asymmetric requests is baroque. +.Pp +The naming inconsistency between +.Dv CRIOGET +and the various +.Dv CIOC Ns \&* +names is an unfortunate historical artifact. Modified: head/share/man/man7/Makefile ============================================================================== --- head/share/man/man7/Makefile Fri Dec 12 18:54:31 2014 (r275731) +++ head/share/man/man7/Makefile Fri Dec 12 19:56:36 2014 (r275732) @@ -9,6 +9,7 @@ MAN= adding_user.7 \ bsd.snmpmod.mk.7 \ build.7 \ clocks.7 \ + crypto.7 \ c99.7 \ development.7 \ environ.7 \ Added: head/share/man/man7/crypto.7 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man7/crypto.7 Fri Dec 12 19:56:36 2014 (r275732) @@ -0,0 +1,141 @@ +.\" Copyright (c) 2014 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This documentation was written by John-Mark Gurney under +.\" the sponsorship of the FreeBSD Foundation and +.\" Rubicon Communications, LLC (Netgate). +.\" 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 December 12, 2014 +.Dt CRYPTO 7 +.Os +.Sh NAME +.Nm crypto +.Nd OpenCrypto algorithms +.Sh SYNOPSIS +In the kernel configuration file: +.Cd "device crypto" +.Pp +Or load the crypto.ko module. +.Sh DESCRIPTION +The following cryptographic algorithms that are part of the OpenCrypto +framework have the following requirements. +.Pp +Cipher algorithms: +.Bl -tag -width ".Dv CRYPTO_AES_CBC" +.It Dv CRYPTO_AES_CBC +.Bl -tag -width "Block size :" -compact -offset indent +.It IV size : +16 +.It Block size : +16 +.It Key size : +16, 24 or 32 +.El +.Pp +This algorithm implements Cipher-block chaining. +.It Dv CRYPTO_AES_NIST_GCM_16 +.Bl -tag -width "Block size :" -compact -offset indent +.It IV size : +12 +.It Block size : +1 +.It Key size : +16, 24 or 32 +.It Digest size : +16 +.El +.Pp +This algorithm implements Galois/Counter Mode. +This is the cipher part of an AEAD +.Pq Authenticated Encryption with Associated Data +mode. +This requires use of the use of a proper authentication mode, one of +.Dv CRYPTO_AES_128_NIST_GMAC , +.Dv CRYPTO_AES_192_NIST_GMAC +or +.Dv CRYPTO_AES_256_NIST_GMAC , +that corresponds with the number of bits in the key that you are using. +.Pp +The associated data (if any) must be provided by the authentication mode op. +The authentication tag will be read/written from/to the offset crd_inject +specified in the descriptor for the authentication mode. +.Pp +Note: You must provide an IV on every call. +.It Dv CRYPTO_AES_ICM +.Bl -tag -width "Block size :" -compact -offset indent +.It IV size : +16 +.It Block size : +1 (aesni), 16 (software) +.It Key size : +16, 24 or 32 +.El +.Pp +This algorithm implements Integer Counter Mode. +This is similar to what most people call counter mode, but instead of the +counter being split into a nonce and a counter part, then entire nonce is +used as the initial counter. +This does mean that if a counter is required that rolls over at 32 bits, +the transaction need to be split into two parts where the counter rolls over. +The counter incremented as a 128-bit big endian number. +.Pp +Note: You must provide an IV on every call. +.It Dv CRYPTO_AES_XTS +.Bl -tag -width "Block size :" -compact -offset indent +.It IV size : +16 +.It Block size : +16 +.It Key size : +32 or 64 +.El +.Pp +This algorithm implements XEX Tweakable Block Cipher with Ciphertext Stealing +as defined in NIST SP 800-38E. +.Pp +NOTE: The ciphertext stealing part is not implemented which is why this cipher +is listed as having a block size of 16 instead of 1. +.El +.Pp +Authentication algorithms: +.Bl -tag -width ".Dv CRYPTO_AES_256_NIST_GMAC" +.It CRYPTO_AES_128_NIST_GMAC +See +.Dv CRYPTO_AES_NIST_GCM_16 +in the cipher mode section. +.It CRYPTO_AES_192_NIST_GMAC +See +.Dv CRYPTO_AES_NIST_GCM_16 +in the cipher mode section. +.It CRYPTO_AES_256_NIST_GMAC +See +.Dv CRYPTO_AES_NIST_GCM_16 +in the cipher mode section. +.El +.Sh SEE ALSO +.Xr crypto 4 , +.Xr crypto 9 +.Sh BUGS +Not all the implemented algorithms are listed. Modified: head/share/man/man9/crypto.9 ============================================================================== --- head/share/man/man9/crypto.9 Fri Dec 12 18:54:31 2014 (r275731) +++ head/share/man/man9/crypto.9 Fri Dec 12 19:56:36 2014 (r275732) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 18, 2014 +.Dd December 12, 2014 .Dt CRYPTO 9 .Os .Sh NAME @@ -175,17 +175,26 @@ Contains an algorithm identifier. Currently supported algorithms are: .Pp .Bl -tag -width ".Dv CRYPTO_RIPEMD160_HMAC" -compact +.It Dv CRYPTO_AES_128_NIST_GMAC +.It Dv CRYPTO_AES_192_NIST_GMAC +.It Dv CRYPTO_AES_256_NIST_GMAC .It Dv CRYPTO_AES_CBC +.It Dv CRYPTO_AES_ICM +.It Dv CRYPTO_AES_NIST_GCM_16 +.It Dv CRYPTO_AES_NIST_GMAC +.It Dv CRYPTO_AES_XTS .It Dv CRYPTO_ARC4 .It Dv CRYPTO_BLF_CBC .It Dv CRYPTO_CAMELLIA_CBC .It Dv CRYPTO_CAST_CBC +.It Dv CRYPTO_DEFLATE_COMP .It Dv CRYPTO_DES_CBC .It Dv CRYPTO_3DES_CBC -.It Dv CRYPTO_SKIPJACK_CBC .It Dv CRYPTO_MD5 .It Dv CRYPTO_MD5_HMAC .It Dv CRYPTO_MD5_KPDK +.It Dv CRYPTO_NULL_HMAC +.It Dv CRYPTO_NULL_CBC .It Dv CRYPTO_RIPEMD160_HMAC .It Dv CRYPTO_SHA1 .It Dv CRYPTO_SHA1_HMAC @@ -193,8 +202,7 @@ Currently supported algorithms are: .It Dv CRYPTO_SHA2_256_HMAC .It Dv CRYPTO_SHA2_384_HMAC .It Dv CRYPTO_SHA2_512_HMAC -.It Dv CRYPTO_NULL_HMAC -.It Dv CRYPTO_NULL_CBC +.It Dv CRYPTO_SKIPJACK_CBC .El .It Va cri_klen Specifies the length of the key in bits, for variable-size key @@ -207,7 +215,8 @@ Contains the key to be used with the alg .It Va cri_iv Contains an explicit initialization vector (IV), if it does not prefix the data. -This field is ignored during initialization. +This field is ignored during initialization +.Pq Nm crypto_newsession . If no IV is explicitly passed (see below on details), a random IV is used by the device driver processing the request. .It Va cri_next @@ -296,8 +305,6 @@ The buffer pointed to by is an .Vt uio structure. -.It Dv CRYPTO_F_REL -Must return data in the same place. .It Dv CRYPTO_F_BATCH Batch operation if possible. .It Dv CRYPTO_F_CBIMM @@ -363,7 +370,7 @@ The following flags are defined: For encryption algorithms, this bit is set when encryption is required (when not set, decryption is performed). .It Dv CRD_F_IV_PRESENT -For encryption algorithms, this bit is set when the IV already +For encryption, this bit is set when the IV already precedes the data, so the .Va crd_inject value will be ignored and no IV will be written in the buffer. @@ -372,7 +379,7 @@ at the location pointed to by .Va crd_inject . The IV length is assumed to be equal to the blocksize of the encryption algorithm. -Some applications that do special +Applications that do special .Dq "IV cooking" , such as the half-IV mode in .Xr ipsec 4 , @@ -403,6 +410,8 @@ field for the given operation. Otherwise, the key is taken at newsession time from the .Va cri_key field. +As calculating the key schedule may take a while, it is recommended that often +used keys are given their own session. .It Dv CRD_F_COMP For compression algorithms, this bit is set when compression is required (when not set, decompression is performed). @@ -642,6 +651,7 @@ most of the framework code .Sh SEE ALSO .Xr crypto 4 , .Xr ipsec 4 , +.Xr crypto 7 , .Xr malloc 9 , .Xr sleep 9 .Sh HISTORY Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Dec 12 18:54:31 2014 (r275731) +++ head/sys/conf/files Fri Dec 12 19:56:36 2014 (r275732) @@ -3223,6 +3223,7 @@ libkern/strtoq.c standard libkern/strtoul.c standard libkern/strtouq.c standard libkern/strvalid.c standard +libkern/timingsafe_bcmp.c standard net/bpf.c standard net/bpf_buffer.c optional bpf net/bpf_jitter.c optional bpf_jitter @@ -3880,6 +3881,8 @@ opencrypto/cryptodev.c optional cryptod opencrypto/cryptodev_if.m optional crypto opencrypto/cryptosoft.c optional crypto opencrypto/cryptodeflate.c optional crypto +opencrypto/gmac.c optional crypto +opencrypto/gfmult.c optional crypto opencrypto/rmd160.c optional crypto | ipsec opencrypto/skipjack.c optional crypto opencrypto/xform.c optional crypto Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Fri Dec 12 18:54:31 2014 (r275731) +++ head/sys/conf/files.amd64 Fri Dec 12 19:56:36 2014 (r275732) @@ -129,9 +129,14 @@ amd64/pci/pci_cfgreg.c optional pci cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S optional zfs compile-with "${ZFS_S}" crypto/aesni/aeskeys_amd64.S optional aesni crypto/aesni/aesni.c optional aesni +aesni_ghash.o optional aesni \ + dependency "$S/crypto/aesni/aesni_ghash.c" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ + no-implicit-rule \ + clean "aesni_ghash.o" aesni_wrap.o optional aesni \ dependency "$S/crypto/aesni/aesni_wrap.c" \ - compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -maes ${.IMPSRC}" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -maes ${.IMPSRC}" \ no-implicit-rule \ clean "aesni_wrap.o" crypto/blowfish/bf_enc.c optional crypto | ipsec Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Dec 12 18:54:31 2014 (r275731) +++ head/sys/conf/files.i386 Fri Dec 12 19:56:36 2014 (r275732) @@ -116,9 +116,14 @@ bf_enc.o optional crypto | ipsec \ no-implicit-rule crypto/aesni/aeskeys_i386.S optional aesni crypto/aesni/aesni.c optional aesni +aesni_ghash.o optional aesni \ + dependency "$S/crypto/aesni/aesni_ghash.c" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ + no-implicit-rule \ + clean "aesni_ghash.o" aesni_wrap.o optional aesni \ dependency "$S/crypto/aesni/aesni_wrap.c" \ - compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -maes ${.IMPSRC}" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -maes ${.IMPSRC}" \ no-implicit-rule \ clean "aesni_wrap.o" crypto/des/arch/i386/des_enc.S optional crypto | ipsec | netsmb Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Fri Dec 12 18:54:31 2014 (r275731) +++ head/sys/crypto/aesni/aesni.c Fri Dec 12 19:56:36 2014 (r275732) @@ -1,8 +1,13 @@ /*- * Copyright (c) 2005-2008 Pawel Jakub Dawidek * Copyright (c) 2010 Konstantin Belousov + * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by John-Mark Gurney + * under sponsorship of the FreeBSD Foundation and + * Rubicon Communications, LLC (Netgate). + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -39,8 +44,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include struct aesni_softc { int32_t cid; @@ -56,7 +63,7 @@ static void aesni_freesession_locked(str static int aesni_cipher_setup(struct aesni_session *ses, struct cryptoini *encini); static int aesni_cipher_process(struct aesni_session *ses, - struct cryptodesc *enccrd, struct cryptop *crp); + struct cryptodesc *enccrd, struct cryptodesc *authcrd, struct cryptop *crp); MALLOC_DEFINE(M_AESNI, "aesni_data", "AESNI Data"); @@ -79,12 +86,12 @@ aesni_probe(device_t dev) return (EINVAL); } - if ((cpu_feature & CPUID_SSE2) == 0) { - device_printf(dev, "No SSE2 support but AESNI!?!\n"); + if ((cpu_feature2 & CPUID2_SSE41) == 0) { + device_printf(dev, "No SSE4.1 support.\n"); return (EINVAL); } - device_set_desc_copy(dev, "AES-CBC,AES-XTS"); + device_set_desc_copy(dev, "AES-CBC,AES-XTS,AES-GCM,AES-ICM"); return (0); } @@ -105,6 +112,11 @@ aesni_attach(device_t dev) rw_init(&sc->lock, "aesni_lock"); crypto_register(sc->cid, CRYPTO_AES_CBC, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_ICM, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_NIST_GCM_16, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_128_NIST_GMAC, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_192_NIST_GMAC, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_256_NIST_GMAC, 0, 0); crypto_register(sc->cid, CRYPTO_AES_XTS, 0, 0); return (0); } @@ -144,8 +156,10 @@ aesni_newsession(device_t dev, uint32_t struct cryptoini *encini; int error; - if (sidp == NULL || cri == NULL) + if (sidp == NULL || cri == NULL) { + CRYPTDEB("no sidp or cri"); return (EINVAL); + } sc = device_get_softc(dev); ses = NULL; @@ -153,17 +167,32 @@ aesni_newsession(device_t dev, uint32_t for (; cri != NULL; cri = cri->cri_next) { switch (cri->cri_alg) { case CRYPTO_AES_CBC: + case CRYPTO_AES_ICM: case CRYPTO_AES_XTS: - if (encini != NULL) + case CRYPTO_AES_NIST_GCM_16: + if (encini != NULL) { + CRYPTDEB("encini already set"); return (EINVAL); + } encini = cri; break; + case CRYPTO_AES_128_NIST_GMAC: + case CRYPTO_AES_192_NIST_GMAC: + case CRYPTO_AES_256_NIST_GMAC: + /* + * nothing to do here, maybe in the future cache some + * values for GHASH + */ + break; default: + CRYPTDEB("unhandled algorithm"); return (EINVAL); } } - if (encini == NULL) + if (encini == NULL) { + CRYPTDEB("no cipher"); return (EINVAL); + } rw_wlock(&sc->lock); /* @@ -195,6 +224,7 @@ aesni_newsession(device_t dev, uint32_t error = aesni_cipher_setup(ses, encini); if (error != 0) { + CRYPTDEB("setup failed"); rw_wlock(&sc->lock); aesni_freesession_locked(sc, ses); rw_wunlock(&sc->lock); @@ -214,7 +244,7 @@ aesni_freesession_locked(struct aesni_so sid = ses->id; TAILQ_REMOVE(&sc->sessions, ses, next); ctx = ses->fpu_ctx; - bzero(ses, sizeof(*ses)); + *ses = (struct aesni_session){}; ses->id = sid; ses->fpu_ctx = ctx; TAILQ_INSERT_HEAD(&sc->sessions, ses, next); @@ -248,11 +278,13 @@ aesni_process(device_t dev, struct crypt { struct aesni_softc *sc = device_get_softc(dev); struct aesni_session *ses = NULL; - struct cryptodesc *crd, *enccrd; - int error; + struct cryptodesc *crd, *enccrd, *authcrd; + int error, needauth; error = 0; enccrd = NULL; + authcrd = NULL; + needauth = 0; /* Sanity check. */ if (crp == NULL) @@ -266,6 +298,7 @@ aesni_process(device_t dev, struct crypt for (crd = crp->crp_desc; crd != NULL; crd = crd->crd_next) { switch (crd->crd_alg) { case CRYPTO_AES_CBC: + case CRYPTO_AES_ICM: case CRYPTO_AES_XTS: if (enccrd != NULL) { error = EINVAL; @@ -273,11 +306,41 @@ aesni_process(device_t dev, struct crypt } enccrd = crd; break; + + case CRYPTO_AES_NIST_GCM_16: + if (enccrd != NULL) { + error = EINVAL; + goto out; + } + enccrd = crd; + needauth = 1; + break; + + case CRYPTO_AES_128_NIST_GMAC: + case CRYPTO_AES_192_NIST_GMAC: + case CRYPTO_AES_256_NIST_GMAC: + if (authcrd != NULL) { + error = EINVAL; + goto out; + } + authcrd = crd; + needauth = 1; + break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 20:23:21 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D71BEA6; Fri, 12 Dec 2014 20:23:21 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADC2BD76; Fri, 12 Dec 2014 20:23:21 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2D50DB913; Fri, 12 Dec 2014 15:23:20 -0500 (EST) From: John Baldwin To: John-Mark Gurney Subject: Re: svn commit: r275732 - in head: etc/mtree share/man/man4 share/man/man7 share/man/man9 sys/conf sys/crypto/aesni sys/crypto/via sys/geom/eli sys/libkern sys/mips/rmi/dev/sec sys/modules/aesni sys/mo... Date: Fri, 12 Dec 2014 15:23:17 -0500 Message-ID: <1533978.vC7tcjiHLN@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <201412121956.sBCJucpj048475@svn.freebsd.org> References: <201412121956.sBCJucpj048475@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 12 Dec 2014 15:23:20 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 20:23:22 -0000 On Friday, December 12, 2014 07:56:38 PM John-Mark Gurney wrote: > Author: jmg > Date: Fri Dec 12 19:56:36 2014 > New Revision: 275732 > URL: https://svnweb.freebsd.org/changeset/base/275732 > > Log: > Add some new modes to OpenCrypto. These modes are AES-ICM (can be used > for counter mode), and AES-GCM. Both of these modes have been added to > the aesni module. > > Obtained from: p4: //depot/projects/opencrypto > Relnotes: yes > Sponsored by: FreeBSD Foundation > Sponsored by: NetGate No reviewers? (I thought FF projects required a reviewer?) Were you not able to get other folks to review this when you asked? With crypto involved, it would seem like a good idea to have run this by secteam if you hadn't. (If you did, something like 'Silence from: secteam' in the commit log would have let us know you tried and didn't get any feedback). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 20:35:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 96B8A62F; Fri, 12 Dec 2014 20:35:25 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CA52E8E; Fri, 12 Dec 2014 20:35:24 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id sBCKZHmX055521 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 12 Dec 2014 12:35:17 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id sBCKZHoS055520; Fri, 12 Dec 2014 12:35:17 -0800 (PST) (envelope-from jmg) Date: Fri, 12 Dec 2014 12:35:17 -0800 From: John-Mark Gurney To: John Baldwin Subject: Re: svn commit: r275732 - in head: etc/mtree share/man/man4 share/man/man7 share/man/man9 sys/conf sys/crypto/aesni sys/crypto/via sys/geom/eli sys/libkern sys/mips/rmi/dev/sec sys/modules/aesni sys/mo... Message-ID: <20141212203517.GE25139@funkthat.com> References: <201412121956.sBCJucpj048475@svn.freebsd.org> <1533978.vC7tcjiHLN@ralph.baldwin.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1533978.vC7tcjiHLN@ralph.baldwin.cx> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Fri, 12 Dec 2014 12:35:17 -0800 (PST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 20:35:25 -0000 John Baldwin wrote this message on Fri, Dec 12, 2014 at 15:23 -0500: > On Friday, December 12, 2014 07:56:38 PM John-Mark Gurney wrote: > > Author: jmg > > Date: Fri Dec 12 19:56:36 2014 > > New Revision: 275732 > > URL: https://svnweb.freebsd.org/changeset/base/275732 > > > > Log: > > Add some new modes to OpenCrypto. These modes are AES-ICM (can be used > > for counter mode), and AES-GCM. Both of these modes have been added to > > the aesni module. > > > > Obtained from: p4: //depot/projects/opencrypto > > Relnotes: yes > > Sponsored by: FreeBSD Foundation > > Sponsored by: NetGate > > No reviewers? (I thought FF projects required a reviewer?) Were you not able > to get other folks to review this when you asked? > > With crypto involved, it would seem like a good idea to have run this by > secteam if you hadn't. (If you did, something like 'Silence from: secteam' > in the commit log would have let us know you tried and didn't get any > feedback). Sorry, I did get reviewers for specific parts of the project... But they were third party reviewers... Watson Ladd did the software AES review, and Mike Hamburg did the AES-NI review. Also, I posted an earlier version of this patch to -security and -current over a month ago, and didn't get any significant responses... Sorry for not including that in the commit. Want me to do a null commit to record it? or? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 20:38:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9AFED7D6; Fri, 12 Dec 2014 20:38:44 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71304EB5; Fri, 12 Dec 2014 20:38:44 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6FE5FB946; Fri, 12 Dec 2014 15:38:43 -0500 (EST) From: John Baldwin To: John-Mark Gurney Subject: Re: svn commit: r275732 - in head: etc/mtree share/man/man4 share/man/man7 share/man/man9 sys/conf sys/crypto/aesni sys/crypto/via sys/geom/eli sys/libkern sys/mips/rmi/dev/sec sys/modules/aesni sys/mo... Date: Fri, 12 Dec 2014 15:38:41 -0500 Message-ID: <3059144.OhW84ild8L@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <20141212203517.GE25139@funkthat.com> References: <201412121956.sBCJucpj048475@svn.freebsd.org> <1533978.vC7tcjiHLN@ralph.baldwin.cx> <20141212203517.GE25139@funkthat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 12 Dec 2014 15:38:43 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 20:38:44 -0000 On Friday, December 12, 2014 12:35:17 PM John-Mark Gurney wrote: > John Baldwin wrote this message on Fri, Dec 12, 2014 at 15:23 -0500: > > On Friday, December 12, 2014 07:56:38 PM John-Mark Gurney wrote: > > > Author: jmg > > > Date: Fri Dec 12 19:56:36 2014 > > > New Revision: 275732 > > > URL: https://svnweb.freebsd.org/changeset/base/275732 > > > > > > Log: > > > Add some new modes to OpenCrypto. These modes are AES-ICM (can be > > > used > > > for counter mode), and AES-GCM. Both of these modes have been added > > > to > > > the aesni module. > > > > > > Obtained from: p4: //depot/projects/opencrypto > > > Relnotes: yes > > > Sponsored by: FreeBSD Foundation > > > Sponsored by: NetGate > > > > No reviewers? (I thought FF projects required a reviewer?) Were you not > > able to get other folks to review this when you asked? > > > > With crypto involved, it would seem like a good idea to have run this by > > secteam if you hadn't. (If you did, something like 'Silence from: > > secteam' in the commit log would have let us know you tried and didn't > > get any feedback). > > Sorry, I did get reviewers for specific parts of the project... But > they were third party reviewers... > > Watson Ladd did the software AES review, and Mike Hamburg did the > AES-NI review. > > Also, I posted an earlier version of this patch to -security and > -current over a month ago, and didn't get any significant responses... > > Sorry for not including that in the commit. Want me to do a null > commit to record it? or? No, I don't think it's worth a null commit over. I think noting even external reviewers is probably a good idea for future reference though. Thanks! -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Dec 12 21:55:00 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 958ED1BC; Fri, 12 Dec 2014 21:55:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8253C8C7; Fri, 12 Dec 2014 21:55:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBCLt0jL007195; Fri, 12 Dec 2014 21:55:00 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBCLt0gs007185; Fri, 12 Dec 2014 21:55:00 GMT (envelope-from np@FreeBSD.org) Message-Id: <201412122155.sBCLt0gs007185@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 12 Dec 2014 21:55:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275733 - in head/sys/dev/cxgbe: . tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 12 Dec 2014 21:55:00 -0000 Author: np Date: Fri Dec 12 21:54:59 2014 New Revision: 275733 URL: https://svnweb.freebsd.org/changeset/base/275733 Log: Move KTR_CXGBE from t4_tom.h to adapter.h so that the base if_cxgbe code can use it too. MFC after: 1 week Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Fri Dec 12 19:56:36 2014 (r275732) +++ head/sys/dev/cxgbe/adapter.h Fri Dec 12 21:54:59 2014 (r275733) @@ -57,6 +57,7 @@ #include "common/t4_msg.h" #include "firmware/t4fw_interface.h" +#define KTR_CXGBE KTR_SPARE3 MALLOC_DECLARE(M_CXGBE); #define CXGBE_UNIMPLEMENTED(s) \ panic("%s (%s, line %d) not implemented yet.", s, __FILE__, __LINE__) Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Fri Dec 12 19:56:36 2014 (r275732) +++ head/sys/dev/cxgbe/tom/t4_tom.h Fri Dec 12 21:54:59 2014 (r275733) @@ -31,7 +31,6 @@ #ifndef __T4_TOM_H__ #define __T4_TOM_H__ -#define KTR_CXGBE KTR_SPARE3 #define LISTEN_HASH_SIZE 32 /* From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 01:10:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D88A3664; Sat, 13 Dec 2014 01:10:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3E63D79; Sat, 13 Dec 2014 01:10:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBD1AICk006990; Sat, 13 Dec 2014 01:10:18 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBD1AInC006989; Sat, 13 Dec 2014 01:10:18 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412130110.sBD1AInC006989@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 13 Dec 2014 01:10:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275734 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 01:10:19 -0000 Author: delphij Date: Sat Dec 13 01:10:17 2014 New Revision: 275734 URL: https://svnweb.freebsd.org/changeset/base/275734 Log: MFV r275542: If a dnode has a spill block and there is an error while accessing a data block then traverse_dnode() loses information about that error and returns a status of visiting the spill block. This issue is discovered by Spectra Logic. Illumos issue: 5311 traverse_dnode may report success when it should not Original author: gibbs MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Fri Dec 12 21:54:59 2014 (r275733) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Sat Dec 13 01:10:17 2014 (r275734) @@ -429,7 +429,7 @@ traverse_dnode(traverse_data_t *td, cons break; } - if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { + if (err == 0 && dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { SET_BOOKMARK(&czb, objset, object, 0, DMU_SPILL_BLKID); err = traverse_visitbp(td, dnp, &dnp->dn_spill, &czb); } From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 01:15:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 210397E0; Sat, 13 Dec 2014 01:15:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0357CD99; Sat, 13 Dec 2014 01:15:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBD1F03p010668; Sat, 13 Dec 2014 01:15:00 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBD1F00c010660; Sat, 13 Dec 2014 01:15:00 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412130115.sBD1F00c010660@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 13 Dec 2014 01:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275735 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 01:15:01 -0000 Author: delphij Date: Sat Dec 13 01:14:59 2014 New Revision: 275735 URL: https://svnweb.freebsd.org/changeset/base/275735 Log: MFV r275543: Remove always true tests for ds->ds_phys' presence. Clean up assertions in dsl_dataset_disown. Remove unreachable code in dsl_dataset_disown(). Illumos issue: 5310 Remove always true tests for non-NULL ds->ds_phys MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Dec 13 01:10:17 2014 (r275734) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Dec 13 01:14:59 2014 (r275735) @@ -644,16 +644,14 @@ dsl_dataset_rele(dsl_dataset_t *ds, void void dsl_dataset_disown(dsl_dataset_t *ds, void *tag) { - ASSERT(ds->ds_owner == tag && ds->ds_dbuf != NULL); + ASSERT3P(ds->ds_owner, ==, tag); + ASSERT(ds->ds_dbuf != NULL); mutex_enter(&ds->ds_lock); ds->ds_owner = NULL; mutex_exit(&ds->ds_lock); dsl_dataset_long_rele(ds, tag); - if (ds->ds_dbuf != NULL) - dsl_dataset_rele(ds, tag); - else - dsl_dataset_evict(NULL, ds); + dsl_dataset_rele(ds, tag); } boolean_t Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Sat Dec 13 01:10:17 2014 (r275734) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Sat Dec 13 01:14:59 2014 (r275735) @@ -167,8 +167,8 @@ dsl_prop_get_ds(dsl_dataset_t *ds, const ASSERT(dsl_pool_config_held(ds->ds_dir->dd_pool)); inheritable = (prop == ZPROP_INVAL || zfs_prop_inheritable(prop)); - snapshot = (ds->ds_phys != NULL && dsl_dataset_is_snapshot(ds)); - zapobj = (ds->ds_phys == NULL ? 0 : ds->ds_phys->ds_props_obj); + snapshot = dsl_dataset_is_snapshot(ds); + zapobj = ds->ds_phys->ds_props_obj; if (zapobj != 0) { objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; @@ -543,7 +543,7 @@ dsl_prop_set_sync_impl(dsl_dataset_t *ds isint = (dodefault(propname, 8, 1, &intval) == 0); - if (ds->ds_phys != NULL && dsl_dataset_is_snapshot(ds)) { + if (dsl_dataset_is_snapshot(ds)) { ASSERT(version >= SPA_VERSION_SNAP_PROPS); if (ds->ds_phys->ds_props_obj == 0) { dmu_buf_will_dirty(ds->ds_dbuf, tx); @@ -640,7 +640,7 @@ dsl_prop_set_sync_impl(dsl_dataset_t *ds if (isint) { VERIFY0(dsl_prop_get_int_ds(ds, propname, &intval)); - if (ds->ds_phys != NULL && dsl_dataset_is_snapshot(ds)) { + if (dsl_dataset_is_snapshot(ds)) { dsl_prop_cb_record_t *cbr; /* * It's a snapshot; nothing can inherit this From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 01:18:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C276E9DC; Sat, 13 Dec 2014 01:18:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE4AEDCB; Sat, 13 Dec 2014 01:18:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBD1IONC011220; Sat, 13 Dec 2014 01:18:24 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBD1IOj6011219; Sat, 13 Dec 2014 01:18:24 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412130118.sBD1IOj6011219@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 13 Dec 2014 01:18:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275736 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 01:18:24 -0000 Author: delphij Date: Sat Dec 13 01:18:23 2014 New Revision: 275736 URL: https://svnweb.freebsd.org/changeset/base/275736 Log: MFV r275544: Clean up some duplicated code in dnode_sync() around freeing spill blocks. Illumos issue: 5350 clean up code in dnode_sync() MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Sat Dec 13 01:14:59 2014 (r275735) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Sat Dec 13 01:18:23 2014 (r275736) @@ -633,12 +633,11 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx) dn->dn_free_txg <= tx->tx_txg; /* - * We will either remove a spill block when a file is being removed - * or we have been asked to remove it. + * Remove the spill block if we have been explicitly asked to + * remove it, or if the object is being removed. */ - if (dn->dn_rm_spillblk[txgoff] || - ((dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) && freeing_dnode)) { - if ((dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR)) + if (dn->dn_rm_spillblk[txgoff] || freeing_dnode) { + if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) kill_spill = B_TRUE; dn->dn_rm_spillblk[txgoff] = 0; } From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 01:26:07 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D87DCBF4; Sat, 13 Dec 2014 01:26:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C41F3E9C; Sat, 13 Dec 2014 01:26:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBD1Q7eZ015790; Sat, 13 Dec 2014 01:26:07 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBD1Q7mt015789; Sat, 13 Dec 2014 01:26:07 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412130126.sBD1Q7mt015789@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 13 Dec 2014 01:26:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275737 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 01:26:08 -0000 Author: delphij Date: Sat Dec 13 01:26:06 2014 New Revision: 275737 URL: https://svnweb.freebsd.org/changeset/base/275737 Log: MFV r275545: If zio_checksum_error() returns other than ECKSUM (e.g. EINVAL), it does not fill in the "zio_bad_cksum_t *info" parameter. Caller should not attempt to use it in this case. Illumos issue: 5348 zio_checksum_error() only fills in info if ECKSUM MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Dec 13 01:18:23 2014 (r275736) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Dec 13 01:26:06 2014 (r275737) @@ -2958,7 +2958,8 @@ zio_checksum_verify(zio_t *zio) if ((error = zio_checksum_error(zio, &info)) != 0) { zio->io_error = error; - if (!(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { + if (error == ECKSUM && + !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { zfs_ereport_start_checksum(zio->io_spa, zio->io_vd, zio, zio->io_offset, zio->io_size, NULL, &info); From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 01:39:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A945EDE5; Sat, 13 Dec 2014 01:39:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89F84F76; Sat, 13 Dec 2014 01:39:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBD1dPnM021503; Sat, 13 Dec 2014 01:39:25 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBD1dPUG021502; Sat, 13 Dec 2014 01:39:25 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412130139.sBD1dPUG021502@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 13 Dec 2014 01:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275738 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 01:39:25 -0000 Author: delphij Date: Sat Dec 13 01:39:24 2014 New Revision: 275738 URL: https://svnweb.freebsd.org/changeset/base/275738 Log: MFV r275546: Reduce scrub activities when system there is enough dirty data, namely when dirty data is more than zfs_vdev_async_write_active_min_dirty_percent (once we start to increase the number of concurrent async writes). While there also correct rounding error which would make scrub end up pausing for (zfs_txg_timeout + 1) seconds instead of the desired zfs_txg_timeout seconds. Illumos issue: 5351 scrub goes for an extra second each txg 5352 scrub should pause when there is some dirty data MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Sat Dec 13 01:26:06 2014 (r275737) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Sat Dec 13 01:39:24 2014 (r275738) @@ -414,12 +414,11 @@ dsl_scan_sync_state(dsl_scan_t *scn, dmu &scn->scn_phys, tx)); } +extern int zfs_vdev_async_write_active_min_dirty_percent; + static boolean_t dsl_scan_check_pause(dsl_scan_t *scn, const zbookmark_phys_t *zb) { - uint64_t elapsed_nanosecs; - unsigned int mintime; - /* we never skip user/group accounting objects */ if (zb && (int64_t)zb->zb_object < 0) return (B_FALSE); @@ -434,12 +433,28 @@ dsl_scan_check_pause(dsl_scan_t *scn, co if (zb && zb->zb_level != 0) return (B_FALSE); - mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ? + /* + * We pause if: + * - we have scanned for the maximum time: an entire txg + * timeout (default 5 sec) + * or + * - we have scanned for at least the minimum time (default 1 sec + * for scrub, 3 sec for resilver), and either we have sufficient + * dirty data that we are starting to write more quickly + * (default 30%), or someone is explicitly waiting for this txg + * to complete. + * or + * - the spa is shutting down because this pool is being exported + * or the machine is rebooting. + */ + int mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ? zfs_resilver_min_time_ms : zfs_scan_min_time_ms; - elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time; - if (elapsed_nanosecs / NANOSEC > zfs_txg_timeout || + uint64_t elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time; + int dirty_pct = scn->scn_dp->dp_dirty_total * 100 / zfs_dirty_data_max; + if (elapsed_nanosecs / NANOSEC >= zfs_txg_timeout || (NSEC2MSEC(elapsed_nanosecs) > mintime && - txg_sync_waiting(scn->scn_dp)) || + (txg_sync_waiting(scn->scn_dp) || + dirty_pct >= zfs_vdev_async_write_active_min_dirty_percent)) || spa_shutting_down(scn->scn_dp->dp_spa)) { if (zb) { dprintf("pausing at bookmark %llx/%llx/%llx/%llx\n", From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 01:55:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5D56F9C; Sat, 13 Dec 2014 01:55:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FA4514F; Sat, 13 Dec 2014 01:55:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBD1t3Zo030655; Sat, 13 Dec 2014 01:55:03 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBD1t3dA030654; Sat, 13 Dec 2014 01:55:03 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412130155.sBD1t3dA030654@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 13 Dec 2014 01:55:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275739 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 01:55:03 -0000 Author: delphij Date: Sat Dec 13 01:55:02 2014 New Revision: 275739 URL: https://svnweb.freebsd.org/changeset/base/275739 Log: MFV r275547: Port Illumos 'zfs allow' examples update. While I'm there also fix a typo. Illumos issue: 4181 zfs(1m): 'zfs allow' examples in the man page are outdated MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Dec 13 01:39:24 2014 (r275738) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Dec 13 01:55:02 2014 (r275739) @@ -23,15 +23,15 @@ .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. -.\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2014, Joyent, Inc. All rights reserved. .\" Copyright (c) 2013, Steven Hartland +.\" Copyright (c) 2014 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2014, Xin LI .\" Copyright (c) 2014, The FreeBSD Foundation, All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd November 12, 2014 +.Dd December 12, 2014 .Dt ZFS 8 .Os .Sh NAME @@ -3505,10 +3505,9 @@ are also displayed. .Bd -literal -offset 2n .Li # Ic zfs allow cindys create,destroy,mount,snapshot tank/cindys .Li # Ic zfs allow tank/cindys -------------------------------------------------------------- -Local+Descendent permissions on (tank/cindys) - user cindys create,destroy,mount,snapshot -------------------------------------------------------------- +---- Permissions on tank/cindys -------------------------------------- +Local+Descendent permissions: + user cindys create,destroy,mount,snapshot .Ed .It Sy Example 18 No Delegating Create Time Permissions on a Tn ZFS No Dataset .Pp @@ -3524,12 +3523,11 @@ are also displayed. .Li # Ic zfs allow staff create,mount tank/users .Li # Ic zfs allow -c destroy tank/users .Li # Ic zfs allow tank/users -------------------------------------------------------------- -Create time permissions on (tank/users) - create,destroy -Local+Descendent permissions on (tank/users) - group staff create,mount -------------------------------------------------------------- +---- Permissions on tank/users --------------------------------------- +Permission sets: + destroy +Local+Descendent permissions: + group staff create,mount .Ed .It Xo .Sy Example 19 @@ -3547,14 +3545,11 @@ are also displayed. .Li # Ic zfs allow -s @pset create,destroy,snapshot,mount tank/users .Li # Ic zfs allow staff @pset tank/users .Li # Ic zfs allow tank/users -------------------------------------------------------------- -Permission sets on (tank/users) +---- Permissions on tank/users --------------------------------------- +Permission sets: @pset create,destroy,mount,snapshot -Create time permissions on (tank/users) - create,destroy -Local+Descendent permissions on (tank/users) - group staff @pset,create,mount -------------------------------------------------------------- +Local+Descendent permissions: + group staff @pset .Ed .It Sy Example 20 No Delegating Property Permissions on a Tn ZFS No Dataset .Pp @@ -3566,16 +3561,15 @@ file system. The permissions on are also displayed. .Bd -literal -offset 2n .Li # Ic zfs allow cindys quota,reservation users/home -.Li # Ic zfs allow cindys -------------------------------------------------------------- -Local+Descendent permissions on (users/home) +.Li # Ic zfs allow users/home +---- Permissions on users/home --------------------------------------- +Local+Descendent permissions: user cindys quota,reservation -------------------------------------------------------------- .Li # Ic su - cindys .Li cindys% Ic zfs set quota=10G users/home/marks .Li cindys% Ic zfs get quota users/home/marks -NAME PROPERTY VALUE SOURCE -users/home/marks quota 10G local +NAME PROPERTY VALUE SOURCE +users/home/marks quota 10G local .Ed .It Sy Example 21 No Removing ZFS Delegated Permissions on a Tn ZFS No Dataset .Pp @@ -3589,14 +3583,11 @@ are also displayed. .Bd -literal -offset 2n .Li # Ic zfs unallow staff snapshot tank/users .Li # Ic zfs allow tank/users -------------------------------------------------------------- -Permission sets on (tank/users) +---- Permissions on tank/users --------------------------------------- +Permission sets: @pset create,destroy,mount,snapshot -Create time permissions on (tank/users) - create,destroy -Local+Descendent permissions on (tank/users) - group staff @pset,create,mount -------------------------------------------------------------- +Local+Descendent permissions: + group staff @pset .Ed .It Sy Example 22 Showing the differences between a snapshot and a ZFS Dataset .Pp From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 02:08:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0AC7A279; Sat, 13 Dec 2014 02:08:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9F1D239; Sat, 13 Dec 2014 02:08:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBD28J0e036065; Sat, 13 Dec 2014 02:08:19 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBD28JIO036063; Sat, 13 Dec 2014 02:08:19 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412130208.sBD28JIO036063@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 13 Dec 2014 02:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275740 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 02:08:20 -0000 Author: delphij Date: Sat Dec 13 02:08:18 2014 New Revision: 275740 URL: https://svnweb.freebsd.org/changeset/base/275740 Log: MFV r275548: Verify that the block pointer is structurally valid, before attempting to read it in. It can only be invalid in the case of a ZFS bug, but this change will help identify such bugs in a more transparent way, by panic'ing with a relevant message, rather than indexing off the end of an array or something. Illumos issue: 5349 verify that block pointer is plausible before reading MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Sat Dec 13 01:55:02 2014 (r275739) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Sat Dec 13 02:08:18 2014 (r275740) @@ -811,6 +811,7 @@ extern boolean_t spa_is_root(spa_t *spa) extern boolean_t spa_writeable(spa_t *spa); extern boolean_t spa_has_pending_synctask(spa_t *spa); extern int spa_maxblocksize(spa_t *spa); +extern void zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp); extern int spa_mode(spa_t *spa); extern uint64_t zfs_strtonum(const char *str, char **nptr); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Dec 13 01:55:02 2014 (r275739) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Dec 13 02:08:18 2014 (r275740) @@ -265,7 +265,7 @@ zio_buf_alloc(size_t size) size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; int flags = zio_exclude_metadata ? KM_NODEBUG : 0; - ASSERT3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); if (zio_use_uma) return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE)); @@ -284,7 +284,7 @@ zio_data_buf_alloc(size_t size) { size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; - ASSERT(c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); if (zio_use_uma) return (kmem_cache_alloc(zio_data_buf_cache[c], KM_PUSHPAGE)); @@ -297,7 +297,7 @@ zio_buf_free(void *buf, size_t size) { size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; - ASSERT(c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); if (zio_use_uma) kmem_cache_free(zio_buf_cache[c], buf); @@ -310,7 +310,7 @@ zio_data_buf_free(void *buf, size_t size { size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; - ASSERT(c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); if (zio_use_uma) kmem_cache_free(zio_data_buf_cache[c], buf); @@ -657,6 +657,86 @@ zio_root(spa_t *spa, zio_done_func_t *do return (zio_null(NULL, spa, NULL, done, private, flags)); } +void +zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp) +{ + if (!DMU_OT_IS_VALID(BP_GET_TYPE(bp))) { + zfs_panic_recover("blkptr at %p has invalid TYPE %llu", + bp, (longlong_t)BP_GET_TYPE(bp)); + } + if (BP_GET_CHECKSUM(bp) >= ZIO_CHECKSUM_FUNCTIONS || + BP_GET_CHECKSUM(bp) <= ZIO_CHECKSUM_ON) { + zfs_panic_recover("blkptr at %p has invalid CHECKSUM %llu", + bp, (longlong_t)BP_GET_CHECKSUM(bp)); + } + if (BP_GET_COMPRESS(bp) >= ZIO_COMPRESS_FUNCTIONS || + BP_GET_COMPRESS(bp) <= ZIO_COMPRESS_ON) { + zfs_panic_recover("blkptr at %p has invalid COMPRESS %llu", + bp, (longlong_t)BP_GET_COMPRESS(bp)); + } + if (BP_GET_LSIZE(bp) > SPA_MAXBLOCKSIZE) { + zfs_panic_recover("blkptr at %p has invalid LSIZE %llu", + bp, (longlong_t)BP_GET_LSIZE(bp)); + } + if (BP_GET_PSIZE(bp) > SPA_MAXBLOCKSIZE) { + zfs_panic_recover("blkptr at %p has invalid PSIZE %llu", + bp, (longlong_t)BP_GET_PSIZE(bp)); + } + + if (BP_IS_EMBEDDED(bp)) { + if (BPE_GET_ETYPE(bp) > NUM_BP_EMBEDDED_TYPES) { + zfs_panic_recover("blkptr at %p has invalid ETYPE %llu", + bp, (longlong_t)BPE_GET_ETYPE(bp)); + } + } + + /* + * Pool-specific checks. + * + * Note: it would be nice to verify that the blk_birth and + * BP_PHYSICAL_BIRTH() are not too large. However, spa_freeze() + * allows the birth time of log blocks (and dmu_sync()-ed blocks + * that are in the log) to be arbitrarily large. + */ + for (int i = 0; i < BP_GET_NDVAS(bp); i++) { + uint64_t vdevid = DVA_GET_VDEV(&bp->blk_dva[i]); + if (vdevid >= spa->spa_root_vdev->vdev_children) { + zfs_panic_recover("blkptr at %p DVA %u has invalid " + "VDEV %llu", + bp, i, (longlong_t)vdevid); + } + vdev_t *vd = spa->spa_root_vdev->vdev_child[vdevid]; + if (vd == NULL) { + zfs_panic_recover("blkptr at %p DVA %u has invalid " + "VDEV %llu", + bp, i, (longlong_t)vdevid); + } + if (vd->vdev_ops == &vdev_hole_ops) { + zfs_panic_recover("blkptr at %p DVA %u has hole " + "VDEV %llu", + bp, i, (longlong_t)vdevid); + + } + if (vd->vdev_ops == &vdev_missing_ops) { + /* + * "missing" vdevs are valid during import, but we + * don't have their detailed info (e.g. asize), so + * we can't perform any more checks on them. + */ + continue; + } + uint64_t offset = DVA_GET_OFFSET(&bp->blk_dva[i]); + uint64_t asize = DVA_GET_ASIZE(&bp->blk_dva[i]); + if (BP_IS_GANG(bp)) + asize = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE); + if (offset + asize > vd->vdev_asize) { + zfs_panic_recover("blkptr at %p DVA %u has invalid " + "OFFSET %llu", + bp, i, (longlong_t)offset); + } + } +} + zio_t * zio_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, void *data, uint64_t size, zio_done_func_t *done, void *private, @@ -664,6 +744,8 @@ zio_read(zio_t *pio, spa_t *spa, const b { zio_t *zio; + zfs_blkptr_verify(spa, bp); + zio = zio_create(pio, spa, BP_PHYSICAL_BIRTH(bp), bp, data, size, done, private, ZIO_TYPE_READ, priority, flags, NULL, 0, zb, From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 04:26:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 030D76A6 for ; Sat, 13 Dec 2014 04:26:18 +0000 (UTC) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C2D5207 for ; Sat, 13 Dec 2014 04:26:17 +0000 (UTC) Received: by mail-la0-f46.google.com with SMTP id q1so7109033lam.19 for ; Fri, 12 Dec 2014 20:26:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=DmTrW4va/vR7KIsuDtu75eu1Nk7mKkAQQOmVieJjlT4=; b=S+k5xaJv/l/lRJ7yIPkMnDVBDW0BFvF7CbvsOEO2SGBCNjR3P8iC4XeN5+MzBmdI9j q4RpEXvV+jm30k0kHJuPriYGTU2WNfzQU+OGTp36Bf4QBdERVRNs4/kF97ZOxzu89DCn 2SsoU15y9X62aPcRaS60+cKfEPOCgpQ1DLsPunHi5CoH7S/39LGtoYU9VSsBkbQatOQq 88URHKro7YvhREPGNmd2BBQp/Bn0eadfcTRACPKcjMAjmWIV7G7ajB/ynQRl2rDW54EZ E6keFVxrtdVtZGDeLFf3s9zD3XRYqeDVQy+0rRXTRTR1sE0HppTrBNvA49U+ZXOf4W98 9NXw== X-Gm-Message-State: ALoCoQkAWGrRmjGc4A5pd5yKU7mopJ3wORKTm5N3hG7rJabx0grD/WeeZrxg5TZENI29Kidl27wH X-Received: by 10.112.150.71 with SMTP id ug7mr18678657lbb.73.1418444288055; Fri, 12 Dec 2014 20:18:08 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id ph5sm888944lbb.40.2014.12.12.20.18.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Dec 2014 20:18:07 -0800 (PST) Message-ID: <548BBDFE.8010302@freebsd.org> Date: Sat, 13 Dec 2014 07:18:06 +0300 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r275633 - in head: contrib/llvm/lib/Transforms/Vectorize sys/sys References: <201412090734.sB97YT2X080620@svn.freebsd.org> In-Reply-To: <201412090734.sB97YT2X080620@svn.freebsd.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 04:26:18 -0000 On 09.12.2014 10:34, Dimitry Andric wrote: > PR21302. Vectorize only bottom-tested loops. ... > MFC after: 3 days Hi. More than 3 days already passed, do you plan to MFC it? I have irrational fear to compile anything under -stable until this change will be committed) -- http://ache.vniz.net/ From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 04:50:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 63B84817; Sat, 13 Dec 2014 04:50:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3504A3E3; Sat, 13 Dec 2014 04:50:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBD4oFZI017597; Sat, 13 Dec 2014 04:50:15 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBD4oFF5017596; Sat, 13 Dec 2014 04:50:15 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201412130450.sBD4oFF5017596@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Sat, 13 Dec 2014 04:50:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275741 - stable/9/sys/contrib/ipfilter/netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 04:50:15 -0000 Author: rodrigc Date: Sat Dec 13 04:50:14 2014 New Revision: 275741 URL: https://svnweb.freebsd.org/changeset/base/275741 Log: Merge r275213. Set the current vnet inside the ioctl handler for ipfilter. Without this fix, the vnet was NULL and would crash. This fix is similar to what was done inside the ioctl handler for PF. Tested by: (1) Boot a kernel with "options VIMAGE" enabled (2) Type: echo "map lo0 from 10.0.0.0/24 to ! 10.0.0.0/24 -> 127.0.0.1/32" > /etc/ipnat.rules ; service ipnat onerestart PR: 176992 Differential Revision: https://reviews.freebsd.org/D1191 Modified: stable/9/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/9/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Dec 13 02:08:18 2014 (r275740) +++ stable/9/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Dec 13 04:50:14 2014 (r275741) @@ -47,11 +47,12 @@ static const char rcsid[] = "@(#)$Id: ip #endif #include #include -#if (__FreeBSD_version >= 300000) # include -#else -# include +#if defined(__FreeBSD_version) && (__FreeBSD_version >= 800000) +#include #endif +# include +# include #if !defined(__hpux) # include #endif @@ -86,6 +87,12 @@ static const char rcsid[] = "@(#)$Id: ip #include #include #include +#if defined(__FreeBSD_version) && (__FreeBSD_version >= 800000) +#include +#else +#define CURVNET_SET(arg) +#define CURVNET_RESTORE() +#endif #if defined(__osf__) # include #endif @@ -362,7 +369,9 @@ int mode; SPL_NET(s); + CURVNET_SET(TD_TO_VNET(p)); error = fr_ioctlswitch(unit, data, cmd, mode, p->p_uid, p); + CURVNET_RESTORE(); if (error != -1) { SPL_X(s); return error; From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 12:14:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0BC2363A; Sat, 13 Dec 2014 12:14:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E113FA7; Sat, 13 Dec 2014 12:14:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDCEROP033031; Sat, 13 Dec 2014 12:14:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDCERJT033028; Sat, 13 Dec 2014 12:14:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412131214.sBDCERJT033028@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Dec 2014 12:14:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r275742 - in stable: 10/contrib/llvm/lib/Transforms/Vectorize 10/sys/sys 9/contrib/llvm/lib/Transforms/Vectorize 9/sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 12:14:28 -0000 Author: dim Date: Sat Dec 13 12:14:26 2014 New Revision: 275742 URL: https://svnweb.freebsd.org/changeset/base/275742 Log: MFC r275633: Pull in r223171 from upstream llvm trunk (by Michael Zolotukhin): PR21302. Vectorize only bottom-tested loops. rdar://problem/18886083 This fixes a bug in the llvm vectorizer, which could sometimes cause vectorized loops to perform an additional iteration, leading to possible buffer overruns. Symptoms of this, which are usually segfaults, were first noticed when building gcc ports, here: https://lists.freebsd.org/pipermail/freebsd-ports/2014-September/095466.html https://lists.freebsd.org/pipermail/freebsd-toolchain/2014-September/001211.html Since this fix is very important for ports, bump __FreeBSD_version to make it easier for port maintainers to test whether the fix has been applied. Upstream PR: http://llvm.org/PR21302 Modified: stable/9/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp stable/9/sys/sys/param.h Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp stable/10/sys/sys/param.h Directory Properties: stable/10/ (props changed) Modified: stable/9/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Sat Dec 13 04:50:14 2014 (r275741) +++ stable/9/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Sat Dec 13 12:14:26 2014 (r275742) @@ -2864,6 +2864,14 @@ bool LoopVectorizationLegality::canVecto if (!TheLoop->getExitingBlock()) return false; + // We only handle bottom-tested loops, i.e. loop in which the condition is + // checked at the end of each iteration. With that we can assume that all + // instructions in the loop are executed the same number of times. + if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch()) { + DEBUG(dbgs() << "LV: loop control flow is not understood by vectorizer\n"); + return false; + } + // We need to have a loop header. DEBUG(dbgs() << "LV: Found a loop: " << TheLoop->getHeader()->getName() << '\n'); Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Sat Dec 13 04:50:14 2014 (r275741) +++ stable/9/sys/sys/param.h Sat Dec 13 12:14:26 2014 (r275742) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 903506 /* Master, propagated to newvers */ +#define __FreeBSD_version 903507 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 12:14:29 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A24A63B; Sat, 13 Dec 2014 12:14:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF549A8; Sat, 13 Dec 2014 12:14:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDCESLf033039; Sat, 13 Dec 2014 12:14:28 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDCESwJ033037; Sat, 13 Dec 2014 12:14:28 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412131214.sBDCESwJ033037@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Dec 2014 12:14:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275742 - in stable: 10/contrib/llvm/lib/Transforms/Vectorize 10/sys/sys 9/contrib/llvm/lib/Transforms/Vectorize 9/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 12:14:29 -0000 Author: dim Date: Sat Dec 13 12:14:26 2014 New Revision: 275742 URL: https://svnweb.freebsd.org/changeset/base/275742 Log: MFC r275633: Pull in r223171 from upstream llvm trunk (by Michael Zolotukhin): PR21302. Vectorize only bottom-tested loops. rdar://problem/18886083 This fixes a bug in the llvm vectorizer, which could sometimes cause vectorized loops to perform an additional iteration, leading to possible buffer overruns. Symptoms of this, which are usually segfaults, were first noticed when building gcc ports, here: https://lists.freebsd.org/pipermail/freebsd-ports/2014-September/095466.html https://lists.freebsd.org/pipermail/freebsd-toolchain/2014-September/001211.html Since this fix is very important for ports, bump __FreeBSD_version to make it easier for port maintainers to test whether the fix has been applied. Upstream PR: http://llvm.org/PR21302 Modified: stable/10/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp stable/10/sys/sys/param.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp stable/9/sys/sys/param.h Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/sys/ (props changed) Modified: stable/10/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp ============================================================================== --- stable/10/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Sat Dec 13 04:50:14 2014 (r275741) +++ stable/10/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Sat Dec 13 12:14:26 2014 (r275742) @@ -2864,6 +2864,14 @@ bool LoopVectorizationLegality::canVecto if (!TheLoop->getExitingBlock()) return false; + // We only handle bottom-tested loops, i.e. loop in which the condition is + // checked at the end of each iteration. With that we can assume that all + // instructions in the loop are executed the same number of times. + if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch()) { + DEBUG(dbgs() << "LV: loop control flow is not understood by vectorizer\n"); + return false; + } + // We need to have a loop header. DEBUG(dbgs() << "LV: Found a loop: " << TheLoop->getHeader()->getName() << '\n'); Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Sat Dec 13 04:50:14 2014 (r275741) +++ stable/10/sys/sys/param.h Sat Dec 13 12:14:26 2014 (r275742) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1001503 /* Master, propagated to newvers */ +#define __FreeBSD_version 1001504 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 12:29:53 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C56D89A2; Sat, 13 Dec 2014 12:29:53 +0000 (UTC) Received: from tensor.andric.com (unknown [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8080017F; Sat, 13 Dec 2014 12:29:53 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::ec02:9330:f41e:f824] (unknown [IPv6:2001:7b8:3a7:0:ec02:9330:f41e:f824]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 9F97FB80A; Sat, 13 Dec 2014 13:29:47 +0100 (CET) Subject: Re: svn commit: r275633 - in head: contrib/llvm/lib/Transforms/Vectorize sys/sys Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Content-Type: multipart/signed; boundary="Apple-Mail=_E661A99F-BFD1-4698-9F3A-56AE1DE35124"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.5b3 From: Dimitry Andric In-Reply-To: <548BBDFE.8010302@freebsd.org> Date: Sat, 13 Dec 2014 13:29:43 +0100 Message-Id: <3F1197D0-34C9-4220-B297-1DF14A827F9D@FreeBSD.org> References: <201412090734.sB97YT2X080620@svn.freebsd.org> <548BBDFE.8010302@freebsd.org> To: Andrey Chernov X-Mailer: Apple Mail (2.1993) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 12:29:53 -0000 --Apple-Mail=_E661A99F-BFD1-4698-9F3A-56AE1DE35124 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 13 Dec 2014, at 05:18, Andrey Chernov wrote: > > On 09.12.2014 10:34, Dimitry Andric wrote: >> PR21302. Vectorize only bottom-tested loops. > ... >> MFC after: 3 days > > Hi. More than 3 days already passed, do you plan to MFC it? > I have irrational fear to compile anything under -stable until this > change will be committed) Yes, I got the reminder, and merged the change in r275742. I will also inform portmgr of the updated __FreeBSD_version values. -Dimitry --Apple-Mail=_E661A99F-BFD1-4698-9F3A-56AE1DE35124 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.26 iEYEARECAAYFAlSMMTsACgkQsF6jCi4glqOACgCaA3ApOUwmIXS5PrD15IO6sTh1 YawAoIT64VDOW20Nh6uINhAXQ9DixoXV =TXTX -----END PGP SIGNATURE----- --Apple-Mail=_E661A99F-BFD1-4698-9F3A-56AE1DE35124-- From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 16:02:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BBD9786C; Sat, 13 Dec 2014 16:02:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CC72881; Sat, 13 Dec 2014 16:02:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDG2c9D044854; Sat, 13 Dec 2014 16:02:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDG2cIE044852; Sat, 13 Dec 2014 16:02:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412131602.sBDG2cIE044852@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 13 Dec 2014 16:02:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275743 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 16:02:38 -0000 Author: kib Date: Sat Dec 13 16:02:37 2014 New Revision: 275743 URL: https://svnweb.freebsd.org/changeset/base/275743 Log: The vinactive() call in vgonel() may start writes for the dirty pages, creating delayed write buffers belonging to the reclaimed vnode. Put the buffer cleanup code after inactivation. Add asserts that ensure that buffer queues are empty and add BO_DEAD flag for bufobj to check that no buffers are added after the cleanup. BO_DEAD is only used by INVARIANTS-enabled kernels. Reported and tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_subr.c head/sys/sys/bufobj.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Dec 13 12:14:26 2014 (r275742) +++ head/sys/kern/vfs_subr.c Sat Dec 13 16:02:37 2014 (r275743) @@ -1567,6 +1567,7 @@ buf_vlist_add(struct buf *bp, struct buf int error; ASSERT_BO_WLOCKED(bo); + KASSERT((bo->bo_flag & BO_DEAD) == 0, ("dead bo %p", bo)); KASSERT((bp->b_xflags & (BX_VNDIRTY|BX_VNCLEAN)) == 0, ("buf_vlist_add: Buf %p has existing xflags %d", bp, bp->b_xflags)); bp->b_xflags |= xflags; @@ -2803,16 +2804,6 @@ vgonel(struct vnode *vp) vfs_notify_upper(vp, VFS_NOTIFY_UPPER_RECLAIM); /* - * Clean out any buffers associated with the vnode. - * If the flush fails, just toss the buffers. - */ - mp = NULL; - if (!TAILQ_EMPTY(&vp->v_bufobj.bo_dirty.bv_hd)) - (void) vn_start_secondary_write(vp, &mp, V_WAIT); - if (vinvalbuf(vp, V_SAVE, 0, 0) != 0) - vinvalbuf(vp, 0, 0, 0); - - /* * If purging an active vnode, it must be closed and * deactivated before being reclaimed. */ @@ -2826,6 +2817,29 @@ vgonel(struct vnode *vp) } if (vp->v_type == VSOCK) vfs_unp_reclaim(vp); + + /* + * Clean out any buffers associated with the vnode. + * If the flush fails, just toss the buffers. + */ + mp = NULL; + if (!TAILQ_EMPTY(&vp->v_bufobj.bo_dirty.bv_hd)) + (void) vn_start_secondary_write(vp, &mp, V_WAIT); + if (vinvalbuf(vp, V_SAVE, 0, 0) != 0) { + while (vinvalbuf(vp, 0, 0, 0) != 0) + ; + } +#ifdef INVARIANTS + BO_LOCK(&vp->v_bufobj); + KASSERT(TAILQ_EMPTY(&vp->v_bufobj.bo_dirty.bv_hd) && + vp->v_bufobj.bo_dirty.bv_cnt == 0 && + TAILQ_EMPTY(&vp->v_bufobj.bo_clean.bv_hd) && + vp->v_bufobj.bo_clean.bv_cnt == 0, + ("vp %p bufobj not invalidated", vp)); + vp->v_bufobj.bo_flag |= BO_DEAD; + BO_UNLOCK(&vp->v_bufobj); +#endif + /* * Reclaim the vnode. */ Modified: head/sys/sys/bufobj.h ============================================================================== --- head/sys/sys/bufobj.h Sat Dec 13 12:14:26 2014 (r275742) +++ head/sys/sys/bufobj.h Sat Dec 13 16:02:37 2014 (r275743) @@ -112,6 +112,7 @@ struct bufobj { */ #define BO_ONWORKLST (1 << 0) /* On syncer work-list */ #define BO_WWAIT (1 << 1) /* Wait for output to complete */ +#define BO_DEAD (1 << 2) /* Dead; only with INVARIANTS */ #define BO_LOCKPTR(bo) (&(bo)->bo_lock) #define BO_LOCK(bo) rw_wlock(BO_LOCKPTR((bo))) From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 16:07:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F4299DD; Sat, 13 Dec 2014 16:07:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2239289E; Sat, 13 Dec 2014 16:07:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDG72Ix045597; Sat, 13 Dec 2014 16:07:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDG72ru045596; Sat, 13 Dec 2014 16:07:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412131607.sBDG72ru045596@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 13 Dec 2014 16:07:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275744 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 16:07:02 -0000 Author: kib Date: Sat Dec 13 16:07:01 2014 New Revision: 275744 URL: https://svnweb.freebsd.org/changeset/base/275744 Log: Only sleep interruptible while waiting for suspension end when filesystem specified VFCF_SBDRY flag, i.e. for NFS. There are two issues with the sleeps. First, applications may get unexpected EINTR from the disk i/o syscalls. Second, interruptible sleep allows the stop of the process, and since mount point is referenced while thread sleeps, unmount cannot free mount point structure' memory, blocking unmount indefinitely. Even for NFS, it is probably only reasonable to enable PCATCH for intr mounts, but this information is currently not available at VFS level. Reported and tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sat Dec 13 16:02:37 2014 (r275743) +++ head/sys/kern/vfs_vnops.c Sat Dec 13 16:07:01 2014 (r275744) @@ -1600,7 +1600,7 @@ vn_suspendable(struct vnode *vp, struct static int vn_start_write_locked(struct mount *mp, int flags) { - int error; + int error, mflags; mtx_assert(MNT_MTX(mp), MA_OWNED); error = 0; @@ -1610,13 +1610,15 @@ vn_start_write_locked(struct mount *mp, */ if ((curthread->td_pflags & TDP_IGNSUSP) == 0 || mp->mnt_susp_owner != curthread) { + mflags = ((mp->mnt_vfc->vfc_flags & VFCF_SBDRY) != 0 ? + (flags & PCATCH) : 0) | (PUSER - 1); while ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { if (flags & V_NOWAIT) { error = EWOULDBLOCK; goto unlock; } - error = msleep(&mp->mnt_flag, MNT_MTX(mp), - (PUSER - 1) | (flags & PCATCH), "suspfs", 0); + error = msleep(&mp->mnt_flag, MNT_MTX(mp), mflags, + "suspfs", 0); if (error) goto unlock; } @@ -1732,8 +1734,9 @@ vn_start_secondary_write(vp, mpp, flags) /* * Wait for the suspension to finish. */ - error = msleep(&mp->mnt_flag, MNT_MTX(mp), - (PUSER - 1) | (flags & PCATCH) | PDROP, "suspfs", 0); + error = msleep(&mp->mnt_flag, MNT_MTX(mp), (PUSER - 1) | PDROP | + ((mp->mnt_vfc->vfc_flags & VFCF_SBDRY) != 0 ? (flags & PCATCH) : 0), + "suspfs", 0); vfs_rel(mp); if (error == 0) goto retry; From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 16:18:33 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3E1ACBE2; Sat, 13 Dec 2014 16:18:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2871195D; Sat, 13 Dec 2014 16:18:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDGIXkh050733; Sat, 13 Dec 2014 16:18:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDGIUYK050710; Sat, 13 Dec 2014 16:18:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201412131618.sBDGIUYK050710@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 13 Dec 2014 16:18:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275745 - in head: bin/ps sys/kern sys/rpc sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 16:18:33 -0000 Author: kib Date: Sat Dec 13 16:18:29 2014 New Revision: 275745 URL: https://svnweb.freebsd.org/changeset/base/275745 Log: Add facility to stop all userspace processes. The supposed use of the feature is to quisce the system before suspend. Stop is implemented by reusing the thread_single(9) with the special mode SINGLE_ALLPROC. SINGLE_ALLPROC differs from the existing single-threading modes by allowing (requiring) caller to operate on other process. Interruptible sleeps for !TDF_SBDRY threads are suspended like SIGSTOP does it, instead of aborting the sleep, like SINGLE_NO_EXIT, to avoid spurious EINTRs on resume. Provide debugging sysctl debug.stop_all_proc, which causes total stop and suspends syncer, while waiting for variable reset for resume. It is used for debugging; should be removed after the real use of the interface is added. In collaboration with: pho Discussed with: avg Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/bin/ps/ps.1 head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_proc.c head/sys/kern/kern_sig.c head/sys/kern/kern_thread.c head/sys/rpc/svc.c head/sys/sys/proc.h Modified: head/bin/ps/ps.1 ============================================================================== --- head/bin/ps/ps.1 Sat Dec 13 16:07:01 2014 (r275744) +++ head/bin/ps/ps.1 Sat Dec 13 16:18:29 2014 (r275745) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd August 27, 2014 +.Dd December 9, 2014 .Dt PS 1 .Os .Sh NAME @@ -332,6 +332,7 @@ the include file .It Dv "P_SINGLE_BOUNDARY" Ta No "0x400000" Ta "Threads should suspend at user boundary" .It Dv "P_HWPMC" Ta No "0x800000" Ta "Process is using HWPMCs" .It Dv "P_JAILED" Ta No "0x1000000" Ta "Process is in jail" +.It Dv "P_TOTAL_STOP" Ta No "0x2000000" Ta "Stopped for system suspend" .It Dv "P_INEXEC" Ta No "0x4000000" Ta "Process is in execve()" .It Dv "P_STATCHILD" Ta No "0x8000000" Ta "Child process stopped or exited" .It Dv "P_INMEM" Ta No "0x10000000" Ta "Loaded into memory" Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Sat Dec 13 16:07:01 2014 (r275744) +++ head/sys/kern/kern_exec.c Sat Dec 13 16:18:29 2014 (r275745) @@ -289,7 +289,7 @@ kern_execve(td, args, mac_p) args->endp - args->begin_envv); if (p->p_flag & P_HADTHREADS) { PROC_LOCK(p); - if (thread_single(SINGLE_BOUNDARY)) { + if (thread_single(p, SINGLE_BOUNDARY)) { PROC_UNLOCK(p); exec_free_args(args); return (ERESTART); /* Try again later. */ @@ -308,9 +308,9 @@ kern_execve(td, args, mac_p) * force other threads to suicide. */ if (error == 0) - thread_single(SINGLE_EXIT); + thread_single(p, SINGLE_EXIT); else - thread_single_end(); + thread_single_end(p, SINGLE_BOUNDARY); PROC_UNLOCK(p); } if ((td->td_pflags & TDP_EXECVMSPC) != 0) { Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Sat Dec 13 16:07:01 2014 (r275744) +++ head/sys/kern/kern_exit.c Sat Dec 13 16:18:29 2014 (r275745) @@ -207,7 +207,7 @@ exit1(struct thread *td, int rv) * re-check all suspension request, the thread should * either be suspended there or exit. */ - if (!thread_single(SINGLE_EXIT)) + if (!thread_single(p, SINGLE_EXIT)) /* * All other activity in this process is now * stopped. Threading support has been turned Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Sat Dec 13 16:07:01 2014 (r275744) +++ head/sys/kern/kern_fork.c Sat Dec 13 16:18:29 2014 (r275745) @@ -317,7 +317,7 @@ fork_norfproc(struct thread *td, int fla if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) && (flags & (RFCFDG | RFFDG))) { PROC_LOCK(p1); - if (thread_single(SINGLE_BOUNDARY)) { + if (thread_single(p1, SINGLE_BOUNDARY)) { PROC_UNLOCK(p1); return (ERESTART); } @@ -348,7 +348,7 @@ fail: if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) && (flags & (RFCFDG | RFFDG))) { PROC_LOCK(p1); - thread_single_end(); + thread_single_end(p1, SINGLE_BOUNDARY); PROC_UNLOCK(p1); } return (error); @@ -384,6 +384,7 @@ do_fork(struct thread *td, int flags, st p2->p_pid = trypid; AUDIT_ARG_PID(p2->p_pid); LIST_INSERT_HEAD(&allproc, p2, p_list); + allproc_gen++; LIST_INSERT_HEAD(PIDHASH(p2->p_pid), p2, p_hash); tidhash_add(td2); PROC_LOCK(p2); Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sat Dec 13 16:07:01 2014 (r275744) +++ head/sys/kern/kern_proc.c Sat Dec 13 16:18:29 2014 (r275745) @@ -2896,3 +2896,141 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC static SYSCTL_NODE(_kern_proc, KERN_PROC_SIGTRAMP, sigtramp, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_kern_proc_sigtramp, "Process signal trampoline location"); + +int allproc_gen; + +void +stop_all_proc(void) +{ + struct proc *cp, *p; + int r, gen; + bool restart, seen_stopped, seen_exiting, stopped_some; + + cp = curproc; + /* + * stop_all_proc() assumes that all process which have + * usermode must be stopped, except current process, for + * obvious reasons. Since other threads in the process + * establishing global stop could unstop something, disable + * calls from multithreaded processes as precaution. The + * service must not be user-callable anyway. + */ + KASSERT((cp->p_flag & P_HADTHREADS) == 0 || + (cp->p_flag & P_KTHREAD) != 0, ("mt stop_all_proc")); + +allproc_loop: + sx_xlock(&allproc_lock); + gen = allproc_gen; + seen_exiting = seen_stopped = stopped_some = restart = false; + LIST_REMOVE(cp, p_list); + LIST_INSERT_HEAD(&allproc, cp, p_list); + for (;;) { + p = LIST_NEXT(cp, p_list); + if (p == NULL) + break; + LIST_REMOVE(cp, p_list); + LIST_INSERT_AFTER(p, cp, p_list); + PROC_LOCK(p); + if ((p->p_flag & (P_KTHREAD | P_SYSTEM | + P_TOTAL_STOP)) != 0) { + PROC_UNLOCK(p); + continue; + } + if ((p->p_flag & P_WEXIT) != 0) { + seen_exiting = true; + PROC_UNLOCK(p); + continue; + } + if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { + /* + * Stopped processes are tolerated when there + * are no other processes which might continue + * them. P_STOPPED_SINGLE but not + * P_TOTAL_STOP process still has at least one + * thread running. + */ + seen_stopped = true; + PROC_UNLOCK(p); + continue; + } + _PHOLD(p); + sx_xunlock(&allproc_lock); + r = thread_single(p, SINGLE_ALLPROC); + if (r != 0) + restart = true; + else + stopped_some = true; + _PRELE(p); + PROC_UNLOCK(p); + sx_xlock(&allproc_lock); + } + /* Catch forked children we did not see in iteration. */ + if (gen != allproc_gen) + restart = true; + sx_xunlock(&allproc_lock); + if (restart || stopped_some || seen_exiting || seen_stopped) { + kern_yield(PRI_USER); + goto allproc_loop; + } +} + +void +resume_all_proc(void) +{ + struct proc *cp, *p; + + cp = curproc; + sx_xlock(&allproc_lock); + LIST_REMOVE(cp, p_list); + LIST_INSERT_HEAD(&allproc, cp, p_list); + for (;;) { + p = LIST_NEXT(cp, p_list); + if (p == NULL) + break; + LIST_REMOVE(cp, p_list); + LIST_INSERT_AFTER(p, cp, p_list); + PROC_LOCK(p); + if ((p->p_flag & P_TOTAL_STOP) != 0) { + sx_xunlock(&allproc_lock); + _PHOLD(p); + thread_single_end(p, SINGLE_ALLPROC); + _PRELE(p); + PROC_UNLOCK(p); + sx_xlock(&allproc_lock); + } else { + PROC_UNLOCK(p); + } + } + sx_xunlock(&allproc_lock); +} + +#define TOTAL_STOP_DEBUG 1 +#ifdef TOTAL_STOP_DEBUG +volatile static int ap_resume; +#include + +static int +sysctl_debug_stop_all_proc(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = 0; + ap_resume = 0; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (val != 0) { + stop_all_proc(); + syncer_suspend(); + while (ap_resume == 0) + ; + syncer_resume(); + resume_all_proc(); + } + return (0); +} + +SYSCTL_PROC(_debug, OID_AUTO, stop_all_proc, CTLTYPE_INT | CTLFLAG_RW | + CTLFLAG_MPSAFE, (void *)&ap_resume, 0, sysctl_debug_stop_all_proc, "I", + ""); +#endif Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sat Dec 13 16:07:01 2014 (r275744) +++ head/sys/kern/kern_sig.c Sat Dec 13 16:18:29 2014 (r275745) @@ -2491,7 +2491,7 @@ ptracestop(struct thread *td, int sig) cv_broadcast(&p->p_dbgwait); } stopme: - thread_suspend_switch(td); + thread_suspend_switch(td, p); if (p->p_xthread == td) p->p_xthread = NULL; if (!(p->p_flag & P_TRACED)) @@ -2752,7 +2752,7 @@ issignal(struct thread *td) p->p_xstat = sig; PROC_SLOCK(p); sig_suspend_threads(td, p, 0); - thread_suspend_switch(td); + thread_suspend_switch(td, p); PROC_SUNLOCK(p); mtx_lock(&ps->ps_mtx); break; @@ -2933,7 +2933,7 @@ sigexit(td, sig) * XXX If another thread attempts to single-thread before us * (e.g. via fork()), we won't get a dump at all. */ - if ((sigprop(sig) & SA_CORE) && (thread_single(SINGLE_NO_EXIT) == 0)) { + if ((sigprop(sig) & SA_CORE) && thread_single(p, SINGLE_NO_EXIT) == 0) { p->p_sig = sig; /* * Log signals which would cause core dumps Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sat Dec 13 16:07:01 2014 (r275744) +++ head/sys/kern/kern_thread.c Sat Dec 13 16:18:29 2014 (r275745) @@ -445,7 +445,7 @@ thread_exit(void) if (p->p_numthreads == p->p_suspcount) { thread_lock(p->p_singlethread); wakeup_swapper = thread_unsuspend_one( - p->p_singlethread); + p->p_singlethread, p); thread_unlock(p->p_singlethread); if (wakeup_swapper) kick_proc0(); @@ -576,7 +576,7 @@ calc_remaining(struct proc *p, int mode) remaining = p->p_numthreads; else if (mode == SINGLE_BOUNDARY) remaining = p->p_numthreads - p->p_boundary_count; - else if (mode == SINGLE_NO_EXIT) + else if (mode == SINGLE_NO_EXIT || mode == SINGLE_ALLPROC) remaining = p->p_numthreads - p->p_suspcount; else panic("calc_remaining: wrong mode %d", mode); @@ -587,7 +587,7 @@ static int remain_for_mode(int mode) { - return (1); + return (mode == SINGLE_ALLPROC ? 0 : 1); } static int @@ -603,21 +603,41 @@ weed_inhib(int mode, struct thread *td2, switch (mode) { case SINGLE_EXIT: if (TD_IS_SUSPENDED(td2)) - wakeup_swapper |= thread_unsuspend_one(td2); + wakeup_swapper |= thread_unsuspend_one(td2, p); if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) wakeup_swapper |= sleepq_abort(td2, EINTR); break; case SINGLE_BOUNDARY: if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) - wakeup_swapper |= thread_unsuspend_one(td2); + wakeup_swapper |= thread_unsuspend_one(td2, p); if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) wakeup_swapper |= sleepq_abort(td2, ERESTART); break; case SINGLE_NO_EXIT: if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) - wakeup_swapper |= thread_unsuspend_one(td2); + wakeup_swapper |= thread_unsuspend_one(td2, p); if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) wakeup_swapper |= sleepq_abort(td2, ERESTART); + case SINGLE_ALLPROC: + /* + * ALLPROC suspend tries to avoid spurious EINTR for + * threads sleeping interruptable, by suspending the + * thread directly, similarly to sig_suspend_threads(). + * Since such sleep is not performed at the user + * boundary, TDF_BOUNDARY flag is not set, and TDF_ALLPROCSUSP + * is used to avoid immediate un-suspend. + */ + if (TD_IS_SUSPENDED(td2) && (td2->td_flags & (TDF_BOUNDARY | + TDF_ALLPROCSUSP)) == 0) + wakeup_swapper |= thread_unsuspend_one(td2, p); + if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) { + if ((td2->td_flags & TDF_SBDRY) == 0) { + thread_suspend_one(td2); + td2->td_flags |= TDF_ALLPROCSUSP; + } else { + wakeup_swapper |= sleepq_abort(td2, ERESTART); + } + } break; } return (wakeup_swapper); @@ -637,19 +657,29 @@ weed_inhib(int mode, struct thread *td2, * any sleeping threads that are interruptable. (PCATCH). */ int -thread_single(int mode) +thread_single(struct proc *p, int mode) { struct thread *td; struct thread *td2; - struct proc *p; int remaining, wakeup_swapper; td = curthread; - p = td->td_proc; + KASSERT(mode == SINGLE_EXIT || mode == SINGLE_BOUNDARY || + mode == SINGLE_ALLPROC || mode == SINGLE_NO_EXIT, + ("invalid mode %d", mode)); + /* + * If allowing non-ALLPROC singlethreading for non-curproc + * callers, calc_remaining() and remain_for_mode() should be + * adjusted to also account for td->td_proc != p. For now + * this is not implemented because it is not used. + */ + KASSERT((mode == SINGLE_ALLPROC && td->td_proc != p) || + (mode != SINGLE_ALLPROC && td->td_proc == p), + ("mode %d proc %p curproc %p", mode, p, td->td_proc)); mtx_assert(&Giant, MA_NOTOWNED); PROC_LOCK_ASSERT(p, MA_OWNED); - if ((p->p_flag & P_HADTHREADS) == 0) + if ((p->p_flag & P_HADTHREADS) == 0 && mode != SINGLE_ALLPROC) return (0); /* Is someone already single threading? */ @@ -666,6 +696,8 @@ thread_single(int mode) else p->p_flag &= ~P_SINGLE_BOUNDARY; } + if (mode == SINGLE_ALLPROC) + p->p_flag |= P_TOTAL_STOP; p->p_flag |= P_STOPPED_SINGLE; PROC_SLOCK(p); p->p_singlethread = td; @@ -679,13 +711,13 @@ thread_single(int mode) continue; thread_lock(td2); td2->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; - if (TD_IS_INHIBITED(td2)) + if (TD_IS_INHIBITED(td2)) { wakeup_swapper |= weed_inhib(mode, td2, p); #ifdef SMP - else if (TD_IS_RUNNING(td2) && td != td2) { + } else if (TD_IS_RUNNING(td2) && td != td2) { forward_signal(td2); - } #endif + } thread_unlock(td2); } if (wakeup_swapper) @@ -703,7 +735,7 @@ stopme: * Wake us up when everyone else has suspended. * In the mean time we suspend as well. */ - thread_suspend_switch(td); + thread_suspend_switch(td, p); remaining = calc_remaining(p, mode); } if (mode == SINGLE_EXIT) { @@ -813,8 +845,9 @@ thread_suspend_check(int return_instead) * Ignore suspend requests for stop signals if they * are deferred. */ - if (P_SHOULDSTOP(p) == P_STOPPED_SIG && - td->td_flags & TDF_SBDRY) { + if ((P_SHOULDSTOP(p) == P_STOPPED_SIG || + (p->p_flag & P_TOTAL_STOP) != 0) && + (td->td_flags & TDF_SBDRY) != 0) { KASSERT(return_instead, ("TDF_SBDRY set for unsafe thread_suspend_check")); return (0); @@ -841,7 +874,7 @@ thread_suspend_check(int return_instead) if (p->p_numthreads == p->p_suspcount + 1) { thread_lock(p->p_singlethread); wakeup_swapper = - thread_unsuspend_one(p->p_singlethread); + thread_unsuspend_one(p->p_singlethread, p); thread_unlock(p->p_singlethread); if (wakeup_swapper) kick_proc0(); @@ -874,11 +907,9 @@ thread_suspend_check(int return_instead) } void -thread_suspend_switch(struct thread *td) +thread_suspend_switch(struct thread *td, struct proc *p) { - struct proc *p; - p = td->td_proc; KASSERT(!TD_IS_SUSPENDED(td), ("already suspended")); PROC_LOCK_ASSERT(p, MA_OWNED); PROC_SLOCK_ASSERT(p, MA_OWNED); @@ -886,8 +917,10 @@ thread_suspend_switch(struct thread *td) * We implement thread_suspend_one in stages here to avoid * dropping the proc lock while the thread lock is owned. */ - thread_stopped(p); - p->p_suspcount++; + if (p == td->td_proc) { + thread_stopped(p); + p->p_suspcount++; + } PROC_UNLOCK(p); thread_lock(td); td->td_flags &= ~TDF_NEEDSUSPCHK; @@ -905,8 +938,9 @@ thread_suspend_switch(struct thread *td) void thread_suspend_one(struct thread *td) { - struct proc *p = td->td_proc; + struct proc *p; + p = td->td_proc; PROC_SLOCK_ASSERT(p, MA_OWNED); THREAD_LOCK_ASSERT(td, MA_OWNED); KASSERT(!TD_IS_SUSPENDED(td), ("already suspended")); @@ -917,15 +951,17 @@ thread_suspend_one(struct thread *td) } int -thread_unsuspend_one(struct thread *td) +thread_unsuspend_one(struct thread *td, struct proc *p) { - struct proc *p = td->td_proc; - PROC_SLOCK_ASSERT(p, MA_OWNED); THREAD_LOCK_ASSERT(td, MA_OWNED); KASSERT(TD_IS_SUSPENDED(td), ("Thread not suspended")); TD_CLR_SUSPENDED(td); - p->p_suspcount--; + td->td_flags &= ~TDF_ALLPROCSUSP; + if (td->td_proc == p) { + PROC_SLOCK_ASSERT(p, MA_OWNED); + p->p_suspcount--; + } return (setrunnable(td)); } @@ -945,7 +981,7 @@ thread_unsuspend(struct proc *p) FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); if (TD_IS_SUSPENDED(td)) { - wakeup_swapper |= thread_unsuspend_one(td); + wakeup_swapper |= thread_unsuspend_one(td, p); } thread_unlock(td); } @@ -956,9 +992,12 @@ thread_unsuspend(struct proc *p) * threading request. Now we've downgraded to single-threaded, * let it continue. */ - thread_lock(p->p_singlethread); - wakeup_swapper = thread_unsuspend_one(p->p_singlethread); - thread_unlock(p->p_singlethread); + if (p->p_singlethread->td_proc == p) { + thread_lock(p->p_singlethread); + wakeup_swapper = thread_unsuspend_one( + p->p_singlethread, p); + thread_unlock(p->p_singlethread); + } } if (wakeup_swapper) kick_proc0(); @@ -968,15 +1007,20 @@ thread_unsuspend(struct proc *p) * End the single threading mode.. */ void -thread_single_end(void) +thread_single_end(struct proc *p, int mode) { struct thread *td; - struct proc *p; int wakeup_swapper; - p = curproc; + KASSERT(mode == SINGLE_EXIT || mode == SINGLE_BOUNDARY || + mode == SINGLE_ALLPROC || mode == SINGLE_NO_EXIT, + ("invalid mode %d", mode)); PROC_LOCK_ASSERT(p, MA_OWNED); - p->p_flag &= ~(P_STOPPED_SINGLE | P_SINGLE_EXIT | P_SINGLE_BOUNDARY); + KASSERT((mode == SINGLE_ALLPROC && (p->p_flag & P_TOTAL_STOP) != 0) || + (mode != SINGLE_ALLPROC && (p->p_flag & P_TOTAL_STOP) == 0), + ("mode %d does not match P_TOTAL_STOP", mode)); + p->p_flag &= ~(P_STOPPED_SINGLE | P_SINGLE_EXIT | P_SINGLE_BOUNDARY | + P_TOTAL_STOP); PROC_SLOCK(p); p->p_singlethread = NULL; wakeup_swapper = 0; @@ -986,12 +1030,11 @@ thread_single_end(void) * on the process. The single threader must be allowed * to continue however as this is a bad place to stop. */ - if (p->p_numthreads != remain_for_mode(SINGLE_EXIT) && - !P_SHOULDSTOP(p)) { + if (p->p_numthreads != remain_for_mode(mode) && !P_SHOULDSTOP(p)) { FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); if (TD_IS_SUSPENDED(td)) { - wakeup_swapper |= thread_unsuspend_one(td); + wakeup_swapper |= thread_unsuspend_one(td, p); } thread_unlock(td); } Modified: head/sys/rpc/svc.c ============================================================================== --- head/sys/rpc/svc.c Sat Dec 13 16:07:01 2014 (r275744) +++ head/sys/rpc/svc.c Sat Dec 13 16:18:29 2014 (r275745) @@ -1190,7 +1190,8 @@ svc_run_internal(SVCGROUP *grp, bool_t i mtx_unlock(&grp->sg_lock); p = curproc; PROC_LOCK(p); - if (P_SHOULDSTOP(p)) { + if (P_SHOULDSTOP(p) || + (p->p_flag & P_TOTAL_STOP) != 0) { thread_suspend_check(0); PROC_UNLOCK(p); mtx_lock(&grp->sg_lock); Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sat Dec 13 16:07:01 2014 (r275744) +++ head/sys/sys/proc.h Sat Dec 13 16:18:29 2014 (r275745) @@ -361,7 +361,7 @@ do { \ #define TDF_CANSWAP 0x00000040 /* Thread can be swapped. */ #define TDF_SLEEPABORT 0x00000080 /* sleepq_abort was called. */ #define TDF_KTH_SUSP 0x00000100 /* kthread is suspended */ -#define TDF_UNUSED09 0x00000200 /* --available-- */ +#define TDF_ALLPROCSUSP 0x00000200 /* suspended by SINGLE_ALLPROC */ #define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */ #define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */ #define TDF_TIMOFAIL 0x00001000 /* Timeout from sleep after we were awake. */ @@ -652,7 +652,7 @@ struct proc { #define P_SINGLE_BOUNDARY 0x400000 /* Threads should suspend at user boundary. */ #define P_HWPMC 0x800000 /* Process is using HWPMCs */ #define P_JAILED 0x1000000 /* Process is in jail. */ -#define P_UNUSED1 0x2000000 +#define P_TOTAL_STOP 0x2000000 /* Stopped in proc_stop_total. */ #define P_INEXEC 0x4000000 /* Process is in execve(). */ #define P_STATCHILD 0x8000000 /* Child process stopped or exited. */ #define P_INMEM 0x10000000 /* Loaded into memory. */ @@ -713,6 +713,7 @@ struct proc { #define SINGLE_NO_EXIT 0 #define SINGLE_EXIT 1 #define SINGLE_BOUNDARY 2 +#define SINGLE_ALLPROC 3 #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_PARGS); @@ -839,6 +840,7 @@ extern LIST_HEAD(pgrphashhead, pgrp) *pg extern u_long pgrphash; extern struct sx allproc_lock; +extern int allproc_gen; extern struct sx proctree_lock; extern struct mtx ppeers_lock; extern struct proc proc0; /* Process slot for swapper. */ @@ -962,8 +964,8 @@ void thread_exit(void) __dead2; void thread_free(struct thread *td); void thread_link(struct thread *td, struct proc *p); void thread_reap(void); -int thread_single(int how); -void thread_single_end(void); +int thread_single(struct proc *p, int how); +void thread_single_end(struct proc *p, int how); void thread_stash(struct thread *td); void thread_stopped(struct proc *p); void childproc_stopped(struct proc *child, int reason); @@ -971,14 +973,17 @@ void childproc_continued(struct proc *ch void childproc_exited(struct proc *child); int thread_suspend_check(int how); bool thread_suspend_check_needed(void); -void thread_suspend_switch(struct thread *); +void thread_suspend_switch(struct thread *, struct proc *p); void thread_suspend_one(struct thread *td); void thread_unlink(struct thread *td); void thread_unsuspend(struct proc *p); -int thread_unsuspend_one(struct thread *td); +int thread_unsuspend_one(struct thread *td, struct proc *p); void thread_wait(struct proc *p); struct thread *thread_find(struct proc *p, lwpid_t tid); +void stop_all_proc(void); +void resume_all_proc(void); + static __inline int curthread_pflags_set(int flags) { From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 17:14:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 87A257DC; Sat, 13 Dec 2014 17:14:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 733FFE36; Sat, 13 Dec 2014 17:14:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDHEaX7080029; Sat, 13 Dec 2014 17:14:36 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDHEaVB080028; Sat, 13 Dec 2014 17:14:36 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201412131714.sBDHEaVB080028@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 13 Dec 2014 17:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275746 - head/usr.sbin/autofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 17:14:36 -0000 Author: trasz Date: Sat Dec 13 17:14:35 2014 New Revision: 275746 URL: https://svnweb.freebsd.org/changeset/base/275746 Log: Fix markup. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/autofs/autounmountd.8 Modified: head/usr.sbin/autofs/autounmountd.8 ============================================================================== --- head/usr.sbin/autofs/autounmountd.8 Sat Dec 13 16:18:29 2014 (r275745) +++ head/usr.sbin/autofs/autounmountd.8 Sat Dec 13 17:14:35 2014 (r275746) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 20, 2014 +.Dd December 13, 2014 .Dt AUTOUNMOUNTD 8 .Os .Sh NAME @@ -36,8 +36,8 @@ .Sh SYNOPSIS .Nm .Op Fl d -.Op Fl r time -.Op Fl t time +.Op Fl r Ar time +.Op Fl t Ar time .Op Fl v .Sh DESCRIPTION The From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 18:54:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7758EE78; Sat, 13 Dec 2014 18:54:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 610AD98C; Sat, 13 Dec 2014 18:54:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDIsloP030513; Sat, 13 Dec 2014 18:54:47 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDIslko030511; Sat, 13 Dec 2014 18:54:47 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412131854.sBDIslko030511@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Dec 2014 18:54:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275747 - head/contrib/llvm/patches X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 18:54:47 -0000 Author: dim Date: Sat Dec 13 18:54:46 2014 New Revision: 275747 URL: https://svnweb.freebsd.org/changeset/base/275747 Log: Update llvm patches for r274286 and r275633 so all the tests will pass. Modified: head/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff Modified: head/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff ============================================================================== --- head/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff Sat Dec 13 17:14:35 2014 (r275746) +++ head/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff Sat Dec 13 18:54:46 2014 (r275747) @@ -1,3 +1,14 @@ +Pull in r200383 from upstream llvm trunk (by David Majnemer): + + MC: Reorganize macro MC test along dialect lines + + This commit seeks to do two things: + - Run the surfeit of tests under the Darwin dialect. This ends up + affecting tests which assumed that spaces could deliminate arguments. + - The GAS dialect tests should limit their surface area to things that + could plausibly work under GAS. For example, Darwin style arguments + have no business being in such a test. + Pull in r201784 from upstream llvm trunk (by Benjamin Kramer): AsmParser: Disable Darwin-style macro argument expansion on non-darwin targets. @@ -53,3 +64,208 @@ Index: test/MC/AsmParser/exprs.s .macro check_expr .if ($0) != ($1) +Index: test/MC/AsmParser/macros.s (deleted) +=================================================================== +Index: test/MC/AsmParser/macros-darwin.s +=================================================================== +--- test/MC/AsmParser/macros-darwin.s ++++ test/MC/AsmParser/macros-darwin.s +@@ -1,9 +1,97 @@ +-// RUN: llvm-mc -triple i386-apple-darwin10 %s | FileCheck %s ++// RUN: not llvm-mc -triple i386-apple-darwin10 %s 2> %t.err | FileCheck %s ++// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err + +-.macro test1 ++.macro .test0 ++.macrobody0 ++.endmacro ++.macro .test1 ++.test0 ++.endmacro ++ ++.test1 ++// CHECK-ERRORS: :1:1: error: unknown directive ++// CHECK-ERRORS-NEXT: macrobody0 ++// CHECK-ERRORS-NEXT: ^ ++// CHECK-ERRORS: :1:1: note: while in macro instantiation ++// CHECK-ERRORS-NEXT: .test0 ++// CHECK-ERRORS-NEXT: ^ ++// CHECK-ERRORS: 11:1: note: while in macro instantiation ++// CHECK-ERRORS-NEXT: .test1 ++// CHECK-ERRORS-NEXT: ^ ++ ++.macro test2 ++.byte $0 ++.endmacro ++// CHECK: .byte 10 ++test2 10 ++ ++.macro test3 + .globl "$0 $1 $2 $$3 $n" + .endmacro + + // CHECK: .globl "1 23 $3 2" +-test1 1, 2 3 ++test3 1, 2 3 + ++// CHECK: .globl "1 (23) $3 2" ++test3 1, (2 3) ++ ++// CHECK: .globl "12 $3 1" ++test3 1 2 ++ ++.macro test4 ++.globl "$0 -- $1" ++.endmacro ++ ++// CHECK: .globl "(ab)(,)) -- (cd)" ++test4 (a b)(,)),(cd) ++ ++// CHECK: .globl "(ab)(,)) -- (cd)" ++test4 (a b)(,)),(cd) ++ ++.macro test5 _a ++.globl "\_a" ++.endm ++ ++// CHECK: .globl zed1 ++test5 zed1 ++ ++.macro test6 $a ++.globl "\$a" ++.endm ++ ++// CHECK: .globl zed2 ++test6 zed2 ++ ++.macro test7 .a ++.globl "\.a" ++.endm ++ ++// CHECK: .globl zed3 ++test7 zed3 ++ ++.macro test8 _a, _b, _c ++.globl "\_a,\_b,\_c" ++.endmacro ++ ++.macro test9 _a _b _c ++.globl "\_a \_b \_c" ++.endmacro ++ ++// CHECK: .globl "a,b,c" ++test8 a, b, c ++// CHECK: .globl "%1,%2,%3" ++test8 %1, %2, %3 #a comment ++// CHECK: .globl "x-y,z,1" ++test8 x - y, z, 1 ++// CHECK: .globl "1 2 3" ++test9 1, 2,3 ++ ++test8 1,2 3 ++// CHECK-ERRORS: error: macro argument '_c' is missing ++// CHECK-ERRORS-NEXT: test8 1,2 3 ++// CHECK-ERRORS-NEXT: ^ ++ ++test8 1 2, 3 ++// CHECK-ERRORS: error: macro argument '_c' is missing ++// CHECK-ERRORS-NEXT:test8 1 2, 3 ++// CHECK-ERRORS-NEXT: ^ +Index: test/MC/AsmParser/macros-gas.s +=================================================================== +--- test/MC/AsmParser/macros-gas.s ++++ test/MC/AsmParser/macros-gas.s +@@ -0,0 +1,93 @@ ++// RUN: not llvm-mc -triple i386-linux-gnu %s 2> %t.err | FileCheck %s ++// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err ++ ++.macro .test0 ++.macrobody0 ++.endm ++.macro .test1 ++.test0 ++.endm ++ ++.test1 ++// CHECK-ERRORS: :1:1: error: unknown directive ++// CHECK-ERRORS-NEXT: macrobody0 ++// CHECK-ERRORS-NEXT: ^ ++// CHECK-ERRORS: :1:1: note: while in macro instantiation ++// CHECK-ERRORS-NEXT: .test0 ++// CHECK-ERRORS-NEXT: ^ ++// CHECK-ERRORS: 11:1: note: while in macro instantiation ++// CHECK-ERRORS-NEXT: .test1 ++// CHECK-ERRORS-NEXT: ^ ++ ++.macro test2 _a ++.byte \_a ++.endm ++// CHECK: .byte 10 ++test2 10 ++ ++.macro test3 _a _b _c ++.ascii "\_a \_b \_c \\_c" ++.endm ++ ++// CHECK: .ascii "1 2 3 \003" ++test3 1, 2, 3 ++ ++// FIXME: test3 1, 2 3 should be treated like test 1, 2, 3 ++ ++// FIXME: remove the n argument from the remaining test3 examples ++// CHECK: .ascii "1 (23) n \n" ++test3 1, (2 3), n ++ ++// CHECK: .ascii "1 (23) n \n" ++test3 1 (2 3) n ++ ++// CHECK: .ascii "1 2 n \n" ++test3 1 2 n ++ ++.macro test5 _a ++.globl \_a ++.endm ++ ++// CHECK: .globl zed1 ++test5 zed1 ++ ++.macro test6 $a ++.globl \$a ++.endm ++ ++// CHECK: .globl zed2 ++test6 zed2 ++ ++.macro test7 .a ++.globl \.a ++.endm ++ ++// CHECK: .globl zed3 ++test7 zed3 ++ ++.macro test8 _a, _b, _c ++.ascii "\_a,\_b,\_c" ++.endm ++ ++.macro test9 _a _b _c ++.ascii "\_a \_b \_c" ++.endm ++ ++// CHECK: .ascii "a,b,c" ++test8 a, b, c ++// CHECK: .ascii "%1,%2,%3" ++test8 %1 %2 %3 #a comment ++// CHECK: .ascii "x-y,z,1" ++test8 x - y z 1 ++// CHECK: .ascii "1 2 3" ++test9 1, 2,3 ++ ++test8 1,2 3 ++// CHECK-ERRORS: error: macro argument '_c' is missing ++// CHECK-ERRORS-NEXT: test8 1,2 3 ++// CHECK-ERRORS-NEXT: ^ ++ ++test8 1 2, 3 ++// CHECK-ERRORS: error: expected ' ' for macro argument separator ++// CHECK-ERRORS-NEXT:test8 1 2, 3 ++// CHECK-ERRORS-NEXT: ^ Modified: head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff ============================================================================== --- head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff Sat Dec 13 17:14:35 2014 (r275746) +++ head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff Sat Dec 13 18:54:46 2014 (r275747) @@ -1,3 +1,11 @@ +Pull in r223170 from upstream llvm trunk (by Michael Zolotukhin): + + Apply loop-rotate to several vectorizer tests. + + Such loops shouldn't be vectorized due to the loops form. + After applying loop-rotate (+simplifycfg) the tests again start to check + what they are intended to check. + Pull in r223171 from upstream llvm trunk (by Michael Zolotukhin): PR21302. Vectorize only bottom-tested loops. @@ -16,8 +24,8 @@ Introduced here: http://svnweb.freebsd.o Index: lib/Transforms/Vectorize/LoopVectorize.cpp =================================================================== ---- lib/Transforms/Vectorize/LoopVectorize.cpp (revision 21) -+++ lib/Transforms/Vectorize/LoopVectorize.cpp (revision 22) +--- lib/Transforms/Vectorize/LoopVectorize.cpp ++++ lib/Transforms/Vectorize/LoopVectorize.cpp @@ -2864,6 +2864,14 @@ bool LoopVectorizationLegality::canVectorize() { if (!TheLoop->getExitingBlock()) return false; @@ -35,11 +43,11 @@ Index: lib/Transforms/Vectorize/LoopVect TheLoop->getHeader()->getName() << '\n'); Index: test/Transforms/LoopVectorize/loop-form.ll =================================================================== ---- test/Transforms/LoopVectorize/loop-form.ll (revision 0) -+++ test/Transforms/LoopVectorize/loop-form.ll (revision 22) +--- test/Transforms/LoopVectorize/loop-form.ll ++++ test/Transforms/LoopVectorize/loop-form.ll @@ -0,0 +1,31 @@ +; RUN: opt -S -loop-vectorize < %s | FileCheck %s -+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" ++target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128" + +; Check that we vectorize only bottom-tested loops. +; This is a reduced testcase from PR21302. @@ -69,3 +77,453 @@ Index: test/Transforms/LoopVectorize/loo +if.end: + ret void +} +Index: test/Transforms/LoopVectorize/runtime-check-address-space.ll +=================================================================== +--- test/Transforms/LoopVectorize/runtime-check-address-space.ll ++++ test/Transforms/LoopVectorize/runtime-check-address-space.ll +@@ -31,25 +31,23 @@ define void @foo(i32 addrspace(1)* %a, i32 addrspa + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom + %0 = load i32 addrspace(1)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %idxprom1 + store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -60,25 +58,23 @@ define void @bar0(i32* %a, i32 addrspace(1)* %b, i + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom + %0 = load i32 addrspace(1)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32* %a, i64 %idxprom1 + store i32 %mul, i32* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -89,25 +85,23 @@ define void @bar1(i32 addrspace(1)* %a, i32* %b, i + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32* %b, i64 %idxprom + %0 = load i32* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %idxprom1 + store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -119,25 +113,23 @@ define void @bar2(i32* noalias %a, i32 addrspace(1 + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom + %0 = load i32 addrspace(1)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32* %a, i64 %idxprom1 + store i32 %mul, i32* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -149,25 +141,23 @@ define void @arst0(i32* %b, i32 %n) #0 { + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32* %b, i64 %idxprom + %0 = load i32* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom1 + store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -180,25 +170,23 @@ define void @arst1(i32* %b, i32 %n) #0 { + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom + %0 = load i32 addrspace(1)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32* %b, i64 %idxprom1 + store i32 %mul, i32* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -210,25 +198,23 @@ define void @aoeu(i32 %n) #0 { + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds [1024 x i32] addrspace(2)* @q_as2, i64 0, i64 %idxprom + %0 = load i32 addrspace(2)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom1 + store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +Index: test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll +=================================================================== +--- test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll ++++ test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll +@@ -8,26 +8,24 @@ define void @add_ints_1_1_1(i32 addrspace(1)* %a, + ; CHECK-LABEL: @add_ints_1_1_1( + ; CHECK: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 + %0 = load i32 addrspace(1)* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.01 + %1 = load i32 addrspace(1)* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.01 + store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + +@@ -35,26 +33,24 @@ define void @add_ints_as_1_0_0(i32 addrspace(1)* % + ; CHECK-LABEL: @add_ints_as_1_0_0( + ; CHECK-NOT: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32* %b, i64 %i.01 + %0 = load i32* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.01 + %1 = load i32* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.01 + store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + +@@ -62,26 +58,24 @@ define void @add_ints_as_0_1_0(i32* %a, i32 addrsp + ; CHECK-LABEL: @add_ints_as_0_1_0( + ; CHECK-NOT: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 + %0 = load i32 addrspace(1)* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.01 + %1 = load i32* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.01 + store i32 %add, i32* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + +@@ -89,26 +83,24 @@ define void @add_ints_as_0_1_1(i32* %a, i32 addrsp + ; CHECK-LABEL: @add_ints_as_0_1_1( + ; CHECK-NOT: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 + %0 = load i32 addrspace(1)* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.01 + %1 = load i32 addrspace(1)* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.01 + store i32 %add, i32* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + +@@ -116,26 +108,24 @@ define void @add_ints_as_0_1_2(i32* %a, i32 addrsp + ; CHECK-LABEL: @add_ints_as_0_1_2( + ; CHECK-NOT: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 + %0 = load i32 addrspace(1)* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32 addrspace(2)* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32 addrspace(2)* %c, i64 %i.01 + %1 = load i32 addrspace(2)* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.01 + store i32 %add, i32* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 19:13:57 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 56A0348B for ; Sat, 13 Dec 2014 19:13:57 +0000 (UTC) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 011D0B56 for ; Sat, 13 Dec 2014 19:13:56 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id pv20so7690024lab.13 for ; Sat, 13 Dec 2014 11:13:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type; bh=k9nJOV/1xmyo7+jN1or8ohDTeKxDOqKV8Cztk+F3p6E=; b=gKxyrW4FH3z38mY9DpsCvvX4AglCE7sCIWU3E+Zas3jvr4xzKpe60MIT5WZ8leISD7 u5V6AGxkQf97IeJEtXBo1imgNU0vsp5vuouMt7z3zz5jyRK3Kmh+mcHiitpuizpxxB1T D+foV3/n7+U6AsU//WaSJPPuekZ7c4mBJZbgYSJ/B4yXraS9MwS+l1tnX7CdHsaCd9jF Aia1/XlZo8d9Cd6wrv+upuwyXa3G1iF2AFOlEwFqwVSsa0fKxBzgRUdFcmtdqkzGyLEt aeuDqT0wHLrrxAzAGgPPr8rf2kXsHYZfIKlLtLqj+hkYJk7v6lZchjCQ6ss1L3FmdMh2 VxSg== X-Gm-Message-State: ALoCoQl6bc3rK8epRHDtGnEflEo0/8t0BEIU7/lStZWwm2U5hQc+KJhkNyDcikmciVe+6Sjttt9a X-Received: by 10.152.27.100 with SMTP id s4mr1615467lag.87.1418498029069; Sat, 13 Dec 2014 11:13:49 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id wq1sm1361895lbb.24.2014.12.13.11.13.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Dec 2014 11:13:48 -0800 (PST) Message-ID: <548C8FE4.9040500@freebsd.org> Date: Sat, 13 Dec 2014 22:13:40 +0300 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Dimitry Andric Subject: Re: svn commit: r275633 - in head: contrib/llvm/lib/Transforms/Vectorize sys/sys References: <201412090734.sB97YT2X080620@svn.freebsd.org> <548BBDFE.8010302@freebsd.org> <3F1197D0-34C9-4220-B297-1DF14A827F9D@FreeBSD.org> In-Reply-To: <3F1197D0-34C9-4220-B297-1DF14A827F9D@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CPegJONDUIwbcdOVeo5wLah7EbULJrF3U" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 19:13:57 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --CPegJONDUIwbcdOVeo5wLah7EbULJrF3U Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: quoted-printable On 13.12.2014 15:29, Dimitry Andric wrote: > On 13 Dec 2014, at 05:18, Andrey Chernov wrote: >> >> On 09.12.2014 10:34, Dimitry Andric wrote: >>> PR21302. Vectorize only bottom-tested loops. >> ... >>> MFC after: 3 days >> >> Hi. More than 3 days already passed, do you plan to MFC it? >> I have irrational fear to compile anything under -stable until this >> change will be committed) >=20 > Yes, I got the reminder, and merged the change in r275742. I will also= > inform portmgr of the updated __FreeBSD_version values. Thanx! --=20 http://ache.vniz.net/ --CPegJONDUIwbcdOVeo5wLah7EbULJrF3U Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJUjI/rAAoJEKUckv0MjfbKks0H/3ph7qQSZFgY4AjEB5ZR7xt9 SMP/osCI7gbyg/jKUad7Ju1IyM3b574Z8l7bfctrwAApCiKaNFfvg9AO/LRU4ORU e1w7Z1JHX4qQ7V72l6OlCW653INRY0g4BJsg5af1FZi8eXT+dw8M+L2CTcWEL1nB RlbxAI8NaXOTxuWmVtuXlOmKMJehHVlt9DDygVAQ1hJV2fZT6O+cBUrmZLG51LVL NaWWdEo+36nNHY5ZWKoRnLdg95QUTezNy/t/XNH9gcXyTdfVTIOnGpEJYDiuUUHv eeoNxXRzN4HttYTlNmfddKpaSK+ID4ZT+AJhDh+f/Q9i+L/ptrOt4p7w2nEojdA= =ntVi -----END PGP SIGNATURE----- --CPegJONDUIwbcdOVeo5wLah7EbULJrF3U-- From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 19:17:29 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF92059C; Sat, 13 Dec 2014 19:17:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA8E4B7E; Sat, 13 Dec 2014 19:17:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDJHTJi041404; Sat, 13 Dec 2014 19:17:29 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDJHTaU041403; Sat, 13 Dec 2014 19:17:29 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201412131917.sBDJHTaU041403@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 13 Dec 2014 19:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275748 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 19:17:30 -0000 Author: delphij Date: Sat Dec 13 19:17:28 2014 New Revision: 275748 URL: https://svnweb.freebsd.org/changeset/base/275748 Log: MFV r247174: Expose arc_meta_limit, et al via kstats. Note that as a result, vfs.zfs.arc_meta_used is removed. The existing vfs.zfs.arc_meta_limit sysctl/tunable is retained with a SYSCTL_PROC wrapper. Illumos ZFS issues: 3561 arc_meta_limit should be exposed via kstats Relnotes: yes MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Dec 13 18:54:46 2014 (r275747) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Dec 13 19:17:28 2014 (r275748) @@ -205,6 +205,7 @@ uint64_t zfs_arc_average_blocksize = 8 * u_int zfs_arc_free_target = 0; static int sysctl_vfs_zfs_arc_free_target(SYSCTL_HANDLER_ARGS); +static int sysctl_vfs_zfs_arc_meta_limit(SYSCTL_HANDLER_ARGS); #ifdef _KERNEL static void @@ -259,6 +260,15 @@ sysctl_vfs_zfs_arc_free_target(SYSCTL_HA return (0); } + +/* + * Must be declared here, before the definition of corresponding kstat + * macro which uses the same names will confuse the compiler. + */ +SYSCTL_PROC(_vfs_zfs, OID_AUTO, arc_meta_limit, + CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(uint64_t), + sysctl_vfs_zfs_arc_meta_limit, "QU", + "ARC metadata limit"); #endif /* @@ -413,6 +423,9 @@ typedef struct arc_stats { kstat_named_t arcstat_duplicate_buffers; kstat_named_t arcstat_duplicate_buffers_size; kstat_named_t arcstat_duplicate_reads; + kstat_named_t arcstat_meta_used; + kstat_named_t arcstat_meta_limit; + kstat_named_t arcstat_meta_max; } arc_stats_t; static arc_stats_t arc_stats = { @@ -490,7 +503,10 @@ static arc_stats_t arc_stats = { { "memory_throttle_count", KSTAT_DATA_UINT64 }, { "duplicate_buffers", KSTAT_DATA_UINT64 }, { "duplicate_buffers_size", KSTAT_DATA_UINT64 }, - { "duplicate_reads", KSTAT_DATA_UINT64 } + { "duplicate_reads", KSTAT_DATA_UINT64 }, + { "arc_meta_used", KSTAT_DATA_UINT64 }, + { "arc_meta_limit", KSTAT_DATA_UINT64 }, + { "arc_meta_max", KSTAT_DATA_UINT64 } }; #define ARCSTAT(stat) (arc_stats.stat.value.ui64) @@ -552,6 +568,9 @@ static arc_state_t *arc_l2c_only; #define arc_c ARCSTAT(arcstat_c) /* target size of cache */ #define arc_c_min ARCSTAT(arcstat_c_min) /* min target cache size */ #define arc_c_max ARCSTAT(arcstat_c_max) /* max target cache size */ +#define arc_meta_limit ARCSTAT(arcstat_meta_limit) /* max size for metadata */ +#define arc_meta_used ARCSTAT(arcstat_meta_used) /* size of metadata */ +#define arc_meta_max ARCSTAT(arcstat_meta_max) /* max size of metadata */ #define L2ARC_IS_VALID_COMPRESS(_c_) \ ((_c_) == ZIO_COMPRESS_LZ4 || (_c_) == ZIO_COMPRESS_EMPTY) @@ -559,13 +578,6 @@ static arc_state_t *arc_l2c_only; static int arc_no_grow; /* Don't try to grow cache size */ static uint64_t arc_tempreserve; static uint64_t arc_loaned_bytes; -static uint64_t arc_meta_used; -static uint64_t arc_meta_limit; -static uint64_t arc_meta_max = 0; -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_meta_used, CTLFLAG_RD, &arc_meta_used, 0, - "ARC metadata used"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_meta_limit, CTLFLAG_RW, &arc_meta_limit, 0, - "ARC metadata limit"); typedef struct l2arc_buf_hdr l2arc_buf_hdr_t; @@ -626,6 +638,26 @@ struct arc_buf_hdr { list_node_t b_l2node; }; +#ifdef _KERNEL +static int +sysctl_vfs_zfs_arc_meta_limit(SYSCTL_HANDLER_ARGS) +{ + uint64_t val; + int err; + + val = arc_meta_limit; + err = sysctl_handle_64(oidp, &val, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + + if (val <= 0 || val > arc_c_max) + return (EINVAL); + + arc_meta_limit = val; + return (0); +} +#endif + static arc_buf_t *arc_eviction_list; static kmutex_t arc_eviction_mtx; static arc_buf_hdr_t arc_eviction_hdr; @@ -1479,7 +1511,7 @@ arc_space_consume(uint64_t space, arc_sp break; } - atomic_add_64(&arc_meta_used, space); + ARCSTAT_INCR(arcstat_meta_used, space); atomic_add_64(&arc_size, space); } @@ -1506,7 +1538,7 @@ arc_space_return(uint64_t space, arc_spa ASSERT(arc_meta_used >= space); if (arc_meta_max < arc_meta_used) arc_meta_max = arc_meta_used; - atomic_add_64(&arc_meta_used, -space); + ARCSTAT_INCR(arcstat_meta_used, -space); ASSERT(arc_size >= space); atomic_add_64(&arc_size, -space); } From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 21:00:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8BEA1ED6; Sat, 13 Dec 2014 21:00:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D12A789; Sat, 13 Dec 2014 21:00:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDL0Foi094031; Sat, 13 Dec 2014 21:00:15 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDL0BvR094009; Sat, 13 Dec 2014 21:00:11 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201412132100.sBDL0BvR094009@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 13 Dec 2014 21:00:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275751 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 21:00:15 -0000 Author: dchagin Date: Sat Dec 13 21:00:10 2014 New Revision: 275751 URL: https://svnweb.freebsd.org/changeset/base/275751 Log: Add _NEW flag to mtx(9), sx(9), rmlock(9) and rwlock(9). A _NEW flag passed to _init_flags() to avoid check for double-init. Differential Revision: https://reviews.freebsd.org/D1208 Reviewed by: jhb, wblock MFC after: 1 Month Modified: head/share/man/man9/mutex.9 head/share/man/man9/rmlock.9 head/share/man/man9/rwlock.9 head/share/man/man9/sx.9 head/sys/kern/kern_mutex.c head/sys/kern/kern_rmlock.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c head/sys/kern/subr_lock.c head/sys/sys/lock.h head/sys/sys/mutex.h head/sys/sys/rmlock.h head/sys/sys/rwlock.h head/sys/sys/sx.h Modified: head/share/man/man9/mutex.9 ============================================================================== --- head/share/man/man9/mutex.9 Sat Dec 13 20:17:54 2014 (r275750) +++ head/share/man/man9/mutex.9 Sat Dec 13 21:00:10 2014 (r275751) @@ -28,7 +28,7 @@ .\" from BSDI $Id: mutex.4,v 1.1.2.3 1998/04/27 22:53:13 ewv Exp $ .\" $FreeBSD$ .\" -.Dd November 16, 2011 +.Dd December 13, 2014 .Dt MUTEX 9 .Os .Sh NAME @@ -177,13 +177,17 @@ It may contain either or .Dv MTX_SPIN but not both. -See below for additional initialization options. -It is not permissible to pass the same -.Fa mutex -to +If the kernel has been compiled with +.Cd "option INVARIANTS" , .Fn mtx_init -multiple times without intervening calls to -.Fn mtx_destroy . +will assert that the +.Fa mutex +has not been initialized multiple times without intervening calls to +.Fn mtx_destroy +unless the +.Dv MTX_NEW +option is specified. +See below for additional initialization options. .Pp The .Fn mtx_lock @@ -453,6 +457,8 @@ to ignore this lock. Witness should not log messages about duplicate locks being acquired. .It Dv MTX_NOPROFILE Do not profile this lock. +.It Dv MTX_NEW +Do not check for double-init. .El .Ss Lock and Unlock Flags The flags passed to the Modified: head/share/man/man9/rmlock.9 ============================================================================== --- head/share/man/man9/rmlock.9 Sat Dec 13 20:17:54 2014 (r275750) +++ head/share/man/man9/rmlock.9 Sat Dec 13 21:00:10 2014 (r275751) @@ -26,7 +26,7 @@ .\" $FreeBSD$ .\" .\" Based on rwlock.9 man page -.Dd June 25, 2013 +.Dd December 13, 2014 .Dt RMLOCK 9 .Os .Sh NAME @@ -156,6 +156,15 @@ Allow threads to recursively acquire sha .Fa rm . .It Dv RM_SLEEPABLE Create a sleepable read-mostly lock. +.It Dv RM_NEW +If the kernel has been compiled with +.Cd "option INVARIANTS" , +.Fn rm_init_flags +will assert that the +.Fa rm +has not been initialized multiple times without intervening calls to +.Fn rm_destroy +unless this option is specified. .El .It Fn rm_rlock "struct rmlock *rm" "struct rm_priotracker* tracker" Lock Modified: head/share/man/man9/rwlock.9 ============================================================================== --- head/share/man/man9/rwlock.9 Sat Dec 13 20:17:54 2014 (r275750) +++ head/share/man/man9/rwlock.9 Sat Dec 13 21:00:10 2014 (r275751) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 20, 2013 +.Dd December 13, 2014 .Dt RWLOCK 9 .Os .Sh NAME @@ -154,6 +154,15 @@ Do not log any operations for this lock .It Dv RW_RECURSE Allow threads to recursively acquire exclusive locks for .Fa rw . +.It Dv RW_NEW +If the kernel has been compiled with +.Cd "option INVARIANTS" , +.Fn rw_init_flags +will assert that the +.Fa rw +has not been initialized multiple times without intervening calls to +.Fn rw_destroy +unless this option is specified. .El .It Fn rw_rlock "struct rwlock *rw" Lock Modified: head/share/man/man9/sx.9 ============================================================================== --- head/share/man/man9/sx.9 Sat Dec 13 20:17:54 2014 (r275750) +++ head/share/man/man9/sx.9 Sat Dec 13 21:00:10 2014 (r275751) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 16, 2011 +.Dd December 13, 2014 .Dt SX 9 .Os .Sh NAME @@ -144,6 +144,15 @@ Allow threads to recursively acquire exc .It Dv SX_QUIET Do not log any operations for this lock via .Xr ktr 4 . +.It Dv SX_NEW +If the kernel has been compiled with +.Cd "options INVARIANTS" , +.Fn sx_init +will assert that the +.Fa sx +has not been initialized multiple times without intervening calls to +.Fn sx_destroy +unless this option is specified. .El .Pp Shared/exclusive locks are destroyed with Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/kern/kern_mutex.c Sat Dec 13 21:00:10 2014 (r275751) @@ -881,7 +881,7 @@ _mtx_init(volatile uintptr_t *c, const c m = mtxlock2mtx(c); MPASS((opts & ~(MTX_SPIN | MTX_QUIET | MTX_RECURSE | - MTX_NOWITNESS | MTX_DUPOK | MTX_NOPROFILE)) == 0); + MTX_NOWITNESS | MTX_DUPOK | MTX_NOPROFILE | MTX_NEW)) == 0); ASSERT_ATOMIC_LOAD_PTR(m->mtx_lock, ("%s: mtx_lock not aligned for %s: %p", __func__, name, &m->mtx_lock)); @@ -907,6 +907,8 @@ _mtx_init(volatile uintptr_t *c, const c flags |= LO_DUPOK; if (opts & MTX_NOPROFILE) flags |= LO_NOPROFILE; + if (opts & MTX_NEW) + flags |= LO_NEW; /* Initialize mutex. */ lock_init(&m->lock_object, class, name, type, flags); Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/kern/kern_rmlock.c Sat Dec 13 21:00:10 2014 (r275751) @@ -277,22 +277,28 @@ void rm_init_flags(struct rmlock *rm, const char *name, int opts) { struct lock_class *lc; - int liflags; + int liflags, xflags; liflags = 0; if (!(opts & RM_NOWITNESS)) liflags |= LO_WITNESS; if (opts & RM_RECURSE) liflags |= LO_RECURSABLE; + if (opts & RM_NEW) + liflags |= LO_NEW; rm->rm_writecpus = all_cpus; LIST_INIT(&rm->rm_activeReaders); if (opts & RM_SLEEPABLE) { liflags |= LO_SLEEPABLE; lc = &lock_class_rm_sleepable; - sx_init_flags(&rm->rm_lock_sx, "rmlock_sx", SX_NOWITNESS); + xflags = (opts & RM_NEW ? SX_NEW : 0); + sx_init_flags(&rm->rm_lock_sx, "rmlock_sx", + xflags | SX_NOWITNESS); } else { lc = &lock_class_rm; - mtx_init(&rm->rm_lock_mtx, name, "rmlock_mtx", MTX_NOWITNESS); + xflags = (opts & RM_NEW ? MTX_NEW : 0); + mtx_init(&rm->rm_lock_mtx, name, "rmlock_mtx", + xflags | MTX_NOWITNESS); } lock_init(&rm->lock_object, lc, name, NULL, liflags); } Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/kern/kern_rwlock.c Sat Dec 13 21:00:10 2014 (r275751) @@ -187,7 +187,7 @@ _rw_init_flags(volatile uintptr_t *c, co rw = rwlock2rw(c); MPASS((opts & ~(RW_DUPOK | RW_NOPROFILE | RW_NOWITNESS | RW_QUIET | - RW_RECURSE)) == 0); + RW_RECURSE | RW_NEW)) == 0); ASSERT_ATOMIC_LOAD_PTR(rw->rw_lock, ("%s: rw_lock not aligned for %s: %p", __func__, name, &rw->rw_lock)); @@ -203,6 +203,8 @@ _rw_init_flags(volatile uintptr_t *c, co flags |= LO_RECURSABLE; if (opts & RW_QUIET) flags |= LO_QUIET; + if (opts & RW_NEW) + flags |= LO_NEW; lock_init(&rw->lock_object, &lock_class_rw, name, NULL, flags); rw->rw_lock = RW_UNLOCKED; Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/kern/kern_sx.c Sat Dec 13 21:00:10 2014 (r275751) @@ -209,7 +209,7 @@ sx_init_flags(struct sx *sx, const char int flags; MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK | - SX_NOPROFILE | SX_NOADAPTIVE)) == 0); + SX_NOPROFILE | SX_NOADAPTIVE | SX_NEW)) == 0); ASSERT_ATOMIC_LOAD_PTR(sx->sx_lock, ("%s: sx_lock not aligned for %s: %p", __func__, description, &sx->sx_lock)); @@ -225,6 +225,8 @@ sx_init_flags(struct sx *sx, const char flags |= LO_RECURSABLE; if (opts & SX_QUIET) flags |= LO_QUIET; + if (opts & SX_NEW) + flags |= LO_NEW; flags |= opts & SX_NOADAPTIVE; lock_init(&sx->lock_object, &lock_class_sx, description, NULL, flags); Modified: head/sys/kern/subr_lock.c ============================================================================== --- head/sys/kern/subr_lock.c Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/kern/subr_lock.c Sat Dec 13 21:00:10 2014 (r275751) @@ -75,8 +75,8 @@ lock_init(struct lock_object *lock, stru int i; /* Check for double-init and zero object. */ - KASSERT(!lock_initialized(lock), ("lock \"%s\" %p already initialized", - name, lock)); + KASSERT(flags & LO_NEW || !lock_initialized(lock), + ("lock \"%s\" %p already initialized", name, lock)); /* Look up lock class to find its index. */ for (i = 0; i < LOCK_CLASS_MAX; i++) Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/sys/lock.h Sat Dec 13 21:00:10 2014 (r275751) @@ -84,6 +84,7 @@ struct lock_class { #define LO_IS_VNODE 0x00800000 /* Tell WITNESS about a VNODE lock */ #define LO_CLASSMASK 0x0f000000 /* Class index bitmask. */ #define LO_NOPROFILE 0x10000000 /* Don't profile this lock */ +#define LO_NEW 0x20000000 /* Don't check for double-init */ /* * Lock classes are statically assigned an index into the gobal lock_classes Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/sys/mutex.h Sat Dec 13 21:00:10 2014 (r275751) @@ -52,6 +52,7 @@ #define MTX_RECURSE 0x00000004 /* Option: lock allowed to recurse */ #define MTX_NOWITNESS 0x00000008 /* Don't do any witness checking. */ #define MTX_NOPROFILE 0x00000020 /* Don't profile this lock */ +#define MTX_NEW 0x00000040 /* Don't check for double-init */ /* * Option flags passed to certain lock/unlock routines, through the use Modified: head/sys/sys/rmlock.h ============================================================================== --- head/sys/sys/rmlock.h Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/sys/rmlock.h Sat Dec 13 21:00:10 2014 (r275751) @@ -45,6 +45,7 @@ #define RM_NOWITNESS 0x00000001 #define RM_RECURSE 0x00000002 #define RM_SLEEPABLE 0x00000004 +#define RM_NEW 0x00000008 void rm_init(struct rmlock *rm, const char *name); void rm_init_flags(struct rmlock *rm, const char *name, int opts); Modified: head/sys/sys/rwlock.h ============================================================================== --- head/sys/sys/rwlock.h Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/sys/rwlock.h Sat Dec 13 21:00:10 2014 (r275751) @@ -258,6 +258,7 @@ struct rw_args_flags { #define RW_NOWITNESS 0x04 #define RW_QUIET 0x08 #define RW_RECURSE 0x10 +#define RW_NEW 0x20 /* * The INVARIANTS-enabled rw_assert() functionality. Modified: head/sys/sys/sx.h ============================================================================== --- head/sys/sys/sx.h Sat Dec 13 20:17:54 2014 (r275750) +++ head/sys/sys/sx.h Sat Dec 13 21:00:10 2014 (r275751) @@ -292,6 +292,7 @@ __sx_sunlock(struct sx *sx, const char * #define SX_QUIET 0x08 #define SX_NOADAPTIVE 0x10 #define SX_RECURSE 0x20 +#define SX_NEW 0x40 /* * Options passed to sx_*lock_hard(). From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 21:03:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EFA50DB; Sat, 13 Dec 2014 21:03:49 +0000 (UTC) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7EDBA838; Sat, 13 Dec 2014 21:03:49 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id n3so5523215wiv.11; Sat, 13 Dec 2014 13:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BmDG7OT6A+48QUhrZlKJzCPnNhap+RxWbX89lfZ51fQ=; b=LodAssX3Wxw4MKF8akWfSz6uaL0zRGn0oHnGjS7QgRr9UBB753zXRwMja1wgvGp2wh bVxJkv9F6Ak5gXq4jb4YOCitgGfZOSJOoyeJ2380BuKkBt+gT66gMuS8Fg24wOoPdqHS f/AJFOlhMUUFWDn5Uu1dL9i3oqDo9srmJm1MJFZ4h8tTtEFITQHt7S3OhArC7zMdV6q8 eyKZy9Zqk4RFn526WLqStB8yQhpf+yY/7UL5+3g1v+Sv26UMMXxt/ogWsrhXphVtsTGT dDDHT4z4/tupE1k0JzlJt7g/20gdChdavBVJjtN8JschpqgYAu3dPhB3Ux7hE4KsotwY RbQw== MIME-Version: 1.0 X-Received: by 10.180.76.144 with SMTP id k16mr18412495wiw.3.1418504627892; Sat, 13 Dec 2014 13:03:47 -0800 (PST) Received: by 10.27.179.168 with HTTP; Sat, 13 Dec 2014 13:03:47 -0800 (PST) In-Reply-To: <201412132100.sBDL0BvR094009@svn.freebsd.org> References: <201412132100.sBDL0BvR094009@svn.freebsd.org> Date: Sat, 13 Dec 2014 16:03:47 -0500 Message-ID: Subject: Re: svn commit: r275751 - in head: share/man/man9 sys/kern sys/sys From: Benjamin Kaduk To: Dmitry Chagin Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 21:03:50 -0000 On Sat, Dec 13, 2014 at 4:00 PM, Dmitry Chagin wrote: > > Author: dchagin > Date: Sat Dec 13 21:00:10 2014 > New Revision: 275751 > URL: https://svnweb.freebsd.org/changeset/base/275751 > > Log: > Add _NEW flag to mtx(9), sx(9), rmlock(9) and rwlock(9). > A _NEW flag passed to _init_flags() to avoid check for double-init. > > Can you please say a bit more about why this is desired and what it will be used for? Thanks, Ben From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 21:13:29 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D2C46303; Sat, 13 Dec 2014 21:13:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEB9690E; Sat, 13 Dec 2014 21:13:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDLDTcq002677; Sat, 13 Dec 2014 21:13:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDLDTEt002676; Sat, 13 Dec 2014 21:13:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201412132113.sBDLDTEt002676@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 13 Dec 2014 21:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275752 - head/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 21:13:29 -0000 Author: trasz Date: Sat Dec 13 21:13:28 2014 New Revision: 275752 URL: https://svnweb.freebsd.org/changeset/base/275752 Log: Fix quick_exit(3) manual page to match reality - the status was missing. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/stdlib/quick_exit.3 Modified: head/lib/libc/stdlib/quick_exit.3 ============================================================================== --- head/lib/libc/stdlib/quick_exit.3 Sat Dec 13 21:00:10 2014 (r275751) +++ head/lib/libc/stdlib/quick_exit.3 Sat Dec 13 21:13:28 2014 (r275752) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 7, 2011 +.Dd December 13, 2014 .Dt QUICK_EXIT 3 .Os .Sh NAME @@ -35,7 +35,7 @@ .Sh SYNOPSIS .In stdlib.h .Ft _Noreturn void -.Fn quick_exit "void" +.Fn quick_exit "int status" .Sh DESCRIPTION The .Fn quick_exit From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 21:31:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A360D742; Sat, 13 Dec 2014 21:31:43 +0000 (UTC) Received: from dchagin.static.corbina.net (dchagin.static.corbina.ru [78.107.232.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "dchagin.static.corbina.net", Issuer "dchagin.static.corbina.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F7ABAB2; Sat, 13 Dec 2014 21:31:42 +0000 (UTC) Received: from dchagin.static.corbina.net (localhost [127.0.0.1]) by dchagin.static.corbina.net (8.14.9/8.14.9) with ESMTP id sBDLVBeo002102 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 14 Dec 2014 00:31:12 +0300 (MSK) (envelope-from dchagin@dchagin.static.corbina.net) Received: (from dchagin@localhost) by dchagin.static.corbina.net (8.14.9/8.14.9/Submit) id sBDLVBhe002101; Sun, 14 Dec 2014 00:31:11 +0300 (MSK) (envelope-from dchagin) Date: Sun, 14 Dec 2014 00:31:11 +0300 From: Chagin Dmitry To: Benjamin Kaduk Subject: Re: svn commit: r275751 - in head: share/man/man9 sys/kern sys/sys Message-ID: <20141213213111.GA2070@dchagin.static.corbina.net> References: <201412132100.sBDL0BvR094009@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="45Z9DzgjV8m4Oswq" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 21:31:43 -0000 --45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 13, 2014 at 04:03:47PM -0500, Benjamin Kaduk wrote: > On Sat, Dec 13, 2014 at 4:00 PM, Dmitry Chagin wrot= e: > > > > Author: dchagin > > Date: Sat Dec 13 21:00:10 2014 > > New Revision: 275751 > > URL: https://svnweb.freebsd.org/changeset/base/275751 > > > > Log: > > Add _NEW flag to mtx(9), sx(9), rmlock(9) and rwlock(9). > > A _NEW flag passed to _init_flags() to avoid check for double-init. > > > > > Can you please say a bit more about why this is desired and what it will = be > used for? >=20 If the kernel has been compiled with INVARIANTS _init() will assert that the lock has not been initialized multiple times. _NEW flag is needed to skip t= his. as _init() does expect you to zero lock first. it should be used carefully, when you are sure its safe, to avoid bzero'ing lock struct. ugh --=20 Have fun! chd --45Z9DzgjV8m4Oswq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlSMsB8ACgkQ0t2Tb3OO/O0cSwCguFvw8qTzhf5ZQB7K0DaT0Dzs fNwAoKrS2rfIczoFVh6k39S3iyjfFhA/ =FAXl -----END PGP SIGNATURE----- --45Z9DzgjV8m4Oswq-- From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 21:49:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8187E975; Sat, 13 Dec 2014 21:49:28 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 42CD4BB1; Sat, 13 Dec 2014 21:49:27 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 460CA981E; Sat, 13 Dec 2014 21:49:20 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id DBDC032E3; Sat, 13 Dec 2014 22:49:09 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: src-committers@freebsd.org Subject: Re: svn commit: r275659 - head/bin/freebsd-version References: <201412100312.sBA3CNEm081570@svn.freebsd.org> <20141212164901.GB65403@hades.panopticon> Date: Sat, 13 Dec 2014 22:49:09 +0100 In-Reply-To: <20141212164901.GB65403@hades.panopticon> (Dmitry Marakasov's message of "Fri, 12 Dec 2014 19:49:01 +0300") Message-ID: <86ppbnw78q.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 21:49:28 -0000 Dmitry Marakasov writes: > This is wrong. Target uses ${.ALLSRC} to which you've appended ${NEWVERS}, > and now the target appends newvers.sh contents to freebsd-version script. I am clearly made of dumb. Please commit. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 21:50:17 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4EEDDAB7; Sat, 13 Dec 2014 21:50:17 +0000 (UTC) Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [IPv6:2a00:1450:400c:c05::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDEB7BB6; Sat, 13 Dec 2014 21:50:16 +0000 (UTC) Received: by mail-wi0-f174.google.com with SMTP id h11so5578546wiw.7; Sat, 13 Dec 2014 13:50:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=753+Ol4TPlz+3KGRaNeiqn+NUzcB02WKKSLaN6E9bow=; b=kBn1Xwh4jj5GM8gn6zhHshg2F619qPlUxL2XOwWaa/5eyCJwSjur7r6YtCK80fMxDu 2+ol4H0jbJei5lfHzXxGyfELZR99gC75MiChVx5RB9iFXt0ofPTPttvSR0Qi8zZLdi27 jq+iLgAGxeBahji7Jvnpc5NIV0LSn/i5gKWot5LdFsTKYFrfCf6291OmXDd86MKaneEX M4GIkoxek3DBxoXSB5RirKPPbgMoJMtNWEAwv080GLKdEhSVjUWqTQfNIB+a4cdDjPiR vR3vd9/zbskwJU4mUTW9dcuNbRaODvpflZld05hKdN4khA1ktE/iO9wpfrgyamqPxFca TYLg== X-Received: by 10.194.71.45 with SMTP id r13mr37885157wju.128.1418507415140; Sat, 13 Dec 2014 13:50:15 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id u9sm6904363wjy.37.2014.12.13.13.50.13 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 13 Dec 2014 13:50:14 -0800 (PST) Date: Sat, 13 Dec 2014 22:50:11 +0100 From: Mateusz Guzik To: Chagin Dmitry Subject: Re: svn commit: r275751 - in head: share/man/man9 sys/kern sys/sys Message-ID: <20141213215011.GA17746@dft-labs.eu> References: <201412132100.sBDL0BvR094009@svn.freebsd.org> <20141213213111.GA2070@dchagin.static.corbina.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20141213213111.GA2070@dchagin.static.corbina.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Benjamin Kaduk , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 21:50:17 -0000 On Sun, Dec 14, 2014 at 12:31:11AM +0300, Chagin Dmitry wrote: > On Sat, Dec 13, 2014 at 04:03:47PM -0500, Benjamin Kaduk wrote: > > On Sat, Dec 13, 2014 at 4:00 PM, Dmitry Chagin wrote: > > > > > > Author: dchagin > > > Date: Sat Dec 13 21:00:10 2014 > > > New Revision: 275751 > > > URL: https://svnweb.freebsd.org/changeset/base/275751 > > > > > > Log: > > > Add _NEW flag to mtx(9), sx(9), rmlock(9) and rwlock(9). > > > A _NEW flag passed to _init_flags() to avoid check for double-init. > > > > > > > > Can you please say a bit more about why this is desired and what it will be > > used for? > > > If the kernel has been compiled with INVARIANTS _init() will assert that the > lock has not been initialized multiple times. _NEW flag is needed to skip this. > as _init() does expect you to zero lock first. > it should be used carefully, when you are sure its safe, > to avoid bzero'ing lock struct. ugh > I think the actual question was when would you call _init_flags and not want _NEW and it would have a potential to detect double init. I think a better approach would be to have a hash with addresses of all locks in use. Then _init/_destroy would add/remove it respectively and we would not be dependent on the state of the lock (e.g. struct could be zeroed by unrelated code and then double init is not detected). Chains locked separately of course. I didn't try that, should be totally fine for invariants. -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Sat Dec 13 22:14:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 018CEDAA; Sat, 13 Dec 2014 22:14:09 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D2D34DE2; Sat, 13 Dec 2014 22:14:08 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id sBDME1gb073814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 13 Dec 2014 14:14:02 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id sBDME1OU073813; Sat, 13 Dec 2014 14:14:01 -0800 (PST) (envelope-from jmg) Date: Sat, 13 Dec 2014 14:14:01 -0800 From: John-Mark Gurney To: Dmitry Chagin Subject: Re: svn commit: r275751 - in head: share/man/man9 sys/kern sys/sys Message-ID: <20141213221401.GM25139@funkthat.com> References: <201412132100.sBDL0BvR094009@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201412132100.sBDL0BvR094009@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sat, 13 Dec 2014 14:14:02 -0800 (PST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 13 Dec 2014 22:14:09 -0000 Dmitry Chagin wrote this message on Sat, Dec 13, 2014 at 21:00 +0000: > Author: dchagin > Date: Sat Dec 13 21:00:10 2014 > New Revision: 275751 > URL: https://svnweb.freebsd.org/changeset/base/275751 > > Log: > Add _NEW flag to mtx(9), sx(9), rmlock(9) and rwlock(9). > A _NEW flag passed to _init_flags() to avoid check for double-init. > > Differential Revision: https://reviews.freebsd.org/D1208 > Reviewed by: jhb, wblock > MFC after: 1 Month Thanks for adding this... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."