Project

General

Profile

Compile as Position-Independent Executables (PIE)

As of commit - https://github.com/gozzy/suricata/commit/7d09cf10d870e6a4c938ca2778e6a7603a7b174c
Suricata can be compiled as Position-Independent Executables (PIE) on Linux. HardenedBSD compiles Suricata as a PIE by default. What does this mean you can read more here -

Enabling that feature is simple:

./configure --enable-pie

or just add --enable-pie to your usual config line. For example compiling the latest git/dev source -

git clone git://phalanx.openinfosecfoundation.org/oisf.git && cd suricata \
&& git clone https://github.com/OISF/libhtp.git -b 0.5.x \
&& ./autogen.sh && ./configure --enable-pie \
&&  make clean && make -j && make install &&  ldconfig

You should be able to confirm Position-Independent Executable (PIE) compilation like so (you should look for - Position Independent Executable enabled: yes):

user@ids:/opt#suricata --build-info
This is Suricata version 2.1dev (rev 08a3de4)
Features: PCAP_SET_BUFF LIBPCAP_VERSION_MAJOR=1 PF_RING AF_PACKET HAVE_PACKET_FANOUT LIBCAP_NG LIBNET1.1 HAVE_HTP_URI_NORMALIZE_HOOK PCRE_JIT HAVE_NSS HAVE_LUA HAVE_LUAJIT HAVE_LIBJANSSON TLS 
SIMD support: SSE_4_2 SSE_4_1 SSE_3 
Atomic intrisics: 1 2 4 8 16 byte(s)
64-bits, Little-endian architecture
GCC version 4.8.4, C version 199901
compiled with -fstack-protector
compiled with _FORTIFY_SOURCE=2
L1 cache line size (CLS)=64
thread local storage method: __thread
compiled with LibHTP v0.5.18, linked against LibHTP v0.5.18

Suricata Configuration:
  AF_PACKET support:                       yes
  PF_RING support:                         yes
  NFQueue support:                         no
  NFLOG support:                           no
  IPFW support:                            no
  Netmap support:                          no
  DAG enabled:                             no
  Napatech enabled:                        no

  Unix socket enabled:                     yes
  Detection enabled:                       yes

  libnss support:                          yes
  libnspr support:                         yes
  libjansson support:                      yes
  Prelude support:                         no
  PCRE jit:                                yes
  LUA support:                             yes, through luajit
  libluajit:                               yes
  libgeoip:                                yes
  Non-bundled htp:                         no
  Old barnyard2 support:                   no
  CUDA enabled:                            no

  Suricatasc install:                      yes

  Unit tests enabled:                      no
  Debug output enabled:                    no
  Debug validation enabled:                no
  Profiling enabled:                       no
  Profiling locks enabled:                 no
  Coccinelle / spatch:                     yes

Generic build parameters:
  Installation prefix:                     /usr/local
  Configuration directory:                 /usr/local/etc/suricata/
  Log directory:                           /usr/local/var/log/suricata/

  --prefix                                 /usr/local
  --sysconfdir                             /usr/local/etc
  --localstatedir                          /usr/local/var

  Host:                                    x86_64-unknown-linux-gnu
  Compiler:                                gcc (exec name) / gcc (real)
  GCC Protect enabled:                     no
  GCC march native enabled:                yes
  GCC Profile enabled:                     no
  -->> Position Independent Executable enabled: yes <<--
  CFLAGS                                   -g -O2 -march=native
  PCAP_CFLAGS                               -I/usr/include
  SECCFLAGS                                

pevma