libpayload: find source of input characters
This change makes it possible for vboot to avoid an exploit that could cause involuntary switch to dev mode. It gives depthcharge/vboot some information on the type of input device that generated a key. BUG=chrome-os-partner:21729 TEST=manually tested for panther BRANCH=none CQ-DEPEND=CL:182420,CL:182241,CL:182946 Change-Id: I87bdac34bfc50f3adb0b35a2c57a8f95f4fbc35b Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-on: https://chromium-review.googlesource.com/182357 Reviewed-by: Luigi Semenzato <semenzato@chromium.org> Tested-by: Luigi Semenzato <semenzato@chromium.org> Commit-Queue: Luigi Semenzato <semenzato@chromium.org> Reviewed-on: http://review.coreboot.org/6003 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
parent
f4d1f3a4d9
commit
562db3bb3f
|
@ -391,7 +391,8 @@ usb_hid_set_protocol (usbdev_t *dev, interface_descriptor_t *interface, hid_prot
|
||||||
|
|
||||||
static struct console_input_driver cons = {
|
static struct console_input_driver cons = {
|
||||||
.havekey = usbhid_havechar,
|
.havekey = usbhid_havechar,
|
||||||
.getchar = usbhid_getchar
|
.getchar = usbhid_getchar,
|
||||||
|
.input_type = CONSOLE_INPUT_TYPE_USB,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -247,12 +247,18 @@ int set_option_from_string(const struct nvram_accessor *nvram, struct cb_cmos_op
|
||||||
* @defgroup console Console functions
|
* @defgroup console Console functions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
typedef enum {
|
||||||
|
CONSOLE_INPUT_TYPE_UNKNOWN = 0,
|
||||||
|
CONSOLE_INPUT_TYPE_USB,
|
||||||
|
} console_input_type;
|
||||||
|
|
||||||
void console_init(void);
|
void console_init(void);
|
||||||
int putchar(unsigned int c);
|
int putchar(unsigned int c);
|
||||||
int puts(const char *s);
|
int puts(const char *s);
|
||||||
int havekey(void);
|
int havekey(void);
|
||||||
int getchar(void);
|
int getchar(void);
|
||||||
int getchar_timeout(int *ms);
|
int getchar_timeout(int *ms);
|
||||||
|
console_input_type last_key_input_type(void);
|
||||||
|
|
||||||
extern int last_putchar;
|
extern int last_putchar;
|
||||||
|
|
||||||
|
@ -261,6 +267,7 @@ struct console_input_driver {
|
||||||
struct console_input_driver *next;
|
struct console_input_driver *next;
|
||||||
int (*havekey) (void);
|
int (*havekey) (void);
|
||||||
int (*getchar) (void);
|
int (*getchar) (void);
|
||||||
|
console_input_type input_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct console_output_driver;
|
struct console_output_driver;
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
struct console_output_driver *console_out;
|
struct console_output_driver *console_out;
|
||||||
struct console_input_driver *console_in;
|
struct console_input_driver *console_in;
|
||||||
|
static console_input_type last_getchar_input_type;
|
||||||
|
|
||||||
void console_add_output_driver(struct console_output_driver *out)
|
void console_add_output_driver(struct console_output_driver *out)
|
||||||
{
|
{
|
||||||
|
@ -115,8 +116,10 @@ int getchar(void)
|
||||||
#endif
|
#endif
|
||||||
struct console_input_driver *in;
|
struct console_input_driver *in;
|
||||||
for (in = console_in; in != 0; in = in->next)
|
for (in = console_in; in != 0; in = in->next)
|
||||||
if (in->havechar())
|
if (in->havechar()) {
|
||||||
|
last_getchar_input_type = in->input_type;
|
||||||
return in->getchar();
|
return in->getchar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,3 +138,8 @@ int getchar_timeout(int *ms)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console_input_type last_key_input_type(void)
|
||||||
|
{
|
||||||
|
return last_getchar_input_type;
|
||||||
|
}
|
||||||
|
|
|
@ -115,7 +115,8 @@ chip northbridge/intel/haswell
|
||||||
io 0x60 = 0x700
|
io 0x60 = 0x700
|
||||||
io 0x62 = 0x710
|
io 0x62 = 0x710
|
||||||
irq 0x70 = 0x09
|
irq 0x70 = 0x09
|
||||||
irq 0xf4 = 0x20
|
irq 0xf2 = 0x20
|
||||||
|
irq 0xf4 = 0x0
|
||||||
irq 0xfa = 0x12
|
irq 0xfa = 0x12
|
||||||
end
|
end
|
||||||
device pnp 2e.7 on # GPIO
|
device pnp 2e.7 on # GPIO
|
||||||
|
|
|
@ -195,6 +195,7 @@ static void pch_power_options(device_t dev)
|
||||||
* If the option is not existent (Laptops), use Kconfig setting.
|
* If the option is not existent (Laptops), use Kconfig setting.
|
||||||
*/
|
*/
|
||||||
get_option(&pwr_on, "power_on_after_fail");
|
get_option(&pwr_on, "power_on_after_fail");
|
||||||
|
pwr_on = MAINBOARD_POWER_KEEP;
|
||||||
|
|
||||||
reg16 = pci_read_config16(dev, GEN_PMCON_3);
|
reg16 = pci_read_config16(dev, GEN_PMCON_3);
|
||||||
reg16 &= 0xfffe;
|
reg16 &= 0xfffe;
|
||||||
|
|
Loading…
Reference in New Issue