From mboxrd@z Thu Jan 1 00:00:00 1970 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 D25E9C61D9D for ; Thu, 23 Nov 2023 02:58:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA55A6B00DF; Wed, 22 Nov 2023 21:58:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E535B6B04FC; Wed, 22 Nov 2023 21:58:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1AD06B04FD; Wed, 22 Nov 2023 21:58:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C00026B00DF for ; Wed, 22 Nov 2023 21:58:16 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 95F70A1113 for ; Thu, 23 Nov 2023 02:58:16 +0000 (UTC) X-FDA: 81487710192.13.8ADB204 Received: from mail-vk1-f169.google.com (mail-vk1-f169.google.com [209.85.221.169]) by imf28.hostedemail.com (Postfix) with ESMTP id D6AFFC000C for ; Thu, 23 Nov 2023 02:58:14 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=GmH8njHn; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.221.169 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700708294; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KNqhJS4E6ntiOthoCCp30Dce98FPuWbxjBUizuT5qHE=; b=0bMqctTxDVbQwPNv+MYlcQcGIv5JqGnXSr5HLZTCSuFef22A+Q5cS0re5dK37pgh1wu1g5 U1UKA7YBokMlKlif8ELfEB8ANG8JzbKcwmXvA0/elyAwet7ejbEBp3jrSq1V2C/HEkgRNV YKzuF85RGjFnFJoivN6CknVgc4F7PZc= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=GmH8njHn; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.221.169 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700708294; a=rsa-sha256; cv=none; b=Gbxr3TjW5xXw8Cx0JPbXolsX6L/6CIJwDr8Du3N5XwbPG0vw74s2nR2LTMZd4R7AVF2dE9 y7nlJt56T/ghSPUtU5Um+JKRShpKACekKnZZL61ZOCLibo3cGFLHHLr9dfVpRNA/LT9SCN 5qzNhm/Ujow0/HMLaAd/f3KWgPlUX0I= Received: by mail-vk1-f169.google.com with SMTP id 71dfb90a1353d-4ac45927974so157125e0c.3 for ; Wed, 22 Nov 2023 18:58:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700708294; x=1701313094; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KNqhJS4E6ntiOthoCCp30Dce98FPuWbxjBUizuT5qHE=; b=GmH8njHn4NLMsWaYsNkc8vANZgd5JvJB+srOnkRNDT1qXgl2ksPwnBwIBT/BVusIFb u5nUSglhFHumJNc/zUR63ybxfB639Vmsq/b7JidsrS0Rn4vysgpJ2mRZA1sc7bfJ5UgX JrXnm3KAUNr+5sS1D7qmX76SE0JtHPazFnpBXsZMcSiBNt2aLGtFnIAjcfb42nlmrlUj TOWMzfPl7vPeuimcbJkq0WTWNlNUvqwGwW14FPl5ua6dDS65P1qNOZ8G+6ye76IcP+Xm bfuf0ghJWV7g78Zf6xEEuyt1JiGLqjcEc9ExYNDR2WtHWmnasZWYxoqMmvjcrIJIwjQU ZwWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700708294; x=1701313094; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KNqhJS4E6ntiOthoCCp30Dce98FPuWbxjBUizuT5qHE=; b=GOrmGsTJ+B01cP2wFGr4SxjWKTnljCJrOacfC6w9z53F6AznVlN7w6imloCNmDp73d v8JXasvUYK1SozlyzvJGaAoysVPCSWLKUejAIlX8OMhrbST+pZkMTSmEhPLp+H/qrboF BX5qVxNuqTfJ+HX+3pTB7yJWJMBgr4f59IIcqDr6r3p+yfOuAGAo+bUWWhy67ViXLXQS M0EjFfqY+3F14UMa+M54PSGruAVjwwzfbJMrrtP3goyrq61THlgEM3OFlxO442DfFey1 m1AdJ4bajKXiMw+rTMO++Pg95wiAIQlI+GwE4WKakDIR5nTWkbyL1GOoN8vZCRHfMaiE nh7w== X-Gm-Message-State: AOJu0Yyzu4sFqhvtrmq90eHhBymnuMJjdkqo+UBzDjYD6H1R2n1uYIyx ZNyjT0EHkHgCBsOyNipZ0mFMiSgPLDMua98zFpU= X-Google-Smtp-Source: AGHT+IH5KZJpl6aREdAr1HdnesbhNhwGxOkUSqrOml8nuuykUyEAOW12bLklefdZVae2hePno5m1rPkBu+fZtOFCkVs= X-Received: by 2002:a67:f546:0:b0:462:877d:7d05 with SMTP id z6-20020a67f546000000b00462877d7d05mr4431612vsn.24.1700708293822; Wed, 22 Nov 2023 18:58:13 -0800 (PST) MIME-Version: 1.0 References: <20231122231202.121277-1-andrey.konovalov@linux.dev> In-Reply-To: From: Hyeonggon Yoo <42.hyeyoo@gmail.com> Date: Thu, 23 Nov 2023 11:58:02 +0900 Message-ID: Subject: Re: [PATCH mm] slub, kasan: improve interaction of KASAN and slub_debug poisoning To: Andrey Konovalov Cc: andrey.konovalov@linux.dev, Andrew Morton , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , Feng Tang , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: D6AFFC000C X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: nfrk7qygmzta7qxtrig4p6ef8aa1e687 X-HE-Tag: 1700708294-822964 X-HE-Meta: U2FsdGVkX1/3F2KXwvVOG/OWOdzWvQaiuPT6nPh30VSmfEKfXJLJ5epRbrZtf7J+CT4ThSt/RqCuYq22J9Jdgsz+XDwu0cYoTcaAmzB4wHU+818wsLslhPxBB7/7+srgcfBzg5OZqQdBPHEgKI+oxBZvYRpkWE1ZjWz9i+HkQTDNshMU/Vbh/b30mTBdYft6IgroL5K242Zu7too402mWkduY9KpslbhHrgR1FaHVZL/6o3UTgtfWscb6nAx5Tb0saaZjgOSs3r8iRwaPxuh5tAZluP+F4WdpFp9tW0orxuhQVePFunnyfuJ1khAynUdOR+0oUZR2Asnzfu7m0xsaBxV0C08c9hrUXOqsHJcmtteGj2zOKVrIZqub1by75PiiqiNlu+tHIxHFYjRcCaW3S6a/+16TYlAGsXJhn9FzuH8wxAgkgSxt7WAqbKoxoyUdNK24rZ4mGQplzgtckYi7B3dQ3TiO0WhKsc3b0RJoWtUvaEEwxoquofSUsI99jmmqbVDrHtxql8svAlui75KkeNkF51QJSvG2FtLMQSldfJKUeLEhXplzno5iWQSMr3JSPpX7uW+o5uKEQhLh3CzX5AHfTsoMuWb5S7GRKvyFtdlKhp0m+fKmt8cBe9y8G3xRFaBEGEebsUjl9vclSw8HfwJtgQAJ9lp88nAkWH63M0R0oqPDEE0OmqbFoMeTbkl/Iz+JyBxC04zZ8hoaXWt11tovAvZjz//lwkzeZWtracj8Tkp1GgOHA/YjeVUXH0ffEsInNm7TajK0fz+5umsS8tvIfuWKfjAmZSGlcsy7G7/8IKSdkEP2EOkS+IyGDdzyHRZuU9C9Rh0E1MtpmTucxZyQDPHHhIotpMThAQXI20cnTCm3gq8aRLyj56kbjZuNPFE04JExmrPgvo77SFTl489a4aRHSdNuiSfjmwux32WPtT073pv7lZWuyEADjVVrhKITzG3aLtlTx6/PVW 35+Wc31a wgPuIpbACmsKLT1INkKxvpzFnHU+rENK9vQj8pfxN295zhgW7qzePMdVtO5nlvqdrP/CIc+8wUHFt2BGS9iyIcnMuIyMwxd8uEGw2A2dtW/DRgGXQActBirCgbonH2lYAHar9kWgQtUEWFhPr2jmvnwqUdbXRmFU6dP4Ck2Wwtw5XzBL9jgV8fMri5gZo+AZ3DFI6oyiCaK0F9zaSnuL0GHOCr84yNupWOVB6vM3suLe/jjilw6WcsHQjCtbd/og7kxM792fuND7IIQeHre9Pr7kDqjEVc+Rt6zBfyiSHZcVWOjlPpsU8gMIj6wsYfMWfMLxcTglp6f25wpItfFxVi3ChPDwFH0Snw/ImYoGvFcro2NAe1fQd8KPdzCm3F3TFH7rwP75tiqrS7BAPBOi/kyDglRJcRCeG2VLFAkKo/YZhmj1SS49UCw/j59B4rGcEx1DgTpz81YGyyJPRo6/u7Jbh9PFK3tcrJypb 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: List-Subscribe: List-Unsubscribe: On Thu, Nov 23, 2023 at 11:31=E2=80=AFAM Andrey Konovalov wrote: > > On Thu, Nov 23, 2023 at 1:39=E2=80=AFAM Hyeonggon Yoo <42.hyeyoo@gmail.co= m> wrote: > > > > On Thu, Nov 23, 2023 at 8:12=E2=80=AFAM wr= ote: > > > > > > From: Andrey Konovalov > > > > > > When both KASAN and slub_debug are enabled, when a free object is bei= ng > > > prepared in setup_object, slub_debug poisons the object data before K= ASAN > > > initializes its per-object metadata. > > > > > > Right now, in setup_object, KASAN only initializes the alloc metadata= , > > > which is always stored outside of the object. slub_debug is aware of > > > this and it skips poisoning and checking that memory area. > > > > > > However, with the following patch in this series, KASAN also starts > > > initializing its free medata in setup_object. As this metadata might = be > > > stored within the object, this initialization might overwrite the > > > slub_debug poisoning. This leads to slub_debug reports. > > > > > > Thus, skip checking slub_debug poisoning of the object data area that > > > overlaps with the in-object KASAN free metadata. > > > > > > Also make slub_debug poisoning of tail kmalloc redzones more precise = when > > > KASAN is enabled: slub_debug can still poison and check the tail kmal= loc > > > allocation area that comes after the KASAN free metadata. > > > > > > Signed-off-by: Andrey Konovalov > > > > Thank you for looking at this quickly! > > Unfortunately the problem isn't fixed yet with the patch. > > > > I applied this on top of linux-next and built a kernel with the same co= nfig, > > it is still stuck at boot. > > Ah, this is caused by a buggy version of "kasan: improve free meta > storage in Generic KASAN", which made its way into linux-next. > Reverting that patch should fix the issue. My patch that you bisected > to exposes the buggy behavior. 1. I reverted the commit "kasan: improve free meta storage in Generic KASAN= ", on top of linux-next (next-20231122), and it is still stuck at boot. 2. I reverted the commit "kasan: improve free meta storage in Generic KASAN= ", on top of linux-next (next-20231122), _and_ applied this patch on top of it, now it boots fine! -- Hyeonggon