First, get the source code for accountsservice:
mkdir accountsservice
cd accountsservice
apt-get source accountsservice
cd accountsservice-0.6.55/To create a debug build:
DEB_BUILD_OPTIONS='nostrip noopt debug' debuild -b -uc -usInstall like this:
sudo dpkg -i ../*.deb
The instructions that I found here don't work on accountsservice. (I get lots of linker errors like undefined reference to __asan_report_store8', presumably because libasanhasn't been included in the link step.) But I was able to successfully create an ASAN build by modifyingsrc/meson.build` like this:
diff --git a/src/meson.build b/src/meson.build
index 20d5276..50ec3e1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -28,6 +28,7 @@ cflags = [
'-DDATADIR="@0@"'.format(act_datadir),
'-DICONDIR="@0@"'.format(join_paths(act_localstatedir, 'lib', 'AccountsService', 'icons')),
'-DUSERDIR="@0@"'.format(join_paths(act_localstatedir, 'lib', 'AccountsService', 'users')),
+ '-fsanitize=address',
]
libaccounts_generated = static_library(
@@ -36,6 +37,7 @@ libaccounts_generated = static_library(
include_directories: top_inc,
dependencies: deps,
c_args: cflags,
+ link_args: '-fsanitize=address',
)
libaccounts_generated_dep = declare_dependency(
@@ -68,6 +70,7 @@ executable(
include_directories: top_inc,
dependencies: deps,
c_args: cflags,
+ link_args: '-fsanitize=address',
install: true,
install_dir: act_libexecdir,
)
Then run the same commands as before to build and install:
DEB_BUILD_OPTIONS='nostrip noopt debug' debuild -b -uc -us
sudo dpkg -i ../*.deb