openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.55k stars 1.74k forks source link

PAX: size overflow detected in function zil_itx_create #2505

Closed mrobbetts closed 8 years ago

mrobbetts commented 10 years ago

Since updating to 0.6.3 (also kernel 3.14.5-hardened on Gentoo) I am seeing some of these in my dmesg:

Jul 17 09:39:15 copper kernel: [126911.127543] PAX: size overflow detected in function zil_itx_create /var/tmp/portage/sys-fs/zfs-kmod-0.6.3/work/zfs-zfs-0.6.3/module/zfs/../../module/zfs/zil.c:1179 cicus.137_21 min, count: 2
Jul 17 09:39:15 copper kernel: [126911.127553] CPU: 0 PID: 11210 Comm: rsync Tainted: P           O 3.14.5-hardened-r2 #4
Jul 17 09:39:15 copper kernel: [126911.127557] Hardware name: HP ProLiant MicroServer, BIOS O41     07/29/2011
Jul 17 09:39:15 copper kernel: [126911.127560]  ffff88025f7c1180 ffffc90085a97c18 ffffffff817c065e ffff88041fc0db20
Jul 17 09:39:15 copper kernel: [126911.127565]  0000000000000048 ffffc90085a97c28 ffffffff8111e8b3 ffffc90085a97c48
Jul 17 09:39:15 copper kernel: [126911.127570]  ffffffffa031fdc6 ffff8802da6cf078 ffff88025f7c1180 ffffc90085a97c98
Jul 17 09:39:15 copper kernel: [126911.127574] Call Trace:
Jul 17 09:39:15 copper kernel: [126911.127585]  [<ffffffff817c065e>] dump_stack+0x46/0x5e
Jul 17 09:39:15 copper kernel: [126911.127592]  [<ffffffff8111e8b3>] report_size_overflow+0x24/0x2e
Jul 17 09:39:15 copper kernel: [126911.127617]  [<ffffffffa031fdc6>] zil_itx_create+0x48/0x9d [zfs]
Jul 17 09:39:15 copper kernel: [126911.127639]  [<ffffffffa030c2b7>] zfs_log_remove+0x80/0xca [zfs]
Jul 17 09:39:15 copper kernel: [126911.127658]  [<ffffffffa0315ffe>] zfs_remove+0x311/0x3b5 [zfs]
Jul 17 09:39:15 copper kernel: [126911.127663]  [<ffffffff817c7b2a>] ? _raw_spin_lock+0x9/0x11
Jul 17 09:39:15 copper kernel: [126911.127680]  [<ffffffffa0329192>] zpl_fallocate_common+0x485/0x5f9 [zfs]
Jul 17 09:39:15 copper kernel: [126911.127685]  [<ffffffff81126db4>] vfs_unlink+0x92/0xeb
Jul 17 09:39:15 copper kernel: [126911.127689]  [<ffffffff81126f5e>] do_unlinkat+0x151/0x265
Jul 17 09:39:15 copper kernel: [126911.127695]  [<ffffffff811292c7>] SyS_unlink+0x11/0x19
Jul 17 09:39:15 copper kernel: [126911.127699]  [<ffffffff817ce89e>] system_call_fastpath+0x16/0x1b

This is obviously a 'hardened' (64-bit) kernel with PaX enabled. I saw it most recently when I tried to eix-sync my Gentoo installation (with /usr/portage/ stored on a zfs file system). That errored out with:

...
receiving incremental file list
rsync: writefd_unbuffered failed to write 8 bytes to message fd [receiver]: Broken pipe (32)
rsync error: error in rsync protocol data stream (code 12) at io.c(1532) [receiver=3.0.9]

Is this a problem with ZoL, or my configuration?

behlendorf commented 8 years ago

@chrisrd @perfinion @ryao thank you all for working on this. That patch looks good to me and you all agreed it's correctly I'll get it merged.

behlendorf commented 8 years ago

OK, after giving this a careful looking over I'm convinced it's correct too. I've merged it. Thank you everyone! Merged as:

zfsonlinux/spl@8fc851b sysmacros: Make P2ROUNDUP not trigger int overflow

perfinion commented 8 years ago

@behlendorf Thanks for pulling this in!

you need to pull in the second pull request too. The header file from spl is in the zfs repo too: https://github.com/zfsonlinux/zfs/blob/master/lib/libspl/include/sys/sysmacros.h#L53-L81

This pull request does the exact same fix for that file too: https://github.com/zfsonlinux/zfs/pull/3949 It also removes the duplicated definition.

behlendorf commented 8 years ago

@perfinion thanks for the reminder. I've just pulled it in.