lkml.org 
[lkml]   [2017]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 03/11] tty: kbd: reduce stack size with KASAN
    Date
    As reported by kernelci, some functions in the VT code use significant
    amounts of kernel stack when local variables get inlined into the caller
    multiple times:

    drivers/tty/vt/keyboard.c: In function 'kbd_keycode':
    drivers/tty/vt/keyboard.c:1452:1: error: the frame size of 2240 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]

    Annotating those functions as noinline_if_stackbloat prevents the inlining
    and reduces the overall stack usage in this driver.

    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    ---
    drivers/tty/vt/keyboard.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
    index f4166263bb3a..c0d111444a0e 100644
    --- a/drivers/tty/vt/keyboard.c
    +++ b/drivers/tty/vt/keyboard.c
    @@ -301,13 +301,13 @@ int kbd_rate(struct kbd_repeat *rpt)
    /*
    * Helper Functions.
    */
    -static void put_queue(struct vc_data *vc, int ch)
    +static noinline_if_stackbloat void put_queue(struct vc_data *vc, int ch)
    {
    tty_insert_flip_char(&vc->port, ch, 0);
    tty_schedule_flip(&vc->port);
    }

    -static void puts_queue(struct vc_data *vc, char *cp)
    +static noinline_if_stackbloat void puts_queue(struct vc_data *vc, char *cp)
    {
    while (*cp) {
    tty_insert_flip_char(&vc->port, *cp, 0);
    @@ -555,7 +555,7 @@ static void fn_inc_console(struct vc_data *vc)
    set_console(i);
    }

    -static void fn_send_intr(struct vc_data *vc)
    +static noinline_if_stackbloat void fn_send_intr(struct vc_data *vc)
    {
    tty_insert_flip_char(&vc->port, 0, TTY_BREAK);
    tty_schedule_flip(&vc->port);
    --
    2.9.0
    \
     
     \ /
      Last update: 2017-06-14 23:19    [W:2.468 / U:0.232 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site