Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1519022lqm; Thu, 2 May 2024 19:03:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVPKqVMNo46rMXwjDWZbB38BIYk4q6rf0/8+5Hzl+WQZLiEiwBTYf9bQc3VZDvYGz+f3kYnwSu9miUNdiesG5fKpjpy9aE/PKt+mdk3bw== X-Google-Smtp-Source: AGHT+IHxX91kLbDkAQhVAPmKkJ0RqSt3esYfZe5vJ6EChD9wZhXTJZjZIbG1cIpgE7U09/S9+JGs X-Received: by 2002:a05:6214:c84:b0:6a0:6167:9eab with SMTP id r4-20020a0562140c8400b006a061679eabmr1720816qvr.16.1714701816682; Thu, 02 May 2024 19:03:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714701816; cv=pass; d=google.com; s=arc-20160816; b=L+RN+2GlbOHJ8/ANAs4q8enF4UiRgnChOz2dw/6GxPmnyBLwJX68T2pZO1ELP3nsrZ AN+AHh5224KuFABPgb238Ns7OnGN9lCULlATRhaOO3w+CcKVfkUymlY8xHi2hT4YRtNM 19FRgKBWhuPf1XlFOpKY3/jPx1ti73tOFC6WN15TLA133lTi2Lv5cckaVQcjOePszREV r0JBWk3H1qdVlMgGM/rsd0pZfC77JV3K16XkqS/Xat8sgoog6z3zv3HjJLLDJ431OG2a /orjOKSlVvzqO2fb7agcQiEFkaeJQRhppwqPbynRFvsw8oT/5LMLJp+XipeXw1ECiyg1 rcrQ== 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=/B6jbvibKPqJ+5AECGRR6OKm8iqlq+xtcRgNIHE1nnc=; fh=jguT5/1MbRBf4GmlqXfBBokzBciyk29FevM8+dFBrdM=; b=qOIp/kgJyZ4btYl9Rf1P7zePPIWdtz95IUMge/4YB6cxmVhl9pVLdJr49+dIoagCbE Y3+sR+nhWsvZWXh2Dk+/ieH13we3XZ8BEN+hhxwjCZBsxL4B8mKjJzv3VH7en3VV4DoV ZKLgkDsUZpOtdDjr3XHaur85+Mtm/pOne8gBWEz1xfke0n90PZPj44BB9EJ1rHBtDi14 WnM6w2u/Q4uJxxnXRDPcFPrPWvfRghpMJMBOOKTFyN3hOj5WjsmiiN2PjpBG8rzYIa/W CEWmishWmn/QDfbQ7XoiW3ZbOzm17MBt7+nXCbgjjNt07ZIiuuPmdVvj8JsGL3s18K7U wyww==; 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-kernel+bounces-167165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167165-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d13-20020a05621421cd00b0069940594bb6si2238649qvh.146.2024.05.02.19.03.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 19:03:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-167165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167165-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 67BE41C21F0A for ; Fri, 3 May 2024 02:03:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C8E8179AE; Fri, 3 May 2024 02:03:24 +0000 (UTC) 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 CA96C11CA9; Fri, 3 May 2024 02:03:20 +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=1714701803; cv=none; b=nRcDcr2kSYIBxticmrDchQlK7GB5yAjoT2dqrL7DxEuPXEdPyTG4poNKNXfIy7pQ4RLtHEY8k9gVBL13dIKiEMaEqkQP+v4svAXDCKB8XT5vjQPBIzm5tfp+friWAeD0CZgo/SPTYvW2KysB0e4XLnx2LhvzOp7TVqTUVx+a55o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714701803; c=relaxed/simple; bh=NJ4H1pZUAlpuiYEur2CV1Z0R1IDpFmWiWWgG6HEDU98=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IUdkiD4RwsjqCyQnTok1mSxxHonh4BudfudsF7fH3VGGrfflnSfdQiu4SYycjtJbPtvAscnnD9ynyTWp/BsuHsMJFV+KzzltNT8TiSa+E3s7eak4nRuZM5+8gKQFsPMhYTqjTWL6CiSdIJxXZhBEZRQvdPwnY+Ae84zdMgz8ylo= 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 4VVvGD6f2Qz4f3n6Q; Fri, 3 May 2024 10:03:00 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 8605C1A1325; Fri, 3 May 2024 10:03:10 +0800 (CST) Received: from [10.174.177.174] (unknown [10.174.177.174]) by APP1 (Coremail) with SMTP id cCh0CgBHZQ7YRTRmdbxsLg--.54078S3; Fri, 03 May 2024 10:03:08 +0800 (CST) Message-ID: <8cf61cfc-8717-ee33-c94f-959212ce9c85@huaweicloud.com> Date: Fri, 3 May 2024 10:03:04 +0800 Precedence: bulk X-Mailing-List: linux-kernel@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, tytso@mit.edu Cc: 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> <985285f6-973b-30d5-4742-29cf5e8c0e27@huaweicloud.com> From: Baokun Li In-Reply-To: <985285f6-973b-30d5-4742-29cf5e8c0e27@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgBHZQ7YRTRmdbxsLg--.54078S3 X-Coremail-Antispam: 1UD129KBjvJXoWxCF15CFW5WF18ZFyUJrW7CFg_yoW5GFyrpF s3Ka45WrZ8Cws7JrsrGw1DA34Fqws5JasrGF13Xa48AFWjyr129rZ2gr1F9F9rGrZ5CF1I yr17Zrn7uF1avrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Y14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWUuVWrJwAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kI c2xKxwCYjI0SjxkI62AI1cAE67vIY487MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4 AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE 17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMI IF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_WFyUJVCq 3wCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCT nIWIevJa73UjIFyTuYvjfUoOJ5UUUUU X-CM-SenderInfo: 5olet0hnxqqx5xdzvxpfor3voofrz/ Hi Ted, Would you consider merging in this patchset in the current merge window? I would appreciate it if you could. Thanks, Baokun On 2024/4/23 9:44, Baokun Li wrote: > 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(-) >>