X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=qIW9VWjs3bFR2uB+wvsDzzu/nESgin2MlWxcSQIgXeA=; b=GjMTbq/bF5flLik4z5XN5aC6Q1qwulULSfY5ogeXBVgjUNa7woqGc+9C72Mf8vKPDj ScD7ShKHi8jeICwhnUjrgF6mg5pU/nO56BDo67sO4+0wl3Pz6MkJKgv/4AeAJ//ejQRf nsE1BYD3qHn2PzoBJiYnMLlQ61wPc0d94Ycf3l4cpZkaY5LyfKgMfnZTCiXM5a3mRs5J 0dmWVZL4x6ddHoEKI9J4pgpS3Qjx+Rq1rcDxV+imKNTIPxVuF0a6ifkrTMJZxX92W/Q3 klVj/LZxeTp4B8hcZMNabDhZnx46IvogKM3oGXw4o6Ky8plwsjRrvoTuODsh15zYwH7Q kr2A== MIME-Version: 1.0 X-Received: by 10.50.79.229 with SMTP id m5mr5555593igx.1.1443973418553; Sun, 04 Oct 2015 08:43:38 -0700 (PDT) In-Reply-To: <56111BF6.8040408@gmx.de> References: <952a68b4-223b-4222-b456-35514bb8b7eb AT googlegroups DOT com> <561101C4 DOT 7040701 AT gmx DOT de> <56111BF6 DOT 8040408 AT gmx DOT de> Date: Sun, 4 Oct 2015 18:43:38 +0300 Message-ID: Subject: Re: dlclose not removing dependency dxes From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" To: djgpp AT delorie DOT com Content-Type: multipart/mixed; boundary=089e0122a3faad98dc05214942da Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk --089e0122a3faad98dc05214942da Content-Type: text/plain; charset=UTF-8 On 10/4/15, Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com] wrote: > Am 04.10.2015 12:39, schrieb Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) > [via djgpp AT delorie DOT com]: > > [snip] >> Below is a patch that will implement ref-counting for implicitly loaded >> modules >> by other ones. Please not that this ref-counting only works for >> dlopen/dlclose. >> There may be other loading mechanisms that suffer from the same issue and >> that >> will not be fixed by this modification. >> The patch is intended for the main branch but should work on v2_05_1 as >> well. > [snip] > > > There was a typo in the previously posted patch. Please use this one. > > Regards, > Juan M. Guerrero > The patch uses very long type and variable names: was hard to read for me. My version is as follows. (Also attached as a patch file, because gmail will mangle it.) I have some concerns with the patch itself, will outline them in the next mail. Index: src/libc/dxe/dlopen.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dxe/dlopen.c,v retrieving revision 1.11 diff -U 5 -p -r1.11 dlopen.c --- src/libc/dxe/dlopen.c 4 Oct 2015 10:27:28 -0000 1.11 +++ src/libc/dxe/dlopen.c 4 Oct 2015 14:55:50 -0000 @@ -36,14 +36,16 @@ #ifndef ELOOP #define ELOOP EMLINK #endif +#define DEBUG_DXE3 0 /* Prints struct __dxe_handle members. Always commited as 0. */ + /* private stack */ -typedef struct stk_node { +typedef struct __stk_node { const char *name; - struct stk_node *next; + struct __stk_node *next; } stk_node; /* Exported symbols table entry */ typedef struct { @@ -57,10 +59,16 @@ typedef struct unsigned short n_rel_relocs; unsigned short n_abs_relocs; char name [1]; /* expanded as needed */ } __attribute__((packed)) unres_table_entry; +/* This is a linked list of implicitly loaded dxe modules. */ +typedef struct __llist { + struct __dxe_handle *handle; /* last implicitly opened module */ + struct __llist *next; +} dxe_list; + /* This is the private dxe_h structure */ typedef struct __dxe_handle { struct __dxe_handle *next; /* Pointer to next module in chain */ char fname[FILENAME_MAX]; /* Full module pathname */ @@ -69,10 +77,11 @@ typedef struct __dxe_handle int n_exp_syms; /* Number of entries in export table */ exp_table_entry **exp_table; /* Exported symbols table */ char *header; /* The resident portion of header */ char *section; /* code+data+bss section */ long _fini; /* finalization */ + dxe_list *deps; /* Linked list of implicitly open module by this module or NULL */ } dxe_handle, *dxe_h; /* Last-resort symbol resolver */ void *(*_dlsymresolver) (const char *symname) = NULL; /* Last-error unresolved symbol count */ @@ -110,10 +119,12 @@ void *dlopen(const char *filename, int m char *discardable; stk_node *node; static stk_node *stk_top = NULL; + dxe_list *deps; + #ifndef __GNUC__ static int cleanup = 0; #endif _dl_unresolved_count = 0; @@ -205,10 +216,11 @@ found: /* O.k, fill the module handle structure */ strcpy(dxe.fname, realfn); dxe.inuse = 1; dxe.mode = mode; dxe.n_exp_syms = dxehdr.n_exp_syms; + dxe.deps = NULL; /* Read DXE tables and the data section */ hdrsize = dxehdr.symbol_offset - sizeof(dxehdr); discardsize = dxehdr.dep_size + dxehdr.unres_size + dxehdr.nrelocs * sizeof(long); if ((dxe.header = malloc(hdrsize + dxehdr.sec_size)) == NULL) @@ -240,11 +252,11 @@ found: /* Fill the unfilled portion of code+data+bss segment with zeros */ memset(dxe.section + dxehdr.sec_f_size, 0, dxehdr.sec_size - dxehdr.sec_f_size); /* Load the dependencies */ scan = discardable; - for (i = 0; i < dxehdr.n_deps; i++) + for (deps = NULL, i = 0; i < dxehdr.n_deps; i++) { stk_node tmp; tmp.name = realfn; tmp.next = stk_top; stk_top = &tmp; @@ -252,14 +264,35 @@ found: if (dlopen(scan, RTLD_GLOBAL) == NULL) { stk_top = tmp.next; goto unrecoverable; } + else + { + dxe_list *next; + + stk_top = tmp.next; - stk_top = tmp.next; + scan = strchr(scan, 0) + 1; - scan = strchr(scan, 0) + 1; + /* Register all implicitly open modules by this one. */ + if ((next = malloc(sizeof(dxe_list))) == NULL) + { + errno = ENOMEM; + goto midwayerror; + } + next->handle = dxe_chain; + next->next = NULL; + + if (deps) + { + deps->next = next; + deps = deps->next; + } + else + dxe.deps = deps = next; + } } /* Allright, now we're ready to resolve all unresolved symbols */ _dl_unresolved_count = dxehdr.n_unres_syms; _dl_unresolved_symbol[0] = 0; @@ -325,10 +358,50 @@ found: errno = ENOMEM; goto midwayerror; } memcpy(dxe_chain, &dxe, sizeof(dxe_handle)); +#if (DEBUG_DXE3 -0) == 1 + { + FILE *f = fopen("c:/tmp/dxe_chain.txt", "a"); + + if (f) + { + fprintf(f, "dxe_chain : 0x%p\n" + " next : 0x%p\n" + " fname : %s\n" + " mode : %s\n" + " inuse : %d\n" + " n_exp_syms : %d\n" + " exp_table : 0x%p\n", + dxe_chain, dxe_chain->next, dxe_chain->fname, + dxe_chain->mode == RTLD_LAZY ? "RTLD_LAZY" : + dxe_chain->mode == RTLD_NOW ? "RTLD_NOW" : + dxe_chain->mode == RTLD_LOCAL ? "RTLD_LOCAL" : + dxe_chain->mode == RTLD_GLOBAL ? "RTLD_GLOBAL" : "unknown", + dxe_chain->inuse, dxe_chain->n_exp_syms, dxe_chain->exp_table); + for (i = 0; i < dxe_chain->n_exp_syms; i++) + fprintf(f, " exp_table[%d]->offset : %ld\n" + " exp_table[%d]->name : %s\n", + i, dxe_chain->exp_table[i]->offset, i, dxe_chain->exp_table[i]->name); + fprintf(f, " header : 0x%p\n" + " section : 0x%p\n" + " _fini : %ld\n", + dxe_chain->header, dxe_chain->section, dxe_chain->_fini); + if ((deps = dxe_chain->deps)) + for (; deps; deps = deps->next) + fprintf(f, " deps : 0x%p\n" + " handle : 0x%p\n" + " handle->fname : %s\n\n", + deps, deps->handle, deps->handle->fname); + else + fprintf(f, " deps : 0x00000000\n\n"); + fclose(f); + } + } +#endif + #ifndef __GNUC__ if (!cleanup) { cleanup = !0; atexit(_closeall); @@ -361,10 +434,21 @@ int dlclose(void *dxe) { dxe_h *cur; for (cur = &dxe_chain; *cur; cur = &(*cur)->next) if (*cur == dxe) { + /* Un-register all implicitly loaded modules by this module. */ + dxe_list *deps = (*cur)->deps; + while (deps) + { + dxe_list *next = deps->next; + + dlclose(deps->handle); + free(deps); + deps = next; + } + *cur = ((dxe_h)dxe)->next; break; } } -- O.S. --089e0122a3faad98dc05214942da Content-Type: application/octet-stream; name="dlopen2.patch" Content-Disposition: attachment; filename="dlopen2.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: file0 SW5kZXg6IHNyYy9saWJjL2R4ZS9kbG9wZW4uYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvY3ZzL2Rq Z3BwL2RqZ3BwL3NyYy9saWJjL2R4ZS9kbG9wZW4uYyx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4x MQpkaWZmIC1VIDUgLXAgLXIxLjExIGRsb3Blbi5jCi0tLSBzcmMvbGliYy9keGUvZGxvcGVuLmMJ NCBPY3QgMjAxNSAxMDoyNzoyOCAtMDAwMAkxLjExCisrKyBzcmMvbGliYy9keGUvZGxvcGVuLmMJ NCBPY3QgMjAxNSAxNDo1NTo1MCAtMDAwMApAQCAtMzYsMTQgKzM2LDE2IEBACiAKICNpZm5kZWYg RUxPT1AKICNkZWZpbmUgRUxPT1AgRU1MSU5LCiAjZW5kaWYKIAorI2RlZmluZSBERUJVR19EWEUz IDAJLyogUHJpbnRzIHN0cnVjdCBfX2R4ZV9oYW5kbGUgbWVtYmVycy4gIEFsd2F5cyBjb21taXRl ZCBhcyAwLiAqLworCiAvKiBwcml2YXRlIHN0YWNrICovCi10eXBlZGVmIHN0cnVjdCBzdGtfbm9k ZSB7Cit0eXBlZGVmIHN0cnVjdCBfX3N0a19ub2RlIHsKICAgY29uc3QgY2hhciAqbmFtZTsKLSAg c3RydWN0IHN0a19ub2RlICpuZXh0OworICBzdHJ1Y3QgX19zdGtfbm9kZSAqbmV4dDsKIH0gc3Rr X25vZGU7CiAKIC8qIEV4cG9ydGVkIHN5bWJvbHMgdGFibGUgZW50cnkgKi8KIHR5cGVkZWYgc3Ry dWN0CiB7CkBAIC01NywxMCArNTksMTYgQEAgdHlwZWRlZiBzdHJ1Y3QKICAgdW5zaWduZWQgc2hv cnQgbl9yZWxfcmVsb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GVuKCJjOi90bXAvZHhlX2NoYWluLnR4dCIsICJhIik7CisKKyAgICBpZiAoZikK KyAgICB7CisgICAgICBmcHJpbnRmKGYsICJkeGVfY2hhaW4gICAgICAgICAgICAgICAgICAgIDog MHglcFxuIgorICAgICAgICAgICAgICAgICAiICBuZXh0ICAgICAgICAgICAgICAgICAgICAgICA6 IDB4JXBcbiIKKyAgICAgICAgICAgICAgICAgIiAgZm5hbWUgICAgICAgICAgICAgICAgICAgICAg OiAlc1xuIgorICAgICAgICAgICAgICAgICAiICBtb2RlICAgICAgICAgICAgICAgICAgICAgICA6 ICVzXG4iCisgICAgICAgICAgICAgICAgICIgIGludXNlICAgICAgICAgICAgICAgICAgICAgIDog JWRcbiIKKyAgICAgICAgICAgICAgICAgIiAgbl9leHBfc3ltcyAgICAgICAgICAgICAgICAgOiAl ZFxuIgorICAgICAgICAgICAgICAgICAiICBleHBfdGFibGUgICAgICAgICAgICAgICAgICA6IDB4 JXBcbiIsCisgICAgICAgICAgICAgICAgIGR4ZV9jaGFpbiwgZHhlX2NoYWluLT5uZXh0LCBkeGVf Y2hhaW4tPmZuYW1lLAorICAgICAgICAgICAgICAgICBkeGVfY2hhaW4tPm1vZGUgPT0gUlRMRF9M QVpZID8gIlJUTERfTEFaWSIgOgorICAgICAgICAgICAgICAgICBkeGVfY2hhaW4tPm1vZGUgPT0g UlRMRF9OT1cgPyAiUlRMRF9OT1ciIDoKKyAgICAgICAgICAgICAgICAgZHhlX2NoYWluLT5tb2Rl ID09IFJUTERfTE9DQUwgPyAiUlRMRF9MT0NBTCIgOgorICAgICAgICAgICAgICAgICBkeGVfY2hh aW4tPm1vZGUgPT0gUlRMRF9HTE9CQUwgPyAiUlRMRF9HTE9CQUwiIDogInVua25vd24iLAorICAg ICAgICAgICAgICAgICBkeGVfY2hhaW4tPmludXNlLCBkeGVfY2hhaW4tPm5fZXhwX3N5bXMsIGR4 ZV9jaGFpbi0+ZXhwX3RhYmxlKTsKKyAgICAgIGZvciAoaSA9IDA7IGkgPCBkeGVfY2hhaW4tPm5f ZXhwX3N5bXM7IGkrKykKKyAgICAgICAgZnByaW50ZihmLCAiICAgIGV4cF90YWJsZVslZF0tPm9m ZnNldCAgICAgOiAlbGRcbiIKKyAgICAgICAgICAgICAgICAgICAiICAgIGV4cF90YWJsZVslZF0t Pm5hbWUgICAgICAgOiAlc1xuIiwKKyAgICAgICAgICAgICAgICAgICBpLCBkeGVfY2hhaW4tPmV4 cF90YWJsZVtpXS0+b2Zmc2V0LCBpLCBkeGVfY2hhaW4tPmV4cF90YWJsZVtpXS0+bmFtZSk7Cisg ICAgICBmcHJpbnRmKGYsICIgIGhlYWRlciAgICAgICAgICAgICAgICAgICAgIDogMHglcFxuIgor ICAgICAgICAgICAgICAgICAiICBzZWN0aW9uICAgICAgICAgICAgICAgICAgICA6IDB4JXBcbiIK KyAgICAgICAgICAgICAgICAgIiAgX2ZpbmkgICAgICAgICAgICAgICAgICAgICAgOiAlbGRcbiIs CisgICAgICAgICAgICAgICAgIGR4ZV9jaGFpbi0+aGVhZGVyLCBkeGVfY2hhaW4tPnNlY3Rpb24s IGR4ZV9jaGFpbi0+X2ZpbmkpOworICAgICAgaWYgKChkZXBzID0gZHhlX2NoYWluLT5kZXBzKSkK KyAgICAgICAgZm9yICg7IGRlcHM7IGRlcHMgPSBkZXBzLT5uZXh0KQorICAgICAgICAgIGZwcmlu dGYoZiwgIiAgZGVwcyAgICAgICAgICAgICAgICAgICAgICAgOiAweCVwXG4iCisgICAgICAgICAg ICAgICAgICAgICAiICAgIGhhbmRsZSAgICAgICAgICAgICAgICAgICA6IDB4JXBcbiIKKyAgICAg ICAgICAgICAgICAgICAgICIgICAgaGFuZGxlLT5mbmFtZSAgICAgICAgICAgIDogJXNcblxuIiwK KyAgICAgICAgICAgICAgICAgICAgIGRlcHMsIGRlcHMtPmhhbmRsZSwgZGVwcy0+aGFuZGxlLT5m bmFtZSk7CisgICAgICBlbHNlCisgICAgICAgIGZwcmludGYoZiwgIiAgZGVwcyAgICAgICAgICAg ICAgICAgICAgICAgOiAweDAwMDAwMDAwXG5cbiIpOworICAgICAgZmNsb3NlKGYpOworICAgIH0K KyAgfQorI2VuZGlmCisKICNpZm5kZWYgX19HTlVDX18KICAgaWYgKCFjbGVhbnVwKQogICB7CiAg ICAgY2xlYW51cCA9ICEwOwogICAgIGF0ZXhpdChfY2xvc2VhbGwpOwpAQCAtMzYxLDEwICs0MzQs MjEgQEAgaW50IGRsY2xvc2Uodm9pZCAqZHhlKQogICB7CiAgICAgZHhlX2ggKmN1cjsKICAgICBm b3IgKGN1ciA9ICZkeGVfY2hhaW47ICpjdXI7IGN1ciA9ICYoKmN1ciktPm5leHQpCiAgICAgICBp ZiAoKmN1ciA9PSBkeGUpCiAgICAgICB7CisgICAgICAgIC8qIFVuLXJlZ2lzdGVyIGFsbCBpbXBs aWNpdGx5IGxvYWRlZCBtb2R1bGVzIGJ5IHRoaXMgbW9kdWxlLiAgKi8KKyAgICAgICAgZHhlX2xp c3QgKmRlcHMgPSAoKmN1ciktPmRlcHM7CisgICAgICAgIHdoaWxlIChkZXBzKQorICAgICAgICB7 CisgICAgICAgICAgZHhlX2xpc3QgKm5leHQgPSBkZXBzLT5uZXh0OworCisgICAgICAgICAgZGxj bG9zZShkZXBzLT5oYW5kbGUpOworICAgICAgICAgIGZyZWUoZGVwcyk7CisgICAgICAgICAgZGVw cyA9IG5leHQ7CisgICAgICAgIH0KKwogICAgICAgICAqY3VyID0gKChkeGVfaClkeGUpLT5uZXh0 OwogICAgICAgICBicmVhazsKICAgICAgIH0KICAgfQogCg== --089e0122a3faad98dc05214942da--