All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: dev: zero-initialize struct rtc_wkalrm to prevent information leak
@ 2026-08-27  1:54 Liu Dalin
  2026-08-27  2:04 ` sashiko-bot
  2026-09-21 19:14 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Liu Dalin @ 2026-08-27  1:54 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: linux-rtc, linux-kernel, Liu Dalin, Deng Yingchao, Qin Yungao,
	Luo Qiu

The struct rtc_wkalrm has padding holes after the 'pending' member.
When returned to userspace via the RTC_WKALRM_RD ioctl, uninitialized
kernel stack data residing in these holes may be leaked.

Zero-initialize the struct at declaration to eliminate this information
leak risk.

Fixes smatch warnings:
- drivers/rtc/dev.c:392 rtc_dev_ioctl() warn: check that 'alarm' doesn't
  leak information (struct has a hole after 'pending')

Fixes: 36e14f5fdfdf ("rtc: rename core files")
Assisted-by: smatch:2.0 [static analysis]
Signed-off-by: Liu Dalin <liudalin@kylinsec.com.cn>
---
 drivers/rtc/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/dev.c b/drivers/rtc/dev.c
index 8ba7c25d2565..be173c9511fa 100644
--- a/drivers/rtc/dev.c
+++ b/drivers/rtc/dev.c
@@ -216,7 +216,7 @@ static long rtc_dev_ioctl(struct file *file,
 	struct rtc_device *rtc = file->private_data;
 	const struct rtc_class_ops *ops = rtc->ops;
 	struct rtc_time tm;
-	struct rtc_wkalrm alarm;
+	struct rtc_wkalrm alarm = { 0 };
 	struct rtc_param param;
 	void __user *uarg = (void __user *)arg;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: dev: zero-initialize struct rtc_wkalrm to prevent information leak
  2026-08-27  1:54 [PATCH] rtc: dev: zero-initialize struct rtc_wkalrm to prevent information leak Liu Dalin
@ 2026-08-27  2:04 ` sashiko-bot
  2026-09-21 19:14 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-08-27  2:04 UTC (permalink / raw)
  To: Liu Dalin; +Cc: linux-rtc, Alexandre Belloni

> The struct rtc_wkalrm has padding holes after the 'pending' member.
> When returned to userspace via the RTC_WKALRM_RD ioctl, uninitialized
> kernel stack data residing in these holes may be leaked.
> 
> Zero-initialize the struct at declaration to eliminate this information
> leak risk.
> 
> Fixes smatch warnings:
> - drivers/rtc/dev.c:392 rtc_dev_ioctl() warn: check that 'alarm' doesn't
>   leak information (struct has a hole after 'pending')
> 
> Fixes: 36e14f5fdfdf ("rtc: rename core files")
> Assisted-by: smatch:2.0 [static analysis]
> Signed-off-by: Liu Dalin <liudalin@kylinsec.com.cn>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/B28B7DE18F3A9447+20260827015444.3314227-1-liudalin@kylinsec.com.cn?part=1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: dev: zero-initialize struct rtc_wkalrm to prevent information leak
  2026-08-27  1:54 [PATCH] rtc: dev: zero-initialize struct rtc_wkalrm to prevent information leak Liu Dalin
  2026-08-27  2:04 ` sashiko-bot
@ 2026-09-21 19:14 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2026-09-21 19:14 UTC (permalink / raw)
  To: Liu Dalin; +Cc: linux-rtc, linux-kernel, Deng Yingchao, Qin Yungao, Luo Qiu

On Thu, 27 Aug 2026 09:54:44 +0800, Liu Dalin wrote:
> The struct rtc_wkalrm has padding holes after the 'pending' member.
> When returned to userspace via the RTC_WKALRM_RD ioctl, uninitialized
> kernel stack data residing in these holes may be leaked.
> 
> Zero-initialize the struct at declaration to eliminate this information
> leak risk.
> 
> [...]

Applied, thanks!

[1/1] rtc: dev: zero-initialize struct rtc_wkalrm to prevent information leak
      https://git.kernel.org/abelloni/c/0ee5c5d804d5

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-21 19:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27  1:54 [PATCH] rtc: dev: zero-initialize struct rtc_wkalrm to prevent information leak Liu Dalin
2026-08-27  2:04 ` sashiko-bot
2026-09-21 19:14 ` Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.