Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5574743ybp; Tue, 8 Oct 2019 05:13:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrDzjv35WStctKdl+wosmsrog+FrfC6fPxdKB3y2kXhFJjVdT9sTAk9yT2UuN8MMpLWlEL X-Received: by 2002:a17:906:f74e:: with SMTP id jp14mr20557961ejb.323.1570536794318; Tue, 08 Oct 2019 05:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570536794; cv=none; d=google.com; s=arc-20160816; b=or/7rZpMblEi5xgPhYPudiB7L7094DPThY20vsRViqVYwlBna+Os9X9+pQ4uKnXK0L lhdz+SfRillQP0J00d7fBDxMmanZZPLjpmaQxMVkH0Xj018YVkDsO9/WKMhd+31DW/gw bMy8lKby7zvQPZqPW9gim1HBuQsgOvu7q3W6/tIIzOnAf2yNyL6rz+C1IPj6xPu86Toe w3CQa4DeOuh7BfbSMApaIfxmv8ihaq1SU/F1uG40jRt1r2NaM5xVrYLpuNmJGcqUsPiO TrTznOmFKsI5VwouGOXOwHgk2GUFpdY9SIDFPCzLmhkXYdJFf69ftEgcvX6GaWcLEqE5 /95g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=GMN6AE/Wckiy15zsiQVxc8Ha0nqrOTJmAoLEeM+N80A=; b=SFw/nNqFnJrepPBZsUkUPY1IQWDhxkjx3KIbsyCcZxZz96ETEcs7SNgHmoMDLDNhkt /YdAxQ+XfiPURs7iYtqhZE1IEbQqHs1sdF1E7asf9BU+9X+HnE2QzWmKyHROyVPYsBnL ft7MD1I7y8YXhhowRlI+KIDsn1Fg81YnhPMGhVIFcmgiHSWcR9jaDvv4EhjBwQZDxUqZ X61X8oNZL/KEtOO9cYTIRbzMl3JJgk9QileuNiK5sebhDf0MoixVw2adSx6J7C44/N43 TzPgiDvPUKMN4hFyu59BWaXomn/GGhAe8wPTA4ESGH8zt3L7/tEqDYCJMYXi8IzVTl0n /jeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=eh8pCLow; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q24si8629593ejr.128.2019.10.08.05.12.50; Tue, 08 Oct 2019 05:13:14 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=eh8pCLow; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731270AbfJHMMA (ORCPT + 99 others); Tue, 8 Oct 2019 08:12:00 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:44598 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731193AbfJHMLg (ORCPT ); Tue, 8 Oct 2019 08:11:36 -0400 Received: by mail-qk1-f196.google.com with SMTP id u22so16415858qkk.11 for ; Tue, 08 Oct 2019 05:11:36 -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=GMN6AE/Wckiy15zsiQVxc8Ha0nqrOTJmAoLEeM+N80A=; b=eh8pCLowBh+BgvZfmBoGRvtXPz9zE1aDs0RO30fbYsKrn8CCi0iz7dLb+5ZAUaoxjI h8+YdOrv4kFWisVv0+ypSez27VEQps+efiGk7jOMYv3keDR/Y6/soCbxUzNbJXsWmunL vpPylf8BdgPE/ZA1QeOokTinVOQWJUymEUANn2Y+dJMoeBbgBazYB8JxeoNrYQwBHkLP +Y93UIITl3fYH+rqskwFY4S7s0OHFw4upx8Nhqyxd6tVP1iDJRTOXsPTSYokzso/fTTr QdOgkswn28Rv8/n9whT/owI7R/u5774xcNIdbtAtjI/OLjhmtMk6lPra8liDCk+ffMra +nBQ== 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=GMN6AE/Wckiy15zsiQVxc8Ha0nqrOTJmAoLEeM+N80A=; b=pzXJDK32x6NrGLphtLaSR7No0hFrT8xsX9KUEKdivK3esH1GL1mpCUAnnBud5fOt3C QxH7B/7g6OHGttFM5mFTPqlpx6xDIGjdZsj2sol8N9bfzoDytqIDr+DLvWkn3G64F/CE vLPOHM4w8AhIxK6l/7A9z1RJcqLU2xcUKTQjrzAPa6gxRUoBZjW7xCugXinAcovBsSbc 9TJ13TQQxnOCNofijcE3kFPUoEKwgWKqUosvnitd9L484JpfKL2mx7HbiU1N0nzg4WSG MDqNWIYmLscX2B5BgYcylbAVgKA7dgvhkmuHtP/zZSB+VOmUt+PyxP4UB8prW7azSIOR N8Lg== X-Gm-Message-State: APjAAAUW5heEnc+9irqatV84TUU55R2s5uGWA4JFTFK/tApOSO05P21t hrA7FCWf+rrI44BvtO5X356U8fvULr0DXPG2/qKTTQ== X-Received: by 2002:a37:d84:: with SMTP id 126mr26540903qkn.407.1570536695225; Tue, 08 Oct 2019 05:11:35 -0700 (PDT) MIME-Version: 1.0 References: <1570532528.4686.102.camel@mtksdccf07> In-Reply-To: From: Dmitry Vyukov Date: Tue, 8 Oct 2019 14:11:23 +0200 Message-ID: Subject: Re: [PATCH] kasan: fix the missing underflow in memmove and memcpy with CONFIG_KASAN_GENERIC=y To: Qian Cai Cc: Walter Wu , Andrey Ryabinin , Alexander Potapenko , Matthias Brugger , LKML , kasan-dev , Linux-MM , Linux ARM , linux-mediatek@lists.infradead.org, wsd_upstream Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 8, 2019 at 1:42 PM Qian Cai wrote: > > On Oct 8, 2019, at 7:02 AM, Walter Wu wrote: > > I don't know very well in UBSAN, but I try to build ubsan kernel and > > test a negative number in memset and kmalloc_memmove_invalid_size(), it > > look like no check. > > It sounds like more important to figure out why the UBSAN is not working in this case rather than duplicating functionality elsewhere. Detecting out-of-bounds accesses is the direct KASAN responsibility. Even more direct than for KUBSAN. We are not even adding functionality, it's just a plain bug in KASAN code, it tricks itself into thinking that access size is 0. Maybe it's already detected by KUBSAN too?