From patchwork Tue Sep 20 18:58:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 12982517 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C6ABC54EE9 for ; Tue, 20 Sep 2022 18:58:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 23CC9940007; Tue, 20 Sep 2022 14:58:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EBA26B0073; Tue, 20 Sep 2022 14:58:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B432940007; Tue, 20 Sep 2022 14:58:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id ED1026B0072 for ; Tue, 20 Sep 2022 14:58:14 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B176F140B99 for ; Tue, 20 Sep 2022 18:58:14 +0000 (UTC) X-FDA: 79933374108.23.DD5FCB1 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf02.hostedemail.com (Postfix) with ESMTP id 3C1D780006 for ; Tue, 20 Sep 2022 18:58:14 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1663700291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nxHRTq1Yg5oxG8+GRDFsDxq7DRLYMtQhvc5Xaz+eRBo=; b=GnIONQpnE3duZHvOo+5gN7TANSJ5algfnUTlz4osbwGz6JHamLMPEVM23h6esM+h9+qHKa bCpDoOnA4Dmx37fBZ3d+147FVKjbz/I9acSA5E2aK4bqIOFNJCgL7eoQP6jpQoccG3JKSr Z+2DWjvy9TxuyxxjqN1Hw/+elcqw0wk= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, linux-mm@kvack.org, Yu Zhao , linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm] kasan: initialize read-write lock in stack ring Date: Tue, 20 Sep 2022 20:58:07 +0200 Message-Id: <576182d194e27531e8090bad809e4136953895f4.1663700262.git.andreyknvl@google.com> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663700294; a=rsa-sha256; cv=none; b=wkxXx+ufmKMmx0caJV1HSTwLAm7cJGFMwscfSjYmdoMpYUrCmAC0n1DiFpqN9d9cLbRVim S6uQRfL6oltRjE7Fv2YW541w3KLO/VJroRH09ycV9lmzrM8W8bEf477Tg+nXfrLKpzgckv eddoojPnHhFlLK69aYq8/NfPrwEGRBg= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=GnIONQpn; spf=pass (imf02.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663700294; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=nxHRTq1Yg5oxG8+GRDFsDxq7DRLYMtQhvc5Xaz+eRBo=; b=o6fuGkmlxG7q/0s9wpP/N8zmQfJMA0BU2DqVnsLgxaxQ51ljlPKwUOOrS+N/Kbwuo7JoC1 I091kpeXLXc417iYAKVXvEpcHq+kp/X18pVuMv9U1bXfI+1/nlJnk633UOsChXjIcu0tk8 hdLLNxWb2vfhPUF/MrXAlSOMI25V3z0= X-Stat-Signature: aarhj3gg3kg7ygkcmst1koji1i1j9j5g X-Rspamd-Queue-Id: 3C1D780006 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=GnIONQpn; spf=pass (imf02.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1663700294-16150 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Andrey Konovalov Use __RW_LOCK_UNLOCKED to initialize stack_ring.lock. Reported-by: Yu Zhao Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Tested-by: Yu Zhao --- Andrew, could you please fold this patch into: "kasan: implement stack ring for tag-based modes". --- mm/kasan/tags.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c index 9d867cae1b7b..67a222586846 100644 --- a/mm/kasan/tags.c +++ b/mm/kasan/tags.c @@ -36,7 +36,9 @@ DEFINE_STATIC_KEY_TRUE(kasan_flag_stacktrace); /* Non-zero, as initial pointer values are 0. */ #define STACK_RING_BUSY_PTR ((void *)1) -struct kasan_stack_ring stack_ring; +struct kasan_stack_ring stack_ring = { + .lock = __RW_LOCK_UNLOCKED(stack_ring.lock) +}; /* kasan.stacktrace=off/on */ static int __init early_kasan_flag_stacktrace(char *arg)