Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • FPC Source FPC Source
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1,276
    • Issues 1,276
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 57
    • Merge requests 57
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FPC
  • FPC
  • FPC SourceFPC Source
  • Issues
  • #39451
Closed
Open
Created Nov 24, 2021 by dbannon@dbannon

Hardening on x86-64, arm, ppc64le makes a broken executable

Summary

EDIT : Initially reported as affecting PPC64, I now realise its Intel/AMD and ARM as well. Post further down has details.

EDIT : As noted below, this is a two part thing, firstly, on PPC64le, its a definite confirmed bug. But that also exposed a lesser problem on other platforms, hardening does not work with a static binary, maybe its a documentation issue, maybe a new switch is needed that ensures a request for hardening also ensures dynamic linking.

Debian powerpc64el compiling with " -Cg -k-pie -k-znow " makes a non viable binary.

System Information

Debian Bookworm running in a qemu emulator of powerpc64le (note debian says 'el' instead of 'le'). Underlying system x86-64 Linux.

FPC 3.2.2 form a tarball.

Steps to reproduce

Build a powerpc64el vm, install a netinstall of Debian Bookworm -

$> wget http://d-i.debian.org/daily-images/ppc64el/daily/netboot/mini.iso
$> qemu-img create -f qcow ppc64el-base.qcow 15G
$> qemu-system-ppc64le  -machine pseries-2.12  -m 4096 -boot d  -net nic -net user -hda ppc64el-base.qcow -cdrom mini.iso

Last step is seriously slow !

Then install the appropriate FPC tarball and make a minimal helloworld with and without the " -Cg -k-pie -k-znow " options.

Example Project

not needed.

What is the current bug behavior?

When fpc is given the hardening switches, it compiles fine, the resulting binary is shown by the 'file' command as being "pie" but bash cannot even find the executable (??). It does not complain about the executable being wrong, it says its not there !

My application, a medium Lazarus one, the OS tries to run the binary but it segfaults.

What is the expected (correct) behavior?

The same hello world app (and my app) without the hardening commands runs as expected.

Relevant logs and/or screenshots

Possible fixes

Its unclear to me whether the Intel/Arm hardening is even supposed to work with Power but the compiler accepts the switches.

Edited Jan 04, 2022 by dbannon
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking