diff mbox

[CVE-2011-4086] jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer

Message ID 1334918836-7341-1-git-send-email-stefan.bader@canonical.com
State New
Headers show

Commit Message

Stefan Bader April 20, 2012, 10:47 a.m. UTC
local dos because of journal_unmap_buffer()

This is pending in Oneiric but can be cherry-picked all the way
back into Hardy. Proposing for Hardy, Lucid, Natty, Natty/ti-omap4.

-Stefan

From 15291164b22a357cb211b618adfef4fa82fc0de3 Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@redhat.com>
Date: Mon, 20 Feb 2012 17:53:01 -0500
Subject: [PATCH] jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer

journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head
state ala discard_buffer(), but does not touch _Delay or _Unwritten as
discard_buffer() does.

This can be problematic in some areas of the ext4 code which assume
that if they have found a buffer marked unwritten or delay, then it's
a live one.  Perhaps those spots should check whether it is mapped
as well, but if jbd2 is going to tear down a buffer, let's really
tear it down completely.

Without this I get some fsx failures on sub-page-block filesystems
up until v3.2, at which point 4e96b2dbbf1d7e81f22047a50f862555a6cb87cb
and 189e868fa8fdca702eb9db9d8afc46b5cb9144c9 make the failures go
away, because buried within that large change is some more flag
clearing.  I still think it's worth doing in jbd2, since
->invalidatepage leads here directly, and it's the right place
to clear away these flags.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org

BugLink: http://bugs.launchpad.net/bugs/929781
CVE-2011-4086

(cherry-picked from 15291164b22a357cb211b618adfef4fa82fc0de3 upstream)
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 fs/jbd2/transaction.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Leann Ogasawara April 20, 2012, 1:24 p.m. UTC | #1
On 04/20/2012 03:47 AM, Stefan Bader wrote:
> local dos because of journal_unmap_buffer()
>
> This is pending in Oneiric but can be cherry-picked all the way
> back into Hardy. Proposing for Hardy, Lucid, Natty, Natty/ti-omap4.
>
> -Stefan
>
>  From 15291164b22a357cb211b618adfef4fa82fc0de3 Mon Sep 17 00:00:00 2001
> From: Eric Sandeen<sandeen@redhat.com>
> Date: Mon, 20 Feb 2012 17:53:01 -0500
> Subject: [PATCH] jbd2: clear BH_Delay&  BH_Unwritten in journal_unmap_buffer
>
> journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head
> state ala discard_buffer(), but does not touch _Delay or _Unwritten as
> discard_buffer() does.
>
> This can be problematic in some areas of the ext4 code which assume
> that if they have found a buffer marked unwritten or delay, then it's
> a live one.  Perhaps those spots should check whether it is mapped
> as well, but if jbd2 is going to tear down a buffer, let's really
> tear it down completely.
>
> Without this I get some fsx failures on sub-page-block filesystems
> up until v3.2, at which point 4e96b2dbbf1d7e81f22047a50f862555a6cb87cb
> and 189e868fa8fdca702eb9db9d8afc46b5cb9144c9 make the failures go
> away, because buried within that large change is some more flag
> clearing.  I still think it's worth doing in jbd2, since
> ->invalidatepage leads here directly, and it's the right place
> to clear away these flags.
>
> Signed-off-by: Eric Sandeen<sandeen@redhat.com>
> Signed-off-by: "Theodore Ts'o"<tytso@mit.edu>
> Cc: stable@vger.kernel.org
>
> BugLink: http://bugs.launchpad.net/bugs/929781
> CVE-2011-4086
>
> (cherry-picked from 15291164b22a357cb211b618adfef4fa82fc0de3 upstream)
> Signed-off-by: Stefan Bader<stefan.bader@canonical.com>
Acked-by: Leann Ogasawara <leann.ogasawara@canonical.com>
> ---
>   fs/jbd2/transaction.c |    2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index 35ae096..52653306 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -1949,6 +1949,8 @@ zap_buffer_unlocked:
>   	clear_buffer_mapped(bh);
>   	clear_buffer_req(bh);
>   	clear_buffer_new(bh);
> +	clear_buffer_delay(bh);
> +	clear_buffer_unwritten(bh);
>   	bh->b_bdev = NULL;
>   	return may_free;
>   }
Herton Ronaldo Krzesinski April 20, 2012, 1:40 p.m. UTC | #2
On Fri, Apr 20, 2012 at 12:47:16PM +0200, Stefan Bader wrote:
> local dos because of journal_unmap_buffer()
> 
> This is pending in Oneiric but can be cherry-picked all the way
> back into Hardy. Proposing for Hardy, Lucid, Natty, Natty/ti-omap4.
> 
> -Stefan
> 
> From 15291164b22a357cb211b618adfef4fa82fc0de3 Mon Sep 17 00:00:00 2001
> From: Eric Sandeen <sandeen@redhat.com>
> Date: Mon, 20 Feb 2012 17:53:01 -0500
> Subject: [PATCH] jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer
> 
> journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head
> state ala discard_buffer(), but does not touch _Delay or _Unwritten as
> discard_buffer() does.
> 
> This can be problematic in some areas of the ext4 code which assume
> that if they have found a buffer marked unwritten or delay, then it's
> a live one.  Perhaps those spots should check whether it is mapped
> as well, but if jbd2 is going to tear down a buffer, let's really
> tear it down completely.
> 
> Without this I get some fsx failures on sub-page-block filesystems
> up until v3.2, at which point 4e96b2dbbf1d7e81f22047a50f862555a6cb87cb
> and 189e868fa8fdca702eb9db9d8afc46b5cb9144c9 make the failures go
> away, because buried within that large change is some more flag
> clearing.  I still think it's worth doing in jbd2, since
> ->invalidatepage leads here directly, and it's the right place
> to clear away these flags.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> Cc: stable@vger.kernel.org
> 
> BugLink: http://bugs.launchpad.net/bugs/929781
> CVE-2011-4086
> 
> (cherry-picked from 15291164b22a357cb211b618adfef4fa82fc0de3 upstream)
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  fs/jbd2/transaction.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index 35ae096..52653306 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -1949,6 +1949,8 @@ zap_buffer_unlocked:
>  	clear_buffer_mapped(bh);
>  	clear_buffer_req(bh);
>  	clear_buffer_new(bh);
> +	clear_buffer_delay(bh);
> +	clear_buffer_unwritten(bh);
>  	bh->b_bdev = NULL;
>  	return may_free;
>  }
> -- 
> 1.7.9.5
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>
Stefan Bader April 20, 2012, 2:22 p.m. UTC | #3
Applied and pushed to Natty master-next and ti-omap4, Lucid and Hardy
diff mbox

Patch

diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 35ae096..52653306 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1949,6 +1949,8 @@  zap_buffer_unlocked:
 	clear_buffer_mapped(bh);
 	clear_buffer_req(bh);
 	clear_buffer_new(bh);
+	clear_buffer_delay(bh);
+	clear_buffer_unwritten(bh);
 	bh->b_bdev = NULL;
 	return may_free;
 }