Skip to content

Add option SECCOMP_PROFILE for qlever start - #338

Open
hannahbast wants to merge 2 commits into
mainfrom
seccomp-profile
Open

Add option SECCOMP_PROFILE for qlever start#338
hannahbast wants to merge 2 commits into
mainfrom
seccomp-profile

Conversation

@hannahbast

@hannahbast hannahbast commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

So far, qlever start ran the server container with the default seccomp profile of the container engine. The default profile of Docker blocks the io_uring syscalls, so a server started this way logs io_uring is compiled in but unavailable at runtime and falls back to synchronous pread for vocabulary lookups.

This change adds the option SECCOMP_PROFILE in the [runtime] section of the Qleverfile (also qlever start --seccomp-profile), which is passed to the container engine as --security-opt seccomp=<path>. With a profile that additionally allows io_uring_setup, io_uring_enter, and io_uring_register, the server uses the io_uring path. Without the option, nothing changes. Only qlever start gets the option, because the io_uring rings are created when a vocabulary is opened for reading, which the index builder never does.

New `[runtime]` option `SECCOMP_PROFILE` (also `qlever start --seccomp-profile`)
that passes `--security-opt seccomp=<path>` to the container engine when
starting the server. Default is none, so the engine's default profile applies
as before. The path is made absolute (and `~` expanded).

Motivation: the default Docker seccomp profile blocks the io_uring syscalls,
so QLever falls back to synchronous vocabulary lookups with a startup warning.
A profile that allows them lets the server use the io_uring path. Only the
server needs this: the io_uring rings are created when a vocabulary is opened
for reading, which the index builder never does.
Copilot AI lite review requested due to automatic review settings September 5, 2026 13:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are a couple of concrete correctness/robustness issues (type annotation consistency and a brittle test assertion around shell-quoting) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds support for specifying a custom seccomp profile when starting the QLever server container, enabling io_uring syscalls when desired while keeping the default behavior unchanged when no profile is configured.

Changes:

  • Introduces a new [runtime]/CLI option seccomp_profile (--seccomp-profile) for qlever start.
  • Extends container command generation to optionally add --security-opt seccomp=<absolute-path>.
  • Adds/updates tests to cover the new argument plumbing and command rendering.
File summaries
File Description
test/qlever/test_containerize.py Adds unit tests for Containerize.containerize_command seccomp option handling and ordering.
test/qlever/commands/test_start_other_methods.py Updates expected relevant Qleverfile arguments to include seccomp_profile.
test/qlever/commands/test_start_execute.py Ensures seccomp_profile is passed through to containerization in start execution tests.
src/qlever/qleverfile.py Adds --seccomp-profile runtime argument definition and help text.
src/qlever/containerize.py Adds optional seccomp profile support to generated container engine command.
src/qlever/commands/start.py Wires args.seccomp_profile into container start command and includes it in relevant Qleverfile args.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 40 to 45
volumes: list[tuple[str, str]] = [],
ports: list[tuple[int, int]] = [],
working_directory: str | None = None,
use_bash: bool = True,
seccomp_profile: Optional[str] = None,
) -> str:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b17e994, now str | None like the other parameters in this module.

Comment on lines +35 to +37
cmd = _cmd(seccomp_profile="seccomp.json")
expected = os.path.join(os.getcwd(), "seccomp.json")
assert f" --security-opt seccomp={expected}" in cmd

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b17e994, the test now compares against the shlex-quoted path.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The undefined Optional annotation causes the Ruff lint check to fail.

Review details

Suppressed comments (1)

src/qlever/containerize.py:44

  • Optional is not imported anywhere in this module. Although postponed annotations hide this during normal calls, Ruff's enabled F821 check will reject the undefined name (and runtime annotation introspection would also fail). Please use the union syntax already used for working_directory above.
        seccomp_profile: Optional[str] = None,
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@hannahbast hannahbast changed the title Add SECCOMP_PROFILE option for the server container Add option SECCOMP_PROFILE for qlever start Sep 5, 2026
The `Optional` annotation was an undefined name (the module has no
`typing` import and uses the union syntax elsewhere), which made the
ruff check fail. The test now compares against the `shlex`-quoted path,
so it also passes when the working directory contains a space.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants