Commit Graph

603 Commits

Author SHA1 Message Date
Giacomo Vercesi 4f9e811110 pypeline: implement Pypeline Data Viewer
Implement the Pypeline Data Viewer, an HTTP server that allows browsing
the data stored by PRSS.
2026-06-17 17:48:13 +02:00
Giacomo Vercesi dfb9a36bb2 pypeline: implement compression
Implement compression of objects before they are saved into the storage
provider. Each container type can specify which algorithm to use
(currently `none` or `zstd`) and the compression level.
2026-06-17 10:06:35 +02:00
Giacomo Vercesi f0144ac0c9 pypeline: make artifact_categories kebab-case 2026-06-17 09:43:07 +02:00
Giacomo Vercesi d3d73a48c9 PRSS: add envvars for secret parameters
Allow passing command-line options which might contain secrets via an
environment variable instead of directly on the CLI.
2026-06-17 09:43:07 +02:00
Giacomo Vercesi d6e02c1f95 get_middlewares: allow x-project-id
When authentication is enabled the `x-project-id` header needs to be
provided. Add it to the list of allowed CORS headers.
2026-06-17 09:43:07 +02:00
Giacomo Vercesi 882afa192d revng.project: fix compatibility
The use of `"` inside a `f"..."` f-string is not supported in older
python versions.
2026-06-17 09:43:07 +02:00
Pietro Fezzardi 6a3ab92a9d Mark to-be-dropped pipeline names as legacy
Several components in both pipeline YAMLs are slated for removal.
Prepend a legacy prefix to their names, and to the matching c++ code, so
they are clearly distinguished from the new Clift-based pipeline until
they are dropped.
2026-06-15 17:28:22 +02:00
Ivan Krysak 17945bbe95 local_provider: improve an error message 2026-06-15 17:28:22 +02:00
Ivan Krysak 6a4c12c68a New pipeline: add more debugging artifacts 2026-06-15 17:28:22 +02:00
Ivan Krysak c1ed293c7a New pipeline: adopt new backend 2026-06-15 17:28:22 +02:00
Ivan Krysak 190405a77b Rename decompile-to-X pipes to emit-c-as-X
Note that the artifact names were intentionally left untouched.
2026-06-15 17:28:22 +02:00
Ivan Krysak a12880aa27 Append legacy- to the old pipes 2026-06-15 17:28:22 +02:00
Ivan Krysak ea785998ec Minor improvements 2026-06-15 11:47:41 +02:00
Alessandro Di Federico 9217752883 model override-by-name: skip nameless base functions
`base_function["Name"]` crashes with `KeyError` when the model has
a function without an explicit `Name` (e.g. the binary entry stub).
Skip those entries silently; only named functions can be matched
by name anyway.
2026-06-11 17:39:53 +02:00
Alessandro Di Federico c306157596 SplitStructPhis: replace HoistStructPhis
Replace the hoist-struct-phis pass with a split-struct-phis pass that
breaks struct PHI nodes into per-field PHIs instead of moving them
out, and update both pipelines to use the new name.
2026-06-11 17:39:53 +02:00
Pietro Fezzardi 34ec07bd7f pipeline: add hoist-variable-initializers 2026-06-03 16:33:15 +02:00
Giacomo Vercesi 828bd9c49f pypeline: add remote storage server
Add the PRSS (Pypeline Remote Storage Server) and the relay companion
server.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi ff4c899954 pypeline: add RSSStorageProvider
Add the storage provider (and factory) for the Pypeline Remote Storage
Server (PRSS).
2026-05-22 09:04:35 +02:00
Giacomo Vercesi 3a9317d512 pypeline: factor out starlette middleware code
Factor out in a function the generation of the middleware list, to
facilitate reuse. Add the `AuthMiddleware` which allows authenticating
requests.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi 25b90139f0 pypeline: rotate notification broker code
Move around the code pertaining to the notification broker, making the
various roles a bit clearer. This also de-couple the broker logic from
the local revng daemon.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi 653f92514b pypeline: adopt hypercorn in place of uvicorn
Switch out from using uvicorn to hypercorn for the pypeline daemon, make
the facilities create hypercorn commands in stand-alone functions, as
they will be re-used for other servers later on.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi 2f0f320711 revng2 project init: fix for non-local providers
Fix the `revng2 project init` command to work with all
`StorageProvider`s, not just the local one. It still specializes for the
local one to allow creating the model file.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi 41ad874013 StorageProviderFactory: add lock_type parameter
Add the `lock_type` parameter to `StorageProviderFactory`, this allows
signaling what operations are going to be done while using the provider.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi 40ae2d73dd Factor out BufferedReader in a standalone file
Move the `BufferedReader` class to a standalone file. This allows the
class to be reused in other packages.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi 6f6cffde3b LocalProvider: add object_id_string to objects
Add the `object_id_string` to the `objects` table. This is for
debugging purposes as it's hard to figure out what is what with binary
objects ids.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi d7d87e237a LocalProvider: add migration logic
Add additional logic to allow the local database to be migrated to newer
versions.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi ccadc30709 StorageProvider: clarify prune purpose 2026-05-22 09:04:35 +02:00
Giacomo Vercesi edab3e26e9 ProjectMetadata: add additional fields
Expand the `ProjectMetadata` dataclass to include additional timestamps
and the hash of the pipeline description. Change all the
`StorageProvider`s so that all the new data is saved and returned.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi 4e0f4a6540 pypeline: stabilize pipeline description
Before this commit the pipeline description suffered from some
non-determinism that led to some values changing between runs of
`revng`. Add extra sorting so to eliminate the non-determinism.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi a1878f0f05 StorageProvider: collapse object deps and saving
Consolidate the saving of object dependencies and saving the actual
objects' data into a single function called `add_objects`. The previous
methods `add_dependencies`, `add_custom_invalidation_data` and `put`
have been removed.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi bbff447181 pypeline: split ScheduledTask
Due to the drifting differences, split `ScheduledTask` into
`PipeScheduledTask` and `SavepointScheduledTask`, which allows each to
specialize on the task it has to accomplish.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi e6bdae206e pypeline: notifications a duty of StorageProvider
Make the issuing of notification completely out of band with respect to
the `Pipeline`. Now the `StorageProvider` is responsible for providing
notifications to clients. Since some providers are local-only, there is
a `LOCAL_QUEUE` which allows sensing notifications through a local
queue, re-using the local revng daemon.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi b7f914d53f StorageProvider: move invalidate into set_model
Make `set_model` perform both the invalidation and the changing of the
model bytes. This makes persisting the result of an analysis to storage
atomic.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi 2fabd9c400 pypeline: split Pipe.invalidate in two
Split the `invalidate` method in two phases: in `invalidateCheck` it
just checks if the model diff warrants the execution of the actual
`invalidate` method, which requires fetching the custom invalidation
data from storage. The actual `invalidation` method remains the same.
This should make invalidation faster for storage providers that store
the invalidation remotely.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi a68c53cbb0 pypeline.cli: drop PypeGroup
The `PypeGroup` click group did not provide any real benefit:
* It added extra help about pipebox arguments, but text that was not
  correct from where the help was coming from (the group does not parse
  the arguments). The subcommands still reports it though.
