uprobes: use READ_ONCE() to read mm->uprobes_state.xol_area in concurrent environment
Message ID | tencent_088804E150842691191FD0021AEE8649EB0A@qq.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-79567-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1081495dyb; Sat, 24 Feb 2024 02:31:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUSRe+MV0Fiq+AJ0hLoxID8IIqs0m0QIbCq12oJBS7lrXdMQg0cvq5qPnJOenzXV54qQm5qO4uW7wEavbtvmuKJZCq9PA== X-Google-Smtp-Source: AGHT+IENFHzIgNMfeahz3ABHas3Rc335tpZVR0AvLm9lPBLJsvirHtnwVsxUWMapPfbIZF8SVR25 X-Received: by 2002:a05:6a00:1953:b0:6e2:b25d:a999 with SMTP id s19-20020a056a00195300b006e2b25da999mr2810186pfk.34.1708770704439; Sat, 24 Feb 2024 02:31:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708770704; cv=pass; d=google.com; s=arc-20160816; b=S5Bed3Ia3/FQDg6DY2TAQGDEMglWVTGRGcBU+EYlf2H/ROfL2i6NklQXeEk+p/nITS upBv3wxgq3/JpCphTTHhrGimGg8hQhh0Sm/TNc0ov8FD7Ap6hZKTgMAU6RuMWbLmCZ2C uU0GechS/gubN10npucuEEara+yXCCTS7IJ99losuzhtzW3c7wi5XdWLmOeyeBVxLq0E v6zbQp2TqQ+fhpPu9zLTDhFh0XkofRkiTM2nx0770z9Vv7goBzko6l0K/lCzVbCYkpXe pLUntxnH6danPqQn+MRdxEbPy+4OPkZtuDv08NlBZSD9qFqdqUXR1NwyCxowcySDfwIy tJGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:subject:cc:to:from :message-id:dkim-signature; bh=JakpM4UpT9WYC+dBrABZ4HnlbAhvwlK1yGteAKNIH+E=; fh=+/ioFU7hJbGtP5/ok+SrCLDJ1TAcr1bjeJa9imayiRs=; b=Yy9PgPbvOz7A8ZlIjEmMccw5grYJ85aBMJOaYnop2CBeg5IEpVIx8iRP699v4z0tm4 RUIfWpuFXNd4VOtxow+RQa6CS3Kpi4jsc3bHZqenCjPZ2dlrjBluYb0038Ac+9kSeIrs VitumdFvQBJo0/GoghQDL3v5Jy1er/zbwV7NlOdtxFEmKO2jOq72msomsh3w0gI7FbD0 j9WRh2DgVXU2iVmEIpnfVLcUZ6O1PwhxypccOSmwWzf2bgbDPJ7ZTYDXX+W5Tb9bszkJ T/Oa1mqtnJTE+2Cuz5Iu9ZnB4L8wtgOXQQ8ZA8t3WzUuOpC8X4da2gT2zq8/8uhqRmlc 2gWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b="RHn4+/1V"; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-79567-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79567-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ca12-20020a056a02068c00b005d8c245c500si754073pgb.397.2024.02.24.02.31.44 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 02:31:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79567-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b="RHn4+/1V"; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-79567-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79567-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 433BD283B8E for <ouuuleilei@gmail.com>; Sat, 24 Feb 2024 10:31:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2FDD14AA1; Sat, 24 Feb 2024 10:31:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="RHn4+/1V" Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 558D824B26 for <linux-kernel@vger.kernel.org>; Sat, 24 Feb 2024 10:31:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.252 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708770690; cv=none; b=A0VVjN+LMqmxBwgoYjIQomBI9KBl/zYNlqCV83sDXo7E5C9TYj/YjG2uDTHB0dhfqczaLClaRaIyLBSBClbuxCM+x444NUlnRfGDLjFZRI15EKZh02kKQm0SJhRQe5NtuYGv4bwGj2ugbPkN16ObGfSfM97bNiiTKJeI5+240aE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708770690; c=relaxed/simple; bh=FKVmx7HpE2ep54ZS8eZHiCvcg/1cKYk/1oKsrQ+s+sU=; h=Message-ID:From:To:Cc:Subject:Date:MIME-Version; b=DmD9XYqlqd7xvl8OaSFWQBOwsEdNR2IuqyoG+hQ8uVzXv87bko+vVesNoZhkYQu7vy+jvWibkAjMT2J3+V6jZpZLg4+QKgiyoDcjYvZ5B4w4SN/4u1Z+OInngLdGMan5umdVX5xaKzTaXKFDg6SnTRq7XxLceYPvjxmPcrdDpHo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=RHn4+/1V; arc=none smtp.client-ip=162.62.57.252 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1708770677; bh=JakpM4UpT9WYC+dBrABZ4HnlbAhvwlK1yGteAKNIH+E=; h=From:To:Cc:Subject:Date; b=RHn4+/1VRcSuRNSzoSiK5n9BFOpFwsJEjc6KpepWMwoTPSKO5jiRMO2wjIUPrO2Bw wpAPIcvcd/YKZbHpH8IY423LoBRcBCqNJf6gIHMbW5vNvxW+yXYa/eUKDxC3E+VCQ/ 9O11Aufdogy4FKHLIwaHkayJ6Xs/AP2spcC/F/DY= Received: from localhost.localdomain ([153.3.164.50]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id 7861CABA; Sat, 24 Feb 2024 18:30:06 +0800 X-QQ-mid: xmsmtpt1708770606tm0ddc59u Message-ID: <tencent_088804E150842691191FD0021AEE8649EB0A@qq.com> X-QQ-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Vp+SPm3vtS1Vd6Y4Mggwc= From: linke li <lilinke99@qq.com> To: Cc: lilinke99@qq.com, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] uprobes: use READ_ONCE() to read mm->uprobes_state.xol_area in concurrent environment Date: Sat, 24 Feb 2024 18:25:19 +0800 X-OQ-MSGID: <20240224102519.19874-1-lilinke99@qq.com> X-Mailer: git-send-email 2.39.3 (Apple Git-145) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791775950552797405 X-GMAIL-MSGID: 1791775950552797405 |
Series |
uprobes: use READ_ONCE() to read mm->uprobes_state.xol_area in concurrent environment
|
|
Commit Message
linke li
Feb. 24, 2024, 10:25 a.m. UTC
In function get_xol_area(), mm->uprobes_state.xol_area is read using
READ_ONCE() in line 1534
1534 area = READ_ONCE(mm->uprobes_state.xol_area); /* ^^^ */
while read directly in line 1530
1530 if (!mm->uprobes_state.xol_area)
1531 __create_xol_area(0);
In the same environment, reads in two places should have the same
protection.
Signed-off-by: linke li <lilinke99@qq.com>
---
kernel/events/uprobes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 929e98c62965..e110941fbc6b 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1527,7 +1527,7 @@ static struct xol_area *get_xol_area(void) struct mm_struct *mm = current->mm; struct xol_area *area; - if (!mm->uprobes_state.xol_area) + if (!READ_ONCE(mm->uprobes_state.xol_area)) __create_xol_area(0); /* Pairs with xol_add_vma() smp_store_release() */