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

nixos/postgresql/citus: fix syscall filter and add test #379769

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

jflanglois
Copy link
Contributor

This fixes the citus extension for postgresql. Without this, the database will crash on start because the extension uses getpriority and setpriority syscalls. The ~@privileged @resources filter breaks those calls. This also adds automated tests for citus.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Feb 6, 2025
@jflanglois jflanglois changed the title nixos/postgresql: fix syscall filter and add test nixos/postgresql/citus: fix syscall filter and add test Feb 6, 2025
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Feb 6, 2025
@github-actions github-actions bot added 6.topic: python 6.topic: emacs Text editor 6.topic: rust 6.topic: golang 6.topic: lua 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 8.has: documentation This PR adds or changes documentation labels Feb 6, 2025
@jflanglois jflanglois changed the base branch from master to staging February 6, 2025 23:12
@github-actions github-actions bot removed 6.topic: python 6.topic: emacs Text editor 6.topic: rust 6.topic: golang 6.topic: lua 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related labels Feb 6, 2025
@jflanglois
Copy link
Contributor Author

Build failure looks related to rustc, so I assume this is due to the state of staging.

Copy link
Contributor

Choose a reason for hiding this comment

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

So, in #355010 we didn't add a whole new test on purpose - because this won't scale for many extensions. We can't add a new VM test for each of them. But I think we also can't test them together, otherwise the granted exceptions here might overlay each other.

At the same time - we should really test this. So we need a VM test.

I don't really have a solution, but I do think that a VM test for citus is generally a good idea, especially if we consider that this test could be extended to test multiple machines setting up a citus cluster in the future.

TLDR: I'm OK with adding another test here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right I agree with a multi-node test, but would rather do that on top of master when staging is merged

Copy link
Contributor Author

@jflanglois jflanglois Feb 9, 2025

Choose a reason for hiding this comment

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

This also makes me think: I wonder if the hardening should be made more configurable in the module? It seems like extensions could easily hit a blocked syscall after an update and this was difficult to debug for me because there were no logs—I only looked at hardening options because postgresql started fine when run manually.

Copy link
Member

Choose a reason for hiding this comment

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

It seems like extensions could easily hit a blocked syscall after an update and this was difficult to debug for me because there were no logs

Aren't these logged to the kernel log?
I don't recall where exactly, but I'm pretty sure it's written somewhere - for syscalls at least.

I wonder if the hardening should be made more configurable in the module

See #344925 (comment) for my rationale on why it's implemented the way it currently is.

So, in #355010 we didn't add a whole new test on purpose - because this won't scale for many extensions. We can't add a new VM test for each of them. But I think we also can't test them together, otherwise the granted exceptions here might overlay each other.

Agreed. For the time being, my suggestion would be to add VM tests when the need arises (i.e. when we have to adjust the hardening for instance).

@wolfgangwalther
Copy link
Contributor

Build failure looks related to rustc, so I assume this is due to the state of staging.

I am building on staging with very low resources allocated - so this might take a while. Will still look at this.

Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

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

Successfully built the test. LGTM from my side.

@wolfgangwalther wolfgangwalther merged commit 3ec550c into NixOS:staging Feb 11, 2025
27 checks passed
@jflanglois jflanglois deleted the fix-citus branch February 11, 2025 20:26
@jflanglois
Copy link
Contributor Author

Thanks y'all

@Ma27
Copy link
Member

Ma27 commented Feb 21, 2025

I figured that it's probably reasonable to backport this to 24.11 as well: #383933

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants