All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] uts: Don't randomize "struct uts_namespace".
@ 2018-07-06 10:07 Tetsuo Handa
  2018-07-06 16:11 ` Linus Torvalds
  0 siblings, 1 reply; 10+ messages in thread
From: Tetsuo Handa @ 2018-07-06 10:07 UTC (permalink / raw)
  To: keescook; +Cc: linux-kernel, torvalds, Tetsuo Handa

I noticed that makedumpfile utility is failing to check kernel version, for
it depends on offset of "struct uts_namespace"->name being sizeof(int).

----------
int
check_release(void)
{
	unsigned long utsname;

	/*
	 * Get the kernel version.
	 */
	if (SYMBOL(system_utsname) != NOT_FOUND_SYMBOL) {
		utsname = SYMBOL(system_utsname);
	} else if (SYMBOL(init_uts_ns) != NOT_FOUND_SYMBOL) {
		utsname = SYMBOL(init_uts_ns) + sizeof(int);
	} else {
		ERRMSG("Can't get the symbol of system_utsname.\n");
		return FALSE;
	}
	if (!readmem(VADDR, utsname, &info->system_utsname,
					sizeof(struct utsname))) {
		ERRMSG("Can't get the address of system_utsname.\n");
		return FALSE;
	}
----------

Since there is no way to tell the offset to userspace, let's not randomize
"struct uts_namespace".

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: 3859a271a003aba0 ("randstruct: Mark various structs for randomization")
Cc: stable <stable@vger.kernel.org> # v4.13+
---
 include/linux/utsname.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 44429d9..85c206f 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -27,7 +27,7 @@ struct uts_namespace {
 	struct user_namespace *user_ns;
 	struct ucounts *ucounts;
 	struct ns_common ns;
-} __randomize_layout;
+};
 extern struct uts_namespace init_uts_ns;
 
 #ifdef CONFIG_UTS_NS
-- 
1.8.3.1


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

end of thread, other threads:[~2018-07-11 16:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-06 10:07 [PATCH] uts: Don't randomize "struct uts_namespace" Tetsuo Handa
2018-07-06 16:11 ` Linus Torvalds
2018-07-06 23:10   ` Tetsuo Handa
2018-07-11 14:07     ` Fwd: " Tetsuo Handa
2018-07-11 16:31     ` Kazuhito Hagio
2018-07-11 16:31       ` Kazuhito Hagio
2018-07-06 23:19   ` Kees Cook
2018-07-06 23:35     ` Tetsuo Handa
2018-07-07  0:55       ` Eric W. Biederman
2018-07-07  0:55         ` Eric W. Biederman

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.