Skip to content

Commit

Permalink
kernel/utsname_sysctl.c: Fix hostname polling
Browse files Browse the repository at this point in the history
Commit bfca3dd ("kernel/utsname_sysctl.c: print kernel arch") added
a new entry to the uts_kern_table[] array, but didn't update the
UTS_PROC_xyz enumerators of older entries, breaking anything that used
them.

Which is admittedly not many cases: it's really just the two uses of
uts_proc_notify() in kernel/sys.c.  But apparently journald-systemd
actually uses this to detect hostname changes.

Reported-by: Torsten Hilbrich <[email protected]>
Fixes: bfca3dd ("kernel/utsname_sysctl.c: print kernel arch")
Link: https://lore.kernel.org/lkml/[email protected]/
Link: https://linux-regtracking.leemhuis.info/regzbot/regression/[email protected]/
Cc: Petr Vorel <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Oct 23, 2022
1 parent a703852 commit 52826d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/utsname.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <uapi/linux/utsname.h>

enum uts_proc {
UTS_PROC_ARCH,
UTS_PROC_OSTYPE,
UTS_PROC_OSRELEASE,
UTS_PROC_VERSION,
Expand Down
1 change: 1 addition & 0 deletions kernel/utsname_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static int proc_do_uts_string(struct ctl_table *table, int write,
static DEFINE_CTL_TABLE_POLL(hostname_poll);
static DEFINE_CTL_TABLE_POLL(domainname_poll);

// Note: update 'enum uts_proc' to match any changes to this table
static struct ctl_table uts_kern_table[] = {
{
.procname = "arch",
Expand Down

0 comments on commit 52826d3

Please sign in to comment.