kern/141011: [usb] Encrypted root, geli password at boot; enter key never release

Wiktor Niesiobedzki bsd at w.evip.pl
Sun Jan 10 23:39:19 UTC 2010


2010/1/10 Hans Petter Selasky <hselasky at c2i.net>:
> On Sunday 10 January 2010 17:40:03 Wiktor Niesiobedzki wrote:
>> The following reply was made to PR kern/141011; it has been noted by GNATS.
>
>>
>>  Hello Hans,
>>
>>  I've tried to comment out this section in your version of ukbd.c, but
>>  to no extent. Still some events get discarded somehow. Shall I enable
>>  some usb debug-flags to help getting to the core of the problem?
>
> Hi,
>
> The information we need is inside ukbd.c . Try to add printfs in code enabling
> and disabling the keyboard. Especially in the USB keyboard read character
> function, and try to figure out where the missing characters are going.


Hi,

Nothing new in enabling and disabling the keyboard. The only
intresting thing is, that although I have only one keyboard, the
ukbd_enable is called twice.

What I found somehow helping, is some additional printfs in ukbd_read_char.
Especially in beginning part:
        printf("enter ukbd_read_char\n");
        if (!KBD_IS_ACTIVE(kbd)) {
                printf("kbd is not active - exiting\n");
                return (NOKEY);
        }

        if (sc->sc_flags & UKBD_FLAG_POLLING) {
                if (!mtx_owned(&Giant)) {
                        /* XXX cludge */
                        printf("ukbd_read_char: UKBD_FLAG_POOLING is
set and giant is not owned - recursing and locking giant\n");
                        int retval;
                        mtx_lock(&Giant);
                        retval = ukbd_read_char(kbd, wait);
                        mtx_unlock(&Giant);
                        return (retval);
                }
        } else {
                /* XXX the keyboard layer requires Giant */
                if (!mtx_owned(&Giant))
                        printf("ukbd_read_char: UKBD_FLAG_POOLING is
not set and Giant is not owned -> DISCARDING KEY!\n");
                        return (NOKEY);
        }


Then i see this message:
"ukbd_read_char: UKBD_FLAG_POOLING is set and giant is not owned -
recursing and locking giant"

Full message is (for entering one character is something like that):
ukbd_read_char: UKBD_FLAG_POOLING is set and giant is not owned -
recursing and locking giant
enter ukbd_read_char
a (echo from GELI)
enter ukbd_read_char
ukbd_read_char: UKBD_FLAG_POOLING is set and giant is not owned -
recursing and locking giant
enter ukbd_read_char
enter ukbd_read_char

And supriselingly - no characters were lost, when I was typing my passphareses.

As far as I know (and I may know wrong - please correct me here) -
there is some relation between Giant and printfs (something like -
when you printf on console, you have to have a giant) but this is just
my wild guessing (maybe from java - where System.out.println is
synchronized method). Is it possible, that my printf's affected how
Giant is handled within ukbd and thus - I don't see misbehaviour of
ukbd now?

Or was it just my luck now? (I hardly believe that - I usulally got ~8
characters lost for a boot sequence and now noone).


Any hints for now?


Cheers,

Wiktor Niesiobedzki


More information about the freebsd-usb mailing list