diff options
author | Andrei Vagin <avagin@gmail.com> | 2020-09-25 14:18:19 -0700 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2020-10-02 13:16:58 -0700 |
commit | de85b045d42f503d6463a86145d797b8deb22604 (patch) | |
tree | f93b199c100e63fc8aef44eab0bd07349afee16f /pkg/context | |
parent | 0cea6472188e056673fd0ab8ff06a25dbe44ca52 (diff) |
kvm/x86: handle a case when interrupts are enabled in the kernel space
Before we thought that interrupts are always disabled in the kernel
space, but here is a case when goruntime switches on a goroutine which
has been saved in the host mode. On restore, the popf instruction is
used to restore flags and this means that all flags what the goroutine
has in the host mode will be restored in the kernel mode. And in the
host mode, interrupts are always enabled.
The long story short, we can't use the IF flag for determine whether a
tasks is running in user or kernel mode.
This patch reworks the code so that in userspace, the first bit of the
IOPL flag will be always set. This doesn't give any new privilidges for
a task because CPL in userspace is always 3. But then we can use this
flag to distinguish user and kernel modes. The IOPL flag is never set in
the kernel and host modes.
Reported-by: syzbot+5036b325a8eb15c030cf@syzkaller.appspotmail.com
Reported-by: syzbot+034d580e89ad67b8dc75@syzkaller.appspotmail.com
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Diffstat (limited to 'pkg/context')
0 files changed, 0 insertions, 0 deletions