Re: RPI3 - clang 3.9.0 issues

2016-10-18 Thread Shawn Webb
On Tue, Oct 18, 2016 at 03:27:43PM -0400, Shawn Webb wrote:
> On Mon, Oct 17, 2016 at 09:40:53PM -0400, Shawn Webb wrote:
> > On Mon, Oct 17, 2016 at 05:11:43PM -0400, Shawn Webb wrote:
> > >
> > > I'm tracking down a potential issue with jemalloc compiled with clang
> > > 3.9.0, but I need to verify that the issue exists in vanilla FreeBSD in
> > > addition to HardenedBSD. Most of my testing has been done with
> > > HardenedBSD to-date.
> > 
> > The jemalloc issue exists with vanilla FreeBSD with clang 3.9.0 + lld:
> > 
> > ===>   Registering installation for pkg-1.9.1
> > : 
> > /scratch/arm64/fbsd-clang390/lib/libc/../../contrib/jemalloc/include/jemalloc/internal/tcache.h:346:
> >  Failed assertion: "binind < nhbins"
> > 
> > With pkg failing to install, it seems building ports/packages directly
> > on the rpi3 won't be viable until this bug is fixed.
> 
> I was able to work around this issue by disabling tcache via
> malloc.conf:
> 
> ln -s 'tcache:false' /etc/malloc.conf
> 
> pkg would install, but /usr/local/sbin/pkg was mislinked:
> http://ix.io/1xlt

It seems this type of mislinking happens with more than just pkg:

(pkgconf-1.0.1) /usr/ports/devel/pkgconf/work/stage//usr/local/bin/pkgconf - 
required shared library ./.libs/libpkgconf.so not found

So I wonder if it's happening with all dynamically-linked executables
in the ports tree.


-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: RPI3 - clang 3.9.0 issues

2016-10-18 Thread Shawn Webb
On Mon, Oct 17, 2016 at 09:40:53PM -0400, Shawn Webb wrote:
> On Mon, Oct 17, 2016 at 05:11:43PM -0400, Shawn Webb wrote:
> >
> > I'm tracking down a potential issue with jemalloc compiled with clang
> > 3.9.0, but I need to verify that the issue exists in vanilla FreeBSD in
> > addition to HardenedBSD. Most of my testing has been done with
> > HardenedBSD to-date.
> 
> The jemalloc issue exists with vanilla FreeBSD with clang 3.9.0 + lld:
> 
> ===>   Registering installation for pkg-1.9.1
> : 
> /scratch/arm64/fbsd-clang390/lib/libc/../../contrib/jemalloc/include/jemalloc/internal/tcache.h:346:
>  Failed assertion: "binind < nhbins"
> 
> With pkg failing to install, it seems building ports/packages directly
> on the rpi3 won't be viable until this bug is fixed.

I was able to work around this issue by disabling tcache via
malloc.conf:

ln -s 'tcache:false' /etc/malloc.conf

pkg would install, but /usr/local/sbin/pkg was mislinked:
http://ix.io/1xlt

So as a workaround to that, I just mv'd /usr/local/sbin/pkg to
/usr/local/sbin/pkg.bak and replaced it with a symlink to
/usr/local/sbin/pkg-static.

I've now successfully compiled and installed a few ports. I've also
updated the wiki to document the two workarounds described above.

https://wiki.freebsd.org/arm64/rpi3

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: RPI3 - clang 3.9.0 issues

2016-10-17 Thread Shawn Webb
On Mon, Oct 17, 2016 at 05:11:43PM -0400, Shawn Webb wrote:
>
> I'm tracking down a potential issue with jemalloc compiled with clang
> 3.9.0, but I need to verify that the issue exists in vanilla FreeBSD in
> addition to HardenedBSD. Most of my testing has been done with
> HardenedBSD to-date.

The jemalloc issue exists with vanilla FreeBSD with clang 3.9.0 + lld:

===>   Registering installation for pkg-1.9.1
: 
/scratch/arm64/fbsd-clang390/lib/libc/../../contrib/jemalloc/include/jemalloc/internal/tcache.h:346:
 Failed assertion: "binind < nhbins"

With pkg failing to install, it seems building ports/packages directly
on the rpi3 won't be viable until this bug is fixed.

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: RPI3 - clang 3.9.0 issues

2016-10-17 Thread Mark Millard
[A quick top post about synchronous aborts for aarch64.]

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/ch10s02s01.html
 says:

