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

spectre-meltdown-checker: init at 0.29 #33858

Merged
merged 1 commit into from Jan 14, 2018

Conversation

dotlambda
Copy link
Member

@dotlambda dotlambda commented Jan 14, 2018

Motivation for this change

Can someone please help me adding readelf to the path?
I didn't have any success using

makeWrapper $out/lib/spectre-meltdown-checker.sh $out/bin/spectre-meltdown-checker \
  --prefix PATH : ${makeBinPath [ binutils ]}
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@dotlambda dotlambda changed the title spectre-meltdown-checker: init at 0.29 [WIP] spectre-meltdown-checker: init at 0.29 Jan 14, 2018
@grahamc
Copy link
Member

grahamc commented Jan 14, 2018

@GrahamcOfBorg build spectre-meltdown-checker

installPhase = with stdenv.lib; ''
install -Dt $out/lib spectre-meltdown-checker.sh
makeWrapper $out/lib/spectre-meltdown-checker.sh $out/bin/spectre-meltdown-checker \
--prefix PATH : ${makeBinPath [ binutils ]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readelf is in binutils-uwrapped


nativeBuildInputs = [ makeWrapper ];

buildInputs = [ binutils ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required to put binutils in buildInputs

@@ -0,0 +1,36 @@
{ stdenv, fetchFromGitHub, makeWrapper, binutils }:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readelf is in binutils-unwrapped

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!


prePatch = ''
substituteInPlace spectre-meltdown-checker.sh \
--replace /bin/echo echo \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a trailing \ here. Probably leftover from the previous version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@dotlambda dotlambda changed the title [WIP] spectre-meltdown-checker: init at 0.29 spectre-meltdown-checker: init at 0.29 Jan 14, 2018
@andir
Copy link
Member

andir commented Jan 14, 2018

I usually apply the following patch to the script. That removes the need to specify the kernel manually on Nix. I will open a PR (speed47/spectre-meltdown-checker#79) with the upstream repo for that.. finally....

diff --git a/spectre-meltdown-checker.sh b/spectre-meltdown-checker.sh
index 75f186c..9d6eb5f 100755
--- a/spectre-meltdown-checker.sh
+++ b/spectre-meltdown-checker.sh
@@ -487,6 +487,7 @@ if [ "$opt_live" = 1 ]; then
                [ -e /boot/kernel-$( uname -r) ] && opt_kernel=/boot/kernel-$( uname -r)
                [ -e /boot/bzImage-$(uname -r) ] && opt_kernel=/boot/bzImage-$(uname -r)
                [ -e /boot/kernel-genkernel-$(uname -m)-$(uname -r) ] && opt_kernel=/boot/kernel-genkernel-$(uname -m)-$(uname -r)
+               [ -e /run/booted-system/kernel ] && opt_kernel=/run/booted-system/kernel
        fi

        # system.map

@dotlambda
Copy link
Member Author

I added the patch using fetchpatch.

@andir
Copy link
Member

andir commented Jan 14, 2018

@GrahamcOfBorg build spectre-meltdown-checker

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failure for system: x86_64-darwin

Package ‘spectre-meltdown-checker-0.29’ in /Users/graham/nix-borg/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-zoidberg/pkgs/tools/security/spectre-meltdown-checker/default.nix:33 is not supported on ‘x86_64-darwin’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: aarch64-linux

no Makefile, doing nothing
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/y8w212cscygrlcsjc996fa0nyms69hxx-spectre-meltdown-checker-0.29
strip is /nix/store/c6qj0j45xizkrx58i65j75a5ysmqhgrs-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/y8w212cscygrlcsjc996fa0nyms69hxx-spectre-meltdown-checker-0.29/lib  /nix/store/y8w212cscygrlcsjc996fa0nyms69hxx-spectre-meltdown-checker-0.29/bin
patching script interpreter paths in /nix/store/y8w212cscygrlcsjc996fa0nyms69hxx-spectre-meltdown-checker-0.29
/nix/store/y8w212cscygrlcsjc996fa0nyms69hxx-spectre-meltdown-checker-0.29/lib/spectre-meltdown-checker.sh: interpreter directive changed from " /bin/sh" to "/nix/store/b2rfm1s05ria7d00r4p9r7f5lg7llazi-bash-4.4-p12/bin/sh"
checking for references to /build in /nix/store/y8w212cscygrlcsjc996fa0nyms69hxx-spectre-meltdown-checker-0.29...
/nix/store/y8w212cscygrlcsjc996fa0nyms69hxx-spectre-meltdown-checker-0.29

@adisbladis adisbladis merged commit 940d1a9 into NixOS:master Jan 14, 2018
Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-linux

no Makefile, doing nothing
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/3fqzz55dxhnyfph42hlpk5vsf5rywlc1-spectre-meltdown-checker-0.29
strip is /nix/store/wxn5gn8amxm1w0ikcx4gbs8a17wvss4j-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/3fqzz55dxhnyfph42hlpk5vsf5rywlc1-spectre-meltdown-checker-0.29/lib  /nix/store/3fqzz55dxhnyfph42hlpk5vsf5rywlc1-spectre-meltdown-checker-0.29/bin 
patching script interpreter paths in /nix/store/3fqzz55dxhnyfph42hlpk5vsf5rywlc1-spectre-meltdown-checker-0.29
/nix/store/3fqzz55dxhnyfph42hlpk5vsf5rywlc1-spectre-meltdown-checker-0.29/lib/spectre-meltdown-checker.sh: interpreter directive changed from " /bin/sh" to "/nix/store/nkq0n2m4shlbdvdq0qijib5zyzgmn0vq-bash-4.4-p12/bin/sh"
checking for references to /tmp/nix-build-spectre-meltdown-checker-0.29.drv-0 in /nix/store/3fqzz55dxhnyfph42hlpk5vsf5rywlc1-spectre-meltdown-checker-0.29...
/nix/store/3fqzz55dxhnyfph42hlpk5vsf5rywlc1-spectre-meltdown-checker-0.29

@dotlambda dotlambda deleted the spectre-meltdown-checker branch January 14, 2018 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants