---
name: "ulp"
section: "1"
platform: "linux"
package: "libpulp-tools"
version: "0.2.8-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ulp"
---

# ulp(1)

Userspace Livepatching Tool

## NAME

ulp - Userspace Livepatching Tool

## SYNOPSIS

**ulp command** \[SWITCHES\]... \[ARGUMENTS\] *file*

## INTRODUCTION

**ulp** consists of a set of tools used in the userspace livepatching process. Those include querying patch status, libpulp messages, applying and removing patches, and checking for livepatch capabilities within a process.

- Commands currently supported by ulp are:

  - **patches:**

  list running programs that have livepatching capabilities loaded, as well the libraries that are livepatchable and the list of loaded patches.

- **check:**

  check if a certain livepatch (.so) is applied to a running process.

- **dump:**

  print the content of a livepatch (.so) in human-readable form.

- **packer:**

  compile the livepatch descriptor (.dsc file) into a livepatch (.ulp file). The later can be used to apply a livepatch to a running process using trigger.

- **trigger:**

  apply or remove a list of livepatches to a list of running processes.

- **post:**

  apply any post-processing needed to livepatch containers (.so files).

- **messages:**

  querry the libpulp internal message queue in a running process. This can be used to diagnose livepaching errors that occured internally in the target process.

-

  - Detailed descriptions about how these commands work are provided in the next

  sections.

## PATCHES

- ulp patches - Show active live patches and libraries

  ## NAME

- **ulp patches**

  ## SYNOPSIS

**-p**wildcard

- **ulp patches show which libraries are livepatchable and which livepatches**

  ## DESCRIPTION

are loaded in process that matches either *wildcard* as name or with pid = *wildcard.*

-

  ## OPTIONS

- **-p**

  *wildcard* Show processes which name matches the wildcard, or with pid = wildcard.

-

  ## EXIT STATUS

- **ulp patches**

  exits 0 on success, anything else on error.

## CHECK

- ulp check - Apply a live patch

  ## NAME

- **ulp check**

  ## SYNOPSIS

\[OPTION\]... **-p**pid *file*

- **ulp check**

  ## DESCRIPTION

attaches to the target process specified by *pid* and checks whether the live patch described by the metadata *file* that it takes as argument has already been applied or not.

Only relevant processes can be inspected with **ulp**check**.** More specifically, the following conditions must be met:

- **Attaching to the Target Process**

  Libpulp uses ptrace to attach to target processes, thus only the owner of a process (or root) can apply a live patch to it. Moreover, on systems that have Linux Security Modules (LSM) enabled, some extra convincing might be required (see Ptrace access mode checking in [*ptrace*(2)](/ptrace/2.md)). When **ulp check** is unable to attach to the target process, it exits in error.

- **Runtime support**

  Applying a live patch requires functions from libpulp.so, which must have been loaded into the address space of the target process. Typically, this is accomplished with LD\_PRELOAD (see [*libpulp*(7)](/libpulp/7.md)).

- If a problem happens during the execution of functions from libpulp.so, the

  ## FATAL ERRORS

target process might end up in an inconsistent state. When that happens **ulp check** exits with error code **-1**, and the user is advised to kill the process.

-

  ## OPTIONS

- **-q, --quiet**

  Do not produce any output.

- **-v, --verbose**

  Produce verbose output.

- **-?, --help**

  Display a lengthy usage message.

- **-usage**

  Display a brief usage message.

- **-V --version**

  Print program version and exit.

-

  ## BUGS

- **ulp check**

  also returns -1 on non-fatal errors.

-

  ## EXIT STATUS

- **ulp check**

  exits 0 on success, 1 on error, and -1 on fatal errors. A fatal error is an indication that the target process should be killed, because it was probably left in an inconsistent state.

## DUMP

- ulp dump - Prints metadata information in human-readable format

  ## NAME

-

  ## SYNOPSIS

- **ulp dump**

  *file*

-

  ## DESCRIPTION

- **ulp dump**

  parses the metadata *file* that it takes as argument, which is in binary format, then prints its content to the standard output in human-readable format.

-

  ## EXIT STATUS

- **ulp dump**

  exits 0 on success and 1 on error.

## PACKER

- ulp packer - Create live patch metadata

  ## NAME

- **ulp packer**

  ## SYNOPSIS

\[OPTION\]... *file\_wildcard*

- **ulp packer**

  ## DESCRIPTION

creates a live patch metadata file based on the live patch description *file* that it takes as argument. After parsing the description file, **ulp packer** validates that the target library and live patch objects referred to exist, then produces the metadata file required by live patching tools, such as **ulp** [**trigger**(1)](/trigger/1.md) and **ulp** [**check**(1)](/check/1.md).

The syntax of the description file is described in [*libpulp*(7)](/libpulp/7.md).

By default, the output is written to stdout, but it can be optionally redirected to a specified file. See OPTIONS below.

-

  ## OPTIONS

- **-o, --output=FILENAME**

  Instead of printing the results to the standard output, write them to FILENAME.

- **-p, --process=WILDCARD**

  Patch any process which name matches the WILDCARD. A single PID is also supported by passing WILDCARD=PID of the target process.

  **-l, --livepatch=FILENAME** Instead of getting the path to the live patch object from the description file, use FILENAME.

- **-t, --target=FILENAME**

  Instead of getting the path to the target library from the description file, use FILENAME.

- **-q, --quiet**

  Do not produce any output.

- **-v, --verbose**

  Produce verbose output.

- **-?, --help**

  Display a lengthy usage message.

- **-usage**

  Display a brief usage message.

- **-V --version**

  Print program version and exit.

- **-R --root=PREFIX**

  Append PREFIX to the path to the livepatch .so file when it is send to the target process. This is useful if ulp is running inside a chroot.

- **ulp packer**

  ## EXIT STATUS

exits 0 on success and 1 on error.

## TRIGGER

- ulp trigger - Apply a live patch

  ## NAME

- **ulp trigger**

  ## SYNOPSIS

\[OPTION\]... **-p** *process\_wildcard* *file\_wildcard*

- **ulp trigger**

  ## DESCRIPTION

attaches to the target process specified by a set of process in *process\_wildcard* or a single process with pid equals to *process\_wildcard* and applies a set of livepatches described by the metadata *file\_wildcard* that it takes as argument. After parsing the metadata file, several checks are performed to verify that the target process can receive the specified live patch:

- **Target Library**

  A live patch replaces functions belonging to a shared library, thus, **ulp trigger** searches the memory space of the target process for its presence. When the library is not present, **ulp trigger** exits in error.

- **Replacement functions**

  The metadata file contains a list of replacement functions, which must be present in the live patch object (DSO). If all functions are present, the live patching operation can proceed, otherwise **ulp trigger** exits in error.

- **Attaching to the Target Process**

  Libpulp uses ptrace to attach to target processes, thus only the owner of a process (or root) can apply a live patch to it. Moreover, on systems that have Linux Security Modules (LSM) enabled, some extra convincing might be required (see Ptrace access mode checking in [*ptrace*(2)](/ptrace/2.md)). When **ulp trigger** is unable to attach to the target process, it exits in error.

- **Runtime support**

  Applying a live patch requires functions from libpulp.so, which must have been loaded into the address space of the target process. Typically, this is accomplished with LD\_PRELOAD (see [*libpulp*(7)](/libpulp/7.md)).

- **Forward progress**

  After attaching to the target process with ptrace, Libpulp calls functions from libpulp.so. The execution of these functions happens from the context of a signal handler, thus *AS-Unsafe* functions are not allowed (see [*attributes*(7)](/attributes/7.md)). However, Libpulp requires the use of [*malloc*(3)](/malloc/3.md), [*dlopen*(3)](/dlopen/3.md) and [*dlsym*(3)](/dlsym/3.md), which are all *AS-Unsafe*. In order to avoid deadlocks, libpulp.so checks that these functions are not in execution anywhere in the target process, before starting the live patching operation.

- If a problem happens after Libpulp started replacing functions from the target

  ## FATAL ERRORS

process, the process might end up in an inconsistent state. When that happens **ulp trigger** exits with error code **-1**, and the user is advised to kill the process.

-

  ## OPTIONS

