1
0
Fork 0
alistair23-linux/drivers
Daniel Vetter 3c4e0dff20 vt: Disable KD_FONT_OP_COPY
It's buggy:

On Fri, Nov 06, 2020 at 10:30:08PM +0800, Minh Yuan wrote:
> We recently discovered a slab-out-of-bounds read in fbcon in the latest
> kernel ( v5.10-rc2 for now ).  The root cause of this vulnerability is that
> "fbcon_do_set_font" did not handle "vc->vc_font.data" and
> "vc->vc_font.height" correctly, and the patch
> <https://lkml.org/lkml/2020/9/27/223> for VT_RESIZEX can't handle this
> issue.
>
> Specifically, we use KD_FONT_OP_SET to set a small font.data for tty6, and
> use  KD_FONT_OP_SET again to set a large font.height for tty1. After that,
> we use KD_FONT_OP_COPY to assign tty6's vc_font.data to tty1's vc_font.data
> in "fbcon_do_set_font", while tty1 retains the original larger
> height. Obviously, this will cause an out-of-bounds read, because we can
> access a smaller vc_font.data with a larger vc_font.height.

Further there was only one user ever.
- Android's loadfont, busybox and console-tools only ever use OP_GET
  and OP_SET
- fbset documentation only mentions the kernel cmdline font: option,
  not anything else.
- systemd used OP_COPY before release 232 published in Nov 2016

Now unfortunately the crucial report seems to have gone down with
gmane, and the commit message doesn't say much. But the pull request
hints at OP_COPY being broken

https://github.com/systemd/systemd/pull/3651

So in other words, this never worked, and the only project which
foolishly every tried to use it, realized that rather quickly too.

Instead of trying to fix security issues here on dead code by adding
missing checks, fix the entire thing by removing the functionality.

Note that systemd code using the OP_COPY function ignored the return
value, so it doesn't matter what we're doing here really - just in
case a lone server somewhere happens to be extremely unlucky and
running an affected old version of systemd. The relevant code from
font_copy_to_all_vcs() in systemd was:

	/* copy font from active VT, where the font was uploaded to */
	cfo.op = KD_FONT_OP_COPY;
	cfo.height = vcs.v_active-1; /* tty1 == index 0 */
	(void) ioctl(vcfd, KDFONTOP, &cfo);

Note this just disables the ioctl, garbage collecting the now unused
callbacks is left for -next.

v2: Tetsuo found the old mail, which allowed me to find it on another
archive. Add the link too.

