Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp11231pxb; Thu, 12 Aug 2021 09:38:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeEKmHS2uQ855gjWVLDrhksDWqCJMbsXk6A2VAIEpmzVwNLN9k9Q8b0GFLlAedG7B4gHB8 X-Received: by 2002:a6b:ef16:: with SMTP id k22mr3564501ioh.127.1628786330130; Thu, 12 Aug 2021 09:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628786330; cv=none; d=google.com; s=arc-20160816; b=b8ONjOJl7shSvaruWA/amvvOGZkhwWjSknz4iJpAgHXMd2+QqQREFfQRCxwxj687ke tw/bsR1nxoQHn7GOgPkxau/ytRtCjY64mytFW3E/ve/9Bz28rRRF7RrRQ898TolGnavx y1Y+B5hktOTwBtfeZh6G4tOBF+HBbtZkLtvvs4vKZTJd7cA892AwCDFEfOJDeZnQUNhg r9+4Li2rj+MLtll4CTmnrMwUkWfKtD5dDnX+63gVIsS5ael3TmOtg9mwhyQ/z/qVbJY3 y+deQZHubL/xZMV0nq4VU58lYtcD1aOVZBCxM/QE80D9jCHqoSBGWkp+925XNOdWY3Ef D6dA== 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=A7pHKxayGFMZlOwIq/bHkeKVOMFNUJ88V3SLok4nSRM=; b=WMkZd/j2vJ304a9dA103lt8w1tVZQBI3IvNen5vzIk6fPpxGZyUQQ4H+OnvjETmeZ3 DkNX82qOGjIJxffrcghEnJ6jE5S/ExTFUzWUp23MDUYZsddoNp2gAklCtr9dPdAZ4MD3 Il8ZFFC9l/1P/JDDjSxF7rhM50wRu2vBaUBGYi/utmsyJyIYlRnJTMu5bQr+IA5pbV0L 3AcmAN/fBQIqelOvvp2tzMN23uvGbJxd4OqcUGZsKZiE+SbMNYUQ0skgB8JUQ6nsdEd6 UkiEuodhZriRHfISEmNEhhe+at0v+SIIHEQbIP0hVpCkNZni4Aa78fpFUfPe+htm9A+A ShgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AyScEMSO; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q7si3833029jaj.64.2021.08.12.09.38.28; Thu, 12 Aug 2021 09:38:49 -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=@gmail.com header.s=20161025 header.b=AyScEMSO; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237632AbhHLNC7 (ORCPT + 99 others); Thu, 12 Aug 2021 09:02:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237622AbhHLNC6 (ORCPT ); Thu, 12 Aug 2021 09:02:58 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9E75C061765 for ; Thu, 12 Aug 2021 06:02:32 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id d11so11405747eja.8 for ; Thu, 12 Aug 2021 06:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=A7pHKxayGFMZlOwIq/bHkeKVOMFNUJ88V3SLok4nSRM=; b=AyScEMSOxALQVA7V7H0KBjnoYK1AjzL1m1zPaNebYAx4mp4BLFUEGi5Njdc30IszK3 4CZ8q2CP66DEHbi3lNMPHseEX5gETKpNv/vpphK8qK4GyIz07y14K/lc1XyQv9jg+3Pi xK4cS82KOtsHAdQ0A4B67bBFW8tAM10e7fVDRIT1Kd8b6X1XuQNTDWg4+u6H9/9sfreC MF3VCCarR9k7QmUk/jjXymaQuiR1mn9nN2W6kMBM9Kjyly+qB6UBkNMU7Al1WxGhLD6w XPcwPmQOSZgEpLiy4DNcHxluKtXo1cAtFkWz7TQBfacaQ93Q/llEihP7PxraRhFZjeY1 t1WQ== 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=A7pHKxayGFMZlOwIq/bHkeKVOMFNUJ88V3SLok4nSRM=; b=FhsAonNipAOKvJfyTHyWq5/NvJ2tiMPyRtGB8Pwm56J4DtUGhWX/c35SfOED2XYWBv WMo3HF8x9i6NpS5Qfn8jeZp494Ws72zgOyACKbTkF+XTglXbDTRRKaI08X3UrIuUVYdD nW0vAEKnLzoF687PVXXvEJHY+/3fxtma0MNp/5tohTbAFOX2V5tdU9KzJPWLEJCfP1/H fqgr2UMW/QDOkAuNFqVhUjTPtYE3rUVFvDZmAa68CAcN9YMJHZFA57ZKz6DpJjgtTHi9 seglAR4EE+mx8vAQgfCM3o3RAHVhiqWUE/Uju/a5pt6ljhD1N7eg2q6kBtpRlhiM2+nN rN3A== X-Gm-Message-State: AOAM533eBzMfHCDgt/GHVp4jAh7Sl73aa7Ph6/sl1qdYRXhjYkJ1XlqV A3WUYUQtSyuN3m4f5Cyj+OB2I/ZsFbHvFQEP/W4= X-Received: by 2002:a17:906:53d3:: with SMTP id p19mr3522667ejo.509.1628773351053; Thu, 12 Aug 2021 06:02:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Thu, 12 Aug 2021 15:02:20 +0200 Message-ID: Subject: Re: [PATCH 2/8] kasan: test: avoid writing invalid memory To: Marco Elver Cc: andrey.konovalov@linux.dev, Andrew Morton , Andrey Ryabinin , Dmitry Vyukov , Alexander Potapenko , kasan-dev , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 12, 2021 at 10:57 AM Marco Elver wrote: > > On Wed, 11 Aug 2021 at 21:21, wrote: > > From: Andrey Konovalov > > > > Multiple KASAN tests do writes past the allocated objects or writes to > > freed memory. Turn these writes into reads to avoid corrupting memory. > > Otherwise, these tests might lead to crashes with the HW_TAGS mode, as it > > neither uses quarantine nor redzones. > > > > Signed-off-by: Andrey Konovalov > > Reviewed-by: Marco Elver > > although if you need a write primitive somewhere that doesn't corrupt > memory, you could use atomic_add() or atomic_or() of 0. Although > technically that's a read-modify-write. Interesting idea. I'd say let's keep the volatile reads for now, and change them if we encounter any problem with those. > For generic mode one issue is > that these are explicitly instrumented and not through the compiler, > which is only a problem if you're testing the compiler emits the right > instrumentation. On a related point, it seems we have no KASAN tests to check atomic operations. Filed https://bugzilla.kernel.org/show_bug.cgi?id=214055 for this. Thanks!