[SCM] Samba Shared Repository - branch master updated
- release-4-0-0alpha8-172-gacfb01a
Stefan (metze) Metzmacher
metze at samba.org
Thu Jul 2 08:52:30 GMT 2009
Hi Tridge,
> change talloc to 2.0.0
>
> This is needed to prevent samba3 and samba4 from using an ABI
> incompatible system version of talloc
>
> See ongoing discussion on the samba-technical mailing list
I think we should also change TALLOC_MAGIC to make 100% sure we abort,
when libtalloc.so.1 and libtalloc.so.2 are loaded into the same process.
Like this:
http://gitweb.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=c534a8af46e1efbfad8cd953dadb3a68b29b9919
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -57,7 +57,9 @@
#define MAX_TALLOC_SIZE 0x10000000
-#define TALLOC_MAGIC 0xe814ec70
+#define TALLOC_MAGIC_V1 0xe814ec70
+#define TALLOC_MAGIC_V2 0xe814ec80
+#define TALLOC_MAGIC TALLOC_MAGIC_V2
#define TALLOC_FLAG_FREE 0x01
#define TALLOC_FLAG_LOOP 0x02
#define TALLOC_FLAG_POOL 0x04 /* This is a talloc pool */
@@ -154,6 +156,11 @@ static void talloc_abort(const char *reason)
talloc_abort_fn(reason);
}
+static void talloc_abort_magic_v1(void)
+{
+ talloc_abort("Bad talloc magic value - old magic v1 used");
+}
+
static void talloc_abort_double_free(void)
{
talloc_abort("Bad talloc magic value - double free");
@@ -170,6 +177,10 @@ static inline struct talloc_chunk
*talloc_chunk_from_ptr(const void *ptr)
const char *pp = (const char *)ptr;
struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp -
TC_HDR_SIZE);
if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) {
+ if ((tc->flags & (~0xF)) == TALLOC_MAGIC_V1)) {
+ talloc_abort_magic_v1();
+ }
+
if (tc->flags & TALLOC_FLAG_FREE) {
talloc_abort_double_free();
} else {
metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.samba.org/archive/samba-technical/attachments/20090702/868d06aa/signature.bin
More information about the samba-technical
mailing list