Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2876144rwd; Fri, 26 May 2023 12:38:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5S0jP+uGztEDYt+/l7QGNxVMOKB/6fmsbGU+Fl7TZ8+UGUe70wsuIpz/2iMveYjgf6ZrRa X-Received: by 2002:a17:903:41cc:b0:1ab:675:3e0c with SMTP id u12-20020a17090341cc00b001ab06753e0cmr4039792ple.33.1685129934237; Fri, 26 May 2023 12:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685129934; cv=none; d=google.com; s=arc-20160816; b=z+S8aV0nFC8uirwNxrBoUst316Ew1qDIwiGB/hC5m0RBB0Kf+nlGriBQoGsD95ioOs vdIVa1ZQd8lYU6MnwtZeKqxwIE3ubbROhGWnlVA+GhJeUdFzPwjXi2rY/TMURla8C/ov oVzglo+KQUiPoKmAraWavUNVqKOG3q8otAaU+i3URN7AV93czphBHk3MMfp2GISUp/kC 77JdnyS/rgHOBgJELwM9V7XtNAUqW2DdblVgpRoDOftBDoHDsECJnKOL1F0jRoOT8POh TeEjEnqh/706fOyytcgW5ihM6Y7ehaYLuk073Rjhv1jLkTSXoQQuzZ5FMI7kQI6MXzej K6sQ== 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=8romIX85D4OBHtWltWUODAU2SRYOjVW+fjymVe7tBqw=; b=GUguOsvlr+h+24AqrVyf0gsDC3y8s7fPpwvu/NXdeZYyz0qlEunfcryqSwJhbMVMkE QlgVSduzvNRoNUbKRtNoUFOHk+a9R878L2tYj9ySEWQ4uMKNxkxDkXskmeFWhrYoPzuD 7Xi2VVbQNSBdihlExNOirMF+32DdA1GZKWGsRzawEJdUFBTwnjJZCb9VUdXWSKWS7u2A zeexkp0Kyu0jr0tQCzbrwzKpejprQTUxqK3/jGXvkUKfMhF56xOhyGv8CkXue1JuUUBh Qs3PBz9XTSj8AxL5SClv2gciDG1o3iMqnJrV0srffzudPKlN9V3AXdhg80zepeJpEedp JrsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mw2R36mU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz5-20020a170902ef8500b001a669006139si131422plb.248.2023.05.26.12.38.32; Fri, 26 May 2023 12:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mw2R36mU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231144AbjEZTgE (ORCPT + 99 others); Fri, 26 May 2023 15:36:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242430AbjEZTf4 (ORCPT ); Fri, 26 May 2023 15:35:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA95AE46 for ; Fri, 26 May 2023 12:35:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 68B4865316 for ; Fri, 26 May 2023 19:35:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21280C433D2; Fri, 26 May 2023 19:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685129723; bh=hrXnPJh/IHKl7DDBAAfTeqFjAiG1/nHeuB1mCrXtIxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mw2R36mU/rvchgfsAwGQYlRZa8+xIa3vvVi9pcrJ8B0+yKO7PcH8+WFZDFc52UCWd CPriTpOkoyx/RKHKD9TI6fubLQK5kngHwkKitATbfmUTZokHjsDmDYMYBD9z8FvOyy /mUN87nG9OjpksX8kRieuRsfJp2Jy+olXVFOJoVXq200WQk923ycsVTe8LwSTiAp9j Zmz5Th4Qw42sYKzNnPBWoFN7DlX6ukrhPHwkj6Dfg0FXgo7+Q34xPTc9KICMSH3CXu 4hr+I+dXx11QU0gDut72zqPcNGpd2ZdvexAB1z4zhP4L1V7zhN/9K7IRcZXdLJ5e2t llEtA/HWdqjTQ== From: SeongJae Park To: SeongJae Park Cc: Kefeng Wang , syzbot , akpm@linux-foundation.org, damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [damon?] divide error in damon_set_attrs Date: Fri, 26 May 2023 19:35:21 +0000 Message-Id: <20230526193521.162787-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230526185409.92039-1-sj@kernel.org> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 May 2023 18:54:09 +0000 SeongJae Park wrote: [...] > > > > > > divide error: 0000 [#1] PREEMPT SMP KASAN > > > CPU: 1 PID: 13527 Comm: syz-executor.1 Not tainted 6.4.0-rc3-syzkaller #0 > > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 > > > RIP: 0010:damon_nr_accesses_to_accesses_bp mm/damon/core.c:491 [inline] > > > RIP: 0010:damon_nr_accesses_for_new_attrs mm/damon/core.c:497 [inline] > > > RIP: 0010:damon_update_monitoring_result mm/damon/core.c:506 [inline] > > > RIP: 0010:damon_update_monitoring_results mm/damon/core.c:534 [inline] > > > RIP: 0010:damon_set_attrs+0x224/0x460 mm/damon/core.c:555 > > Thank you for finding and reporting this bug! > > The code of the problem is as below: > > /* convert nr_accesses to access ratio in bp (per 10,000) */ > static unsigned int damon_nr_accesses_to_accesses_bp( > unsigned int nr_accesses, struct damon_attrs *attrs) > { > unsigned int max_nr_accesses = > attrs->aggr_interval / attrs->sample_interval; > > return nr_accesses * 10000 / max_nr_accesses; > } > > The problem can happen when 'aggr_interval' is smaller than 'sample_interval', > because 'max_nr_accesses' becomes zero in the case, and resulting in divide by > zero. > > Same problem is in damon_accesses_bp_to_nr_accesses(). This is not true, because the function doesn't divide something by 'max_nr_acceses'. I was confused, sorry. Thanks, SJ [...]