[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1468014494-25291-1-git-send-email-keescook@chromium.org>
Date: Fri, 8 Jul 2016 14:48:12 -0700
From: Kees Cook <keescook@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Kees Cook <keescook@...omium.org>,
Hector Marco-Gisbert <hecmargi@....es>,
Ismael Ripoll Ripoll <iripoll@....es>,
Alexander Viro <viro@...iv.linux.org.uk>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Oleg Nesterov <oleg@...hat.com>,
Chen Gang <gang.chen.5i5j@...il.com>,
Michal Hocko <mhocko@...e.com>,
Konstantin Khlebnikov <koct9i@...il.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 0/2] binfmt_elf: fix calculations for bss padding
This fixes a double-bug in ELF loading, as noticed by Hector
Marco-Gisbert. To quote his original email:
The size of the bss section for some interpreters is not correctly
calculated resulting in unnecessary calls to vm_brk() with enormous size
values.
The bug appears when loading some interpreters with a small bss size. Once
the last loadable segment has been loaded, the bss section is zeroed up to
the page boundary and the elf_bss variable is updated to this new page
boundary. Because of this update (alignment), the last_bss could be less
than elf_bss and the subtraction "last_bss - elf_bss" value could overflow.
...
[e.g.] The size value requested to the vm_brk() call (last_bss - elf_bss) is
0xfffffffffffff938 and internally this size is page aligned in the do_brk()
function resulting in a 0 length request.
This series takes a slightly different approach to fixing it and updates
vm_brk to refuse bad allocation sizes.
-Kees
Powered by blists - more mailing lists