Shared library, hardening
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
*.o
|
*.o
|
||||||
*.a
|
*.a
|
||||||
|
*.so
|
||||||
example_simple
|
example_simple
|
||||||
connection_afl
|
connection_afl
|
||||||
findings
|
findings
|
||||||
|
|||||||
16
Makefile
16
Makefile
@@ -1,8 +1,9 @@
|
|||||||
FIRE_CXX ?= clang++
|
FIRE_CXX ?= clang++
|
||||||
FIRE_CXXFLAGS ?= -O3 -std=gnu++2a -Wall -Werror
|
FIRE_CXXFLAGS ?= -O3 -std=gnu++2a -Wall -Werror -Wextra -fPIE -fPIC -fstack-protector-strong -fsanitize=safe-stack -fsanitize=safe-stack
|
||||||
|
FIRE_LDFLAGS ?= -fuse-ld=gold -flto -Wl,-z,relro -Wl,-z,now
|
||||||
FIRE_LDLIBS ?= -lgflags -lglog -lpthread
|
FIRE_LDLIBS ?= -lgflags -lglog -lpthread
|
||||||
|
|
||||||
all: firecgi.a firecgi.o example_simple
|
all: firecgi.a firecgi.o firecgi.so example_simple
|
||||||
|
|
||||||
objects = server.o connection.o request.o parse.o
|
objects = server.o connection.o request.o parse.o
|
||||||
|
|
||||||
@@ -13,17 +14,20 @@ firecgi.a: $(objects)
|
|||||||
ar rcs $@ $^
|
ar rcs $@ $^
|
||||||
|
|
||||||
firecgi.o: $(objects) firebuf/firebuf.o
|
firecgi.o: $(objects) firebuf/firebuf.o
|
||||||
ld --relocatable --output=$@ $+
|
gold -z relro -z now -r --output=$@ $+
|
||||||
|
|
||||||
|
firecgi.so: $(objects) firebuf/firebuf.o
|
||||||
|
$(FIRE_CXX) $(FIRE_CXXFLAGS) $(FIRE_LDFLAGS) -shared -o $@ $+ $(FIRE_LDFLIBS)
|
||||||
|
|
||||||
example_simple: example_simple.o firecgi.o
|
example_simple: example_simple.o firecgi.o
|
||||||
$(FIRE_CXX) $(FIRE_CXXFLAGS) -o $@ $+ $(FIRE_LDLIBS)
|
$(FIRE_CXX) $(FIRE_CXXFLAGS) $(FIRE_LDFLAGS) -pie -o $@ $+ $(FIRE_LDLIBS)
|
||||||
|
|
||||||
%.o: %.cc *.h Makefile
|
%.o: %.cc *.h Makefile
|
||||||
$(FIRE_CXX) $(FIRE_CXXFLAGS) -c -o $@ $<
|
$(FIRE_CXX) $(FIRE_CXXFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) --directory=firebuf clean
|
$(MAKE) --directory=firebuf clean
|
||||||
rm --force example_simple connection_afl *.o *.a
|
rm --force example_simple connection_afl *.so *.o *.a
|
||||||
|
|
||||||
afl:
|
afl:
|
||||||
$(MAKE) clean
|
$(MAKE) clean
|
||||||
@@ -32,7 +36,7 @@ afl:
|
|||||||
afl_int: connection_afl
|
afl_int: connection_afl
|
||||||
|
|
||||||
connection_afl: connection_afl.o firecgi.o
|
connection_afl: connection_afl.o firecgi.o
|
||||||
$(FIRE_CXX) $(FIRE_CXXFLAGS) -o $@ $+ $(FIRE_LDLIBS)
|
$(FIRE_CXX) $(FIRE_CXXFLAGS) $(FIRE_LDFLAGS) -pie -o $@ $+ $(FIRE_LDLIBS)
|
||||||
|
|
||||||
test: test_connection
|
test: test_connection
|
||||||
|
|
||||||
|
|||||||
2
firebuf
2
firebuf
Submodule firebuf updated: 4d9486e281...944483d13f
Reference in New Issue
Block a user