Acked-by: Peilin Ye <yepeilin.cs@gmail.com>
Reported-by: Minh Yuan <yuanmingbuaa@gmail.com>
References: https://lists.freedesktop.org/archives/systemd-devel/2016-June/036935.html
References: https://github.com/systemd/systemd/pull/3651
Cc: Greg KH <greg@kroah.com>
Cc: Peilin Ye <yepeilin.cs@gmail.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://lore.kernel.org/r/20201108153806.3140315-1-daniel.vetter@ffwll.ch
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-08 19:35:06 +01:00
..
accessibility
acpi Merge branches 'acpi-button' and 'acpi-dock' 2020-10-30 16:31:20 +01:00
amba
android task_work: cleanup notification modes 2020-10-17 15:05:30 -06:00
ata libata-5.10-2020-10-30 2020-10-30 14:51:01 -07:00
atm
auxdisplay
base device property: Don't clear secondary pointer for shared primary firmware node 2020-10-27 19:20:03 +01:00
bcma
block xsysace: use platform_get_resource() and platform_get_irq_optional() 2020-10-29 08:22:33 -06:00
bluetooth Bluetooth: btintel: Replace zero-length array with flexible-array member 2020-10-30 16:57:41 -05:00
bus ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
cdrom
char random32: make prandom_u32() output unpredictable 2020-10-24 20:21:57 +02:00
clk treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
clocksource treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
connector
counter
cpufreq cpufreq: Introduce cpufreq_driver_test_flags() 2020-10-29 14:07:30 +01:00
cpuidle powerpc updates for 5.10 2020-10-16 12:21:15 -07:00
crypto s390 updates for the 5.10 merge window 2020-10-16 12:36:38 -07:00
dax fuse update for 5.10 2020-10-19 14:28:30 -07:00
dca
devfreq
dio
dma misc: mic: remove the MIC drivers 2020-10-28 19:12:03 +01:00
dma-buf dma-mapping updates for 5.10 2020-10-15 14:43:29 -07:00
edac EFI changes for v5.10: 2020-10-12 13:26:49 -07:00
eisa
extcon
firewire
firmware ARM SCMI fixes for v5.10 2020-10-26 12:40:02 +01:00
fpga
fsi
gnss
gpio - New Drivers 2020-10-14 15:56:58 -07:00
gpu - Fix max memory region size calculation (Matt) 2020-10-30 11:54:11 +10:00
greybus
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2020-10-23 16:16:31 -07:00
hsi
hv Merge branch 'akpm' (patches from Andrew) 2020-10-16 11:31:55 -07:00
hwmon ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
hwspinlock
hwtracing coresight: cti: Initialize dynamic sysfs attributes 2020-10-29 20:10:25 +01:00
i2c i2c: core: Restore acpi_walk_dep_device_list() getting called after registering the ACPI i2c devs 2020-10-25 13:33:54 +01:00
i3c * Fix DAA for the pre-reserved address case 2020-10-17 11:01:01 -07:00
ide block-5.10-2020-10-12 2020-10-13 12:12:44 -07:00
idle intel_idle: Fix max_cstate for processor models without C-state tables 2020-10-27 19:03:53 +01:00
iio chrome platform changes for 5.10 2020-10-23 10:54:13 -07:00
infiniband RDMA/qedr: Fix memory leak in iWARP CM 2020-10-28 09:45:25 -03:00
input Merge branch 'parisc-5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2020-10-25 10:59:34 -07:00
interconnect interconnect: qcom: use icc_sync state for sm8[12]50 2020-10-27 16:01:22 +02:00
iommu IOMMU Fix for Linux v5.10: 2020-10-20 09:35:06 -07:00
ipack
irqchip treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
isdn
leds leds: pwm: Remove platform_data support 2020-10-07 12:02:58 +02:00
lightnvm lightnvm: fix out-of-bounds write to array devices->info[] 2020-10-16 09:28:45 -06:00
macintosh powerpc updates for 5.10 2020-10-16 12:21:15 -07:00
mailbox ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
mcb
md - Improve DM core's bio splitting to use blk_max_size_offset(). Also 2020-10-14 15:05:38 -07:00
media dma-mapping updates for 5.10 2020-10-15 14:43:29 -07:00
memory ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
memstick
message scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove() 2020-10-26 16:57:18 -04:00
mfd - New Drivers 2020-10-14 15:56:58 -07:00
misc Char/Misc fixes/removals for 5.10-rc2 2020-11-01 10:05:16 -08:00
mmc MMC host: 2020-10-30 11:04:11 -07:00
most
mtd This pull request contains fixes for UBI and UBIFS 2020-10-18 09:56:50 -07:00
mux
net flexible-array member conversion patches for 5.10-rc2 2020-10-31 14:31:28 -07:00
nfc nfc: remove unneeded break 2020-10-20 10:36:41 -07:00
ntb Bug fixes for v5.10 2020-10-25 11:12:31 -07:00
nubus
nvdimm mm/memremap_pages: support multiple ranges per invocation 2020-10-13 18:38:28 -07:00
nvme block-5.10-2020-10-30 2020-10-30 15:02:49 -07:00
nvmem
of dma-mapping: fix 32-bit overflow with CONFIG_ARM_LPAE=n 2020-10-29 16:59:34 +01:00
opp Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm 2020-10-06 12:26:45 +02:00
oprofile
parisc dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
parport
pci VFIO updates for v5.10-rc1 2020-10-22 13:00:44 -07:00
pcmcia
perf
phy pci-v5.10-changes 2020-10-22 12:41:00 -07:00
pinctrl Pin control bulk changes for the v5.10 kernel cycle 2020-10-14 15:25:04 -07:00
platform Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2020-10-23 16:16:31 -07:00
pnp PNP: fix kernel-doc markups 2020-10-27 19:23:04 +01:00
power ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
powercap powercap: Fix typo in Kconfig "Plance" -> "Plane" 2020-10-19 17:40:53 +02:00
pps
ps3
ptp
pwm ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
rapidio rapidio: fix the missed put_device() for rio_mport_add_riodev 2020-10-16 11:11:22 -07:00
ras
regulator Merge remote-tracking branch 'regulator/for-5.10' into regulator-next 2020-10-05 16:54:56 +01:00
remoteproc remoteproc updates for v5.10 2020-10-22 12:56:33 -07:00
reset ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
rpmsg rpmsg updates for 5.10 2020-10-22 12:58:21 -07:00
rtc RTC for 5.10 2020-10-21 11:22:08 -07:00
s390 s390/ism: fix incorrect system EID 2020-10-26 16:29:14 -07:00
sbus
scsi SCSI fixes on 20201030 2020-10-31 12:21:04 -07:00
sfi
sh
siox
slimbus
soc soc: ti: ti_sci_pm_domains: check for proper args count in xlate 2020-10-29 22:13:38 +01:00
soundwire
spi ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
spmi
ssb
staging staging: fieldbus: anybuss: jump to correct label in an error path 2020-10-27 13:24:51 +01:00
target scsi: target: tcmu: Replace zero-length array with flexible-array member 2020-10-29 17:22:59 -05:00
tc
tee Reenable kernel login method for kernel TEE client API 2020-10-26 10:55:56 +01:00
thermal treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
thunderbolt
tty vt: Disable KD_FONT_OP_COPY 2020-11-08 19:35:06 +01:00
uio
usb 4 bug fixes for Cadence 3 driver. 2020-10-30 11:46:49 +01:00
vdpa vhost,vdpa: fixes 2020-10-31 14:41:48 -07:00
vfio VFIO updates for v5.10-rc1 2020-10-22 13:00:44 -07:00
vhost vdpa: handle irq bypass register failure case 2020-10-30 04:02:53 -04:00
video A couple of x86 fixes which missed rc1 due to my stupidity: 2020-10-27 14:39:29 -07:00
virt virt: vbox: simplify the return expression of vbg_input_open() 2020-10-02 11:36:13 +02:00
virtio vhost,vdpa,virtio: cleanups, fixes 2020-10-23 11:00:57 -07:00
visorbus
vlynq
vme
w1 w1: w1_therm: make w1_poll_completion static 2020-10-05 14:49:24 +02:00
watchdog ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
xen xen: branch for v5.10-rc1c 2020-10-25 10:55:35 -07:00
zorro
Kconfig
Makefile