Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2657806lqt; Mon, 22 Apr 2024 18:44:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUVnKopiHvueOGeUfVP+wd0v8QoG9XbzQps5RbUS9KHUb8e+/PsTjb0u65cH+CXq76oIMR0mku9Q/TZQj4aBy6hDhDqzo5cyT54fEd1tA== X-Google-Smtp-Source: AGHT+IHSxDlrtEWJwgh7+Z6ccfjRU5n4Z5bbR8r46MG67E5bYeN3MKtTisaNBW/ZjHTwzblu8SXt X-Received: by 2002:a05:622a:1386:b0:437:b634:a61a with SMTP id o6-20020a05622a138600b00437b634a61amr14960350qtk.47.1713836684755; Mon, 22 Apr 2024 18:44:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713836684; cv=pass; d=google.com; s=arc-20160816; b=xfY/LyWoyq7ib2jWJv50PW9qd7VIl14wnhjRt/FvFh/M/UaZFKd4tLDQU/MIIF7ToS /GOFT5eB6wr8mLZrmBAp4Zb2M7+wnuRt0Fk/X/G2DaqZVH3tQK+126ZVQUzJXOGIE5Ma 0QG93oV5yuVWoOoo9eutKR2sZK9VVif+G+cS1UpC9urr5PYCraCS20vBhG2B/s20lywg 9+83cWv0IM5+dpzlf25XuYdEA8PUBKx4trlAqUX4WXuHxwtOdsrZW5IL74wdn+/TtXe2 16E37j2TiCfw4tRtAHgHwfz3TIGEmJ5mFXlAziK6fmQh6LeiCmcmdaXBxRbMQVTfZC06 uxXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=JHQGktTw73xnI/ozRDZXXc/mpDtKNog/9IWOBpo+1YQ=; fh=Ji1dcfONJAeFQVK73EeCZcNjE56rZmbtpTcNVEnKJH4=; b=WH25Ev58kBDPQliAWz1j5VjpBYkr8fyg3afnzOHl/QGIs3Ny6se9hCtBS7xt++f6hI 9SbpRkLhOLTmxTd6C593AZwmzf26JKos4QZPk+pFOZsjGtUwmpTVEVovufkYzaslGP+5 bcsIPdLwuS2wCqOOc3147e6gob8srbSrjVjRVlVQG5niDlGtWdZHlNr6BuWzIqO9B6R8 c0zw0/bLK30ILZnTMyy2foaRrG/qTSh+4A3OSEPv9zr3DkbEr41+XGFENp15Xe/Ynw4O iOh/qpNA0F8rzZj6pF+vbPy6TysGP3z3gKJTVSwpb4lRPdyf9Ka6YsorKYjuR8MbZx6N tFIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-2155-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2155-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j13-20020a05620a0a4d00b0078f14eb85a3si10362585qka.518.2024.04.22.18.44.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 18:44:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2155-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-2155-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2155-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 783651C212D9 for ; Tue, 23 Apr 2024 01:44:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B11F134D1; Tue, 23 Apr 2024 01:44:38 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52AFB3FF4; Tue, 23 Apr 2024 01:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713836678; cv=none; b=rczOck7P61Q3Mp+SEYaeDCv27G9FDZVp/hnKIdgKbtgEBT6ITBgyAm8vIhEbFoP/5nshw+b0Xrab490XHWW9CpWyePxNZ9mX6mG85Ej7VZRgjTtjXhdIaF9slZm4KV1d//8lAwrxVINyKdTTJzyztGhtXZoXGuNYF85BN1qV0mI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713836678; c=relaxed/simple; bh=r4WznIYg5k4SVGULs1Q8+9QuWxNOFXcnZi9zzumsie8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=BgERA3iUPyrYlvW4ONszvlXp8Rhj+nVtCkl2A1dQXyNDOML9WWCkPU5ENQEMVpG9J+pBKCHTLpa6bstzdj40P1EdcO2Q78Oh5OxHdcXBTwGs50H90lgizS9akAKUtLD+BABjmwkoAmhZkP+yWb6Sm3s7diBggTjoJANHk1ZPN8s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VNlKR04cBz4f3kJs; Tue, 23 Apr 2024 09:44:27 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id CC0891A09FB; Tue, 23 Apr 2024 09:44:31 +0800 (CST) Received: from [10.174.177.174] (unknown [10.174.177.174]) by APP1 (Coremail) with SMTP id cCh0CgAn9g57EidmtP7WKg--.27129S3; Tue, 23 Apr 2024 09:44:30 +0800 (CST) Message-ID: <985285f6-973b-30d5-4742-29cf5e8c0e27@huaweicloud.com> Date: Tue, 23 Apr 2024 09:44:27 +0800 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH v4 0/9] ext4: avoid sysfs variables overflow causing BUG_ON/SOOB Content-Language: en-US To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, ojaswin@linux.ibm.com, adobriyan@gmail.com, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, libaokun@huaweicloud.com References: <20240319113325.3110393-1-libaokun1@huawei.com> From: Baokun Li In-Reply-To: <20240319113325.3110393-1-libaokun1@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID:cCh0CgAn9g57EidmtP7WKg--.27129S3 X-Coremail-Antispam: 1UD129KBjvJXoW7WF13KF1kXw1fCw4kCFyfWFg_yoW8uw13pF sI9w15Gr40qw47Ja9F93Z8Z3WFgw4kJa47KFW7X34rCFyjvryS9ryIgF1rAF97CrZ5uFyx tr12vr10kr1j9rDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Y14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWUWVWUuwAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2ka 0xkIwI1lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7x kEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E 67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCw CI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6Fyj6rWU JwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCT nIWIevJa73UjIFyTuYvjfUF9a9DUUUU X-CM-SenderInfo: 5olet0hnxqqx5xdzvxpfor3voofrz/ A gentle ping. On 2024/3/19 19:33, Baokun Li wrote: > Hello everyone, > > This patchset is intended to avoid variables that can be modified via sysfs > from overflowing when stored or used and thus causing various problems. > > "kvm-xfstests -c ext4/all -g auto" has been executed with no new failures. > > V3->V4: > Patch 4: Corrects WARN_ON_ONCE added in V3. > > V2->V3: > Add Reviewed-by tag from Jan Kara. > Patch 4: Trimming order before the for loop makes the logic easier to > understand. > > V1->V2: > Patch 1: Use kstrtouint() as suggested by Alexey and Honza. > Patch 2: Adapted to patch 1 changes. > Patch 3: Add Reviewed-by tag. > Patch 4: Avoid useless loops as suggested by Ojaswin and rename > attr_group_prealloc to attr_clusters_in_group. > Patch 5: New patch added to limit mb_best_avail_max_trim_order < 64 > as Honza's suggestion. > Patch 6: Reordered and updated description. > Patch 7: Add Reviewed-by tag. > Patch 8: Keep unrelated variables on different lines as suggested by Honza. > Patch 9: New patch to fix warnings found during compile checking. > > [V1]: https://lore.kernel.org/all/20240126085716.1363019-1-libaokun1@huawei.com/ > [V2]: https://lore.kernel.org/all/20240227091148.178435-1-libaokun1@huawei.com/ > [V3]: https://lore.kernel.org/all/20240314140906.3064072-1-libaokun1@huawei.com/ > > Baokun Li (9): > ext4: avoid overflow when setting values via sysfs > ext4: refactor out ext4_generic_attr_store() > ext4: refactor out ext4_generic_attr_show() > ext4: fix slab-out-of-bounds in > ext4_mb_find_good_group_avg_frag_lists() > ext4: add new attr pointer attr_mb_order > ext4: add positive int attr pointer to avoid sysfs variables overflow > ext4: set type of ac_groups_linear_remaining to __u32 to avoid > overflow > ext4: set the type of max_zeroout to unsigned int to avoid overflow > ext4: clean up s_mb_rb_lock to fix build warnings with C=1 > > fs/ext4/extents.c | 3 +- > fs/ext4/mballoc.c | 5 +- > fs/ext4/mballoc.h | 2 +- > fs/ext4/sysfs.c | 174 ++++++++++++++++++++++++++++------------------ > 4 files changed, 112 insertions(+), 72 deletions(-) >