Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2940706iog; Mon, 20 Jun 2022 07:56:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1thxxKtQgeQDpEyv0iOKolHD6Jagje34J7rrAVm3JHtp24tdgXogpQEZXOgAZUE0DWHlRg5 X-Received: by 2002:aa7:97b6:0:b0:525:20b4:be8 with SMTP id d22-20020aa797b6000000b0052520b40be8mr6699728pfq.7.1655737014957; Mon, 20 Jun 2022 07:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655737014; cv=none; d=google.com; s=arc-20160816; b=EGqOWK17dKmJ2xrTVY4WDLEzNyLEJdwcPNVjnB+4aVZJBWSczWmBbuUzWDC9vl/ksd Eya9zOZcRADE9npeG9o+fUOApQWMSXq22lSpXyPf4KmLbLaen2OfOZhkDx9XY96+YARc 2k6SJaXRww+Gdbj5Ee5HyDHzK2tLs4nVW3Pr2Fn1tvjbaT/HIhdWD/Md4WnxSCz4udne EOqnndd8P9Cy9ofeBUItTnWhnd5AraZl7PBnBRMw4uOOVW6JP1tuDf8TTdaTe7Xm+3OE zYWcB7XKgmAH3MNsHDFUBSaRxgomqKMbZhLZuMOaOl8bWVa9O2RrtyXSi8gxXLQaE/1s eTEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WS4VFRwLCNQ3Gv6onv6Grnwt8jHHc1O3704ajv1HwX8=; b=Od31zvMTq2Hlf22lcA3l4knisQtBLoXwp5DR0DjkBd1r6Z5/c+j6IGtsdz3/tcf7LD XqPG5XFnE0Cx9Nwz54AeAYmMNwOWN7f/IKsbBKWLlYWGx5aPsp/PstMOLkkpuWKevXZd I7lylWJrfEnzs/uJtlTPwui722Nw76MSFnAOlXF3jJfi/SM0TsEmrSH+0Xkr6SyrkpQo qS4YqZOKDM6qbuVDdYhTJH1HGBnDE32Yq1gDzHYMY8P+UQVe7yszZ0IcnkP0QEK/SrVd iP3/deMJlysXUX5zPoNoVlb25rJnISMjVYxcXXOMjjp27zvNH6Odvc9JmIZLgVJ7fDCn XWfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=oe3RFUCF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a63f947000000b003db379692e2si9950498pgk.181.2022.06.20.07.56.42; Mon, 20 Jun 2022 07:56:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=oe3RFUCF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346024AbiFTOYb (ORCPT + 99 others); Mon, 20 Jun 2022 10:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351057AbiFTOYH (ORCPT ); Mon, 20 Jun 2022 10:24:07 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F29FF1FA6D for ; Mon, 20 Jun 2022 06:40:02 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id l11so18987771ybu.13 for ; Mon, 20 Jun 2022 06:40:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WS4VFRwLCNQ3Gv6onv6Grnwt8jHHc1O3704ajv1HwX8=; b=oe3RFUCFtQsf2C6GbVuLT4H9zsB2uSOBU8ynW0d58tLz9eliKUvPOnd7yGRq8ujcgj bQEYRUlPrSOo51iJQlpJvSxpxQ3NW5hhBldbwTnE/1cHebxP6baEdZoUlcfKnPC7hA+D ItrLiJO0KmnQCCN4GpecieYlpdTU5X+JyGAdi06uXyJA68eQnMEtAPDwqXeC7qw7x9CL DH7/GUHyMf2n/Okv3gqxzoJ8M9p35Lk+Nvyj1OYHvn3XtR8EJ3EVwIlh93wnrX0ufJjy dSx7vAqQTl7KhADa5j36BnlSMSoazoQtyrN1iTgjB6TAXwv2f/IVdtHQwUDhiXtB/OpE xQ0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WS4VFRwLCNQ3Gv6onv6Grnwt8jHHc1O3704ajv1HwX8=; b=ZFDDxSYJtANTndM1NixHGOshNfn0ncrL0aSNz0NZ0jxVZvM2ky0NShGggZm8aaURuK kOSx3jDYWdVeAhHQpkg/EyoISOBriouAUBptMd2kyznsUUE1L0MIYLU5vC79m8r7ynYy RvyNeFVFyxl667CPbVNpAGhJpf2jnu/rMHhfw1bxNdKvHoJHkepEBI57xg5uAGTf4WoX oVxGkdWA4d6zogf8eeMxWt9dPHhaElnaK9ConnbcqEKwbqWSbbROynBSN70VcqwoEB2+ 5v5qye3djxouoKnTjjHZcG/UScIX/GYLTOPX9K5ZDbtVuehBMgs4KJz1tzJzE+eTd8Mp E/fw== X-Gm-Message-State: AJIora/NFMi78Btnfo16TsgNRfaXxNIsF7zpk1MePWL+zbsoHTyqQtTP ATPC00/sWifAJNdvWypTIG3gi3d05VsDcebP+ndvqg== X-Received: by 2002:a25:94a:0:b0:668:df94:fdf4 with SMTP id u10-20020a25094a000000b00668df94fdf4mr10943765ybm.425.1655732401678; Mon, 20 Jun 2022 06:40:01 -0700 (PDT) MIME-Version: 1.0 References: <91406e5f2a1c0a1fddfc4e7f17df22fda852591c.1655150842.git.andreyknvl@google.com> In-Reply-To: <91406e5f2a1c0a1fddfc4e7f17df22fda852591c.1655150842.git.andreyknvl@google.com> From: Marco Elver Date: Mon, 20 Jun 2022 15:39:25 +0200 Message-ID: Subject: Re: [PATCH 01/32] kasan: check KASAN_NO_FREE_META in __kasan_metadata_size To: andrey.konovalov@linux.dev Cc: Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Peter Collingbourne , Evgenii Stepanov , Florian Mayer , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 13 Jun 2022 at 22:15, wrote: > > From: Andrey Konovalov > > __kasan_metadata_size() calculates the size of the redzone for objects > in a slab cache. > > When accounting for presence of kasan_free_meta in the redzone, this > function only compares free_meta_offset with 0. But free_meta_offset could > also be equal to KASAN_NO_FREE_META, which indicates that kasan_free_meta > is not present at all. > > Add a comparison with KASAN_NO_FREE_META into __kasan_metadata_size(). > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > > This is a minor fix that only affects slub_debug runs, so it is probably > not worth backporting. > --- > mm/kasan/common.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/kasan/common.c b/mm/kasan/common.c > index c40c0e7b3b5f..968d2365d8c1 100644 > --- a/mm/kasan/common.c > +++ b/mm/kasan/common.c > @@ -223,8 +223,9 @@ size_t __kasan_metadata_size(struct kmem_cache *cache) > return 0; > return (cache->kasan_info.alloc_meta_offset ? > sizeof(struct kasan_alloc_meta) : 0) + > - (cache->kasan_info.free_meta_offset ? > - sizeof(struct kasan_free_meta) : 0); > + ((cache->kasan_info.free_meta_offset && > + cache->kasan_info.free_meta_offset != KASAN_NO_FREE_META) ? > + sizeof(struct kasan_free_meta) : 0); > } > > struct kasan_alloc_meta *kasan_get_alloc_meta(struct kmem_cache *cache, > -- > 2.25.1 > > -- > You received this message because you are subscribed to the Google Groups "kasan-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/91406e5f2a1c0a1fddfc4e7f17df22fda852591c.1655150842.git.andreyknvl%40google.com.