Re: Thinkpad active cooling

2015-07-15 Thread Michael McConville
On Wed, Jul 15, 2015 at 11:28:49PM -0500, Adam Thompson wrote:
 Although I agree the fan speed handling under OpenBSD still has room
 for improvement... I haven't run OpenBSD on it for any significant
 amount of time since the ~recent changes to improve Thinkpad power
 usage.

The C-state changes were a huge improvement. Thanks again, Philip.



Re: Thinkpad active cooling

2015-07-15 Thread Adam Thompson

On 2015-07-14 09:13 PM, Michael McConville wrote:

On Wed, Jul 15, 2015 at 03:04:07AM +0200, Tobias Ulmer wrote:

Theo is asking for affected models, so lets compile a list.
All my Thinkpads can be provoked into shutdown due to overtemp because
the fan doesn't spin up:

T60
T61
X201

I've had it happen on my X201, but only once in the ~6 months I've had
it. I was building a Coq library with all four cores in a hot lab. It's
survived many other build beatings without issue, and I've never noticed
a problem with the fans. I'm not questioning that it could be improved,
though.


FWIW, the X201t can trivially hit thermal throttling under Windows 7 
(using the OEM image, even) if you exercise the GPU (easiest way: play a 
Flash game), although not into complete thermal shutdown.

It's a hardware design flaw, not a firmware problem.
I've never had my x201t actually hit the thermal limit under OpenBSD - 
at least not that I've noticed.  I don't use it for CPU-intensive work, 
and I'm not even sure how I would go about exercising the GPU under 
OpenBSD without Adobe Flash :-).
Although I agree the fan speed handling under OpenBSD still has room for 
improvement... I haven't run OpenBSD on it for any significant amount of 
time since the ~recent changes to improve Thinkpad power usage.


--
-Adam Thompson
 athom...@athompso.net



Re: [patch] Defunct companies in products.html

2015-07-15 Thread Ingo Schwarze
Hi Michael,

 On Fri, Jul 10, 2015 at 12:11:43AM -0400, Michael McConville wrote:
 On Thu, Jul 09, 2015 at 11:51:23PM -0400, Michael McConville wrote:

 Core Systems' website has been down for a while, and it seems that
 they no may longer exist. Can anyone confirm or deny?

 Also, MIPS-Informatics seems to be serving World Cup updates these days.

Nobody spoke up, so i just committed your diff.
Relisting is always possible when someone submits up-to-date information.

Thanks,
  Ingo

  Index: products.html
  ===
  RCS file: /cvs/www/products.html,v
  retrieving revision 1.97
  diff -u -p -r1.97 products.html
  --- products.html   2 Jul 2015 05:49:04 -   1.97
  +++ products.html   10 Jul 2015 04:04:15 -
  @@ -105,16 +105,6 @@ href=http://www.opensound.com/openbsd.h
   for OpenBSD/i386 3.x/a
   p
   
  -lifont color=#e0strongCore Systems/strong/fontbr
  -a href=http://www.core.dk;Core Systems/a sells a
  -href=http://www.core.dk/products/insite/index_en.html;InSite/a, an
  -easy to use, server-side web statistics utility, for OpenBSD/i386.
  -InSite is similar to products such as WebTrends, but can also be
  -configured through a web interface to generate reports on the fly, using
  -very little CPU time. (Upon request, Core may be able to provide InSite
  -for platforms other then i386.)
  -p
  -
   lifont color=#e0strongSoftware2Go Motif/strong/font (i386 
  and SPARC only)br
   a href=http://www.apps2go.com;Software2Go, LLC/a has Motif 2.1.20
   Development and Runtime toolkits for OpenBSD.
  @@ -152,13 +142,6 @@ Ordering,/a 817-431-8775 (phone/fax)
   lia href=http://www.interact.se;Interact/abr
   Lulea, Sweden.p
   /ul
  -
  -lifont color=#e0strongSpain/strong/fontp
  -ul
  -lia href=http://www.mips-informatics.com;MIPS-Informatics/abr
  -Sabadell, Spain.p
  -/ul
  -/ul
   
   /body
   /html



Re: httpd: patch to close TLS sockets that fail before TLS handshake

2015-07-15 Thread Joel Sing
On Wednesday 15 July 2015 23:38:33 Jack Burton wrote:
 In 5.7-stable  -current, httpd, when listening for TLS, does not close
 the client socket when tls_accept_socket() returns any non-recoverable
 error. The problem manifests most often when a client connects but does
 not attempt TLS handshake.
 
 Steps to reproduce:
 
 * Configure httpd to listen for TLS requests
 * From a remote host, open TCP session to httpd on port 443
 * Close the TCP connection without sending any data
 * Wait at least 2 * MSL to avoid false positives
 * fstat continues to show the open socket for as long as httpd runs
 
 This causes the number of sockets httpd has opne to keep growing until
 it reaches (openfiles-cur - 7), at which point httpd stops responding
 to HTTPS requests altogether.
 
 Real world occurrence:
 
 We've seen this fairly regularly on a host with only modest HTTPS load,
 where httpd stops responding to HTTPS requests anywhere between 2 hours
 and 4 days after httpd restart.
 
 See the thread httpd stops accepting connections after a few hours on
 current on misc@ for further background and several independent reports
 of the observed behaviour.
 
 Despite the title of that thread, the same behaviour is seen in
 5.7-stable.
 
 Sorry, I don't have any hosts running -current at the moment, but I've
 written a trivial patch against 5.7-stable to treat that particular
 failure mode in the same way as was already being done for EV_TIMEOUTs.
 That fixes the issue for us here (been in place on one production host
 with a modest [2req/sec avg] load for 4 hours with no obvious
 regressions and no stale sockets -- previously we were getting at least
 several stale sockets appearing every hour). The good folks on misc@
 suggested I should post my patch to tech@, so here it is:
 
 --- usr.sbin/httpd/server.c.origWed Jul 15 20:40:16 2015
 +++ usr.sbin/httpd/server.c Wed Jul 15 20:50:15 2015
 @@ -932,6 +932,7 @@ server_accept_tls(int fd, short event, void *arg)
 struct client *clt = (struct client *)arg;
 struct server *srv = (struct server *)clt-clt_srv;
 int ret;
 + char *errmsg;
 
 if (event == EV_TIMEOUT) {
 server_close(clt, TLS accept timeout);
 @@ -952,8 +953,13 @@ server_accept_tls(int fd, short event, void *arg)
 server_accept_tls, clt-clt_tv_start,
 srv-srv_conf.timeout, clt);
 } else if (ret != 0) {
 - log_warnx(%s: TLS accept failed - %s, __func__,
 - tls_error(srv-srv_tls_ctx));
 + if (asprintf(errmsg, %s: TLS accept failed - %s,
 + __func__, tls_error(srv-srv_tls_ctx))  0) {
 + server_close(clt, server_accept_tls: TLS accept failed);
 + } else {
 + server_close(clt, errmsg);
 + free(errmsg);
 + }
 return;
 }
 
 This is the first time I've posted a patch for OpenBSD, so if I've erred
 in style or method please correct me and I'll try to do better next
 time.

Thanks for finding this and providing a diff. I've just committed a slightly 
different version, which simply adds the missing server_close() call - the 
version above will result in additional noise in the logs (both the function 
name and the full details from tls_error()), which we'd rather avoid.



Re: tail: -r mem leak with non-regular files

2015-07-15 Thread Ingo Schwarze
Hi Tobias,