* It forbid using non-PypeGroup and non-PypeCommand commands in the
  command tree, but in the long run this is desirable so it should be
  dropped
For these reasons it has been dropped.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi dc511987ed revng2 project daemon: propagate exception
When one of the tasks completes, it might be due to an exception, call
the `exception()` method so that the exception can actually be caught by
the try block.
2026-05-22 09:04:35 +02:00
Giacomo Vercesi e8d6e48a1f pypeline-cli: fix logic for --format option
The `--format` option relied on `click.Context.get_parameter_source` to
determine if the default value for the `--format` parameter was passed.
A bug in click caused this to behave "correctly", click 8.4.0 fixed the
bug. Change the logic by using `None` as the default value so that it
can be checked without using the parameter source.
2026-05-19 10:41:18 +02:00
Giacomo Vercesi 591e5b237a Fix check-convention errors
An upgrade in mypy made a type error show up in existing code.
2026-05-18 10:13:54 +02:00
Alessandro Di Federico 723e4ead76 export sqlite: ignore symbols without a prototype 2026-05-15 11:43:11 +02:00
Alessandro Di Federico 3f68528866 sqlite export: add Functions having ExportedName
A library's exported functions live in model::Function. Walk the
Functions list and insert one Symbol row per ExportedName so the
database covers both shapes.

Also, batch all symbol inserts.
2026-05-15 11:27:33 +02:00
Alessandro Di Federico 694bad5bfa model export sqlite: save full library path 2026-05-15 11:27:33 +02:00
Alessandro Di Federico c3bff6e062 configuration: drop redundant yaml.safe_load
The duplicate `result = yaml.safe_load(file)` after the merge() call
overwrote the accumulated configuration with just the last file's
contents.
2026-05-15 11:27:33 +02:00
Giacomo Vercesi 358291afa1 DaemonProject: fix _join_url
Fix the `_join_url` function, as `normpath` does not trim multiple `/`s
at the beginning of a path.
2026-05-14 11:59:01 +02:00
Giacomo Vercesi dbc734f23a CMake: force use of Python3
Switch from using `find_package(Python ...)` to `find_package(Python3
...)` as it excludes that CMake picks a Python 2 version by accident.
2026-05-14 11:26:41 +02:00
Roberto Bertolini 5dcd6334b3 Add Clift local variable scope tightening 2026-05-13 15:32:34 +02:00
Lauri Vasama 5740ac0c9c Add defer-allocas LLVM pass 2026-05-13 15:32:33 +02:00
Pietro Fezzardi 1e94ca0711 Add SplitExponentialDataflow pass
Introduce a new canonicalisation pass that forces a small set of
exponential-dataflow-prone instructions (SelectInst plus the FShl
and FShr intrinsic patterns) to be stored into a dedicated local
variable. Without this, expanding their value into C expressions
during decompilation can blow up into exponential path enumeration
on real binaries.

This is a temporary workaround. A more principled split of
pathological dataflows is planned and will replace this pass.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi 13fc8b0930 Strip dead prototypes before emitting C
Run -strip-dead-prototypes as part of the LLVM-pass list invoked
just before the Clifter, so that all unused helpers are stripped
away. In particular, this prevents some LLVM intrinsics that
return structs containing i1 (e.g. the overflow intrinsics) from
ending up in the C output and tripping later passes.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi f3639d4649 Add ExtractValueToGEP pass
Add a canonicalisation pass that rewrites extractvalue from a
pointer-returning struct as an i8 GEP plus a load. Together with
ArithmeticToGEP this lets later passes consume the result through
the same GEP-based interface they use for ordinary memory accesses.
2026-05-08 11:37:10 +02:00
Pietro Fezzardi cb5702dc04 Add ArithmeticToGEP pass
Introduce the ArithmeticToGEP canonicalisation pass. It detects
pointers (LLVM-typed pointer values, model pointers flagged by the
"revng.pointers" metadata, and pointer-tagged extract values) and
rewrites integer arithmetic computed on top of them as i8 GEPs,
followed by a ptrtoint when the original use needs an integer.

For each obvious pointer the pass also walks backwards through Add
chains and disambiguates the pointer operand of each Add when the
other operand cannot be a pointer, so the rewrite extends to integer
arithmetic that only later flows into a pointer use.
2026-05-08 11:37:10 +02:00