• Juergen Gross's avatar
    xen/events: block rogue events for some time · 5f7f7740
    Juergen Gross authored
    In order to avoid high dom0 load due to rogue guests sending events at
    high frequency, block those events in case there was no action needed
    in dom0 to handle the events.
    
    This is done by adding a per-event counter, which set to zero in case
    an EOI without the XEN_EOI_FLAG_SPURIOUS is received from a backend
    driver, and incremented when this flag has been set. In case the
    counter is 2 or higher delay the EOI by 1 << (cnt - 2) jiffies, but
    not more than 1 second.
    
    In order not to waste memory shorten the per-event refcnt to two bytes
    (it should normally never exceed a value of 2). Add an overflow check
    to evtchn_get() to make sure the 2 bytes really won't overflow.
    
    This is part of XSA-332.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
    Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
    Reviewed-by: default avatarStefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: default avatarWei Liu <wl@xen.org>
    5f7f7740
events_base.c 47.4 KB