On Sat, Feb 27, 2021 at 12:24:33PM +0000, George Brown wrote: > Binaries without a .note.openbsd.ident section fail to execute. This > note section is mentioned in the ELF man page as follows. > > > .note This section holds information in the note section format > > described below. This section is of type SHT_NOTE. No > > attribute types are used. OpenBSD native executables usually > > contain a .note.openbsd.ident section to identify themselves, > > for the kernel to bypass any compatibility ELF binary emula- > > tion tests when loading the file. > > The use of the word "usually" makes this read ambiguously to me. In that > it's not clear if this note is present and/or required in all binaries. > > Examining binaries on my system it seems this note is indeed always > present and from practise does seem to be required (removing it from > binaries with objcopy -R causes execution to fail). The mention of > "emulation" made we wonder if perhaps this was referring to the old > compat_linux layer. Reviewing the history it seems this part of the man > page is largely unchanged from it's import in V 1.1 which pre-dates the > removal of compat_linux. > > Is this indeed a remnant? If so should an update with firmer wording be > made, perhaps something like the following? Though I'm not really sure > what in the underlying implantation this note represents in a post > compat_linux removal world? > > diff --git a/share/man/man5/elf.5 b/share/man/man5/elf.5 > index d22279f6738..aece235de6b 100644 > --- a/share/man/man5/elf.5 > +++ b/share/man/man5/elf.5 > @@ -1026,10 +1026,9 @@ This section is of type > .Dv SHT_NOTE . > No attribute types are used. > .Ox > -native executables usually contain a > +native executables must contain a > .Sy .note.openbsd.ident > -section to identify themselves, for the kernel to bypass any compatibility > -ELF binary emulation tests when loading the file. > +section to identify themselves. > .It .plt > This section holds the procedure linkage table. > This section is of type >
hi. diff committed, with one change: we did not add "must" (just removed "usually"). jmc