[cfarm-users] having a bit of trouble with getting into the new netbsd and freebsd virtual machines

CM Graff cm0graff at gmail.com
Sat Oct 13 11:09:59 CEST 2018


Hello again everyone!!

So I finally figured out what is going on with this -- and it has
nothing to do with lack of packages and only tangentially related to
issues of linux to BSD compat. NetBSD requires a note section in the
ELF headers, as do other BSD to some extent. This applies to anyone
writing bare-metal C programs or assembly code on such platforms.

http://www.netbsd.org/docs/kernel/elf-notes.html

I have collected a number of such links and some of them even
pertaining to security issues! Interesting stuff.

Well, I am going to go ahead and let this thread die as I am at the
end of my journey with discovering what needs to happen for bare-metal
programs on NetBSD

Thank you all for the help, time and the cfarm resources!

Graff

On 10/6/18, CM Graff <cm0graff at gmail.com> wrote:
> Once again hello everyone!
>
> Assaf, I think that upgrading the NetBSD box to version 8 should not
> be a terrible concern, at least it's not important to me. In my
> opinion it may lead to a huge time investment and potential breakage.
> In my opinion it might be easier to just start a new virtual machine
> running NetBSD 8 when that time comes around and simply just keep
> supplying security fixes for the NetBSD 7 box.
>
> Regardless, it's up to you and everyone else of course. I just don't
> want you spending lots of time on my behalf.
>
> Thank you !  :)
>
> Graff
>
> On 10/6/18, CM Graff <cm0graff at gmail.com> wrote:
>> Hey Assaf and everyone!
>>
>> I did discover a few things.
>>
>> gcc300$ echo "int x = 0;" > example.c
>> gcc300$ cc --freestanding -nostdlib -static example.c
>> ld: warning: cannot find entry symbol _start; defaulting to
>> 0000000000400078
>> gcc300$ ./a.out
>> -sh: Cannot execute ELF binary ./a.out
>>
>> Making this simple freestanding binary results in the same issue.
>>
>> When doing the same on my linux box, the a.out runs and the binary
>> simply segfaults (but does run!).
>>
>> I did try the new clang package and it results in the same issue.
>> Thank you for installing that Assaf! It will come in handy quite soon.
>>
>> I'll take some of these questions to the netbsd developers and try to
>> get to the bottom of this.
>>
>> Thanks again!
>>
>> Graff
>>
>>
>>
>>
>> On 10/6/18, Assaf Gordon <assafgordon at gmail.com> wrote:
>>> Hello Graff,
>>>
>>> On 06/10/18 09:02 PM, CM Graff via cfarm-users wrote:
>>>> To follow up, I think that the problem is a bit more complex. I am
>>>> guessing now that there is a Linux/ELF compat mechanism somewhere in
>>>> the default compiler search path. I think for hlibc to work with
>>>> NetBSD I'll have to research how this all works, or perhaps even
>>>> specify a different binary format. Because I am redirecting the
>>>> compiler search paths to only look for hlibc's libc.a, crt1.o, crtn.o
>>>> and crti.o something is probably getting excluded. Open to
>>>> suggestions, but I am starting to think this is not a system
>>>> maintenance issue but something of a different nature having to do
>>>> with various less used compiler invocations.
>>>
>>> I know very little about the above, but note that:
>>>
>>> 1.
>>> gcc300 is NetBSD 7.1 - not yet upgraded to NetBSD 8.0.
>>> Not sure if there is a big difference.
>>> I do plan to upgrade in the near future.
>>>
>>> 2.
>>> I've just installed clang-5.0.2 on gcc300,
>>> perhaps using it instead of the (very old) gcc
>>> would make things easier to troubleshoot.
>>>
>>>
>>> regards,
>>>   - assaf
>>>
>>>
>>>
>>
>


More information about the cfarm-users mailing list