[PATCH] Do not leave random talloc magic in free()'ed memory

Andrew Bartlett abartlet at samba.org
Fri Jan 12 08:25:23 UTC 2018


On Fri, 2018-01-12 at 21:07 +1300, Andrew Bartlett wrote:
> On Fri, 2018-01-12 at 08:21 +0100, Stefan Metzmacher wrote:
> > Hi Andrew,
> > 
> > I saw these patches in your current autobuild.
> > 
> > I tried to pick them for 4.8.0 (including talloc-2.1.11),
> > but it failed locally with:
> > 
> > [2(1)/2 at 0s] samba4.local.talloc
> > talloc: access after free error - first free may be at
> > ../lib/talloc/talloc.c:1978_talloc_realloc
> > Bad talloc magic value - access after free
> > UNEXPECTED(error): samba4.local.talloc.magic_free_protection(none)
> > REASON: Exception: Exception: Test was never started
> > UNEXPECTED(error): samba4.local.talloc.magic_protection(none)
> > (samba.subunit.RemotedTestCase)
> > REASON: was started but never finished!
> > UNEXPECTED(error): samba4.local.talloc.talloc(none)
> > (samba.subunit.RemotedTestCase)
> > REASON: was started but never finished!
> > 
> > I don't think we need this for 4.8.0rc1.
> 
> Drat.  I tested those in the lib/talloc sub-build but not in the
> included master build.  Probably just needs a success line, but I
> agree, it is just a 'nice to have' and I have bugs filed in any case.

For the curious, here is the fixup diff.

I'll do some trial autobuilds with my full set, I'm also doing some on
master.

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba
-------------- next part --------------
diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c
index 92081b5fdd8..f49f4fae008 100644
--- a/lib/talloc/testsuite.c
+++ b/lib/talloc/testsuite.c
@@ -2023,7 +2023,7 @@ static bool test_magic_free_protection(void)
 	pid_t pid;
 	int exit_status;
 
-	printf("test: magic_protection\n");
+	printf("test: magic_free_protection\n");
 	p1 = talloc(pool, int);
 	p2 = talloc(pool, int);
 


More information about the samba-technical mailing list