From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 B840E20AF74 for ; Mon, 13 Jan 2025 16:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736784740; cv=none; b=XStqXxZd2quUhvIu1vFZ8QiCcKG3CePx9N3pFntkSqOO8A3v6h9/q2mSol1bj3pQFgm/ob7Og1qQGhBTb90VLZ6fb8l/VQL6oP2GdUZE8hWcvjuxpp7T2m1Tt5pLGs44067G/QpgyO8moqcjtrO18eRSuoWWJtmwerpQPV9k0SM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736784740; c=relaxed/simple; bh=H+F9tHVBR0fQmf71J3gLkHC9qgPnJkYNp5GS5S4g+7g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=a+CCuNOd6mQ4DlJo8YnRhXeCFsbbo2jjgwZXG1qd1K6an/TFrKnbRQapv4P1mWtmDoTYLHU/+TwB1iXXgiqqpVFdrnuc9HJV3yXJCgaJyUQolgmuCaPLpkD0TSLZngUtuWTVVR5Ay2y3/BdKgr8I1wI1vlufITgGvbdWWgKbXmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fmpoWUHA; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fmpoWUHA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736784737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+pjWyIe8mnk7g6/F83/ZX7003rIKqe+bESoWt3TOXDo=; b=fmpoWUHARcHa1L5eBdiJm/uSkhcGrmcmjnJW219VmUgXm6qCED5+Kk2BgmFFGJ+sQH5WEl 4wjzyr8vr9hy3rpp46JLpf5fe96EkAv3skAgoYWM3yB0+1CLBinYwNr2VsnymP+00zI/Sy wVVXBopl40WkIK++BXMVwH4oWSxaBRI= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-43-AVRu9lHlMOOrhA4NSrE9NQ-1; Mon, 13 Jan 2025 11:12:15 -0500 X-MC-Unique: AVRu9lHlMOOrhA4NSrE9NQ-1 X-Mimecast-MFC-AGG-ID: AVRu9lHlMOOrhA4NSrE9NQ Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43626224274so25789825e9.0 for ; Mon, 13 Jan 2025 08:12:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736784734; x=1737389534; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+pjWyIe8mnk7g6/F83/ZX7003rIKqe+bESoWt3TOXDo=; b=R528keZdlxx1YzRwcvP0INZvTPCRZdb3/5pJsZyOMDJOx7vfqZG9vZzT7t+9im2yp5 MwBXfx9yTsOJQ2xGj1+SIBAz1HuiHvrbK8C69aPYooDtIXpMClVO3v3cQc9A4Tb3JOBp YJYnUTit8aUBp+wsb/IBfkowq6zZtvfqO+xJEEc2YHJ3Js/GEsXodpAEGfEXDvnoLDMu Gs+5g03NVj/QxX6M43ssXjKUxF5tiXtQ1uGym0MQBcJQQ5ZkqRaTJjXQLzyjYjK8E/WP gRkdLBTZ+DPcqKqeePw55fXB+y+cEG0fZTipC9AJNUBaywfx2gpSrwcbbkiYcn3Laf8w wpUw== X-Forwarded-Encrypted: i=1; AJvYcCV4Hsq4AIafuD7q5Q1ekO2NB4KPSX4eNcB6yTmzOsd+2zwaTvviParWKG054BXJAAd4Gm9xxUrJ3ajW0Y8=@vger.kernel.org X-Gm-Message-State: AOJu0YwGgDGqASYhJdZvYhlbmf9f2fA9UOXv8NvDantkB6K1mHTcofsO KiddAd/Any3DPUGaT9OrHaLtox8RLnVKOwFDGoVBjpkZroVtvrRIBYPc+rXO/j9rl4+mhbt/0/j BD1qC2zByHF8Cyr3TVGr8IS8flBavknuZCI49vAjGExPY1OFYbUgOAhyT07H/Ww== X-Gm-Gg: ASbGncvpvak/9v1rraQm1fruiylgVdzX3QqceN/fCX3zyltNmwYLPbjshV4/jZYCQH7 C1BshXt/sgF0ad1gzxSnw2UXn9PldHRgv20n70Bn1GGsxRytqiFZIdhAOCGDPVkg42OoeaH+8sW NuXj51M6R0qTNNEOy+wCgiXJKbXfbaxO5FCLp7Gxa2s1pOoRsNNQBF/fgq5R/f/RJaK92e9ftF9 vs9Zanluqtg4Cgwivl0tYDdi07yaXs9Ped9pnD1CGL3csNsnK6F08ymZkXqa9/1PDEVzlPFFIOK Vo3/q3yxxqPWpnRm63ITWEx5RyX3jN7eHejxsqek X-Received: by 2002:a05:600c:a44:b0:434:a852:ba6d with SMTP id 5b1f17b1804b1-436e2692d98mr192763475e9.9.1736784734436; Mon, 13 Jan 2025 08:12:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IFf6XW1cvL5UoHvdjbD30b+iBZ9HkwmTvZwbT8O+46nwB/B8rcXEgT73vr2SwiShA/NK8OOuA== X-Received: by 2002:a05:600c:a44:b0:434:a852:ba6d with SMTP id 5b1f17b1804b1-436e2692d98mr192763035e9.9.1736784733859; Mon, 13 Jan 2025 08:12:13 -0800 (PST) Received: from [192.168.1.167] (cpc76484-cwma10-2-0-cust967.7-3.cable.virginm.net. [82.31.203.200]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38bd0dsm12465616f8f.45.2025.01.13.08.12.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jan 2025 08:12:13 -0800 (PST) Message-ID: <31f0da2e-4dd7-44eb-95ee-6d22d310a2d6@redhat.com> Date: Mon, 13 Jan 2025 16:12:12 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Bug: slab-out-of-bounds Write in __bh_read Content-Language: en-US To: Kun Hu , Andreas Gruenbacher Cc: Jan Kara , viro@zeniv.linux.org.uk, brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, "jjtan24@m.fudan.edu.cn" , gfs2@lists.linux.dev References: <5757218E-52F8-49C7-95F1-9051EB51A2F3@m.fudan.edu.cn> <6yd5s7fxnr7wtmluqa667lok54sphgtg4eppubntulelwidvca@ffyohkeovnyn> <31A10938-C36E-40A2-8A1D-180BD95528DD@m.fudan.edu.cn> <86F5589E-BC3A-49E5-824F-0E840F75F46D@m.fudan.edu.cn> <27DB604A-8C3B-4703-BB8A-CBC16B9C4969@m.fudan.edu.cn> From: Andrew Price In-Reply-To: <27DB604A-8C3B-4703-BB8A-CBC16B9C4969@m.fudan.edu.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 13/01/2025 15:54, Kun Hu wrote: > >> >> 32generated_program.c memory maps the filesystem image, mounts it, and >> then modifies it through the memory map. It's those modifications that >> cause gfs2 to crash, so the test case is invalid. >> >> Is disabling CONFIG_BLK_DEV_WRITE_MOUNTED supposed to prevent that? If >> so, then it doesn't seem to be working. >> >> Thanks, >> Andreas > > >> We have reproduced the crash with CONFIG_BLK_DEV_WRITE_MOUNTED disabled to obtain the same crash log. The new crash log, along with C and Syzlang reproducers are provided below: > >> Crash log: https://drive.google.com/file/d/1FiCgo05oPheAt4sDQzRYTQwl0-CY6rvi/view?usp=sharing >> C reproducer: https://drive.google.com/file/d/1TTR9cquaJcMYER6vtYUGh3gOn_mROME4/view?usp=sharing >> Syzlang reproducer: https://drive.google.com/file/d/1R9QDUP2r7MI4kYMiT_yn-tzm6NqmcEW-/view?usp=sharing > > Hi Andreas, > > As per Jan's suggestion, we’ve successfully reproduced the crash with CONFIG_BLK_DEV_WRITE_MOUNTED disabled. Should you require us to test this issue again, we are happy to do so. > FWIW the reproducer boils down to #include #include #include #include /* mkfs.gfs2 -b 2048 -p lock_nolock $DEV mount $DEV $MNT cd $MNT /path/to/this_test */ int main(void) { unsigned flag = FS_JOURNAL_DATA_FL; char buf[4102] = {0}; int fd; /* Error checking omitted for clarity */ fd = open("f", O_CREAT|O_RDWR); write(fd, buf, sizeof(buf)); ioctl(fd, FS_IOC_SETFLAGS, &flag); write(fd, buf, sizeof(buf)); /* boom */ close(fd); return 0; } So it's switching the file to journaled data mode between two writes. The size of the writes seems to be relevant and the fs needs to be created with a 2K block size (I'm guessing it could reproduce with other combinations). Andy