<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/binfmt_elf_fdpic.c, branch linux-6.7.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-10-31T05:28:19Z</updated>
<entry>
<title>Merge tag 'execve-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux</title>
<updated>2023-10-31T05:28:19Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2023-10-31T05:28:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d82c0a37d431ada0d1dae9a2665fcfe17b0f9e14'/>
<id>urn:sha1:d82c0a37d431ada0d1dae9a2665fcfe17b0f9e14</id>
<content type='text'>
Pull execve updates from Kees Cook:

 - Support non-BSS ELF segments with zero filesz

   Eric Biederman and I refactored ELF segment loading to handle the
   case where a segment has a smaller filesz than memsz. Traditionally
   linkers only did this for .bss and it was always the last segment. As
   a result, the kernel only handled this case when it was the last
   segment. We've had two recent cases where linkers were trying to use
   these kinds of segments for other reasons, and the were in the middle
   of the segment list. There was no good reason for the kernel not to
   support this, and the refactor actually ends up making things more
   readable too.

 - Enable namespaced binfmt_misc

   Christian Brauner has made it possible to use binfmt_misc with mount
   namespaces. This means some traditionally root-only interfaces (for
   adding/removing formats) are now more exposed (but believed to be
   safe).

 - Remove struct tag 'dynamic' from ELF UAPI

   Alejandro Colomar noticed that the ELF UAPI has been polluting the
   struct namespace with an unused and overly generic tag named
   "dynamic" for no discernible reason for many many years. After
   double-checking various distro source repositories, it has been
   removed.

 - Clean up binfmt_elf_fdpic debug output (Greg Ungerer)

* tag 'execve-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  binfmt_misc: enable sandboxed mounts
  binfmt_misc: cleanup on filesystem umount
  binfmt_elf_fdpic: clean up debug warnings
  mm: Remove unused vm_brk()
  binfmt_elf: Only report padzero() errors when PROT_WRITE
  binfmt_elf: Use elf_load() for library
  binfmt_elf: Use elf_load() for interpreter
  binfmt_elf: elf_bss no longer used by load_elf_binary()
  binfmt_elf: Support segments with 0 filesz and misaligned starts
  elf, uapi: Remove struct tag 'dynamic'
</content>
</entry>
<entry>
<title>binfmt_elf_fdpic: clean up debug warnings</title>
<updated>2023-10-04T02:48:44Z</updated>
<author>
<name>Greg Ungerer</name>
</author>
<published>2023-09-27T13:29:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=553e41d1bc95a09e32b6beb0a2b1c20dc4ea9b19'/>
<id>urn:sha1:553e41d1bc95a09e32b6beb0a2b1c20dc4ea9b19</id>
<content type='text'>
The binfmt_elf_fdpic loader has some debug trace that can be enabled at
build time. The recent 64-bit additions cause some warnings if that
debug is enabled, such as:

    fs/binfmt_elf_fdpic.c: In function ‘elf_fdpic_map_file’:
    fs/binfmt_elf_fdpic.c:46:33: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Elf64_Addr’ {aka ‘long long unsigned int’} [-Wformat=]
       46 | #define kdebug(fmt, ...) printk("FDPIC "fmt"\n" ,##__VA_ARGS__ )
          |                                 ^~~~~~~~
    ./include/linux/printk.h:427:25: note: in definition of macro ‘printk_index_wrap’
      427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
          |                         ^~~~

Cast values to the largest possible type (which is equivilent to unsigned
long long in this case) and use appropriate format specifiers to match.

Fixes: b922bf04d2c1 ("binfmt_elf_fdpic: support 64-bit systems")
Signed-off-by: Greg Ungerer &lt;gerg@kernel.org&gt;
Link: https://lore.kernel.org/r/20230927132933.3290734-1-gerg@kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>fs: binfmt_elf_efpic: fix personality for ELF-FDPIC</title>
<updated>2023-09-30T00:20:45Z</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=7c3151585730b7095287be8162b846d31e6eee61'/>
<id>urn:sha1:7c3151585730b7095287be8162b846d31e6eee61</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>binfmt_elf_fdpic: support 64-bit systems</title>
<updated>2023-08-23T21:17:42Z</updated>
<author>
<name>Greg Ungerer</name>
</author>
<published>2023-07-11T13:07:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b922bf04d2c1355633bdefbc2ed5fba1f0d4df07'/>
<id>urn:sha1:b922bf04d2c1355633bdefbc2ed5fba1f0d4df07</id>
<content type='text'>
The binfmt_flat_fdpic code has a number of 32-bit specific data
structures associated with it. Extend it to be able to support and
be used on 64-bit systems as well.

The new code defines a number of key 64-bit variants of the core
elf-fdpic data structures - along side the existing 32-bit sized ones.
A common set of generic named structures are defined to be either
the 32-bit or 64-bit ones as required at compile time. This is a
similar technique to that used in the ELF binfmt loader.

For example:

  elf_fdpic_loadseg is either elf32_fdpic_loadseg or elf64_fdpic_loadseg
  elf_fdpic_loadmap is either elf32_fdpic_loadmap or elf64_fdpic_loadmap

the choice based on ELFCLASS32 or ELFCLASS64.

Signed-off-by: Greg Ungerer &lt;gerg@kernel.org&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20230711130754.481209-2-gerg@kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&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>
</feed>
