Re: malloc: add error message in putleakinfo
On Sat, Sep 09, 2023 at 11:27:37AM +0900, Masato Asou wrote: > From: Otto Moerbeek > Date: Fri, 8 Sep 2023 13:39:53 +0200 > > > On Fri, Sep 08, 2023 at 10:08:28AM +0900, Masato Asou wrote: > > > >> From: Masato Asou > >> Date: Fri, 08 Sep 2023 05:45:55 +0900 (JST) > >> > >> > There was a mistake in the diff. > >> > > >> > From: Masato Asou > >> > Date: Fri, 08 Sep 2023 05:33:23 +0900 (JST) > >> > > >> >> Hi, > >> >> > >> >> I have modified diff. comments, ok? > > > > As wrtwarning() is only used #ifdef MALLOC_STATS, please put it inside > > those guards (e.g directly above putleakinfo()). > > > > -Otto > > I have fixed diff. ok? OK, -Otto > -- > ASOU Masato > > Index: stdlib/malloc.c > === > RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v > retrieving revision 1.289 > diff -u -p -r1.289 malloc.c > --- stdlib/malloc.c 30 Jun 2023 06:24:58 - 1.289 > +++ stdlib/malloc.c 9 Sep 2023 02:16:22 - > @@ -2338,6 +2338,22 @@ RBT_PROTOTYPE(leaktree, leaknode, entry, > RBT_GENERATE(leaktree, leaknode, entry, leakcmp); > > static void > +wrtwarning(const char *func, char *msg, ...) > +{ > + int saved_errno = errno; > + va_list ap; > + > + dprintf(STDERR_FILENO, "%s(%d) in %s(): ", __progname, > + getpid(), func != NULL ? func : "unknown"); > + va_start(ap, msg); > + vdprintf(STDERR_FILENO, msg, ap); > + va_end(ap); > + dprintf(STDERR_FILENO, "\n"); > + > + errno = saved_errno; > +} > + > +static void > putleakinfo(struct leaktree *leaks, void *f, size_t sz, int cnt) > { > struct leaknode key, *p; > @@ -2353,8 +2369,10 @@ putleakinfo(struct leaktree *leaks, void > if (page == NULL || > used >= MALLOC_PAGESIZE / sizeof(struct leaknode)) { > page = MMAP(MALLOC_PAGESIZE, 0); > - if (page == MAP_FAILED) > + if (page == MAP_FAILED) { > + wrtwarning(__func__, strerror(errno)); > return; > + } > used = 0; > } > p = [used++]; > > >> >> > >> >> $ MALLOC_OPTIONS=D ktrace -tu ./a.out 107349 > >> >> a.out(99781) in unknown(): putleakinfo(): Cannot allocate memory > >> >> -- > >> >> ASOU Masato > >> >> > >> >> Index: stdlib/malloc.c > >> >> === > >> >> RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v > >> >> retrieving revision 1.289 > >> >> diff -u -p -r1.289 malloc.c > >> >> --- stdlib/malloc.c 30 Jun 2023 06:24:58 - 1.289 > >> >> +++ stdlib/malloc.c 7 Sep 2023 20:30:01 - > >> >> @@ -344,6 +344,22 @@ wrterror(struct dir_info *d, char *msg, > >> >> } > >> >> > >> >> static void > >> >> +wrtwarning(char *func, char *msg, ...) > >> >> +{ > >> >> + int saved_errno = errno; > >> >> + va_list ap; > >> >> + > >> >> + dprintf(STDERR_FILENO, "%s(%d) in %s(): ", __progname, > >> >> + getpid(), func == NULL ? func : "unknown"); > >> > > >> > func != NULL ? func : "unknown" > >> > > >> > I will take a break and re-create the diff. > >> > >> I have fixed the diff. > >> > >> $ MALLOC_OPTIONS=D ktrace -tu ./a.out 107350 > >> a.out(34886) in putleakinfo(): Cannot allocate memory > >> $ kdump -u malloc > >> Start dump a.out *** > >> M=8 I=1 F=0 U=0 J=1 R=0 X=0 C=0 cache=64 G=0 > >> Leak report: > >> f sum #avg > >> > >> End dump a.out *** > >> $ ls -l ktrace.out > >> -rw--- 1 asou asou 734 Sep 8 09:59 ktrace.out > >> > >> comments, ok? > >> -- > >> ASOU Masato > >> > >> Index: stdlib/malloc.c > >> === > >> RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v > >> retrieving revision 1.289 > >> diff -u -p -r1.289 malloc.c > >> --- stdlib/malloc.c30 Jun 2023 06:24:58 - 1.289 > >> +++ stdlib/malloc.c8 Sep 2023 00:55:13 - > >> @@ -344,6 +344,22 @@ wrterror(struct dir_info *d, char *msg, > >> } > >> > >> static void > >> +wrtwarning(const char *func, char *msg, ...) > >> +{ > >> + int saved_errno = errno; > >> + va_list ap; > >> + > >> + dprintf(STDERR_FILENO, "%s(%d) in %s(): ", __progname, > >> + getpid(), func != NULL ? func : "unknown"); > >> + va_start(ap, msg); > >> + vdprintf(STDERR_FILENO, msg, ap); > >> + va_end(ap); > >> + dprintf(STDERR_FILENO, "\n"); > >> + > >> + errno = saved_errno; > >> +} > >> + > >> +static void > >> rbytes_init(struct dir_info *d) > >> { > >>arc4random_buf(d->rbytes, sizeof(d->rbytes)); > >> @@ -2353,8 +2369,10 @@ putleakinfo(struct leaktree *leaks, void > >>if (page == NULL || > >>used >= MALLOC_PAGESIZE / sizeof(struct
Re: malloc: add error message in putleakinfo
From: Otto Moerbeek Date: Fri, 8 Sep 2023 13:39:53 +0200 > On Fri, Sep 08, 2023 at 10:08:28AM +0900, Masato Asou wrote: > >> From: Masato Asou >> Date: Fri, 08 Sep 2023 05:45:55 +0900 (JST) >> >> > There was a mistake in the diff. >> > >> > From: Masato Asou >> > Date: Fri, 08 Sep 2023 05:33:23 +0900 (JST) >> > >> >> Hi, >> >> >> >> I have modified diff. comments, ok? > > As wrtwarning() is only used #ifdef MALLOC_STATS, please put it inside > those guards (e.g directly above putleakinfo()). > > -Otto I have fixed diff. ok? -- ASOU Masato Index: stdlib/malloc.c === RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v retrieving revision 1.289 diff -u -p -r1.289 malloc.c --- stdlib/malloc.c 30 Jun 2023 06:24:58 - 1.289 +++ stdlib/malloc.c 9 Sep 2023 02:16:22 - @@ -2338,6 +2338,22 @@ RBT_PROTOTYPE(leaktree, leaknode, entry, RBT_GENERATE(leaktree, leaknode, entry, leakcmp); static void +wrtwarning(const char *func, char *msg, ...) +{ + int saved_errno = errno; + va_list ap; + + dprintf(STDERR_FILENO, "%s(%d) in %s(): ", __progname, + getpid(), func != NULL ? func : "unknown"); + va_start(ap, msg); + vdprintf(STDERR_FILENO, msg, ap); + va_end(ap); + dprintf(STDERR_FILENO, "\n"); + + errno = saved_errno; +} + +static void putleakinfo(struct leaktree *leaks, void *f, size_t sz, int cnt) { struct leaknode key, *p; @@ -2353,8 +2369,10 @@ putleakinfo(struct leaktree *leaks, void if (page == NULL || used >= MALLOC_PAGESIZE / sizeof(struct leaknode)) { page = MMAP(MALLOC_PAGESIZE, 0); - if (page == MAP_FAILED) + if (page == MAP_FAILED) { + wrtwarning(__func__, strerror(errno)); return; + } used = 0; } p = [used++]; >> >> >> >> $ MALLOC_OPTIONS=D ktrace -tu ./a.out 107349 >> >> a.out(99781) in unknown(): putleakinfo(): Cannot allocate memory >> >> -- >> >> ASOU Masato >> >> >> >> Index: stdlib/malloc.c >> >> === >> >> RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v >> >> retrieving revision 1.289 >> >> diff -u -p -r1.289 malloc.c >> >> --- stdlib/malloc.c 30 Jun 2023 06:24:58 - 1.289 >> >> +++ stdlib/malloc.c 7 Sep 2023 20:30:01 - >> >> @@ -344,6 +344,22 @@ wrterror(struct dir_info *d, char *msg, >> >> } >> >> >> >> static void >> >> +wrtwarning(char *func, char *msg, ...) >> >> +{ >> >> + int saved_errno = errno; >> >> + va_list ap; >> >> + >> >> + dprintf(STDERR_FILENO, "%s(%d) in %s(): ", __progname, >> >> + getpid(), func == NULL ? func : "unknown"); >> > >> > func != NULL ? func : "unknown" >> > >> > I will take a break and re-create the diff. >> >> I have fixed the diff. >> >> $ MALLOC_OPTIONS=D ktrace -tu ./a.out 107350 >> a.out(34886) in putleakinfo(): Cannot allocate memory >> $ kdump -u malloc >> Start dump a.out *** >> M=8 I=1 F=0 U=0 J=1 R=0 X=0 C=0 cache=64 G=0 >> Leak report: >> f sum #avg >> >> End dump a.out *** >> $ ls -l ktrace.out >> -rw--- 1 asou asou 734 Sep 8 09:59 ktrace.out >> >> comments, ok? >> -- >> ASOU Masato >> >> Index: stdlib/malloc.c >> === >> RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v >> retrieving revision 1.289 >> diff -u -p -r1.289 malloc.c >> --- stdlib/malloc.c 30 Jun 2023 06:24:58 - 1.289 >> +++ stdlib/malloc.c 8 Sep 2023 00:55:13 - >> @@ -344,6 +344,22 @@ wrterror(struct dir_info *d, char *msg, >> } >> >> static void >> +wrtwarning(const char *func, char *msg, ...) >> +{ >> +int saved_errno = errno; >> +va_list ap; >> + >> +dprintf(STDERR_FILENO, "%s(%d) in %s(): ", __progname, >> +getpid(), func != NULL ? func : "unknown"); >> +va_start(ap, msg); >> +vdprintf(STDERR_FILENO, msg, ap); >> +va_end(ap); >> +dprintf(STDERR_FILENO, "\n"); >> + >> +errno = saved_errno; >> +} >> + >> +static void >> rbytes_init(struct dir_info *d) >> { >> arc4random_buf(d->rbytes, sizeof(d->rbytes)); >> @@ -2353,8 +2369,10 @@ putleakinfo(struct leaktree *leaks, void >> if (page == NULL || >> used >= MALLOC_PAGESIZE / sizeof(struct leaknode)) { >> page = MMAP(MALLOC_PAGESIZE, 0); >> -if (page == MAP_FAILED) >> +if (page == MAP_FAILED) { >> +wrtwarning(__func__, strerror(errno)); >> return; >> +} >> used = 0; >>
Re: document USE_NOBTCFI in bsd.port.mk
Lucas Raab writes: > New version attached ok bentley@ > diff /usr/src > commit - 2933f00289463a6d1923d1b9cc5e5c1c5c697ece > path + /usr/src > blob - 00ec6c3f81fcf03ea69eabe8de1741a6e562 > file + share/man/man5/bsd.port.mk.5 > --- share/man/man5/bsd.port.mk.5 > +++ share/man/man5/bsd.port.mk.5 > @@ -3613,6 +3613,22 @@ and not intended to be a user setting. > See > .Ev WRKOBJDIR_MFS > for configuration. > +.It Ev USE_NOBTCFI > +If set to > +.Sq Yes , > +writes a wrapper script to > +.Pa ${WRKDIR}/bin/ld > +in > +.Cm patch > +to request that the linker adds an > +.Dv PT_OPENBSD_NOBTCFI > +ELF section. > +Use when a port does not work with the default strict enforcement of > +indirect branch targets. > +.Pp > +Applies to all architectures; set > +.Ev USE_NOBTCFI-${MACHINE_ARCH} > +to apply to only a specific architecture. > .It Ev USE_NOEXECONLY > If set to > .Sq Yes ,
Re: document USE_NOBTCFI in bsd.port.mk
On Fri, Sep 08, 2023 at 03:22:32PM -0600, Anthony J. Bentley wrote: > Lucas Raab writes: > > +writes a wrapper script to ${WRKDIR}/bin/ld in > > Use: > > .Pa ${WRKDIR}/bin/ld > > I see it's wrong elsewhere in the manpage, but let's not introduce another. > > > +.Cm patch > > +to request that the linker adds an > > +.Dv PT_OPENBSD_NOBTCFI > > +ELF section. Use when a port requires no enforcement of indirect branch > > The second sentence needs to begin on its own line. This affects > inter-sentence spacing in the rendered manpage. Ah, I understand now. I think I was initially confusing that with new paragraphs starting out on their own line. > > ELF section. > Use when a port ... > > > Use when a port requires no enforcement of indirect branch targets. > > Reading it again, I think this could be misinterpreted. Better would be > to word it like USE_NOEXECONLY: > > "Use when a port does not work with the default strict enforcement of > indirect branch targets." New version attached diff /usr/src commit - 2933f00289463a6d1923d1b9cc5e5c1c5c697ece path + /usr/src blob - 00ec6c3f81fcf03ea69eabe8de1741a6e562 file + share/man/man5/bsd.port.mk.5 --- share/man/man5/bsd.port.mk.5 +++ share/man/man5/bsd.port.mk.5 @@ -3613,6 +3613,22 @@ and not intended to be a user setting. See .Ev WRKOBJDIR_MFS for configuration. +.It Ev USE_NOBTCFI +If set to +.Sq Yes , +writes a wrapper script to +.Pa ${WRKDIR}/bin/ld +in +.Cm patch +to request that the linker adds an +.Dv PT_OPENBSD_NOBTCFI +ELF section. +Use when a port does not work with the default strict enforcement of +indirect branch targets. +.Pp +Applies to all architectures; set +.Ev USE_NOBTCFI-${MACHINE_ARCH} +to apply to only a specific architecture. .It Ev USE_NOEXECONLY If set to .Sq Yes ,
Re: document USE_NOBTCFI in bsd.port.mk
Lucas Raab writes: > +writes a wrapper script to ${WRKDIR}/bin/ld in Use: .Pa ${WRKDIR}/bin/ld I see it's wrong elsewhere in the manpage, but let's not introduce another. > +.Cm patch > +to request that the linker adds an > +.Dv PT_OPENBSD_NOBTCFI > +ELF section. Use when a port requires no enforcement of indirect branch The second sentence needs to begin on its own line. This affects inter-sentence spacing in the rendered manpage. ELF section. Use when a port ... > Use when a port requires no enforcement of indirect branch targets. Reading it again, I think this could be misinterpreted. Better would be to word it like USE_NOEXECONLY: "Use when a port does not work with the default strict enforcement of indirect branch targets."
Re: document USE_NOBTCFI in bsd.port.mk
On Fri, Sep 08, 2023 at 02:49:56PM -0600, Anthony J. Bentley wrote: > Lucas Raab writes: > > +Use when a port requires no enforcement of indirect branch targets. Use > > New sentence, new line. > > > +.Ev USE_NOBTCFI-${MACHINE_ARCH} > > +to apply to specific architectures instead of all architectures. > > I would invert the wording: "Applies to all architectures; set > USE_NOBTCFI-${MACHINE_ARCH} to apply to only a specific architecture." More like this? diff /usr/src commit - 2933f00289463a6d1923d1b9cc5e5c1c5c697ece path + /usr/src blob - 00ec6c3f81fcf03ea69eabe8de1741a6e562 file + share/man/man5/bsd.port.mk.5 --- share/man/man5/bsd.port.mk.5 +++ share/man/man5/bsd.port.mk.5 @@ -3613,6 +3613,19 @@ and not intended to be a user setting. See .Ev WRKOBJDIR_MFS for configuration. +.It Ev USE_NOBTCFI +If set to +.Sq Yes, +writes a wrapper script to ${WRKDIR}/bin/ld in +.Cm patch +to request that the linker adds an +.Dv PT_OPENBSD_NOBTCFI +ELF section. Use when a port requires no enforcement of indirect branch +targets. +.Pp +Applies to all architectures; set +.Ev USE_NOBTCFI-${MACHINE_ARCH} +to apply to only a specific architecture. .It Ev USE_NOEXECONLY If set to .Sq Yes ,
Re: document USE_NOBTCFI in bsd.port.mk
Lucas Raab writes: > +Use when a port requires no enforcement of indirect branch targets. Use New sentence, new line. > +.Ev USE_NOBTCFI-${MACHINE_ARCH} > +to apply to specific architectures instead of all architectures. I would invert the wording: "Applies to all architectures; set USE_NOBTCFI-${MACHINE_ARCH} to apply to only a specific architecture."
document USE_NOBTCFI in bsd.port.mk
Hello, Following up on a suggestion from tb@, here's a proposed addition to bsd.port.mk to document the use of USE_NOBTCFI[-${MACHINE_ARCH}]. Text and formatting mostly borrowed from the other USE_ sections so feedback welcome on improvements (particularly placement of the ${MACHINE_ARCH}, I wasn't sure if that warranted its own section a la SUBST_CMD-sub). Thanks, Lucas diff /usr/src commit - 2933f00289463a6d1923d1b9cc5e5c1c5c697ece path + /usr/src blob - 00ec6c3f81fcf03ea69eabe8de1741a6e562 file + share/man/man5/bsd.port.mk.5 --- share/man/man5/bsd.port.mk.5 +++ share/man/man5/bsd.port.mk.5 @@ -3613,6 +3613,17 @@ and not intended to be a user setting. See .Ev WRKOBJDIR_MFS for configuration. +.It Ev USE_NOBTCFI +If set to +.Sq Yes, +writes a wrapper script to ${WRKDIR}/bin/ld in +.Cm patch +to request that the linker adds an +.Dv PT_OPENBSD_NOBTCFI +ELF section. +Use when a port requires no enforcement of indirect branch targets. Use +.Ev USE_NOBTCFI-${MACHINE_ARCH} +to apply to specific architectures instead of all architectures. .It Ev USE_NOEXECONLY If set to .Sq Yes ,
Re: Replace selinfo by klist in vnode structure
On Fri, Sep 08, 2023 at 07:39:10PM +0200, Alexander Bluhm wrote: > On Thu, Sep 07, 2023 at 10:32:58PM +0300, Vitaliy Makkoveev wrote: > > Remove the remnants of the leftover selinfo from vnode(9) layer. Just > > mechanical replacement because knote(9) API is already used. I don't > > want make klist MP safe with this diff. > > > > headers added where is was required. Disabled tmpsfs was > > also tested. > > > > ok? > > OK bluhm@ > > > #include > > #include > > #include > > +#include > > I think these headers were sorted alphabetically as much as possible > before. > Committed with alphabetical order.
kernel: remove schedhz
mpi@ notes that alpha doesn't set schedhz anymore, so schedhz is always zero and serves no purpose. We could remove it (patch below). Or we could wait a bit to see if schedclock() finds a future as an independent clock interrupt. My guess is that roundrobin() (or something like it) will have a future as a deadline clock interrupt -- when it fires, the running thread is preempted if it is in userspace. Or something like that. I don't know about schedclock(), though. I have a hard time imagining the need to adjust the priority of the running thread *during* the clock interrupt. Even as I write that down, it sounds like a hack. This patch deletes the variable and its sole remaining reference in statclock(). Note that schedclock() itself remains in place and still runs at its default frequency, approximately (stathz / 8). ok? wait a bit? Index: sys/sched.h === RCS file: /cvs/src/sys/sys/sched.h,v retrieving revision 1.61 diff -u -p -r1.61 sched.h --- sys/sched.h 11 Aug 2023 22:02:50 - 1.61 +++ sys/sched.h 8 Sep 2023 18:28:32 - @@ -146,7 +146,6 @@ struct cpustats { #defineESTCPULIM(e) min((e), NICE_WEIGHT * PRIO_MAX - SCHED_PPQ) extern uint32_t roundrobin_period; -extern int schedhz;/* ideally: 16 */ struct proc; void schedclock(struct proc *); Index: kern/kern_clock.c === RCS file: /cvs/src/sys/kern/kern_clock.c,v retrieving revision 1.115 diff -u -p -r1.115 kern_clock.c --- kern/kern_clock.c 23 Aug 2023 01:55:45 - 1.115 +++ kern/kern_clock.c 8 Sep 2023 18:28:32 - @@ -79,7 +79,6 @@ */ intstathz; -intschedhz; intprofhz; intprofprocs; intticks = INT_MAX - (15 * 60 * HZ); @@ -295,13 +294,10 @@ statclock(struct clockframe *frame) if (p != NULL) { p->p_cpticks++; /* -* If no schedclock is provided, call it here at ~~12-25 Hz; -* ~~16 Hz is best +* schedclock() runs every eighth statclock(). */ - if (schedhz == 0) { - if ((++spc->spc_schedticks & 3) == 0) - schedclock(p); - } + if ((++spc->spc_schedticks & 3) == 0) + schedclock(p); } }
Re: Replace selinfo by klist in vnode structure
On Thu, Sep 07, 2023 at 10:32:58PM +0300, Vitaliy Makkoveev wrote: > Remove the remnants of the leftover selinfo from vnode(9) layer. Just > mechanical replacement because knote(9) API is already used. I don't > want make klist MP safe with this diff. > > headers added where is was required. Disabled tmpsfs was > also tested. > > ok? OK bluhm@ > #include > #include > #include > +#include I think these headers were sorted alphabetically as much as possible before.
Folks thanks to all who attended P2k23 Hackathon in Dublin
Folks thanks to all who attended P2k23 Hackathon in Dublin if any of you would like to email me off list what you managed to achieve/ or increse understanding of or any interesting ideas collaborations that happened during the week please feel free to email me them and Ill include them in an undeadly hackathon report.. It was a real pleasure to host you all and learn from the hackathon hallway track :) Thanks Tom Smyth -- Kindest regards, Tom Smyth.
Re: simple pledge for xeyes(1)
Sebastien Marie writes: > For me, you are pledging too early (before initialization). I agree with everything you said regarding pledge(2) technique, including this statement, but it is worth remembering that the list of promises can be narrowed later with another pledge call. It's very important to get the final steady-state promises right. They should be suitably narrow. But initialization code can be very dangerous too, so a broader list of promises very early in the program can be worth it, if it means the init code runs without some of the big ones like exec. The risk is that someone adds pledge to a new program with a single broad promise, and never narrows it after initialization is over.
Re: simple pledge for xeyes(1)
On 2023-09-08, Sebastien Marie wrote: > "rpath" is a bit odd in xeyes(1) normal behaviour (but it will be required on > X11 error, as if I remember well, error codes are "translated" to message by > reading some file). Exactly. X11 reads the error database `/usr/X11R6/share/X11/XErrorDB` if it needs to issue an error. However, we can force xeyes(1) to read the error database into memory at initialization before pledging; so if an error occurs, it would not need to read the database again. Quoting from `xenocara/app/xclock/xclock.c`: > { > /* force reading of XErrorDB into memory to avoid adding "rpath" to >pledge below */ > char buf[1]; > >(void)XGetErrorDatabaseText(XtDisplay(toplevel), "XProtoError", "0", "", > buf, 1); > } > if (pledge("stdio", NULL) == -1) >err(1, "pledge"); XGetErrorDatabaseText uses a static variable to hold the database. This variable is initialized in the first call, and then used by the following calls. On 2023-09-08, Sebastien Marie wrote: > For me, you are pledging too early (before initialization). It should be done > at > least after calling XtAppInitialize(3). > > It will be the main limitation for a tool like `abstain`. pledge(2) should be > called *after* initialization, and not at the beginning of the program. I also think that. If we pledge(2) after initializing the connection to the X Server, we can drop the "unix" and "inet" promises. Lucas de Sena
Re: malloc: add error message in putleakinfo
On Fri, Sep 08, 2023 at 10:08:28AM +0900, Masato Asou wrote: > From: Masato Asou > Date: Fri, 08 Sep 2023 05:45:55 +0900 (JST) > > > There was a mistake in the diff. > > > > From: Masato Asou > > Date: Fri, 08 Sep 2023 05:33:23 +0900 (JST) > > > >> Hi, > >> > >> I have modified diff. comments, ok? As wrtwarning() is only used #ifdef MALLOC_STATS, please put it inside those guards (e.g directly above putleakinfo()). -Otto > >> > >> $ MALLOC_OPTIONS=D ktrace -tu ./a.out 107349 > >> a.out(99781) in unknown(): putleakinfo(): Cannot allocate memory > >> -- > >> ASOU Masato > >> > >> Index: stdlib/malloc.c > >> === > >> RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v > >> retrieving revision 1.289 > >> diff -u -p -r1.289 malloc.c > >> --- stdlib/malloc.c30 Jun 2023 06:24:58 - 1.289 > >> +++ stdlib/malloc.c7 Sep 2023 20:30:01 - > >> @@ -344,6 +344,22 @@ wrterror(struct dir_info *d, char *msg, > >> } > >> > >> static void > >> +wrtwarning(char *func, char *msg, ...) > >> +{ > >> + int saved_errno = errno; > >> + va_list ap; > >> + > >> + dprintf(STDERR_FILENO, "%s(%d) in %s(): ", __progname, > >> + getpid(), func == NULL ? func : "unknown"); > > > > func != NULL ? func : "unknown" > > > > I will take a break and re-create the diff. > > I have fixed the diff. > > $ MALLOC_OPTIONS=D ktrace -tu ./a.out 107350 > a.out(34886) in putleakinfo(): Cannot allocate memory > $ kdump -u malloc > Start dump a.out *** > M=8 I=1 F=0 U=0 J=1 R=0 X=0 C=0 cache=64 G=0 > Leak report: > f sum #avg > > End dump a.out *** > $ ls -l ktrace.out > -rw--- 1 asou asou 734 Sep 8 09:59 ktrace.out > > comments, ok? > -- > ASOU Masato > > Index: stdlib/malloc.c > === > RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v > retrieving revision 1.289 > diff -u -p -r1.289 malloc.c > --- stdlib/malloc.c 30 Jun 2023 06:24:58 - 1.289 > +++ stdlib/malloc.c 8 Sep 2023 00:55:13 - > @@ -344,6 +344,22 @@ wrterror(struct dir_info *d, char *msg, > } > > static void > +wrtwarning(const char *func, char *msg, ...) > +{ > + int saved_errno = errno; > + va_list ap; > + > + dprintf(STDERR_FILENO, "%s(%d) in %s(): ", __progname, > + getpid(), func != NULL ? func : "unknown"); > + va_start(ap, msg); > + vdprintf(STDERR_FILENO, msg, ap); > + va_end(ap); > + dprintf(STDERR_FILENO, "\n"); > + > + errno = saved_errno; > +} > + > +static void > rbytes_init(struct dir_info *d) > { > arc4random_buf(d->rbytes, sizeof(d->rbytes)); > @@ -2353,8 +2369,10 @@ putleakinfo(struct leaktree *leaks, void > if (page == NULL || > used >= MALLOC_PAGESIZE / sizeof(struct leaknode)) { > page = MMAP(MALLOC_PAGESIZE, 0); > - if (page == MAP_FAILED) > + if (page == MAP_FAILED) { > + wrtwarning(__func__, strerror(errno)); > return; > + } > used = 0; > } > p = [used++];
Re: FWD: FWD: Re: Setting personal mailserver
On Fri, Sep 08, 2023 at 11:35:37AM +0200, Sagar Acharya wrote: > Requesting a feature at OpenSMTPD. > Date: 8 Sept 2023, 14:50 > From: sagaracha...@tutanota.com > To: b...@opensmtpd.org > Subject: FWD: Re: Setting personal mailserver > > > > I request a feature from all the devs. > > > > This would enable users of smtpd to host an email server at any port > > instead of standard 25. Unless I read the smtpd.conf man page very wrong (https://man.openbsd.org/smtpd.conf) it is possible, but not recommended, to set up to listen on ports other than the standard ones. To put it bluntly, what you need is not a new smtpd feature. What you need is for you to take the advice given on the opensmptd mailing list: Read the literature others have pointed you at, and please consider one or more of the alternative approaches that have been suggested to you. -- Peter N. M. Hansteen, member of the first RFC 1149 implementation team https://bsdly.blogspot.com/ https://www.bsdly.net/ https://www.nuug.no/ "Remember to set the evil bit on all malicious network traffic" delilah spamd[29949]: 85.152.224.147: disconnected after 42673 seconds.
FWD: FWD: Re: Setting personal mailserver
Requesting a feature at OpenSMTPD. Date: 8 Sept 2023, 14:50 From: sagaracha...@tutanota.com To: b...@opensmtpd.org Subject: FWD: Re: Setting personal mailserver > I request a feature from all the devs. > > This would enable users of smtpd to host an email server at any port instead > of standard 25. > > More details can be read at later parts of debate between Stuart and me at > misc mailing list. > > I await your reply. > > Thanking you > Sagar Acharya > https://humaaraartha.in > > > > Date: 8 Sept 2023, 11:21 > From: sagaracha...@tutanota.com > To: stua...@longlandclan.id.au > Cc: m...@opensmtpd.org > Subject: Re: Setting personal mailserver > > >> Thank you Stuart. That is very helpful. >> >> SRV records would get port, like >> >> https://xmpp.org/extensions/xep-0368.html >> >> The logic would be like, say there is opensmtpd on the other server too. >> >> dig _mail._smtp.humaaraartha.in. SRV >> get_port_from_SRV() >> if found_different_port() try_port() >> else try_25() >> >> Caching can also be done for future requests. >> >>> You and I are small fish. I've been mucking around with mail servers pretty >>> much this whole century so far. >>> >> >> OpenBSD and suckless are moving forward and providing solutions. Which >> mailserver do you use? If we can establish that any software be run on any >> port, then blocking ports won't make sense. Besides, they can block any >> domains and they already do if they find spam there. SPAM is just an excuse. >> Thanking you >> Sagar Acharya >> https://humaaraartha.in >> >> >> >> 8 Sept 2023, 03:55 by stua...@longlandclan.id.au: >> >>> On 7/9/23 20:44, Sagar Acharya wrote: >>> Let the mail providers have their setups. Is it possible to have a configuration where I have 2 servers, example.com example2.com where I can send and receive emails on ports say, 777 on plaintext, starttls optional and port 778 with smtps? Give me a configuration for such a thing. humaaraartha.in. TXT "v=spf1 ipv4:{myipv4address} -all" humaaraartha.in. TXT "resports:777,778" >>> humaaraartha.in. humaaraartha.in. MX 10 humaaraartha.in. >>> humaaraartha.in. A {myipv4address} That is all you have, nothing more for both servers. Can you help me send and recieve mails on ports 777,778 with just above DNS and smtpd? I can add SRV records for detection of ports 777, 778 if you want. >>> >>> Okay, not quite sure what the "resports" TXT record is achieving (a quick >>> search on the topic didn't reveal any documentation on how it was supposed >>> to work or correct syntax). I won't labour the point about outgoing port >>> 25 traffic since others have covered this already. >>> >>> You can of course use different ports between servers on an agreed-upon >>> manner. e.g. say we have a server, bnemx.vk4msl.com, running OpenSMTPD: >>> vk4msl-bne# cat /etc/mail/smtpd.conf # $OpenBSD: smtpd.conf,v 1.14 2019/11/26 20:14:38 gilles Exp $ # This is the smtpd server system-wide configuration file. # See smtpd.conf(5) for more information. #table aliases file:/etc/mail/aliases table virtualdomains file:/etc/mail/virtualdomains table virtualusers file:/etc/mail/virtualusers pki bnemx cert "/etc/ssl/bnemx.vk4msl.com.fullchain.pem" pki bnemx key "/etc/ssl/private/bnemx.vk4msl.com.key" pki bnemx dhe auto listen on socket listen on all tls pki bnemx >>> … etc, I won't post the full config. >>> >>> Those `listen` lines are the key, from smtpd.conf manpage: >>> listen on interface [family] [options] Listen on the interface for incoming connections, using the same syntax as ifconfig(8). The interface parameter may also be an interface group, an IP address, or a domain name. Listening can optionally be restricted to a specific address family, which can be either inet4 or inet6. >>> >>> In amongst the options: >>> port [port] Listen on the given port instead of the default port 25. >>> >>> So if I chose to, I could add: >>> >>> listen on all port 777 >>> >>> and then re-start smtpd, I'd now be listening on port 777. >>> >>> You could then tell your SMTP server to send to port 777 when sending to my >>> domain. >>> >>> But doing so would be useless: >>> - no one else would bother using port 777/tcp: they would most likely use >>> port 25 >>> - you wouldn't be able to send to any other server, unless they too, chose >>> to use port 777/tcp. >>> >>> If you have a good proposal for how such alternative ports could be >>> advertised (maybe via DNS TXT record), perhaps you could propose that as a >>> Request For Comment to the Internet Engineering Task Force… and maybe if >>> enough people thought it was a good idea, it would be
Re: CVS: cvs.openbsd.org: xenocara
On Thu, Sep 07, 2023 at 11:58:03PM +0200, Mark Kettenis wrote: > > Date: Thu, 7 Sep 2023 22:02:12 +0200 > > From: Matthieu Herrb > > > > basically just define the CARDnn types in terms on uint_nn everywhere. > > Like for signal.h all systems still supported by X have stdint and the > > uintnn_t types. > > The problem with this is that you're changing the type of CARD32 and > CARD64. Which means that if these types are used in C++ code, the > mangling changes, and therefore you risk breaking the ABI. And I bet > you there is C++ code that uses the CARD32 and CARD64 types. > > How did the commit break the tree? The actual error messages were > never mailed out as far as I can tell. > > I think you should simply revert to the pre-hackathon state. Done. Indeed this needs more thinking. I've reverted those commits. Here are the errors with llvm 16 on the tree before p2k23 (and -current) in xserver/glamor_egl: libtool: compile: /usr/local/bin/clang-16 -DHAVE_CONFIG_H -I. -I/local/OpenBSD/xenocara/xserver/hw/xfree86/glamor_egl -I../../../include -I/local/OpenBSD/xenocara/xserver/hw/xfree86 -I/local/OpenBSD/xenocara/xserver/hw/xfree86/include -I/local/OpenBSD/xenocara/xserver/hw/xfree86/common -I/local/OpenBSD/xenocara/xserver/hw/xfree86/os-support -I/local/OpenBSD/xenocara/xserver/hw/xfree86/os-support/bus -I/local/OpenBSD/xenocara/xserver/os -I/local/OpenBSD/xenocara/xserver/dri3 -I/local/OpenBSD/xenocara/xserver/glamor -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -fno-strict-aliasing -fno-strict-aliasing -I/usr/X11R6/include -D_DEFAULT_SOURCE -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/usr/X11R6/include/X11/dri -I/usr/X11R6/include/libdrm -I/usr/X11R6/include/pixman-1 -I/usr/X11R6/include/freetype2 -I/local/OpenBSD/xenocara/xserver/include -I../../../include -I/local/OpenBSD/xenocara/xserver/Xext -I/local/OpenBSD/xenocara/xserver/composite -I/local/OpenBSD/xenocara/xserver/damageext -I/local/OpenBSD/xenocara/xserver/xfixes -I/local/OpenBSD/xenocara/xserver/Xi -I/local/OpenBSD/xenocara/xserver/mi -I/local/OpenBSD/xenocara/xserver/miext/sync -I/local/OpenBSD/xenocara/xserver/miext/shadow -I/local/OpenBSD/xenocara/xserver/miext/damage -I/local/OpenBSD/xenocara/xserver/render -I/local/OpenBSD/xenocara/xserver/randr -I/local/OpenBSD/xenocara/xserver/fb -I/local/OpenBSD/xenocara/xserver/dbe -I/local/OpenBSD/xenocara/xserver/present -fvisibility=hidden -I/usr/X11R6/include -DHAVE_XORG_CONFIG_H -fvisibility=hidden -I/usr/X11R6/include -I/usr/X11R6/include -I/usr/X11R6/include/libdrm -I/usr/X11R6/include -I/usr/X11R6/include -I/usr/X11R6/include/libdrm -I/usr/X11R6/include -O2 -pipe -pthread -c /local/OpenBSD/xenocara/xserver/glamor/glamor_egl.c -fPIC -DPIC -o .libs/glamor_egl.o /local/OpenBSD/xenocara/xserver/glamor/glamor_egl.c:849:24: error: incompatible function pointer types initializing 'dri3_pixmap_from_fds_proc' (aka 'struct _Pixmap *(*)(struct _Screen *, unsigned char, const int *, unsigned short, unsigned short, const unsigned int *, const unsigned int *, unsigned char, unsigned char, unsigned long)') with an expression of type 'PixmapPtr (ScreenPtr, CARD8, const int *, CARD16, CARD16, const CARD32 *, const CARD32 *, CARD8, CARD8, uint64_t)' (aka 'struct _Pixmap *(struct _Screen *, unsigned char, const int *, unsigned short, unsigned short, const unsigned int *, const unsigned int *, unsigned char, unsigned char, unsigned long long)') [-Wincompatible-function-pointer-types] .pixmap_from_fds = glamor_pixmap_from_fds, ^~ 1 error generated. *** Error 1 in xserver/obj/hw/xfree86/glamor_egl (Makefile:635 'glamor_egl.lo') in xserver/hw/xfree86/drivers/modesetting: source='/local/OpenBSD/xenocara/xserver/hw/xfree86/drivers/modesetting/dri2.c' object='dri2.lo' libtool=yes DEPDIR=.deps depmode=none /bin/sh /local/OpenBSD/xenocara/xserver/depcomp /bin/sh ../../../../libtool --tag=CC --mode=compile /usr/local/bin/clang-16 -DHAVE_CONFIG_H -I. -I/local/OpenBSD/xenocara/xserver/hw/xfree86/drivers/modesetting -I../../../../include -I/local/OpenBSD/xenocara/xserver/hw/xfree86 -I/local/OpenBSD/xenocara/xserver/hw/xfree86/include -I/local/OpenBSD/xenocara/xserver/hw/xfree86/common -I/local/OpenBSD/xenocara/xserver/hw/xfree86/os-support -I/local/OpenBSD/xenocara/xserver/hw/xfree86/os-support/bus -I/local/OpenBSD/xenocara/xserver/os -I/local/OpenBSD/xenocara/xserver/glamor