[sparc64] dead code in emul.c
emul.c r1.19 removed a bunch of code, but not enough, and left dead code around. Index: emul.c === RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/emul.c,v retrieving revision 1.23 diff -u -p -r1.23 emul.c --- emul.c 16 Nov 2014 12:30:59 - 1.23 +++ emul.c 6 Aug 2018 20:11:00 - @@ -49,13 +49,9 @@ #define GPR(tf, i) ((int32_t *)(u_long)&tf->tf_global)[i] #define IPR(tf, i) ((int32_t *)(u_long)tf->tf_out[6])[i - 16] -#define FPR(p, i) ((int32_t) p->p_md.md_fpstate->fs_regs[i]) -#define FPRSET(p, i, v)p->p_md.md_fpstate->fs_regs[i] = (v) static __inline int readgpreg(struct trapframe64 *, int, void *); -static __inline int readfpreg(struct proc *, int, void *); static __inline int writegpreg(struct trapframe64 *, int, const void *); -static __inline int writefpreg(struct proc *, int, const void *); static __inline int decodeaddr(struct trapframe64 *, union instr *, void *); static int muldiv(struct trapframe64 *, union instr *, int32_t *, int32_t *, int32_t *); @@ -81,7 +77,6 @@ readgpreg(tf, i, val) return error; } - static __inline int writegpreg(tf, i, val) struct trapframe64 *tf; @@ -99,28 +94,6 @@ writegpreg(tf, i, val) error = copyout((caddr_t) val, &IPR(tf, i), sizeof(int32_t)); return error; -} - - -static __inline int -readfpreg(p, i, val) - struct proc *p; - int i; - void *val; -{ - *(int32_t *) val = FPR(p, i); - return 0; -} - - -static __inline int -writefpreg(p, i, val) - struct proc *p; - int i; - const void *val; -{ - FPRSET(p, i, *(const int32_t *) val); - return 0; } static __inline int
fsck - abort trap on openBSD current
Hi All, Getting some unexpected inconsistencies reported during boot up on my openBSD -current amd64 machine: https://i.imgur.com/ZxnXrx8.jpg How can I fsck /var if fsck abort traps? Wait for next build? Thanks!
Re: Remove dead assignment in login(1)
>>> Tom Cosgrove 7-Aug-18 20:14 >>> > > >>> Frederic Cambus 7-Aug-18 16:15 >>> > > > > Hi tech@, > > > > Since rev 1.36, the instance variable is never read again so we can > > simply drop the else clause with the assignment. > > > > Comments? OK? > > > > Index: usr.bin/login/login.c > > = > RCS file: /cvs/src/usr.bin/login/login.c,v > > retrieving revision 1.69 > > diff -u -p -r1.69 login.c > > --- usr.bin/login/login.c 8 Dec 2017 17:04:15 - 1.69 > > +++ usr.bin/login/login.c 7 Aug 2018 13:47:00 - > > @@ -406,8 +406,7 @@ main(int argc, char *argv[]) > > if (strncmp(instance + 1, "root", 4) == 0) > > rootlogin = 1; > > *instance++ = '\0'; > > You should also remove this line ^ Err, no you shouldn't - sorry. (Note to self: don't email after alcohol, especially to lists) Just ok tom@ > > - } else > > - instance = ""; > > + } > > > > if (strlen(username) > UT_NAMESIZE) > > username[UT_NAMESIZE] = '\0';
Re: Remove dead assignment in login(1)
>>> Frederic Cambus 7-Aug-18 16:15 >>> > > Hi tech@, > > Since rev 1.36, the instance variable is never read again so we can > simply drop the else clause with the assignment. > > Comments? OK? > > Index: usr.bin/login/login.c > == > RCS file: /cvs/src/usr.bin/login/login.c,v > retrieving revision 1.69 > diff -u -p -r1.69 login.c > --- usr.bin/login/login.c 8 Dec 2017 17:04:15 - 1.69 > +++ usr.bin/login/login.c 7 Aug 2018 13:47:00 - > @@ -406,8 +406,7 @@ main(int argc, char *argv[]) > if (strncmp(instance + 1, "root", 4) == 0) > rootlogin = 1; > *instance++ = '\0'; You should also remove this line ^ With that, ok tom@ > - } else > - instance = ""; > + } > > if (strlen(username) > UT_NAMESIZE) > username[UT_NAMESIZE] = '\0';
Re: Remove dead assignment in login(1)
On Tue, 07 Aug 2018 17:15:58 +0200, Frederic Cambus wrote: > Since rev 1.36, the instance variable is never read again so we can > simply drop the else clause with the assignment. OK millert@ - todd
Remove dead assignment in login(1)
Hi tech@, Since rev 1.36, the instance variable is never read again so we can simply drop the else clause with the assignment. Comments? OK? Index: usr.bin/login/login.c === RCS file: /cvs/src/usr.bin/login/login.c,v retrieving revision 1.69 diff -u -p -r1.69 login.c --- usr.bin/login/login.c 8 Dec 2017 17:04:15 - 1.69 +++ usr.bin/login/login.c 7 Aug 2018 13:47:00 - @@ -406,8 +406,7 @@ main(int argc, char *argv[]) if (strncmp(instance + 1, "root", 4) == 0) rootlogin = 1; *instance++ = '\0'; - } else - instance = ""; + } if (strlen(username) > UT_NAMESIZE) username[UT_NAMESIZE] = '\0';
Re: bgpd: reload RIBs in background
On Fri, Aug 03, 2018 at 04:31:58PM +0200, Claudio Jeker wrote: > So the reshuffling made it possible to simply run the reconfigure > of the RIBs in the background and no longer lock up the RDE for > extended times. In short this means that during 'bgpctl reload' > other bgpctl calls no longer block and that also UPDATE from neighbors > are fully processed. > > This does not really spead up anything (apart from maybe some cache > related speedups) but it makes it look faster :) Benno@ noticed that on startup announced networks where gone. Funnily after a reload they came back. Turns out this is a race condition and bug we did not hit before. announced networks are not filtered so we need to skip them in the softreconfig in runner. Until recently the announced networks were never part of Adj-RIB-In but then I added them which now hits this side-effect. Anyway this version just adds a check in the softreconfig_in runner to skip announced networks (or actually aspaths with the flag set). More testing welcome :) -- :wq Claudio Index: rde.c === RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v retrieving revision 1.411 diff -u -p -r1.411 rde.c --- rde.c 6 Aug 2018 15:59:01 - 1.411 +++ rde.c 7 Aug 2018 13:31:54 - @@ -90,7 +90,10 @@ void rde_rib_free(struct rib_desc *); int rde_rdomain_import(struct rde_aspath *, struct rdomain *); voidrde_reload_done(void); -static void rde_softreconfig_done(void *); +static void rde_reload_runner(void); +static void rde_softreconfig_in_done(void *); +static void rde_softreconfig_out_done(void *); +static void rde_softreconfig_done(void); static void rde_softreconfig_out(struct rib_entry *, void *); static void rde_softreconfig_in(struct rib_entry *, void *); static void rde_softreconfig_unload_peer(struct rib_entry *, void *); @@ -132,6 +135,7 @@ struct imsgbuf *ibuf_se; struct imsgbuf *ibuf_se_ctl; struct imsgbuf *ibuf_main; struct rde_memstats rdemem; +int softreconfig; struct rde_dump_ctx { LIST_ENTRY(rde_dump_ctx)entry; @@ -322,6 +326,9 @@ rde_main(int debug, int verbose) if (rde_dump_pending() && ibuf_se_ctl && ibuf_se_ctl->w.queued <= 10) rde_dump_runner(); + if (softreconfig) { + rde_reload_runner(); + } } /* do not clean up on shutdown on production, it takes ages. */ @@ -2715,6 +2722,7 @@ rde_reload_done(void) struct rdomain *rd; struct rde_peer *peer; struct filter_head *fh; + struct rib_context *ctx; u_int16_trid; int reload = 0; @@ -2835,14 +2843,55 @@ rde_reload_done(void) filterlist_free(ribs[rid].in_rules_tmp); ribs[rid].in_rules_tmp = NULL; } + log_info("RDE reconfigured"); + + softreconfig++; + if (reload > 0) { + ctx = &ribs[RIB_ADJ_IN].ribctx; + memset(ctx, 0, sizeof(*ctx)); + ctx->ctx_rib = &ribs[RIB_ADJ_IN].rib; + ctx->ctx_arg = &ribs[RIB_ADJ_IN]; + ctx->ctx_upcall = rde_softreconfig_in; + ctx->ctx_done = rde_softreconfig_in_done; + ctx->ctx_aid = AID_UNSPEC; + ctx->ctx_count = RDE_RUNNER_ROUNDS; + ribs[RIB_ADJ_IN].dumping = 1; + log_info("running softreconfig in"); + } else { + rde_softreconfig_in_done(&ribs[RIB_ADJ_IN]); + } +} + +static void +rde_reload_runner(void) +{ + u_int16_t rid; + + for (rid = 0; rid < rib_size; rid++) { + if (*ribs[rid].name == '\0') + continue; + if (ribs[rid].dumping) + rib_dump_r(&ribs[rid].ribctx); + } +} - if (reload > 0) - rib_dump(&ribs[RIB_ADJ_IN].rib, rde_softreconfig_in, NULL, - AID_UNSPEC); +static void +rde_softreconfig_in_done(void *arg) +{ + struct rib_desc *rib = arg; + struct rde_peer *peer; + u_int16_trid; + + /* Adj-RIB-In run is done */ + softreconfig--; + rib->dumping = 0; /* now do the Adj-RIB-Out sync */ - for (rid = 0; rid < rib_size; rid++) + for (rid = 0; rid < rib_size; rid++) { + if (*ribs[rid].name == '\0') + continue; ribs[rid].state = RECONF_NONE; + } LIST_FOREACH(peer, &peerlist, peer_l) { if (peer->reconf_out) @@ -2852,18 +2901,53 @@ rde_reload_done(void) peer_dump(peer->conf.id, AID_UNSPEC); } - for (rid = 0; rid < rib_size; rid++) - if (ribs[rid].state ==
uaudio(4) division by zero patch
Hello, I adapted the following patch from netbsd to prevent a division by zero in the uaudio driver. http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/usb/uaudio.c.diff?r1=1.142&r2=1.143&f=h I haven't encountered this problem with my own device but possibly it can be triggered by some device or by a usb fuzzer. - Michael Index: uaudio.c === RCS file: /cvs/src/sys/dev/usb/uaudio.c,v retrieving revision 1.131 diff -u -p -u -r1.131 uaudio.c --- uaudio.c30 Jul 2018 11:51:42 - 1.131 +++ uaudio.c7 Aug 2018 09:51:47 - @@ -1069,15 +1069,19 @@ uaudio_add_feature(struct uaudio_softc * const struct usb_audio_feature_unit *d = iot[id].d.fu; uByte *ctls = (uByte *)d->bmaControls; int ctlsize = d->bControlSize; - int nchan = (d->bLength - 7) / ctlsize; u_int fumask, mmask, cmask; struct mixerctl mix; - int chan, ctl, i, unit; + int chan, ctl, i, nchan, unit; const char *mixername; #define GET(i) (ctls[(i)*ctlsize] | \ (ctlsize > 1 ? ctls[(i)*ctlsize+1] << 8 : 0)) + if (ctlsize == 0) { + DPRINTF(("ignoring feature %d: bControlSize == 0\n", id)); + return; + } + nchan = (d->bLength - 7) / ctlsize; mmask = GET(0); /* Figure out what we can control */ for (cmask = 0, chan = 1; chan < nchan; chan++) {