From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 892BC80031 for ; Tue, 1 Dec 2026 10:21:44 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6B1AKKnE028464; Tue, 1 Dec 2026 13:20:21 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6B1AKKnE028464 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="JeOnwtJH" Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6B1AKJEW028460 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 1 Dec 2026 13:20:20 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6B1AKJEW028460 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-c41dae9db9dso261123666b.2 for ; Tue, 01 Dec 2026 02:20:19 -0800 (PST) X-Gm-Message-State: APuU4Z+k9Gu5Ikp64dd3NrTTG428rQ3OrCShOzqTOPLR0YkvMAktoExg xtKPprAooj8AKrB1YjSaFtjVeAGJHL0p8wfqRXm1C0sMWXCaj92ptNA753K9E+Ijmo0jzbhKqqg qsMsKpOdMuoSTGjVqN+s9qoTZXQcBXT/N/SthFA2TBOPwBj3Ioq9kxg== X-Gm-Gg: AZFdTZeLSpA9bOeMXfrD+ASj0WMG+tNqDu4wpojTf1LlCQgacKx2qfnM0h85eQ5uQ7O uQQcozQkrupWxOw80k3foLZyB6Afe4ij8BVbuEt7ucUOjMN3h3jijSzybt5eUTpNPuglf0YSmJw Y1lWSjfG8D64JFbDAywRKSvzPivbauA/PNeReKyUvO222SBIc0VOFJPKWm4yJ5AghtwRoera2Lx Nmcq7VLFcuABpU++iW+pTeE579KvUfZE8k7kXh8IEiZyNnwiS1teYB+IA6udpwZGFYWa0QW1NJU fsBIOWm8KHHh68EgYkTu8nV3MRCmWyxwbFtuybAH3cBU1NPW3rTlP7md5jS31pMKM8XWzQ/M/IW xdrx0PBBczOBb1BCyflwdCrDKQ5IFiA== X-Received: by 2002:a17:906:c14b:b0:c35:babe:ab44 with SMTP id a640c23a62f3a-c513a1e0076mr3459397366b.0.1796120419589; Tue, 01 Dec 2026 02:20:19 -0800 (PST) X-Received: by 2002:a17:906:c14b:b0:c35:babe:ab44 with SMTP id a640c23a62f3a-c513a1e0076mr3459394666b.0.1796120419039; Tue, 01 Dec 2026 02:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1796120419; cv=none; d=google.com; s=arc-20260327; b=YPiii+CJx+uTe0rqxbRWz3KUwQg7lvEnTnvczTTgWylo9ZsMxi6fBAp973h4kpJdJB hFjAIOgtXie+5yLzjzDx2KvxKBwI25J8/lvBKeeLZGqxdRami3NLlV7o3l5NDv9GkLRt ZeXFeqzaY1HrWLEcDQ8HThf0Vey3c/juY6JGpomAHuVwlsSz5+jdUnDMPtvVsoSVMW21 CQDvaSd5+c69NOxf9GW/ZTmKmyxZRextP2JwTgHUD1m8WG+r7opCyScBQgjpgxF888bz QziiKMfgMnj0uWqRUM7xcavjsXS8lkD6lpdyb/I9owNCAIBZHhoocYF0oCLVHw4e8/gY tE0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:dkim-signature; bh=EzFZA5zSnCkuIJJRKon04E9GeO2J9WY1uaPgHTfakSA=; fh=DglJZCp3N+VS8Ho2eetuhrRPUaBCCMPba5BdTJ+8An0=; b=n6vD6FxlywawgkOupU9mPcYGjbU6BK2M/5Ewbcp0JR9rcxdytwM+vNerpyAJZMtFyd Tr/jFt3mDdrTuu2SVw5Srxl+SdwARwxUTocuFLR4B6mNAkx3E+n3oVsm4x+A5tCUMvd2 mTN0nTSbruRBxC+I5Rz03kmlFpuyIMpJc4jRsZrn5ljUlYe+eaJvq5vu0L0LRIv+0w6G EYdlDfmVH4uFozQ5t3JovwrhLPSmOO7+eoxIlIIH0zxgUwNKSbtTpmb0Ne8jA59kZv5c H7xnGBROzdJqeRBDXxc0agsVhK31uNDNesOyrN7AZMJa3s+lAeg55IXHYh4SyQNVcBf2 jQfw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=JeOnwtJH; spf=pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=vasileios.almpanis@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id a640c23a62f3a-c513b06d286si2275871166b.228.2026.12.01.02.20.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 02:20:18 -0800 (PST) Received-SPF: pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=JeOnwtJH; spf=pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=vasileios.almpanis@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Content-Type:MIME-Version:Subject:Date :From; bh=EzFZA5zSnCkuIJJRKon04E9GeO2J9WY1uaPgHTfakSA=; b=JeOnwtJHwC9qsNw4csl 0dlKYqJua84bApypgRceTc2B5c8ulYN6jNrnzmF2UlfuymyC223vwY6vY+CWznXwS8HOsI93FEeqX p2smv5dKCqurcjKvmxX+IKGcWyyQ1KQLt/mOSDrVey0mf2ymVm0nge2FpgbhW+lfG1ss1JZqS7uHQ 7XaPwRB3BLRIMygap5Yk1cdWkm6slVIZRIQ46FjwWJy3Q3IuTtscJCdXOFRlEr+fupI/SyLPUyyvz bX8H8umY/GMasB1WkkrpmDJLhJrvR5annioCkPOqlfyx/kAO6lvSQzhbKPPpjl6Dg6gcX+h0lNNrp X31ElxtLF8UVzHw==; Received: from [130.117.225.5] (helo=dev010.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xYKxp-001z8O-37; Tue, 01 Dec 2026 11:20:08 +0100 From: Vasileios Almpanis Date: Tue, 01 Dec 2026 10:20:13 +0000 MIME-Version: 1.0 Message-Id: <20261201-ve-kthreadd-stack-v1-1-b4fb15511033@virtuozzo.com> X-B4-Tracking: v=1; b=H4sIAFyfDmsC/yWMQQrCMBAAv1L27EqSUq1+RTwkm61ZC1WysQilf 2+qx2GYWUA5CytcmwUyz6LymirYQwOU/PRglFgZnHEn64zFmXEsKbOPEbV4GrElM3SX0IVz20P t3pkH+f6eN0gk2B8d3P9CP+HJVPYjrOsG0YhPoX4AAAA= X-Change-ID: 20261201-ve-kthreadd-stack-3c0f59b5b738 To: Pavel Tikhomirov , Mirian Shilakadze , Konstantin Khorenko X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796120418; l=3268; i=vasileios.almpanis@virtuozzo.com; s=20260812; h=from:subject:message-id; bh=I5H6Rxf939IfFeHWCZbJNaAKLQ4MOhhO805AHD6v0uM=; b=irrneXjsk05yKQqe+uf33rV1a4xBfnKvP9YO4yBA2DR0+WgSRcZvmFnedC+UG8eh0eixsKO+l UVHL4LXXtjYBFMYmLk1QOUWvWXrkMMz0u1ILQkLXwMuIkZSks2Ep1zl X-Developer-Key: i=vasileios.almpanis@virtuozzo.com; a=ed25519; pk=HhuHDXAcPva9A8zccWEMRsb36reu+y4IVbBjXKxNUjw= X-OZ-Fwd: true Cc: devel@openvz.org, Artem Bulgakov Subject: [Devel] [PATCH hci-8.2] ve/kthreadd: keep the create request of a VE kthread off the stack X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org __kthread_create_on_node_ve() queues a work item from its stack to the kthreadd worker of the VE. When a fatal signal ends the wait, the function returns -EINTR and the item stays in the queue. The worker then uses a dead stack frame. A SIGKILL to the init of a container during the write of START to ve.state crashes the node: Oops: general protection fault RIP: __list_del_entry_valid_or_report kthread_worker_fn Comm: kthreadd ve: vek5 Put the work item into struct kthread_create_info. As in the kthreadd of the host, the caller frees this structure, or, if the caller was killed, the new thread or the worker on a failed kernel_thread(). https://virtuozzo.atlassian.net/browse/VSTOR-158054 Feature: nfs/nfsd: containerization Fixes: f94e1c28fdd1 ("ve/kthreadd: add per-ve kthreads creation interface") Reported-by: Artem Bulgakov Signed-off-by: Vasileios Almpanis --- kernel/kthread.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/kernel/kthread.c b/kernel/kthread.c index a6738c77b09d..baacee7ab331 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -52,6 +52,11 @@ struct kthread_create_info struct completion *done; struct list_head list; +#ifdef CONFIG_VE + /* Queued to the VE kthreadd, may outlive a killed caller */ + struct kthread_work ve_work; + unsigned long ve_flags; +#endif }; struct kthread { @@ -508,19 +513,16 @@ static void create_kthread(struct kthread_create_info *create) } -struct kthread_create_work { - struct kthread_work work; - struct kthread_create_info *info; - unsigned long flags; -}; - +#ifdef CONFIG_VE static void kthread_create_fn(struct kthread_work *w) { - struct kthread_create_work *work = container_of(w, - struct kthread_create_work, work); + struct kthread_create_info *create = container_of(w, + struct kthread_create_info, ve_work); - create_kthread_flags(work->info, work->flags); + /* @create must not be touched after kernel_thread() succeeds */ + create_kthread_flags(create, create->ve_flags); } +#endif static void kthread_create_add(struct kthread_create_info *create) { @@ -540,9 +542,6 @@ struct task_struct *__kthread_create_on_node_ve(struct ve_struct *ve, va_list args) { DECLARE_COMPLETION_ONSTACK(done); - struct kthread_create_work work = { - KTHREAD_WORK_INIT(work.work, kthread_create_fn), - }; struct task_struct *task; struct kthread_create_info *create = kmalloc(sizeof(*create), GFP_KERNEL); @@ -562,9 +561,9 @@ struct task_struct *__kthread_create_on_node_ve(struct ve_struct *ve, #ifdef CONFIG_VE if (!ve_is_super(ve)) { - work.info = create; - work.flags = flags; - kthread_queue_work(ve->kthreadd_worker, &work.work); + kthread_init_work(&create->ve_work, kthread_create_fn); + create->ve_flags = flags; + kthread_queue_work(ve->kthreadd_worker, &create->ve_work); } else #endif kthread_create_add(create); --- base-commit: beda1840d22b7707e3f8e18f413afbfffef93d25 change-id: 20261201-ve-kthreadd-stack-3c0f59b5b738 -- Best regards, Vasileios Almpanis Software Developer, Virtuozzo. _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel