Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4717963pxt; Wed, 11 Aug 2021 12:24:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgeNW0hy7MscDa0txWkx3bKwoIccZHRAeRY+nsrOmB5+fO0ZqmpA33gCPLw34nydj7w3eD X-Received: by 2002:a92:c144:: with SMTP id b4mr18231ilh.67.1628709854033; Wed, 11 Aug 2021 12:24:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628709854; cv=none; d=google.com; s=arc-20160816; b=P64u6L63Le4cgKwam/HfLkkcACEs3oa+QtrELTzF2wlFxNbqZLChvQ4DE0Tje5lKnT ISh1vGeIQl+RdSSfHFJF+jQp+sQ1Sm0ScuqLMXfVGF+04ls9Xob9dFD+cCuhs7w2x35H o88eTOyvUGQbhUsEYtw6Y+sFT/NYN/NupZslLiLQfrBPdiZtmxwA+cvSp8lYG4b9/vBK gyDokZXseb5SGoWVehWQrnwIUGrc4tYy/oy5xIsDS+WSUGyKXS+rmx5tqvyun84XzCue vYyqnjQbBf4qWTugZfDDhrNnjfXi55tZZxyIwJT9zdETjkZwvSynUDPxu80tbZ7zu6Q8 S8EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lNfCPiEqsvC4j0wratT12NabqkYWU1ro94i4c/TmnC4=; b=AKaPa/vXEJhvEsgyd6TlwqeVyakNkgnQG6BefSwbrokRacADVfYl4VDEiquuUP6lAJ 7zLE0Svgc9K4aSKnZcG6AdNdRF/dvur85zkN1GfQ9tsl2Ad2h6mKR7cst20shi45ANs2 GnmR/4B40+1n1JNgbSVUAhhOs0tEEmekreD0/dmd0edb3ZDhdfl1pv/5+nkTUz3tkd4c SMaZdkJuqJIt69MipW97/fvu0pgGIYVTF8vx9ck3TdJc5zmyiJGjj7r73CHEa1xITycu idwF0a/7KpOM+nimf1fmCmd9yAsj+zYiVujYDE3DY6UVVj8Rd+ZcY1YrMuMfcPyU+Gee Gm9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XglRGggb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e101si350869jai.50.2021.08.11.12.24.02; Wed, 11 Aug 2021 12:24:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XglRGggb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231546AbhHKTWJ (ORCPT + 99 others); Wed, 11 Aug 2021 15:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231330AbhHKTWH (ORCPT ); Wed, 11 Aug 2021 15:22:07 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91306C0613D5 for ; Wed, 11 Aug 2021 12:21:43 -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=1628709700; 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=lNfCPiEqsvC4j0wratT12NabqkYWU1ro94i4c/TmnC4=; b=XglRGggb+pI2XH3q6+ggFWTuR0jX4ckwAYAUmIfagJThGhgC/7QZX1hfKuOAGhq6xNszaO Z67Nz1sJ248zvpOiPIOsu0g5JNGjEClO3VneWk3KubQNT25rewG5JB2/7EFTDyzniZnNLi huZJrCjAYG/pFvA/50a16+4PbqfGX/o= 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 0/8] kasan: test: avoid crashing the kernel with HW_TAGS Date: Wed, 11 Aug 2021 21:21:16 +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. 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 | 74 ++++++++++++++++++++++++++++------------- lib/test_kasan_module.c | 20 +++++------ 2 files changed, 60 insertions(+), 34 deletions(-) -- 2.25.1