Re: [PATCH v2] arm64: compat: Implement misalignment fixups for multiword loads

2022-09-05 Thread Catalin Marinas
On Mon, Sep 05, 2022 at 12:04:47PM +0200, Ard Biesheuvel wrote:
> On Wed, 31 Aug 2022 at 19:07, Catalin Marinas  wrote:
> > On Fri, Jul 01, 2022 at 03:53:22PM +0200, Ard Biesheuvel wrote:
> > > +config COMPAT_ALIGNMENT_FIXUPS
> > > + bool "Fix up misaligned multi-word loads and stores in user space"
> > > + default y
> >
> > For consistency with ARMV8_DEPRECATED, I think we should keep this as
> > default n.
> 
> Fair enough. I take it you can fix this up while applying?

Yes.

-- 
Catalin



Re: [PATCH v2] arm64: compat: Implement misalignment fixups for multiword loads

2022-09-05 Thread Ard Biesheuvel
On Wed, 31 Aug 2022 at 19:07, Catalin Marinas  wrote:
>
> On Fri, Jul 01, 2022 at 03:53:22PM +0200, Ard Biesheuvel wrote:
> > The 32-bit ARM kernel implements fixups on behalf of user space when
> > using LDM/STM or LDRD/STRD instructions on addresses that are not 32-bit
> > aligned. This is not something that is supported by the architecture,
> > but was done anyway to increase compatibility with user space software,
> > which mostly targeted x86 at the time and did not care about aligned
> > accesses.
> >
> > This feature is one of the remaining impediments to being able to switch
> > to 64-bit kernels on 64-bit capable hardware running 32-bit user space,
> > soDocumentation/x86/boot.rst let's implement it for the arm64 compat layer 
> > as well.
> >
> > Note that the intent is to implement the exact same handling of
> > misaligned multi-word loads and stores as the 32-bit kernel does,
> > including what appears to be missing support for user space programs
> > that rely on SETEND to switch to a different byte order and back. Also,
> > like the 32-bit ARM version, we rely on the faulting address reported by
> > the CPU to infer the memory address, instead of decoding the instruction
> > fully to obtain this information.
> >
> > This implementation is taken from the 32-bit ARM tree, with all pieces
> > removed that deal with instructions other than LDRD/STRD and LDM/STM, or
> > that deal with alignment exceptions taken in kernel mode.
> >
> > Cc: debian-arm@lists.debian.org
> > Cc: Vagrant Cascadian 
> > Cc: Riku Voipio 
> > Cc: Steve McIntyre 
> > Signed-off-by: Ard Biesheuvel 
> > ---
> > Note to cc'ees: if this is something you would like to see merged,
> > please indicate so. This stuff is unlikely to get in if there are no
> > users.
> >
> > v2: - drop some obsolete comments
> > - emit a perf alignment-fault event for every handled instruction
> > - use arm64_skip_faulting_instruction() to get the correct behavior
> >   wrt IT state and single step
> > - use types with correct endianness annotation (instructions are
> >   always little endian on v7/v8+)
>
> It looks like that's a fairly popular request from people running 32-bit
> user on AArch64 kernels, so happy to queue it for 6.1 (if it still
> applies cleanly). I'm not too keen on code duplication but it's a lot
> more hassle to create a common decoding/emulation library to share with
> arch/arm, especially as such code is not going to change in the future.
>
> > +config COMPAT_ALIGNMENT_FIXUPS
> > + bool "Fix up misaligned multi-word loads and stores in user space"
> > + default y
>
> For consistency with ARMV8_DEPRECATED, I think we should keep this as
> default n.
>

Fair enough. I take it you can fix this up while applying?



Re: abel.d.o + gcc-12.x

2022-09-05 Thread Wookey
On 2022-09-05 08:53 +0200, Mathieu Malaterre wrote:
> Dear Debian arm porters,
> 
> I have two requests:
> 
> - Could someone please check the status of abel.d.o ? (*)

It does not not boot any more after a kernel upgrade. This happened whilst I was
on holiday so it's taken a while to get to it. It is now on my desk being
looked at. 

> - One of gcc dev asked me to verify the status of a bug in gcc-12.x
> branch. Are there any pre-build version of GCC 12.x package for
> Debian/arm ? (**)

Yes:
12.2.0 is in the archive:
https://tracker.debian.org/pkg/gcc-12
https://buildd.debian.org/status/package.php?p=gcc-12
https://deb.debian.org/debian/pool/main/g/gcc-12/

Wookey
-- 
Principal hats:  Debian, Wookware, ARM
http://wookware.org/


signature.asc
Description: PGP signature


Re: abel.d.o + gcc-12.x

2022-09-05 Thread Jeffrey Walton
On Mon, Sep 5, 2022 at 2:54 AM Mathieu Malaterre  wrote:
>
> Dear Debian arm porters,
>
> I have two requests:
>
> - Could someone please check the status of abel.d.o ? (*)
> - One of gcc dev asked me to verify the status of a bug in gcc-12.x
> branch. Are there any pre-build version of GCC 12.x package for
> Debian/arm ? (**)
>
> Thanks much,
>
> (*) I cannot post to 'ad...@db.debian.org', I get a '550 host
> 209.85.221.48 is listed in safe.dnsbl.sorbs.net (127.0.0.6);'
> (**) https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1018953

>From the GCC bug report:

> I can trigger an assertion in highway unit test suite
> on armhf when using -O2 (does not happen at -O0).
>
> Symptoms:
>
> % tests/mul_test 
> "--gtest_filter=HwyMulTestGroup/HwyMulTest.TestAllMulAdd/Emu128" 
> "--gtest_also_run_disabled_tests"
> Running main() from ./googletest/src/gtest_main.cc

We encountered a similar bug under GCC 12. We are also a C++ project.
Things were Ok at -O1, but segfaulted at -O2 or higher. We found GCC
was removing live code. -fsanitize=unreachable helped uncover the
problem. [1]

We needed to add -fno-devirtualize to our CXXFLAGS. It is just a
workaround at the moment. We hope the GCC flks will get it sorted out
soon.

Jeff

[1] https://github.com/weidai11/cryptopp/issues/1141



Re: abel.d.o + gcc-12.x

2022-09-05 Thread Mathieu Malaterre
Hi Adrian,

On Mon, Sep 5, 2022 at 9:11 AM John Paul Adrian Glaubitz
 wrote:
>
>
>
> > On Sep 5, 2022, at 8:54 AM, Mathieu Malaterre  wrote:
> >
> > I have two requests:
> >
> > - Could someone please check the status of abel.d.o ? (*)
> > - One of gcc dev asked me to verify the status of a bug in gcc-12.x
> > branch. Are there any pre-build version of GCC 12.x package for
> > Debian/arm ? (**)
>
> If you have a Debian DSA account, you can just create a armel schroot session 
> for sid.
>
> In sid, gcc-12 is now the default compiler.

I should have said: "I need a GCC 12.3" compiler (on amdahl.d.o).



Re: abel.d.o + gcc-12.x

2022-09-05 Thread John Paul Adrian Glaubitz



> On Sep 5, 2022, at 8:54 AM, Mathieu Malaterre  wrote:
> 
> I have two requests:
> 
> - Could someone please check the status of abel.d.o ? (*)
> - One of gcc dev asked me to verify the status of a bug in gcc-12.x
> branch. Are there any pre-build version of GCC 12.x package for
> Debian/arm ? (**)

If you have a Debian DSA account, you can just create a armel schroot session 
for sid.

In sid, gcc-12 is now the default compiler.

Adrian