svn commit: r326118 - head/sys/netpfil/ipfw
Author: ae Date: Thu Nov 23 08:02:02 2017 New Revision: 326118 URL: https://svnweb.freebsd.org/changeset/base/326118 Log: Modify ipfw's dynamic states KPI. Hide the locking logic used in the dynamic states implementation from generic code. Rename ipfw_install_state() and ipfw_lookup_dyn_rule() function to have similar names: ipfw_dyn_install_state() and ipfw_dyn_lookup_state(). Move dynamic rule counters updating to the ipfw_dyn_lookup_state() function. Now this function return NULL when there is no state and pointer to the parent rule when state is found. Thus now there is no need to return pointer to dynamic rule, and no need to hold bucket lock for this state. Remove ipfw_dyn_unlock() function. Obtained from:Yandex LLC MFC after:1 week Sponsored by: Yandex LLC Differential Revision:https://reviews.freebsd.org/D11657 Modified: head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_dynamic.c head/sys/netpfil/ipfw/ip_fw_private.h Modified: head/sys/netpfil/ipfw/ip_fw2.c == --- head/sys/netpfil/ipfw/ip_fw2.c Thu Nov 23 07:05:25 2017 (r326117) +++ head/sys/netpfil/ipfw/ip_fw2.c Thu Nov 23 08:02:02 2017 (r326118) @@ -1122,7 +1122,7 @@ ipfw_chk(struct ip_fw_args *args) */ int dyn_dir = MATCH_UNKNOWN; uint16_t dyn_name = 0; - ipfw_dyn_rule *q = NULL; + struct ip_fw *q = NULL; struct ip_fw_chain *chain = &V_layer3_chain; /* @@ -2307,7 +2307,7 @@ do { \ */ case O_LIMIT: case O_KEEP_STATE: - if (ipfw_install_state(chain, f, + if (ipfw_dyn_install_state(chain, f, (ipfw_insn_limit *)cmd, args, tablearg)) { /* error or limit violation */ retval = IP_FW_DENY; @@ -2347,28 +2347,25 @@ do { \ if ((dyn_dir == MATCH_UNKNOWN || (dyn_name != 0 && dyn_name != cmd->arg1)) && - (q = ipfw_lookup_dyn_rule(&args->f_id, -&dyn_dir, proto == IPPROTO_TCP ? -TCP(ulp): NULL, + (q = ipfw_dyn_lookup_state(&args->f_id, +ulp, pktlen, &dyn_dir, (dyn_name = cmd->arg1))) != NULL) { /* -* Found dynamic entry, update stats -* and jump to the 'action' part of -* the parent rule by setting -* f, cmd, l and clearing cmdlen. +* Found dynamic entry, jump to the +* 'action' part of the parent rule +* by setting f, cmd, l and clearing +* cmdlen. */ - IPFW_INC_DYN_COUNTER(q, pktlen); + f = q; /* XXX we would like to have f_pos * readily accessible in the dynamic * rule, instead of having to * lookup q->rule. */ - f = q->rule; f_pos = ipfw_find_rule(chain, - f->rulenum, f->id); + f->rulenum, f->id); cmd = ACTION_PTR(f); l = f->cmd_len - f->act_ofs; - ipfw_dyn_unlock(q); cmdlen = 0; match = 1; break; @@ -2580,8 +2577,7 @@ do { \ case O_FORWARD_IP: if (args->eh) /* not valid on layer2 pkts */ break; - if (q == NULL || q->rule != f || - dyn_dir == MATCH_FORWARD) { + if (q != f || dyn_dir == MATCH_FORWARD) { struct so
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
Hi Devin, On Thu, 23 Nov 2017 01:33:39 -0800 Devin Teske wrote: > > > > On Nov 22, 2017, at 11:15 PM, Emmanuel Vadot wrote: > > > >> On 2017-11-22 17:38, Ian Lepore wrote: > >>> On Wed, 2017-11-22 at 15:27 +, Emmanuel Vadot wrote: > >>> Author: manu > >>> Date: Wed Nov 22 15:27:47 2017 > >>> New Revision: 326095 > >>> URL: https://svnweb.freebsd.org/changeset/base/326095 > >>> Log: > >>> bsdinstall: Add ntpdate option > >>> > >>> When you install a computer for the first time, the date in the CMOS > >>> sometimes > >>> not accurate and you need to ntpdate as ntpd will fail a the time > >>> difference > >>> is too big. > >>> Add an option in bsdinstall to enable ntpdate that will do that for us. > >>> > >>> Reviewed by:allanjude > >>> Differential Revision:https://reviews.freebsd.org/D13149 > >>> Modified: > >>> head/usr.sbin/bsdinstall/scripts/services > >>> Modified: head/usr.sbin/bsdinstall/scripts/services > >>> == > >>> --- head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 15:18:11 2017 > >>>(r326094) > >>> +++ head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 15:27:47 2017 > >>>(r326095) > >>> @@ -46,6 +46,8 @@ DAEMONS=$( dialog --backtitle "FreeBSD Installer" \ > >>> local_unbound "Local caching validating resolver" > >>> ${local_unbound:-off} \ > >>> sshd"Secure shell daemon" ${sshd_enable:-off} \ > >>> moused"PS/2 mouse pointer on console" ${moused_enable:-off} \ > >>> +ntpdate"Synchronize system and network time at bootime" \ > >>> +${ntpdate_enable:-off} \ > >>> ntpd"Synchronize system and network time" ${ntpd_enable:-off} \ > >>> powerd"Adjust CPU frequency dynamically if supported" \ > >>> ${powerd_enable:-off} \ > >> The right way to enable a time-step at boot is to set the rc conf > >> variable ntpd_sync_on_start to YES. ntpdate has been deprecated for > >> *years*. > >> -- Ian > > > > Hi Ian, > > > > Thanks I didn't know about option -g (nor ntpd_sync_on_start), this bring a > > few questions : > > > > - Is there any reason to not always use -g for ntpd ? As a lambda user I > > just want my time to be set, no matter what. > > - Should we remove ntpdate in -current before 12 if it's deprecated ? > > > > I'll make the necessary changes according to your (or others) answers. > > > > I would not remove ntpdate. > > Is there a way to make ntpd sync and then quit immediately? Just by reading the man I see the -q option which does exactly that. Setting both -q and -g should have the same behavior than ntpdate (not tested). > If not, sounds like ntpdate serves a purpose not filled by ntpd. > > Valid case is someone running a VM that gets paused for days, weeks, or even > months at a time. On such a VM it may make more sense to let the clock be > only sporadically managed in an adhoc manner. > > I personally like to use ntpdate on said VMs because I generally set a > timeout on my ssh-agent in said VMs and by managing the clock manually allows > me to better control keys loaded. > > Pretty sure other people may have other reasons for non-daemonized clock > management. That's why I asked :) > -- > Devin -- Emmanuel Vadot ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
> On Nov 22, 2017, at 11:15 PM, Emmanuel Vadot wrote: > >> On 2017-11-22 17:38, Ian Lepore wrote: >>> On Wed, 2017-11-22 at 15:27 +, Emmanuel Vadot wrote: >>> Author: manu >>> Date: Wed Nov 22 15:27:47 2017 >>> New Revision: 326095 >>> URL: https://svnweb.freebsd.org/changeset/base/326095 >>> Log: >>> bsdinstall: Add ntpdate option >>> >>> When you install a computer for the first time, the date in the CMOS >>> sometimes >>> not accurate and you need to ntpdate as ntpd will fail a the time >>> difference >>> is too big. >>> Add an option in bsdinstall to enable ntpdate that will do that for us. >>> >>> Reviewed by:allanjude >>> Differential Revision:https://reviews.freebsd.org/D13149 >>> Modified: >>> head/usr.sbin/bsdinstall/scripts/services >>> Modified: head/usr.sbin/bsdinstall/scripts/services >>> == >>> --- head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 15:18:11 2017 >>> (r326094) >>> +++ head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 15:27:47 2017 >>> (r326095) >>> @@ -46,6 +46,8 @@ DAEMONS=$( dialog --backtitle "FreeBSD Installer" \ >>> local_unbound "Local caching validating resolver" >>> ${local_unbound:-off} \ >>> sshd"Secure shell daemon" ${sshd_enable:-off} \ >>> moused"PS/2 mouse pointer on console" ${moused_enable:-off} \ >>> +ntpdate"Synchronize system and network time at bootime" \ >>> +${ntpdate_enable:-off} \ >>> ntpd"Synchronize system and network time" ${ntpd_enable:-off} \ >>> powerd"Adjust CPU frequency dynamically if supported" \ >>> ${powerd_enable:-off} \ >> The right way to enable a time-step at boot is to set the rc conf >> variable ntpd_sync_on_start to YES. ntpdate has been deprecated for >> *years*. >> -- Ian > > Hi Ian, > > Thanks I didn't know about option -g (nor ntpd_sync_on_start), this bring a > few questions : > > - Is there any reason to not always use -g for ntpd ? As a lambda user I just > want my time to be set, no matter what. > - Should we remove ntpdate in -current before 12 if it's deprecated ? > > I'll make the necessary changes according to your (or others) answers. > I would not remove ntpdate. Is there a way to make ntpd sync and then quit immediately? If not, sounds like ntpdate serves a purpose not filled by ntpd. Valid case is someone running a VM that gets paused for days, weeks, or even months at a time. On such a VM it may make more sense to let the clock be only sporadically managed in an adhoc manner. I personally like to use ntpdate on said VMs because I generally set a timeout on my ssh-agent in said VMs and by managing the clock manually allows me to better control keys loaded. Pretty sure other people may have other reasons for non-daemonized clock management. -- Devin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326121 - head/sys/dev/efidev
Author: andrew Date: Thu Nov 23 10:34:38 2017 New Revision: 326121 URL: https://svnweb.freebsd.org/changeset/base/326121 Log: Zero struct efi_tm before setting the needed values. We don't use the dst or timezone fields so ensure these are set. Reported by: emaste Sponsored by: DARPA, AFRL Modified: head/sys/dev/efidev/efirtc.c Modified: head/sys/dev/efidev/efirtc.c == --- head/sys/dev/efidev/efirtc.cThu Nov 23 10:09:49 2017 (r326120) +++ head/sys/dev/efidev/efirtc.cThu Nov 23 10:34:38 2017 (r326121) @@ -116,6 +116,7 @@ efirtc_settime(device_t dev, struct timespec *ts) clock_ts_to_ct(ts, &ct); + bzero(&tm, sizeof(tm)); tm.tm_sec = ct.sec; tm.tm_min = ct.min; tm.tm_hour = ct.hour; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326122 - in head: lib/libc/sys sys/kern sys/sys
Author: kib Date: Thu Nov 23 11:25:11 2017 New Revision: 326122 URL: https://svnweb.freebsd.org/changeset/base/326122 Log: Kill all descendants of the reaper, even if they are descendants of a subordinate reaper. Also, mark reapers when listing pids. Reported by: Michael Zuo PR: 223745 Reviewed by: bapt Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D13183 Modified: head/lib/libc/sys/procctl.2 head/sys/kern/kern_procctl.c head/sys/sys/procctl.h Modified: head/lib/libc/sys/procctl.2 == --- head/lib/libc/sys/procctl.2 Thu Nov 23 10:34:38 2017(r326121) +++ head/lib/libc/sys/procctl.2 Thu Nov 23 11:25:11 2017(r326122) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2016 +.Dd November 21, 2017 .Dt PROCCTL 2 .Os .Sh NAME @@ -211,7 +211,7 @@ of the process. The .Fa pi_flags field returns the following flags, further describing the descendant: -.Bl -tag -width "Dv REAPER_PIDINFO_VALID" +.Bl -tag -width "Dv REAPER_PIDINFO_REAPER" .It Dv REAPER_PIDINFO_VALID Set to indicate that the .Vt procctl_reaper_pidinfo @@ -226,6 +226,9 @@ of the returned array. The .Fa pi_pid field identifies the direct child of the reaper. +.It Dv REAPER_PIDINFO_REAPER +The reported process is itself a reaper. +The descendants of the subordinate reaper are not reported. .El .It Dv PROC_REAP_KILL Request to deliver a signal to some subset of the descendants of the reaper. Modified: head/sys/kern/kern_procctl.c == --- head/sys/kern/kern_procctl.cThu Nov 23 10:34:38 2017 (r326121) +++ head/sys/kern/kern_procctl.cThu Nov 23 11:25:11 2017 (r326122) @@ -221,6 +221,8 @@ reap_getpids(struct thread *td, struct proc *p, struct pip->pi_flags = REAPER_PIDINFO_VALID; if (proc_realparent(p2) == reap) pip->pi_flags |= REAPER_PIDINFO_CHILD; + if ((p2->p_treeflag & P_TREE_REAPER) != 0) + pip->pi_flags |= REAPER_PIDINFO_REAPER; i++; } sx_sunlock(&proctree_lock); @@ -231,20 +233,60 @@ reap_getpids(struct thread *td, struct proc *p, struct return (error); } +static void +reap_kill_proc(struct thread *td, struct proc *p2, ksiginfo_t *ksi, +struct procctl_reaper_kill *rk, int *error) +{ + int error1; + + PROC_LOCK(p2); + error1 = p_cansignal(td, p2, rk->rk_sig); + if (error1 == 0) { + pksignal(p2, rk->rk_sig, ksi); + rk->rk_killed++; + *error = error1; + } else if (*error == ESRCH) { + rk->rk_fpid = p2->p_pid; + *error = error1; + } + PROC_UNLOCK(p2); +} + +struct reap_kill_tracker { + struct proc *parent; + TAILQ_ENTRY(reap_kill_tracker) link; +}; + +TAILQ_HEAD(reap_kill_tracker_head, reap_kill_tracker); + +static void +reap_kill_sched(struct reap_kill_tracker_head *tracker, struct proc *p2) +{ + struct reap_kill_tracker *t; + + t = malloc(sizeof(struct reap_kill_tracker), M_TEMP, M_WAITOK); + t->parent = p2; + TAILQ_INSERT_TAIL(tracker, t, link); +} + static int reap_kill(struct thread *td, struct proc *p, struct procctl_reaper_kill *rk) { struct proc *reap, *p2; ksiginfo_t ksi; - int error, error1; + struct reap_kill_tracker_head tracker; + struct reap_kill_tracker *t; + int error; sx_assert(&proctree_lock, SX_LOCKED); if (IN_CAPABILITY_MODE(td)) return (ECAPMODE); - if (rk->rk_sig <= 0 || rk->rk_sig > _SIG_MAXSIG) + if (rk->rk_sig <= 0 || rk->rk_sig > _SIG_MAXSIG || + (rk->rk_flags & ~(REAPER_KILL_CHILDREN | + REAPER_KILL_SUBTREE)) != 0 || (rk->rk_flags & + (REAPER_KILL_CHILDREN | REAPER_KILL_SUBTREE)) == + (REAPER_KILL_CHILDREN | REAPER_KILL_SUBTREE)) return (EINVAL); - if ((rk->rk_flags & ~(REAPER_KILL_CHILDREN | REAPER_KILL_SUBTREE)) != 0) - return (EINVAL); PROC_UNLOCK(p); reap = (p->p_treeflag & P_TREE_REAPER) == 0 ? p->p_reaper : p; ksiginfo_init(&ksi); @@ -255,26 +297,33 @@ reap_kill(struct thread *td, struct proc *p, struct pr error = ESRCH; rk->rk_killed = 0; rk->rk_fpid = -1; - for (p2 = (rk->rk_flags & REAPER_KILL_CHILDREN) != 0 ? - LIST_FIRST(&reap->p_children) : LIST_FIRST(&reap->p_reaplist); - p2 != NULL; - p2 = (rk->rk_flags & REAPER_KILL_CHILDREN) != 0 ? - LIST_NEXT(p2, p_sibling) : LIST_NEXT(p2, p_reapsibling)) { - if ((rk->rk_flags & REAPER_KILL_SUBTREE) != 0 && - p2->p_reapsubtree != rk->rk_subtree) - continue; -
svn commit: r326123 - in head: include sys/amd64/include sys/i386/include sys/sys sys/x86/include
Author: kib Date: Thu Nov 23 11:40:16 2017 New Revision: 326123 URL: https://svnweb.freebsd.org/changeset/base/326123 Log: Remove lint support from system headers and MD x86 headers. Reviewed by: dim, jhb Discussed with: imp Sponsored by: The FreeBSD Foundation Differential revision:https://reviews.freebsd.org/D13156 Modified: head/include/stdlib.h head/sys/amd64/include/asm.h head/sys/amd64/include/pcpu.h head/sys/amd64/include/profile.h head/sys/i386/include/asm.h head/sys/i386/include/pcpu.h head/sys/i386/include/profile.h head/sys/sys/cdefs.h head/sys/sys/linker_set.h head/sys/sys/param.h head/sys/x86/include/_types.h head/sys/x86/include/bus.h head/sys/x86/include/stdarg.h head/sys/x86/include/ucontext.h Modified: head/include/stdlib.h == --- head/include/stdlib.h Thu Nov 23 11:25:11 2017(r326122) +++ head/include/stdlib.h Thu Nov 23 11:40:16 2017(r326123) @@ -238,17 +238,13 @@ extern void (*malloc_message)(void *, const char *); /* * The alloca() function can't be implemented in C, and on some * platforms it can't be implemented at all as a callable function. - * The GNU C compiler provides a built-in alloca() which we can use; - * in all other cases, provide a prototype, mainly to pacify various - * incarnations of lint. On platforms where alloca() is not in libc, - * programs which use it will fail to link when compiled with non-GNU - * compilers. + * The GNU C compiler provides a built-in alloca() which we can use. + * On platforms where alloca() is not in libc, programs which use it + * will fail to link when compiled with non-GNU compilers. */ #if __GNUC__ >= 2 || defined(__INTEL_COMPILER) #undef alloca /* some GNU bits try to get cute and define this on their own */ #define alloca(sz) __builtin_alloca(sz) -#elif defined(lint) -void *alloca(size_t); #endif voidabort2(const char *, int, void **) __dead2; Modified: head/sys/amd64/include/asm.h == --- head/sys/amd64/include/asm.hThu Nov 23 11:25:11 2017 (r326122) +++ head/sys/amd64/include/asm.hThu Nov 23 11:40:16 2017 (r326123) @@ -92,10 +92,10 @@ #define RCSID(x) .text; .asciz x #undef __FBSDID -#if !defined(lint) && !defined(STRIP_FBSDID) +#if !defined(STRIP_FBSDID) #define __FBSDID(s).ident s #else #define __FBSDID(s)/* nothing */ -#endif /* not lint and not STRIP_FBSDID */ +#endif /* !STRIP_FBSDID */ #endif /* !_MACHINE_ASM_H_ */ Modified: head/sys/amd64/include/pcpu.h == --- head/sys/amd64/include/pcpu.h Thu Nov 23 11:25:11 2017 (r326122) +++ head/sys/amd64/include/pcpu.h Thu Nov 23 11:40:16 2017 (r326123) @@ -74,19 +74,8 @@ #ifdef _KERNEL -#ifdef lint +#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) -extern struct pcpu *pcpup; - -#defineget_pcpu() (pcpup) -#definePCPU_GET(member)(pcpup->pc_ ## member) -#definePCPU_ADD(member, val) (pcpup->pc_ ## member += (val)) -#definePCPU_INC(member)PCPU_ADD(member, 1) -#definePCPU_PTR(member)(&pcpup->pc_ ## member) -#definePCPU_SET(member, val) (pcpup->pc_ ## member = (val)) - -#elif defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) - /* * Evaluates to the byte offset of the per-cpu variable name. */ @@ -251,11 +240,11 @@ __curpcb(void) #defineIS_BSP()(PCPU_GET(cpuid) == 0) -#else /* !lint || defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */ +#else /* !__GNUCLIKE_ASM || !__GNUCLIKE___TYPEOF */ #error "this file needs to be ported to your compiler" -#endif /* lint, etc. */ +#endif /* __GNUCLIKE_ASM && __GNUCLIKE___TYPEOF */ #endif /* _KERNEL */ Modified: head/sys/amd64/include/profile.h == --- head/sys/amd64/include/profile.hThu Nov 23 11:25:11 2017 (r326122) +++ head/sys/amd64/include/profile.hThu Nov 23 11:40:16 2017 (r326123) @@ -71,10 +71,6 @@ : "ax", "dx", "cx", "di", "si", "r8", "r9", "memory") #defineMEXITCOUNT_OVERHEAD_GETLABEL(labelp) \ __asm __volatile("movq $1b,%0" : "=rm" (labelp)) -#elif defined(lint) -#defineMCOUNT_OVERHEAD(label) -#defineMEXITCOUNT_OVERHEAD() -#defineMEXITCOUNT_OVERHEAD_GETLABEL() #else #error this file needs to be ported to your compiler #endif /* !__GNUCLIKE_ASM */ Modified: head/sys/i386/include/asm.h == --- head/sys/i386/include/asm.h Thu Nov 23 11:25:11 2017(r326122) +++ head/sys/i386/include/asm.h Thu Nov 23 11:40:16 20
svn commit: r326125 - head/usr.sbin/kgmon
Author: trasz Date: Thu Nov 23 12:41:05 2017 New Revision: 326125 URL: https://svnweb.freebsd.org/changeset/base/326125 Log: Mark kgmon(8) obsolete, redirecting users to pmcstat(8). MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D12574 Modified: head/usr.sbin/kgmon/kgmon.8 Modified: head/usr.sbin/kgmon/kgmon.8 == --- head/usr.sbin/kgmon/kgmon.8 Thu Nov 23 12:25:11 2017(r326124) +++ head/usr.sbin/kgmon/kgmon.8 Thu Nov 23 12:41:05 2017(r326125) @@ -28,7 +28,7 @@ .\" @(#)kgmon.88.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 6, 1993 +.Dd November 23, 2017 .Dt KGMON 8 .Os .Sh NAME @@ -40,6 +40,13 @@ .Op Fl M Ar core .Op Fl N Ar system .Sh DESCRIPTION +.Bf -symbolic +This command is obsolete. +Users are advised to use +.Xr pmcstat 8 +instead. +.Ef +.Pp The .Nm utility is used when profiling the operating system. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326073 - head/usr.bin/systat
On Thu, 23 Nov 2017, Konstantin Belousov wrote: On Thu, Nov 23, 2017 at 04:24:13AM +1100, Bruce Evans wrote: sysctl/sysctl.c: sysctl(8) has bogus support for prettyprinting struct vmtotal (sysctl shouldn't have any prettyprinting, especially not for structs that have specialized programs to print them and much more). This uses intmax_t for all calculations and printing except for the int16_t fields, so it automatically benefited from the expansion. However since it uses a correct type (signed, and not restricted to 64 bits), it now has minor type errors -- it dowcasts the uint64_t to intmax_t wheen the latter is 64 bits. Its Makefile uses a fairly high WARNS, so if its type errors were fatal then printf format checking would have detected them (but not non-fatal errors involving downcasting). Below is the cast to uintmax_t and unsigned format for sysctl(8). This adds style bugs by expanding lines from length 79 to 81. diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index e1bf4e31914..92685a8171b 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -625,15 +625,15 @@ S_vmtotal(size_t l2, void *p) "%hd Sleep: %hd)\n", v->t_rq, v->t_dw, v->t_pw, v->t_sl); printf( - "Virtual Memory:\t\t(Total: %jdK Active: %jdK)\n", - (intmax_t)v->t_vm * pageKilo, (intmax_t)v->t_avm * pageKilo); - printf("Real Memory:\t\t(Total: %jdK Active: %jdK)\n", - (intmax_t)v->t_rm * pageKilo, (intmax_t)v->t_arm * pageKilo); - printf("Shared Virtual Memory:\t(Total: %jdK Active: %jdK)\n", - (intmax_t)v->t_vmshr * pageKilo, (intmax_t)v->t_avmshr * pageKilo); - printf("Shared Real Memory:\t(Total: %jdK Active: %jdK)\n", - (intmax_t)v->t_rmshr * pageKilo, (intmax_t)v->t_armshr * pageKilo); - printf("Free Memory:\t%jdK", (intmax_t)v->t_free * pageKilo); + "Virtual Memory:\t\t(Total: %juK Active: %juK)\n", + (uintmax_t)v->t_vm * pageKilo, (uintmax_t)v->t_avm * pageKilo); + printf("Real Memory:\t\t(Total: %juK Active: %juK)\n", + (uintmax_t)v->t_rm * pageKilo, (uintmax_t)v->t_arm * pageKilo); + printf("Shared Virtual Memory:\t(Total: %juK Active: %juK)\n", + (uintmax_t)v->t_vmshr * pageKilo, (uintmax_t)v->t_avmshr * pageKilo); + printf("Shared Real Memory:\t(Total: %juK Active: %juK)\n", + (uintmax_t)v->t_rmshr * pageKilo, (uintmax_t)v->t_armshr * pageKilo); + printf("Free Memory:\t%juK", (uintmax_t)v->t_free * pageKilo); return (0); } All of the casts to uintmax_t can be avoided be avoided by changing the type of pageKilo from int to uintmax_t. Better, do the conversion in a function-like macro pgtokb() as is done in all (?) other utilities, but without so many overflow bugs as in most other utiities: #define pgtok(p)((uintmax_t)(p) * pageKilo) (pageKilo is back to int). This is still sloppy: - pageKilo = getpagesize() / 1024 assumes that the page size is a multiple of 1024 and fails very badly when the page size is 512 - the multiplication can still overflow - when the size in K is too large to fit, the size in M or G will normally fit and converting directly to would avoid the overflow assuming that the page size is <= 1M. Using floating point (even float precision) avoids all overflow and rounding problems up to almost 128-bit sizes in bytes: #define pgtok(p)((p) * pageKilo)/* any integer type * float */ ... float pageKilo; ... pageKilo = getpagesize() / 1024; p = INT128_MAX is slightly too large to convert to float. p = UINT64_MAX fits in float with reduced precision. No one cares about printing more that FLT_DIG = 6 digits for memory sizes, but use double instead of float if you want to fit INT128_MAX and print up to DBL_DIG = 15 digits. Then for printing, change all %jd and %ju to %.0f. In, systat, remove all new printing functions and use putfloat. The problem of printing large values is still there: putfloat might print 4TB bytes as 4398046511k K's or 4398047M K's (where k means 1000, K means 1024 but M means 100 and the K's suffix is implicit, but the new printing function is little better -- it prints 4294962966K K's or 4194304M K's instead. Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326127 - in head/sys/dev: iscsi iser
Author: hselasky Date: Thu Nov 23 13:57:44 2017 New Revision: 326127 URL: https://svnweb.freebsd.org/changeset/base/326127 Log: Make sure the iSCSI I/O limits are set properly so that the ISCSIDSEND IOCTL can be used prior to the ISCSIDHANDOFF IOCTL which set the negotiated values. Else the login PDU will fail when passing the "-r" option to "iscsictl" which means iSCSI over RDMA instead of TCP/IP. Discussed with: np@ and trasz@ Sponsored by: Mellanox Technologies MFC after:1 week Modified: head/sys/dev/iscsi/icl_soft.c head/sys/dev/iscsi/iscsi.c head/sys/dev/iser/icl_iser.c Modified: head/sys/dev/iscsi/icl_soft.c == --- head/sys/dev/iscsi/icl_soft.c Thu Nov 23 12:54:18 2017 (r326126) +++ head/sys/dev/iscsi/icl_soft.c Thu Nov 23 13:57:44 2017 (r326127) @@ -1449,6 +1449,9 @@ icl_soft_limits(struct icl_drv_limits *idl) { idl->idl_max_recv_data_segment_length = 128 * 1024; + idl->idl_max_send_data_segment_length = 128 * 1024; + idl->idl_max_burst_length = 262144; + idl->idl_first_burst_length = 65536; return (0); } Modified: head/sys/dev/iscsi/iscsi.c == --- head/sys/dev/iscsi/iscsi.c Thu Nov 23 12:54:18 2017(r326126) +++ head/sys/dev/iscsi/iscsi.c Thu Nov 23 13:57:44 2017(r326127) @@ -1787,6 +1787,18 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct is = malloc(sizeof(*is), M_ISCSI, M_ZERO | M_WAITOK); memcpy(&is->is_conf, &isa->isa_conf, sizeof(is->is_conf)); + /* +* Set some default values, from RFC 3720, section 12. +* +* These values are updated by the handoff IOCTL, but are +* needed prior to the handoff to support sending the ISER +* login PDU. +*/ + is->is_max_recv_data_segment_length = 8192; + is->is_max_send_data_segment_length = 8192; + is->is_max_burst_length = 262144; + is->is_first_burst_length = 65536; + sx_xlock(&sc->sc_lock); /* Modified: head/sys/dev/iser/icl_iser.c == --- head/sys/dev/iser/icl_iser.cThu Nov 23 12:54:18 2017 (r326126) +++ head/sys/dev/iser/icl_iser.cThu Nov 23 13:57:44 2017 (r326127) @@ -486,7 +486,11 @@ iser_conn_task_done(struct icl_conn *ic, void *prv) static int iser_limits(struct icl_drv_limits *idl) { + idl->idl_max_recv_data_segment_length = 128 * 1024; + idl->idl_max_send_data_segment_length = 128 * 1024; + idl->idl_max_burst_length = 262144; + idl->idl_first_burst_length = 65536; return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326132 - head/sys/geom/mirror
Author: markj Date: Thu Nov 23 14:07:52 2017 New Revision: 326132 URL: https://svnweb.freebsd.org/changeset/base/326132 Log: Allow kern.geom.mirror.debug to be negative. A negative value can be used to suppress all prints from the gmirror kernel code, which can be useful when attempting to trigger race conditions using stress tests. MFC after:1 week Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h Modified: head/sys/geom/mirror/g_mirror.c == --- head/sys/geom/mirror/g_mirror.c Thu Nov 23 14:03:10 2017 (r326131) +++ head/sys/geom/mirror/g_mirror.c Thu Nov 23 14:07:52 2017 (r326132) @@ -54,8 +54,8 @@ static MALLOC_DEFINE(M_MIRROR, "mirror_data", "GEOM_MI SYSCTL_DECL(_kern_geom); static SYSCTL_NODE(_kern_geom, OID_AUTO, mirror, CTLFLAG_RW, 0, "GEOM_MIRROR stuff"); -u_int g_mirror_debug = 0; -SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, debug, CTLFLAG_RWTUN, &g_mirror_debug, 0, +int g_mirror_debug = 0; +SYSCTL_INT(_kern_geom_mirror, OID_AUTO, debug, CTLFLAG_RWTUN, &g_mirror_debug, 0, "Debug level"); static u_int g_mirror_timeout = 4; SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, timeout, CTLFLAG_RWTUN, &g_mirror_timeout, Modified: head/sys/geom/mirror/g_mirror.h == --- head/sys/geom/mirror/g_mirror.h Thu Nov 23 14:03:10 2017 (r326131) +++ head/sys/geom/mirror/g_mirror.h Thu Nov 23 14:07:52 2017 (r326132) @@ -72,7 +72,7 @@ G_MIRROR_DEVICE_FLAG_NOFAILSYNC) #ifdef _KERNEL -extern u_int g_mirror_debug; +extern int g_mirror_debug; #defineG_MIRROR_DEBUG(lvl, ...)do { \ if (g_mirror_debug >= (lvl)) { \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326134 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace
Author: markj Date: Thu Nov 23 14:29:07 2017 New Revision: 326134 URL: https://svnweb.freebsd.org/changeset/base/326134 Log: Duplicate helpers after disabling inherited tracepoints during a fork. We may create probes in the nascent child process, so we first need to ensure that any inherited tracepoints are first removed. Otherwise the probe sites will not be in the state expected by fasttrap, and it won't be able to enable the probes. MFC after:2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c == --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Nov 23 14:28:14 2017(r326133) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Nov 23 14:29:07 2017(r326134) @@ -601,8 +601,8 @@ fasttrap_fork(proc_t *p, proc_t *cp) pid_t ppid = p->p_pid; int i; -#ifdef illumos ASSERT(curproc == p); +#ifdef illumos ASSERT(p->p_proc_flag & P_PR_LOCK); #else PROC_LOCK_ASSERT(p, MA_OWNED); @@ -610,26 +610,15 @@ fasttrap_fork(proc_t *p, proc_t *cp) #ifdef illumos ASSERT(p->p_dtrace_count > 0); #else - if (p->p_dtrace_helpers) { - /* -* dtrace_helpers_duplicate() allocates memory. -*/ - _PHOLD(cp); - PROC_UNLOCK(p); - PROC_UNLOCK(cp); - dtrace_helpers_duplicate(p, cp); - PROC_LOCK(cp); - PROC_LOCK(p); - _PRELE(cp); - } /* * This check is purposely here instead of in kern_fork.c because, * for legal resons, we cannot include the dtrace_cddl.h header * inside kern_fork.c and insert if-clause there. */ - if (p->p_dtrace_count == 0) + if (p->p_dtrace_count == 0 && p->p_dtrace_helpers == NULL) return; #endif + ASSERT(cp->p_dtrace_count == 0); /* @@ -658,6 +647,8 @@ fasttrap_fork(proc_t *p, proc_t *cp) _PHOLD(cp); PROC_UNLOCK(cp); PROC_UNLOCK(p); + if (p->p_dtrace_count == 0) + goto dup_helpers; #endif /* @@ -711,6 +702,9 @@ fasttrap_fork(proc_t *p, proc_t *cp) mutex_enter(&cp->p_lock); sprunlock(cp); #else +dup_helpers: + if (p->p_dtrace_helpers != NULL) + dtrace_helpers_duplicate(p, cp); PROC_LOCK(p); PROC_LOCK(cp); _PRELE(cp); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326135 - head/contrib/binutils/bfd
Author: emaste Date: Thu Nov 23 14:30:41 2017 New Revision: 326135 URL: https://svnweb.freebsd.org/changeset/base/326135 Log: bfd: fix segfault in the ihex parser on malformed ihex file From binutils commit 0102ea8cec5fc509bba6c91df61b7ce23a799d32, made available under GPLv2 by Nick Clifton. PR: 198824 MFC after:1 week Security: CVE-2014-8503 Modified: head/contrib/binutils/bfd/ihex.c Modified: head/contrib/binutils/bfd/ihex.c == --- head/contrib/binutils/bfd/ihex.cThu Nov 23 14:29:07 2017 (r326134) +++ head/contrib/binutils/bfd/ihex.cThu Nov 23 14:30:41 2017 (r326135) @@ -320,7 +320,7 @@ ihex_scan (bfd *abfd) { if (! ISHEX (buf[i])) { - ihex_bad_byte (abfd, lineno, hdr[i], error); + ihex_bad_byte (abfd, lineno, buf[i], error); goto error_return; } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326125 - head/usr.sbin/kgmon
On Thu, 23 Nov 2017, Edward Tomasz Napierala wrote: Log: Mark kgmon(8) obsolete, redirecting users to pmcstat(8). It isn't obsolete. pmcstat can't do at least full (non-statistical) call graphs and high-resolution profiling. gmon in the kernel is slow to use in the SMP case and dangerous to use in all cases, but usually works for call graphs. In the SMP case, it uses a giant spinlock which is slow and gives deadlock when a non-maskable trap like an NMI or debugger trap occurs while the lock is held by the same CPU. In the !SMP case, it uses interrupt disabling to lock. This races instead of deadlocking for non-maskable traps while it is held. Ordinary mutexes have the same problems, and only work if NMI and debugger trap handlers don't use any mutexes that might be held by the interrupted context. Broken cases mostly involve broken locking in printf() and console drivers. High-resolution profiling was broken by gcc-4.2.1 and is more broken for clang. Only the parts written in asm sort of work, and no parts ever worked right for SMP. All these bugs are except the slowness from giant locking are fixed for gcc-4.2.1 in some of my versions, using better giant locking with a timeout on it to avoid deadlocking. When deadlock is detected, profiling is skipped. My fixes for printf() and console drivers are similar except fot trying harder to not skip (switch to alternative methods). pmc also can't do better than nothing for cases involving NMIs even when they aren't near deadlock. Ordinary profiling can do better, and high resolution profiling can do better still. E.g., for profiling an NMI handler, pmc can't generate NMIs to even sample it statistically, but ordinary profiling can see it whenever the NMI doesn't occur while the profiling lock is held. Ordinary profiling then gives an exact call graph, but broken statistical sampling for times since generating hardclock interrupts in an NMI (and other contexts) is even more impossible than generating an NMI for pmc. High-resolution profiling gives almost exact times (or perfmon counts) even in NMI handlers except in the near-deadlock case. Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
> > Hi Devin, > > On Thu, 23 Nov 2017 01:33:39 -0800 > Devin Teske wrote: > > > > > > > > On Nov 22, 2017, at 11:15 PM, Emmanuel Vadot > > > wrote: > > > > > >> On 2017-11-22 17:38, Ian Lepore wrote: > > >>> On Wed, 2017-11-22 at 15:27 +, Emmanuel Vadot wrote: > > >>> Author: manu > > >>> Date: Wed Nov 22 15:27:47 2017 > > >>> New Revision: 326095 > > >>> URL: https://svnweb.freebsd.org/changeset/base/326095 > > >>> Log: > > >>> bsdinstall: Add ntpdate option > > >>> > > >>> When you install a computer for the first time, the date in the CMOS > > >>> sometimes > > >>> not accurate and you need to ntpdate as ntpd will fail a the time > > >>> difference > > >>> is too big. > > >>> Add an option in bsdinstall to enable ntpdate that will do that for > > >>> us. > > >>> > > >>> Reviewed by:allanjude > > >>> Differential Revision:https://reviews.freebsd.org/D13149 > > >>> Modified: > > >>> head/usr.sbin/bsdinstall/scripts/services > > >>> Modified: head/usr.sbin/bsdinstall/scripts/services > > >>> == > > >>> --- head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 15:18:11 > > >>> 2017(r326094) > > >>> +++ head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 15:27:47 > > >>> 2017(r326095) > > >>> @@ -46,6 +46,8 @@ DAEMONS=$( dialog --backtitle "FreeBSD Installer" \ > > >>> local_unbound "Local caching validating resolver" > > >>> ${local_unbound:-off} \ > > >>> sshd"Secure shell daemon" ${sshd_enable:-off} \ > > >>> moused"PS/2 mouse pointer on console" ${moused_enable:-off} \ > > >>> +ntpdate"Synchronize system and network time at bootime" \ > > >>> +${ntpdate_enable:-off} \ > > >>> ntpd"Synchronize system and network time" ${ntpd_enable:-off} \ > > >>> powerd"Adjust CPU frequency dynamically if supported" \ > > >>> ${powerd_enable:-off} \ > > >> The right way to enable a time-step at boot is to set the rc conf > > >> variable ntpd_sync_on_start to YES. ntpdate has been deprecated for > > >> *years*. > > >> -- Ian > > > > > > Hi Ian, > > > > > > Thanks I didn't know about option -g (nor ntpd_sync_on_start), this bring > > > a few questions : > > > > > > - Is there any reason to not always use -g for ntpd ? As a lambda user I > > > just want my time to be set, no matter what. > > > - Should we remove ntpdate in -current before 12 if it's deprecated ? > > > > > > I'll make the necessary changes according to your (or others) answers. > > > > > > > I would not remove ntpdate. I concur, as ntpdate is trivial to use, ntpd -pg requires a proper /etc/ntp.conf, though that is trival too you well not get what you want if you do not have that. > > Is there a way to make ntpd sync and then quit immediately? > > Just by reading the man I see the -q option which does exactly that. > Setting both -q and -g should have the same behavior than ntpdate (not > tested). ntpd -pg is the preferred method per the ntp.org documentation: https://support.ntp.org/bin/view/Dev/DeprecatingNtpdate > > > If not, sounds like ntpdate serves a purpose not filled by ntpd. > > > > Valid case is someone running a VM that gets paused for days, weeks, or > > even months at a time. On such a VM it may make more sense to let the clock > > be only sporadically managed in an adhoc manner. > > > > I personally like to use ntpdate on said VMs because I generally set a > > timeout on my ssh-agent in said VMs and by managing the clock manually > > allows me to better control keys loaded. > > > > Pretty sure other people may have other reasons for non-daemonized clock > > management. > > That's why I asked :) I think that the ntp distribution still contains ntpdate, so long as that is true we should continue to include it in FreeBSD. When/if they remove it from the official ntp distribution then this issue shall need a revist. > > -- > > Devin > > -- > Emmanuel Vadot -- Rod Grimes rgri...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326125 - head/usr.sbin/kgmon
> Author: trasz > Date: Thu Nov 23 12:41:05 2017 > New Revision: 326125 > URL: https://svnweb.freebsd.org/changeset/base/326125 > > Log: > Mark kgmon(8) obsolete, redirecting users to pmcstat(8). If you are planning to remove kgmon you need to make it spit out a warning that it is being depricated in a future release, man page changes are insufficient warning of future removal. See commiters guide, 17.4 > MFC after: 2 weeks > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D12574 > > Modified: > head/usr.sbin/kgmon/kgmon.8 > > Modified: head/usr.sbin/kgmon/kgmon.8 > == > --- head/usr.sbin/kgmon/kgmon.8 Thu Nov 23 12:25:11 2017 > (r326124) > +++ head/usr.sbin/kgmon/kgmon.8 Thu Nov 23 12:41:05 2017 > (r326125) > @@ -28,7 +28,7 @@ > .\" @(#)kgmon.8 8.1 (Berkeley) 6/6/93 > .\" $FreeBSD$ > .\" > -.Dd June 6, 1993 > +.Dd November 23, 2017 > .Dt KGMON 8 > .Os > .Sh NAME > @@ -40,6 +40,13 @@ > .Op Fl M Ar core > .Op Fl N Ar system > .Sh DESCRIPTION > +.Bf -symbolic > +This command is obsolete. > +Users are advised to use > +.Xr pmcstat 8 > +instead. > +.Ef > +.Pp > The > .Nm > utility is used when profiling the operating system. > > -- Rod Grimes rgri...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
On Thu, 23 Nov 2017 06:56:50 -0800 (PST) "Rodney W. Grimes" wrote: > > > > Hi Devin, > > > > On Thu, 23 Nov 2017 01:33:39 -0800 > > Devin Teske wrote: > > > > > > > > > > > > On Nov 22, 2017, at 11:15 PM, Emmanuel Vadot > > > > wrote: > > > > > > > >> On 2017-11-22 17:38, Ian Lepore wrote: > > > >>> On Wed, 2017-11-22 at 15:27 +, Emmanuel Vadot wrote: > > > >>> Author: manu > > > >>> Date: Wed Nov 22 15:27:47 2017 > > > >>> New Revision: 326095 > > > >>> URL: https://svnweb.freebsd.org/changeset/base/326095 > > > >>> Log: > > > >>> bsdinstall: Add ntpdate option > > > >>> > > > >>> When you install a computer for the first time, the date in the > > > >>> CMOS sometimes > > > >>> not accurate and you need to ntpdate as ntpd will fail a the time > > > >>> difference > > > >>> is too big. > > > >>> Add an option in bsdinstall to enable ntpdate that will do that for > > > >>> us. > > > >>> > > > >>> Reviewed by:allanjude > > > >>> Differential Revision:https://reviews.freebsd.org/D13149 > > > >>> Modified: > > > >>> head/usr.sbin/bsdinstall/scripts/services > > > >>> Modified: head/usr.sbin/bsdinstall/scripts/services > > > >>> == > > > >>> --- head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 15:18:11 > > > >>> 2017(r326094) > > > >>> +++ head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 15:27:47 > > > >>> 2017(r326095) > > > >>> @@ -46,6 +46,8 @@ DAEMONS=$( dialog --backtitle "FreeBSD Installer" \ > > > >>> local_unbound "Local caching validating resolver" > > > >>> ${local_unbound:-off} \ > > > >>> sshd"Secure shell daemon" ${sshd_enable:-off} \ > > > >>> moused"PS/2 mouse pointer on console" ${moused_enable:-off} \ > > > >>> +ntpdate"Synchronize system and network time at bootime" \ > > > >>> +${ntpdate_enable:-off} \ > > > >>> ntpd"Synchronize system and network time" > > > >>> ${ntpd_enable:-off} \ > > > >>> powerd"Adjust CPU frequency dynamically if supported" \ > > > >>> ${powerd_enable:-off} \ > > > >> The right way to enable a time-step at boot is to set the rc conf > > > >> variable ntpd_sync_on_start to YES. ntpdate has been deprecated for > > > >> *years*. > > > >> -- Ian > > > > > > > > Hi Ian, > > > > > > > > Thanks I didn't know about option -g (nor ntpd_sync_on_start), this > > > > bring a few questions : > > > > > > > > - Is there any reason to not always use -g for ntpd ? As a lambda user > > > > I just want my time to be set, no matter what. > > > > - Should we remove ntpdate in -current before 12 if it's deprecated ? > > > > > > > > I'll make the necessary changes according to your (or others) answers. > > > > > > > > > > I would not remove ntpdate. > > I concur, as ntpdate is trivial to use, ntpd -pg requires a proper > /etc/ntp.conf, > though that is trival too you well not get what you want if you do not have > that. From the website you linked after they say to use : ntpd -gqc /dev/null server1.name.net server2.name.org server3.name.com for use without ntp.conf. Also we do provide an ntp.conf so ... > > > Is there a way to make ntpd sync and then quit immediately? > > > > Just by reading the man I see the -q option which does exactly that. > > Setting both -q and -g should have the same behavior than ntpdate (not > > tested). > > ntpd -pg is the preferred method per the ntp.org documentation: > https://support.ntp.org/bin/view/Dev/DeprecatingNtpdate -gq like I said but it's good to have an official reference. > > > > > If not, sounds like ntpdate serves a purpose not filled by ntpd. > > > > > > Valid case is someone running a VM that gets paused for days, weeks, or > > > even months at a time. On such a VM it may make more sense to let the > > > clock be only sporadically managed in an adhoc manner. > > > > > > I personally like to use ntpdate on said VMs because I generally set a > > > timeout on my ssh-agent in said VMs and by managing the clock manually > > > allows me to better control keys loaded. > > > > > > Pretty sure other people may have other reasons for non-daemonized clock > > > management. > > > > That's why I asked :) > > I think that the ntp distribution still contains ntpdate, so long as that is > true > we should continue to include it in FreeBSD. When/if they remove it from the > official ntp distribution then this issue shall need a revist. I haven't checked. We can also add a shell script that does what I quoted above. > > > -- > > > Devin > > > > -- > > Emmanuel Vadot > > -- > Rod Grimes rgri...@freebsd.org -- Emmanuel Vadot ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
> On Thu, 23 Nov 2017 06:56:50 -0800 (PST) > "Rodney W. Grimes" wrote: > > > > > > > Hi Devin, > > > > > > On Thu, 23 Nov 2017 01:33:39 -0800 > > > Devin Teske wrote: > > > > > > > > > > > > > > > > On Nov 22, 2017, at 11:15 PM, Emmanuel Vadot > > > > > wrote: > > > > > > > > > >> On 2017-11-22 17:38, Ian Lepore wrote: > > > > >>> On Wed, 2017-11-22 at 15:27 +, Emmanuel Vadot wrote: > > > > >>> Author: manu > > > > >>> Date: Wed Nov 22 15:27:47 2017 > > > > >>> New Revision: 326095 > > > > >>> URL: https://svnweb.freebsd.org/changeset/base/326095 > > > > >>> Log: > > > > >>> bsdinstall: Add ntpdate option > > > > >>> > > > > >>> When you install a computer for the first time, the date in the > > > > >>> CMOS sometimes > > > > >>> not accurate and you need to ntpdate as ntpd will fail a the time > > > > >>> difference > > > > >>> is too big. > > > > >>> Add an option in bsdinstall to enable ntpdate that will do that > > > > >>> for us. > > > > >>> > > > > >>> Reviewed by:allanjude > > > > >>> Differential Revision:https://reviews.freebsd.org/D13149 > > > > >>> Modified: > > > > >>> head/usr.sbin/bsdinstall/scripts/services > > > > >>> Modified: head/usr.sbin/bsdinstall/scripts/services > > > > >>> == > > > > >>> --- head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 > > > > >>> 15:18:11 2017(r326094) > > > > >>> +++ head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 > > > > >>> 15:27:47 2017(r326095) > > > > >>> @@ -46,6 +46,8 @@ DAEMONS=$( dialog --backtitle "FreeBSD Installer" > > > > >>> \ > > > > >>> local_unbound "Local caching validating resolver" > > > > >>> ${local_unbound:-off} \ > > > > >>> sshd"Secure shell daemon" ${sshd_enable:-off} \ > > > > >>> moused"PS/2 mouse pointer on console" > > > > >>> ${moused_enable:-off} \ > > > > >>> +ntpdate"Synchronize system and network time at bootime" \ > > > > >>> +${ntpdate_enable:-off} \ > > > > >>> ntpd"Synchronize system and network time" > > > > >>> ${ntpd_enable:-off} \ > > > > >>> powerd"Adjust CPU frequency dynamically if supported" \ > > > > >>> ${powerd_enable:-off} \ > > > > >> The right way to enable a time-step at boot is to set the rc conf > > > > >> variable ntpd_sync_on_start to YES. ntpdate has been deprecated for > > > > >> *years*. > > > > >> -- Ian > > > > > > > > > > Hi Ian, > > > > > > > > > > Thanks I didn't know about option -g (nor ntpd_sync_on_start), this > > > > > bring a few questions : > > > > > > > > > > - Is there any reason to not always use -g for ntpd ? As a lambda > > > > > user I just want my time to be set, no matter what. > > > > > - Should we remove ntpdate in -current before 12 if it's deprecated ? > > > > > > > > > > I'll make the necessary changes according to your (or others) answers. > > > > > > > > > > > > > I would not remove ntpdate. > > > > I concur, as ntpdate is trivial to use, ntpd -pg requires a proper > > /etc/ntp.conf, > > though that is trival too you well not get what you want if you do not have > > that. > > From the website you linked after they say to use : > ntpd -gqc /dev/null server1.name.net server2.name.org server3.name.com > for use without ntp.conf. I do not think you want to do that, as if you read just a bit further you see: Possible hitch: ntpd will step the time adjustment if it is more than 128ms (default). This means that a 128ms adjustment will take 256 seconds to apply. We want an option to step any initial offset, I suspect. So even the ntp folks seem to have issues with replacing ntpdate > Also we do provide an ntp.conf so ... We do, a template, all commented out, and does not work for machines behind strong firewalls that wont allow ntp out to the net but have internal ntp servers that are used for such things. Well maybe not all commented out, I think it defaults to some public pools. I believe it would be missing iburst for use with ntp -pg > > > > > Is there a way to make ntpd sync and then quit immediately? > > > > > > Just by reading the man I see the -q option which does exactly that. > > > Setting both -q and -g should have the same behavior than ntpdate (not > > > tested). > > > > ntpd -pg is the preferred method per the ntp.org documentation: > > https://support.ntp.org/bin/view/Dev/DeprecatingNtpdate > > -gq like I said but it's good to have an official reference. > > > > > > > > If not, sounds like ntpdate serves a purpose not filled by ntpd. > > > > > > > > Valid case is someone running a VM that gets paused for days, weeks, or > > > > even months at a time. On such a VM it may make more sense to let the > > > > clock be only sporadically managed in an adhoc manner. > > > > > > > > I personally like to use ntpdate on said VMs because I generally set a > > > > timeout on my ssh-agent in
Re: svn commit: r326073 - head/usr.bin/systat
On Fri, Nov 24, 2017 at 12:10:09AM +1100, Bruce Evans wrote: > On Thu, 23 Nov 2017, Konstantin Belousov wrote: > > > On Thu, Nov 23, 2017 at 04:24:13AM +1100, Bruce Evans wrote: > >> sysctl/sysctl.c: > >>sysctl(8) has bogus support for prettyprinting struct vmtotal (sysctl > >>shouldn't have any prettyprinting, especially not for structs that have > >>specialized programs to print them and much more). This uses intmax_t > >>for all calculations and printing except for the int16_t fields, so it > >>automatically benefited from the expansion. However since it uses a > >>correct type (signed, and not restricted to 64 bits), it now has minor > >>type errors -- it dowcasts the uint64_t to intmax_t wheen the latter is > >>64 bits. Its Makefile uses a fairly high WARNS, so if its type errors > >>were fatal then printf format checking would have detected them (but > >>not non-fatal errors involving downcasting). > > > > Below is the cast to uintmax_t and unsigned format for sysctl(8). > > This adds style bugs by expanding lines from length 79 to 81. > > > diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c > > index e1bf4e31914..92685a8171b 100644 > > --- a/sbin/sysctl/sysctl.c > > +++ b/sbin/sysctl/sysctl.c > > @@ -625,15 +625,15 @@ S_vmtotal(size_t l2, void *p) > > "%hd Sleep: %hd)\n", > > v->t_rq, v->t_dw, v->t_pw, v->t_sl); > > printf( > > - "Virtual Memory:\t\t(Total: %jdK Active: %jdK)\n", > > - (intmax_t)v->t_vm * pageKilo, (intmax_t)v->t_avm * pageKilo); > > - printf("Real Memory:\t\t(Total: %jdK Active: %jdK)\n", > > - (intmax_t)v->t_rm * pageKilo, (intmax_t)v->t_arm * pageKilo); > > - printf("Shared Virtual Memory:\t(Total: %jdK Active: %jdK)\n", > > - (intmax_t)v->t_vmshr * pageKilo, (intmax_t)v->t_avmshr * pageKilo); > > - printf("Shared Real Memory:\t(Total: %jdK Active: %jdK)\n", > > - (intmax_t)v->t_rmshr * pageKilo, (intmax_t)v->t_armshr * pageKilo); > > - printf("Free Memory:\t%jdK", (intmax_t)v->t_free * pageKilo); > > + "Virtual Memory:\t\t(Total: %juK Active: %juK)\n", > > + (uintmax_t)v->t_vm * pageKilo, (uintmax_t)v->t_avm * pageKilo); > > + printf("Real Memory:\t\t(Total: %juK Active: %juK)\n", > > + (uintmax_t)v->t_rm * pageKilo, (uintmax_t)v->t_arm * pageKilo); > > + printf("Shared Virtual Memory:\t(Total: %juK Active: %juK)\n", > > + (uintmax_t)v->t_vmshr * pageKilo, (uintmax_t)v->t_avmshr * > > pageKilo); > > + printf("Shared Real Memory:\t(Total: %juK Active: %juK)\n", > > + (uintmax_t)v->t_rmshr * pageKilo, (uintmax_t)v->t_armshr * > > pageKilo); > > + printf("Free Memory:\t%juK", (uintmax_t)v->t_free * pageKilo); > > > > return (0); > > } > > All of the casts to uintmax_t can be avoided be avoided by changing the type > of pageKilo from int to uintmax_t. > > Better, do the conversion in a function-like macro pgtokb() as is done in > all (?) other utilities, but without so many overflow bugs as in most other > utiities: > > #define pgtok(p)((uintmax_t)(p) * pageKilo) Amusingly there is already MD macro in machine/param.h with the same name and same intent, but as you formulate it, sloppy implementation. It uses unsigned long cast on almost all 64bit arches, except powerpc. For 32bit arches, the cast is not done, unfortunately. > > (pageKilo is back to int). This is still sloppy: > - pageKilo = getpagesize() / 1024 assumes that the page size is a multiple >of 1024 and fails very badly when the page size is 512 > - the multiplication can still overflow > - when the size in K is too large to fit, the size in M or G will normally >fit and converting directly to would avoid the overflow assuming that >the page size is <= 1M. > > Using floating point (even float precision) avoids all overflow and rounding > problems up to almost 128-bit sizes in bytes: No, I do not want to use floating point calculation there. diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index e1bf4e31914..36851f302a0 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -608,14 +608,18 @@ S_timeval(size_t l2, void *p) static int S_vmtotal(size_t l2, void *p) { - struct vmtotal *v = (struct vmtotal *)p; - int pageKilo = getpagesize() / 1024; + struct vmtotal *v; + int pageKilo; if (l2 != sizeof(*v)) { warnx("S_vmtotal %zu != %zu", l2, sizeof(*v)); return (1); } + v = p; + pageKilo = getpagesize() / 1024; + +#definepg2k(a) ((uintmax_t)(a) * pageKilo) printf( "\nSystem wide totals computed every five seconds:" " (values in kilobytes)\n"); @@ -624,16 +628,16 @@ S_vmtotal(size_t l2, void *p) "Processes:\t\t(RUNQ: %hd Disk Wait: %hd Page Wait: " "%hd Sleep: %hd)\n", v->t_rq, v->t_dw, v->t_pw, v->t_sl); - printf( - "Virtual Memory:\t\t(Total: %
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
On Thu, 23 Nov 2017 07:17:49 -0800 (PST) "Rodney W. Grimes" wrote: > > On Thu, 23 Nov 2017 06:56:50 -0800 (PST) > > "Rodney W. Grimes" wrote: > > > > > > > > > > Hi Devin, > > > > > > > > On Thu, 23 Nov 2017 01:33:39 -0800 > > > > Devin Teske wrote: > > > > > > > > > > > > > > > > > > > > On Nov 22, 2017, at 11:15 PM, Emmanuel Vadot > > > > > > wrote: > > > > > > > > > > > >> On 2017-11-22 17:38, Ian Lepore wrote: > > > > > >>> On Wed, 2017-11-22 at 15:27 +, Emmanuel Vadot wrote: > > > > > >>> Author: manu > > > > > >>> Date: Wed Nov 22 15:27:47 2017 > > > > > >>> New Revision: 326095 > > > > > >>> URL: https://svnweb.freebsd.org/changeset/base/326095 > > > > > >>> Log: > > > > > >>> bsdinstall: Add ntpdate option > > > > > >>> > > > > > >>> When you install a computer for the first time, the date in the > > > > > >>> CMOS sometimes > > > > > >>> not accurate and you need to ntpdate as ntpd will fail a the > > > > > >>> time difference > > > > > >>> is too big. > > > > > >>> Add an option in bsdinstall to enable ntpdate that will do that > > > > > >>> for us. > > > > > >>> > > > > > >>> Reviewed by:allanjude > > > > > >>> Differential Revision:https://reviews.freebsd.org/D13149 > > > > > >>> Modified: > > > > > >>> head/usr.sbin/bsdinstall/scripts/services > > > > > >>> Modified: head/usr.sbin/bsdinstall/scripts/services > > > > > >>> == > > > > > >>> --- head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 > > > > > >>> 15:18:11 2017(r326094) > > > > > >>> +++ head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 > > > > > >>> 15:27:47 2017(r326095) > > > > > >>> @@ -46,6 +46,8 @@ DAEMONS=$( dialog --backtitle "FreeBSD > > > > > >>> Installer" \ > > > > > >>> local_unbound "Local caching validating resolver" > > > > > >>> ${local_unbound:-off} \ > > > > > >>> sshd"Secure shell daemon" ${sshd_enable:-off} \ > > > > > >>> moused"PS/2 mouse pointer on console" > > > > > >>> ${moused_enable:-off} \ > > > > > >>> +ntpdate"Synchronize system and network time at bootime" \ > > > > > >>> +${ntpdate_enable:-off} \ > > > > > >>> ntpd"Synchronize system and network time" > > > > > >>> ${ntpd_enable:-off} \ > > > > > >>> powerd"Adjust CPU frequency dynamically if supported" \ > > > > > >>> ${powerd_enable:-off} \ > > > > > >> The right way to enable a time-step at boot is to set the rc conf > > > > > >> variable ntpd_sync_on_start to YES. ntpdate has been deprecated > > > > > >> for > > > > > >> *years*. > > > > > >> -- Ian > > > > > > > > > > > > Hi Ian, > > > > > > > > > > > > Thanks I didn't know about option -g (nor ntpd_sync_on_start), this > > > > > > bring a few questions : > > > > > > > > > > > > - Is there any reason to not always use -g for ntpd ? As a lambda > > > > > > user I just want my time to be set, no matter what. > > > > > > - Should we remove ntpdate in -current before 12 if it's deprecated > > > > > > ? > > > > > > > > > > > > I'll make the necessary changes according to your (or others) > > > > > > answers. > > > > > > > > > > > > > > > > I would not remove ntpdate. > > > > > > I concur, as ntpdate is trivial to use, ntpd -pg requires a proper > > > /etc/ntp.conf, > > > though that is trival too you well not get what you want if you do not > > > have > > > that. > > > > From the website you linked after they say to use : > > ntpd -gqc /dev/null server1.name.net server2.name.org server3.name.com > > for use without ntp.conf. > > I do not think you want to do that, as if you read just a bit further you see: > > Possible hitch: ntpd will step the time adjustment if it is more > than 128ms (default). This means that a 128ms adjustment will take > 256 seconds to apply. We want an option to step any initial offset, > I suspect. > > So even the ntp folks seem to have issues with replacing ntpdate There is -G for that. > > Also we do provide an ntp.conf so ... > > We do, a template, all commented out, and does not work for > machines behind strong firewalls that wont allow ntp out > to the net but have internal ntp servers that are used for > such things. > > Well maybe not all commented out, I think it defaults to > some public pools. I believe it would be missing iburst > for use with ntp -pg Nope, see : https://svnweb.freebsd.org/base/head/etc/ntp.conf?revision=311103&view=markup#l32 > > > > > > > Is there a way to make ntpd sync and then quit immediately? > > > > > > > > Just by reading the man I see the -q option which does exactly that. > > > > Setting both -q and -g should have the same behavior than ntpdate (not > > > > tested). > > > > > > ntpd -pg is the preferred method per the ntp.org documentation: > > > https://support.ntp.org/bin/view/Dev/DeprecatingNtpdate > > > > -gq like I said but it's good to have an officia
svn commit: r326136 - head/contrib/binutils/bfd
Author: emaste Date: Thu Nov 23 16:04:52 2017 New Revision: 326136 URL: https://svnweb.freebsd.org/changeset/base/326136 Log: bfd: avoid crash on corrupt binaries From binutils commits 5a4b0ccc20ba30caef53b01bee2c0aaa5b855339 and 7e1e19887abd24aeb15066b141cdff5541e0ec8e, made available under GPLv2 by Nick Clifton. PR: 198824 MFC after:1 week Security: CVE-2014-8501 Security: CVE-2014-8502 Modified: head/contrib/binutils/bfd/peXXigen.c Modified: head/contrib/binutils/bfd/peXXigen.c == --- head/contrib/binutils/bfd/peXXigen.cThu Nov 23 14:30:41 2017 (r326135) +++ head/contrib/binutils/bfd/peXXigen.cThu Nov 23 16:04:52 2017 (r326136) @@ -448,6 +448,17 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, { int idx; +/* PR 17512: Corrupt PE binaries can cause seg-faults. */ +if (a->NumberOfRvaAndSizes > 16) + { + (*_bfd_error_handler) + (_("%B: aout header specifies an invalid number of data-directory entries: %d"), + abfd, a->NumberOfRvaAndSizes); + /* Paranoia: If the number is corrupt, then assume that the + actual entries themselves might be corrupt as well. */ + a->NumberOfRvaAndSizes = 0; + } + for (idx = 0; idx < 16; idx++) { /* If data directory is empty, rva also should be 0. */ @@ -1426,6 +1437,15 @@ pe_print_edata (bfd * abfd, void * vfile) section->name); return TRUE; } +} + + /* PR 17512: Handle corrupt PE binaries. */ + if (datasize < 36) +{ + fprintf (file, + _("\nThere is an export table in %s, but it is too small (%d)\n"), + section->name, (int) datasize); + return TRUE; } fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"), ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
On Thu, 2017-11-23 at 06:56 -0800, Rodney W. Grimes wrote: > > > > > > Hi Devin, > > > > On Thu, 23 Nov 2017 01:33:39 -0800 > > Devin Teske wrote: > > > > > > > > > > > > > > > > > > > On Nov 22, 2017, at 11:15 PM, Emmanuel Vadot wrote: > > > > > > > > > > > > > > On 2017-11-22 17:38, Ian Lepore wrote: > > > > > > > > > > > > On Wed, 2017-11-22 at 15:27 +, Emmanuel Vadot wrote: > > > > > > Author: manu > > > > > > Date: Wed Nov 22 15:27:47 2017 > > > > > > New Revision: 326095 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/326095 > > > > > > Log: > > > > > > bsdinstall: Add ntpdate option > > > > > > > > > > > > When you install a computer for the first time, the date in the > > > > > > CMOS sometimes > > > > > > not accurate and you need to ntpdate as ntpd will fail a the time > > > > > > difference > > > > > > is too big. > > > > > > Add an option in bsdinstall to enable ntpdate that will do that > > > > > > for us. > > > > > > > > > > > > Reviewed by:allanjude > > > > > > Differential Revision:https://reviews.freebsd.org/D13149 > > > > > > Modified: > > > > > > head/usr.sbin/bsdinstall/scripts/services > > > > > > Modified: head/usr.sbin/bsdinstall/scripts/services > > > > > > == > > > > > > --- head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 > > > > > > 15:18:11 2017(r326094) > > > > > > +++ head/usr.sbin/bsdinstall/scripts/servicesWed Nov 22 > > > > > > 15:27:47 2017(r326095) > > > > > > @@ -46,6 +46,8 @@ DAEMONS=$( dialog --backtitle "FreeBSD Installer" > > > > > > \ > > > > > > local_unbound "Local caching validating resolver" > > > > > > ${local_unbound:-off} \ > > > > > > sshd"Secure shell daemon" ${sshd_enable:-off} \ > > > > > > moused"PS/2 mouse pointer on console" > > > > > > ${moused_enable:-off} \ > > > > > > +ntpdate"Synchronize system and network time at bootime" \ > > > > > > +${ntpdate_enable:-off} \ > > > > > > ntpd"Synchronize system and network time" > > > > > > ${ntpd_enable:-off} \ > > > > > > powerd"Adjust CPU frequency dynamically if supported" \ > > > > > > ${powerd_enable:-off} \ > > > > > The right way to enable a time-step at boot is to set the rc conf > > > > > variable ntpd_sync_on_start to YES. ntpdate has been deprecated for > > > > > *years*. > > > > > -- Ian > > > > Hi Ian, > > > > > > > > Thanks I didn't know about option -g (nor ntpd_sync_on_start), this > > > > bring a few questions : > > > > > > > > - Is there any reason to not always use -g for ntpd ? As a lambda user > > > > I just want my time to be set, no matter what. > > > > - Should we remove ntpdate in -current before 12 if it's deprecated ? > > > > > > > > I'll make the necessary changes according to your (or others) answers. > > > > > > > I would not remove ntpdate. > I concur, as ntpdate is trivial to use, ntpd -pg requires a proper > /etc/ntp.conf, > though that is trival too you well not get what you want if you do not have > that. > > > > > > > > > Is there a way to make ntpd sync and then quit immediately? > > Just by reading the man I see the -q option which does exactly that. > > Setting both -q and -g should have the same behavior than ntpdate (not > > tested). > ntpd -pg is the preferred method per the ntp.org documentation: > https://support.ntp.org/bin/view/Dev/DeprecatingNtpdate > > > > > > > > > > > If not, sounds like ntpdate serves a purpose not filled by ntpd. > > > > > > Valid case is someone running a VM that gets paused for days, weeks, or > > > even months at a time. On such a VM it may make more sense to let the > > > clock be only sporadically managed in an adhoc manner. > > > > > > I personally like to use ntpdate on said VMs because I generally set a > > > timeout on my ssh-agent in said VMs and by managing the clock manually > > > allows me to better control keys loaded. > > > > > > Pretty sure other people may have other reasons for non-daemonized clock > > > management. > > That's why I asked :) > I think that the ntp distribution still contains ntpdate, so long as that is > true > we should continue to include it in FreeBSD. When/if they remove it from the > official ntp distribution then this issue shall need a revist. > I tend to agree with this... it's the ntpd project that deprecated ntpdate years ago, but as long as it's included in their distributions, we should include it in ours. But I also think we shouldn't add new uses of it when there are alternatives available. -- Ian ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
On Thu, Nov 23, 2017 at 7:17 AM, Rodney W. Grimes wrote: >> Also we do provide an ntp.conf so ... > > We do, a template, all commented out, and does not work for > machines behind strong firewalls that wont allow ntp out > to the net but have internal ntp servers that are used for > such things. > > Well maybe not all commented out, I think it defaults to > some public pools. I believe it would be missing iburst > for use with ntp -pg Does ntpdate work out of the box in such environments? If so, how? Conrad ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
[ Charset UTF-8 unsupported, converting... ] > On Thu, Nov 23, 2017 at 7:17 AM, Rodney W. Grimes > wrote: > >> Also we do provide an ntp.conf so ... > > > > We do, a template, all commented out, and does not work for > > machines behind strong firewalls that wont allow ntp out > > to the net but have internal ntp servers that are used for > > such things. > > > > Well maybe not all commented out, I think it defaults to > > some public pools. I believe it would be missing iburst > > for use with ntp -pg > > Does ntpdate work out of the box in such environments? If so, how? ntpdate time.nist.gov ntpdate does not need a configureration file, just a command line argument. -- Rod Grimes rgri...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326137 - in head/sys: arm/arm arm64/arm64 arm64/include
Author: andrew Date: Thu Nov 23 17:40:40 2017 New Revision: 326137 URL: https://svnweb.freebsd.org/changeset/base/326137 Log: Ensure we check the program state set in the trap frame on arm and arm64. This value may be set by userspace so we need to check it before using it. If this is not done correctly on exception return the kernel may continue in kernel mode with all registers set to a userspace controlled value. Fix this by moving the check into set_mcontext, and also add the missing sanitisation from the arm64 set_regs. Discussed with: security-officer@ MFC after:3 days Sponsored by: DARPA, AFRL Modified: head/sys/arm/arm/machdep.c head/sys/arm64/arm64/machdep.c head/sys/arm64/include/armreg.h Modified: head/sys/arm/arm/machdep.c == --- head/sys/arm/arm/machdep.c Thu Nov 23 16:04:52 2017(r326136) +++ head/sys/arm/arm/machdep.c Thu Nov 23 17:40:40 2017(r326137) @@ -518,7 +518,17 @@ set_mcontext(struct thread *td, mcontext_t *mcp) mcontext_vfp_t mc_vfp, *vfp; struct trapframe *tf = td->td_frame; const __greg_t *gr = mcp->__gregs; + int spsr; + /* +* Make sure the processor mode has not been tampered with and +* interrupts have not been disabled. +*/ + spsr = gr[_REG_CPSR]; + if ((spsr & PSR_MODE) != PSR_USR32_MODE || + (spsr & (PSR_I | PSR_F)) != 0) + return (EINVAL); + #ifdef WITNESS if (mcp->mc_vfp_size != 0 && mcp->mc_vfp_size != sizeof(mc_vfp)) { printf("%s: %s: Malformed mc_vfp_size: %d (0x%08X)\n", @@ -677,22 +687,16 @@ sys_sigreturn(td, uap) } */ *uap; { ucontext_t uc; - int spsr; + int error; if (uap == NULL) return (EFAULT); if (copyin(uap->sigcntxp, &uc, sizeof(uc))) return (EFAULT); - /* -* Make sure the processor mode has not been tampered with and -* interrupts have not been disabled. -*/ - spsr = uc.uc_mcontext.__gregs[_REG_CPSR]; - if ((spsr & PSR_MODE) != PSR_USR32_MODE || - (spsr & (PSR_I | PSR_F)) != 0) - return (EINVAL); /* Restore register context. */ - set_mcontext(td, &uc.uc_mcontext); + error = set_mcontext(td, &uc.uc_mcontext); + if (error != 0) + return (error); /* Restore signal mask. */ kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); Modified: head/sys/arm64/arm64/machdep.c == --- head/sys/arm64/arm64/machdep.c Thu Nov 23 16:04:52 2017 (r326136) +++ head/sys/arm64/arm64/machdep.c Thu Nov 23 17:40:40 2017 (r326137) @@ -211,7 +211,8 @@ set_regs(struct thread *td, struct reg *regs) frame->tf_sp = regs->sp; frame->tf_lr = regs->lr; frame->tf_elr = regs->elr; - frame->tf_spsr = regs->spsr; + frame->tf_spsr &= ~PSR_FLAGS; + frame->tf_spsr |= regs->spsr & PSR_FLAGS; memcpy(frame->tf_x, regs->x, sizeof(frame->tf_x)); @@ -354,7 +355,13 @@ int set_mcontext(struct thread *td, mcontext_t *mcp) { struct trapframe *tf = td->td_frame; + uint32_t spsr; + spsr = mcp->mc_gpregs.gp_spsr; + if ((spsr & PSR_M_MASK) != PSR_M_EL0t || + (spsr & (PSR_F | PSR_I | PSR_A | PSR_D)) != 0) + return (EINVAL); + memcpy(tf->tf_x, mcp->mc_gpregs.gp_x, sizeof(tf->tf_x)); tf->tf_sp = mcp->mc_gpregs.gp_sp; @@ -530,19 +537,16 @@ int sys_sigreturn(struct thread *td, struct sigreturn_args *uap) { ucontext_t uc; - uint32_t spsr; + int error; if (uap == NULL) return (EFAULT); if (copyin(uap->sigcntxp, &uc, sizeof(uc))) return (EFAULT); - spsr = uc.uc_mcontext.mc_gpregs.gp_spsr; - if ((spsr & PSR_M_MASK) != PSR_M_EL0t || - (spsr & (PSR_F | PSR_I | PSR_A | PSR_D)) != 0) - return (EINVAL); - - set_mcontext(td, &uc.uc_mcontext); + error = set_mcontext(td, &uc.uc_mcontext); + if (error != 0) + return (error); set_fpcontext(td, &uc.uc_mcontext); /* Restore signal mask. */ Modified: head/sys/arm64/include/armreg.h == --- head/sys/arm64/include/armreg.h Thu Nov 23 16:04:52 2017 (r326136) +++ head/sys/arm64/include/armreg.h Thu Nov 23 17:40:40 2017 (r326137) @@ -572,6 +572,7 @@ #definePSR_C 0x2000 #definePSR_Z 0x4000 #definePSR_N 0x8000 +#definePSR_FLAGS 0xf000 /* TCR_EL1 - Translation Control Register */ #defineTCR_ASID_16 (1 << 36) ___
svn commit: r326138 - head/usr.bin/vmstat
Author: kib Date: Thu Nov 23 19:06:44 2017 New Revision: 326138 URL: https://svnweb.freebsd.org/changeset/base/326138 Log: Use C standard spelling uint64_t for u_int64_t. Submitted by: Pawel Biernacki Sponsored by: Mysterious Code Ltd. X-Differential revision: https://reviews.freebsd.org/D13199 Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c == --- head/usr.bin/vmstat/vmstat.cThu Nov 23 17:40:40 2017 (r326137) +++ head/usr.bin/vmstat/vmstat.cThu Nov 23 19:06:44 2017 (r326138) @@ -665,7 +665,7 @@ getcpuinfo(u_long *maskp, int *maxidp) static void -prthuman(const char *name, u_int64_t val, int size) +prthuman(const char *name, uint64_t val, int size) { char buf[10]; int flags; @@ -822,10 +822,10 @@ dovmstat(unsigned int interval, int reps) if (hflag) { xo_emit(""); prthuman("available-memory", -total.t_avm * (u_int64_t)sum.v_page_size, 5); +total.t_avm * (uint64_t)sum.v_page_size, 5); xo_emit(" "); prthuman("free-memory", -total.t_free * (u_int64_t)sum.v_page_size, 5); +total.t_free * (uint64_t)sum.v_page_size, 5); xo_emit(" "); } else { xo_emit(" "); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326139 - head/usr.bin/vmstat
Author: kib Date: Thu Nov 23 19:10:09 2017 New Revision: 326139 URL: https://svnweb.freebsd.org/changeset/base/326139 Log: vmstat: use 64-bit counters from struct vmtotal. Consistently print counters using unsigned intmax type. Submitted by: Pawel Biernacki Sponsored by: Mysterious Code Ltd. Differential revision:https://reviews.freebsd.org/D13199 Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c == --- head/usr.bin/vmstat/vmstat.cThu Nov 23 19:06:44 2017 (r326138) +++ head/usr.bin/vmstat/vmstat.cThu Nov 23 19:10:09 2017 (r326139) @@ -817,7 +817,7 @@ dovmstat(unsigned int interval, int reps) total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); xo_close_container("processes"); xo_open_container("memory"); -#define vmstat_pgtok(a) ((a) * (sum.v_page_size >> 10)) +#define vmstat_pgtok(a) ((uintmax_t)(a) * (sum.v_page_size >> 10)) #definerate(x) (((x) * rate_adj + halfuptime) / uptime)/* round */ if (hflag) { xo_emit(""); @@ -829,10 +829,10 @@ dovmstat(unsigned int interval, int reps) xo_emit(" "); } else { xo_emit(" "); - xo_emit("{:available-memory/%7d}", + xo_emit("{:available-memory/%7ju}", vmstat_pgtok(total.t_avm)); xo_emit(" "); - xo_emit("{:free-memory/%7d}", + xo_emit("{:free-memory/%7ju}", vmstat_pgtok(total.t_free)); xo_emit(" "); } @@ -1555,9 +1555,9 @@ display_object(struct kinfo_vmobject *kvo) const char *str; xo_open_instance("object"); -xo_emit("{:resident/%5jd} ", (uintmax_t)kvo->kvo_resident); - xo_emit("{:active/%5jd} ", (uintmax_t)kvo->kvo_active); - xo_emit("{:inactive/%5jd} ", (uintmax_t)kvo->kvo_inactive); + xo_emit("{:resident/%5ju} ", (uintmax_t)kvo->kvo_resident); + xo_emit("{:active/%5ju} ", (uintmax_t)kvo->kvo_active); + xo_emit("{:inactive/%5ju} ", (uintmax_t)kvo->kvo_inactive); xo_emit("{:refcount/%3d} ", kvo->kvo_ref_count); xo_emit("{:shadowcount/%3d} ", kvo->kvo_shadow_count); switch (kvo->kvo_memattr) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
> On Nov 23, 2017, at 9:29 AM, Rodney W. Grimes > wrote: > > [ Charset UTF-8 unsupported, converting... ] >> On Thu, Nov 23, 2017 at 7:17 AM, Rodney W. Grimes >> wrote: Also we do provide an ntp.conf so ... >>> >>> We do, a template, all commented out, and does not work for >>> machines behind strong firewalls that wont allow ntp out >>> to the net but have internal ntp servers that are used for >>> such things. >>> >>> Well maybe not all commented out, I think it defaults to >>> some public pools. I believe it would be missing iburst >>> for use with ntp -pg >> >> Does ntpdate work out of the box in such environments? If so, how? > > ntpdate time.nist.gov > > ntpdate does not need a configureration file, just a command > line argument. > > At the banks we used to rely on both (in this order) ntpdate running and then ntpd running. Running ntpdate before ntpd meant that on a [re]boot, ntpdate would jump the box to the appropriate time, regardless of how far behind the clock was (think "dead cmos battery" on a system left powered-off for a long time). Meanwhile, running ntpd *without* the sync-on-start feature meant we could bounce the ntpd service as necessary and it would always adhere to the limit we set on it -- one hour to prevent syncing on systems which had been manually adjusted by greater than an hour for some one-off instances. -- Devin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326140 - head/share/examples/bhyve
Author: avg Date: Thu Nov 23 22:10:12 2017 New Revision: 326140 URL: https://svnweb.freebsd.org/changeset/base/326140 Log: vmrun.sh: add -A option for AHCI emulation of disk devices AHCI emulation is useful for testing scenarios closer to the real hardware. For example, it allows to exercise the CAM subsystem. There could be other uses as well. MFC after:2 weeks Modified: head/share/examples/bhyve/vmrun.sh Modified: head/share/examples/bhyve/vmrun.sh == --- head/share/examples/bhyve/vmrun.sh Thu Nov 23 19:10:09 2017 (r326139) +++ head/share/examples/bhyve/vmrun.sh Thu Nov 23 22:10:12 2017 (r326140) @@ -46,7 +46,7 @@ errmsg() { usage() { local msg=$1 - echo "Usage: vmrun.sh [-aEhiTv] [-c ] [-C ] [-d ]" + echo "Usage: vmrun.sh [-aAEhiTv] [-c ] [-C ] [-d ]" echo "[-e ] [-f ] [-F ]" echo "[-g ] [-H ]" echo "[-I ] [-l ]" @@ -55,6 +55,7 @@ usage() { echo "" echo " -h: display this help message" echo " -a: force memory mapped local APIC access" + echo " -A: use AHCI disk emulation instead of virtio" echo " -c: number of virtual cpus (default is ${DEFAULT_CPUS})" echo " -C: console device (default is ${DEFAULT_CONSOLE})" echo " -d: virtio diskdev file (default is ${DEFAULT_VIRTIO_DISK})" @@ -99,6 +100,7 @@ console=${DEFAULT_CONSOLE} cpus=${DEFAULT_CPUS} tap_total=0 disk_total=0 +disk_emulation="virtio-blk" gdbport=0 loader_opt="" bhyverun_opt="-H -A -P" @@ -113,11 +115,14 @@ vncport=5900 fbsize="w=1024,h=768" tablet="" -while getopts ac:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c ; do +while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c ; do case $c in a) bhyverun_opt="${bhyverun_opt} -a" ;; + A) + disk_emulation="ahci-hd" + ;; c) cpus=${OPTARG} ;; @@ -316,7 +321,7 @@ while [ 1 ]; do eval "disk=\$disk_dev${i}" eval "opts=\$disk_opts${i}" make_and_check_diskdev "${disk}" - devargs="$devargs -s $nextslot:0,virtio-blk,${disk}${opts} " + devargs="$devargs -s $nextslot:0,$disk_emulation,${disk}${opts} " nextslot=$(($nextslot + 1)) i=$(($i + 1)) done ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326141 - head/sys/arm/allwinner/clkng
Author: kevans Date: Fri Nov 24 02:39:38 2017 New Revision: 326141 URL: https://svnweb.freebsd.org/changeset/base/326141 Log: Add ccu compat string for Allwinner a83t A ccu driver was added for the a83t in r326114. Add compat string to aw_ccung and register the clocks for the a83t upon attach. Reviewed by: manu Approved by: emaste (mentor, implicit) Differential Revision:https://reviews.freebsd.org/D13205 Modified: head/sys/arm/allwinner/clkng/aw_ccung.c Modified: head/sys/arm/allwinner/clkng/aw_ccung.c == --- head/sys/arm/allwinner/clkng/aw_ccung.c Thu Nov 23 22:10:12 2017 (r326140) +++ head/sys/arm/allwinner/clkng/aw_ccung.c Fri Nov 24 02:39:38 2017 (r326141) @@ -76,6 +76,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#if defined(SOC_ALLWINNER_A83T) +#include +#endif + #include "clkdev_if.h" #include "hwreset_if.h" @@ -102,6 +106,10 @@ static struct resource_spec aw_ccung_spec[] = { #defineA13_CCU 6 #endif +#if defined(SOC_ALLWINNER_A83T) +#defineA83T_CCU7 +#endif + static struct ofw_compat_data compat_data[] = { #if defined(SOC_ALLWINNER_A31) { "allwinner,sun5i-a13-ccu", A13_CCU}, @@ -117,6 +125,9 @@ static struct ofw_compat_data compat_data[] = { { "allwinner,sun50i-a64-ccu", A64_CCU }, { "allwinner,sun50i-a64-r-ccu", A64_R_CCU }, #endif +#if defined(SOC_ALLWINNER_A83T) + { "allwinner,sun8i-a83t-ccu", A83T_CCU }, +#endif {NULL, 0 } }; @@ -357,6 +368,11 @@ aw_ccung_attach(device_t dev) break; case A64_R_CCU: ccu_sun8i_r_register_clocks(sc); + break; +#endif +#if defined(SOC_ALLWINNER_A83T) + case A83T_CCU: + ccu_a83t_register_clocks(sc); break; #endif } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326143 - head/stand/common
Author: imp Date: Fri Nov 24 05:00:25 2017 New Revision: 326143 URL: https://svnweb.freebsd.org/changeset/base/326143 Log: Fix theoretical integer overflow issues. If the product here is greater than 2^31-1, then the result will be huge. This is unlikely, as we don't support that many sections, but out of an abundace of caution cast to size_t so the multiplication won't overflow mysteriously when size_t is larger than 32-bits. The resulting code may be a smidge larger, but this isn't super-space critical code. CID: 1194216, 1194217, 1194222, 1194223, 1265018, 1265019,1265020, 1265021 Sponsored by: Netflix Modified: head/stand/common/load_elf.c Modified: head/stand/common/load_elf.c == --- head/stand/common/load_elf.cFri Nov 24 04:42:21 2017 (r326142) +++ head/stand/common/load_elf.cFri Nov 24 05:00:25 2017 (r326143) @@ -456,7 +456,7 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ * think the rule is going to have to be that you must strip a * file to remove symbols before gzipping it. */ -chunk = ehdr->e_shnum * ehdr->e_shentsize; +chunk = (size_t)ehdr->e_shnum * (size_t)ehdr->e_shentsize; if (chunk == 0 || ehdr->e_shoff == 0) goto nosyms; shdr = alloc_pread(ef->fd, ehdr->e_shoff, chunk); @@ -747,7 +747,7 @@ __elfN(load_modmetadata)(struct preloaded_file *fp, u_ goto out; } - size = ef.ehdr->e_shnum * ef.ehdr->e_shentsize; + size = (size_t)ef.ehdr->e_shnum * (size_t)ef.ehdr->e_shentsize; shdr = alloc_pread(ef.fd, ef.ehdr->e_shoff, size); if (shdr == NULL) { err = ENOMEM; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326144 - head/stand/userboot/test
Author: imp Date: Fri Nov 24 05:01:00 2017 New Revision: 326144 URL: https://svnweb.freebsd.org/changeset/base/326144 Log: Mark the func pointer as __dead2. It looks up loader_main, which either aborts or exits, but never returns. Tag it as a non-returning function rather than supply a bogus return(0) at the end of main. CID: 1382885 Sponsored by: Netflix Modified: head/stand/userboot/test/test.c Modified: head/stand/userboot/test/test.c == --- head/stand/userboot/test/test.c Fri Nov 24 05:00:25 2017 (r326143) +++ head/stand/userboot/test/test.c Fri Nov 24 05:01:00 2017 (r326144) @@ -422,7 +422,7 @@ int main(int argc, char** argv) { void *h; - void (*func)(struct loader_callbacks *, void *, int, int); + void (*func)(struct loader_callbacks *, void *, int, int) __dead2; int opt; char *disk_image = NULL; const char *userboot_obj = "/boot/userboot.so"; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326145 - in head/sys: amd64/amd64 amd64/ia32 amd64/linux32 arm/cloudabi32 arm64/arm64 arm64/cloudabi64 compat/linux i386/i386 kern powerpc/powerpc riscv/riscv sparc64/sparc64
Author: ed Date: Fri Nov 24 07:35:08 2017 New Revision: 326145 URL: https://svnweb.freebsd.org/changeset/base/326145 Log: Don't let cpu_set_syscall_retval() clobber exec_setregs(). Upon successful completion, the execve() system call invokes exec_setregs() to initialize the registers of the initial thread of the newly executed process. What is weird is that when execve() returns, it still goes through the normal system call return path, clobbering the registers with the system call's return value (td->td_retval). Though this doesn't seem to be problematic for x86 most of the times (as the value of eax/rax doesn't matter upon startup), this can be pretty frustrating for architectures where function argument and return registers overlap (e.g., ARM). On these systems, exec_setregs() also needs to initialize td_retval. Even worse are architectures where cpu_set_syscall_retval() sets registers to values not derived from td_retval. On these architectures, there is no way cpu_set_syscall_retval() can set registers to the way it wants them to be upon the start of execution. To get rid of this madness, let sys_execve() return EJUSTRETURN. This will cause cpu_set_syscall_retval() to leave registers intact. This makes process execution easier to understand. It also eliminates the difference between execution of the initial process and successive ones. The initial call to sys_execve() is not performed through a system call context. Reviewed by: kib, jhibbits Differential Revision:https://reviews.freebsd.org/D13180 Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/ia32/ia32_signal.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/cloudabi32/cloudabi32_sysvec.c head/sys/arm64/arm64/machdep.c head/sys/arm64/cloudabi64/cloudabi64_sysvec.c head/sys/compat/linux/linux_emul.c head/sys/i386/i386/machdep.c head/sys/kern/init_main.c head/sys/kern/kern_exec.c head/sys/powerpc/powerpc/exec_machdep.c head/sys/riscv/riscv/machdep.c head/sys/sparc64/sparc64/machdep.c Modified: head/sys/amd64/amd64/machdep.c == --- head/sys/amd64/amd64/machdep.c Fri Nov 24 05:01:00 2017 (r326144) +++ head/sys/amd64/amd64/machdep.c Fri Nov 24 07:35:08 2017 (r326145) @@ -604,7 +604,6 @@ exec_setregs(struct thread *td, struct image_params *i regs->tf_fs = _ufssel; regs->tf_gs = _ugssel; regs->tf_flags = TF_HASSEGS; - td->td_retval[1] = 0; /* * Reset the hardware debug registers if they were in use. Modified: head/sys/amd64/ia32/ia32_signal.c == --- head/sys/amd64/ia32/ia32_signal.c Fri Nov 24 05:01:00 2017 (r326144) +++ head/sys/amd64/ia32/ia32_signal.c Fri Nov 24 07:35:08 2017 (r326145) @@ -967,5 +967,4 @@ ia32_setregs(struct thread *td, struct image_params *i /* Return via doreti so that we can change to a different %cs */ set_pcb_flags(pcb, PCB_32BIT | PCB_FULL_IRET); - td->td_retval[1] = 0; } Modified: head/sys/amd64/linux32/linux32_sysvec.c == --- head/sys/amd64/linux32/linux32_sysvec.c Fri Nov 24 05:01:00 2017 (r326144) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Nov 24 07:35:08 2017 (r326145) @@ -832,7 +832,6 @@ exec_linux_setregs(struct thread *td, struct image_par /* Do full restore on return so that we can change to a different %cs */ set_pcb_flags(pcb, PCB_32BIT | PCB_FULL_IRET); - td->td_retval[1] = 0; } /* Modified: head/sys/arm/cloudabi32/cloudabi32_sysvec.c == --- head/sys/arm/cloudabi32/cloudabi32_sysvec.c Fri Nov 24 05:01:00 2017 (r326144) +++ head/sys/arm/cloudabi32/cloudabi32_sysvec.c Fri Nov 24 07:35:08 2017 (r326145) @@ -61,7 +61,7 @@ cloudabi32_proc_setregs(struct thread *td, struct imag * tpidrurw to the TCB. */ regs = td->td_frame; - regs->tf_r0 = td->td_retval[0] = + regs->tf_r0 = stack + roundup(sizeof(cloudabi32_tcb_t), sizeof(register_t)); (void)cpu_set_user_tls(td, (void *)stack); } Modified: head/sys/arm64/arm64/machdep.c == --- head/sys/arm64/arm64/machdep.c Fri Nov 24 05:01:00 2017 (r326144) +++ head/sys/arm64/arm64/machdep.c Fri Nov 24 07:35:08 2017 (r326145) @@ -311,12 +311,7 @@ exec_setregs(struct thread *td, struct image_params *i memset(tf, 0, sizeof(struct trapframe)); - /* -* We need to set x0 for init as it doesn't call -* cpu_set_syscall_retval to copy the value. We also -* need to set td_retval for the cases where
Re: svn commit: r326139 - head/usr.bin/vmstat
On Thu, 23 Nov 2017, Konstantin Belousov wrote: Log: vmstat: use 64-bit counters from struct vmtotal. Consistently print counters using unsigned intmax type. Not very consistently. After fixing 0.01% of libxo (just add __printflike() to xo_emit(), the following errors are detected: X vmstat.c:817:23: error: format specifies type 'long' but the argument has type 'int' [-Werror,-Wformat] X total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); X ^~~ X vmstat.c:817:48: error: format specifies type 'long' but the argument has type 'int16_t' (aka 'short') [-Werror,-Wformat] X total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); X ^~ Broken in r291090 (the first libxo commit to this file). All the arg types here are still int since all the fields in 'total' still have type int16_t. X vmstat.c:865:7: error: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Werror,-Wformat] X (unsigned long)rate(sum.v_swtch - osum.v_swtch)); X ^~~ Broken in r291090. Everything in the same printf is broken, but the other bugs are newer and older: - in 4.4BSD-Lite2, the the format was %lu for all 3 values to be printed, but the type was MD. It was apparently long. The struct fields were all u_int IIRC, but the rate() expression involves time_t. time_t was _BSD_TIME_T_, which was apparently long on all arches. - FreeBSD fixed time_t to be int on at least i386. The type error was still non-fatal on 32-bit arches with 32-bit time_t. - I fixed this in r37453. The fix wasn't so good. It retained the %lu format and added casts to u_long to match the format. But the casts are unportable and became wrong when v_swtch etc. were expanded. - r123407 broke the style by changing all u_* to unsigned *. - the casts became wrong, but fairly harmlessly so, on 32-bit arches when v_swtch, etc. was changed to counter_u64_t in r317061 when v_swtch was expanded to counter_u64_t. The problem is limit because the values are rays of differences. Even %u format is probably enough for this. X vmstat.c:1035:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_swtch); X ^~~ X vmstat.c:1037:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_intr); X ^~ X vmstat.c:1039:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_soft); X ^~ X vmstat.c:1040:38: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X xo_emit("{:traps/%9u} {N:traps}\n", sum.v_trap); X ~~~^~ X %9lu X vmstat.c:1042:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_syscall); X ^ X vmstat.c:1044:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_kthreads); X ^~ X vmstat.c:1045:46: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X xo_emit("{:forks/%9u} {N: fork() calls}\n", sum.v_forks); X ~~~^~~ X %9lu X vmstat.c:1047:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_vforks); X ^~~~ X vmstat.c:1049:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_rforks); X ^~~~ X vmstat.c:1051:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_swapin); X ^~~~ X vmstat.c:1053:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_swappgsin); X ^~~ X vmstat.c:1055:3: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] X sum.v_swapout); X ^ X vmstat.c:1057:3: error: format spec