Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp468131pxt; Thu, 12 Aug 2021 02:43:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFlht8FHJgEjmxpVzoqsKqW2QxeL1va2ApuopCbWqYR3I19tff/Gpi/zrwxS6xfeZkh7Tm X-Received: by 2002:a92:cf0d:: with SMTP id c13mr2219885ilo.49.1628761410419; Thu, 12 Aug 2021 02:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628761410; cv=none; d=google.com; s=arc-20160816; b=fABu2kBr3aEp9m77jzZdmn9sww6wAXd9OniQNiH0hOV/kLnBYZHkgGHsG7Uitw9gx6 3XA+STfm4roaAENXdWauMMr55yyXo4W9H0yx8yw/mvxs8tt5zYf3kfRSj1D0/1M0No7u 1lQSvMNSzV2rTOdQFBZW+UVPm9AFaWLCiYdQm1XmJX/qh5SZZKnM/HIcErfI1+g+rmER qBbhOH8ob5IBOGL711D9gu+M/bKIsD/R+Z8SgVuWpp+K/TpXON2C+Ptt+UVQ5CMKlktg AOQOztTaRP4GWORQe7/S68X9f8B6NOsFv+xeb2vWFXzdtEraIjJtoHON7MXatQmTx5O1 gutg== 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=Az2ike7xADR+kcJZFa8tXN1V5SP3VTm+A32wNNbsp6w=; b=XdNlOkYUtrJLyfEFkQSXUVB2zeT5+roQ6J3pUZOxG2c5nCIsqqBg0ni7F2UhUdsHzf 1V73C2rH3Y99PZaDW0WkoiAexA1gz5LIdG8teHeTL/OwFhSgYBm7hy6b1RNRKRqGpQTS RLqWjHIkRfhhZUfiJ8PFSCQPjr8MBp3fK55/VcdOwRjOnJ9hSPSjGI7dLLHpwTtbAPY2 B/IAqk3HA8lidkz7rpMV4ru+65lLKi37Xci+3f0NIg3aeqAtBDpkzF8G7okAfnjIMQhX PWmTj0grzw/KZdZ6jh+vmH10UV3GbnMY/s3QADqkB9EGrQPdwxd8T0+iL2MlZPkzBJdu ol/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=u1i8Cx7r; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si2451534jao.100.2021.08.12.02.43.19; Thu, 12 Aug 2021 02:43:30 -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=@google.com header.s=20161025 header.b=u1i8Cx7r; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235469AbhHLI6D (ORCPT + 99 others); Thu, 12 Aug 2021 04:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235451AbhHLI6D (ORCPT ); Thu, 12 Aug 2021 04:58:03 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13977C061765 for ; Thu, 12 Aug 2021 01:57:38 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id w6so9182318oiv.11 for ; Thu, 12 Aug 2021 01:57:38 -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=Az2ike7xADR+kcJZFa8tXN1V5SP3VTm+A32wNNbsp6w=; b=u1i8Cx7rVJHryya2B4C2ZBwhWRGzSp7oRmg2YlORyLAw6fXdrVpS+bxhezSx53dMe8 F7vUU7Lq+y+HWjOp9K0JB68UNM5+7Yhvynq2A2AOy00fnGAhj4SnCsGxpk01hYZ9A271 ivq4irRtBaPK38jTcx/mdF3KgS5nB9Ul2Ro8XnMziQCgmBIziMxoS+MZV7djEcOToPmY LTXAsqIjcT+SkCwNVZ+LnbqFWJO02tpHlpez6SXENhe0MCWMbYRbBtkmGRbH5fFC++zL NqAu2ymUpiSm1HCR7ZzsA6okeKQ2zEa4pVZoPSO567PwfL14DYOfF4p+PHmUheZoB9RZ FUdg== 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=Az2ike7xADR+kcJZFa8tXN1V5SP3VTm+A32wNNbsp6w=; b=tjPT1BNrwUsSuq3erND+Uk9V+RRXHdQSp2ttVKIoTdMtVsKNIFeHPqzYFVeu34O3Az iNBZC5EVskMWgWBTQtrvYkYNOTTt86xJKGauxv3ZvnDMtNVDS+NLxFSgWMrc9UvPjZRi n1zCZGbyAX6++DPKwoE2i6PppF9yaP+p24jmJtnVRa+PYDYbN4GixNXkSC9dPkKdK/AO WZGfTLLWP05tHqfKopFZVYXUcysVzMmBk+ovSVLUk2gWR1CFd84NuZzPBFrqCMF+pCGG z7FNtto3wh1R2w/CDlB9efQPH61lMH/B66uJQQ98Q9Ddh1VS/4YWU+/J0+s6AKzSzf9x dkKA== X-Gm-Message-State: AOAM531NOCC2C/QZqauWDcg4FV9yTcUh+SE7GlNl9/EXFnxF8KmkItmy 0AuWxIXf27J2rWWEzt9Kb+eogLUY6Sw2zs1EaO5lhw== X-Received: by 2002:aca:5301:: with SMTP id h1mr2626318oib.70.1628758657248; Thu, 12 Aug 2021 01:57:37 -0700 (PDT) MIME-Version: 1.0 References: <408c63e4a0353633a13403aab4ff25a505e03d93.1628709663.git.andreyknvl@gmail.com> In-Reply-To: <408c63e4a0353633a13403aab4ff25a505e03d93.1628709663.git.andreyknvl@gmail.com> From: Marco Elver Date: Thu, 12 Aug 2021 10:57:25 +0200 Message-ID: Subject: Re: [PATCH 4/8] kasan: test: disable kmalloc_memmove_invalid_size for HW_TAGS To: andrey.konovalov@linux.dev Cc: Andrew Morton , Andrey Konovalov , Andrey Ryabinin , Dmitry Vyukov , Alexander Potapenko , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Aug 2021 at 21:21, wrote: > From: Andrey Konovalov > > 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. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > lib/test_kasan.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/lib/test_kasan.c b/lib/test_kasan.c > index fd00cd35e82c..0b5698cd7d1d 100644 > --- a/lib/test_kasan.c > +++ b/lib/test_kasan.c > @@ -495,11 +495,17 @@ static void kmalloc_memmove_invalid_size(struct kunit *test) > 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); > -- > 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/408c63e4a0353633a13403aab4ff25a505e03d93.1628709663.git.andreyknvl%40gmail.com.