Date: Sat, 27 Jul 2013 20:43:23 +0100 From: Frank Leonhardt <frank2@fjl.co.uk> To: freebsd-questions@freebsd.org Subject: Re: Delete a directory, crash the system Message-ID: <51F422DB.2000205@fjl.co.uk> In-Reply-To: <CAHAXwYArUStyGe600oyiYY3oT0rCwYn-UWqedg8%2BCHBPq0ZcUA@mail.gmail.com> References: <CAHAXwYDPMrdY-TP-5T1_6M_ot4gY09jo2_Wi_REOmE=%2Bu%2B_QuQ@mail.gmail.com> <CAGwOe2byRc4LVsyxvTJgxNGCbhvOEaeDXjmFJ7DoXThPQe1bcQ@mail.gmail.com> <CAHAXwYCj9AV8ZcDffNNGx-ivL=h_TK9zLQRTPknArX25HSfEag@mail.gmail.com> <CAGwOe2YCDRqHudovDB_Kz9WHppvB8v2L%2B0gkDnWgG88bgZTKSA@mail.gmail.com> <CAHAXwYCnRDQqgRcvaEE1BmSJYYOidoQzzUoHX_QWdyJzYO3kKw@mail.gmail.com> <51F3F290.9020004@cordula.ws> <CAHAXwYA7WfYP8OZBVf47xRsDp9N01U3rPLZwwj7PFqkPxm3oag@mail.gmail.com> <51F420ED.1050402@fjl.co.uk> <CAHAXwYArUStyGe600oyiYY3oT0rCwYn-UWqedg8%2BCHBPq0ZcUA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 27/07/2013 20:38, David Noel wrote: >> I was going to raise an issue when the discussion had died down to a >> concensus. I also don't think it's reasonable for the kernel to bomb >> when it encounters corruption on a disk. >> >> If you want to patch it yourself, edit sys/ufs/ufs/ufs_vnops.c at around >> line 2791 change: >> >> if (dp->i_effnlink < 3) >> panic("ufs_dirrem: Bad link count %d on parent", >> dp->i_effnlink); >> >> To >> >> if (dp->i_effnlink < 3) { >> error = EINVAL; >> goto out; >> } >> >> The ufs_link() call has a similar issue. >> >> I can't see why my mod will break anything, but there's always >> unintended consequences. By returning invalid argument, any code above >> it should already be handling that condition although the user will be >> scratching their head wondering what's wrong with it. Returning ENOENT >> or EACCES or ENOTDIR may be better ("No such directory", "Access denied" >> or "Not a valid directory"). >> >> The trouble is that it's tricky to test properly without finding a good >> way to corrupt the link count :-) >> >> Regards, Frank. > Cool. Thanks for the patch! > Sorry - forgot to mention that you use it entirely at your own risk!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51F422DB.2000205>