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 6A980803BB for ; Mon, 16 Nov 2026 13:46:13 +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 6AGDivBO025940; Mon, 16 Nov 2026 16:44:58 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGDivBO025940 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794836701; bh=uhDZTKguzfWXxiadm5Lg1nFU0TwUO2rB24prZUr6ui8=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=cq2hz2yx+ijyn/ARiUmaCpjjZvLV853v9o/IcaYdgIpnH/8XsAi6xudUehqrSAMEN E1CIYAnFKglV+srFlA8rYmwSkYw1jKxplkixd+eXukQ3MLlBnYwHoMxehx1JbL7H/T K+PZTCzjSH5+cTDNn90uRaEaELk8dFFYiN5Z7nxKdMR2oO5g+YDBpn2FC0nZUGkh59 v9ZIsmBhGgFWMDoh9gp3ByfAEooahwIt135jKYjSJbL17rGmCg26Ndy1kLkQt8uTrU 3AZ8w3Dx97JJ0uZDLOi/yUGAVekrGF29lyJV1ou7Avd88bjEyvnfU/zPG5NnGpUeTS 4Pw1SdGvLi5PQ== Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AGDipbR025912 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 16 Nov 2026 16:44:51 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGDipbR025912 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="UPp2uvfB" Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a1fdde384cso16147395e9.3 for ; Mon, 16 Nov 2026 05:44:51 -0800 (PST) X-Gm-Message-State: APuU4Z/i/S+r90qikozjI+eSP0fu1amr3CJfd8Nv9Ztbn3P5OQFdsSdN bluQ9O1dCMHpj1npGsjy4lgfX3yXxPhFEKAToVk2SATziHvX2P+SZJYiv4kzvNocbV2M1NI6xfV RHlXOXQi93+1/qS1exFt+Z4hLPEjVfkKPoUo4jlhrR+KFkCwgxbm98w== X-Gm-Gg: AYBFou1tn4UB3afOwMgs/FnAdqP7w2xbyzRy5lJ01x9HBFdRoaGbGR/M4OjyMirbv9b n0R/VYQVQeZ2ZD/9otUPP6vMJ6ieiG1EOqL9VG1SxNEY7KvllAg1Cl1+DQN8EEpvMyeb+NJ5a7o VMjTR8ilM1U+nk4aZc05ZsMjdZsPxkxpH3M1kYDBiielcxXNYsj6wV5L28eissfGKZxCMGmIrML 0iXLfRKlCSDRy7WDnMbPZ1TistpYw6MMI8JXGu9Znc/myoWtbAtZH/43kIll99xi0sZPHwTcELq E311J9H07g== X-Received: by 2002:a05:600c:1c17:b0:4bb:6752:8400 with SMTP id 5b1f17b1804b1-4bb6752853emr160791105e9.17.1794836691144; Mon, 16 Nov 2026 05:44:51 -0800 (PST) X-Received: by 2002:a05:600c:1c17:b0:4bb:6752:8400 with SMTP id 5b1f17b1804b1-4bb6752853emr160790445e9.17.1794836690642; Mon, 16 Nov 2026 05:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794836690; cv=none; d=google.com; s=arc-20260327; b=Pt+ud7O2jV126s3p4sDE200nRXPKMZp6kw1uM3u9+vDdwIVVjJ4TE33xJ+xOJF+KMs 0ZUz2bdrUFYbBZ4chbqSAoFGkpEEvZdaD661vBziom2dSn43+qFQSqrCukVi7OqKYC0n fR6tjMRAEkzfJqXzXcAGL68IaSlmTq1BSbNtsiwndthiaB7WJV6+NO0BQGvNtwi7hMuu eXY3ZYjUX8RKD0zc5rXZOJtuvCAochPWAUI2WiJiZcnCzHAOIAV0iz8vbdSMGNX+YzBm uNBmJHJ/ogFpd0prGik6uGmhXFtRbJ3ws2C+LdMLnNdRiu4pVZjKDLXMZZFE6N/pInb+ Cg3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=3B8ag+XrMDMHrHwiSTPtLQYZ7jRkbCJv25OuB8dv4dg=; fh=6uNYPwy9b142UWd0jzfAkq2Z52P/q4JTiX3ERhnHONA=; b=g842sWs7SSxZ814yWm8e6eGq2UhErBeuy57cYxOYHouAGPd+HR2d3MO0jZorue6HQ+ dSYdjezLwMgu6AoXkkHIGaFR4Fm92Vm0/4JLK3J5y7xwzp44I9kQJUz8SW8Xnj89iwnA 55/pCd/28HFRIuWMfgPflvC2l4r6KK0QF4N7RgeW3O3sT+O7N6nZOqXxCbgh1edqdmcO nQI8DZcEG/DoeMDWrtlUURATO8SkN7BAYc0j1aNQ0ZK+7Enwqfyj9+MT0f4jF/krzvdv bWBu9ivxgxL0DwXNrJBTJIMST/rldm/Np7RjMXRis5zQyBOoG23eZB7+6U2PavHKz1fQ 0R9w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=UPp2uvfB; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:cf0d:642d:d702:3c24 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-4bb729b29b7sor9301735e9.17.2026.11.16.05.44.50 for (Google Transport Security); Mon, 16 Nov 2026 05:44:50 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:cf0d:642d:d702:3c24 as permitted sender) client-ip=2a06:5b06:b600:300:cf0d:642d:d702:3c24; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=UPp2uvfB; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:cf0d:642d:d702:3c24 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1794836690; x=1795441490; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3B8ag+XrMDMHrHwiSTPtLQYZ7jRkbCJv25OuB8dv4dg=; b=UPp2uvfBGMd1PlD9QhKfFehPs6YA5nmstADSq5lMi50Clyph4vVbtwefyjhWsrMGDZ +pTjOniHzKPI1/okFMXTSgAsBHimewCgyIhD9feVpXGmFmldUydF6gRWleM7oJQRGzck Fpa5iL1U4AeDmWCXCpPOyZG7/ClxEUc3JcmyC7uO2Y+gVjEbANM8sh85N24Qr1fNCyNh VkSI+1pkljHTVgToIkbIixfXGE1xvldVXPZr0DL+Y2mD8qVLvdBZ+CsCwX8KqoO/GXbI 59uzvBS3Fzaoo24m8QWOhq+0CslKj2W9rvB754h9hdcPW5NB/8sVV0JmcQILfDc/j3+W 6HyQ== X-Received: by 2002:a05:600c:e557:20b0:4b2:61e5:b2f4 with SMTP id 5b1f17b1804b1-4bb55a583bbmr139959785e9.11.1794836690136; Mon, 16 Nov 2026 05:44:50 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:cf0d:642d:d702:3c24]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb675200e4sm125713015e9.0.2026.11.16.05.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 05:44:49 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com Date: Mon, 16 Nov 2026 14:44:44 +0100 Message-ID: <20261116134445.438480-3-den@openvz.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261116134445.438480-1-den@openvz.org> References: <20261116134445.438480-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v2 2/3] ve: free ve_name together with the ve, not at cgroup offline 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 From: Denis V. Lunev ve_offline() frees ve->ve_name as soon as the ve cgroup goes offline, while the ve itself lives on as long as anything holds a reference, a ve namespace for one. Tasks of that namespace still point at the ve, and readers of another task's ve name, such as sched_show_task(), dereference the string with nothing that keeps it from being freed under them. A reference to the ve does not help either, as it does not hold the cgroup online. Free the name in ve_destroy() instead. That is css_free, which runs after an RCU grace period, so the name is valid for as long as the ve is and an RCU reader of task_ve() can print it. ve0 is never destroyed and keeps its static name. ve_offline() is left empty and goes away. https://virtuozzo.atlassian.net/browse/VSTOR-155341 Feature: ve: ve generic structures Suggested-by: Vasileios Almpanis Signed-off-by: Denis V. Lunev --- kernel/ve/ve.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index 6cdfaaa4e703..cdfd03416b39 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -894,16 +894,6 @@ static int ve_online(struct cgroup_subsys_state *css) return 0; } -static void ve_offline(struct cgroup_subsys_state *css) -{ - struct ve_struct *ve = css_to_ve(css); - - if (!ve_is_super(ve)) { - kfree(ve->ve_name); - ve->ve_name = NULL; - } -} - static void ve_devmnt_free(struct ve_devmnt *devmnt) { if (!devmnt) @@ -939,6 +929,7 @@ static void ve_destroy(struct cgroup_subsys_state *css) ve_free_vdso(ve); mntput(ve->devtmpfs_mnt); free_percpu(ve->sched_lat_ve.cur); + kfree(ve->ve_name); ve_set_state(ve, VE_STATE_DEAD); kmem_cache_free(ve_cachep, ve); } @@ -1690,7 +1681,6 @@ static struct cftype ve_cftypes[] = { struct cgroup_subsys ve_cgrp_subsys = { .css_alloc = ve_create, .css_online = ve_online, - .css_offline = ve_offline, .css_free = ve_destroy, .legacy_cftypes = ve_cftypes, .dfl_cftypes = ve_cftypes, -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel