<feed xmlns='http://www.w3.org/2005/Atom'>
<title>platform_external_elfutils/libebl/eblobjnote.c, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/'/>
<entry>
<title>libebl: Handle aarch64 bti, pac bits in gnu property note</title>
<updated>2020-09-07T09:23:54+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2020-09-03T13:42:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=18d64cd8e7ce0761568631bb40136ca7a154b6e0'/>
<id>18d64cd8e7ce0761568631bb40136ca7a154b6e0</id>
<content type='text'>
When building with gcc -mbranch-protection= we might get a gnu property
note indicating BTI (Branch Target Identification) and/or PAC (Pointer
Authentication Code) is being used.

Add a small testcase to show eu-readelf -n now properly lists those
bits in the gnu property note.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When building with gcc -mbranch-protection= we might get a gnu property
note indicating BTI (Branch Target Identification) and/or PAC (Pointer
Authentication Code) is being used.

Add a small testcase to show eu-readelf -n now properly lists those
bits in the gnu property note.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libebl: Check GNU property note data padding fits inside note.</title>
<updated>2019-01-29T23:04:11+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2019-01-29T23:04:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=cd7ded3df43f655af945c869976401a602e46fcd'/>
<id>cd7ded3df43f655af945c869976401a602e46fcd</id>
<content type='text'>
The GNU property note data is padded. Make sure the extra padding
still fits in the note description.

https://sourceware.org/bugzilla/show_bug.cgi?id=24075

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The GNU property note data is padded. Make sure the extra padding
still fits in the note description.

https://sourceware.org/bugzilla/show_bug.cgi?id=24075

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libebl: Check GNU property note pr_datasz fits inside note description.</title>
<updated>2019-01-16T11:08:16+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2019-01-16T10:57:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=012018907ca05eb0ab51d424a596ef38fc87cae1'/>
<id>012018907ca05eb0ab51d424a596ef38fc87cae1</id>
<content type='text'>
Before printing the data values, make sure pr_datasz doesn't go beyond
the end of the note description data.

https://sourceware.org/bugzilla/show_bug.cgi?id=24075

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before printing the data values, make sure pr_datasz doesn't go beyond
the end of the note description data.

https://sourceware.org/bugzilla/show_bug.cgi?id=24075

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libebl: Fix reading GNU_PROPERTY_STACK_SIZE reading from 32bit notes.</title>
<updated>2018-12-02T23:03:39+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2018-12-02T23:03:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=e8b9832af19e5975fb2a9dbe729eaba0373c781f'/>
<id>e8b9832af19e5975fb2a9dbe729eaba0373c781f</id>
<content type='text'>
When reading a GNU_PROPERTY_STACK_SIZE we need to use the proper data
type. GElf_Addr is 64bit always and when reading a 32bit size part of
it would not be initialized. Use either Elf32_Addr or Elf64_Addr to
read and print the data.

Add 32bit and 64bit, little and big endian testcases.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When reading a GNU_PROPERTY_STACK_SIZE we need to use the proper data
type. GElf_Addr is 64bit always and when reading a 32bit size part of
it would not be initialized. Use either Elf32_Addr or Elf64_Addr to
read and print the data.

Add 32bit and 64bit, little and big endian testcases.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Handle GNU Build Attribute ELF Notes.</title>
<updated>2018-11-13T12:46:40+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2018-11-12T22:34:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=72e30c2e0cb49a9a300667fdd5ff09082f717950'/>
<id>72e30c2e0cb49a9a300667fdd5ff09082f717950</id>
<content type='text'>
GNU Build Attribute ELF Notes are generated by the GCC annobin plugin
and described at https://fedoraproject.org/wiki/Toolchain/Watermark

Unfortunately the constants aren't yet described in the standard glibc
elf.h so they have been added to the elfutils specific elf-knowledge.h.

The notes abuse the name owner field to encode some data not in the
description. This makes it a bit hard to parse. We have to match the
note owner name prefix (to "GA") to be sure the type is valid. We also
cannot rely on the owner name being a valid C string since the attribute
name and value can contain zero (terminators). So pass around namesz
to the ebl note parsing functions.

eu-elflint will recognize and eu-readelf -n will now show the notes:

Note section [27] '.gnu.build.attributes' of 56080 bytes at offset 0x114564:
  Owner          Data size  Type
  GA                    16  GNU Build Attribute OPEN
    Address Range: 0x2f30f - 0x2f30f
    VERSION: "3p8"
  GA                     0  GNU Build Attribute OPEN
    TOOL: "gcc 8.2.1 20180801"
  GA                     0  GNU Build Attribute OPEN
    "GOW": 45
  GA                     0  GNU Build Attribute OPEN
    STACK_PROT: 0
  GA                     0  GNU Build Attribute OPEN
    "stack_clash": TRUE
  GA                     0  GNU Build Attribute OPEN
    "cf_protection": 0
  GA                     0  GNU Build Attribute OPEN
    "GLIBCXX_ASSERTIONS": TRUE
  GA                     0  GNU Build Attribute OPEN
    "FORTIFY": 0
  GA                     0  GNU Build Attribute OPEN
    PIC: 3
  GA                     0  GNU Build Attribute OPEN
    SHORT_ENUM: FALSE
  GA                     0  GNU Build Attribute OPEN
    ABI: c001100000012
  GA                     0  GNU Build Attribute OPEN
    "stack_realign": FALSE

A new test was added to run-readelf -n for the existing annobin file.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GNU Build Attribute ELF Notes are generated by the GCC annobin plugin
and described at https://fedoraproject.org/wiki/Toolchain/Watermark

Unfortunately the constants aren't yet described in the standard glibc
elf.h so they have been added to the elfutils specific elf-knowledge.h.

The notes abuse the name owner field to encode some data not in the
description. This makes it a bit hard to parse. We have to match the
note owner name prefix (to "GA") to be sure the type is valid. We also
cannot rely on the owner name being a valid C string since the attribute
name and value can contain zero (terminators). So pass around namesz
to the ebl note parsing functions.

eu-elflint will recognize and eu-readelf -n will now show the notes:

Note section [27] '.gnu.build.attributes' of 56080 bytes at offset 0x114564:
  Owner          Data size  Type
  GA                    16  GNU Build Attribute OPEN
    Address Range: 0x2f30f - 0x2f30f
    VERSION: "3p8"
  GA                     0  GNU Build Attribute OPEN
    TOOL: "gcc 8.2.1 20180801"
  GA                     0  GNU Build Attribute OPEN
    "GOW": 45
  GA                     0  GNU Build Attribute OPEN
    STACK_PROT: 0
  GA                     0  GNU Build Attribute OPEN
    "stack_clash": TRUE
  GA                     0  GNU Build Attribute OPEN
    "cf_protection": 0
  GA                     0  GNU Build Attribute OPEN
    "GLIBCXX_ASSERTIONS": TRUE
  GA                     0  GNU Build Attribute OPEN
    "FORTIFY": 0
  GA                     0  GNU Build Attribute OPEN
    PIC: 3
  GA                     0  GNU Build Attribute OPEN
    SHORT_ENUM: FALSE
  GA                     0  GNU Build Attribute OPEN
    ABI: c001100000012
  GA                     0  GNU Build Attribute OPEN
    "stack_realign": FALSE

A new test was added to run-readelf -n for the existing annobin file.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Recognize NT_VERSION notes.</title>
<updated>2018-11-13T12:40:00+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2018-11-11T22:50:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=7a3f6fe60b8519b5372f5a5521ccbac59411f33f'/>
<id>7a3f6fe60b8519b5372f5a5521ccbac59411f33f</id>
<content type='text'>
NT_VERSION notes are emitted by the gas .version directive.
They have an empty description and (ab)use the owner name to store the
version data string.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
NT_VERSION notes are emitted by the gas .version directive.
They have an empty description and (ab)use the owner name to store the
version data string.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Recognize and parse GNU Property notes.</title>
<updated>2018-10-28T23:57:57+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2018-10-15T21:35:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=5199e15870e05e5b0b9f98c20fc9b5427aa6dd6a'/>
<id>5199e15870e05e5b0b9f98c20fc9b5427aa6dd6a</id>
<content type='text'>
GNU Property notes are different from normal notes because they use
variable alignment/padding of their fields. They are 8 byte aligned,
but use 4 byte fields. The name is aligned at 4 bytes and padded so
that, the desc is aligned at 8 bytes. The whole note is padded to
8 bytes again. For normal notes all fields are both 4 bytes wide and
4 bytes aligned.

To recognize these new kind of ELF Notes a new Elf_Type is introduced,
ELF_T_NHDR8. This type is used in the xlate functions to determine
how to align and pad the various fields. Since the fields themselves
can now have different alignments we will have to keep track of the
current alignement and use either NOTE_ALIGN4 or NOTE_ALIGN8 to
determine the padding.

To set the correct Elf_Type on the Elf_Data we use either the section
sh_addralign or the segment p_align values. Assuming 8 means the
section or segment contains the new style notes, otherwise normal
notes.

When we cannot determine the "alignment" directly, like when parsing
special kernel sys files, we check the name "GNU" and type
"GNU_PROPERTY_TYPE_0" fields.

ebl_object_note now parses the new NT_GNU_PROPERTY_TYPE_0 and can
extract the GNU_PROPERTY_STACK_SIZE, GNU_PROPERTY_NO_COPY_ON_PROTECTED
and GNU_PROPERTY_X86_FEATURE_1_AND types GNU_PROPERTY_X86_FEATURE_1_IBT
and GNU_PROPERTY_X86_FEATURE_1_SHSTK.

Tests are added for extracting the note from sections or segments
as set by gcc -fcf-protection.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GNU Property notes are different from normal notes because they use
variable alignment/padding of their fields. They are 8 byte aligned,
but use 4 byte fields. The name is aligned at 4 bytes and padded so
that, the desc is aligned at 8 bytes. The whole note is padded to
8 bytes again. For normal notes all fields are both 4 bytes wide and
4 bytes aligned.

To recognize these new kind of ELF Notes a new Elf_Type is introduced,
ELF_T_NHDR8. This type is used in the xlate functions to determine
how to align and pad the various fields. Since the fields themselves
can now have different alignments we will have to keep track of the
current alignement and use either NOTE_ALIGN4 or NOTE_ALIGN8 to
determine the padding.

To set the correct Elf_Type on the Elf_Data we use either the section
sh_addralign or the segment p_align values. Assuming 8 means the
section or segment contains the new style notes, otherwise normal
notes.

When we cannot determine the "alignment" directly, like when parsing
special kernel sys files, we check the name "GNU" and type
"GNU_PROPERTY_TYPE_0" fields.

ebl_object_note now parses the new NT_GNU_PROPERTY_TYPE_0 and can
extract the GNU_PROPERTY_STACK_SIZE, GNU_PROPERTY_NO_COPY_ON_PROTECTED
and GNU_PROPERTY_X86_FEATURE_1_AND types GNU_PROPERTY_X86_FEATURE_1_IBT
and GNU_PROPERTY_X86_FEATURE_1_SHSTK.

Tests are added for extracting the note from sections or segments
as set by gcc -fcf-protection.

Signed-off-by: Mark Wielaard &lt;mark@klomp.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use fallthrough attribute.</title>
<updated>2018-02-10T02:19:26+00:00</updated>
<author>
<name>Joshua Watt</name>
<email>jpewhacker@gmail.com</email>
</author>
<published>2018-02-09T16:27:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=555e15ebe8bf1eb33d00747173cfc80cc65648a4'/>
<id>555e15ebe8bf1eb33d00747173cfc80cc65648a4</id>
<content type='text'>
Use __attribute__ ((fallthrough)) to indicate switch case fall through
instead of a comment. This ensures that the fallthrough warning is not
triggered even if the file is pre-processed (hence stripping the
comments) before it is compiled.

The actual fallback implementation is hidden behind a FALLBACK macro in
case the compiler doesn't support it.

Finally, the -Wimplict-fallthrough warning was upgraded to only allow
the attribute to satisfy it; a comment alone is no longer sufficient.

Signed-off-by: Joshua Watt &lt;JPEWhacker@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use __attribute__ ((fallthrough)) to indicate switch case fall through
instead of a comment. This ensures that the fallthrough warning is not
triggered even if the file is pre-processed (hence stripping the
comments) before it is compiled.

The actual fallback implementation is hidden behind a FALLBACK macro in
case the compiler doesn't support it.

Finally, the -Wimplict-fallthrough warning was upgraded to only allow
the attribute to satisfy it; a comment alone is no longer sufficient.

Signed-off-by: Joshua Watt &lt;JPEWhacker@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libebl: Fix missing brackets around if statement body.</title>
<updated>2016-01-09T21:09:48+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2016-01-09T21:09:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=c5da7c9e08c2bdb6dba8e115dcc09ed51a07f0e4'/>
<id>c5da7c9e08c2bdb6dba8e115dcc09ed51a07f0e4</id>
<content type='text'>
GCC6 [will have] a nice new warning that showed a real bug:

elfutils/libebl/eblobjnote.c: In function ‘ebl_object_note’:
elfutils/libebl/eblobjnote.c:135:5: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
     switch (type)
     ^~~~~~

elfutils/libebl/eblobjnote.c:45:3: note: ...this ‘if’ clause, but it is not
   if (! ebl-&gt;object_note (name, type, descsz, desc))
   ^~

And indeed, it should have been under the if, but wasn't because of missing
brackets. Added brackets (and reindent).

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GCC6 [will have] a nice new warning that showed a real bug:

elfutils/libebl/eblobjnote.c: In function ‘ebl_object_note’:
elfutils/libebl/eblobjnote.c:135:5: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
     switch (type)
     ^~~~~~

elfutils/libebl/eblobjnote.c:45:3: note: ...this ‘if’ clause, but it is not
   if (! ebl-&gt;object_note (name, type, descsz, desc))
   ^~

And indeed, it should have been under the if, but wasn't because of missing
brackets. Added brackets (and reindent).

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove old-style function definitions.</title>
<updated>2015-09-23T13:50:55+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mjw@redhat.com</email>
</author>
<published>2015-09-22T20:27:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/mirrors/AOSP/platform_external_elfutils/commit/?id=1ccdfb683ad6c7e59793136c3a657ddf131cafd1'/>
<id>1ccdfb683ad6c7e59793136c3a657ddf131cafd1</id>
<content type='text'>
We already require -std=gnu99 and old-style function definitions might
hide some compiler warnings.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We already require -std=gnu99 and old-style function definitions might
hide some compiler warnings.

Signed-off-by: Mark Wielaard &lt;mjw@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
