From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao Yu Subject: Re: [PATCH v2] f2fs: UBSAN: set boolean value iostat_enable correctly Date: Wed, 16 Jan 2019 09:37:21 +0800 Message-ID: <215568d4-aa44-f85f-fbbb-96f932f6ef49@huawei.com> References: <20190115200215.6430-1-shengyong1@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gja9K-0005M9-5g for linux-f2fs-devel@lists.sourceforge.net; Wed, 16 Jan 2019 01:37:46 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1gja9B-0056qB-Vt for linux-f2fs-devel@lists.sourceforge.net; Wed, 16 Jan 2019 01:37:46 +0000 In-Reply-To: <20190115200215.6430-1-shengyong1@huawei.com> Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Sheng Yong , jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net On 2019/1/16 4:02, Sheng Yong wrote: > When setting /sys/fs/f2fs//iostat_enable with non-bool value, UBSAN > reports the following warning. > > [ 7562.295484] ================================================================================ > [ 7562.296531] UBSAN: Undefined behaviour in fs/f2fs/f2fs.h:2776:10 > [ 7562.297651] load of value 64 is not a valid value for type '_Bool' > [ 7562.298642] CPU: 1 PID: 7487 Comm: dd Not tainted 4.20.0-rc4+ #79 > [ 7562.298653] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 > [ 7562.298662] Call Trace: > [ 7562.298760] dump_stack+0x46/0x5b > [ 7562.298811] ubsan_epilogue+0x9/0x40 > [ 7562.298830] __ubsan_handle_load_invalid_value+0x72/0x90 > [ 7562.298863] f2fs_file_write_iter+0x29f/0x3f0 > [ 7562.298905] __vfs_write+0x115/0x160 > [ 7562.298922] vfs_write+0xa7/0x190 > [ 7562.298934] ksys_write+0x50/0xc0 > [ 7562.298973] do_syscall_64+0x4a/0xe0 > [ 7562.298992] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > [ 7562.299001] RIP: 0033:0x7fa45ec19c00 > [ 7562.299004] Code: 73 01 c3 48 8b 0d 88 92 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d dd eb 2c 00 00 75 10 b8 01 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 ce 8f 01 00 48 89 04 24 > [ 7562.299044] RSP: 002b:00007ffca52b49e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 > [ 7562.299052] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa45ec19c00 > [ 7562.299059] RDX: 0000000000000400 RSI: 000000000093f000 RDI: 0000000000000001 > [ 7562.299065] RBP: 000000000093f000 R08: 0000000000000004 R09: 0000000000000000 > [ 7562.299071] R10: 00007ffca52b47b0 R11: 0000000000000246 R12: 0000000000000400 > [ 7562.299077] R13: 000000000093f000 R14: 000000000093f400 R15: 0000000000000000 > [ 7562.299091] ================================================================================ > > So, if iostat_enable is enabled, set its value as true. > > Signed-off-by: Sheng Yong Reviewed-by: Chao Yu Thanks,