mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 01:49:36 +00:00
![David Hildenbrand](/assets/img/avatar_default.png)
Patch series "drivers/char: remove /dev/kmem for good". Exploring /dev/kmem and /dev/mem in the context of memory hot(un)plug and memory ballooning, I started questioning the existence of /dev/kmem. Comparing it with the /proc/kcore implementation, it does not seem to be able to deal with things like a) Pages unmapped from the direct mapping (e.g., to be used by secretmem) -> kern_addr_valid(). virt_addr_valid() is not sufficient. b) Special cases like gart aperture memory that is not to be touched -> mem_pfn_is_ram() Unless I am missing something, it's at least broken in some cases and might fault/crash the machine. Looks like its existence has been questioned before in 2005 and 2010 [1], after ~11 additional years, it might make sense to revive the discussion. CONFIG_DEVKMEM is only enabled in a single defconfig (on purpose or by mistake?). All distributions disable it: in Ubuntu it has been disabled for more than 10 years, in Debian since 2.6.31, in Fedora at least starting with FC3, in RHEL starting with RHEL4, in SUSE starting from 15sp2, and OpenSUSE has it disabled as well. 1) /dev/kmem was popular for rootkits [2] before it got disabled basically everywhere. Ubuntu documents [3] "There is no modern user of /dev/kmem any more beyond attackers using it to load kernel rootkits.". RHEL documents in a BZ [5] "it served no practical purpose other than to serve as a potential security problem or to enable binary module drivers to access structures/functions they shouldn't be touching" 2) /proc/kcore is a decent interface to have a controlled way to read kernel memory for debugging puposes. (will need some extensions to deal with memory offlining/unplug, memory ballooning, and poisoned pages, though) 3) It might be useful for corner case debugging [1]. KDB/KGDB might be a better fit, especially, to write random memory; harder to shoot yourself into the foot. 4) "Kernel Memory Editor" [4] hasn't seen any updates since 2000 and seems to be incompatible with 64bit [1]. For educational purposes, /proc/kcore might be used to monitor value updates -- or older kernels can be used. 5) It's broken on arm64, and therefore, completely disabled there. Looks like it's essentially unused and has been replaced by better suited interfaces for individual tasks (/proc/kcore, KDB/KGDB). Let's just remove it. [1] https://lwn.net/Articles/147901/ [2] https://www.linuxjournal.com/article/10505 [3] https://wiki.ubuntu.com/Security/Features#A.2Fdev.2Fkmem_disabled [4] https://sourceforge.net/projects/kme/ [5] https://bugzilla.redhat.com/show_bug.cgi?id=154796 Link: https://lkml.kernel.org/r/20210324102351.6932-1-david@redhat.com Link: https://lkml.kernel.org/r/20210324102351.6932-2-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Alexander A. Klimov" <grandmaster@al2klimov.de> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Brian Cain <bcain@codeaurora.org> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Chris Zankel <chris@zankel.net> Cc: Corentin Labbe <clabbe@baylibre.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Cc: Greentime Hu <green.hu@gmail.com> Cc: Gregory Clement <gregory.clement@bootlin.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Helge Deller <deller@gmx.de> Cc: Hillf Danton <hdanton@sina.com> Cc: huang ying <huang.ying.caritas@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: James Troup <james.troup@canonical.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Jonas Bonn <jonas@southpole.se> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Kairui Song <kasong@redhat.com> Cc: Krzysztof Kozlowski <krzk@kernel.org> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: Matthew Wilcox <willy@infradead.org> Cc: Matt Turner <mattst88@gmail.com> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Mike Rapoport <rppt@kernel.org> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Niklas Schnelle <schnelle@linux.ibm.com> Cc: Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com> Cc: openrisc@lists.librecores.org Cc: Palmer Dabbelt <palmerdabbelt@google.com> Cc: Paul Mackerras <paulus@samba.org> Cc: "Pavel Machek (CIP)" <pavel@denx.de> Cc: Pavel Machek <pavel@ucw.cz> Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org> Cc: Pierre Morel <pmorel@linux.ibm.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Richard Henderson <rth@twiddle.net> Cc: Rich Felker <dalias@libc.org> Cc: Robert Richter <rric@kernel.org> Cc: Rob Herring <robh@kernel.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Cc: sparclinux@vger.kernel.org Cc: Stafford Horne <shorne@gmail.com> Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Theodore Dubois <tblodt@icloud.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Viresh Kumar <viresh.kumar@linaro.org> Cc: William Cohen <wcohen@redhat.com> Cc: Xiaoming Ni <nixiaoming@huawei.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
160 lines
3.4 KiB
Text
160 lines
3.4 KiB
Text
CONFIG_SYSVIPC=y
|
|
CONFIG_IKCONFIG=y
|
|
CONFIG_IKCONFIG_PROC=y
|
|
CONFIG_LOG_BUF_SHIFT=16
|
|
CONFIG_BLK_DEV_INITRD=y
|
|
CONFIG_EXPERT=y
|
|
# CONFIG_UID16 is not set
|
|
CONFIG_SLAB=y
|
|
CONFIG_MODULES=y
|
|
CONFIG_MODULE_UNLOAD=y
|
|
# CONFIG_BLK_DEV_BSG is not set
|
|
CONFIG_ARCH_PXA=y
|
|
CONFIG_MACH_H4700=y
|
|
CONFIG_MACH_MAGICIAN=y
|
|
CONFIG_NO_HZ=y
|
|
CONFIG_PREEMPT=y
|
|
CONFIG_AEABI=y
|
|
CONFIG_ZBOOT_ROM_TEXT=0x0
|
|
CONFIG_ZBOOT_ROM_BSS=0x0
|
|
CONFIG_CMDLINE="keepinitrd"
|
|
CONFIG_KEXEC=y
|
|
CONFIG_CPU_FREQ=y
|
|
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
|
|
CONFIG_FPE_NWFPE=y
|
|
CONFIG_PM=y
|
|
CONFIG_NET=y
|
|
CONFIG_PACKET=y
|
|
CONFIG_UNIX=y
|
|
CONFIG_INET=y
|
|
CONFIG_IP_MULTICAST=y
|
|
CONFIG_IP_PNP=y
|
|
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
|
|
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
|
|
# CONFIG_INET_XFRM_MODE_BEET is not set
|
|
# CONFIG_INET_DIAG is not set
|
|
# CONFIG_IPV6 is not set
|
|
CONFIG_IRDA=m
|
|
CONFIG_IRLAN=m
|
|
CONFIG_IRCOMM=m
|
|
CONFIG_IRDA_ULTRA=y
|
|
CONFIG_IRDA_CACHE_LAST_LSAP=y
|
|
CONFIG_IRDA_FAST_RR=y
|
|
CONFIG_IRDA_DEBUG=y
|
|
CONFIG_IRTTY_SIR=m
|
|
CONFIG_PXA_FICP=m
|
|
CONFIG_BT=m
|
|
CONFIG_BT_RFCOMM=m
|
|
CONFIG_BT_RFCOMM_TTY=y
|
|
CONFIG_BT_BNEP=m
|
|
CONFIG_BT_BNEP_MC_FILTER=y
|
|
CONFIG_BT_BNEP_PROTO_FILTER=y
|
|
CONFIG_BT_HIDP=m
|
|
CONFIG_BT_HCIBTUSB=m
|
|
CONFIG_MTD=y
|
|
CONFIG_MTD_CMDLINE_PARTS=y
|
|
CONFIG_MTD_BLOCK=y
|
|
CONFIG_MTD_CFI=y
|
|
CONFIG_MTD_CFI_INTELEXT=y
|
|
CONFIG_MTD_PHYSMAP=y
|
|
CONFIG_NETDEVICES=y
|
|
CONFIG_PPP=m
|
|
CONFIG_PPP_ASYNC=m
|
|
CONFIG_PPP_DEFLATE=m
|
|
CONFIG_PPP_BSDCOMP=m
|
|
CONFIG_PPP_MPPE=m
|
|
# CONFIG_INPUT_MOUSEDEV is not set
|
|
CONFIG_INPUT_EVDEV=y
|
|
# CONFIG_KEYBOARD_ATKBD is not set
|
|
CONFIG_KEYBOARD_GPIO=y
|
|
# CONFIG_INPUT_MOUSE is not set
|
|
CONFIG_INPUT_TOUCHSCREEN=y
|
|
CONFIG_INPUT_MISC=y
|
|
CONFIG_INPUT_UINPUT=m
|
|
# CONFIG_SERIO is not set
|
|
CONFIG_SERIAL_PXA=y
|
|
# CONFIG_LEGACY_PTYS is not set
|
|
# CONFIG_HW_RANDOM is not set
|
|
CONFIG_I2C=y
|
|
CONFIG_I2C_CHARDEV=m
|
|
CONFIG_I2C_PXA=y
|
|
CONFIG_W1_MASTER_DS1WM=y
|
|
CONFIG_POWER_SUPPLY=y
|
|
CONFIG_PDA_POWER=y
|
|
CONFIG_BATTERY_DS2760=y
|
|
# CONFIG_HWMON is not set
|
|
CONFIG_MFD_ASIC3=y
|
|
CONFIG_HTC_EGPIO=y
|
|
CONFIG_HTC_PASIC3=y
|
|
CONFIG_REGULATOR=y
|
|
CONFIG_REGULATOR_GPIO=y
|
|
CONFIG_FB=y
|
|
CONFIG_FB_PXA=y
|
|
CONFIG_FB_PXA_OVERLAY=y
|
|
CONFIG_FB_W100=y
|
|
CONFIG_LCD_CLASS_DEVICE=y
|
|
CONFIG_BACKLIGHT_CLASS_DEVICE=y
|
|
CONFIG_BACKLIGHT_PWM=y
|
|
# CONFIG_VGA_CONSOLE is not set
|
|
CONFIG_FRAMEBUFFER_CONSOLE=y
|
|
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
|
|
CONFIG_FONTS=y
|
|
CONFIG_FONT_MINI_4x6=y
|
|
CONFIG_SOUND=y
|
|
CONFIG_SND=m
|
|
CONFIG_SND_MIXER_OSS=m
|
|
CONFIG_SND_PCM_OSS=m
|
|
# CONFIG_SND_ARM is not set
|
|
# CONFIG_SND_USB is not set
|
|
CONFIG_SND_SOC=m
|
|
CONFIG_SND_PXA2XX_SOC=m
|
|
CONFIG_USB=y
|
|
CONFIG_USB_MON=m
|
|
CONFIG_USB_OHCI_HCD=y
|
|
CONFIG_USB_GADGET=y
|
|
CONFIG_USB_GADGET_VBUS_DRAW=500
|
|
CONFIG_USB_PXA27X=y
|
|
CONFIG_USB_ETH=m
|
|
# CONFIG_USB_ETH_RNDIS is not set
|
|
CONFIG_USB_GADGETFS=m
|
|
CONFIG_USB_MASS_STORAGE=m
|
|
CONFIG_USB_G_SERIAL=m
|
|
CONFIG_USB_CDC_COMPOSITE=m
|
|
CONFIG_USB_GPIO_VBUS=y
|
|
CONFIG_MMC=y
|
|
CONFIG_SDIO_UART=m
|
|
CONFIG_MMC_PXA=y
|
|
CONFIG_NEW_LEDS=y
|
|
CONFIG_LEDS_CLASS=y
|
|
CONFIG_LEDS_GPIO=y
|
|
CONFIG_LEDS_TRIGGERS=y
|
|
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
|
|
CONFIG_RTC_CLASS=y
|
|
CONFIG_RTC_DEBUG=y
|
|
CONFIG_RTC_DRV_PXA=y
|
|
CONFIG_EXT2_FS=y
|
|
CONFIG_MSDOS_FS=m
|
|
CONFIG_VFAT_FS=m
|
|
CONFIG_TMPFS=y
|
|
CONFIG_JFFS2_FS=y
|
|
CONFIG_JFFS2_COMPRESSION_OPTIONS=y
|
|
CONFIG_JFFS2_LZO=y
|
|
CONFIG_NFS_FS=y
|
|
CONFIG_NFS_V3=y
|
|
CONFIG_ROOT_NFS=y
|
|
CONFIG_NLS_DEFAULT="utf8"
|
|
CONFIG_NLS_CODEPAGE_437=y
|
|
CONFIG_NLS_CODEPAGE_1251=m
|
|
CONFIG_NLS_ISO8859_1=y
|
|
CONFIG_NLS_UTF8=y
|
|
CONFIG_PRINTK_TIME=y
|
|
CONFIG_DEBUG_KERNEL=y
|
|
# CONFIG_SCHED_DEBUG is not set
|
|
CONFIG_TIMER_STATS=y
|
|
# CONFIG_DEBUG_PREEMPT is not set
|
|
CONFIG_DEBUG_USER=y
|
|
CONFIG_DEBUG_LL=y
|
|
CONFIG_CRYPTO=y
|
|
# CONFIG_CRYPTO_ANSI_CPRNG is not set
|
|
# CONFIG_CRYPTO_HW is not set
|
|
CONFIG_CRC_CCITT=y
|