[{"id":3682282,"web_url":"http://patchwork.ozlabs.org/comment/3682282/","msgid":"<248dffc5-06ff-f9c2-7e39-c1ab991d2a16@ssi.bg>","list_archive_url":null,"date":"2026-04-25T14:40:07","subject":"Re: [PATCHv4 net] ipvs: fix races around est_mutex and est_cpulist","submitter":{"id":2825,"url":"http://patchwork.ozlabs.org/api/people/2825/","name":"Julian Anastasov","email":"ja@ssi.bg"},"content":"Hello,\n\nOn Sat, 25 Apr 2026, Julian Anastasov wrote:\n\n> Sashiko reports for races and possible crash around\n> the usage of est_cpulist_valid and sysctl_est_cpulist.\n> The problem is that we do not lock est_mutex in some\n> places which can lead to wrong write ordering and\n> as result problems when calling cpumask_weight()\n> and cpumask_empty().\n> \n> Fix them by moving the est_max_threads read/write under\n> locked est_mutex. Do the same for one ip_vs_est_reload_start()\n> call to protect the cpumask_empty() usage of sysctl_est_cpulist.\n> \n> To remove the chance of deadlock while stopping the\n> estimation kthreads, keep the data structure for kthread 0\n> even after last estimator is removed and do not hold mutexes\n> while stopping this task. Now we will use a new flag 'needed'\n> to know when kthread 0 should run. The kthreads above 0\n> do not use mutexes, so stop them under est_mutex because\n> their kthread data still can be destroyed if they do not\n> serve estimators. Now all kthreads will be started by\n> the est_reload_work to properly serialize the stop/start\n> for kthread 0.\n> \n> Reduce the use of service_mutex in ip_vs_est_calc_phase()\n> because under est_mutex we can safely walk est_kt_arr to\n> stop the kthreads above slot 0.\n> \n> Finally, fix use-after-free for kd->est_row in\n> ip_vs_est_calc_phase(). est->ktrow should simply switch to\n> a delay value while estimator is linked to est_temp_list.\n> \n> Link: https://sashiko.dev/#/patchset/20260331165015.2777765-1-longman%40redhat.com\n> Link: https://sashiko.dev/#/patchset/20260420171308.87192-1-ja%40ssi.bg\n> Link: https://sashiko.dev/#/patchset/20260422125123.40658-1-ja%40ssi.bg\n> Link: https://sashiko.dev/#/patchset/20260424175858.54752-1-ja%40ssi.bg\n> Fixes: f0be83d54217 (\"ipvs: add est_cpulist and est_nice sysctl vars\")\n> Signed-off-by: Julian Anastasov <ja@ssi.bg>\n\n\tSashiko found another missing mutex lock [1].\nI'll send new patch version...\n\npw-bot: changes-requested\n\n[1] https://sashiko.dev/#/patchset/20260425103918.7447-1-ja%40ssi.bg\n\nRegards\n\n--\nJulian Anastasov <ja@ssi.bg>","headers":{"Return-Path":"\n <netfilter-devel+bounces-12195-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","netfilter-devel@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (4096-bit key;\n unprotected) header.d=ssi.bg header.i=@ssi.bg header.a=rsa-sha256\n header.s=ssi header.b=JgnLwuWE;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-12195-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (4096-bit key) header.d=ssi.bg header.i=@ssi.bg header.b=\"JgnLwuWE\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=193.238.174.39","smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=ssi.bg","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=ssi.bg"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g2sv13lWsz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 26 Apr 2026 00:40:29 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 0A8EA300E70C\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 25 Apr 2026 14:40:23 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 4B3F137AA98;\n\tSat, 25 Apr 2026 14:40:22 +0000 (UTC)","from mx.ssi.bg (mx.ssi.bg [193.238.174.39])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B2FC86331;\n\tSat, 25 Apr 2026 14:40:16 +0000 (UTC)","from mx.ssi.bg (localhost [127.0.0.1])\n\tby mx.ssi.bg (Potsfix) with ESMTP id 188312126B;\n\tSat, 25 Apr 2026 17:40:14 +0300 (EEST)","from box.ssi.bg (box.ssi.bg [193.238.174.46])\n\tby mx.ssi.bg (Potsfix) with ESMTPS;\n\tSat, 25 Apr 2026 17:40:12 +0300 (EEST)","from ja.ssi.bg (unknown [213.16.62.126])\n\tby box.ssi.bg (Potsfix) with ESMTPSA id B128A6089D;\n\tSat, 25 Apr 2026 17:40:11 +0300 (EEST)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby ja.ssi.bg (8.18.1/8.18.1) with ESMTP id 63PEe7Bc017270;\n\tSat, 25 Apr 2026 17:40:10 +0300"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777128021; cv=none;\n b=IEJOynhgY9KCIganftuLRAxO40A2DELROzeUlexGi4ef10+yiUvnU/2vgUqS7G4xu8xHZ0aVvhhmq4aYjfy9O6qBoeNzcpIY5Y0aomyTl1hqBVIprt0xfwzQm/qWTibHp7wcxyF9YUAi+v8g+eViHO7rPCSMSX4Lk5SwarYjadI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777128021; c=relaxed/simple;\n\tbh=3S59E+6wwY1pb8wN+u2QDClwuHlWMAbfkyohregNYMY=;\n\th=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:\n\t MIME-Version:Content-Type;\n b=BclfEQUTWuxuk3OJeM8yWZWE9ETlsQVTwtE1Usjz1DrAVb8aNH5mDsfKByD6EWgHnlO+MFqgVRkw761uHdP1cGB8wkAQedyfFM7h2j57g0C4hZWD+BWjThlmIzHxaeJ5sdhN01hTv2M0rEa4fI8N8jBFPD/5MKprhd3uWPNOZrE=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=ssi.bg;\n spf=pass smtp.mailfrom=ssi.bg;\n dkim=pass (4096-bit key) header.d=ssi.bg header.i=@ssi.bg header.b=JgnLwuWE;\n arc=none smtp.client-ip=193.238.174.39","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=ssi.bg; h=cc:cc\n\t:content-type:content-type:date:from:from:in-reply-to:message-id\n\t:mime-version:references:reply-to:subject:subject:to:to; s=ssi;\n\t bh=t05NlVZq+mhhzTf2yK9v5tWBFrn5EElC1WzGhXz5mEE=; b=JgnLwuWEntx9\n\tMLwLZmT4msNuGAYQZ3lQZBdQ/S89n/Ea99/SoAfeKS6zij32wvA54Nw5pJ0m8ecl\n\thXVaq1e9WRXk8Z6NshfueiIn6s9l12ANGUf+/pRqCnlPej6nYR4QfFTXHNAhvtZ4\n\tzHSgC2HfvJ1rgfOTFwBDTn+C/bhOvTfDreWD3JeXC+TOuEqKQ3GyhDoAbgIhdU77\n\tDxv77cfJCA/G5/N7P4ZmNausANQNm2tFNBsKp0/fyckRfPOZB8uG0QfCFu6CJWX+\n\tmEnvP7V/N8/hJSq9btSCqjMi749+FzJdM/U/tnwPOTpRbSBZqnzay9NHil0ZY93y\n\tK9lwb0ocESdSQjwT5MUePz+o+qGueFFP5idLA2oGcQl2TCBr1g8NZ9OSYRavfRsj\n\tMT9zpX4wzDi4/zCbF7vB0UbT/pArPb8Ws0WTWwoTSvKViKNrkwxv2hrkiUCHpp6v\n\tP7oXXJgZuRElhoiiXv6VXVeHUtPjP4XLYQqKSkpdw5HAJO8fEZTN3p2QLC1xuFnf\n\t2aHljvZmIFQut3kWu4pUb5Q5oGCs6Rqzc8v7ThMH+t9V03gNsZ1UrWlgXbMXbMP9\n\tMtEwNc41RInUeqnQoZC+4PYz1Ujj12zl5OAAMUHz3dbiREfyYhA87dOxUnWHauwE\n\ttI8bXS1jlGlLsB6ym/vA9G77DiZJ+6Q=","Date":"Sat, 25 Apr 2026 17:40:07 +0300 (EEST)","From":"Julian Anastasov <ja@ssi.bg>","To":"Simon Horman <horms@verge.net.au>","cc":"Pablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>,\n        lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org","Subject":"Re: [PATCHv4 net] ipvs: fix races around est_mutex and est_cpulist","In-Reply-To":"<20260425103918.7447-1-ja@ssi.bg>","Message-ID":"<248dffc5-06ff-f9c2-7e39-c1ab991d2a16@ssi.bg>","References":"<20260425103918.7447-1-ja@ssi.bg>","Precedence":"bulk","X-Mailing-List":"netfilter-devel@vger.kernel.org","List-Id":"<netfilter-devel.vger.kernel.org>","List-Subscribe":"<mailto:netfilter-devel+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:netfilter-devel+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII"}}]