Re: stack pointer checking

2018-01-12 Thread Juan Francisco Cantero Hurtado
On Thu, Jan 11, 2018 at 08:39:25PM -0700, Theo de Raadt wrote:
> Stefan (stefan@) and I have been working for a few months on this
> diff, with help from a few others.
> 
> At every trap and system call, it checks if the stack-pointer is on a
> page that is marked MAP_STACK.  execve() is changed to create such
> mappings for the process stack.  Also, libpthread is taught the new
> MAP_STACK flag to use with mmap().
> 
> There is no corresponding system call which can set MAP_FLAG on an
> existing page, you can only set the flag by mapping new memory into
> place.  That is a piece of the security model.
> 
> The purpose of this change is to twart stack pivots, which apparently
> have gained some popularity in JIT ROP attacks.  It makes it difficult
> to place the ROP stack in regular data memory, and then perform a
> system call from it.  Workarounds are cumbersome, increasing the need
> for far more gadgetry.  But also the trap case -- if any memory
> experiences a demand page fault, the same check will occur and
> potentially also kill the process.
> 
> We have experimented a little with performing this check during device
> interrupts, but there are some locking concerns and performance may
> then become a concern.  It'll be best to gain experience from handle
> of syncronous trap cases first.
> 
> chrome and other applications I use run fine!
> 
> I'm asking for some feedback to discover what ports this breaks, we'd
> like to know.  Those would be ports which try to (unconvenionally)
> create their stacks in malloc()'d memory or inside another
> datastructure.  Most of them are probably easily fixed ...

racket passes the test suite. chibi-scheme and pypy run fine with a
big factorial.


-- 
Juan Francisco Cantero Hurtado http://juanfra.info



Re: [PATCH] usr.bin/calendar/calendars/calendar.uk - Burns' Night -> Burns Night

2018-01-12 Thread Andras Farkas
On Fri, Jan 12, 2018 at 3:11 PM, Jason McIntyre  wrote:
> hilariously, i just realised the apostrophe in the quote above is in the
> wrong place! maybe it should be "Burns Hog Weighing Method" ;)
I'd also like to note that while some people would do:
Burns' Hog Weighing Method
The following is also considered valid and correct:
Burns's Hog Weighing Method
In fact, the second method, using Burns's, is the first thing
mentioned in the first chapter of The Elements of Style by William
Strunk Jr. and E.B. White
Coincidentally, one of the three examples given is verbatim:
Burns's poems



Re: nsd 4.1.19

2018-01-12 Thread Todd C. Miller
On Fri, 12 Jan 2018 18:20:58 +0100, Florian Obser wrote:

> so, here is 4.1.19. I haven't gotten around to reading the diff yet.
> But I tossed it in production.

So far so good here.  A note to others, you'll need to "make cleandir"
in /usr/src/usr.sbin/nsd (or just remove /usr/obj/usr.sbin/nsd)
before rebuilding or you will get errors about ATTR_PACKED.

We may want to add a make rule to re-run configure when it changes
(or when config.h.in changes) to avoid this kind of problem.

 - todd



Re: [PATCH] usr.bin/calendar/calendars/calendar.uk - Burns' Night -> Burns Night

2018-01-12 Thread Mike Burns
On 2018-01-12 20.11.37 +, Jason McIntyre wrote:
> > Burn's Hog Weighing Method:
> 
> hilariously, i just realised the apostrophe in the quote above is in the
> wrong place! maybe it should be "Burns Hog Weighing Method" ;)

The apostrophe should come after the s in this case.

-- 
Mike Burns



Re: [PATCH] usr.bin/calendar/calendars/calendar.uk - Burns' Night -> Burns Night

2018-01-12 Thread Raf Czlonka
On Fri, Jan 12, 2018 at 08:11:37PM GMT, Jason McIntyre wrote:
> On Fri, Jan 12, 2018 at 08:05:47PM +, Jason McIntyre wrote:
> > On Fri, Jan 12, 2018 at 07:38:47PM +, Raf Czlonka wrote:
> > > Hi all,
> > > 
> > > According to the most[0] prominent[1] websites[2][3][4], there's no
> > > apostrophe (') in Burns Night.
> > > 
> > > [0] 
> > > https://www.gov.uk/government/news/uk-government-leads-burns-night-celebrations-around-the-world
> > > [1] https://www.scotland.org/events/burns-night
> > > [2] http://www.bbc.co.uk/arts/robertburns/burns_night_running_order.shtml
> > > [3] https://en.wikipedia.org/wiki/Burns_supper
> > > [4] http://www.robertburns.org/suppers/
> > > 
> > > Regards,
> > > 
> > > Raf
> > > 
> > 
> > evening.
> > 
> > it seems both are acceptable. i'm reluctant to change it without any
> > pressing reason to prefer one over the other.
> > 
> > but do check fortunes for some class...
> > 
> > Burn's Hog Weighing Method:
> > (1) Get a perfectly symmetrical plank and balance it across a
> > sawhorse.
> > (2) Put the hog on one end of the plank.
> > (3) Pile rocks on the other end until the plank is again
> > perfectly balanced.
> > (4) Carefully guess the weight of the rocks.
> > -- Robert Burns
> > 
> > jmc
> > 
> 
> hilariously, i just realised the apostrophe in the quote above is in the
> wrong place! maybe it should be "Burns Hog Weighing Method" ;)
> 
> jmc
> 

That's the *first* thing I've notied ;^)

Raf



Re: [PATCH] usr.bin/calendar/calendars/calendar.uk - Burns' Night -> Burns Night

2018-01-12 Thread Jason McIntyre
On Fri, Jan 12, 2018 at 08:05:47PM +, Jason McIntyre wrote:
> On Fri, Jan 12, 2018 at 07:38:47PM +, Raf Czlonka wrote:
> > Hi all,
> > 
> > According to the most[0] prominent[1] websites[2][3][4], there's no
> > apostrophe (') in Burns Night.
> > 
> > [0] 
> > https://www.gov.uk/government/news/uk-government-leads-burns-night-celebrations-around-the-world
> > [1] https://www.scotland.org/events/burns-night
> > [2] http://www.bbc.co.uk/arts/robertburns/burns_night_running_order.shtml
> > [3] https://en.wikipedia.org/wiki/Burns_supper
> > [4] http://www.robertburns.org/suppers/
> > 
> > Regards,
> > 
> > Raf
> > 
> 
> evening.
> 
> it seems both are acceptable. i'm reluctant to change it without any
> pressing reason to prefer one over the other.
> 
> but do check fortunes for some class...
> 
>   Burn's Hog Weighing Method:
>   (1) Get a perfectly symmetrical plank and balance it across a
>   sawhorse.
>   (2) Put the hog on one end of the plank.
>   (3) Pile rocks on the other end until the plank is again
>   perfectly balanced.
>   (4) Carefully guess the weight of the rocks.
>   -- Robert Burns
> 
> jmc
> 

hilariously, i just realised the apostrophe in the quote above is in the
wrong place! maybe it should be "Burns Hog Weighing Method" ;)

jmc



Re: [PATCH] usr.bin/calendar/calendars/calendar.uk - Burns' Night -> Burns Night

2018-01-12 Thread Jason McIntyre
On Fri, Jan 12, 2018 at 07:38:47PM +, Raf Czlonka wrote:
> Hi all,
> 
> According to the most[0] prominent[1] websites[2][3][4], there's no
> apostrophe (') in Burns Night.
> 
> [0] 
> https://www.gov.uk/government/news/uk-government-leads-burns-night-celebrations-around-the-world
> [1] https://www.scotland.org/events/burns-night
> [2] http://www.bbc.co.uk/arts/robertburns/burns_night_running_order.shtml
> [3] https://en.wikipedia.org/wiki/Burns_supper
> [4] http://www.robertburns.org/suppers/
> 
> Regards,
> 
> Raf
> 

evening.

it seems both are acceptable. i'm reluctant to change it without any
pressing reason to prefer one over the other.

but do check fortunes for some class...

Burn's Hog Weighing Method:
(1) Get a perfectly symmetrical plank and balance it across a
sawhorse.
(2) Put the hog on one end of the plank.
(3) Pile rocks on the other end until the plank is again
perfectly balanced.
(4) Carefully guess the weight of the rocks.
-- Robert Burns

jmc

> Index: usr.bin/calendar/calendars/calendar.uk
> ===
> RCS file: /cvs/src/usr.bin/calendar/calendars/calendar.uk,v
> retrieving revision 1.1
> diff -u -p -r1.1 calendar.uk
> --- usr.bin/calendar/calendars/calendar.uk14 Jan 2016 20:08:01 -  
> 1.1
> +++ usr.bin/calendar/calendars/calendar.uk12 Jan 2018 19:28:40 -
> @@ -9,7 +9,7 @@
>  
>  01/01New Year's Day
>  01/02Bank holiday in Scotland
> -01/25Burns' Night in Scotland
> +01/25Burns Night in Scotland
>  02/14Saint Valentine's Day
>  03/01Saint David's Day in Wales
>  03/17Saint Patrick's Day (also a bank holiday across Ireland)



smp basics for arm64

2018-01-12 Thread Mark Kettenis
Diff below adds the necessary bits to build and run a GENERIC.MP
kernel on a single CPU.  It doesn't actually add the GENERIC.MP config
file yet; that would be a bit premature.

Most bits taken from Dale's SMP series.  His diff did disable one of
the KERNEL_LOCK/UNLOCK pairs I'm adding here to make things actually
work when running on multiple CPUs.  I'll keep that in the back of my
mind.

ok?


Index: arch/arm64/arm64/cpu.c
===
RCS file: /cvs/src/sys/arch/arm64/arm64/cpu.c,v
retrieving revision 1.9
diff -u -p -r1.9 cpu.c
--- arch/arm64/arm64/cpu.c  29 Dec 2017 14:45:15 -  1.9
+++ arch/arm64/arm64/cpu.c  12 Jan 2018 19:50:17 -
@@ -92,6 +92,8 @@ const struct implementers {
 char cpu_model[64];
 int cpu_node;
 
+struct cpu_info *cpu_info_list = _info_primary;
+
 intcpu_match(struct device *, void *, void *);
 void   cpu_attach(struct device *, struct device *, void *);
 
@@ -198,3 +200,10 @@ cpu_clockspeed(int *freq)
 }
 
 int(*cpu_on_fn)(register_t, register_t);
+
+#ifdef MULTIPROCESSOR
+void
+cpu_boot_secondary_processors(void)
+{
+}
+#endif
Index: arch/arm64/arm64/syscall.c
===
RCS file: /cvs/src/sys/arch/arm64/arm64/syscall.c,v
retrieving revision 1.1
diff -u -p -r1.1 syscall.c
--- arch/arm64/arm64/syscall.c  17 Dec 2016 23:38:33 -  1.1
+++ arch/arm64/arm64/syscall.c  12 Jan 2018 19:50:17 -
@@ -130,5 +130,7 @@ child_return(arg)
frame->tf_x[1] = 1;
frame->tf_spsr &= ~PSR_C;   /* carry bit */
 
+   KERNEL_UNLOCK();
+
mi_child_return(p);
 }
Index: arch/arm64/arm64/trap.c
===
RCS file: /cvs/src/sys/arch/arm64/arm64/trap.c,v
retrieving revision 1.13
diff -u -p -r1.13 trap.c
--- arch/arm64/arm64/trap.c 24 Dec 2017 10:32:25 -  1.13
+++ arch/arm64/arm64/trap.c 12 Jan 2018 19:50:17 -
@@ -173,7 +173,9 @@ data_abort(struct trapframe *frame, uint
 
/* Fault in the user page: */
if (!pmap_fault_fixup(map->pmap, va, access_type, 1)) {
+   KERNEL_LOCK();
error = uvm_fault(map, va, ftype, access_type);
+   KERNEL_UNLOCK();
}
 
//PROC_LOCK(p);
@@ -185,7 +187,9 @@ data_abort(struct trapframe *frame, uint
 * kernel.
 */
if (!pmap_fault_fixup(map->pmap, va, access_type, 0)) {
+   KERNEL_LOCK();
error = uvm_fault(map, va, ftype, access_type);
+   KERNEL_UNLOCK();
}
}
 
@@ -206,7 +210,9 @@ data_abort(struct trapframe *frame, uint
}
sv.sival_ptr = (u_int64_t *)far;
 
+   KERNEL_LOCK();
trapsignal(p, sig, 0, code, sv);
+   KERNEL_UNLOCK();
} else {
if (curcpu()->ci_idepth == 0 &&
pcb->pcb_onfault != 0) {
@@ -293,7 +299,9 @@ do_el0_sync(struct trapframe *frame)
case EXCP_UNKNOWN:
vfp_save();
sv.sival_ptr = (void *)frame->tf_elr;
+   KERNEL_LOCK();
trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv);
+   KERNEL_UNLOCK();
break;
case EXCP_FP_SIMD:
case EXCP_TRAP_FP:
@@ -310,12 +318,16 @@ do_el0_sync(struct trapframe *frame)
case EXCP_PC_ALIGN:
vfp_save();
sv.sival_ptr = (void *)frame->tf_elr;
+   KERNEL_LOCK();
trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv);
+   KERNEL_UNLOCK();
break;
case EXCP_SP_ALIGN:
vfp_save();
sv.sival_ptr = (void *)frame->tf_sp;
+   KERNEL_LOCK();
trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv);
+   KERNEL_UNLOCK();
break;
case EXCP_DATA_ABORT_L:
vfp_save();
@@ -324,7 +336,9 @@ do_el0_sync(struct trapframe *frame)
case EXCP_BRK:
vfp_save();
sv.sival_ptr = (void *)frame->tf_elr;
+   KERNEL_LOCK();
trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv);
+   KERNEL_UNLOCK();
break;
default:
// panic("Unknown userland exception %x esr_el1 %lx\n", 
exception,
@@ -335,7 +349,9 @@ do_el0_sync(struct trapframe *frame)
printf("exception %x esr_el1 %llx\n", exception, esr);
dumpregs(frame);
}
+   KERNEL_LOCK();
sigexit(p, SIGILL);
+   KERNEL_UNLOCK();
}
 
