Aliasing issue with TAILQ on ppc64 ?

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Sep 18 15:53:18 UTC 2012


In message <CAJ-FndCsf2Xsn=1ioHyr_tn3-yAFOE7E9-wrjp4rcQJajhZvpg at mail.gmail.com>
, Attilio Rao writes:

>The only way I can see this
>code is safe is, infact, to lock it with proper locks around the
>operations.

This is not about locking: at the time where this croaks there is
only one thread.

The problem is that:

	// Empty, freshly initialized ban_head

	b = valid_ban_object();
	TAILQ_INSERT_HEAD(&ban_head, b, list);

	be = TAILQ_LAST(&ban_head, banhead_s);

Causes a sig#11 in TAILQ_LAST().

I belive it is a NULL dereference, and I belive it happens
because the compiler overoptimizes TAILQ_{LAST|PREV}()

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list