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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 26059C4338F for ; Thu, 12 Aug 2021 20:56:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0727F60C41 for ; Thu, 12 Aug 2021 20:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233984AbhHLU4Y (ORCPT ); Thu, 12 Aug 2021 16:56:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:48888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233651AbhHLU4Y (ORCPT ); Thu, 12 Aug 2021 16:56:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 92DD560ED5; Thu, 12 Aug 2021 20:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1628801758; bh=r2sILwec1nlPxCkn7DYjNbfoPTzDTJZj94PVe/Y/sEM=; h=Date:From:To:Subject:From; b=GlOKA39kBQvTLKGbTsBxGTI3wefX/a4VazvTo5kexqWWXUlsaeC44PZ9A/cNCfxuz InYLcx2owJ4zFOAIXsemIRW+cqjRN5cyb1uEyMfA6/dlNyiFyTv/4J7aCdlYs8HZ5f ICYcrxICUHmP7b6z0yxGyN9l+nZORJmK7BZrvf+c= Date: Thu, 12 Aug 2021 13:55:58 -0700 From: akpm@linux-foundation.org To: mm-commits@vger.kernel.org, glider@google.com, elver@google.com, dvyukov@google.com, aryabinin@virtuozzo.com, andreyknvl@gmail.com Subject: + kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags.patch added to -mm tree Message-ID: <20210812205558.6dOVQ%akpm@linux-foundation.org> User-Agent: s-nail v14.9.10 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: kasan: test: disable kmalloc_memmove_invalid_size for HW_TAGS has been added to the -mm tree. Its filename is kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrey Konovalov Subject: kasan: test: disable kmalloc_memmove_invalid_size for HW_TAGS The HW_TAGS mode doesn't check memmove for negative size. As a result, the kmalloc_memmove_invalid_size test corrupts memory, which can result in a crash. Disable this test with HW_TAGS KASAN. Link: https://lkml.kernel.org/r/088733a06ac21eba29aa85b6f769d2abd74f9638.1628779805.git.andreyknvl@gmail.com Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Cc: Alexander Potapenko Cc: Andrey Ryabinin Cc: Dmitry Vyukov Signed-off-by: Andrew Morton --- lib/test_kasan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/lib/test_kasan.c~kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags +++ a/lib/test_kasan.c @@ -501,11 +501,17 @@ static void kmalloc_memmove_invalid_size size_t size = 64; volatile size_t invalid_size = -2; + /* + * Hardware tag-based mode doesn't check memmove for negative size. + * As a result, this test introduces a side-effect memory corruption, + * which can result in a crash. + */ + KASAN_TEST_NEEDS_CONFIG_OFF(test, CONFIG_KASAN_HW_TAGS); + ptr = kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); memset((char *)ptr, 0, 64); - KUNIT_EXPECT_KASAN_FAIL(test, memmove((char *)ptr, (char *)ptr + 4, invalid_size)); kfree(ptr); _ Patches currently in -mm which might be from andreyknvl@gmail.com are kasan-test-rework-kmalloc_oob_right.patch kasan-test-avoid-writing-invalid-memory.patch kasan-test-avoid-corrupting-memory-via-memset.patch kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags.patch kasan-test-only-do-kmalloc_uaf_memset-for-generic-mode.patch kasan-test-clean-up-ksize_uaf.patch kasan-test-avoid-corrupting-memory-in-copy_user_test.patch kasan-test-avoid-corrupting-memory-in-kasan_rcu_uaf.patch