mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 07:31:29 +00:00
78d9161d2b
With deferred IO enabled, a page fault happens when data is written to the
framebuffer device. Then driver determines which page is being updated by
calculating the offset of the written virtual address within the virtual
memory area, and uses this offset to get the updated page within the
internal buffer. This page is later copied to hardware (thus the name
"deferred IO").
This offset calculation is only correct if the virtual memory area is
mapped to the beginning of the internal buffer. Otherwise this is wrong.
For example, if users do:
mmap(ptr, 4096, PROT_WRITE, MAP_FIXED | MAP_SHARED, fd, 0xff000);
Then the virtual memory area will mapped at offset 0xff000 within the
internal buffer. This offset 0xff000 is not accounted for, and wrong page
is updated.
Correct the calculation by using vmf->pgoff instead. With this change, the
variable "offset" will no longer hold the exact offset value, but it is
rounded down to multiples of PAGE_SIZE. But this is still correct, because
this variable is only used to calculate the page offset.
Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Closes: https://lore.kernel.org/linux-fbdev/271372d6-e665-4e7f-b088-dee5f4ab341a@oracle.com
Fixes:
|
||
---|---|---|
.. | ||
bitblit.c | ||
cfbcopyarea.c | ||
cfbfillrect.c | ||
cfbimgblt.c | ||
fb_backlight.c | ||
fb_chrdev.c | ||
fb_cmdline.c | ||
fb_ddc.c | ||
fb_defio.c | ||
fb_draw.h | ||
fb_info.c | ||
fb_internal.h | ||
fb_io_fops.c | ||
fb_logo.c | ||
fb_notify.c | ||
fb_procfs.c | ||
fb_sys_fops.c | ||
fbcmap.c | ||
fbcon_ccw.c | ||
fbcon_cw.c | ||
fbcon_rotate.c | ||
fbcon_rotate.h | ||
fbcon_ud.c | ||
fbcon.c | ||
fbcon.h | ||
fbcvt.c | ||
fbmem.c | ||
fbmon.c | ||
fbsysfs.c | ||
Kconfig | ||
Makefile | ||
modedb.c | ||
softcursor.c | ||
svgalib.c | ||
syscopyarea.c | ||
sysfillrect.c | ||
sysimgblt.c | ||
tileblit.c |