Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdenv/linux/bootstrap-files: add mipsel-linux (mips32) #183487

Merged
merged 1 commit into from Aug 17, 2022
Merged

stdenv/linux/bootstrap-files: add mipsel-linux (mips32) #183487

merged 1 commit into from Aug 17, 2022

Conversation

ghost
Copy link

@ghost ghost commented Jul 28, 2022

Description of changes

This PR adds Hydra-generated bootstrap tarballs for mipsel-linux. I'll be following the script established in #151399, which I previously used in #168199 and #180223.

Files came from this Hydra build, which used nixpkgs revision 5bd14b3 to instantiate:

/nix/store/184fa520zv8ls9fzcqyfa5dmkp8kf6xr-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu.drv

and then built:

/nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu

I downloaded these files from Hydra with the following commands:

STOREPATH=i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu
OPTIONS="--option binary-caches https://cache.nixos.org --option trusted-public-keys cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
nix store add-file \
  --name bootstrap-tools.tar.xz  \
  $(nix-store ${OPTIONS} -r /nix/store/${STOREPATH})/on-server/bootstrap-tools.tar.xz
nix store add-path \
  --name busybox \
  $(nix-store ${OPTIONS} -r /nix/store/${STOREPATH})/on-server/busybox

I then prefetched them into /nix/store with:

$ nix store prefetch-file --executable file:///nix/store/a976a16k2n9bir7yjmdm6n98765spn4m-busybox
Downloaded 'file:///nix/store/a976a16k2n9bir7yjmdm6n98765spn4m-busybox' to '/nix/store/gcvkvka0zjcn50n6pnbjgmar8swpw7bi-a976a16k2n9bir7yjmdm6n98765spn4m-busybox' (hash 'sha256-EhuzjL52VEIOfEcFdVGZaDMClQbMc9V9ISrTUNaA7HQ=').

$ nix store prefetch-file  file:///nix/store/8q53wpn7lk7j45bwqwyn75p39qa8ajam-bootstrap-tools.tar.xz
Downloaded 'file:///nix/store/8q53wpn7lk7j45bwqwyn75p39qa8ajam-bootstrap-tools.tar.xz' to '/nix/store/0shmi3qk2my2x7c1c5dhv04l673mal36-8q53wpn7lk7j45bwqwyn75p39qa8ajam-bootstrap-tools.tar.xz' (hash 'sha256-OEGgLJOLnV+aobsb+P8mY3Dp8qbeVODBH6x3aUE/MGM=').

And started the bootstrap with the following command on a mips64el machine (the --arg localsystem forces nixpkgs to build for mips32 and the --option extra-platforms convinces nix that mips64el machines can run mips32el code):

nix build -f . -L hello \
  --arg localSystem '(import ./lib).systems.examples.mipsel-linux-gnu' \
  --option extra-platforms 'mipsel-linux'

I also edited pkgs/stdenv/linux/default.nix to change longsoon2f.nix to mipsel.nix. That change is not part of this PR; I will submit it separately since it may require more discussion than a simple bootstrap-files upload does.

As @lovesegfault requested in #151399, here are the the sha256sums of all the on-server components for extra verification:

