Page MenuHomeFreeBSD

elftoolchain: Copy "as much as possible" for short note reads
Needs ReviewPublic

Authored by jhibbits on Apr 17 2021, 4:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 22 2023, 4:10 PM
Unknown Object (File)
Mar 22 2023, 8:05 AM
Unknown Object (File)
Mar 4 2023, 9:35 PM
Subscribers

Details

Summary

It's possible a note is not properly padded, which yields a short copy.
Rather than fail, just copy as much as possible, and complete it. This
works around problems found in mesa with AMD GPU pipeline.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 38652
Build 35541: arc lint + arc unit

Event Timeline

Can you provide more info about the problem? Does it arise because of the roundup of namesz and descsz?

contrib/elftoolchain/libelf/libelf_convert.m4
27

Since elftoolchain aims to be portable, I suspect depending on param.h for MIN() is not really desirable.

972

Should _libelf_cvt_NOTE_tof() be modified too?

Can you provide more info about the problem? Does it arise because of the roundup of namesz and descsz?

If I remember correctly (it's been a long time since I made the change), yes, it's the roundup that's the problem. I looked at how the GNU equivalent also only copies as much as is available. I didn't understand why it needed to be sized on a word boundary, because it's just doing a memcpy(), it's not swapping bytes in the copy. I guess because they must be properly aligned?

contrib/elftoolchain/libelf/libelf_convert.m4
27

Sure, I can make it local.

972

Probably. I didn't bother with it because it wasn't needed for Mesa.