<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/binfmt_elf_fdpic.c, branch linux-6.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-10-06T11:16:29Z</updated>
<entry>
<title>fs: binfmt_elf_efpic: fix personality for ELF-FDPIC</title>
<updated>2023-10-06T11:16:29Z</updated>
<author>
<name>Greg Ungerer</name>
</author>
<published>2023-09-07T01:18:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bc15bb91460a43cb8bdf3637896973cb2047199e'/>
<id>urn:sha1:bc15bb91460a43cb8bdf3637896973cb2047199e</id>
<content type='text'>
commit 7c3151585730b7095287be8162b846d31e6eee61 upstream.

The elf-fdpic loader hard sets the process personality to either
PER_LINUX_FDPIC for true elf-fdpic binaries or to PER_LINUX for normal ELF
binaries (in this case they would be constant displacement compiled with
-pie for example).  The problem with that is that it will lose any other
bits that may be in the ELF header personality (such as the "bug
emulation" bits).

On the ARM architecture the ADDR_LIMIT_32BIT flag is used to signify a
normal 32bit binary - as opposed to a legacy 26bit address binary.  This
matters since start_thread() will set the ARM CPSR register as required
based on this flag.  If the elf-fdpic loader loses this bit the process
will be mis-configured and crash out pretty quickly.

Modify elf-fdpic loader personality setting so that it preserves the upper
three bytes by using the SET_PERSONALITY macro to set it.  This macro in
the generic case sets PER_LINUX and preserves the upper bytes.
Architectures can override this for their specific use case, and ARM does
exactly this.

The problem shows up quite easily running under qemu using the ARM
architecture, but not necessarily on all types of real ARM hardware.  If
the underlying ARM processor does not support the legacy 26-bit addressing
mode then everything will work as expected.

Link: https://lkml.kernel.org/r/20230907011808.2985083-1-gerg@kernel.org
Fixes: 1bde925d23547 ("fs/binfmt_elf_fdpic.c: provide NOMMU loader for regular ELF binaries")
Signed-off-by: Greg Ungerer &lt;gerg@kernel.org&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Christian Brauner &lt;brauner@kernel.org&gt;
Cc: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Cc: Greg Ungerer &lt;gerg@kernel.org&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>binfmt: Slightly simplify elf_fdpic_map_file()</title>
<updated>2023-05-30T22:49:46Z</updated>
<author>
<name>Christophe JAILLET</name>
</author>
<published>2023-05-28T16:20:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=36650a357eac3e525edbd31db4fe45841b05dc3b'/>
<id>urn:sha1:36650a357eac3e525edbd31db4fe45841b05dc3b</id>
<content type='text'>
There is no point in initializing 'load_addr' and 'seg' here, they are both
re-written just before being used below.

Doing so, 'load_addr' can be moved in the #ifdef CONFIG_MMU section.

Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Acked-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/4f5e4096ad7f17716e924b5bd080e5709fc0b84b.1685290790.git.christophe.jaillet@wanadoo.fr
</content>
</entry>
<entry>
<title>binfmt: Use struct_size()</title>
<updated>2023-05-30T22:49:46Z</updated>
<author>
<name>Christophe JAILLET</name>
</author>
<published>2023-05-28T16:20:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e6302d5a285b41209ada308ced6f9562cf1c616f'/>
<id>urn:sha1:e6302d5a285b41209ada308ced6f9562cf1c616f</id>
<content type='text'>
Use struct_size() instead of hand-writing it. It is less verbose, more
robust and more informative.

Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Acked-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/53150beae5dc04dac513dba391a2e4ae8696a7f3.1685290790.git.christophe.jaillet@wanadoo.fr
</content>
</entry>
<entry>
<title>coredump, vmcore: Set p_align to 4 for PT_NOTE</title>
<updated>2023-05-16T21:32:00Z</updated>
<author>
<name>Fangrui Song</name>
</author>
<published>2023-05-12T02:25:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=60592fb6b67c653beaa2e7acad9a9d7aa0b71dff'/>
<id>urn:sha1:60592fb6b67c653beaa2e7acad9a9d7aa0b71dff</id>
<content type='text'>
Tools like readelf/llvm-readelf use p_align to parse a PT_NOTE program
header as an array of 4-byte entries or 8-byte entries. Currently, there
are workarounds[1] in place for Linux to treat p_align==0 as 4. However,
it would be more appropriate to set the correct alignment so that tools
do not have to rely on guesswork. FreeBSD coredumps set p_align to 4 as
well.

[1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=82ed9683ec099d8205dc499ac84febc975235af6
[2]: https://reviews.llvm.org/D150022

Signed-off-by: Fangrui Song &lt;maskray@google.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20230512022528.3430327-1-maskray@google.com
</content>
</entry>
<entry>
<title>ELF: fix all "Elf" typos</title>
<updated>2023-04-08T20:45:37Z</updated>
<author>
<name>Alexey Dobriyan</name>
</author>
<published>2023-02-28T12:14:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=70e79866ab36feaaed8ef26dacfbcbac6a0631c9'/>
<id>urn:sha1:70e79866ab36feaaed8ef26dacfbcbac6a0631c9</id>
<content type='text'>
ELF is acronym and therefore should be spelled in all caps.

I left one exception at Documentation/arm/nwfpe/nwfpe.rst which looks like
being written in the first person.

Link: https://lkml.kernel.org/r/Y/3wGWQviIOkyLJW@p183
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>elfcore: Add a cprm parameter to elf_core_extra_{phdrs,data_size}</title>
<updated>2023-01-05T15:12:12Z</updated>
<author>
<name>Catalin Marinas</name>
</author>
<published>2022-12-22T18:12:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=19e183b54528f11fafeca60fc6d0821e29ff281e'/>
<id>urn:sha1:19e183b54528f11fafeca60fc6d0821e29ff281e</id>
<content type='text'>
A subsequent fix for arm64 will use this parameter to parse the vma
information from the snapshot created by dump_vma_snapshot() rather than
traversing the vma list without the mmap_lock.

Fixes: 6dd8b1a0b6cb ("arm64: mte: Dump the MTE tags in the core file")
Cc: &lt;stable@vger.kernel.org&gt; # 5.18.x
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Reported-by: Seth Jenkins &lt;sethjenkins@google.com&gt;
Suggested-by: Seth Jenkins &lt;sethjenkins@google.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Eric Biederman &lt;ebiederm@xmission.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20221222181251.1345752-3-catalin.marinas@arm.com
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>binfmt: Fix error return code in load_elf_fdpic_binary()</title>
<updated>2022-12-02T03:15:52Z</updated>
<author>
<name>Wang Yufen</name>
</author>
<published>2022-12-02T01:41:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e7f703ff2507f4e9f496da96cd4b78fd3026120c'/>
<id>urn:sha1:e7f703ff2507f4e9f496da96cd4b78fd3026120c</id>
<content type='text'>
Fix to return a negative error code from create_elf_fdpic_tables()
instead of 0.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Wang Yufen &lt;wangyufen@huawei.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/1669945261-30271-1-git-send-email-wangyufen@huawei.com
</content>
</entry>
<entry>
<title>binfmt: Fix whitespace issues</title>
<updated>2022-10-25T22:17:23Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2022-10-18T07:14:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8f6e3f9e5a0f58e458a348b7e36af11d0e9702af'/>
<id>urn:sha1:8f6e3f9e5a0f58e458a348b7e36af11d0e9702af</id>
<content type='text'>
Fix the annoying whitespace issues that have been following these files
around for years.

Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Christian Brauner (Microsoft) &lt;brauner@kernel.org&gt;
Link: https://lore.kernel.org/r/20221018071350.never.230-kees@kernel.org
</content>
</entry>
<entry>
<title>coredump: Snapshot the vmas in do_coredump</title>
<updated>2022-03-08T18:55:29Z</updated>
<author>
<name>Eric W. Biederman</name>
</author>
<published>2022-03-08T18:55:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=95c5436a4883841588dae86fb0b9325f47ba5ad3'/>
<id>urn:sha1:95c5436a4883841588dae86fb0b9325f47ba5ad3</id>
<content type='text'>
Move the call of dump_vma_snapshot and kvfree(vma_meta) out of the
individual coredump routines into do_coredump itself.  This makes
the code less error prone and easier to maintain.

Make the vma snapshot available to the coredump routines
in struct coredump_params.  This makes it easier to
change and update what is captures in the vma snapshot
and will be needed for fixing fill_file_notes.

Reviewed-by: Jann Horn &lt;jannh@google.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
</content>
</entry>
<entry>
<title>binfmt: move more stuff undef CONFIG_COREDUMP</title>
<updated>2022-03-02T00:16:27Z</updated>
<author>
<name>Alexey Dobriyan</name>
</author>
<published>2022-02-13T19:25:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d65bc29be0ae4ca2368df25dc6f6247aefb57f07'/>
<id>urn:sha1:d65bc29be0ae4ca2368df25dc6f6247aefb57f07</id>
<content type='text'>
struct linux_binfmt::core_dump and struct min_coredump::min_coredump
are used under CONFIG_COREDUMP only. Shrink those embedded configs
a bit.

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/YglbIFyN+OtwVyjW@localhost.localdomain
</content>
</entry>
</feed>