$ sha256sum /nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu/on-server/*
3841a02c938b9d5f9aa1bb1bf8ff266370e9f2a6de54e0c11fac7769413f3063  /nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu/on-server/bootstrap-tools.tar.xz
ba0645bb4a626f0a3fe4f30f0b92211c41482f0604825f1d1cab99e1e42d1bd9  /nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu/on-server/busybox
Things done

@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Jul 28, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 0 This PR does not cause any packages to rebuild labels Jul 28, 2022
@ghost ghost marked this pull request as ready for review August 5, 2022 06:05
@ghost
Copy link
Author

ghost commented Aug 8, 2022

Ping @lovesegfault

1 similar comment
@ghost
Copy link
Author

ghost commented Aug 11, 2022

Ping @lovesegfault

@ghost
Copy link
Author

ghost commented Aug 15, 2022

@lovesegfault, could you please upload these files to tarballs.nixos.org?

@ghost ghost mentioned this pull request Aug 16, 2022
13 tasks
@lovesegfault
Copy link
Member

Done:

$ aws s3 cp --recursive --acl public-read /nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu/on-server/ s3://nixpkgs-tarballs/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c
69563e4bc/
upload: ../../../../nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu/on-server/busybox to s3://nixpkgs-tarballs/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/busybox
upload: ../../../../nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu/on-server/bootstrap-tools.tar.xz to s3://nixpkgs-tarballs/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/bootstrap-tools.tar.xz
$ aws s3 cp --recursive s3://nixpkgs-tarballs/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc ./
download: s3://nixpkgs-tarballs/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/busybox to ./busybox
download: s3://nixpkgs-tarballs/stdenv-linux/mipsel/5bd14b3cfe2f87a2e2b074645aba39c69563e4bc/bootstrap-tools.tar.xz to ./bootstrap-tools.tar.xz
$ sha256sum /nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu/on-server/*
3841a02c938b9d5f9aa1bb1bf8ff266370e9f2a6de54e0c11fac7769413f3063  /nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu/on-server/bootstrap-tools.tar.xz
ba0645bb4a626f0a3fe4f30f0b92211c41482f0604825f1d1cab99e1e42d1bd9  /nix/store/i46mrzinxi9a5incliwhksmk947ff4wn-stdenv-bootstrap-tools-mipsel-unknown-linux-gnu/on-server/busybox
$ sha256sum ./bootstrap-tools.tar.xz ./busybox
3841a02c938b9d5f9aa1bb1bf8ff266370e9f2a6de54e0c11fac7769413f3063  ./bootstrap-tools.tar.xz
ba0645bb4a626f0a3fe4f30f0b92211c41482f0604825f1d1cab99e1e42d1bd9  ./busybox

As always, very sorry for the delay in getting to these!

Let me know if this can be merged :)

@ghost
Copy link
Author

ghost commented Aug 17, 2022

Thank you so much! If you have time to do the same for #185182 I would appreciate it.

Let me know if this can be merged :)

Yes, it is ready to merge.

From an empty /nix/store, the following command got past the unpacking-the-bootstrap-files step:

nix build \
  -f . \
  -L hello \
  --arg localSystem '(import ./lib).systems.examples.mipsel-linux-gnu' \
  --system mipsel-linux \
  --option filter-syscalls false

@lovesegfault lovesegfault merged commit d00f5c5 into NixOS:master Aug 17, 2022
fgaz added a commit to fgaz/nixpkgs that referenced this pull request Jan 21, 2024
This PR updates the bootstrap tarballs for riscv64-linux with new Hydra-generated ones.

Fixes NixOS#275848 (bootstrap assembler too old to build gcc 13).

I'll be following the script used in NixOS#151399, NixOS#168199, NixOS#183487, and NixOS#188334.

Files came from [this](https://hydra.nixos.org/build/246376732#tabs-summary) Hydra build, which used nixpkgs revision 160cedc to instantiate:

```
/nix/store/cpiajh4l83b08pynwiwkpxj53d78pcxr-stdenv-bootstrap-tools-riscv64-unknown-linux-gnu.drv
```

and then built:

```
/nix/store/8a92pj40awdw585mcb9dvm4nyb03k3q3-stdenv-bootstrap-tools-riscv64-unknown-linux-gnu
```

I downloaded these files from Hydra and prefetched them into the nix store with the following commands:

```
STOREPATH=8a92pj40awdw585mcb9dvm4nyb03k3q3-stdenv-bootstrap-tools-riscv64-unknown-linux-gnu
OPTIONS="--option binary-caches https://cache.nixos.org --option trusted-public-keys cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
nix store prefetch-file \
  file://$(nix store add-file --name bootstrap-tools.tar.xz  $(nix-store ${OPTIONS} -r /nix/store/${STOREPATH})/on-server/bootstrap-tools.tar.xz)
nix store prefetch-file --executable \
  file://$(nix store add-path --name busybox $(nix-store ${OPTIONS} -r /nix/store/${STOREPATH})/on-server/busybox)
```

These commands produced the following output:

```
Downloaded 'file:///nix/store/xs74wcxq3qc12plfc70fds8inbndhcfm-bootstrap-tools.tar.xz' to '/nix/store/3fal4gikp92013kac6rdmfbrch2s859b-xs74wcxq3qc12plfc70fds8inbndhcfm-bootstrap-tools.tar.xz' (hash 'sha256-0LxRd7fdafQezNJ+N2tuOfm0KEwgfRSts5fhP0e0r0s=').
Downloaded 'file:///nix/store/9ndpna6jrlac4y9fappdjm0sxx0g2bja-busybox' to '/nix/store/kb7wyy30y1gxcmdajljr26kxxac606qa-9ndpna6jrlac4y9fappdjm0sxx0g2bja-busybox' (hash 'sha256-OGO96QUzs2n5pGipn/V87AxzUY9OWKZl417nE8HdZIE=').
```

I used the hashes from the output above to create the `fetchurl` invocation which is part of this commit.

I then started the bootstrap with the following command:

```
nix build -L -f . --arg localSystem '(import ./lib).systems.examples.riscv64' hello
```

As @lovesegfault requested, here are the the `sha256sum`s of all the `on-server` components for extra verification:

```
sha256sum /nix/store/${STOREPATH}/on-server/*
```

which produced the following output:

```
d0bc5177b7dd69f41eccd27e376b6e39f9b4284c207d14adb397e13f47b4af4b  /nix/store/8a92pj40awdw585mcb9dvm4nyb03k3q3-stdenv-bootstrap-tools-riscv64-unknown-linux-gnu/on-server/bootstrap-tools.tar.xz
65f9433abb598f63c932d33351b14f686551512b1cece1e64c2d0e76aa0ec52e  /nix/store/8a92pj40awdw585mcb9dvm4nyb03k3q3-stdenv-bootstrap-tools-riscv64-unknown-linux-gnu/on-server/busybox
```
@ghost ghost deleted the pr/mipsel/bootstrap-files branch January 23, 2024 06:49
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/bootstrap-files-updates-amplifiy-exploit-of-any-package-into-exploit-of-every-package/50534/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: stdenv Standard environment 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 0 This PR does not cause any packages to rebuild
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants