Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp730433pxt; Thu, 12 Aug 2021 08:22:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz85T6NDoD0v6KimMQFJX+s2bIR8Fc9Ft0CnAy3K+xRpDinowArltsGqE1bnLVGfXKVUHWP X-Received: by 2002:a17:906:c443:: with SMTP id ck3mr4105012ejb.195.1628781745387; Thu, 12 Aug 2021 08:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628781745; cv=none; d=google.com; s=arc-20160816; b=r319JIOnuSsKXWnjpZnWAtmVIPqctv/oduzAeRFGR9Bxx5ByjOxjbj9G/UDDhpu/nG N+HgLEGVOw8Yap4Fwttx7EYf4z558I2kUUrYiWzOBmwJZY3gT5KV2BJSGCxDvDwFhBIv wbuHa4epwyUCrlCLG/qiPjrROU+AGNyAdpr5wR9d55UeHti5Ol/dmUpDAQgfryK9CrlR kvrtr9O5C5bgcDWjenadtbV5Lss8DOzFlxIYaSEOhUBzD0DRZonxU+NO/cfY0unkmVaY 6ORQZEaHmM6PfdzTdIeF4FYGN6e8YxPBqDJ+NmCed2HoMR5UW6i9jm7VzJKV2aM+ocqn qQOw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wLYmxDSn8yRlvCuXwA7dhNRH5OHfdPThVfS1yzZfw8s=; b=pwP1kPR/LG6U1TcAU4uTm0EHy6tqSD4aA3cEz/aTbfgqvhAVSQwwMRQAMfVEfpNamF HhmZwkGU7hmF0/eVlBXZ4rgMC83EMzswV+ZSZl909bOBSsz67Di7qwa45dMPi1CMRKoF HO9UlNUSq7cV0iXO/ICTkoc/wh8FcS90MioCrIHB3xTfYcJxaEtKYPIaXODQSB/IzUfa gCUrqjJHiI3mfiQ/ylhxCsPuLmq5hhBGRWzk2kyPkxit3x4ZImvdATnZgAtqhmPmBZjP tsWheSYtJI/ZwfcSJ5do+2G9ekypxDx02EI53JAn8h5RHgHkB2w/n8ngHZPv4AawYfaZ RvUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="qyNj2/4L"; 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 p9si1059389ejd.525.2021.08.12.08.22.00; Thu, 12 Aug 2021 08:22:25 -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="qyNj2/4L"; 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 S237232AbhHLO5K (ORCPT + 99 others); Thu, 12 Aug 2021 10:57:10 -0400 Received: from out1.migadu.com ([91.121.223.63]:27993 "EHLO out1.migadu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236417AbhHLO5K (ORCPT ); Thu, 12 Aug 2021 10:57:10 -0400 X-Greylist: delayed 70504 seconds by postgrey-1.27 at vger.kernel.org; Thu, 12 Aug 2021 10:57:09 EDT 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=1628780204; 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: in-reply-to:in-reply-to:references:references; bh=wLYmxDSn8yRlvCuXwA7dhNRH5OHfdPThVfS1yzZfw8s=; b=qyNj2/4L4qC1jYYMJ0qKJnAT7LSTH56iqndM1Ypp/eSyeGZ8vj56KPYO0gmbjJ+hov1PSm N6RJjphfvkVM6uC2LTY76FoNbXcXNmLMDeJuuV43soDoOJ0sMahCEQsyhKV2oH/6JfpifJ 7X7z5dmbyyhErQjYsZ4UB8xulo/AbGI= 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 6/8] kasan: test: clean up ksize_uaf Date: Thu, 12 Aug 2021 16:56:41 +0200 Message-Id: In-Reply-To: References: 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 Some KASAN tests use global variables to store function returns values so that the compiler doesn't optimize away these functions. ksize_uaf() doesn't call any functions, so it doesn't need to use kasan_int_result. Use volatile accesses instead, to be consistent with other similar tests. Signed-off-by: Andrey Konovalov --- lib/test_kasan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 1dcba6dbfc97..30f2cde96e81 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -737,8 +737,8 @@ static void ksize_uaf(struct kunit *test) kfree(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ksize(ptr)); - KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = *ptr); - KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = *(ptr + size)); + KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[0]); + KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[size]); } static void kasan_stack_oob(struct kunit *test) -- 2.25.1