public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] kernel/utsname_sysctl.c: Add missing enum uts_proc value
@ 2022-10-20 15:06 Petr Vorel
  2022-10-20 15:14 ` Petr Vorel
  2022-10-20 15:55 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Petr Vorel @ 2022-10-20 15:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Petr Vorel, Andrew Morton, Greg Kroah-Hartman, Torsten Hilbrich

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")

Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
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/0c2b92a6-0f25-9538-178f-eee3b06da23f@secunet.com/
[2] https://lore.kernel.org/lkml/ec9e00b9-8b47-7918-c39b-8b0069003169@secunet.com/2-hostname-poll-test.c

 include/linux/utsname.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 2b1737c9b244..bf7613ba412b 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -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.38.0


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

* Re: [PATCH 1/1] kernel/utsname_sysctl.c: Add missing enum uts_proc value
  2022-10-20 15:06 [PATCH 1/1] kernel/utsname_sysctl.c: Add missing enum uts_proc value Petr Vorel
@ 2022-10-20 15:14 ` Petr Vorel
  2022-10-20 15:55 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2022-10-20 15:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Greg Kroah-Hartman, Torsten Hilbrich

Hi all,

[ Cc regressions@lists.linux.dev ]

Kind regards,
Petr

> 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")

> Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> 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/0c2b92a6-0f25-9538-178f-eee3b06da23f@secunet.com/
> [2] https://lore.kernel.org/lkml/ec9e00b9-8b47-7918-c39b-8b0069003169@secunet.com/2-hostname-poll-test.c

>  include/linux/utsname.h | 1 +
>  1 file changed, 1 insertion(+)

> diff --git a/include/linux/utsname.h b/include/linux/utsname.h
> index 2b1737c9b244..bf7613ba412b 100644
> --- a/include/linux/utsname.h
> +++ b/include/linux/utsname.h
> @@ -10,6 +10,7 @@
>  #include <uapi/linux/utsname.h>

>  enum uts_proc {
> +	UTS_PROC_ARCH,
>  	UTS_PROC_OSTYPE,
>  	UTS_PROC_OSRELEASE,
>  	UTS_PROC_VERSION,

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

* Re: [PATCH 1/1] kernel/utsname_sysctl.c: Add missing enum uts_proc value
  2022-10-20 15:06 [PATCH 1/1] kernel/utsname_sysctl.c: Add missing enum uts_proc value Petr Vorel
  2022-10-20 15:14 ` Petr Vorel
@ 2022-10-20 15:55 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-10-20 15:55 UTC (permalink / raw)
  To: Petr Vorel; +Cc: linux-kernel, Andrew Morton, Torsten Hilbrich

On Thu, Oct 20, 2022 at 05:06:45PM +0200, Petr Vorel wrote:
> 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")
> 
> Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> 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.

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

greg k-h

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

end of thread, other threads:[~2022-10-20 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-20 15:06 [PATCH 1/1] kernel/utsname_sysctl.c: Add missing enum uts_proc value Petr Vorel
2022-10-20 15:14 ` Petr Vorel
2022-10-20 15:55 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox