Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4364773ybp; Mon, 14 Oct 2019 03:33:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjTqKu6uhOJfkzFLuAy7Q4NWvCYNAzT5k956iZbs6a6RzhA697CeQ+PoLsxlIW6N3Tbrmd X-Received: by 2002:a17:906:35d6:: with SMTP id p22mr27769918ejb.274.1571049214004; Mon, 14 Oct 2019 03:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571049213; cv=none; d=google.com; s=arc-20160816; b=yODEB72KIzptUxNLp+gO8Mjz6ZfojtsQzsxDZ/BuVCiv9swetNvZ/ZD7ck2YCXO2fv LjTcZ4LDXCQO5aqB6U67kVYCTtsjmVFYMZYVIqR9rsxUjCj0NB//XjGkIDw5TIiSZj7E CzPmkvJzYKjUtQk4JXKcZTYVfdJtVPqMAUiI6f8t5+PXGDtnBVbesstDItfHdmKgiMvG l42HJJVG4DKtcp7hv6pbQ4gfNGvWVYoSvXikrOpkVGHzaUfNYIVkGXXGQErJJrYShpD3 VuyU/zR9WqYx6y6g6N6XQ5/6NWxIJ4lN01kwD20WL0J9Rby/5/KmILzNfARtr38b2Wz4 OAFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=ekJNpESIgfQv5XYcvnni+dMzANptHYbcKQ4cfKW4hfI=; b=QT8jPyTNKGF8fxmniMS8J//ogQ1B7TAucgWr2E2O+7CZWJszbosMVzNpAXVvHurpP9 mzpHYQyhU9rWjbC5AjCjmFTVH6OYYJ2QzNCq1tadVpTxKm2p62pDiIm8a+vXGQOxSRsO FGFlKc4yLrNpkU35/xy2wzIe50zJCleC/80el/cIV6MfqZX1DOPG4t+Dw7DPymr7VchT ZGy3P3G0RXq87vNwW1zknLFFprLCu0joFjgxbOqJ9r4YAZ1IBEfh2RbgpeueDy1lN7lO oa6vLJPqCzYlEoDb7Gw6Ad0wMFGF/OnfmcOPrbJPTcmeAaTOQvfOyYeUlcUOkwpptwRp hjIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w20si11732731edc.202.2019.10.14.03.33.11; Mon, 14 Oct 2019 03:33:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731445AbfJNKcE (ORCPT + 99 others); Mon, 14 Oct 2019 06:32:04 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:22346 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731127AbfJNKcE (ORCPT ); Mon, 14 Oct 2019 06:32:04 -0400 X-UUID: 69246c0437ad43a995a203276ea7a8a6-20191014 X-UUID: 69246c0437ad43a995a203276ea7a8a6-20191014 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 653775818; Mon, 14 Oct 2019 18:31:59 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 14 Oct 2019 18:31:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 14 Oct 2019 18:31:48 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger CC: , , , , , , Walter Wu Subject: [PATCH 0/2] fix the missing underflow in memory operation function Date: Mon, 14 Oct 2019 18:31:48 +0800 Message-ID: <20191014103148.17816-1-walter-zh.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: B0FC585DE902AF415BBF2DF73DCE4769D5BBE65605E5E2F26222F2C9D0F93BC92000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patchsets help to produce KASAN report when size is negative numbers in memory operation function. It is helpful for programmer to solve the undefined behavior issue. Patch 1 based on Dmitry's review and suggestion, patch 2 is a test in order to verify the patch 1. [1]https://bugzilla.kernel.org/show_bug.cgi?id=199341 [2]https://lore.kernel.org/linux-arm-kernel/20190927034338.15813-1-walter-zh.wu@mediatek.com/ Walter Wu (2): kasan: detect negative size in memory operation function kasan: add test for invalid size in memmove --- lib/test_kasan.c | 18 ++++++++++++++++++ mm/kasan/common.c | 13 ++++++++----- mm/kasan/generic.c | 5 +++++ mm/kasan/generic_report.c | 18 ++++++++++++++++++ mm/kasan/tags.c | 5 +++++ mm/kasan/tags_report.c | 17 +++++++++++++++++ 6 files changed, 71 insertions(+), 5 deletions(-) -- 2.18.0