lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180708210154.10423-8-ebiggers3@gmail.com>
Date:   Sun,  8 Jul 2018 14:01:43 -0700
From:   Eric Biggers <ebiggers3@...il.com>
To:     David Howells <dhowells@...hat.com>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        linux-fsdevel@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, Eric Biggers <ebiggers@...gle.com>
Subject: [PATCH 07/18] fs_context: fix double free of legacy_fs_context data

From: Eric Biggers <ebiggers@...gle.com>

sys_fsmount() calls fc->ops->free() to free the data, zeroes
->fs_private, then proceeds to reuse the context.  But legacy_fs_context
doesn't use ->fs_private, so we need to handle zeroing it too; otherwise
there's a double free of legacy_fs_context::{legacy_data,secdata}.

Fixes: 8a2e54b8af88 ("vfs: Implement a filesystem superblock creation/configuration context")
Signed-off-by: Eric Biggers <ebiggers@...gle.com>
---
 fs/fs_context.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/fs_context.c b/fs/fs_context.c
index 7a8d1ed34ae71..206256be9777e 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -504,6 +504,9 @@ static void legacy_fs_context_free(struct fs_context *fc)
 		kfree(ctx->legacy_data);
 		break;
 	}
+	/* This doesn't use fs_private, so need to manually zero for fsmount */
+	BUILD_BUG_ON(offsetof(struct legacy_fs_context, fc) != 0);
+	memset(fc + 1, 0, sizeof(*ctx) - sizeof(*fc));
 }
 
 /*
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