Skip to contentSkip to conversation

kernel/utsname_sysctl.c: Add missing enum uts_proc value

PATCH In review Petr Vorel 2 participants 3 messages Oct 20, 2022

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 kernel/utsname_sysctl.c: Add missing enum uts_proc value

bfca3dd3d068 added new struct ctl_table uts_kern_table[], but not new enum uts_proc value. It broke the notification mechanism between the sethostname syscall and the pollers of /proc/sys/kernel/hostname.

The table uts_kern_table is addressed within uts_proc_notify by the enum value, that's why new enum value is needed.

Fixes bfca3dd3d068 ("kernel/utsname_sysctl.c: print kernel arch")

---
Hi all,

I'm sorry to introduce a regression.

Torsten Hilbrich reported [1] that hostnamectl set-hostname foo which does poll() got affected by bfca3dd3d068. He also wrote a reproducer [2] which does not require systemd, I tested the patch on dracut initramfs.

Kind regards,
Petr

[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/2-hostname-poll-test.c

 include/linux/utsname.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/utsname.h +1 -0
index 2b1737c9b244..bf7613ba412b 100644
@@ -10,6 +10,7 @@
 #include <uapi/linux/utsname.h>
 
 enum uts_proc {
+	UTS_PROC_ARCH,
 	UTS_PROC_OSTYPE,
 	UTS_PROC_OSRELEASE,
 	UTS_PROC_VERSION,
Signature · 1 line
2.38.0
author
#1 lore raw

Hi all,

[ Cc [email protected] ]

Kind regards,
Petr

Quoted 42 lines

bfca3dd3d068 added new struct ctl_table uts_kern_table[], but not new enum uts_proc value. It broke the notification mechanism between the sethostname syscall and the pollers of /proc/sys/kernel/hostname.

The table uts_kern_table is addressed within uts_proc_notify by the enum value, that's why new enum value is needed.

Fixes bfca3dd3d068 ("kernel/utsname_sysctl.c: print kernel arch")

---
Hi all,

I'm sorry to introduce a regression.

Torsten Hilbrich reported [1] that hostnamectl set-hostname foo which does poll() got affected by bfca3dd3d068. He also wrote a reproducer [2] which does not require systemd, I tested the patch on dracut initramfs.

Kind regards,
Petr

[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/2-hostname-poll-test.c

 include/linux/utsname.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/utsname.h +1 -0
index 2b1737c9b244..bf7613ba412b 100644
@@ -10,6 +10,7 @@
 #include <uapi/linux/utsname.h>
 
 enum uts_proc {
+	UTS_PROC_ARCH,
 	UTS_PROC_OSTYPE,
 	UTS_PROC_OSRELEASE,
 	UTS_PROC_VERSION,
#2 lore raw
In reply to Petr Vorel
Quoted 14 lines · Petr Vorel

bfca3dd3d068 added new struct ctl_table uts_kern_table[], but not new enum uts_proc value. It broke the notification mechanism between the sethostname syscall and the pollers of /proc/sys/kernel/hostname.

The table uts_kern_table is addressed within uts_proc_notify by the enum value, that's why new enum value is needed.

Fixes bfca3dd3d068 ("kernel/utsname_sysctl.c: print kernel arch")

---
Hi all,

Quoted 6 lines

I'm sorry to introduce a regression.

Torsten Hilbrich reported [1] that hostnamectl set-hostname foo which does poll() got affected by bfca3dd3d068. He also wrote a reproducer [2] which does not require systemd, I tested the patch on dracut initramfs.

Thanks for the quick response, I'll queue this up in my tree now.

greg k-h