Tobias Stoeckmann wrote on Sun, Jul 12, 2015 at 02:35:18PM +0200:

 Sent this back in March, so maybe someone wants to review this time? :)
 
 tail -r has two memory leaks when handling non-regular files. You can
 easily see memory usage increasing with commands like
 
 $ mknod pipe p
 $ tail -r pipe pipe pipe  /dev/null
 
 And then writing a large file into the pipe three times. top shows the
 memory usage of tail increasing with each consecutive read.
 
 The obvious memory leak is at the end of reverse(): the doubly linked
 list (actually circular list) is never freed. To fix this, I break the
 circle and iterate through it, freeing items until I hit NULL.
 
 The less obvious one is in an error path. As tl-l is always of fixed
 size (BSZ), we can just change the struct to have a BSZ sized array in
 it. This removes the need to do checks in the error path completely.

Your analysis and fix look correct to me, and your patch
survived testing.

 While at it, there is no use to have a typedef in the code, so I just
 removed it, too.

That seems fine, too.

OK schwarze@.

Thanks,
  Ingo


 Index: reverse.c
 ===
 RCS file: /cvs/src/usr.bin/tail/reverse.c,v
 retrieving revision 1.19
 diff -u -p -r1.19 reverse.c
 --- reverse.c 27 Oct 2009 23:59:44 -  1.19
 +++ reverse.c 12 Jul 2015 12:34:21 -
 @@ -147,12 +147,13 @@ r_reg(FILE *fp, enum STYLE style, off_t 
   return (0);
  }
  
 -typedef struct bf {
 +#define  BSZ (128 * 1024)
 +struct bf {
   struct bf *next;
   struct bf *prev;
   size_t len;
 - char *l;
 -} BF;
 + char l[BSZ];
 +};
  
  /*
   * r_buf -- display a non-regular file in reverse order by line.
 @@ -167,21 +168,19 @@ typedef struct bf {
  static void
  r_buf(FILE *fp)
  {
 - BF *mark, *tr, *tl = NULL;
 + struct bf *mark, *tr, *tl = NULL;
   int ch;
   size_t len, llen;
   char *p;
   off_t enomem;
  
 -#define  BSZ (128 * 1024)
   for (mark = NULL, enomem = 0;;) {
   /*
* Allocate a new block and link it into place in a doubly
* linked list.  If out of memory, toss the LRU block and
* keep going.
*/
 - if (enomem || (tl = malloc(sizeof(BF))) == NULL ||
 - (tl-l = malloc(BSZ)) == NULL) {
 + if (enomem || (tl = malloc(sizeof(*tl))) == NULL) {
   if (!mark)
   err(1, NULL);
   tl = enomem ? tl-next : mark;
 @@ -259,5 +258,12 @@ r_buf(FILE *fp)
   while ((tl = tl-next)-len) {
   WR(tl-l, tl-len);
   tl-len = 0;
 + }
 +
 + tl-prev-next = NULL;
 + while (tl != NULL) {
 + tr = tl-next;
 + free(tl);
 + tl = tr;
   }
  }



Re: better run(4) fix (was: run(4): fix crash in run_task())

2015-07-15 Thread Stefan Sperling
On Tue, Jul 14, 2015 at 09:56:53PM -0600, Stefan Sperling wrote:
 This implements your suggestion to properly abort async tasks when
 bringing the interface down.
 
 Fixes the problem for me just as well.

And yet another diff after more discussion.

This diff makes the driver schedule a single 80211 state transition at a time.
The command queue is now used for commands to the device firmware only.

A task scheduled by the scan timeout will now be overwritten when run_stop()
schedules a transition to INIT. So there cannot be a SCAN-SCAN transition
that restarts the timeout while the interface goes down.

If this pattern works out we could move storage and management of this task
up into the net80211 layer eventyally, and make use of it in more drivers.

Index: if_run.c
===
RCS file: /cvs/src/sys/dev/usb/if_run.c,v
retrieving revision 1.109
diff -u -p -r1.109 if_run.c
--- if_run.c12 Jun 2015 15:47:31 -  1.109
+++ if_run.c15 Jul 2015 19:54:40 -
@@ -34,6 +34,7 @@
 #include sys/conf.h
 #include sys/device.h
 #include sys/endian.h
+#include sys/task.h
 
 #include machine/intr.h
 
@@ -361,7 +362,7 @@ voidrun_task(void *);
 void   run_do_async(struct run_softc *, void (*)(struct run_softc *,
void *), void *, int);
 intrun_newstate(struct ieee80211com *, enum ieee80211_state, int);
-void   run_newstate_cb(struct run_softc *, void *);
+void   run_newstate_task(void *);
 void   run_updateedca(struct ieee80211com *);
 void   run_updateedca_cb(struct run_softc *, void *);
 intrun_set_key(struct ieee80211com *, struct ieee80211_node *,
@@ -568,6 +569,7 @@ run_attach(struct device *parent, struct
}
 
usb_init_task(sc-sc_task, run_task, sc, USB_TASK_TYPE_GENERIC);
+   task_set(sc-sc_newstate_task, run_newstate_task, sc);
timeout_set(sc-scan_to, run_next_scan, sc);
timeout_set(sc-calib_to, run_calibrate_to, sc);
 
@@ -685,6 +687,8 @@ run_detach(struct device *self, int flag
 
s = splusb();
 
+   task_del(systq, sc-sc_newstate_task);
+
if (timeout_initialized(sc-scan_to))
timeout_del(sc-scan_to);
if (timeout_initialized(sc-calib_to))
@@ -1767,25 +1771,30 @@ int
 run_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
 {
struct run_softc *sc = ic-ic_softc;
-   struct run_cmd_newstate cmd;
+   struct run_newstate_task_arg *task_arg = sc-sc_newstate_task_arg;
+
+   /* remove any already scheduled transition */
+   task_del(systq, sc-sc_newstate_task);
+
+   /* schedule transition in a process context */
+   task_arg-state = nstate;
+   task_arg-arg = arg;
+   task_add(systq, sc-sc_newstate_task);
 
-   /* do it in a process context */
-   cmd.state = nstate;
-   cmd.arg = arg;
-   run_do_async(sc, run_newstate_cb, cmd, sizeof cmd);
return 0;
 }
 
 void
-run_newstate_cb(struct run_softc *sc, void *arg)
+run_newstate_task(void *arg)
 {
-   struct run_cmd_newstate *cmd = arg;
+   struct run_softc *sc = arg;
+   struct run_newstate_task_arg *task_arg = sc-sc_newstate_task_arg;
struct ieee80211com *ic = sc-sc_ic;
enum ieee80211_state ostate;
struct ieee80211_node *ni;
uint32_t tmp, sta[3];
uint8_t wcid;
-   int s;
+   int s, nstate = task_arg-state;
 
s = splnet();
ostate = ic-ic_state;
@@ -1795,7 +1804,7 @@ run_newstate_cb(struct run_softc *sc, vo
run_set_leds(sc, RT2860_LED_RADIO);
}
 
-   switch (cmd-state) {
+   switch (nstate) {
case IEEE80211_S_INIT:
if (ostate == IEEE80211_S_RUN) {
/* abort TSF synchronization */
@@ -1855,7 +1864,7 @@ run_newstate_cb(struct run_softc *sc, vo
 RT2860_LED_LINK_2GHZ : RT2860_LED_LINK_5GHZ));
break;
}
-   (void)sc-sc_newstate(ic, cmd-state, cmd-arg);
+   (void)sc-sc_newstate(ic, task_arg-state, task_arg-arg);
splx(s);
 }
 



Re: Kill arp_ifinit()?

2015-07-15 Thread Chris Cappuccio
Martin Pieuchot [m...@openbsd.org] wrote:
 On 07/07/15(Tue) 18:02, Martin Pieuchot wrote:
  Maybe not yet but at least I'd like to do the ARP request a bit later.
  
  We create a RTF_LOCAL route entry for every configured address.  So
  use this information to emit a who-has for the configured address.
  
  This also has the advantage of *not* sending an ARP request if 
  something wrong happens between the SIOCSIFADDR ioctl and the
  RTF_LOCAL route creation.
 
 Anybody?
 

Looks ok to me!!



Re: Loosing characters on Dell R420 Drac console

2015-07-15 Thread Hrvoje Popovski
On 9.1.2015. 18:24, Matthieu Herrb wrote:
 Hi,
 
 I've an issue on a Dell R420 server running OpenBSD. I tried both
 5.6-stable and -current on it with the same behavior. 
 
 I'm using a DRAC 7 Enterprise remote access card to access the virtual
 console through their Java web start software. I'm running the latest
 Drac software for this platform (1.57.57). 
 
 Under the BIOS, boot load and in bsd.rd the keyboard works
 perfectly. Under a normal boot, it looses characters (one every 3 or
 4). This makes it almost impossible to log in on the virtual console
 to do anything.
 
 Does anyone have a clue on what could be causing this, and how to fix
 (or workaround) it ?


I have same problem on Dell R620 (idrac7) and Dell R630 (idrac8). Dell
R610 (idrac6) and IBM x3550M4 (imm2) are working fine. I don't have
access to HP ilo console.


logs from /var/log/messages

r610 - idrac6
Jul 16 01:15:29 r610 /bsd: umass0 at uhub1
Jul 16 01:15:29 r610 /bsd:  port 3 configuration 1 interface 0 Avocent
USB Composite Device-1 rev 2.00/0.00 addr 2
Jul 16 01:15:29 r610 /bsd: umass0: using SCSI over Bulk-Only
Jul 16 01:15:29 r610 /bsd: scsibus5 at umass0: 2 targets, initiator 0
Jul 16 01:15:30 r610 /bsd: sd1 at scsibus5 targ 1 lun 0: iDRAC,
LCDRIVE, 0323 SCSI0 0/direct removable
Jul 16 01:15:30 r610 /bsd: umass1 at uhub1
Jul 16 01:15:30 r610 /bsd:  port 3 configuration 1 interface 1 Avocent
USB Composite Device-1 rev 2.00/0.00 addr 2
Jul 16 01:15:30 r610 /bsd: umass1: using SCSI over Bulk-Only
Jul 16 01:15:30 r610 /bsd: scsibus6 at umass1: 2 targets, initiator 0
Jul 16 01:15:31 r610 /bsd: cd1 at scsibus6 targ 1 lun 0: iDRAC, Virtual
CD, 0323 SCSI0 5/cdrom removable
Jul 16 01:15:32 r610 /bsd: sd2 at scsibus6 targ 1 lun 1: iDRAC, Virtual
Floppy, 0323 SCSI0 0/direct removable


r620 - idrac 7
Jul 16 01:07:54 r620 /bsd: ukbd0: was console keyboard
Jul 16 01:07:54 r620 /bsd: wskbd0 detached
Jul 16 01:07:54 r620 /bsd: ukbd0 detached
Jul 16 01:07:54 r620 /bsd: uhidev0 detached
Jul 16 01:07:54 r620 /bsd: wsmouse0 detached
Jul 16 01:07:54 r620 /bsd: ums0 detached
Jul 16 01:07:54 r620 /bsd: uhidev1 detached
Jul 16 01:07:54 r620 /bsd: wsmouse1 detached
Jul 16 01:07:54 r620 /bsd: ums1 detached
Jul 16 01:07:54 r620 /bsd: uhidev2 detached
Jul 16 01:07:55 r620 /bsd: uhidev0 at uhub3
Jul 16 01:07:55 r620 /bsd:  port 1 configuration 1 interface 0 Avocent
Keyboard/Mouse Function rev 2.00/0.00 addr 4
Jul 16 01:07:55 r620 /bsd: uhidev0: iclass 3/1
Jul 16 01:07:55 r620 /bsd: ukbd0 at uhidev0: 8 variable keys, 6 key codes
Jul 16 01:07:55 r620 /bsd: wskbd0 at ukbd0: console keyboard, using
wsdisplay0
Jul 16 01:07:55 r620 /bsd: uhidev1 at uhub3
Jul 16 01:07:55 r620 /bsd:  port 1 configuration 1 interface 1 Avocent
Keyboard/Mouse Function rev 2.00/0.00 addr 4
Jul 16 01:07:55 r620 /bsd: uhidev1: iclass 3/1
Jul 16 01:07:55 r620 /bsd: ums0 at uhidev1: 3 buttons, Z dir
Jul 16 01:07:55 r620 /bsd: wsmouse0 at ums0 mux 0
Jul 16 01:07:55 r620 /bsd: uhidev2 at uhub3
Jul 16 01:07:55 r620 /bsd:  port 1 configuration 1 interface 2 Avocent
Keyboard/Mouse Function rev 2.00/0.00 addr 4
Jul 16 01:07:55 r620 /bsd: uhidev2: iclass 3/1
Jul 16 01:07:55 r620 /bsd: ums1 at uhidev2: 3 buttons, Z dir
Jul 16 01:07:55 r620 /bsd: wsmouse1 at ums1 mux 0
Jul 16 01:07:56 r620 /bsd: umass0 at uhub3
Jul 16 01:07:56 r620 /bsd:  port 4 configuration 1 interface 0 Avocent
Mass Storage Function rev 2.00/0.00 addr 5
Jul 16 01:07:56 r620 /bsd: umass0: using SCSI over Bulk-Only
Jul 16 01:07:56 r620 /bsd: scsibus6 at umass0: 2 targets, initiator 0
Jul 16 01:07:57 r620 /bsd: cd1 at scsibus6 targ 1 lun 0: iDRAC, Virtual
CD, 0329 SCSI0 5/cdrom removable
Jul 16 01:07:58 r620 /bsd: sd1 at scsibus6 targ 1 lun 1: iDRAC, Virtual
Floppy, 0329 SCSI0 0/direct removable


r630 - idrac 8
Jul 16 01:12:49 r630 /bsd: uhidev0 at uhub3
Jul 16 01:12:49 r630 /bsd:  port 1 configuration 1 interface 0 Avocent
Keyboard/Mouse Function rev 2.00/0.00 addr 4
Jul 16 01:12:49 r630 /bsd: uhidev0: iclass 3/1
Jul 16 01:12:49 r630 /bsd: ukbd0 at uhidev0: 8 variable keys, 6 key codes
Jul 16 01:12:49 r630 /bsd: wskbd0 at ukbd0: console keyboard, using
wsdisplay0
Jul 16 01:12:49 r630 /bsd: uhidev1 at uhub3
Jul 16 01:12:49 r630 /bsd:  port 1 configuration 1 interface 1 Avocent
Keyboard/Mouse Function rev 2.00/0.00 addr 4
Jul 16 01:12:49 r630 /bsd: uhidev1: iclass 3/1
Jul 16 01:12:49 r630 /bsd: ums0 at uhidev1: 3 buttons, Z dir
Jul 16 01:12:49 r630 /bsd: wsmouse0 at ums0 mux 0
Jul 16 01:12:49 r630 /bsd: uhidev2 at uhub3
Jul 16 01:12:49 r630 /bsd:  port 1 configuration 1 interface 2 Avocent
Keyboard/Mouse Function rev 2.00/0.00 addr 4
Jul 16 01:12:49 r630 /bsd: uhidev2: iclass 3/1
Jul 16 01:12:49 r630 /bsd: ums1 at uhidev2: 3 buttons, Z dir
Jul 16 01:12:49 r630 /bsd: wsmouse1 at ums1 mux 0
Jul 16 01:12:56 r630 /bsd: umass0 at uhub3
Jul 16 01:12:56 r630 /bsd:  port 4 configuration 1 interface 0 Avocent
Mass Storage Function rev 2.00/0.00 addr 5
Jul 16 01:12:56 r630 /bsd: umass0: using SCSI over Bulk-Only
Jul 16 01:12:56 r630 

httpd: patch to close TLS sockets that fail before TLS handshake

2015-07-15 Thread Jack Burton
In 5.7-stable  -current, httpd, when listening for TLS, does not close
the client socket when tls_accept_socket() returns any non-recoverable
error. The problem manifests most often when a client connects but does
not attempt TLS handshake.

Steps to reproduce:

* Configure httpd to listen for TLS requests
* From a remote host, open TCP session to httpd on port 443
* Close the TCP connection without sending any data
* Wait at least 2 * MSL to avoid false positives
* fstat continues to show the open socket for as long as httpd runs

This causes the number of sockets httpd has opne to keep growing until
it reaches (openfiles-cur - 7), at which point httpd stops responding
to HTTPS requests altogether.

Real world occurrence:

We've seen this fairly regularly on a host with only modest HTTPS load,
where httpd stops responding to HTTPS requests anywhere between 2 hours
and 4 days after httpd restart.

See the thread httpd stops accepting connections after a few hours on
current on misc@ for further background and several independent reports
of the observed behaviour.

Despite the title of that thread, the same behaviour is seen in
5.7-stable.

Sorry, I don't have any hosts running -current at the moment, but I've
written a trivial patch against 5.7-stable to treat that particular
failure mode in the same way as was already being done for EV_TIMEOUTs.
That fixes the issue for us here (been in place on one production host
with a modest [2req/sec avg] load for 4 hours with no obvious
regressions and no stale sockets -- previously we were getting at least
several stale sockets appearing every hour). The good folks on misc@
suggested I should post my patch to tech@, so here it is:

--- usr.sbin/httpd/server.c.origWed Jul 15 20:40:16 2015
+++ usr.sbin/httpd/server.c Wed Jul 15 20:50:15 2015
@@ -932,6 +932,7 @@ server_accept_tls(int fd, short event, void *arg)
struct client *clt = (struct client *)arg;
struct server *srv = (struct server *)clt-clt_srv;
int ret;
+ char *errmsg;

if (event == EV_TIMEOUT) {
server_close(clt, TLS accept timeout);
@@ -952,8 +953,13 @@ server_accept_tls(int fd, short event, void *arg)
server_accept_tls, clt-clt_tv_start,
srv-srv_conf.timeout, clt);
} else if (ret != 0) {
- log_warnx(%s: TLS accept failed - %s, __func__,
- tls_error(srv-srv_tls_ctx));
+ if (asprintf(errmsg, %s: TLS accept failed - %s,
+ __func__, tls_error(srv-srv_tls_ctx))  0) {
+ server_close(clt, server_accept_tls: TLS accept failed);
+ } else {
+ server_close(clt, errmsg);
+ free(errmsg);
+ }
return;
}

This is the first time I've posted a patch for OpenBSD, so if I've erred
in style or method please correct me and I'll try to do better next
time.



Adding USB descriptor to uvideo.h

2015-07-15 Thread Ludovic Coues
Following diff add missing descriptor from Video USB specification 1.5
to uvideo.h and update a couple of table reference to match that version.


Index: sys/dev/usb/uvideo.h
===
RCS file: /cvs/src/sys/dev/usb/uvideo.h,v
retrieving revision 1.57
diff -u -p -r1.57 uvideo.h
--- sys/dev/usb/uvideo.h9 Jul 2015 14:58:32 -   1.57
+++ sys/dev/usb/uvideo.h14 Jul 2015 17:24:42 -
@@ -208,6 +208,18 @@ struct usb_video_camera_terminal_desc {
uByte   *bmControls;
 } __packed;
 
+/* Table 3-7: VC Selector Unit Descriptor */
+struct usb_video_vc_selector_desc {
+   uByte   bLength;
+   uByte   bDescriptorType;
+   uByte   bDescriptorSubType;
+   uByte   bUnitID;
+   uByte   bNrInPins;
+   uByte   baSourceID[1];
+/* uByte   iSelector; */
+#defineVC_GET_ISELECTOR(w) ((w).baSourceID[0] + (w).bNrInPins)
+} __packed;
+
 /* Table 3-8: VC Processing Unit Descriptor */
 struct usb_video_vc_processing_desc {
uByte   bLength;
@@ -222,7 +234,20 @@ struct usb_video_vc_processing_desc {
/* uByte bmVideoStandards; */
 } __packed;
 
-/* Table 3-9: VC Extension Unit Descriptor */
+/* Table 3-9: VC Encoding Unit Descriptor */
+struct usb_video_vc_encoding_desc {
+   uByte   bLength;
+   uByte   bDescriptorType;
+   uByte   bDescriptorSubtype;
+   uByte   bUnitID;
+   uByte   bSourceID;
+   uByte   iEncoding;
+   uByte   bControlSize;
+   uByte   bmControls[3];
+   uByte   bmControlsRuntime[3];
+} __packed;
+
+/* Table 3-10: VC Extension Unit Descriptor */
 struct usb_video_vc_extension_desc {
uByte   bLength;
uByte   bDescriptorType;
@@ -233,7 +258,7 @@ struct usb_video_vc_extension_desc {
uByte   bNrInPins;
 } __packed;
 
-/* Table 3-11: VC Endpoint Descriptor */
+/* Table 3-12: VC Endpoint Descriptor */
 struct usb_video_vc_endpoint_desc {
uByte   bLength;
uByte   bDescriptorType;
@@ -241,7 +266,7 @@ struct usb_video_vc_endpoint_desc {
uWord   wMaxTransferSize;
 } __packed;
 
-/* Table 3-13: Interface Input Header Descriptor */
+/* Table 3-14: Interface Input Header Descriptor */
 struct usb_video_input_header_desc {
uByte   bLength;
uByte   bDescriptorType;
@@ -262,7 +287,36 @@ struct usb_video_input_header_desc_all {
uByte   *bmaControls;
 };
 
-/* Table 3-18: Color Matching Descriptor */
+/* Table 3-15: Interface Output Header Descriptor */
+struct usb_video_output_header_desc {
+   uByte   bLength;
+   uByte   bDescriptorType;
+   uByte   bDescriptorSubtype;
+   uByte   bNumFormats;
+   uWord   wTotalLength;
+   uByte   bEndpointAddress;
+   uByte   bTerminalLink;
+   uByte   bControlSize;
+   uByte   baControls[1];
+} __packed;
+
+/* Table 3-18: Still Image Frame Descriptor */
+struct usb_video_still_image_frame_desc {
+   uByte   bLength;
+   uByte   bDescriptorType;
+   uByte   bDescriptorSubtype;
+   uByte   bEndpointAddress;
+   uByte   bNumImageSizePatterns;
+   uByte   data[1];
+/* struct {
+   uWord   wWidth;
+   wWord   wHeight;
+   } __packed size[1]; */
+/* uByte   bNumCompressionPattern; */
+/* uByte   bCompression[1]; */
+} __packed;
+
+/* Table 3-19: Color Matching Descriptor */
 struct usb_video_color_matching_descr {
uByte   bLength;
uByte   bDescriptorType;


Re: httpd: patch to close TLS sockets that fail before TLS handshake

2015-07-15 Thread Jack Burton
On Wed, 2015-07-15 at 23:38 +0930, Jack Burton wrote: 
 Sorry, I don't have any hosts running -current at the moment, but I've
 written a trivial patch against 5.7-stable to treat that particular
 failure mode in the same way as was already being done for EV_TIMEOUTs.
 That fixes the issue for us here (been in place on one production host
 with a modest [2req/sec avg] load for 4 hours with no obvious
 regressions and no stale sockets -- previously we were getting at least
 several stale sockets appearing every hour). The good folks on misc@
 suggested I should post my patch to tech@, so here it is:

Hmm, that's a bit painful to read -- it seems my mail client collapsed
all the tabs into single spaces. I'll try again with tabs expanded:

--- usr.sbin/httpd/server.c.origWed Jul 15 20:40:16 2015
+++ usr.sbin/httpd/server.c Wed Jul 15 20:50:15 2015
@@ -932,6 +932,7 @@ server_accept_tls(int fd, short event, void *arg)
struct client *clt = (struct client *)arg;
struct server *srv = (struct server *)clt-clt_srv;
int ret;
+   char *errmsg;

if (event == EV_TIMEOUT) {
server_close(clt, TLS accept timeout);
@@ -952,8 +953,13 @@ server_accept_tls(int fd, short event, void *arg)
server_accept_tls, clt-clt_tv_start,
srv-srv_conf.timeout, clt);
} else if (ret != 0) {
-   log_warnx(%s: TLS accept failed - %s, __func__,
-   tls_error(srv-srv_tls_ctx));
+   if (asprintf(errmsg, %s: TLS accept failed - %s,
+   __func__, tls_error(srv-srv_tls_ctx))  0) {
+   server_close(clt, server_accept_tls: TLS accept
failed);
+   } else {
+   server_close(clt, errmsg);
+   free(errmsg);
+   }
return;
}



change from vt220 to pccon0 for AMD/Intel consoles

2015-07-15 Thread Alexei Malinin
Hello.

There are pccon* terminal descriptions for AMD/Intel PC consoles
in /etc/termcap.I have been using them on various computers
since 2011 without problems.

I suggest to use pccon0 instead of vt220 by default
for amd64 and i386because vt220 has not good support
of navigation and function keys oftypical PC keyboard.

History of pccon*:
http://marc.info/?l=ncurses-bugm=131825802104588w=2
http://marc.info/?l=openbsd-miscm=132125411729722w=2


--
Alexei Malinin


diff -dur src.orig/etc/etc.amd64/ttys src/etc/etc.amd64/ttys
--- src.orig/etc/etc.amd64/ttys Wed Jan  9 20:39:42 2008
+++ src/etc/etc.amd64/ttys  Wed Jul 15 16:14:29 2015
@@ -3,19 +3,19 @@
 #
 # name getty   typestatus  comments
 #
-console/usr/libexec/getty std.9600   vt220   off secure
-ttyC0  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC1  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC2  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC3  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC4  /usr/libexec/getty std.9600   vt220   off secure
-ttyC5  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC6  /usr/libexec/getty std.9600   vt220   off secure
-ttyC7  /usr/libexec/getty std.9600   vt220   off secure
-ttyC8  /usr/libexec/getty std.9600   vt220   off secure
-ttyC9  /usr/libexec/getty std.9600   vt220   off secure
-ttyCa  /usr/libexec/getty std.9600   vt220   off secure
-ttyCb  /usr/libexec/getty std.9600   vt220   off secure
+console/usr/libexec/getty std.9600   pccon0  off secure
+ttyC0  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC1  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC2  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC3  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC4  /usr/libexec/getty std.9600   pccon0  off secure
+ttyC5  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC6  /usr/libexec/getty std.9600   pccon0  off secure
+ttyC7  /usr/libexec/getty std.9600   pccon0  off secure
+ttyC8  /usr/libexec/getty std.9600   pccon0  off secure
+ttyC9  /usr/libexec/getty std.9600   pccon0  off secure
+ttyCa  /usr/libexec/getty std.9600   pccon0  off secure
+ttyCb  /usr/libexec/getty std.9600   pccon0  off secure
 tty00  /usr/libexec/getty std.9600   unknown off
 tty01  /usr/libexec/getty std.9600   unknown off
 tty02  /usr/libexec/getty std.9600   unknown off
diff -dur src.orig/etc/etc.i386/ttys src/etc/etc.i386/ttys
--- src.orig/etc/etc.i386/ttys  Wed Jan  9 20:39:42 2008
+++ src/etc/etc.i386/ttys   Wed Jul 15 16:14:42 2015
@@ -3,19 +3,19 @@
 #
 # name getty   typestatus  comments
 #
-console/usr/libexec/getty std.9600   vt220   off secure
-ttyC0  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC1  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC2  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC3  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC4  /usr/libexec/getty std.9600   vt220   off secure
-ttyC5  /usr/libexec/getty std.9600   vt220   on  secure
-ttyC6  /usr/libexec/getty std.9600   vt220   off secure
-ttyC7  /usr/libexec/getty std.9600   vt220   off secure
-ttyC8  /usr/libexec/getty std.9600   vt220   off secure
-ttyC9  /usr/libexec/getty std.9600   vt220   off secure
-ttyCa  /usr/libexec/getty std.9600   vt220   off secure
-ttyCb  /usr/libexec/getty std.9600   vt220   off secure
+console/usr/libexec/getty std.9600   pccon0  off secure
+ttyC0  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC1  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC2  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC3  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC4  /usr/libexec/getty std.9600   pccon0  off secure
+ttyC5  /usr/libexec/getty std.9600   pccon0  on  secure
+ttyC6  /usr/libexec/getty std.9600   pccon0  off secure
+ttyC7  /usr/libexec/getty std.9600   pccon0  off secure
+ttyC8  /usr/libexec/getty std.9600   pccon0  off secure
+ttyC9  /usr/libexec/getty std.9600   pccon0  off secure
+ttyCa  /usr/libexec/getty std.9600   pccon0  off secure
+ttyCb  /usr/libexec/getty std.9600   pccon0  off secure
 tty00  /usr/libexec/getty std.9600   unknown off
 tty01  /usr/libexec/getty std.9600   unknown off
 tty02  /usr/libexec/getty std.9600   unknown off



Re: passwd(1): describe behavior when user not specified

2015-07-15 Thread Jérémie Courrèges-Anglas
Todd C. Miller todd.mil...@courtesan.com writes:

 This comes up periodically with users being confused when running
 passwd after su changes the passwd of the user they came from.

Indeed.  ok jca@

 Index: usr.bin/passwd/passwd.1
 ===
 RCS file: /cvs/src/usr.bin/passwd/passwd.1,v
 retrieving revision 1.41
 diff -u -p -u -r1.41 passwd.1
 --- usr.bin/passwd/passwd.1   2 Nov 2014 05:25:09 -   1.41
 +++ usr.bin/passwd/passwd.1   15 Jul 2015 15:40:59 -
 @@ -42,6 +42,10 @@
  .Sh DESCRIPTION
  .Nm
  changes the user's local or YP password.
 +If no
 +.Ar user
 +is specified, the user's login name is used (see
 +.Xr logname 1 ) .
  First, the user is prompted for their current password.
  If the current password is correctly typed, a new password is requested.
  The new password must be entered twice to avoid typing errors.
 @@ -129,7 +133,7 @@ file to clear the error.
  .Sh SEE ALSO
  .Xr chpass 1 ,
  .Xr encrypt 1 ,
 -.Xr login 1 ,
 +.Xr logname 1 ,
  .Xr login.conf 5 ,
  .Xr passwd 5 ,
  .Xr pwd_mkdb 8 ,


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



Re: Stalled IPI processing on octeon

2015-07-15 Thread Visa Hankala
On Wed, Jul 15, 2015 at 05:07:39AM +, Miod Vallat wrote:
  The patch below solves stalled IPI processing on octeon. When IPIs are
  finally enabled during boot, some kernel threads have already been
  started. There seems to be no mechanism that would update interrupt
  masks for a running thread, so the early threads run IPIs disabled.
  This will lead to a deadlock quite soon after launching other cores.
  The patch makes the registering of the IPI handler happen early enough
  for the correct idle_mask to propagate to all threads.
 
 This makes sense. However, your `ipi_enabled' new variable basically
 mimics an `if (ipi_handler != NULL)' test, so there is no need for an
 extra variable.

Here is a revised patch.


Index: arch/octeon/octeon/machdep.c
===
RCS file: src/sys/arch/octeon/octeon/machdep.c,v
retrieving revision 1.64
diff -u -p -r1.64 machdep.c
--- arch/octeon/octeon/machdep.c25 Jun 2015 10:56:00 -  1.64
+++ arch/octeon/octeon/machdep.c15 Jul 2015 13:21:02 -
@@ -128,6 +128,10 @@ intocteon_cpuspeed(int *);
 static voidprocess_bootargs(void);
 static uint64_tget_ncpusfound(void);
 
+#ifdef MULTIPROCESSOR
+uint32_t   ipi_intr(uint32_t, struct trap_frame *);
+#endif
+
 extern voidparse_uboot_root(void);
 
 cons_decl(cn30xxuart);
@@ -487,6 +491,10 @@ mips_init(__register_t a0, __register_t 
Debugger();
 #endif
 
+#ifdef MULTIPROCESSOR
+   set_intr(INTPRI_IPI, CR_INT_1, ipi_intr);
+#endif
+
/*
 * Return the new kernel stack pointer.
 */
@@ -771,8 +779,6 @@ uint32_t cpu_spinup_mask = 0;
 uint64_t cpu_spinup_a0, cpu_spinup_sp;
 static int (*ipi_handler)(void *);
 
-uint32_t ipi_intr(uint32_t, struct trap_frame *);
-
 extern bus_space_t iobus_tag;
 extern bus_space_handle_t iobus_h;
 
@@ -852,6 +858,9 @@ ipi_intr(uint32_t hwpend, struct trap_fr
 */
bus_space_write_8(iobus_tag, iobus_h, CIU_IP3_EN0(cpuid), 0);
 
+   if (ipi_handler == NULL)
+   return hwpend;
+
ipi_handler((void *)cpuid);
 
/*
@@ -872,7 +881,6 @@ hw_ipi_intr_establish(int (*func)(void *
0x);
bus_space_write_8(iobus_tag, iobus_h, CIU_IP3_EN0(cpuid),
(1ULL  CIU_INT_MBOX0)|(1ULL  CIU_INT_MBOX1));
-   set_intr(INTPRI_IPI, CR_INT_1, ipi_intr);
 
return 0;
 };



Re: Missing descriptor in uvideo.h

2015-07-15 Thread ludovic coues
2015-07-15 17:04 GMT+02:00 Martin Pieuchot m...@openbsd.org:
 On 15/07/15(Wed) 16:45, Ludovic Coues wrote:
 Following is a diff adding missing USB descriptor to uvideo.h according
 to USB Video spec 1.5 . It also update a couple of table reference from
 spec 1.1 to 1.5

 Do not hesitate to explain *why* do you need that, it might not be clear
 to everybody on this list :)


Oh, right.
I'm working on an alternative to lsusb for my summer of code. By
design, I'm using pretty much every USB descriptor defined by the
spec.

 Index: sys/dev/usb/uvideo.h
 ===
 RCS file: /cvs/src/sys/dev/usb/uvideo.h,v
 retrieving revision 1.57
 diff -u -p -r1.57 uvideo.h
 --- sys/dev/usb/uvideo.h  9 Jul 2015 14:58:32 -   1.57
 +++ sys/dev/usb/uvideo.h  14 Jul 2015 17:24:42 -
 +/* Table 3-18: Still Image Frame Descriptor */
 +struct usb_video_still_image_frame_desc {
 + uByte   bLength;
 + uByte   bDescriptorType;
 + uByte   bDescriptorSubtype;
 + uByte   bEndpointAddress;
 + uByte   bNumImageSizePatterns;
 + uByte   data[1];
 +/*   struct {
 + uWord   wWidth;
 + wWord   wHeight;
 + } __packed size[1]; */
 +/*   uByte   bNumCompressionPattern; */
 +/*   uByte   bCompression[1]; */

 Why are they commented?

Mainly as a way to document the spec in the code.
I could remove the data field and uncomment the size field. I would be
pretty close to the spec and this struct could be filled with a
memcpy. But size would be a field of size 32 followed by two field of
size 8. I don't know how I could access bNumCompressionPattern or
bCompression in this case.

I choose instead of describing the data as code in a comment and
putting a field to allow access to the data. Maybe I should add macro
to access the 'ghost' field.


-- 

Cordialement, Coues Ludovic
+336 148 743 42



passwd(1): describe behavior when user not specified

2015-07-15 Thread Todd C. Miller
This comes up periodically with users being confused when running
passwd after su changes the passwd of the user they came from.

 - todd

Index: usr.bin/passwd/passwd.1
===
RCS file: /cvs/src/usr.bin/passwd/passwd.1,v
retrieving revision 1.41
diff -u -p -u -r1.41 passwd.1
--- usr.bin/passwd/passwd.1 2 Nov 2014 05:25:09 -   1.41
+++ usr.bin/passwd/passwd.1 15 Jul 2015 15:40:59 -
@@ -42,6 +42,10 @@
 .Sh DESCRIPTION
 .Nm
 changes the user's local or YP password.
+If no
+.Ar user
+is specified, the user's login name is used (see
+.Xr logname 1 ) .
 First, the user is prompted for their current password.
 If the current password is correctly typed, a new password is requested.
 The new password must be entered twice to avoid typing errors.
@@ -129,7 +133,7 @@ file to clear the error.
 .Sh SEE ALSO
 .Xr chpass 1 ,
 .Xr encrypt 1 ,
-.Xr login 1 ,
+.Xr logname 1 ,
 .Xr login.conf 5 ,
 .Xr passwd 5 ,
 .Xr pwd_mkdb 8 ,



Missing descriptor in uvideo.h

2015-07-15 Thread Ludovic Coues
Following is a diff adding missing USB descriptor to uvideo.h according
to USB Video spec 1.5 . It also update a couple of table reference from
spec 1.1 to 1.5
Index: sys/dev/usb/uvideo.h
===
RCS file: /cvs/src/sys/dev/usb/uvideo.h,v
retrieving revision 1.57
diff -u -p -r1.57 uvideo.h
--- sys/dev/usb/uvideo.h9 Jul 2015 14:58:32 -   1.57
+++ sys/dev/usb/uvideo.h14 Jul 2015 17:24:42 -
@@ -208,6 +208,18 @@ struct usb_video_camera_terminal_desc {
uByte   *bmControls;
 } __packed;
 
+/* Table 3-7: VC Selector Unit Descriptor */
+struct usb_video_vc_selector_desc {
+   uByte   bLength;
+   uByte   bDescriptorType;
+   uByte   bDescriptorSubType;
+   uByte   bUnitID;
+   uByte   bNrInPins;
+   uByte   baSourceID[1];
+/* uByte   iSelector; */
+#defineVC_GET_ISELECTOR(w) ((w).baSourceID[0] + (w).bNrInPins)
+} __packed;
+
 /* Table 3-8: VC Processing Unit Descriptor */
 struct usb_video_vc_processing_desc {
uByte   bLength;
@@ -222,7 +234,20 @@ struct usb_video_vc_processing_desc {
/* uByte bmVideoStandards; */
 } __packed;
 
-/* Table 3-9: VC Extension Unit Descriptor */
+/* Table 3-9: VC Encoding Unit Descriptor */
+struct usb_video_vc_encoding_desc {
+   uByte   bLength;
+   uByte   bDescriptorType;
+   uByte   bDescriptorSubtype;
+   uByte   bUnitID;
+   uByte   bSourceID;
+   uByte   iEncoding;
+   uByte   bControlSize;
+   uByte   bmControls[3];
+   uByte   bmControlsRuntime[3];
+} __packed;
+
+/* Table 3-10: VC Extension Unit Descriptor */
 struct usb_video_vc_extension_desc {
uByte   bLength;
uByte   bDescriptorType;
@@ -233,7 +258,7 @@ struct usb_video_vc_extension_desc {
uByte   bNrInPins;
 } __packed;
 
-/* Table 3-11: VC Endpoint Descriptor */
+/* Table 3-12: VC Endpoint Descriptor */
 struct usb_video_vc_endpoint_desc {
uByte   bLength;
uByte   bDescriptorType;
@@ -241,7 +266,7 @@ struct usb_video_vc_endpoint_desc {
uWord   wMaxTransferSize;
 } __packed;
 
-/* Table 3-13: Interface Input Header Descriptor */
+/* Table 3-14: Interface Input Header Descriptor */
 struct usb_video_input_header_desc {
uByte   bLength;
uByte   bDescriptorType;
@@ -262,7 +287,36 @@ struct usb_video_input_header_desc_all {
uByte   *bmaControls;
 };
 
-/* Table 3-18: Color Matching Descriptor */
+/* Table 3-15: Interface Output Header Descriptor */
+struct usb_video_output_header_desc {
+   uByte   bLength;
+   uByte   bDescriptorType;
+   uByte   bDescriptorSubtype;
+   uByte   bNumFormats;
+   uWord   wTotalLength;
+   uByte   bEndpointAddress;
+   uByte   bTerminalLink;
+   uByte   bControlSize;
+   uByte   baControls[1];
+} __packed;
+
+/* Table 3-18: Still Image Frame Descriptor */
+struct usb_video_still_image_frame_desc {
+   uByte   bLength;
+   uByte   bDescriptorType;
+   uByte   bDescriptorSubtype;
+   uByte   bEndpointAddress;
+   uByte   bNumImageSizePatterns;
+   uByte   data[1];
+/* struct {
+   uWord   wWidth;
+   wWord   wHeight;
+   } __packed size[1]; */
+/* uByte   bNumCompressionPattern; */
+/* uByte   bCompression[1]; */
+} __packed;
+
+/* Table 3-19: Color Matching Descriptor */
 struct usb_video_color_matching_descr {
uByte   bLength;
uByte   bDescriptorType;


Re: change from vt220 to pccon0 for AMD/Intel consoles

2015-07-15 Thread Theo de Raadt
 There are pccon* terminal descriptions for AMD/Intel PC consoles
 in /etc/termcap.I have been using them on various computers
 since 2011 without problems.
 
 I suggest to use pccon0 instead of vt220 by default
 for amd64 and i386because vt220 has not good support
 of navigation and function keys oftypical PC keyboard.
 
 History of pccon*:
 http://marc.info/?l=ncurses-bugm=131825802104588w=2
 http://marc.info/?l=openbsd-miscm=132125411729722w=2

Sorry, no.

Because, as soon as you ssh from such a console to another operating
system, you are now operating under the rules of their termcap
entries.  Which are not portable, because the push to distribute
modern termcap files into all-OS slowed down considerably in the
recent years.

vt220 is the baseline the kernel is trying to emulate.  I am pretty
sure such a baseline is more important to people than the fancy
extensions.

I actually wish kernel code implemented xterm.




fd_getfile() and fp refcounting

2015-07-15 Thread Martin Pieuchot
Here's diff a that moves FRELE() inside fd_getfile().  This is some
plumbing to help unlocking code paths manipulating fp.  The idea is
to guarantee to the callers of fd_getfile() that the returned fp has
the necessary reference counts and will not disappear while it is
being manipulated.

Some code paths are more tricky than others so comments are appreciated.

Index: arch/i386/i386/linux_machdep.c
===
RCS file: /cvs/src/sys/arch/i386/i386/linux_machdep.c,v
retrieving revision 1.46
diff -u -p -r1.46 linux_machdep.c
--- arch/i386/i386/linux_machdep.c  16 Dec 2014 18:30:03 -  1.46
+++ arch/i386/i386/linux_machdep.c  14 Jul 2015 21:19:26 -
@@ -428,7 +428,6 @@ linux_machdepioctl(struct proc *p, void 
struct vt_mode lvt;
caddr_t bvtp, sg;
 #endif
-   struct filedesc *fdp;
struct file *fp;
int fd;
int (*ioctlf)(struct file *, u_long, caddr_t, struct proc *);
@@ -439,9 +438,10 @@ linux_machdepioctl(struct proc *p, void 
SCARG(bia, data) = SCARG(uap, data);
com = SCARG(uap, com);
 
-   fdp = p-p_fd;
-   if ((fp = fd_getfile(fdp, fd)) == NULL)
+   if ((fp = fd_getfile(p-p_fd, fd)) == NULL)
return (EBADF);
+   FRELE(fp, p);
+   fp = NULL;
 
switch (com) {
 #if (NWSDISPLAY  0  defined(WSDISPLAY_COMPAT_USL))
@@ -568,7 +568,8 @@ linux_machdepioctl(struct proc *p, void 
 * XXX hack: if the function returns EJUSTRETURN,
 * it has stuffed a sysctl return value in pt.data.
 */
-   FREF(fp);
+   if ((fp = fd_getfile(p-p_fd, fd)) == NULL)
+   return (EBADF);
ioctlf = fp-f_ops-fo_ioctl;
pt.com = SCARG(uap, com);
pt.data = SCARG(uap, data);
Index: compat/linux/linux_blkio.c
===
RCS file: /cvs/src/sys/compat/linux/linux_blkio.c,v
retrieving revision 1.9
diff -u -p -r1.9 linux_blkio.c
--- compat/linux/linux_blkio.c  22 Apr 2012 05:43:14 -  1.9
+++ compat/linux/linux_blkio.c  14 Jul 2015 21:19:26 -
@@ -72,7 +72,6 @@ linux_ioctl_blkio(struct proc *p, struct
 fdp = p-p_fd;
if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
return (EBADF);
-   FREF(fp);
error = 0;
ioctlf = fp-f_ops-fo_ioctl;
com = SCARG(uap, com);
Index: compat/linux/linux_cdrom.c
===
RCS file: /cvs/src/sys/compat/linux/linux_cdrom.c,v
retrieving revision 1.12
diff -u -p -r1.12 linux_cdrom.c
--- compat/linux/linux_cdrom.c  30 Apr 2015 09:20:51 -  1.12
+++ compat/linux/linux_cdrom.c  14 Jul 2015 21:19:26 -
@@ -77,7 +77,6 @@ linux_ioctl_cdrom(p, v, retval)
syscallarg(caddr_t) data;
} */ *uap = v;
struct file *fp;
-   struct filedesc *fdp;
caddr_t sg;
u_long com, arg;
struct sys_ioctl_args ia;
@@ -107,10 +106,8 @@ linux_ioctl_cdrom(p, v, retval)
} tmpl;
 
 
-   fdp = p-p_fd;
-   if ((fp = fd_getfile_mode(fdp, SCARG(uap, fd), FREAD|FWRITE)) == NULL)
+   if ((fp = fd_getfile_mode(p, SCARG(uap, fd), FREAD|FWRITE)) == NULL)
return (EBADF);
-   FREF(fp);
 
com = SCARG(uap, com);
retval[0] = 0;
Index: compat/linux/linux_fdio.c
===
RCS file: /cvs/src/sys/compat/linux/linux_fdio.c,v
retrieving revision 1.7
diff -u -p -r1.7 linux_fdio.c
--- compat/linux/linux_fdio.c   22 Apr 2012 05:43:14 -  1.7
+++ compat/linux/linux_fdio.c   14 Jul 2015 21:19:26 -
@@ -78,7 +78,6 @@ linux_ioctl_fdio(struct proc *p, struct 
if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
return (EBADF);
 
-   FREF(fp);
com = SCARG(uap, com);
ioctlf = fp-f_ops-fo_ioctl;
 
Index: compat/linux/linux_file.c
===
RCS file: /cvs/src/sys/compat/linux/linux_file.c,v
retrieving revision 1.30
diff -u -p -r1.30 linux_file.c
--- compat/linux/linux_file.c   26 Mar 2014 05:23:42 -  1.30
+++ compat/linux/linux_file.c   14 Jul 2015 21:19:26 -
@@ -198,7 +198,6 @@ linux_sys_open(p, v, retval)
 
if ((fp = fd_getfile(fdp, *retval)) == NULL)
return (EBADF);
-   FREF(fp);
 if (fp-f_type == DTYPE_VNODE)
 (fp-f_ops-fo_ioctl) (fp, TIOCSCTTY, (caddr_t) 0, p);
FRELE(fp, p);
@@ -420,12 +419,14 @@ linux_sys_fcntl(p, v, retval)
return (EBADF);
if (fp-f_type == DTYPE_SOCKET) {
cmd = cmd == LINUX_F_SETOWN ? F_SETOWN : F_GETOWN;
+   FRELE(fp, p);
break;
}
vp 

Re: Missing descriptor in uvideo.h

2015-07-15 Thread Martin Pieuchot
On 15/07/15(Wed) 16:45, Ludovic Coues wrote:
 Following is a diff adding missing USB descriptor to uvideo.h according
 to USB Video spec 1.5 . It also update a couple of table reference from
 spec 1.1 to 1.5

Do not hesitate to explain *why* do you need that, it might not be clear
to everybody on this list :)

 Index: sys/dev/usb/uvideo.h
 ===
 RCS file: /cvs/src/sys/dev/usb/uvideo.h,v
 retrieving revision 1.57
 diff -u -p -r1.57 uvideo.h
 --- sys/dev/usb/uvideo.h  9 Jul 2015 14:58:32 -   1.57
 +++ sys/dev/usb/uvideo.h  14 Jul 2015 17:24:42 -
 +/* Table 3-18: Still Image Frame Descriptor */
 +struct usb_video_still_image_frame_desc {
 + uByte   bLength;
 + uByte   bDescriptorType;
 + uByte   bDescriptorSubtype;
 + uByte   bEndpointAddress;
 + uByte   bNumImageSizePatterns;
 + uByte   data[1];
 +/*   struct {
 + uWord   wWidth;
 + wWord   wHeight;
 + } __packed size[1]; */
 +/*   uByte   bNumCompressionPattern; */
 +/*   uByte   bCompression[1]; */

Why are they commented?

 +} __packed;
 +
 +/* Table 3-19: Color Matching Descriptor */
  struct usb_video_color_matching_descr {
   uByte   bLength;
   uByte   bDescriptorType;



unbound update

2015-07-15 Thread Stuart Henderson
Here's an update to unbound 1.5.4. There was some file reorganisation so
I am providing two diffs: the one inline in this email shows the *code*
changes only for those who are interested to review it; this will not
build on its own.

For applying and testing, use http://junkpile.org/unbound-1.5.4.diff
instead (with patch -Ep0) which has all the Makefile changes, #include
path changes etc as well.

Test reports, comments and OKs welcome.

Changelog entries since what we have in tree:

+--
| 29 June 2015: Wouter
|   - iana portlist update.
|   - Fix alloc with log for allocation size checks.
| 
| 26 June 2015: Wouter
|   - Fix #677 Fix DNAME responses from cache that failed internal chain
| test.
|   - iana portlist update.
| 
| 22 June 2015: Wouter
|   - Fix #677 Fix CNAME corresponding to a DNAME was checked incorrectly
| and was therefore always synthesized (thanks to Valentin Dietrich).
| 
| 4 June 2015: Wouter
|   - RFC 7553 RR type URI support, is now enabled by default.
| 
| 2 June 2015: Wouter
|   - Fix #674: Do not free pointers given by getenv.
| 
| 29 May 2015: Wouter
|   - Fix that unparseable error responses are ratelimited.
|   - SOA negative TTL is capped at minimumttl in its rdata section.
|   - cache-max-negative-ttl config option, default 3600.
| 
| 26 May 2015: Wouter
|   - Document that ratelimit works with unbound-control set_option.
| 
| 21 May 2015: Wouter
|   - iana portlist update.
|   - documentation proposes ratelimit of 1000 (closer to what upstream
| servers expect from us).
| 
| 20 May 2015: Wouter
|   - DLV is going to be decommissioned.  Advice to stop using it, and
| put text in the example configuration and man page to that effect.
| 
| 10 May 2015: Wouter
|   - Change syntax of particular validator error to be easier for
| machine parse, swap rrset and ip adres info so it looks like:
| validation failure www.example.nl. TXT IN: signature crypto
| failed from 2001:DB8:7:bba4::53 for *.example.nl. NSEC IN
| 
| 1 May 2015: Wouter
|   - caps-whitelist in unbound.conf allows whitelist of loadbalancers
| that cannot work with caps-for-id or its fallback.
| 
| 30 April 2015: Wouter
|   - Unit test for type ANY synthesis.
| 
| 22 April 2015: Wouter
|   - Removed contrib/unbound_unixsock.diff, because it has been
| integrated, use control-interface: /path in unbound.conf.
|   - iana portlist update.
| 
| 17 April 2015: Wouter
|   - Synthesize ANY responses from cache.  Does not search exhaustively,
| but MX,A,,SOA,NS also CNAME.
|   - Fix leaked dns64prefix configuration string.
| 
| 16 April 2015: Wouter
|   - Add local-zone type inform_deny, that logs query and drops answer.
|   - Ratelimit does not apply to prefetched queries, and ratelimit-factor
| is default 10.  Repeated normal queries get resolved and with
| prefetch stay in the cache.
|   - Fix bug#664: libunbound python3 related fixes (from Tomas Hozza)
| Use print_function also for Python2.
| libunbound examples: produce sorted output.
| libunbound-Python: libldns is not used anymore.
| Fix issue with Python 3 mapping of FILE* using file_py3.i from ldns.
| 
| 10 April 2015: Wouter
|   - unbound-control ratelimit_list lists high rate domains.
|   - ratelimit feature, ratelimit: 100, or some sensible qps, can be
| used to turn it on.  It ratelimits recursion effort per zone.
| For particular names you can configure exceptions in unbound.conf.
|   - Fix that get_option for cache-sizes does not print double newline.
|   - Fix#663: ssl handshake fails when using unix socket because dh size
| is too small.
| 
| 8 April 2015: Wouter
|   - Fix crash in dnstap: Do not try to log TCP responses after timeout.
| 
| 7 April 2015: Wouter
|   - Libunbound skips dos-line-endings from etc/hosts.
|   - Unbound exits with a fatal error when the auto-trust-anchor-file
| fails to be writable.  This is seconds after startup.  You can
| load a readonly auto-trust-anchor-file with trust-anchor-file.
| The file has to be writable to notice the trust anchor change,
| without it, a trust anchor change will be unnoticed and the system
| will then become inoperable.
|   - unbound-control list_insecure command shows the negative trust
| anchors currently configured, patch from Jelte Jansen.
| 
| 2 April 2015: Wouter
|   - Fix #660: Fix interface-automatic broken in the presence of
| asymmetric routing.
| 
| 26 March 2015: Wouter
|   - remote.c probedelay line is easier to read.
|   - rename ldns subdirectory to sldns to avoid name collision.
| 
| 25 March 2015: Wouter
|   - Fix #657:  libunbound(3) recommends deprecated
| CRYPTO_set_id_callback.
|   - If unknown trust anchor