Changeset 544c5b4 in mainline


Ignore:
Timestamp:
2025-01-25T16:25:39Z (10 days ago)
Author:
Matěj Volf <git@…>
Children:
4ef27eb
Parents:
328b89f
git-author:
Matěj Volf <git@…> (2025-01-24 23:59:36)
git-committer:
Matěj Volf <git@…> (2025-01-25 16:25:39)
Message:

a few comments for TLS allocation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/thread/tls.c

    r328b89f r544c5b4  
    8585static tcb_t *tls_make_generic(const void *elf, void *(*alloc)(size_t, size_t))
    8686{
     87        /*
     88         * See also rtld/module.c -> modules_process_tls(), where we have less
     89         * messy code for the dynamic-linking version of this.
     90         */
    8791        assert(!elf_get_phdr(elf, PT_DYNAMIC));
    8892#ifdef CONFIG_RTLD
     
    128132        uintptr_t bias = elf_get_bias(elf);
    129133
     134        /*
     135         * FIXME: I couldn't convince myself this is correct, but I couldn't
     136         * find a case where it breaks either: if the actual alloc_size is
     137         * bigger than the requested size (tls->p_memsz), the alignment padding
     138         * will be placed at the beginning (because TLS is (at least sometimes?)
     139         * indexed with negative offsets from the TCB pointer).
     140         *
     141         * Now we will copy the initialization data to a position at the start of
     142         * the allocation, so if the padding has nonzero size, if think the initialization
     143         * data is now incorrectly offset by its size?
     144         */
     145
    130146        /* Copy thread local data from the initialization image. */
    131147        memcpy(data, (void *)(tls->p_vaddr + bias), tls->p_filesz);
Note: See TracChangeset for help on using the changeset viewer.