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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 B2D25C4338F for ; Thu, 12 Aug 2021 14:53:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 803AB610A4 for ; Thu, 12 Aug 2021 14:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238203AbhHLOyV (ORCPT ); Thu, 12 Aug 2021 10:54:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236470AbhHLOyS (ORCPT ); Thu, 12 Aug 2021 10:54:18 -0400 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F877C061756 for ; Thu, 12 Aug 2021 07:53:53 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1628780031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=y4INfxuNvGKmJ7fA8mFpegB4/XD7G/W0BELDU6wu598=; b=olo/lvSAvBkGdMgJajSr08q+Aq3l7q9njOKWjWFce2KNAfP7eaZ31El3QqgK3k8fvjPGh1 IKEl7ot+Re6s9j8P9hPd34yzy0QNWjkpm0Nl5lc7Y0CUDvi947qU3b5nIOtTJW86Zc6ezu f+stVRrmpOwC7pm6T3tDAY3HU9RDyg0= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Andrey Ryabinin , Marco Elver , Dmitry Vyukov , Alexander Potapenko , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/8] kasan: test: avoid crashing the kernel with HW_TAGS Date: Thu, 12 Aug 2021 16:53:27 +0200 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: andrey.konovalov@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov KASAN tests do out-of-bounds and use-after-free accesses. Running the tests works fine for the GENERIC mode, as it uses qurantine and redzones. But the HW_TAGS mode uses neither, and running the tests might crash the kernel. Rework the tests to avoid corrupting kernel memory. Changes v1->v2: - Touch both good and bad memory in memset tests as suggested by Marco. Andrey Konovalov (8): kasan: test: rework kmalloc_oob_right kasan: test: avoid writing invalid memory kasan: test: avoid corrupting memory via memset kasan: test: disable kmalloc_memmove_invalid_size for HW_TAGS kasan: test: only do kmalloc_uaf_memset for generic mode kasan: test: clean up ksize_uaf kasan: test: avoid corrupting memory in copy_user_test kasan: test: avoid corrupting memory in kasan_rcu_uaf lib/test_kasan.c | 80 +++++++++++++++++++++++++++++------------ lib/test_kasan_module.c | 20 +++++------ 2 files changed, 66 insertions(+), 34 deletions(-) -- 2.25.1