Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2447979pxb; Sun, 16 Jan 2022 21:12:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZUH1GqtTQ+Mb1qkgf+dZA0Azr5Fq+CUBWUDU8EIbaTXTktqFOQ33vwgBzVfpdvUJryjuj X-Received: by 2002:a17:902:7c97:b0:14a:62ed:c296 with SMTP id y23-20020a1709027c9700b0014a62edc296mr21260134pll.42.1642396367507; Sun, 16 Jan 2022 21:12:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642396367; cv=none; d=google.com; s=arc-20160816; b=IO3GtOwfR0hpO6CBf5aSDNP23yTJu60i8Xv85FWalIWa76JgcCYzQOexJF/8/qLR1u KtxB26gvW+lT3p8WHiogQwexpXvZeFT8OPaoLrl49JLAb8nXSypdQ3OiKnxCGX4hQPS1 x/7KxEyWVhG0eNfceidUrszXT0hfdX2NsEw1dgSIhaQSZdRKWwibQBYWzmqt7FcrpCS1 TzkgSj3S3CsKJUnzojsu5BPjV96URV9ixEpyDwAH3WTNTbGzhwRnGwiGQtdA00Rys9nW oP3uLoNpHgUs9+oaO8ATCfp4eirzydcs85e3hVY+c3U0j5l3bVJbEl11uHe8vd8poqFX iF0w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=DFJxJo3WrNDOnKnM1u6xw8YsXtSt+iZ6G/kMCVsM30Y=; b=u9rZvI0RTcagriiWfA8oJfG8i9lgXRqI+k7/X5vPEznNsxjgbgGuC41+a3k7vEH9mW De9S5c41G9Q08sjQez8KrnYb0Q9b+LR3G0UjM7ITPWoZXmBlZyX+SBf1KuoTQ8Mk2fJW DZgqHwuKCLRIyAxuA1CPPJtQscvi9GPiCAk5iSU1irByO4yNp1S/hmcU0hjzKVM7gJtg iBowt7Z5TAB3zwAusP9PKhy7X2VTvEjE2Jv76VZcDFS9JQVGESyFqqMyWkqzUkj1oZNt QSTMauQptM6O7GysC8ZKb/Nt3SQSRDd9eWXlVIflblBrRLnjoyV+6ocIXaN7Cx/3kI7A /4pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MxSg4cfC; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y22si6076220pfi.157.2022.01.16.21.12.35; Sun, 16 Jan 2022 21:12:47 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=MxSg4cfC; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232969AbiAPHDF (ORCPT + 99 others); Sun, 16 Jan 2022 02:03:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbiAPHDD (ORCPT ); Sun, 16 Jan 2022 02:03:03 -0500 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 627AAC061574 for ; Sat, 15 Jan 2022 23:03:03 -0800 (PST) Received: by mail-qv1-xf2e.google.com with SMTP id fo11so14671158qvb.4 for ; Sat, 15 Jan 2022 23:03:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DFJxJo3WrNDOnKnM1u6xw8YsXtSt+iZ6G/kMCVsM30Y=; b=MxSg4cfCRB1PyF5rIDfg1wS+8LqSgSTjwIJRdmXpCkdG6tlGqKZRxGQ7JxJZzlRXGD /5w1EjxiJ8QO3PsTMwUnPpElPln6nUCAMQozzETox8Z81UOfKVKVpMWtWfTyr0xSiFqy m00x+pnqZzdgTk68hJ+KDg4m+dIbwxSuwvU0KeOLH7ncP9oT+b0PBxPp2fUduVIqtWXT d8hukUGdFLsXHfUX4pM2yTr/32mvufGdhaQtmNrliyUR5YCFwS1aAiwqdddo7emu4erd 1CjeZeI6UfOnLgR4xUA4k6w5jHVc3Y5H54Vy/lV1vxFBZiZSsd7iblTsJTlYajMkmA2F 4/tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DFJxJo3WrNDOnKnM1u6xw8YsXtSt+iZ6G/kMCVsM30Y=; b=md8tQJJ27P3fyXcS5b97/9hIpXQ/cifGc0WjwP85NG4Eru0A6LZf0TLvo9Hrl7OIcU QJ4Yr0hDA5ifUV8qfpfbcPmtEwuA37TRZpThOJ/8ydWwZJQxYmhvMC5naY7Xu1n18z1P E3vZutBDdeIIcCJTtWGukxH0ECackO9xnv7SayUiAYGa9H2fiB0joSBVO+pbVlwFWR0q zPCwgOxVC0Pk7js6tp1cYvf+Y4aN7S7axGsig/bE1m4D9VhofCL58IRLO+WTGze97i5S tDA9bLTYFZidpg1ugu9TWBEKSTgc6fy271KDhP+asxXURgKgwfxZ+wrzb9jYAqGbBO+s 1VYQ== X-Gm-Message-State: AOAM5327qujX2/kzvHMnPg7PZrPRUHmawLBd95hKwDk/CFysyPwjPtNu D+4aAGqYdzO+QGLmkW6OfmyEDgsDYDej72vp X-Received: by 2002:ad4:4ea6:: with SMTP id ed6mr7323176qvb.35.1642316582451; Sat, 15 Jan 2022 23:03:02 -0800 (PST) Received: from WRT-WX9.. ([207.246.89.135]) by smtp.gmail.com with ESMTPSA id ay21sm4703439qtb.12.2022.01.15.23.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jan 2022 23:03:02 -0800 (PST) From: Changbin Du To: Andrew Morton , "Matthew Wilcox (Oracle)" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Changbin Du Subject: [PATCH] mm: fix missed initialization for folio_batch::percpu_pvec_drained Date: Sun, 16 Jan 2022 15:02:27 +0800 Message-Id: <20220116070227.6854-1-changbin.du@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The folio_batch_init() forgets to initinize folio_batch::percpu_pvec_drained. This can be detected by UBSAN tool. [ 6.990914][ T1] ======================================================================== [ 6.991968][ T1] UBSAN: invalid-load in mm/swap.c:996:11 [ 6.993429][ T1] load of value 124 is not a valid value for type '_Bool' [ 6.994774][ T1] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.16.0-09673-ga33f5c380c4b #27 [ 6.995909][ T1] Hardware name: riscv-virtio,qemu (DT) [ 6.996898][ T1] Call Trace: [ 6.997608][ T1] [] dump_backtrace+0x30/0x38 [ 6.998307][ T1] [] dump_stack_lvl+0x58/0x7a [ 6.998822][ T1] [] dump_stack+0x18/0x20 [ 6.999334][ T1] [] ubsan_epilogue+0x10/0x58 [ 6.999938][ T1] [] __ubsan_handle_load_invalid_value+0x84/0x86 [ 7.000626][ T1] [] __pagevec_release+0x6c/0x72 [ 7.001212][ T1] [] truncate_inode_pages_range+0x152/0x4a6 [ 7.001839][ T1] [] truncate_inode_pages+0x22/0x2a [ 7.002397][ T1] [] blkdev_flush_mapping+0x78/0x13e [ 7.002960][ T1] [] blkdev_put+0x1a6/0x1f8 [ 7.003482][ T1] [] disk_scan_partitions+0x5c/0x78 [ 7.004069][ T1] [] device_add_disk+0x2a0/0x2c0 [ 7.004627][ T1] [] virtblk_probe+0x68c/0xb20 [ 7.005176][ T1] [] virtio_dev_probe+0x12e/0x210 [ 7.005718][ T1] [] really_probe.part.0+0x6c/0x24e [ 7.006266][ T1] [] __driver_probe_device+0xdc/0x13e [ 7.006847][ T1] [] driver_probe_device+0x40/0x10c [ 7.007451][ T1] [] __driver_attach+0x8c/0x172 [ 7.008036][ T1] [] bus_for_each_dev+0x6a/0xa8 [ 7.008617][ T1] [] driver_attach+0x2e/0x36 [ 7.009159][ T1] [] bus_add_driver+0x170/0x1ee [ 7.009717][ T1] [] driver_register+0x66/0xfe [ 7.010295][ T1] [] register_virtio_driver+0x30/0x4e [ 7.010899][ T1] [] init+0x78/0xac [ 7.011381][ T1] [] do_one_initcall+0x7e/0x262 [ 7.011955][ T1] [] kernel_init_freeable+0x30e/0x372 [ 7.012559][ T1] [] kernel_init+0x32/0x178 [ 7.013105][ T1] [] ret_from_exception+0x0/0x14 [ 7.015034][ T1] ======================================================================== Signed-off-by: Changbin Du --- include/linux/pagevec.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index dda8d5868c81..67b1246f136b 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -111,6 +111,7 @@ static_assert(offsetof(struct pagevec, pages) == static inline void folio_batch_init(struct folio_batch *fbatch) { fbatch->nr = 0; + fbatch->percpu_pvec_drained = false; } static inline unsigned int folio_batch_count(struct folio_batch *fbatch) -- 2.32.0