userret(p);
Index: arch/arm64/dev/agintc.c
===
RCS file: 

[PATCH] usr.bin/calendar/calendars/calendar.uk - Burns' Night -> Burns Night

2018-01-12 Thread Raf Czlonka
Hi all,

According to the most[0] prominent[1] websites[2][3][4], there's no
apostrophe (') in Burns Night.

[0] 
https://www.gov.uk/government/news/uk-government-leads-burns-night-celebrations-around-the-world
[1] https://www.scotland.org/events/burns-night
[2] http://www.bbc.co.uk/arts/robertburns/burns_night_running_order.shtml
[3] https://en.wikipedia.org/wiki/Burns_supper
[4] http://www.robertburns.org/suppers/

Regards,

Raf

Index: usr.bin/calendar/calendars/calendar.uk
===
RCS file: /cvs/src/usr.bin/calendar/calendars/calendar.uk,v
retrieving revision 1.1
diff -u -p -r1.1 calendar.uk
--- usr.bin/calendar/calendars/calendar.uk  14 Jan 2016 20:08:01 -  
1.1
+++ usr.bin/calendar/calendars/calendar.uk  12 Jan 2018 19:28:40 -
@@ -9,7 +9,7 @@
 
 01/01  New Year's Day
 01/02  Bank holiday in Scotland
-01/25  Burns' Night in Scotland
+01/25  Burns Night in Scotland
 02/14  Saint Valentine's Day
 03/01  Saint David's Day in Wales
 03/17  Saint Patrick's Day (also a bank holiday across Ireland)



Re: nsd 4.1.19

2018-01-12 Thread Todd C. Miller
On Fri, 12 Jan 2018 18:20:58 +0100, Florian Obser wrote:

> so, here is 4.1.19. I haven't gotten around to reading the diff yet.
> But I tossed it in production.
>
> When trying to re-gen config.h.in autheader bombs out:
>
> [florian@openbsd-build:/usr/src/usr.sbin/nsd]$ autoheader-2.69
> autoheader-2.69: warning: missing template: HAVE_B64_NTOP
> autoheader-2.69: Use AC_DEFINE([HAVE_B64_NTOP], [], [Description])
> autoheader-2.69: warning: missing template: HAVE_B64_PTON

This will fix it.  I guess no one tried to re-run autoheader after
the configure.ac changes.

 - todd

--- configure.ac.orig   Fri Jan 12 11:27:48 2018
+++ configure.acFri Jan 12 11:27:57 2018
@@ -687,8 +687,8 @@
fi
 fi
 if test "x$found_b64_ntop" = xyes; then
-   AC_DEFINE(HAVE_B64_NTOP)
-   AC_DEFINE(HAVE_B64_PTON)
+   AC_DEFINE(HAVE_B64_NTOP, 1, [Define to 1 if you have the `b64_ntop' 
function.])
+   AC_DEFINE(HAVE_B64_PTON, 1, [Define to 1 if you have the `b64_ntop' 
function.])
AC_MSG_RESULT(yes)
 else
AC_LIBOBJ([b64_ntop])



Re: nsd 4.1.19

2018-01-12 Thread Florian Obser

Oh and yes, that packed BS is completely retarded.

Seeing how many commits it took to have it not constantly spass out on
different compilers, it's amazing that someone didn't take the hint and
gave up on it. No idea what the usecase is suppsed to be.

-- 
I'm not entirely sure you are real.



nsd 4.1.19

2018-01-12 Thread Florian Obser
so, here is 4.1.19. I haven't gotten around to reading the diff yet.
But I tossed it in production.

When trying to re-gen config.h.in autheader bombs out:

[florian@openbsd-build:/usr/src/usr.sbin/nsd]$ autoheader-2.69
autoheader-2.69: warning: missing template: HAVE_B64_NTOP
autoheader-2.69: Use AC_DEFINE([HAVE_B64_NTOP], [], [Description])
autoheader-2.69: warning: missing template: HAVE_B64_PTON

I suppose this has something to do with our b64 half-arsery?
Anyone has a clue? For now I copied config.h.in from the
release tgz.

Tests, OKs?

diff --git Makefile.in Makefile.in
index 495160c0826..3468101c19d 100644
--- Makefile.in
+++ Makefile.in
@@ -286,9 +286,6 @@ qtest.o:$(srcdir)/tpkg/cutest/qtest.c
 udb-inspect.o: $(srcdir)/tpkg/cutest/udb-inspect.c
$(COMPILE) -c $(srcdir)/tpkg/cutest/udb-inspect.c
 
-xfr-inspect.o: $(srcdir)/tpkg/cutest/xfr-inspect.c
-   $(COMPILE) -c $(srcdir)/tpkg/cutest/xfr-inspect.c
-
 zlexer.c:  $(srcdir)/zlexer.lex
if test "$(LEX)" != ":"; then rm -f $@ ;\
echo '#include "config.h"' > $@ ;\
@@ -516,7 +513,7 @@ udb-inspect.o: $(srcdir)/tpkg/cutest/udb-inspect.c config.h 
$(srcdir)/udb.h $(sr
  $(srcdir)/udb.h $(srcdir)/udbzone.h $(srcdir)/dns.h $(srcdir)/udbradtree.h 
$(srcdir)/util.h $(srcdir)/buffer.h $(srcdir)/region-allocator.h \
  $(srcdir)/util.h $(srcdir)/packet.h $(srcdir)/namedb.h $(srcdir)/dname.h 
$(srcdir)/buffer.h $(srcdir)/radtree.h $(srcdir)/rbtree.h $(srcdir)/rdata.h \
  $(srcdir)/namedb.h $(srcdir)/difffile.h $(srcdir)/options.h config.h
-xfr-inspect.o: $(srcdir)/tpkg/cutest/xfr-inspect.c config.h 
$(srcdir)/udbzone.h $(srcdir)/udb.h $(srcdir)/dns.h \
+xfr-inspect.o: $(srcdir)/xfr-inspect.c config.h $(srcdir)/udbzone.h 
$(srcdir)/udb.h $(srcdir)/dns.h \
  $(srcdir)/udbradtree.h $(srcdir)/util.h $(srcdir)/buffer.h 
$(srcdir)/region-allocator.h $(srcdir)/util.h $(srcdir)/packet.h 
$(srcdir)/namedb.h \
  $(srcdir)/dname.h $(srcdir)/buffer.h $(srcdir)/radtree.h $(srcdir)/rbtree.h 
$(srcdir)/rdata.h $(srcdir)/namedb.h $(srcdir)/difffile.h \
  $(srcdir)/options.h config.h
diff --git axfr.c axfr.c
index 6f6b0957e99..dd34c0c3cee 100644
--- axfr.c
+++ axfr.c
@@ -201,6 +201,7 @@ answer_axfr_ixfr(struct nsd *nsd, struct query *q)
return query_axfr(nsd, q);
}
/** Fallthrough: AXFR over UDP queries are discarded. */
+   /* fallthrough */
case TYPE_IXFR:
RCODE_SET(q->packet, RCODE_IMPL);
return QUERY_PROCESSED;
diff --git config.h.in config.h.in
index 6c44616432f..34091d5eb3f 100644
--- config.h.in
+++ config.h.in
@@ -73,6 +73,9 @@
 /* Define to 1 if you have the `endpwent' function. */
 #undef HAVE_ENDPWENT
 
+/* Define to 1 if you have the `ERR_load_crypto_strings' function. */
+#undef HAVE_ERR_LOAD_CRYPTO_STRINGS
+
 /* Define to 1 if you have the `event_base_free' function. */
 #undef HAVE_EVENT_BASE_FREE
 
@@ -88,6 +91,9 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_EVENT_H
 
+/* Define to 1 if you have the `EVP_cleanup' function. */
+#undef HAVE_EVP_CLEANUP
+
 /* Define to 1 if you have the `ev_default_loop' function. */
 #undef HAVE_EV_DEFAULT_LOOP
 
@@ -194,6 +200,12 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_OPENSSL_ERR_H
 
+/* Define to 1 if you have the `OPENSSL_init_crypto' function. */
+#undef HAVE_OPENSSL_INIT_CRYPTO
+
+/* Define to 1 if you have the `OPENSSL_init_ssl' function. */
+#undef HAVE_OPENSSL_INIT_SSL
+
 /* Define to 1 if you have the  header file. */
 #undef HAVE_OPENSSL_RAND_H
 
@@ -426,6 +438,9 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Define this to use packed structure alignment. */
+#undef PACKED_STRUCTS
+
 /* Pathname to the NSD pidfile */
 #undef PIDFILE
 
@@ -483,6 +498,9 @@
 /* Define this to enable mmap instead of malloc. Experimental. */
 #undef USE_MMAP_ALLOC
 
+/* Define this to configure to use the radix tree. */
+#undef USE_RADIX_TREE
+
 /* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
@@ -817,5 +835,11 @@ int memcmp(const void *x, const void *y, size_t n);
 #endif /* !HAVE_STRUCT_TIMESPEC */
 #endif /* !CONFIG_DEFINES */
 
+#ifdef PACKED_STRUCTS
+#define ATTR_PACKED __attribute__((packed))
+#else
+#define ATTR_PACKED
+#endif
+
 int __b64_ntop(uint8_t const *, size_t, char *, size_t);
 int __b64_pton(char const *, uint8_t*, size_t);
diff --git configure configure
index 15ceae2b292..c8a8743f384 100644
--- configure
+++ configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for NSD 4.1.17.
+# Generated by GNU Autoconf 2.69 for NSD 4.1.19.
 #
 # Report bugs to .
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='NSD'
 PACKAGE_TARNAME='nsd'
-PACKAGE_VERSION='4.1.17'
-PACKAGE_STRING='NSD 4.1.17'
+PACKAGE_VERSION='4.1.19'
+PACKAGE_STRING='NSD 

Re: sysctl(3) or sysctl(2)?

2018-01-12 Thread Stuart Henderson
On 2018/01/12 15:38, Ingo Schwarze wrote:
> 
> > but we have to find all the tendrils.
> 
> Finding them is easy:
> 
>   $ man -k Xr~sysctl.3 | wc -l 
>   60

Plus web pages.



Re: sysctl(3) or sysctl(2)?

2018-01-12 Thread Ingo Schwarze
Hi,

Theo de Raadt wrote on Thu, Jan 11, 2018 at 08:48:32PM -0700:
> Anthony Coulter wrote:

>> /usr/src/lib/libc/gen/sysctl.3
>> Should it actually be in section 2?

> It used to be wrapped in an odd way.
> The manual page could now be renamed,

We rarely do that, though.  There are many edge cases and historical
accidents regarding which pages are in which section, and the benefit
of moving them is limited.

> but we have to find all the tendrils.

Finding them is easy:

  $ man -k Xr~sysctl.3 | wc -l 
  60

So, we change sixty manual pages referencing sysctl(3) and lose
the history of the file?  I'm not convinced it's worth the work,
and the churn.

Then again, if a developer wants to do the work, i don't object
to it either (non-developers please refrain from sending patches
in this case, that wouldn't reduce the work for the developer
actually committing it).

Yours,
  Ingo



Re: ksh: State of NOTES and PROJECTS

2018-01-12 Thread Jeremie Courreges-Anglas
On Mon, Jan 08 2018, Klemens Nanni  wrote:
> On Mon, Jan 08, 2018 at 03:06:32PM +0100, Jeremie Courreges-Anglas wrote:
>> On Mon, Jan 08 2018, Jeremie Courreges-Anglas  wrote:
>> > On Mon, Jan 08 2018, Klemens Nanni  wrote:
>> > Looks good, except you give no rationale for moving the FPATH quirk
>> > from "known differences [...] that are not likely to change" to "known
>> > differences [...] that may change".
> I checked ksh88 but not ksh93, my bad.
>
>> > IIUC ksh93 now documents this behavior:
>> >
>> >   FPATH  The search path for function definitions.  The
>> >  directories in this path are searched for a file with 
>> > the
>> >  same name as the function or command when a function 
>> > with
>> >  the -u attribute is referenced and when a command is 
>> > not
>> >  found.  If an executable file with the name of that
>> >  command is found, then it is read and executed in the
>> >  current environment. [...]
>> >
>> > (Actually ksh93 doesn't require the file to be executable.)
>> >
>> > Right now I'm tempted to leave the FPATH bits as is or to amend them,
>> > not to move them to the "may change later" section.
>> 
>> Another small round of fixes.
>> - unreadable/setuid scripts... what?
>> - BUG-REPORTS has been moved to Attic
>> - s/effect/affect where relevant
>> - tweak the note about FPATH
>> - pdksh "understand[s] C integer constants (ie, 0x123, 0177)"
> These all look good so far, thanks.

ack, I'll commit my diff then.

>> I've been tempted to remove the second paragraph in POSIX sh bugs, but
>> I don't know whether ksh handles all the details of parameter
>> expansions.
> Tilde expansion is not performed in double quoted words of parameter
> expansions:
>
>   $ unset v
>   $ echo ${v:=~root}  # assigns expanded word
>   /root
>   $ echo ${v+"~root"} # substitutes unexpanded word
>   ~root
>
> Other expansion operators (-, ?, #, ##, %, %%) behave the same. So I'd
> say it's safe to remove that, too.

Yeah, but maybe a more solid approach would be to remove this entry from
NOTES/PROJECTS only when we have good regress tests?  AFAIK here we only
have a few (unclass1.t).  Just a suggestion, I'm not trying to push this
as a required step whenever we want to amend NOTES/PROJECTS.

I have added basic regress tests for hex/octal notation and POSIX
character classes btw, feedback welcome.

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: cast __swapXX in _endian.h to help the compiler

2018-01-12 Thread Joerg Sonnenberger
On Thu, Jan 11, 2018 at 01:53:00PM +1000, David Gwynne wrote:
> this silences the warnings when building dhclient.

You might want to check if __builtin_bswap16 and friends exist first and
prefer to use them directly.

Joerg



Re: constrain drm alloc_pages() to dma range

2018-01-12 Thread Mark Kettenis
> Date: Fri, 12 Jan 2018 14:53:20 +1100
> From: Jonathan Gray 
> 
> When trying to use alloc_page from ttm with radeon on an amd64
> machine with 8GB physmem the system would panic part way through
> taking over the console along the lines of
> 
> 'panic: Non dma-reachable buffer at paddr 0x1ef221000(raw)'
> 
> This adds the dma constraints ttm_uvm_alloc_page() has.

At some point it would be good if at least for the graphics stuff we
could allocate "high" memory, but for now this is better to be safe
than sorry.  Might have some impact on inteldrm(4) users on modern
hardware but we probably won't find out until this gets committed.

ok kettenis@

> Index: drm_linux.c
> ===
> RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 drm_linux.c
> --- drm_linux.c   12 Jul 2017 20:12:19 -  1.15
> +++ drm_linux.c   12 Jan 2018 03:36:20 -
> @@ -204,8 +204,8 @@ alloc_pages(unsigned int gfp_mask, unsig
>   flags |= UVM_PLA_ZERO;
>  
>   TAILQ_INIT();
> - if (uvm_pglistalloc(PAGE_SIZE << order, 0, -1, PAGE_SIZE, 0,
> - , 1, flags))
> + if (uvm_pglistalloc(PAGE_SIZE << order, dma_constraint.ucr_low,
> + dma_constraint.ucr_high, PAGE_SIZE, 0, , 1, flags))
>   return NULL;
>   return TAILQ_FIRST();
>  }
> 
>