# RELRO

**Rel**ocation **R**ead-**O**nly (or **RELRO**) is a security measure against [GOT overwrite](/pwn/stack-exploitation/arbitrary-code-execution/code-reuse-attack/got-overwrite.md).

There are two RELRO "modes": partial and full.

## Partial RELRO <a href="#partial-relro" id="partial-relro"></a>

{% hint style="info" %}
Partial RELRO is the default setting in GCC.
{% endhint %}

Partial RELRO offers little additional protection, aside from ensuring that the [Global Offset Table (GOT) ](/pwn/general-knowledge/plt-and-got.md)is located in memory before the BSS (Block Started by Symbol) section. This eliminates the risk of a [buffer overflow](/pwn/stack-exploitation/stack-buffer-overflow.md) on a global variable overwriting GOT entries.

## Full RELRO <a href="#full-relro" id="full-relro"></a>

Full RELRO makes the entire GOT read-only which removes the ability to perform a "[GOT overwrite](/pwn/stack-exploitation/arbitrary-code-execution/code-reuse-attack/got-overwrite.md)" attack.

{% hint style="info" %}
Full RELRO is not a default compiler setting as it can greatly increase program startup time since all symbols must be resolved before the program is started. In large programs with thousands of symbols that need to be linked, this could cause a noticable delay in startup time.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.ctfrecipes.com/pwn/protections/relro.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
