arm64: Fix crash due to incorrect page alignment on centos

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

arm64: Fix crash due to incorrect page alignment on centos

Siddhesh Poyarekar
Hi,

I posted a patch to mob for review:

https://repo.or.cz/tinycc.git/commitdiff/7d4a71fc8b9776dc9c156a158546040833090a7a

which increases the page size on arm64 to increase alignment of section
headers in the generated ELF binaries.  This fixes crashes of binaries
built by tinycc on centos.

Thanks,
Siddhesh

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: arm64: Fix crash due to incorrect page alignment on centos

Christian Jullien-3
Hello,

I have to questions with your patch:
- Why then my FC30 aarch64 PRi port does not fail, I'm running tcc for several months on it. Maybe I'm luck?
- pagesize can be configured by sys admin (including huge pages up to 1GB) , so IMHO, the right patch is to use the POSIX portable value of  sysconf(_SC_PAGESIZE) you can compute once and put in a variable when tcc initializes.

C.



-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of Siddhesh Poyarekar
Sent: Tuesday, September 03, 2019 09:59
To: [hidden email]
Subject: [Tinycc-devel] arm64: Fix crash due to incorrect page alignment on centos

Hi,

I posted a patch to mob for review:

https://repo.or.cz/tinycc.git/commitdiff/7d4a71fc8b9776dc9c156a158546040833090a7a

which increases the page size on arm64 to increase alignment of section
headers in the generated ELF binaries.  This fixes crashes of binaries
built by tinycc on centos.

Thanks,
Siddhesh

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: arm64: Fix crash due to incorrect page alignment on centos

Edmund Grimley Evans
Christian Jullien <[hidden email]>:

> I have to questions with your patch:
> - Why then my FC30 aarch64 PRi port does not fail, I'm running tcc for several months on it. Maybe I'm luck?
> - pagesize can be configured by sys admin (including huge pages up to 1GB) , so IMHO, the right patch is to use the POSIX portable value of  sysconf(_SC_PAGESIZE) you can compute once and put in a variable when tcc initializes.

The user-visible page size is 4K, 16K or 64K (according to
https://wiki.debian.org/ArchitectureSpecificsMemo, which has similar
information for a lot of different architectures).

I think we're talking about generating an object file here, which
might be used on a different system, so we have to assume the largest
size.

Edmund

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: arm64: Fix crash due to incorrect page alignment on centos

Christian Jullien-3
Ok but what happens if s.o. configures its system with HUGE PAGE support?
https://wiki.debian.org/Hugepages

See for example https://stackoverflow.com/questions/21159982/how-to-get-the-page-size-of-a-specific-address-programmatically

C.

-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of Edmund Grimley Evans
Sent: Wednesday, September 04, 2019 09:55
To: [hidden email]
Subject: Re: [Tinycc-devel] arm64: Fix crash due to incorrect page alignment on centos

Christian Jullien <[hidden email]>:

> I have to questions with your patch:
> - Why then my FC30 aarch64 PRi port does not fail, I'm running tcc for several months on it. Maybe I'm luck?
> - pagesize can be configured by sys admin (including huge pages up to 1GB) , so IMHO, the right patch is to use the POSIX portable value of  sysconf(_SC_PAGESIZE) you can compute once and put in a variable when tcc initializes.

The user-visible page size is 4K, 16K or 64K (according to
https://wiki.debian.org/ArchitectureSpecificsMemo, which has similar
information for a lot of different architectures).

I think we're talking about generating an object file here, which
might be used on a different system, so we have to assume the largest
size.

Edmund

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: arm64: Fix crash due to incorrect page alignment on centos

Michael Matz-4
Hi,

On Wed, 4 Sep 2019, Christian Jullien wrote:

> Ok but what happens if s.o. configures its system with HUGE PAGE support?

