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 X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 832E7C43457 for ; Sat, 17 Oct 2020 07:43:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DEE002072D for ; Sat, 17 Oct 2020 07:42:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="S8DTt5Vg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEE002072D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3E6756B005D; Sat, 17 Oct 2020 03:42:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3703C6B0062; Sat, 17 Oct 2020 03:42:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 237D96B0068; Sat, 17 Oct 2020 03:42:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id D75606B005D for ; Sat, 17 Oct 2020 03:42:58 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 55E33181AEF1F for ; Sat, 17 Oct 2020 07:42:58 +0000 (UTC) X-FDA: 77380626036.10.tray85_1b01b2927224 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 2509F16A0B9 for ; Sat, 17 Oct 2020 07:42:58 +0000 (UTC) X-HE-Tag: tray85_1b01b2927224 X-Filterd-Recvd-Size: 4519 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Sat, 17 Oct 2020 07:42:57 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id n15so5948445wrq.2 for ; Sat, 17 Oct 2020 00:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8nuuz9yi8Y031tKgDWok/ahu1bW/JJ2vJv28TM2RgTI=; b=S8DTt5VgS5NmR9ckDdJlmI2YSnCm5/+Kf/Qsnm+fzcI2WeLBMhr8ZdDOzTMH21TKof mjAFbWH2oGUYeNQjEuw6jbvnD4afwgeUk7YL0VOrSAdV6h5nEU7KhYjUlt+ctOBvux9Y nwMa036rpr+SgzuU5mouaZows2ZQ3RzC6txnlZwlCW93tzv/fw/OFv8TJ8tdxOAUayrM VpnMA9fE0olI8hz7aoFlRrpkVdTutZ2dP1eijwFz5naBlzSFbfHsGq2YiyXhh5hMo2Ih YTpdmoZ/yNkZDqeoAjuCqDoiQEPKXplSRD5Df7eGCOc8PpLEdL6XRKZcU8Fx8hyx+JyN +4PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8nuuz9yi8Y031tKgDWok/ahu1bW/JJ2vJv28TM2RgTI=; b=IOotTMWtOnFUlKPi5sKqF2YTSB4/gzHyQWrVNtlPuP9CHnEglK1k69vro9boTjpRcl fLWXctckFDE3nlwCuk33rqr3AZrO0eMhP0IEVylNg0p/4fLk7VrZzGZ8xKm4sx9xqIDT zhX++s6DdNDomTAAevqKP2/qrbX/qp/QvQt76VgIKXYyVhGfIQWOWBXgULIuL7sFG1Cy MOBa6Ics83YbX/HOLfUZOFOxp1bKN6dHVd9PCocsh5V/Cawez9gnQDTBch0PRQMXgysl pwxL0Dr9O/wxNWcY5kYV3DnznvQ1Ls5AeGGeuwTXnV8w3mXDlSVu8+5KwcxVi6ePkAaj VfEQ== X-Gm-Message-State: AOAM533otk9J1OVVApBvKfYJinmacjFVUIG/4hPtpkEwB4jdJJhLFtnU j817vADLzr0/TGaEXvNxykrwOmg8xNiRy7UKTfsLAA== X-Google-Smtp-Source: ABdhPJy9A/6uEDOmpUZ9DKM+fvbvAWksxv9VVCkLa8R4yNFNugKzpc8LHRGHDXZQA4LSXICJ4BplKBwvQHYoqFvltu0= X-Received: by 2002:a5d:488e:: with SMTP id g14mr8889936wrq.203.1602920576419; Sat, 17 Oct 2020 00:42:56 -0700 (PDT) MIME-Version: 1.0 References: <44861eaca17ffbb51726473bc8e86ad9e130c67e.1602876780.git.andreyknvl@google.com> In-Reply-To: <44861eaca17ffbb51726473bc8e86ad9e130c67e.1602876780.git.andreyknvl@google.com> From: David Gow Date: Sat, 17 Oct 2020 15:42:44 +0800 Message-ID: Subject: Re: [PATCH] kasan: adopt KUNIT tests to SW_TAGS mode To: Andrey Konovalov Cc: Andrew Morton , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Marco Elver , Vincenzo Frascino , kasan-dev , Linux Memory Management List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Oct 17, 2020 at 3:33 AM Andrey Konovalov wrote: > > Now that we have KASAN-KUNIT tests integration, it's easy to see that > some KASAN tests are not adopted to the SW_TAGS mode and are failing. > > Adjust the allocation size for kasan_memchr() and kasan_memcmp() by > roung it up to OOB_TAG_OFF so the bad access ends up in a separate > memory granule. > > Add new kmalloc_uaf_16() and kasan_bitops_uaf() tests that rely on UAFs, > as it's hard to adopt the existing kmalloc_oob_16() and kasan_bitops_oob() > (rename from kasan_bitops()) without losing the precision. > > Disable kasan_global_oob() and kasan_alloca_oob_left/right() as SW_TAGS > mode doesn't instrument globals nor dynamic allocas. > > Signed-off-by: Andrey Konovalov This looks good to me. Though, as you mention, writing to freed memory might not bode well for system stability after the test runs. I don't think that needs to be a goal for these tests, though. One thing which we're hoping to add to KUnit soon is support for skipping tests: once that's in place, we can use it to mark tests as explicitly skipped if they rely on the GENERIC mode. That'll take a little while to get upstream though, so I wouldn't want to hold this up for it. Otherwise, from the KUnit side, this looks great. I also tested it against the GENERIC mode on x86_64 (which is all I have set up here at the moment), and nothing obviously had broken. So: Tested-by: David Gow Cheers, -- David