Re: pckbc(4) diff

2019-01-29 Thread Raphael Graf
On Mon, Jan 28, 2019 at 08:14:09PM +0100, Marcus Glocker wrote:
> On some machines when the pckbc(4) keyboard controller driver attaches
> to the console, it's possible to inject characters by moving your mouse
> in to the keyboard channel.  When injecting enough noise the keyboard
> will stop operating at some point.  A nice way to test this, e.g. on my
> ThinkPad, is by entering in to UKC at boot time and then move your
> mouse.
> 
> This diff will discard characters coming from the aux slot which are
> mixed in to the keyboard slot when we're still in console mode.
> 
> This issue has been reported by deraadt@ who already has OK'ed the diff.
> 
> Comments?  Testing?  More OKs?

I can confirm this fixes the issue on a lenovo X1 Carbon. 

> 
> Thanks,
> Marcus
> 
> 
> Index: sys/dev/ic/pckbc.c
> ===
> RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
> retrieving revision 1.50
> diff -u -p -u -p -r1.50 pckbc.c
> --- sys/dev/ic/pckbc.c11 Mar 2017 11:55:03 -  1.50
> +++ sys/dev/ic/pckbc.c27 Jan 2019 09:01:31 -
> @@ -161,6 +161,9 @@ pckbc_poll_data1(bus_space_tag_t iot, bu
>   if (slot == PCKBC_AUX_SLOT) {
>   DPRINTF("lost kbd 0x%x\n", c);
>   continue;
> + } else if (stat & KBS_AUXDATA) {
> + DPRINTF("discard aux data 0x%x\n", c);
> + continue;
>   }
>   }
>   return (c);
> 



pckbc(4) diff

2019-01-28 Thread Marcus Glocker
On some machines when the pckbc(4) keyboard controller driver attaches
to the console, it's possible to inject characters by moving your mouse
in to the keyboard channel.  When injecting enough noise the keyboard
will stop operating at some point.  A nice way to test this, e.g. on my
ThinkPad, is by entering in to UKC at boot time and then move your
mouse.

This diff will discard characters coming from the aux slot which are
mixed in to the keyboard slot when we're still in console mode.

This issue has been reported by deraadt@ who already has OK'ed the diff.

Comments?  Testing?  More OKs?

Thanks,
Marcus


Index: sys/dev/ic/pckbc.c
===
RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
retrieving revision 1.50
diff -u -p -u -p -r1.50 pckbc.c
--- sys/dev/ic/pckbc.c  11 Mar 2017 11:55:03 -  1.50
+++ sys/dev/ic/pckbc.c  27 Jan 2019 09:01:31 -
@@ -161,6 +161,9 @@ pckbc_poll_data1(bus_space_tag_t iot, bu
if (slot == PCKBC_AUX_SLOT) {
DPRINTF("lost kbd 0x%x\n", c);
continue;
+   } else if (stat & KBS_AUXDATA) {
+   DPRINTF("discard aux data 0x%x\n", c);
+   continue;
}
}
return (c);