That doesn't affect the user visible page size (i.e. the mmap granularity
will still be 4 or 64 KB), ELF files won't be mapped into huge pages
(except perhaps transparently by the kernel in which case the user won't
notice either).  And yes, Edmund is right, this is about how the ELF files
are generated, that's not configurable at runtime.

Normally, for accessing huge pages you either need a helper library or use
special flags for mmap (in which case it's again at the kernels discretion
to really use huge pages).


Ciao,
Michael.

> https://wiki.debian.org/Hugepages
>
> See for example https://stackoverflow.com/questions/21159982/how-to-get-the-page-size-of-a-specific-address-programmatically
>
> C.
>
> -----Original Message-----
> From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of Edmund Grimley Evans
> Sent: Wednesday, September 04, 2019 09:55
> To: [hidden email]
> Subject: Re: [Tinycc-devel] arm64: Fix crash due to incorrect page alignment on centos
>
> Christian Jullien <[hidden email]>:
>
> > I have to questions with your patch:
> > - Why then my FC30 aarch64 PRi port does not fail, I'm running tcc for several months on it. Maybe I'm luck?
> > - pagesize can be configured by sys admin (including huge pages up to 1GB) , so IMHO, the right patch is to use the POSIX portable value of  sysconf(_SC_PAGESIZE) you can compute once and put in a variable when tcc initializes.
>
> The user-visible page size is 4K, 16K or 64K (according to
> https://wiki.debian.org/ArchitectureSpecificsMemo, which has similar
> information for a lot of different architectures).
>
> I think we're talking about generating an object file here, which
> might be used on a different system, so we have to assume the largest
> size.
>
> Edmund
>
> _______________________________________________
> Tinycc-devel mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>
> _______________________________________________
> Tinycc-devel mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: arm64: Fix crash due to incorrect page alignment on centos

Christian Jullien-3
Thanks for clarification.

C.

-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of Michael Matz
Sent: Wednesday, September 04, 2019 16:49
To: [hidden email]; [hidden email]
Subject: Re: [Tinycc-devel] arm64: Fix crash due to incorrect page alignment on centos

Hi,

On Wed, 4 Sep 2019, Christian Jullien wrote:

> Ok but what happens if s.o. configures its system with HUGE PAGE support?

That doesn't affect the user visible page size (i.e. the mmap granularity
will still be 4 or 64 KB), ELF files won't be mapped into huge pages
(except perhaps transparently by the kernel in which case the user won't
notice either).  And yes, Edmund is right, this is about how the ELF files
are generated, that's not configurable at runtime.

Normally, for accessing huge pages you either need a helper library or use
special flags for mmap (in which case it's again at the kernels discretion
to really use huge pages).


Ciao,
Michael.

> https://wiki.debian.org/Hugepages
>
> See for example https://stackoverflow.com/questions/21159982/how-to-get-the-page-size-of-a-specific-address-programmatically
>
> C.
>
> -----Original Message-----
> From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of Edmund Grimley Evans
> Sent: Wednesday, September 04, 2019 09:55
> To: [hidden email]
> Subject: Re: [Tinycc-devel] arm64: Fix crash due to incorrect page alignment on centos
>
> Christian Jullien <[hidden email]>:
>
> > I have to questions with your patch:
> > - Why then my FC30 aarch64 PRi port does not fail, I'm running tcc for several months on it. Maybe I'm luck?
> > - pagesize can be configured by sys admin (including huge pages up to 1GB) , so IMHO, the right patch is to use the POSIX portable value of  sysconf(_SC_PAGESIZE) you can compute once and put in a variable when tcc initializes.
>
> The user-visible page size is 4K, 16K or 64K (according to
> https://wiki.debian.org/ArchitectureSpecificsMemo, which has similar
> information for a lot of different architectures).
>
> I think we're talking about generating an object file here, which
> might be used on a different system, so we have to assume the largest
> size.
>
> Edmund
>
> _______________________________________________
> Tinycc-devel mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>
> _______________________________________________
> Tinycc-devel mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel