From nobody Tue Nov 26 09:36:55 2024 Received: from zg8tmja2lje4os43os4xodqa.icoremail.net (zg8tmja2lje4os43os4xodqa.icoremail.net [206.189.79.184]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90188185B5F; Sat, 19 Oct 2024 06:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=206.189.79.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729319002; cv=none; b=hADZq4nIqVib9+pB4gbcyFbTrhCZpQkQglh9TUd3ZVDxJuA75rCmmLfzAsoGzXa7dIWFfcuFR4CQVR4dgSBRpDufaZ3BQ4T9/fqeJJd8e8OmeLcH6q5kiSLcDzKD0AwMzz97a9DWTQMpfemB/RbPhjRV3lcGK5ODv8zzeX5H/Cg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729319002; c=relaxed/simple; bh=KbR6O17vssnyHsX99yYmUs0FpIqH/9OBgl/rNzkEKvo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=l+bvUzGOg3dXIWpJ/h48yUJrJqySAAIfPOEZtJHgpiCx5lw6ahHox2CmGMQ87MzDks5Ff28fbBiyz0JbpwdiAW4QjrpOtdFxZ5a3yMHO3LuIb+PqqRvosrY/pBeuoVuYW14pS+vT7zALBytIaaD318ETyGvq4lONXdESachCDMM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hust.edu.cn; spf=pass smtp.mailfrom=hust.edu.cn; arc=none smtp.client-ip=206.189.79.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hust.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hust.edu.cn Received: from hust.edu.cn (unknown [172.16.0.50]) by app2 (Coremail) with SMTP id HwEQrAAXH889UBNnPhgaAQ--.19299S2; Sat, 19 Oct 2024 14:22:53 +0800 (CST) Received: from russ.localdomain (unknown [10.12.177.116]) by gateway (Coremail) with SMTP id _____wC3wEE3UBNnIcJtAA--.61837S2; Sat, 19 Oct 2024 14:22:48 +0800 (CST) From: Haoyang Liu To: Alex Shi , Yanteng Si , Jonathan Corbet , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: hust-os-kernel-patches@googlegroups.com, Haoyang Liu , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v2] docs/zh_CN: add translation of dev-tools/kmsan.rst Date: Sat, 19 Oct 2024 22:22:41 +0800 Message-ID: <20241019142243.88712-1-tttturtleruss@hust.edu.cn> X-Mailer: git-send-email 2.47.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: HwEQrAAXH889UBNnPhgaAQ--.19299S2 Authentication-Results: app2; spf=neutral smtp.mail=tttturtleruss@hust .edu.cn; X-Coremail-Antispam: 1UD129KBjvAXoW3ur17Jw1rKw13ZFyfAw48tFb_yoW8CFy8Wo WFkFZ8u3Z3Jw15JFyrCa17JFyDCr4fCrsxJ3Wakwn8ZryUGw4Fq3Z5tw43Jw45ArZ8Kasx J3WrtF1xA3Wqqasrn29KB7ZKAUJUUUUf529EdanIXcx71UUUUU7v73VFW2AGmfu7bjvjm3 AaLaJ3UjIYCTnIWjp_UUUOm7k0a2IF6FyUM7kC6x804xWl1xkIjI8I6I8E6xAIw20EY4v2 0xvaj40_Wr0E3s1l87I20VAvwVAaII0Ic2I_JFv_Gryl8cAvFVAK0II2c7xJM28CjxkF64 kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY 1x0267AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7 CjxVAFwI0_GcCE3s1ln4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF 6xkI12xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj64x0Y40En7xvr7 AKxVW8Jr0_Cr1UMcIj6x8ErcxFaVAv8VW8uFyUJr1UMcIj6xkF7I0En7xvr7AKxVW8Jr0_ Cr1UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262kKe7AKxVWUtV W8ZwCF04k20xvY0x0EwIxGrwCF04k20xvE74AGY7Cv6cx26r4fZr1UJr1l4I8I3I0E4IkC 6x0Yz7v_Jr0_Gr1l4IxYO2xFxVAFwI0_JF0_Jw1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s 026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF 0xvE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0x vE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv 6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUhwZ2DUUUU X-CM-SenderInfo: rxsqjiqrssiko6kx23oohg3hdfq/1tbiAQYPAmcTK8EMEQAAsJ Add translation of kmsan.rst and remove it from TODO list. update to commit 3f53d1b4a4d2 ("docs/dev-tools: fix a typo") Signed-off-by: Haoyang Liu Reviewed-by: Alex Shi Reviewed-by: Yanteng Si --- v1 -> v2: fix incorrect translations .../translations/zh_CN/dev-tools/index.rst | 2 +- .../translations/zh_CN/dev-tools/kmsan.rst | 392 ++++++++++++++++++ 2 files changed, 393 insertions(+), 1 deletion(-) create mode 100644 Documentation/translations/zh_CN/dev-tools/kmsan.rst diff --git a/Documentation/translations/zh_CN/dev-tools/index.rst b/Documen= tation/translations/zh_CN/dev-tools/index.rst index 6a8c637c0be1..7b37194217b0 100644 --- a/Documentation/translations/zh_CN/dev-tools/index.rst +++ b/Documentation/translations/zh_CN/dev-tools/index.rst @@ -22,6 +22,7 @@ Documentation/translations/zh_CN/dev-tools/testing-overvi= ew.rst sparse kcov kcsan + kmsan gcov kasan ubsan @@ -32,7 +33,6 @@ Todolist: =20 - checkpatch - coccinelle - - kmsan - kfence - kgdb - kselftest diff --git a/Documentation/translations/zh_CN/dev-tools/kmsan.rst b/Documen= tation/translations/zh_CN/dev-tools/kmsan.rst new file mode 100644 index 000000000000..80da60cb340e --- /dev/null +++ b/Documentation/translations/zh_CN/dev-tools/kmsan.rst @@ -0,0 +1,392 @@ +.. SPDX-License-Identifier: GPL-2.0 + +.. include:: ../disclaimer-zh_CN.rst + +:Original: Documentation/dev-tools/kmsan.rst +:Translator: =E5=88=98=E6=B5=A9=E9=98=B3 Haoyang Liu + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +=E5=86=85=E6=A0=B8=E5=86=85=E5=AD=98=E6=B6=88=E6=AF=92=E5=89=82=EF=BC=88KM= SAN=EF=BC=89 +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +KMSAN =E6=98=AF=E4=B8=80=E4=B8=AA=E5=8A=A8=E6=80=81=E9=94=99=E8=AF=AF=E6= =A3=80=E6=B5=8B=E5=99=A8=EF=BC=8C=E6=97=A8=E5=9C=A8=E6=9F=A5=E6=89=BE=E6=9C= =AA=E5=88=9D=E5=A7=8B=E5=8C=96=E5=80=BC=E7=9A=84=E4=BD=BF=E7=94=A8=E3=80=82= =E5=AE=83=E5=9F=BA=E4=BA=8E=E7=BC=96=E8=AF=91=E5=99=A8=E6=8F=92=E6=A1=A9=EF= =BC=8C=E7=B1=BB=E4=BC=BC=E4=BA=8E=E7=94=A8 +=E6=88=B7=E7=A9=BA=E9=97=B4=E7=9A=84 `MemorySanitizer tool`_=E3=80=82 + +=E9=9C=80=E8=A6=81=E6=B3=A8=E6=84=8F=E7=9A=84=E6=98=AF KMSAN =E5=B9=B6=E4= =B8=8D=E9=80=82=E5=90=88=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83=EF=BC=8C=E5=9B= =A0=E4=B8=BA=E5=AE=83=E4=BC=9A=E5=A4=A7=E5=B9=85=E5=A2=9E=E5=8A=A0=E5=86=85= =E6=A0=B8=E5=86=85=E5=AD=98=E5=8D=A0=E7=94=A8=E5=B9=B6=E9=99=8D=E4=BD=8E=E7= =B3=BB=E7=BB=9F=E8=BF=90=E8=A1=8C=E9=80=9F=E5=BA=A6=E3=80=82 + +=E4=BD=BF=E7=94=A8=E6=96=B9=E6=B3=95 +=3D=3D=3D=3D=3D=3D=3D=3D + +=E6=9E=84=E5=BB=BA=E5=86=85=E6=A0=B8 +-------- + +=E8=A6=81=E6=9E=84=E5=BB=BA=E5=B8=A6=E6=9C=89 KMSAN =E7=9A=84=E5=86=85=E6= =A0=B8=EF=BC=8C=E4=BD=A0=E9=9C=80=E8=A6=81=E4=B8=80=E4=B8=AA=E8=BE=83=E6=96= =B0=E7=9A=84 Clang (14.0.6+)=E3=80=82 +=E8=AF=B7=E5=8F=82=E9=98=85 `LLVM documentation`_ =E4=BA=86=E8=A7=A3=E5=A6= =82=E4=BD=95=E6=9E=84=E5=BB=BA Clang=E3=80=82 + +=E7=8E=B0=E5=9C=A8=E9=85=8D=E7=BD=AE=E5=B9=B6=E6=9E=84=E5=BB=BA=E4=B8=80= =E4=B8=AA=E5=90=AF=E7=94=A8 CONFIG_KMSAN =E7=9A=84=E5=86=85=E6=A0=B8=E3=80= =82 + +=E7=A4=BA=E4=BE=8B=E6=8A=A5=E5=91=8A +-------- + +=E4=BB=A5=E4=B8=8B=E6=98=AF=E4=B8=80=E4=B8=AA KMSAN =E6=8A=A5=E5=91=8A=E7= =9A=84=E7=A4=BA=E4=BE=8B:: + + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D + BUG: KMSAN: uninit-value in test_uninit_kmsan_check_memory+0x1be/0x380 [= kmsan_test] + test_uninit_kmsan_check_memory+0x1be/0x380 mm/kmsan/kmsan_test.c:273 + kunit_run_case_internal lib/kunit/test.c:333 + kunit_try_run_case+0x206/0x420 lib/kunit/test.c:374 + kunit_generic_run_threadfn_adapter+0x6d/0xc0 lib/kunit/try-catch.c:28 + kthread+0x721/0x850 kernel/kthread.c:327 + ret_from_fork+0x1f/0x30 ??:? + + Uninit was stored to memory at: + do_uninit_local_array+0xfa/0x110 mm/kmsan/kmsan_test.c:260 + test_uninit_kmsan_check_memory+0x1a2/0x380 mm/kmsan/kmsan_test.c:271 + kunit_run_case_internal lib/kunit/test.c:333 + kunit_try_run_case+0x206/0x420 lib/kunit/test.c:374 + kunit_generic_run_threadfn_adapter+0x6d/0xc0 lib/kunit/try-catch.c:28 + kthread+0x721/0x850 kernel/kthread.c:327 + ret_from_fork+0x1f/0x30 ??:? + + Local variable uninit created at: + do_uninit_local_array+0x4a/0x110 mm/kmsan/kmsan_test.c:256 + test_uninit_kmsan_check_memory+0x1a2/0x380 mm/kmsan/kmsan_test.c:271 + + Bytes 4-7 of 8 are uninitialized + Memory access of size 8 starts at ffff888083fe3da0 + + CPU: 0 PID: 6731 Comm: kunit_try_catch Tainted: G B E 5.16.= 0-rc3+ #104 + Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/= 01/2014 + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D + +=E6=8A=A5=E5=91=8A=E6=8C=87=E5=87=BA=E6=9C=AC=E5=9C=B0=E5=8F=98=E9=87=8F `= `uninit`` =E5=9C=A8 ``do_uninit_local_array()`` =E4=B8=AD=E6=9C=AA=E5=88=9D= =E5=A7=8B=E5=8C=96=E3=80=82 +=E7=AC=AC=E4=B8=89=E4=B8=AA=E5=A0=86=E6=A0=88=E8=B7=9F=E8=B8=AA=E5=AF=B9= =E5=BA=94=E4=BA=8E=E8=AF=A5=E5=8F=98=E9=87=8F=E5=88=9B=E5=BB=BA=E7=9A=84=E4= =BD=8D=E7=BD=AE=E3=80=82 + +=E7=AC=AC=E4=B8=80=E4=B8=AA=E5=A0=86=E6=A0=88=E8=B7=9F=E8=B8=AA=E6=98=BE= =E7=A4=BA=E4=BA=86=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E5=80=BC=E7=9A=84=E4= =BD=BF=E7=94=A8=E4=BD=8D=E7=BD=AE=EF=BC=88=E5=9C=A8 +``test_uninit_kmsan_check_memory()``=EF=BC=89=E3=80=82 +=E5=B7=A5=E5=85=B7=E6=98=BE=E7=A4=BA=E4=BA=86=E5=B1=80=E9=83=A8=E5=8F=98= =E9=87=8F=E4=B8=AD=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84=E5=AD=97=E8= =8A=82=E5=8F=8A=E5=85=B6=E8=A2=AB=E5=A4=8D=E5=88=B6=E5=88=B0=E5=85=B6=E4=BB= =96=E5=86=85=E5=AD=98=E4=BD=8D=E7=BD=AE=E5=89=8D=E7=9A=84=E5=A0=86=E6=A0=88= =E3=80=82 + +KMSAN =E4=BC=9A=E5=9C=A8=E4=BB=A5=E4=B8=8B=E6=83=85=E5=86=B5=E4=B8=8B=E6= =8A=A5=E5=91=8A=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84=E5=80=BC ``v``: + + - =E5=9C=A8=E6=9D=A1=E4=BB=B6=E5=88=A4=E6=96=AD=E4=B8=AD=EF=BC=8C=E4=BE= =8B=E5=A6=82 ``if (v) { ... }``=EF=BC=9B + - =E5=9C=A8=E7=B4=A2=E5=BC=95=E6=88=96=E6=8C=87=E9=92=88=E8=A7=A3=E5=BC= =95=E7=94=A8=E4=B8=AD=EF=BC=8C=E4=BE=8B=E5=A6=82 ``array[v]`` =E6=88=96 ``*= v``=EF=BC=9B + - =E5=BD=93=E5=AE=83=E8=A2=AB=E5=A4=8D=E5=88=B6=E5=88=B0=E7=94=A8=E6=88= =B7=E7=A9=BA=E9=97=B4=E6=88=96=E7=A1=AC=E4=BB=B6=E6=97=B6=EF=BC=8C=E4=BE=8B= =E5=A6=82 ``copy_to_user(..., &v, ...)``=EF=BC=9B + - =E5=BD=93=E5=AE=83=E4=BD=9C=E4=B8=BA=E5=87=BD=E6=95=B0=E5=8F=82=E6=95= =B0=E4=BC=A0=E9=80=92=EF=BC=8C=E5=B9=B6=E4=B8=94=E5=90=AF=E7=94=A8 ``CONFIG= _KMSAN_CHECK_PARAM_RETVAL`` =E6=97=B6=EF=BC=88=E8=A7=81=E4=B8=8B=E6=96=87= =EF=BC=89=E3=80=82 + +=E8=BF=99=E4=BA=9B=E6=83=85=E5=86=B5=EF=BC=88=E9=99=A4=E4=BA=86=E5=A4=8D= =E5=88=B6=E6=95=B0=E6=8D=AE=E5=88=B0=E7=94=A8=E6=88=B7=E7=A9=BA=E9=97=B4=E6= =88=96=E7=A1=AC=E4=BB=B6=E5=A4=96=EF=BC=8C=E8=BF=99=E6=98=AF=E4=B8=80=E4=B8= =AA=E5=AE=89=E5=85=A8=E9=97=AE=E9=A2=98=EF=BC=89=E8=A2=AB=E8=A7=86=E4=B8=BA= C11 =E6=A0=87=E5=87=86=E4=B8=8B=E7=9A=84=E6=9C=AA=E5=AE=9A=E4=B9=89=E8=A1= =8C=E4=B8=BA=E3=80=82 + +=E7=A6=81=E7=94=A8=E6=8F=92=E6=A1=A9 +-------- + +=E5=8F=AF=E4=BB=A5=E7=94=A8 ``__no_kmsan_checks`` =E6=A0=87=E8=AE=B0=E5=87= =BD=E6=95=B0=E3=80=82=E8=BF=99=E6=A0=B7=EF=BC=8CKMSAN =E4=BC=9A=E5=BF=BD=E7= =95=A5=E8=AF=A5=E5=87=BD=E6=95=B0=E4=B8=AD=E7=9A=84=E6=9C=AA=E5=88=9D=E5=A7= =8B=E5=8C=96=E5=80=BC=EF=BC=8C +=E5=B9=B6=E5=B0=86=E5=85=B6=E8=BE=93=E5=87=BA=E6=A0=87=E8=AE=B0=E4=B8=BA= =E5=B7=B2=E5=88=9D=E5=A7=8B=E5=8C=96=E3=80=82=E5=A6=82=E6=AD=A4=EF=BC=8C=E7= =94=A8=E6=88=B7=E4=B8=8D=E4=BC=9A=E6=94=B6=E5=88=B0=E4=B8=8E=E8=AF=A5=E5=87= =BD=E6=95=B0=E7=9B=B8=E5=85=B3=E7=9A=84 KMSAN =E6=8A=A5=E5=91=8A=E3=80=82 + +KMSAN =E8=BF=98=E6=94=AF=E6=8C=81 ``__no_sanitize_memory`` =E5=87=BD=E6=95= =B0=E5=B1=9E=E6=80=A7=E3=80=82KMSAN =E4=B8=8D=E4=BC=9A=E5=AF=B9=E6=8B=A5=E6= =9C=89=E8=AF=A5=E5=B1=9E=E6=80=A7=E7=9A=84=E5=87=BD=E6=95=B0=E8=BF=9B=E8=A1= =8C +=E6=8F=92=E6=A1=A9=EF=BC=8C=E8=BF=99=E5=9C=A8=E6=88=91=E4=BB=AC=E4=B8=8D= =E5=B8=8C=E6=9C=9B=E7=BC=96=E8=AF=91=E5=99=A8=E5=B9=B2=E6=89=B0=E6=9F=90=E4= =BA=9B=E5=BA=95=E5=B1=82=E4=BB=A3=E7=A0=81=EF=BC=88=E4=BE=8B=E5=A6=82=E6=A0= =87=E8=AE=B0=E4=B8=BA ``noinstr`` =E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C=E8= =AF=A5 +=E4=BB=A3=E7=A0=81=E9=9A=90=E5=BC=8F=E6=B7=BB=E5=8A=A0=E4=BA=86 ``__no_san= itize_memory``=EF=BC=89=E6=97=B6=E5=8F=AF=E8=83=BD=E5=BE=88=E6=9C=89=E7=94= =A8=E3=80=82 + +=E7=84=B6=E8=80=8C=EF=BC=8C=E8=BF=99=E4=BC=9A=E6=9C=89=E4=BB=A3=E4=BB=B7= =EF=BC=9A=E6=AD=A4=E7=B1=BB=E5=87=BD=E6=95=B0=E7=9A=84=E6=A0=88=E5=88=86=E9= =85=8D=E5=B0=86=E5=85=B7=E6=9C=89=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E5=BD= =B1=E5=AD=90/=E5=88=9D=E5=A7=8B=E5=80=BC=EF=BC=8C=E5=8F=AF=E8=83=BD=E5=AF= =BC=E8=87=B4=E8=AF=AF=E6=8A=A5=E3=80=82=E6=9D=A5 +=E8=87=AA=E9=9D=9E=E6=8F=92=E6=A1=A9=E4=BB=A3=E7=A0=81=E7=9A=84=E5=87=BD= =E6=95=B0=E4=B9=9F=E5=8F=AF=E8=83=BD=E6=8E=A5=E6=94=B6=E5=88=B0=E4=B8=8D=E6= =AD=A3=E7=A1=AE=E7=9A=84=E5=85=83=E6=95=B0=E6=8D=AE=E3=80=82 + + +=E4=BD=9C=E4=B8=BA=E7=BB=8F=E9=AA=8C=E4=B9=8B=E8=B0=88=EF=BC=8C=E9=81=BF= =E5=85=8D=E6=98=BE=E5=BC=8F=E4=BD=BF=E7=94=A8 ``__no_sanitize_memory``=E3= =80=82 + +=E4=B9=9F=E5=8F=AF=E4=BB=A5=E9=80=9A=E8=BF=87 Makefile =E7=A6=81=E7=94=A8 = KMSAN =E5=AF=B9=E6=9F=90=E4=B8=AA=E6=96=87=E4=BB=B6=EF=BC=88=E4=BE=8B=E5=A6= =82 main.o=EF=BC=89=E7=9A=84=E4=BD=9C=E7=94=A8:: + + KMSAN_SANITIZE_main.o :=3D n + +=E6=88=96=E8=80=85=E5=AF=B9=E6=95=B4=E4=B8=AA=E7=9B=AE=E5=BD=95:: + + KMSAN_SANITIZE :=3D n + +=E5=B0=86=E5=85=B6=E5=BA=94=E7=94=A8=E5=88=B0=E6=96=87=E4=BB=B6=E6=88=96= =E7=9B=AE=E5=BD=95=E4=B8=AD=E7=9A=84=E6=AF=8F=E4=B8=AA=E5=87=BD=E6=95=B0=E3= =80=82=E5=A4=A7=E5=A4=9A=E6=95=B0=E7=94=A8=E6=88=B7=E4=B8=8D=E4=BC=9A=E9=9C= =80=E8=A6=81 KMSAN_SANITIZE=EF=BC=8C +=E9=99=A4=E9=9D=9E=E4=BB=96=E4=BB=AC=E7=9A=84=E4=BB=A3=E7=A0=81=E8=A2=AB K= MSAN =E7=A0=B4=E5=9D=8F=EF=BC=88=E4=BE=8B=E5=A6=82=E5=9C=A8=E6=97=A9=E6=9C= =9F=E5=90=AF=E5=8A=A8=E6=97=B6=E8=BF=90=E8=A1=8C=E7=9A=84=E4=BB=A3=E7=A0=81= =EF=BC=89=E3=80=82 + +=E8=BF=98=E5=8F=AF=E4=BB=A5=E9=80=9A=E8=BF=87=E8=B0=83=E7=94=A8 ``kmsan_di= sable_current()`` =E5=92=8C ``kmsan_enable_current()`` +=E6=9A=82=E6=97=B6=E5=AF=B9=E5=BD=93=E5=89=8D=E4=BB=BB=E5=8A=A1=E7=A6=81= =E7=94=A8 KMSAN =E6=A3=80=E6=9F=A5=E3=80=82=E6=AF=8F=E4=B8=AA ``kmsan_enabl= e_current()`` =E5=BF=85=E9=A1=BB=E5=9C=A8 +``kmsan_disable_current()`` =E4=B9=8B=E5=90=8E=E8=B0=83=E7=94=A8=EF=BC=9B= =E8=BF=99=E4=BA=9B=E8=B0=83=E7=94=A8=E5=AF=B9=E5=8F=AF=E4=BB=A5=E5=B5=8C=E5= =A5=97=E3=80=82=E5=9C=A8=E8=B0=83=E7=94=A8=E6=97=B6=E9=9C=80=E8=A6=81=E6=B3= =A8=E6=84=8F=E4=BF=9D=E6=8C=81 +=E5=B5=8C=E5=A5=97=E5=8C=BA=E5=9F=9F=E7=AE=80=E7=9F=AD=EF=BC=8C=E5=B9=B6= =E4=B8=94=E5=B0=BD=E5=8F=AF=E8=83=BD=E4=BD=BF=E7=94=A8=E5=85=B6=E4=BB=96=E6= =96=B9=E6=B3=95=E7=A6=81=E7=94=A8=E6=8F=92=E6=A1=A9=E3=80=82 + +=E6=94=AF=E6=8C=81 +=3D=3D=3D=3D + +=E4=B8=BA=E4=BA=86=E4=BD=BF=E7=94=A8 KMSAN=EF=BC=8C=E5=86=85=E6=A0=B8=E5= =BF=85=E9=A1=BB=E4=BD=BF=E7=94=A8 Clang =E6=9E=84=E5=BB=BA=EF=BC=8C=E5=88= =B0=E7=9B=AE=E5=89=8D=E4=B8=BA=E6=AD=A2=EF=BC=8CClang =E6=98=AF=E5=94=AF=E4= =B8=80=E6=94=AF=E6=8C=81 KMSAN +=E7=9A=84=E7=BC=96=E8=AF=91=E5=99=A8=E3=80=82=E5=86=85=E6=A0=B8=E6=8F=92= =E6=A1=A9=E8=BF=87=E7=A8=8B=E5=9F=BA=E4=BA=8E=E7=94=A8=E6=88=B7=E7=A9=BA=E9= =97=B4=E7=9A=84 `MemorySanitizer tool`_=E3=80=82 + +=E7=9B=AE=E5=89=8D=E8=BF=90=E8=A1=8C=E6=97=B6=E5=BA=93=E4=BB=85=E6=94=AF= =E6=8C=81 x86_64 =E6=9E=B6=E6=9E=84=E3=80=82 + +KMSAN =E7=9A=84=E5=B7=A5=E4=BD=9C=E5=8E=9F=E7=90=86 +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +KMSAN =E9=98=B4=E5=BD=B1=E5=86=85=E5=AD=98 +-------------- + +KMSAN =E5=B0=86=E4=B8=80=E4=B8=AA=E5=85=83=E6=95=B0=E6=8D=AE=E5=AD=97=E8= =8A=82=EF=BC=88=E4=B9=9F=E7=A7=B0=E4=B8=BA=E9=98=B4=E5=BD=B1=E5=AD=97=E8=8A= =82=EF=BC=89=E4=B8=8E=E6=AF=8F=E4=B8=AA=E5=86=85=E6=A0=B8=E5=86=85=E5=AD=98= =E5=AD=97=E8=8A=82=E5=85=B3=E8=81=94=E3=80=82=E4=BB=85=E5=BD=93=E5=86=85=E6= =A0=B8=E5=86=85=E5=AD=98=E5=AD=97=E8=8A=82 +=E7=9A=84=E7=9B=B8=E5=BA=94=E4=BD=8D=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96= =E6=97=B6=EF=BC=8C=E9=98=B4=E5=BD=B1=E5=AD=97=E8=8A=82=E4=B8=AD=E7=9A=84=E4= =B8=80=E4=B8=AA=E6=AF=94=E7=89=B9=E4=BD=8D=E6=89=8D=E4=BC=9A=E8=A2=AB=E8=AE= =BE=E7=BD=AE=E3=80=82=E5=B0=86=E5=86=85=E5=AD=98=E6=A0=87=E8=AE=B0=E4=B8=BA= =E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=88=E5=8D=B3 +=E5=B0=86=E5=85=B6=E9=98=B4=E5=BD=B1=E5=AD=97=E8=8A=82=E8=AE=BE=E7=BD=AE= =E4=B8=BA ``0xff``=EF=BC=89=E7=A7=B0=E4=B8=BA=E4=B8=AD=E6=AF=92=EF=BC=8C=E5= =B0=86=E5=85=B6=E6=A0=87=E8=AE=B0=E4=B8=BA=E5=B7=B2=E5=88=9D=E5=A7=8B=E5=8C= =96=EF=BC=88=E5=B0=86=E9=98=B4=E5=BD=B1=E5=AD=97=E8=8A=82=E8=AE=BE=E7=BD=AE= =E4=B8=BA +``0x00``=EF=BC=89=E7=A7=B0=E4=B8=BA=E8=A7=A3=E6=AF=92=E3=80=82 + +=E5=BD=93=E5=9C=A8=E6=A0=88=E4=B8=8A=E5=88=86=E9=85=8D=E6=96=B0=E5=8F=98= =E9=87=8F=E6=97=B6=EF=BC=8C=E9=BB=98=E8=AE=A4=E6=83=85=E5=86=B5=E4=B8=8B=E5= =AE=83=E4=BC=9A=E4=B8=AD=E6=AF=92=EF=BC=8C=E8=BF=99=E7=94=B1=E7=BC=96=E8=AF= =91=E5=99=A8=E6=8F=92=E5=85=A5=E7=9A=84=E6=8F=92=E6=A1=A9=E4=BB=A3=E7=A0=81= =E5=AE=8C=E6=88=90=EF=BC=88=E9=99=A4=E9=9D=9E=E5=AE=83 +=E6=98=AF=E7=AB=8B=E5=8D=B3=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84=E6=A0=88= =E5=8F=98=E9=87=8F=EF=BC=89=E3=80=82=E4=BB=BB=E4=BD=95=E6=9C=AA=E4=BD=BF=E7= =94=A8 ``__GFP_ZERO`` =E7=9A=84=E5=A0=86=E5=88=86=E9=85=8D=E4=B9=9F=E4=BC= =9A=E4=B8=AD=E6=AF=92=E3=80=82 + +=E7=BC=96=E8=AF=91=E5=99=A8=E6=8F=92=E6=A1=A9=E8=BF=98=E8=B7=9F=E8=B8=AA= =E9=98=B4=E5=BD=B1=E5=80=BC=E5=9C=A8=E4=BB=A3=E7=A0=81=E4=B8=AD=E7=9A=84=E4= =BD=BF=E7=94=A8=E3=80=82=E5=BD=93=E9=9C=80=E8=A6=81=E6=97=B6=EF=BC=8C=E6=8F= =92=E6=A1=A9=E4=BB=A3=E7=A0=81=E4=BC=9A=E8=B0=83=E7=94=A8 ``mm/kmsan/`` =E4= =B8=AD +=E7=9A=84=E8=BF=90=E8=A1=8C=E6=97=B6=E5=BA=93=E4=BB=A5=E6=8C=81=E4=B9=85= =E5=8C=96=E9=98=B4=E5=BD=B1=E5=80=BC=E3=80=82 + +=E5=9F=BA=E6=9C=AC=E6=88=96=E5=A4=8D=E5=90=88=E7=B1=BB=E5=9E=8B=E7=9A=84= =E9=98=B4=E5=BD=B1=E5=80=BC=E6=98=AF=E9=95=BF=E5=BA=A6=E7=9B=B8=E5=90=8C=E7= =9A=84=E5=AD=97=E8=8A=82=E6=95=B0=E7=BB=84=E3=80=82=E5=BD=93=E5=B8=B8=E9=87= =8F=E5=80=BC=E5=86=99=E5=85=A5=E5=86=85=E5=AD=98=E6=97=B6=EF=BC=8C=E8=AF=A5= =E5=86=85=E5=AD=98=E4=BC=9A=E8=A2=AB=E8=A7=A3=E6=AF=92 +=E3=80=82=E5=BD=93=E4=BB=8E=E5=86=85=E5=AD=98=E8=AF=BB=E5=8F=96=E5=80=BC= =E6=97=B6=EF=BC=8C=E5=85=B6=E9=98=B4=E5=BD=B1=E5=86=85=E5=AD=98=E4=B9=9F=E4= =BC=9A=E8=A2=AB=E8=8E=B7=E5=8F=96=EF=BC=8C=E5=B9=B6=E4=BC=A0=E9=80=92=E5=88= =B0=E6=89=80=E6=9C=89=E4=BD=BF=E7=94=A8=E8=AF=A5=E5=80=BC=E7=9A=84=E6=93=8D= =E4=BD=9C=E4=B8=AD=E3=80=82=E5=AF=B9=E4=BA=8E=E6=AF=8F +=E4=B8=AA=E9=9C=80=E8=A6=81=E4=B8=80=E4=B8=AA=E6=88=96=E5=A4=9A=E4=B8=AA= =E5=80=BC=E7=9A=84=E6=8C=87=E4=BB=A4=EF=BC=8C=E7=BC=96=E8=AF=91=E5=99=A8=E4= =BC=9A=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81=E6=A0=B9=E6=8D=AE=E8=BF=99=E4=BA= =9B=E5=80=BC=E5=8F=8A=E5=85=B6=E9=98=B4=E5=BD=B1=E6=9D=A5=E8=AE=A1=E7=AE=97= =E7=BB=93=E6=9E=9C=E7=9A=84=E9=98=B4=E5=BD=B1=E3=80=82 + + +=E7=A4=BA=E4=BE=8B:: + + int a =3D 0xff; // i.e. 0x000000ff + int b; + int c =3D a | b; + +=E5=9C=A8=E8=BF=99=E7=A7=8D=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C ``a`` =E7= =9A=84=E9=98=B4=E5=BD=B1=E4=B8=BA ``0``=EF=BC=8C ``b`` =E7=9A=84=E9=98=B4= =E5=BD=B1=E4=B8=BA ``0xffffffff``=EF=BC=8C +``c`` =E7=9A=84=E9=98=B4=E5=BD=B1=E4=B8=BA ``0xffffff00``=E3=80=82=E8=BF= =99=E6=84=8F=E5=91=B3=E7=9D=80 ``c`` =E7=9A=84=E9=AB=98=E4=B8=89=E4=B8=AA= =E5=AD=97=E8=8A=82=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=8C=E8=80=8C=E4= =BD=8E=E5=AD=97=E8=8A=82=E5=B7=B2 +=E5=88=9D=E5=A7=8B=E5=8C=96=E3=80=82 + +=E8=B5=B7=E6=BA=90=E8=B7=9F=E8=B8=AA +-------- + +=E6=AF=8F=E5=9B=9B=E5=AD=97=E8=8A=82=E7=9A=84=E5=86=85=E6=A0=B8=E5=86=85= =E5=AD=98=E9=83=BD=E6=9C=89=E4=B8=80=E4=B8=AA=E6=89=80=E8=B0=93=E7=9A=84=E6= =BA=90=E7=82=B9=E4=B8=8E=E4=B9=8B=E6=98=A0=E5=B0=84=E3=80=82=E8=BF=99=E4=B8= =AA=E6=BA=90=E7=82=B9=E6=8F=8F=E8=BF=B0=E4=BA=86=E5=9C=A8=E7=A8=8B=E5=BA=8F= =E6=89=A7=E8=A1=8C=E4=B8=AD=EF=BC=8C=E6=9C=AA=E5=88=9D +=E5=A7=8B=E5=8C=96=E5=80=BC=E7=9A=84=E5=88=9B=E5=BB=BA=E7=82=B9=E3=80=82= =E6=AF=8F=E4=B8=AA=E6=BA=90=E7=82=B9=E9=83=BD=E4=B8=8E=E5=AE=8C=E6=95=B4=E7= =9A=84=E5=88=86=E9=85=8D=E6=A0=88=EF=BC=88=E5=AF=B9=E4=BA=8E=E5=A0=86=E5=88= =86=E9=85=8D=E7=9A=84=E5=86=85=E5=AD=98=EF=BC=89=E6=88=96=E5=8C=85=E5=90=AB= =E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E5=8F=98 +=E9=87=8F=E7=9A=84=E5=87=BD=E6=95=B0=EF=BC=88=E5=AF=B9=E4=BA=8E=E5=B1=80= =E9=83=A8=E5=8F=98=E9=87=8F=EF=BC=89=E7=9B=B8=E5=85=B3=E8=81=94=E3=80=82 + +=E5=BD=93=E4=B8=80=E4=B8=AA=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84= =E5=8F=98=E9=87=8F=E5=9C=A8=E6=A0=88=E6=88=96=E5=A0=86=E4=B8=8A=E5=88=86=E9= =85=8D=E6=97=B6=EF=BC=8C=E4=BC=9A=E5=88=9B=E5=BB=BA=E4=B8=80=E4=B8=AA=E6=96= =B0=E7=9A=84=E6=BA=90=E7=82=B9=E5=80=BC=EF=BC=8C=E5=B9=B6=E5=B0=86=E8=AF=A5= =E5=8F=98=E9=87=8F=E7=9A=84=E5=88=9D=E5=A7=8B=E5=80=BC +=E5=A1=AB=E5=85=85=E4=B8=BA=E8=BF=99=E4=B8=AA=E5=80=BC=E3=80=82=E5=BD=93= =E4=BB=8E=E5=86=85=E5=AD=98=E4=B8=AD=E8=AF=BB=E5=8F=96=E4=B8=80=E4=B8=AA=E5= =80=BC=E6=97=B6=EF=BC=8C=E5=85=B6=E5=88=9D=E5=A7=8B=E5=80=BC=E4=B9=9F=E4=BC= =9A=E8=A2=AB=E8=AF=BB=E5=8F=96=E5=B9=B6=E4=B8=8E=E9=98=B4=E5=BD=B1=E4=B8=80= =E8=B5=B7=E4=BF=9D=E7=95=99=E3=80=82=E5=AF=B9=E4=BA=8E +=E6=AF=8F=E4=B8=AA=E6=8E=A5=E5=8F=97=E4=B8=80=E4=B8=AA=E6=88=96=E5=A4=9A= =E4=B8=AA=E5=80=BC=E7=9A=84=E6=8C=87=E4=BB=A4=EF=BC=8C=E7=BB=93=E6=9E=9C=E7= =9A=84=E6=BA=90=E7=82=B9=E6=98=AF=E4=B8=8E=E4=BB=BB=E4=BD=95=E6=9C=AA=E5=88= =9D=E5=A7=8B=E5=8C=96=E8=BE=93=E5=85=A5=E7=9B=B8=E5=AF=B9=E5=BA=94=E7=9A=84= =E6=BA=90=E7=82=B9=E4=B9=8B=E4=B8=80=E3=80=82=E5=A6=82 +=E6=9E=9C=E4=B8=80=E4=B8=AA=E6=B1=A1=E6=9F=93=E5=80=BC=E8=A2=AB=E5=86=99= =E5=85=A5=E5=86=85=E5=AD=98=EF=BC=8C=E5=85=B6=E8=B5=B7=E6=BA=90=E4=B9=9F=E4= =BC=9A=E8=A2=AB=E5=86=99=E5=85=A5=E7=9B=B8=E5=BA=94=E7=9A=84=E5=AD=98=E5=82= =A8=E4=B8=AD=E3=80=82 + +=E7=A4=BA=E4=BE=8B 1:: + + int a =3D 42; + int b; + int c =3D a + b; + +=E5=9C=A8=E8=BF=99=E7=A7=8D=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C ``b`` =E7= =9A=84=E6=BA=90=E7=82=B9=E6=98=AF=E5=9C=A8=E5=87=BD=E6=95=B0=E5=85=A5=E5=8F= =A3=E6=97=B6=E7=94=9F=E6=88=90=E7=9A=84=EF=BC=8C=E5=B9=B6=E5=9C=A8=E5=8A=A0= =E6=B3=95=E7=BB=93=E6=9E=9C=E5=86=99=E5=85=A5=E5=86=85=E5=AD=98=E4=B9=8B=E5= =89=8D=E5=AD=98=E5=82=A8=E5=88=B0 +``c`` =E7=9A=84=E6=BA=90=E7=82=B9=E4=B8=AD=E3=80=82 + +=E5=A6=82=E6=9E=9C=E5=87=A0=E4=B8=AA=E5=8F=98=E9=87=8F=E5=85=B1=E4=BA=AB= =E7=9B=B8=E5=90=8C=E7=9A=84=E6=BA=90=E7=82=B9=E5=9C=B0=E5=9D=80=EF=BC=8C=E5= =88=99=E5=AE=83=E4=BB=AC=E8=A2=AB=E5=AD=98=E5=82=A8=E5=9C=A8=E5=90=8C=E4=B8= =80=E4=B8=AA=E5=9B=9B=E5=AD=97=E8=8A=82=E5=9D=97=E4=B8=AD=E3=80=82=E5=9C=A8= =E8=BF=99=E7=A7=8D=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C +=E5=AF=B9=E4=BB=BB=E4=BD=95=E5=8F=98=E9=87=8F=E7=9A=84=E6=AF=8F=E6=AC=A1= =E5=86=99=E5=85=A5=E9=83=BD=E4=BC=9A=E6=9B=B4=E6=96=B0=E6=89=80=E6=9C=89=E5= =8F=98=E9=87=8F=E7=9A=84=E6=BA=90=E7=82=B9=E3=80=82=E5=9C=A8=E8=BF=99=E7=A7= =8D=E6=83=85=E5=86=B5=E4=B8=8B=E6=88=91=E4=BB=AC=E5=BF=85=E9=A1=BB=E7=89=BA= =E7=89=B2=E7=B2=BE=E5=BA=A6=EF=BC=8C=E5=9B=A0 +=E4=B8=BA=E4=B8=BA=E5=8D=95=E7=8B=AC=E7=9A=84=E4=BD=8D=EF=BC=88=E7=94=9A= =E8=87=B3=E5=AD=97=E8=8A=82=EF=BC=89=E5=AD=98=E5=82=A8=E6=BA=90=E7=82=B9=E6= =88=90=E6=9C=AC=E8=BF=87=E9=AB=98=E3=80=82 + +=E7=A4=BA=E4=BE=8B 2:: + + int combine(short a, short b) { + union ret_t { + int i; + short s[2]; + } ret; + ret.s[0] =3D a; + ret.s[1] =3D b; + return ret.i; + } + +=E5=A6=82=E6=9E=9C ``a`` =E5=B7=B2=E5=88=9D=E5=A7=8B=E5=8C=96=E8=80=8C ``b= `` =E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=8C=E5=88=99=E7=BB=93=E6=9E=9C= =E7=9A=84=E9=98=B4=E5=BD=B1=E4=B8=BA 0xffff0000=EF=BC=8C=E7=BB=93=E6=9E=9C= =E7=9A=84=E6=BA=90=E7=82=B9=E4=B8=BA +``b`` =E7=9A=84=E6=BA=90=E7=82=B9=E3=80=82 ``ret.s[0]`` =E4=BC=9A=E6=9C=89= =E7=9B=B8=E5=90=8C=E7=9A=84=E8=B5=B7=E6=BA=90=EF=BC=8C=E4=BD=86=E5=AE=83=E4= =B8=8D=E4=BC=9A=E8=A2=AB=E4=BD=BF=E7=94=A8=EF=BC=8C=E5=9B=A0=E4=B8=BA=E8=AF= =A5=E5=8F=98=E9=87=8F=E5=B7=B2=E5=88=9D=E5=A7=8B=E5=8C=96=E3=80=82 + +=E5=A6=82=E6=9E=9C=E4=B8=A4=E4=B8=AA=E5=87=BD=E6=95=B0=E5=8F=82=E6=95=B0= =E9=83=BD=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=8C=E5=88=99=E5=8F=AA=E4= =BF=9D=E7=95=99=E7=AC=AC=E4=BA=8C=E4=B8=AA=E5=8F=82=E6=95=B0=E7=9A=84=E6=BA= =90=E7=82=B9=E3=80=82 + +=E6=BA=90=E7=82=B9=E9=93=BE +~~~~~~ + +=E4=B8=BA=E4=BA=86=E4=BE=BF=E4=BA=8E=E8=B0=83=E8=AF=95=EF=BC=8CKMSAN =E5= =9C=A8=E6=AF=8F=E6=AC=A1=E5=B0=86=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E5=80= =BC=E5=AD=98=E5=82=A8=E5=88=B0=E5=86=85=E5=AD=98=E6=97=B6=E9=83=BD=E4=BC=9A= =E5=88=9B=E5=BB=BA=E4=B8=80=E4=B8=AA=E6=96=B0=E7=9A=84=E6=BA=90=E7=82=B9=E3= =80=82=E6=96=B0=E7=9A=84=E6=BA=90=E7=82=B9 +=E5=BC=95=E7=94=A8=E4=BA=86=E5=85=B6=E5=88=9B=E5=BB=BA=E6=A0=88=E4=BB=A5= =E5=8F=8A=E5=80=BC=E7=9A=84=E5=89=8D=E4=B8=80=E4=B8=AA=E8=B5=B7=E6=BA=90=E3= =80=82=E8=BF=99=E5=8F=AF=E8=83=BD=E5=AF=BC=E8=87=B4=E5=86=85=E5=AD=98=E6=B6= =88=E8=80=97=E5=A2=9E=E5=8A=A0=EF=BC=8C=E5=9B=A0=E6=AD=A4=E6=88=91=E4=BB=AC= =E5=9C=A8=E8=BF=90=E8=A1=8C=E6=97=B6=E9=99=90=E5=88=B6 +=E4=BA=86=E6=BA=90=E7=82=B9=E9=93=BE=E7=9A=84=E9=95=BF=E5=BA=A6=E3=80=82 + +Clang =E6=8F=92=E6=A1=A9 API +-------------- + +Clang =E6=8F=92=E6=A1=A9=E9=80=9A=E8=BF=87=E5=9C=A8=E5=86=85=E6=A0=B8=E4= =BB=A3=E7=A0=81=E4=B8=AD=E6=8F=92=E5=85=A5=E5=AE=9A=E4=B9=89=E5=9C=A8 ``mm/= kmsan/instrumentation.c`` =E4=B8=AD=E7=9A=84=E5=87=BD=E6=95=B0=E8=B0=83=E7= =94=A8 +=E6=9D=A5=E5=AE=9E=E7=8E=B0=E3=80=82 + + +=E9=98=B4=E5=BD=B1=E6=93=8D=E4=BD=9C +~~~~~~~~ + +=E5=AF=B9=E4=BA=8E=E6=AF=8F=E6=AC=A1=E5=86=85=E5=AD=98=E8=AE=BF=E9=97=AE= =EF=BC=8C=E7=BC=96=E8=AF=91=E5=99=A8=E9=83=BD=E4=BC=9A=E5=8F=91=E5=87=BA=E4= =B8=80=E4=B8=AA=E5=87=BD=E6=95=B0=E8=B0=83=E7=94=A8=EF=BC=8C=E8=AF=A5=E5=87= =BD=E6=95=B0=E8=BF=94=E5=9B=9E=E4=B8=80=E5=AF=B9=E6=8C=87=E9=92=88=EF=BC=8C= =E6=8C=87=E5=90=91=E7=BB=99=E5=AE=9A=E5=86=85=E5=AD=98 +=E7=9A=84=E9=98=B4=E5=BD=B1=E5=92=8C=E5=8E=9F=E5=A7=8B=E5=9C=B0=E5=9D=80:: + + typedef struct { + void *shadow, *origin; + } shadow_origin_ptr_t + + shadow_origin_ptr_t __msan_metadata_ptr_for_load_{1,2,4,8}(void *addr) + shadow_origin_ptr_t __msan_metadata_ptr_for_store_{1,2,4,8}(void *addr) + shadow_origin_ptr_t __msan_metadata_ptr_for_load_n(void *addr, uintptr_t= size) + shadow_origin_ptr_t __msan_metadata_ptr_for_store_n(void *addr, uintptr_= t size) + +=E5=87=BD=E6=95=B0=E5=90=8D=E4=BE=9D=E8=B5=96=E4=BA=8E=E5=86=85=E5=AD=98= =E8=AE=BF=E9=97=AE=E7=9A=84=E5=A4=A7=E5=B0=8F=E3=80=82 + +=E7=BC=96=E8=AF=91=E5=99=A8=E7=A1=AE=E4=BF=9D=E5=AF=B9=E4=BA=8E=E6=AF=8F= =E4=B8=AA=E5=8A=A0=E8=BD=BD=E7=9A=84=E5=80=BC=EF=BC=8C=E5=85=B6=E9=98=B4=E5= =BD=B1=E5=92=8C=E5=8E=9F=E5=A7=8B=E5=80=BC=E9=83=BD=E4=BB=8E=E5=86=85=E5=AD= =98=E4=B8=AD=E8=AF=BB=E5=8F=96=E3=80=82=E5=BD=93=E4=B8=80=E4=B8=AA=E5=80=BC= =E5=AD=98=E5=82=A8=E5=88=B0=E5=86=85=E5=AD=98=E6=97=B6 +=EF=BC=8C=E5=85=B6=E9=98=B4=E5=BD=B1=E5=92=8C=E5=8E=9F=E5=A7=8B=E5=80=BC= =E4=B9=9F=E4=BC=9A=E9=80=9A=E8=BF=87=E5=85=83=E6=95=B0=E6=8D=AE=E6=8C=87=E9= =92=88=E8=BF=9B=E8=A1=8C=E5=AD=98=E5=82=A8=E3=80=82 + +=E5=A4=84=E7=90=86=E5=B1=80=E9=83=A8=E5=8F=98=E9=87=8F +~~~~~~~~~~~~ + +=E4=B8=80=E4=B8=AA=E7=89=B9=E6=AE=8A=E7=9A=84=E5=87=BD=E6=95=B0=E7=94=A8= =E4=BA=8E=E4=B8=BA=E5=B1=80=E9=83=A8=E5=8F=98=E9=87=8F=E5=88=9B=E5=BB=BA=E4= =B8=80=E4=B8=AA=E6=96=B0=E7=9A=84=E5=8E=9F=E5=A7=8B=E5=80=BC=EF=BC=8C=E5=B9= =B6=E5=B0=86=E8=AF=A5=E5=8F=98=E9=87=8F=E7=9A=84=E5=8E=9F=E5=A7=8B=E5=80=BC= =E8=AE=BE=E7=BD=AE=E4=B8=BA=E8=AF=A5=E5=80=BC:: + + void __msan_poison_alloca(void *addr, uintptr_t size, char *descr) + +=E8=AE=BF=E9=97=AE=E6=AF=8F=E4=B8=AA=E4=BB=BB=E5=8A=A1=E6=95=B0=E6=8D=AE +~~~~~~~~~~~~~~~~ + +=E5=9C=A8=E6=AF=8F=E4=B8=AA=E6=8F=92=E6=A1=A9=E5=87=BD=E6=95=B0=E7=9A=84= =E5=BC=80=E5=A7=8B=E5=A4=84=EF=BC=8CKMSAN =E6=8F=92=E5=85=A5=E4=B8=80=E4=B8= =AA=E5=AF=B9 ``__msan_get_context_state()`` =E7=9A=84=E8=B0=83=E7=94=A8 +:: + + kmsan_context_state *__msan_get_context_state(void) + +``kmsan_context_state`` =E5=9C=A8 ``include/linux/kmsan.h`` =E4=B8=AD=E5= =A3=B0=E6=98=8E:: + + struct kmsan_context_state { + char param_tls[KMSAN_PARAM_SIZE]; + char retval_tls[KMSAN_RETVAL_SIZE]; + char va_arg_tls[KMSAN_PARAM_SIZE]; + char va_arg_origin_tls[KMSAN_PARAM_SIZE]; + u64 va_arg_overflow_size_tls; + char param_origin_tls[KMSAN_PARAM_SIZE]; + depot_stack_handle_t retval_origin_tls; + }; + +KMSAN =E4=BD=BF=E7=94=A8=E6=AD=A4=E7=BB=93=E6=9E=84=E4=BD=93=E5=9C=A8=E6= =8F=92=E6=A1=A9=E5=87=BD=E6=95=B0=E4=B9=8B=E9=97=B4=E4=BC=A0=E9=80=92=E5=8F= =82=E6=95=B0=E9=98=B4=E5=BD=B1=E5=92=8C=E5=8E=9F=E5=A7=8B=E5=80=BC=EF=BC=88= =E9=99=A4=E9=9D=9E=E7=AB=8B=E5=88=BB=E9=80=9A=E8=BF=87 + ``CONFIG_KMSAN_CHECK_PARAM_RETVAL`` =E6=A3=80=E6=9F=A5=E5=8F=82=E6=95=B0= =EF=BC=89=E3=80=82 + +=E5=B0=86=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84=E5=80=BC=E4=BC=A0= =E9=80=92=E7=BB=99=E5=87=BD=E6=95=B0 +~~~~~~~~~~~~~~~~~~~~~~~~ + +Clang =E7=9A=84 MemorySanitizer =E6=8F=92=E6=A1=A9=E6=9C=89=E4=B8=80=E4=B8= =AA=E9=80=89=E9=A1=B9 ``-fsanitize-memory-param-retval``=EF=BC=8C=E8=AF=A5 +=E9=80=89=E9=A1=B9=E4=BD=BF=E7=BC=96=E8=AF=91=E5=99=A8=E6=A3=80=E6=9F=A5= =E6=8C=89=E5=80=BC=E4=BC=A0=E9=80=92=E7=9A=84=E5=87=BD=E6=95=B0=E5=8F=82=E6= =95=B0=EF=BC=8C=E4=BB=A5=E5=8F=8A=E5=87=BD=E6=95=B0=E8=BF=94=E5=9B=9E=E5=80= =BC=E3=80=82 + +=E8=AF=A5=E9=80=89=E9=A1=B9=E7=94=B1 ``CONFIG_KMSAN_CHECK_PARAM_RETVAL`` = =E6=8E=A7=E5=88=B6=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=90=AF=E7=94=A8=E4=BB=A5=E4= =BE=BF KMSAN =E6=9B=B4=E6=97=A9=E6=8A=A5=E5=91=8A +=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84=E5=80=BC=E3=80=82=E6=9C=89= =E5=85=B3=E6=9B=B4=E5=A4=9A=E7=BB=86=E8=8A=82=EF=BC=8C=E8=AF=B7=E5=8F=82=E8= =80=83 `LKML discussion`_=E3=80=82 + +=E7=94=B1=E4=BA=8E LLVM =E4=B8=AD=E7=9A=84=E5=AE=9E=E7=8E=B0=E6=A3=80=E6= =9F=A5=E7=9A=84=E6=96=B9=E5=BC=8F=EF=BC=88=E5=AE=83=E4=BB=AC=E4=BB=85=E5=BA= =94=E7=94=A8=E4=BA=8E=E6=A0=87=E8=AE=B0=E4=B8=BA ``noundef`` =E7=9A=84=E5= =8F=82=E6=95=B0=EF=BC=89=EF=BC=8C=E5=B9=B6=E4=B8=8D=E6=98=AF=E6=89=80 +=E6=9C=89=E5=8F=82=E6=95=B0=E9=83=BD=E8=83=BD=E4=BF=9D=E8=AF=81=E8=A2=AB= =E6=A3=80=E6=9F=A5=EF=BC=8C=E5=9B=A0=E6=AD=A4=E6=88=91=E4=BB=AC=E4=B8=8D=E8= =83=BD=E6=94=BE=E5=BC=83 ``kmsan_context_state`` =E4=B8=AD=E7=9A=84=E5=85= =83=E6=95=B0=E6=8D=AE=E5=AD=98=E5=82=A8 +=E3=80=82 + +=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=87=BD=E6=95=B0 +~~~~~~~~~~~ + +=E7=BC=96=E8=AF=91=E5=99=A8=E5=B0=86=E5=AF=B9 ``memcpy()``/``memmove()``/`= `memset()`` =E7=9A=84=E8=B0=83=E7=94=A8=E6=9B=BF=E6=8D=A2=E4=B8=BA=E4=BB=A5= =E4=B8=8B=E5=87=BD=E6=95=B0=E3=80=82=E8=BF=99=E4=BA=9B=E5=87=BD +=E6=95=B0=E5=9C=A8=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=E5=88=9D=E5=A7=8B= =E5=8C=96=E6=88=96=E5=A4=8D=E5=88=B6=E6=97=B6=E4=B9=9F=E4=BC=9A=E8=A2=AB=E8= =B0=83=E7=94=A8=EF=BC=8C=E7=A1=AE=E4=BF=9D=E9=98=B4=E5=BD=B1=E5=92=8C=E5=8E= =9F=E5=A7=8B=E5=80=BC=E4=B8=8E=E6=95=B0=E6=8D=AE=E4=B8=80=E8=B5=B7=E5=A4=8D= =E5=88=B6:: + + void *__msan_memcpy(void *dst, void *src, uintptr_t n) + void *__msan_memmove(void *dst, void *src, uintptr_t n) + void *__msan_memset(void *dst, int c, uintptr_t n) + +=E9=94=99=E8=AF=AF=E6=8A=A5=E5=91=8A +~~~~~~~~ + +=E5=AF=B9=E4=BA=8E=E6=AF=8F=E4=B8=AA=E5=80=BC=E7=9A=84=E4=BD=BF=E7=94=A8= =EF=BC=8C=E7=BC=96=E8=AF=91=E5=99=A8=E5=8F=91=E5=87=BA=E4=B8=80=E4=B8=AA=E9= =98=B4=E5=BD=B1=E6=A3=80=E6=9F=A5=EF=BC=8C=E5=9C=A8=E5=80=BC=E4=B8=AD=E6=AF= =92=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E8=B0=83=E7=94=A8 +``__msan_warning()``:: + + void __msan_warning(u32 origin) + +``__msan_warning()`` =E4=BD=BF KMSAN =E8=BF=90=E8=A1=8C=E6=97=B6=E6=89=93= =E5=8D=B0=E9=94=99=E8=AF=AF=E6=8A=A5=E5=91=8A=E3=80=82 + +=E5=86=85=E8=81=94=E6=B1=87=E7=BC=96=E6=8F=92=E6=A1=A9 +~~~~~~~~~~~~ + +KMSAN =E5=AF=B9=E6=AF=8F=E4=B8=AA=E5=86=85=E8=81=94=E6=B1=87=E7=BC=96=E8= =BE=93=E5=87=BA=E8=BF=9B=E8=A1=8C=E6=8F=92=E6=A1=A9=EF=BC=8C=E8=B0=83=E7=94= =A8:: + + void __msan_instrument_asm_store(void *addr, uintptr_t size) + +=EF=BC=8C=E8=AF=A5=E5=87=BD=E6=95=B0=E8=A7=A3=E9=99=A4=E5=86=85=E5=AD=98= =E5=8C=BA=E5=9F=9F=E7=9A=84=E6=B1=A1=E6=9F=93=E3=80=82 + +=E8=BF=99=E7=A7=8D=E6=96=B9=E6=B3=95=E5=8F=AF=E8=83=BD=E4=BC=9A=E6=8E=A9= =E7=9B=96=E6=9F=90=E4=BA=9B=E9=94=99=E8=AF=AF=EF=BC=8C=E4=BD=86=E4=B9=9F=E6= =9C=89=E5=8A=A9=E4=BA=8E=E9=81=BF=E5=85=8D=E8=AE=B8=E5=A4=9A=E4=BD=8D=E6=93= =8D=E4=BD=9C=E3=80=81=E5=8E=9F=E5=AD=90=E6=93=8D=E4=BD=9C=E7=AD=89=E4=B8=AD= =E7=9A=84=E5=81=87=E9=98=B3=E6=80=A7=E3=80=82 + +=E6=9C=89=E6=97=B6=E4=BC=A0=E9=80=92=E7=BB=99=E5=86=85=E8=81=94=E6=B1=87= =E7=BC=96=E7=9A=84=E6=8C=87=E9=92=88=E4=B8=8D=E6=8C=87=E5=90=91=E6=9C=89=E6= =95=88=E5=86=85=E5=AD=98=E3=80=82=E5=9C=A8=E8=BF=99=E7=A7=8D=E6=83=85=E5=86= =B5=E4=B8=8B=EF=BC=8C=E5=AE=83=E4=BB=AC=E5=9C=A8=E8=BF=90=E8=A1=8C=E6=97=B6= =E8=A2=AB=E5=BF=BD=E7=95=A5=E3=80=82 + + +=E8=BF=90=E8=A1=8C=E6=97=B6=E5=BA=93 +-------- + +=E4=BB=A3=E7=A0=81=E4=BD=8D=E4=BA=8E ``mm/kmsan/``=E3=80=82 + +=E6=AF=8F=E4=B8=AA=E4=BB=BB=E5=8A=A1 KMSAN =E7=8A=B6=E6=80=81 +~~~~~~~~~~~~~~~~~~~ + +=E6=AF=8F=E4=B8=AA task_struct =E9=83=BD=E6=9C=89=E4=B8=80=E4=B8=AA=E5=85= =B3=E8=81=94=E7=9A=84 KMSAN =E4=BB=BB=E5=8A=A1=E7=8A=B6=E6=80=81=EF=BC=8C= =E5=AE=83=E4=BF=9D=E5=AD=98 KMSAN +=E4=B8=8A=E4=B8=8B=E6=96=87=EF=BC=88=E8=A7=81=E4=B8=8A=E6=96=87=EF=BC=89= =E5=92=8C=E4=B8=80=E4=B8=AA=E6=AF=8F=E4=B8=AA=E4=BB=BB=E5=8A=A1=E8=AE=A1=E6= =95=B0=E5=99=A8=E4=BB=A5=E7=A6=81=E6=AD=A2 KMSAN =E6=8A=A5=E5=91=8A:: + + struct kmsan_context { + ... + unsigned int depth; + struct kmsan_context_state cstate; + ... + } + + struct task_struct { + ... + struct kmsan_context kmsan; + ... + } + +KMSAN =E4=B8=8A=E4=B8=8B=E6=96=87 +~~~~~~~~~~~~ + +=E5=9C=A8=E5=86=85=E6=A0=B8=E4=BB=BB=E5=8A=A1=E4=B8=8A=E4=B8=8B=E6=96=87= =E4=B8=AD=E8=BF=90=E8=A1=8C=E6=97=B6=EF=BC=8CKMSAN =E4=BD=BF=E7=94=A8 ``cur= rent->kmsan.cstate`` =E6=9D=A5 +=E4=BF=9D=E5=AD=98=E5=87=BD=E6=95=B0=E5=8F=82=E6=95=B0=E5=92=8C=E8=BF=94= =E5=9B=9E=E5=80=BC=E7=9A=84=E5=85=83=E6=95=B0=E6=8D=AE=E3=80=82 + +=E4=BD=86=E5=9C=A8=E5=86=85=E6=A0=B8=E8=BF=90=E8=A1=8C=E4=BA=8E=E4=B8=AD= =E6=96=AD=E3=80=81softirq =E6=88=96 NMI =E4=B8=8A=E4=B8=8B=E6=96=87=E4=B8= =AD=EF=BC=8C ``current`` =E4=B8=8D=E5=8F=AF=E7=94=A8=E6=97=B6=EF=BC=8C +KMSAN =E5=88=87=E6=8D=A2=E5=88=B0=E6=AF=8F CPU =E4=B8=AD=E6=96=AD=E7=8A=B6= =E6=80=81:: + + DEFINE_PER_CPU(struct kmsan_ctx, kmsan_percpu_ctx); + +=E5=85=83=E6=95=B0=E6=8D=AE=E5=88=86=E9=85=8D +~~~~~~~~~~ + +=E5=86=85=E6=A0=B8=E4=B8=AD=E6=9C=89=E5=A4=9A=E4=B8=AA=E5=9C=B0=E6=96=B9= =E5=AD=98=E5=82=A8=E5=85=83=E6=95=B0=E6=8D=AE=E3=80=82 + +1. =E6=AF=8F=E4=B8=AA ``struct page`` =E5=AE=9E=E4=BE=8B=E5=8C=85=E5=90=AB= =E4=B8=A4=E4=B8=AA=E6=8C=87=E5=90=91=E5=85=B6=E5=BD=B1=E5=AD=90=E5=92=8C=E5= =86=85=E5=AD=98=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=8C=87=E9=92=88 +:: + + struct page { + ... + struct page *shadow, *origin; + ... + }; + +=E5=9C=A8=E5=90=AF=E5=8A=A8=E6=97=B6=EF=BC=8C=E5=86=85=E6=A0=B8=E4=B8=BA= =E6=AF=8F=E4=B8=AA=E5=8F=AF=E7=94=A8=E7=9A=84=E5=86=85=E6=A0=B8=E9=A1=B5=E9= =9D=A2=E5=88=86=E9=85=8D=E5=BD=B1=E5=AD=90=E5=92=8C=E6=BA=90=E9=A1=B5=E9=9D= =A2=E3=80=82=E8=BF=99=E6=98=AF=E5=9C=A8=E5=86=85=E6=A0=B8=E5=9C=B0=E5=9D=80= =E7=A9=BA=E9=97=B4=E5=B7=B2=E7=BB=8F=E7=A2=8E=E7=89=87 +=E5=8C=96=E6=97=B6=E5=90=8E=E5=AE=8C=E6=88=90=E7=9A=84=EF=BC=8C=E5=AE=8C= =E6=88=90=E7=9A=84=E7=9B=B8=E5=BD=93=E6=99=9A=EF=BC=8C=E5=9B=A0=E6=AD=A4=E6= =99=AE=E9=80=9A=E6=95=B0=E6=8D=AE=E9=A1=B5=E9=9D=A2=E5=8F=AF=E8=83=BD=E4=B8= =8E=E5=85=83=E6=95=B0=E6=8D=AE=E9=A1=B5=E9=9D=A2=E4=BB=BB=E6=84=8F=E4=BA=A4= =E9=94=99=E3=80=82 + +=E8=BF=99=E6=84=8F=E5=91=B3=E7=9D=80=E9=80=9A=E5=B8=B8=E4=B8=A4=E4=B8=AA= =E7=9B=B8=E9=82=BB=E7=9A=84=E5=86=85=E5=AD=98=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5= =AE=83=E4=BB=AC=E7=9A=84=E5=BD=B1=E5=AD=90/=E6=BA=90=E9=A1=B5=E9=9D=A2=E5= =8F=AF=E8=83=BD=E4=B8=8D=E6=98=AF=E8=BF=9E=E7=BB=AD=E7=9A=84=E3=80=82=E5=9B= =A0=E6=AD=A4=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=86=85=E5=AD=98 +=E8=AE=BF=E9=97=AE=E8=B7=A8=E8=B6=8A=E5=86=85=E5=AD=98=E5=9D=97=E7=9A=84= =E8=BE=B9=E7=95=8C=EF=BC=8C=E8=AE=BF=E9=97=AE=E5=BD=B1=E5=AD=90/=E6=BA=90= =E5=86=85=E5=AD=98=E5=8F=AF=E8=83=BD=E4=BC=9A=E7=A0=B4=E5=9D=8F=E5=85=B6=E4= =BB=96=E9=A1=B5=E9=9D=A2=E6=88=96=E4=BB=8E=E4=B8=AD=E8=AF=BB=E5=8F=96=E9=94= =99=E8=AF=AF=E7=9A=84=E5=80=BC=E3=80=82 + +=E5=AE=9E=E9=99=85=E4=B8=8A=EF=BC=8C=E7=94=B1=E7=9B=B8=E5=90=8C ``alloc_pa= ges()`` =E8=B0=83=E7=94=A8=E8=BF=94=E5=9B=9E=E7=9A=84=E8=BF=9E=E7=BB=AD=E5= =86=85=E5=AD=98=E9=A1=B5=E9=9D=A2=E5=B0=86=E5=85=B7=E6=9C=89=E8=BF=9E=E7=BB= =AD=E7=9A=84=E5=85=83=E6=95=B0=E6=8D=AE=EF=BC=8C=E8=80=8C +=E5=A6=82=E6=9E=9C=E8=BF=99=E4=BA=9B=E9=A1=B5=E9=9D=A2=E5=B1=9E=E4=BA=8E= =E4=B8=A4=E4=B8=AA=E4=B8=8D=E5=90=8C=E7=9A=84=E5=88=86=E9=85=8D=EF=BC=8C=E5= =AE=83=E4=BB=AC=E7=9A=84=E5=85=83=E6=95=B0=E6=8D=AE=E9=A1=B5=E9=9D=A2=E5=8F= =AF=E8=83=BD=E4=BC=9A=E8=A2=AB=E7=A2=8E=E7=89=87=E5=8C=96=E3=80=82 + +=E5=AF=B9=E4=BA=8E=E5=86=85=E6=A0=B8=E6=95=B0=E6=8D=AE=EF=BC=88 ``.data``= =E3=80=81 ``.bss`` =E7=AD=89=EF=BC=89=E5=92=8C=E6=AF=8F CPU =E5=86=85=E5=AD= =98=E5=8C=BA=E5=9F=9F=EF=BC=8C=E4=B9=9F=E6=B2=A1=E6=9C=89=E5=AF=B9=E5=85=83= =E6=95=B0=E6=8D=AE=E8=BF=9E=E7=BB=AD +=E6=80=A7=E7=9A=84=E4=BF=9D=E8=AF=81=E3=80=82 + +=E5=9C=A8 ``__msan_metadata_ptr_for_XXX_YYY()`` =E9=81=87=E5=88=B0=E4=B8= =A4=E4=B8=AA=E9=A1=B5=E9=9D=A2=E4=B9=8B=E9=97=B4=E7=9A=84 +=E9=9D=9E=E8=BF=9E=E7=BB=AD=E5=85=83=E6=95=B0=E6=8D=AE=E8=BE=B9=E7=95=8C= =E6=97=B6=EF=BC=8C=E5=AE=83=E8=BF=94=E5=9B=9E=E6=8C=87=E5=90=91=E5=81=87=E5= =BD=B1=E5=AD=90/=E6=BA=90=E5=8C=BA=E5=9F=9F=E7=9A=84=E6=8C=87=E9=92=88:: + + char dummy_load_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); + char dummy_store_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); + +``dummy_load_page`` =E8=A2=AB=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=BA=E9=9B=B6= =EF=BC=8C=E5=9B=A0=E6=AD=A4=E8=AF=BB=E5=8F=96=E5=AE=83=E5=A7=8B=E7=BB=88=E8= =BF=94=E5=9B=9E=E9=9B=B6=E3=80=82=E5=AF=B9 ``dummy_store_page`` =E7=9A=84 +=E6=89=80=E6=9C=89=E5=86=99=E5=85=A5=E9=83=BD=E8=A2=AB=E5=BF=BD=E7=95=A5= =E3=80=82 + +2. =E5=AF=B9=E4=BA=8E vmalloc =E5=86=85=E5=AD=98=E5=92=8C=E6=A8=A1=E5=9D= =97=EF=BC=8C=E5=86=85=E5=AD=98=E8=8C=83=E5=9B=B4=E3=80=81=E5=BD=B1=E5=AD=90= =E5=92=8C=E6=BA=90=E4=B9=8B=E9=97=B4=E6=9C=89=E4=B8=80=E4=B8=AA=E7=9B=B4=E6= =8E=A5=E6=98=A0=E5=B0=84=E3=80=82KMSAN =E5=B0=86 +vmalloc =E5=8C=BA=E5=9F=9F=E7=BC=A9=E5=B0=8F=E4=BA=86 3/4=EF=BC=8C=E4=BB= =85=E4=BD=BF=E5=89=8D=E5=9B=9B=E5=88=86=E4=B9=8B=E4=B8=80=E5=8F=AF=E7=94=A8= =E4=BA=8E ``vmalloc()``=E3=80=82vmalloc +=E5=8C=BA=E5=9F=9F=E7=9A=84=E7=AC=AC=E4=BA=8C=E4=B8=AA=E5=9B=9B=E5=88=86= =E4=B9=8B=E4=B8=80=E5=8C=85=E5=90=AB=E7=AC=AC=E4=B8=80=E4=B8=AA=E5=9B=9B=E5= =88=86=E4=B9=8B=E4=B8=80=E7=9A=84=E5=BD=B1=E5=AD=90=E5=86=85=E5=AD=98=EF=BC= =8C=E7=AC=AC=E4=B8=89=E4=B8=AA=E5=9B=9B=E5=88=86=E4=B9=8B=E4=B8=80=E4=BF=9D= =E5=AD=98=E6=BA=90=E3=80=82=E7=AC=AC=E5=9B=9B=E4=B8=AA +=E5=9B=9B=E5=88=86=E4=B9=8B=E4=B8=80=E7=9A=84=E5=B0=8F=E9=83=A8=E5=88=86= =E5=8C=85=E5=90=AB=E5=86=85=E6=A0=B8=E6=A8=A1=E5=9D=97=E7=9A=84=E5=BD=B1=E5= =AD=90=E5=92=8C=E6=BA=90=E3=80=82=E6=9C=89=E5=85=B3=E6=9B=B4=E5=A4=9A=E8=AF= =A6=E7=BB=86=E4=BF=A1=E6=81=AF=EF=BC=8C=E8=AF=B7=E5=8F=82=E9=98=85 +``arch/x86/include/asm/pgtable_64_types.h``=E3=80=82 + +=E5=BD=93=E4=B8=80=E7=B3=BB=E5=88=97=E9=A1=B5=E9=9D=A2=E6=98=A0=E5=B0=84= =E5=88=B0=E4=B8=80=E4=B8=AA=E8=BF=9E=E7=BB=AD=E7=9A=84=E8=99=9A=E6=8B=9F=E5= =86=85=E5=AD=98=E7=A9=BA=E9=97=B4=E6=97=B6=EF=BC=8C=E5=AE=83=E4=BB=AC=E7=9A= =84=E5=BD=B1=E5=AD=90=E5=92=8C=E6=BA=90=E9=A1=B5=E9=9D=A2=E4=B9=9F=E4=BB=A5= =E8=BF=9E=E7=BB=AD=E5=8C=BA=E5=9F=9F=E7=9A=84=E6=96=B9 +=E5=BC=8F=E6=98=A0=E5=B0=84=E3=80=82 + +=E5=8F=82=E8=80=83=E6=96=87=E7=8C=AE +=3D=3D=3D=3D=3D=3D=3D=3D + +E. Stepanov, K. Serebryany. `MemorySanitizer: fast detector of uninitializ= ed +memory use in C++ +`_. +In Proceedings of CGO 2015. + +.. _MemorySanitizer tool: https://clang.llvm.org/docs/MemorySanitizer.html +.. _LLVM documentation: https://llvm.org/docs/GettingStarted.html +.. _LKML discussion: https://lore.kernel.org/all/20220614144853.3693273-1-= glider@google.com/ --=20 2.47.0