The patch titled RTCs: handle NVRAM better has been added to the -mm tree. Its filename is rtcs-handle-nvram-better.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: RTCs: handle NVRAM better From: David Brownell <david-b@xxxxxxxxxxx> Several of the RTC drivers are exporting binary "nvram" files in sysfs. Such NVRAM (or on many systems, EEPROM) data is often initialized during system manufacture to hold data about identity (serial numbers, Ethernet addresses, etc), configuration, calibration, and so forth. This patch improves integrity and security of those files: - Correctly initializes the size in one of the two cases where that was not yet being done. - Improves system security/integrity by making this state not be world-writable by default. Letting arbitrary userspace code mangle such state by default is at least Not A Good Thing; and it could sometimes be worse, depending on the particular data that might be corrupted. (I disregard the paranoiac "don't let anyone read it either" approach. Anyone storing passwords in such memory doesn't really care about security.) Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx> Acked-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx> Cc: Torsten Ertbjerg Rasmussen <tr@xxxxxxxxx> Cc: Mark Zhan <rongkai.zhan@xxxxxxxxxxxxx> Cc: Thomas Hommel <thomas.hommel@xxxxxxxxxxx> Acked-by: Alessandro Zummo <a.zummo@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/rtc/rtc-ds1553.c | 2 +- drivers/rtc/rtc-ds1742.c | 5 ++++- drivers/rtc/rtc-m48t59.c | 3 ++- drivers/rtc/rtc-stk17ta8.c | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff -puN drivers/rtc/rtc-ds1553.c~rtcs-handle-nvram-better drivers/rtc/rtc-ds1553.c --- a/drivers/rtc/rtc-ds1553.c~rtcs-handle-nvram-better +++ a/drivers/rtc/rtc-ds1553.c @@ -291,7 +291,7 @@ static ssize_t ds1553_nvram_write(struct static struct bin_attribute ds1553_nvram_attr = { .attr = { .name = "nvram", - .mode = S_IRUGO | S_IWUGO, + .mode = S_IRUGO | S_IWUSR, }, .size = RTC_OFFSET, .read = ds1553_nvram_read, diff -puN drivers/rtc/rtc-ds1742.c~rtcs-handle-nvram-better drivers/rtc/rtc-ds1742.c --- a/drivers/rtc/rtc-ds1742.c~rtcs-handle-nvram-better +++ a/drivers/rtc/rtc-ds1742.c @@ -160,10 +160,13 @@ static ssize_t ds1742_nvram_write(struct static struct bin_attribute ds1742_nvram_attr = { .attr = { .name = "nvram", - .mode = S_IRUGO | S_IWUGO, + .mode = S_IRUGO | S_IWUSR, }, .read = ds1742_nvram_read, .write = ds1742_nvram_write, + /* REVISIT: size in sysfs won't match actual size... if it's + * not a constant, each RTC should have its own attribute. + */ }; static int __devinit ds1742_rtc_probe(struct platform_device *pdev) diff -puN drivers/rtc/rtc-m48t59.c~rtcs-handle-nvram-better drivers/rtc/rtc-m48t59.c --- a/drivers/rtc/rtc-m48t59.c~rtcs-handle-nvram-better +++ a/drivers/rtc/rtc-m48t59.c @@ -353,11 +353,12 @@ static ssize_t m48t59_nvram_write(struct static struct bin_attribute m48t59_nvram_attr = { .attr = { .name = "nvram", - .mode = S_IRUGO | S_IWUGO, + .mode = S_IRUGO | S_IWUSR, .owner = THIS_MODULE, }, .read = m48t59_nvram_read, .write = m48t59_nvram_write, + .size = M48T59_NVRAM_SIZE, }; static int __devinit m48t59_rtc_probe(struct platform_device *pdev) diff -puN drivers/rtc/rtc-stk17ta8.c~rtcs-handle-nvram-better drivers/rtc/rtc-stk17ta8.c --- a/drivers/rtc/rtc-stk17ta8.c~rtcs-handle-nvram-better +++ a/drivers/rtc/rtc-stk17ta8.c @@ -291,7 +291,7 @@ static ssize_t stk17ta8_nvram_write(stru static struct bin_attribute stk17ta8_nvram_attr = { .attr = { .name = "nvram", - .mode = S_IRUGO | S_IWUGO, + .mode = S_IRUGO | S_IWUSR, .owner = THIS_MODULE, }, .size = RTC_OFFSET, _ Patches currently in -mm which might be from david-b@xxxxxxxxxxx are origin.patch rtc-m48t59-fix-section-mismatch-warning.patch rtc_hctosys-expects-rtcs-in-utc-doc.patch rtcs-handle-nvram-better.patch rtc-ds1307-exports-nvram.patch rtc-dont-write-rtc-century-when-setting-a-wake-alarm.patch usb-s3c2410_udc-minor-irq-handler-cleanups.patch pci-add-pci-identifiers-for-the-rdc-devices.patch x86-add-support-for-the-rdc-r-321x-soc.patch add-the-rdc-machine-specific-reboot-fixup.patch rtc-release-correct-region-in-error-path.patch rtc-fallback-to-requesting-only-the-ports-we-actually-use.patch tle62x0-driver-stops-ignoring-read-errors.patch rtc-convert-mutex-to-bitfield.patch drivers-pmc-msp71xx-gpio-char-driver.patch remove-pointless-casts-from-void-pointers.patch spi-at25-driver-is-for-eeprom-not-flash.patch spi-use-mutex-not-semaphore.patch blackfin-spi-driver-use-cpu_relax-to-replace-continue-in-while-busywait.patch blackfin-spi-driver-use-void-__iomem-for-regs_base.patch blackfin-spi-driver-move-hard-coded-pin_req-to-board-file.patch blackfin-spi-driver-reconfigure-speed_hz-and-bits_per_word-in-each-spi-transfer.patch cosmetic-fixes-to-rtc-subsystems-kconfig.patch rtc-pcf8583-dont-abuse-i2c_m_nostart.patch pnp-request-ioport-and-iomem-resources-used-by-active-devices.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html