From fe4c2d55634c700ba527ac4183e05c66e9f93c62 Mon Sep 17 00:00:00 2001
From: Nick Alcock <nick.alcock@oracle.com>
Date: Mon, 21 Oct 2019 11:27:43 +0100
Subject: libctf: create: non-root-visible types should not appear in name
 tables

We were accidentally interning newly-added and newly-opened
non-root-visible types into name tables, and removing names from name
tables when such types were removed.  This is very wrong: the whole
point of non-root-visible types is they do not go in name tables and
cannot be looked up by name.  This bug made non-root-visible types
basically identical to root-visible types, right back to the earliest
days of libctf in the Solaris era.

libctf/
	* ctf-open.c (init_types): Only intern root-visible types.
	* ctf-create.c (ctf_dtd_insert): Likewise.
	(ctf_dtd_delete): Only remove root-visible types.
	(ctf_rollback): Likewise.
	(ctf_add_generic): Adjust.
	(ctf_add_struct_sized): Adjust comment.
	(ctf_add_union_sized): Likewise.
	(ctf_add_enum): Likewise.
	* ctf-impl.h (ctf_dtd_insert): Adjust prototype.
---
 libctf/ctf-impl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'libctf/ctf-impl.h')

diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h
index 267801d..56ef9a3 100644
--- a/libctf/ctf-impl.h
+++ b/libctf/ctf-impl.h
@@ -399,7 +399,7 @@ extern void ctf_list_prepend (ctf_list_t *, void *);
 extern void ctf_list_delete (ctf_list_t *, void *);
 extern int ctf_list_empty_p (ctf_list_t *lp);
 
-extern int ctf_dtd_insert (ctf_file_t *, ctf_dtdef_t *, int);
+extern int ctf_dtd_insert (ctf_file_t *, ctf_dtdef_t *, int flag, int kind);
 extern void ctf_dtd_delete (ctf_file_t *, ctf_dtdef_t *);
 extern ctf_dtdef_t *ctf_dtd_lookup (const ctf_file_t *, ctf_id_t);
 extern ctf_dtdef_t *ctf_dynamic_type (const ctf_file_t *, ctf_id_t);
-- 
cgit v1.1