]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commitdiff
TLS update
authorAlex Markuze <amarkuze@redhat.com>
Wed, 2 Jul 2025 11:03:04 +0000 (11:03 +0000)
committerAlex Markuze <amarkuze@redhat.com>
Wed, 2 Jul 2025 12:30:34 +0000 (12:30 +0000)
include/linux/sched.h
kernel/fork.c

index f96ac198289349199b9c671240a20fc7826228ad..467dfbb45485c15bcbac8e5e10c3faa8e36219da 100644 (file)
@@ -1273,6 +1273,7 @@ struct task_struct {
 
        /* Journalling filesystem info: */
        void                            *journal_info;
+       void                            *tls_ctx;
 
        /* Stacked block device info: */
        struct bio_list                 *bio_list;
index 168681fc4b25a9fddcb90ce155c027551455f4ee..8390d5e1a6d3927e76f86779199cc9e08fefefb3 100644 (file)
@@ -180,8 +180,25 @@ static inline struct task_struct *alloc_task_struct_node(int node)
        return kmem_cache_alloc_node(task_struct_cachep, GFP_KERNEL, node);
 }
 
+struct tls_storage {
+       void (*release)(void *state);
+};
+
 static inline void free_task_struct(struct task_struct *tsk)
 {
+/*
+       if (tsk->tls.release) {
+               tsk->tls.release(tsk->tls.state);
+               tsk->tls.state = NULL;
+               tsk->tls.release = NULL;
+       }
+*/
+       if (tsk->tls_ctx) {
+               struct tls_storage *tls = (struct tls_storage *)tsk->tls_ctx;
+               tls->release(tls);
+               tsk->tls_ctx = NULL;
+               wmb();
+       }
        kmem_cache_free(task_struct_cachep, tsk);
 }
 
@@ -2260,6 +2277,9 @@ __latent_entropy struct task_struct *copy_process(
        p = dup_task_struct(current, node);
        if (!p)
                goto fork_out;
+
+       p->tls_ctx = NULL;
+
        p->flags &= ~PF_KTHREAD;
        if (args->kthread)
                p->flags |= PF_KTHREAD;