> Synchronous exceptions can occur for a number of possible reasons:
> 
>   • Aborts from the MMU. For example, permission failures or memory areas 
> marked as Access flag fault. 
>   • SP and PC alignment checking.
>   • Unallocated instructions. 
>   • Service Calls (SVCs, SMCs and HVCs).
> 
> Such exceptions may be part of the normal operation of the OS. For example, 
> in Linux, when a task wishes to request allocation of a new memory page, this 
> is handled through the MMU abort mechanism.
> 
> In the ARMv7-A architecture, the prefetch abort, Data Abort and undef 
> exceptions are separate items. In AArch64, all of these events generate a 
> Synchronous abort. The exception handler may then read the syndrome and FAR 
> registers to obtain the necessary information to distinguish between them 
> (described in more detail later.)


===
Mark Millard
markmi at dsl-only.net

On 2016-Oct-17, at 2:11 PM, Shawn Webb  wrote:

Hey All,

I'm submitting this report to this list as directed by Ed Maste.

The Raspberry Pi 3 is an ARMv8 SoC dev board. Within the last week,
FreeBSD added basic initial support for it. We don't currently have a
linker in HEAD for the arm64/aarch64 platform. The
projects/clang390-import branch contains lld, though, which supports
arm64/aarch64.

Over the past few days, I've been working on testing clang 3.9.0 and lld
on the RPI3. I've jotted down a few issues in FreeBSD's wiki:

https://wiki.freebsd.org/arm64/rpi3

Mainly:

low-level code like bootloaders (boot1.efi and loader.efi) do NOT work
with projects/clang390-import. When I use boot1.efi and loader.efi
compiled with HEAD (clang 3.8), they work.

When the kernel is compiled with clang 3.9.0, it seems to freeze after
being loaded by the clang 3.8 boot1.efi/loader.efi. I'm unsure if it's
actually frozen or if simply nothing is being outputted to the console.
Either way, I don't see console messages and the RPI3 _appears_ frozen.

I'm tracking down a potential issue with jemalloc compiled with clang
3.9.0, but I need to verify that the issue exists in vanilla FreeBSD in
addition to HardenedBSD. Most of my testing has been done with
HardenedBSD to-date.

If I find more issues or find the causes of the ones I've already
documented, I'll be sure to not only update the wiki, but update this
email thread as well.

If there's anything anyone would like me to try, please let me know.

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE

___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"

Re: RPI3 - clang 3.9.0 issues

2016-10-17 Thread Shawn Webb
On Mon, Oct 17, 2016 at 05:18:42PM -0400, Ed Maste wrote:
> On 17 October 2016 at 17:11, Shawn Webb  wrote:
> >
> > When the kernel is compiled with clang 3.9.0, it seems to freeze after
> > being loaded by the clang 3.8 boot1.efi/loader.efi. I'm unsure if it's
> > actually frozen or if simply nothing is being outputted to the console.
> > Either way, I don't see console messages and the RPI3 _appears_ frozen.
> 
> This will probably be a bit tricky to track down. Have you tried
> booting a Clang 3.8-compiled kernel with a Clang 3.9 boot1.efi and
> loader.efi? Do you get any kernel output, or nothing after the last
> lines of loader output?

I haven't. clang 3.9 boot1.efi won't run in the slightest. It crashes
prior to me being able to even use printf.

I could try a 3.9 loader.efi with some extra printf debugging, though.

A clang 3.8 kernel works perfectly when matched with a clang 3.8
boot1.efi and loader.efi. The clang 3.9 kernel doesn't output a single
thing. I could probably try some printf based debugging early in the
process. But it's clear that loader.efi loads the kernel and tries to
execute it.

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: RPI3 - clang 3.9.0 issues

2016-10-17 Thread Ed Maste
On 17 October 2016 at 17:11, Shawn Webb  wrote:
>
> When the kernel is compiled with clang 3.9.0, it seems to freeze after
> being loaded by the clang 3.8 boot1.efi/loader.efi. I'm unsure if it's
> actually frozen or if simply nothing is being outputted to the console.
> Either way, I don't see console messages and the RPI3 _appears_ frozen.

This will probably be a bit tricky to track down. Have you tried
booting a Clang 3.8-compiled kernel with a Clang 3.9 boot1.efi and
loader.efi? Do you get any kernel output, or nothing after the last
lines of loader output?
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"