- **-r, --retries=N**

  To guarantee **Forward Progress**, Libpulp first checks whether trying to apply a live patch would cause a deadlock in the target process, or if it would be safe to do so. By default, **ulp trigger** performs this check a single time and exits in error if the check fails. However, the state of the relevant locks usually changes very quickly, thus, there is a high chance that trying again after a brief moment would allow the live patching operation to succeed without risk of deadlock. This option tells **ulp trigger** to try again *N* times.

- **-c, --check-stack**

  Before applying the live patch to the target process, unwind the stacks of all threads and make sure that none of them have library calls in execution. If any thread is within the target library, **ulp trigger** aborts the live patching operation; on the other hand, if no threads are within the target library, the live patch can be applied with additional consistency guarantees.

- **--revert-all=LIB**

  Before applying the live patch to the target process, revert all livepatches applied to the library LIB. If LIB=target, then all patches to the target library of the livepatch will be removed.

- **--disable-summarization**

  Disable output summarization. This avoids suppression of output 'irrelevant output' with regard to skipped livepatches.

- **--timeout N**

  Wait N seconds for a reply from libpulp. Default is 100s. In cases where the system is busy running multiple tasks it may be worth increasing this number, once ulp will bail out to not hang a system update.

- **--recursive**

  Look for livepatches recursively when a wildcard is passed.

- **-q, --quiet**

  Do not produce any output.

- **-v, --verbose**

  Produce verbose output.

- **-?, --help**

  Display a lengthy usage message.

- **-usage**

  Display a brief usage message.

- **-V --version**

  Print program version and exit.

- **ulp trigger**

  ## EXIT STATUS

exits 0 on success, 1 on error, and -1 on fatal errors. A fatal error is an indication that the target process should be killed, because it was probably left in an inconsistent state.

## POST

- ulp post - Post-process live patchable libraries

  ## NAME

- **ulp post**

  ## SYNOPSIS

*file*

- **ulp post**

  ## DESCRIPTION

opens the library *file* passed as argument and replaces one-byte nops with multi-byte nop instructions at patchable function entries (see [*gcc*(1)](/gcc/1.md)).

- **ulp post**

  ## EXIT STATUS

exits 0 on success, and 1 on error.

## REVERSE

- ulp reverse - Create live patch metadata

  ## NAME

-

  ## SYNOPSIS

- **ulp reverse**

  *file*

-

  ## DESCRIPTION

- **ulp reverse**

  creates a live patch metadata used to revert the effects of the metadata *file* that it takes as argument. Live patch reversal does not require a live patch object file, because it does not add new replacement functions; rather, it causes the reverse-patched process to fallback to the functions that had been previously replaced. These functions are already present in the memory space of the target process.

-

  ## EXIT STATUS

- **ulp reverse**

  exits 0 on success and a positive integer on error.

## MESSAGES

- ulp messages - Querry internal messages from libpulp

  ## NAME

-

  ## SYNOPSIS

- **ulp messages**

  \-p *pid*

-

  ## DESCRIPTION

- **ulp messages**

  print all internal messages from libpulp message queue in process running with pid = *pid* Those messages are useful to debug any problem that may happens when a livepatch is applied.

- Messages are output to stdout.

  -

  ## EXIT STATUS

- **ulp messages**

  exits 0 on success, anything else on error.

## EXTRACT

- ulp extract - Extract the relevant content from a livepatchable library

  ## NAME

-

  ## SYNOPSIS

- **ulp extract**

  *livepatchable\_library* -o *output\_file*

-

  ## DESCRIPTION

- Extract the relevant content from

  *livepatchable\_library* such as the library name, buildid, and symbols in the library; and write those informations into a JSON file specified by *output\_file.*

-

  ## EXIT STATUS

- exits 0 on success, anything else on error.

  ## SET\_PATCHABLE

- ulp set\_patchable - Enable/disable livepatching on target process

  ## NAME

-

  ## SYNOPSIS

- **ulp set\_livepatchable -p process**

  *enable/disable*

-

  ## DESCRIPTION

- Enable or disable the livepatching capability of process specified by

  \-p *WILDCARD.* If WILDCARD is a number, then it is assumed to be the PID of the process. The program will output which processes were modified.

-

  ## EXIT STATUS

- Always returns 0.
