diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2019-11-11 23:03:15 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-11-16 11:23:59 +0100 |
commit | 8c40397f22a4ff7996d3abdc2d9d1d90f9fc8054 (patch) | |
tree | fe1c769e70c4cd50c7a1da6589c3625d030a3ce6 | |
parent | Linux 5.4-rc7 (diff) | |
download | linux-8c40397f22a4ff7996d3abdc2d9d1d90f9fc8054.tar.xz linux-8c40397f22a4ff7996d3abdc2d9d1d90f9fc8054.zip |
x86/ptrace: Prevent truncation of bitmap size
The active() callback of the IO bitmap regset divides the IO bitmap size by
the word size (32/64 bit). As the I/O bitmap size is in bytes the active
check fails for bitmap sizes of 1-3 bytes on 32bit and 1-7 bytes on 64bit.
Use DIV_ROUND_UP() instead.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Andy Lutomirski <luto@kernel.org>
-rw-r--r-- | arch/x86/kernel/ptrace.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 3c5bbe8e4120..7c526741215b 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -697,7 +697,7 @@ static int ptrace_set_debugreg(struct task_struct *tsk, int n, static int ioperm_active(struct task_struct *target, const struct user_regset *regset) { - return target->thread.io_bitmap_max / regset->size; + return DIV_ROUND_UP(target->thread.io_bitmap_max, regset->size); } static int ioperm_get(struct task_struct *target, |