From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7958AC4CECE for ; Mon, 14 Oct 2019 10:32:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2339F20663 for ; Mon, 14 Oct 2019 10:32:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2339F20663 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 69A8B8E0005; Mon, 14 Oct 2019 06:32:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 64B898E0001; Mon, 14 Oct 2019 06:32:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 560888E0005; Mon, 14 Oct 2019 06:32:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 302948E0001 for ; Mon, 14 Oct 2019 06:32:07 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id DD44A4DC1 for ; Mon, 14 Oct 2019 10:32:06 +0000 (UTC) X-FDA: 76042025052.02.use16_12489e7f2975f X-HE-Tag: use16_12489e7f2975f X-Filterd-Recvd-Size: 2672 Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 14 Oct 2019 10:32:05 +0000 (UTC) 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000821, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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