lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141006150647.GH7526@quack.suse.cz>
Date:	Mon, 6 Oct 2014 17:06:47 +0200
From:	Jan Kara <jack@...e.cz>
To:	Theodore Ts'o <tytso@....edu>
Cc:	Ext4 Developers List <linux-ext4@...r.kernel.org>,
	stable@...r.kernel.org
Subject: Re: [PATCH 1/2] ext4: don't orphan or truncate the boot loader inode

On Sun 05-10-14 22:48:01, Ted Tso wrote:
> The boot loader inode (inode #5) should never be visible in the
> directory hierarchy, but it's possible if the file system is corrupted
> that there will be a directory entry that points at inode #5.  In
> order to avoid accidentally trashing it, when such a directory inode
> is opened, the inode will be marked as a bad inode, so that it's not
> possible to modify (or read) the inode from userspace.
> 
> Unfortunately, when we unlink this (invalid/illegal) directory entry,
> we will put the bad inode on the ophan list, and then when try to
> unlink the directory, we don't actually remove the bad inode from the
> orphan list before freeing in-memory inode structure.  This means the
> in-memory orphan list is corrupted, leading to a kernel oops.
> 
> In addition, avoid truncating a bad inode in ext4_destroy_inode(),
> since truncating the boot loader inode is not a smart thing to do.
> 
> Reported-by: Sami Liedes <sami.liedes@....fi>
> Signed-off-by: Theodore Ts'o <tytso@....edu>
> Cc: stable@...r.kernel.org
  The patch looks good. You can add:
Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  fs/ext4/inode.c | 7 +++----
>  fs/ext4/namei.c | 2 +-
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 41c4f97..59983b2 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -224,16 +224,15 @@ void ext4_evict_inode(struct inode *inode)
>  		goto no_delete;
>  	}
>  
> -	if (!is_bad_inode(inode))
> -		dquot_initialize(inode);
> +	if (is_bad_inode(inode))
> +		goto no_delete;
> +	dquot_initialize(inode);
>  
>  	if (ext4_should_order_data(inode))
>  		ext4_begin_ordered_truncate(inode, 0);
>  	truncate_inode_pages_final(&inode->i_data);
>  
>  	WARN_ON(atomic_read(&EXT4_I(inode)->i_ioend_count));
> -	if (is_bad_inode(inode))
> -		goto no_delete;
>  
>  	/*
>  	 * Protect us against freezing - iput() caller didn't have to have any
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 51705f8..a2a9d40 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2544,7 +2544,7 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
>  	int err = 0, rc;
>  	bool dirty = false;
>  
> -	if (!sbi->s_journal)
> +	if (!sbi->s_journal || is_bad_inode(inode))
>  		return 0;
>  
>  	WARN_ON_ONCE(!(inode->i_state & (I_NEW | I_FREEING)) &&
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