Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp71684rdh; Wed, 22 Nov 2023 18:58:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBOYBqm6hjUYF+yoeYO4GgPkMCe4KQl+U/FMeZjK/pQ4ivwRfVC1LxukX95TDviHR+Mkv7 X-Received: by 2002:a05:6870:7d01:b0:1f0:4108:bc87 with SMTP id os1-20020a0568707d0100b001f04108bc87mr5343477oab.19.1700708304306; Wed, 22 Nov 2023 18:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700708304; cv=none; d=google.com; s=arc-20160816; b=hsMP/apAb+eMTZc24HXxWCFr1Ylgl0vtLJd/SbnBe3Fv/UT4BfcqQL6dFk8XZIKdNp 2fFsWZuCdnefK1joWPD7SJKXQ2owkZLKlZT9fSRDIxaC9d47VCRR52lO8InNe0tkc+q3 zjV5mnsjdr/fkT47XxnmeqlejLm1jrDhiTecI8NFuU3gUjtIQw89dNMJvAQJVNAhdWJZ 3xumjWASmtgpiwxPR++eaAXxq2P6KRQjoFrsGq9CG7cvZcz7qOUaU5xF1GU2AvoX57/i h3pT3R1sfdgm/dA6gNam6wtpOP5WN1JLaesEfmypnkf0rBux9qXao/jljmNGt964dAdW tiyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KNqhJS4E6ntiOthoCCp30Dce98FPuWbxjBUizuT5qHE=; fh=eQ3tmEpMl1bhz7wzJ6U1QYJhLcA51CamE1Xf+NHyjgo=; b=Wt90eFJSE7usmjYjynXPGLlgZRk7e2wcFTb3/razmmOCZi7HSVuIE7Aqqc7IcS/J7O xmZnFsulUYj36v8QBVrztbyeNUhTWkcIRg08qMAcNdQJ1ylxtLdd4Xd55PsPn4ra60+R z2JbS/7cxm7A6pciLTj66+Mf5325n2kVl0XkWUiOOuxJa1neM2H+pgNcKkZLh9wV+mYe dWIildnJ2wiu7ED9fGTvR6ouZ5BJuRAdU0HKoC0mbeAVKpVjhkP/BX4bpR1UAWxEgZAs fWbpX/o73ncpavYUITfLuAt7r/OqZpvqeiAxKj/xr9gVhW4XEEo25/PkELBv4wTPLVew GTgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iP1qw2Wk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id ip8-20020a17090b314800b00274df6d4c38si408395pjb.89.2023.11.22.18.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 18:58:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iP1qw2Wk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id F123A825B521; Wed, 22 Nov 2023 18:58:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232736AbjKWC6J (ORCPT + 99 others); Wed, 22 Nov 2023 21:58:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232584AbjKWC6I (ORCPT ); Wed, 22 Nov 2023 21:58:08 -0500 Received: from mail-vk1-xa33.google.com (mail-vk1-xa33.google.com [IPv6:2607:f8b0:4864:20::a33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3DDD101 for ; Wed, 22 Nov 2023 18:58:14 -0800 (PST) Received: by mail-vk1-xa33.google.com with SMTP id 71dfb90a1353d-4ac023c8f82so159356e0c.1 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=vger.kernel.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=iP1qw2WkutAlJ0p9m1MAxYyEou3SU380kIzvq0R6Q6L3KBhyhqnLJ38MeIt7SvrDY8 4riBLYMR7dNR3UvqvOPqkpF+z/SIZr/XwECHUA97Ied6IgKwxNNfOPY/Ch9AHLdB7Zna /RV3xbbCTIT0A3FOud7n8d6adkI5Ue9Ywo8yXU8aWk+uK01l/Of9IyMF57SqQZ+3N9aV mPT8KgiBy9iia9Wm2UsSvDPDjgzGT65mQOhWf2/3xcfxBtzex8JzmlLyL1n7QmdsSvso K9G1xCSzpoqedHsMpFV3egUVKjxkVKRa4HacUdgZ6j9A1IcpdWQzsvzMZT4E/Pnd4hbx YHmA== 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=a+DaiNCH2lH1+2o72yUcOzBYlkC1NdxOEWSciwajV8yutMLPyMJxUhDQlOlnT7mYrX zvaVzp4307Y+uDpWlm1Ghb86Cu8jQlimdl0LglMquh1zxlxBGDBAqS6dZuv5Of+6gvF1 Sty2Iv5ak6OssszKxXlu7ZgHeDfTIXiVa/q7cK4xtgq06sXuhMXNtEfRYtnCr1cCaQsh IUGrj9PHU3OzS8nqDDUeLgO3Uk2xy9WYzzMPItcNcsvGnuEUbc4fgm3WgSbGRP1GIdHx zjHiVMb+qLH353G2pznXISERv4r5Kyzob2rbK6KI87V8DRo3+WmsB1Jv62xaO+T0ZVn3 m4OA== X-Gm-Message-State: AOJu0Yy0CEt0/iFSGK7WNX8+O+gzzCE801q5NghoJxez7thntfVgY3PF ovHsMCuaTCtiZUxrJqeWX2GMkap0OtTKlv2ezOc= 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-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 22 Nov 2023 18:58:22 -0800 (PST) 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