[systemd-devel] [PATCH] build: Honour SUID_CFLAGS and SUID_LDFLAGS

Dave Reisner d at falconindy.com
Sat May 17 11:56:20 PDT 2014


On Sat, May 17, 2014 at 12:39:47PM -0400, Cristian Rodríguez wrote:
> This is the standard* way used to pass special linker/compiler
> flags such as -fPIE and -pie
> 
> * "Standard" in the sense it is understood by many other
> packages  and commonly used by distributions.

This doesn't really make sense to me. I infer from the names of the
variables that these are flags passed to the compiler for binaries which
will eventually be setuid root. Why then, are you adding them to the
global flags, particularly when systemd doesn't even build any SUID
binaries? If you want to compile everything with -fPIE and -pie, why not
just append these to your flags locally in the build script?

> ---
>  configure.ac | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 30ef33d..c798674 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -48,6 +48,9 @@ LT_INIT([disable-static])
>  AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by systemd])])
>  AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by systemd])])
>  
> +AC_ARG_VAR([SUID_CFLAGS], [CFLAGS used for binaries which are usually with the suid bit])
> +AC_ARG_VAR([SUID_LDFLAGS], [LDFLAGS used for binaries which are usually with the suid bit])
> +
>  # i18n stuff for the PolicyKit policy files
>  IT_PROG_INTLTOOL([0.40.0])
>  
> @@ -181,7 +184,7 @@ AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
>          [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
>                 -flto])],
>          [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
> -AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
> +AC_SUBST([OUR_CFLAGS], "$SUID_CFLAGS $with_cflags $sanitizer_cflags")
>  
>  AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
>          [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
> @@ -196,7 +199,7 @@ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
>          -Wl,-z,relro \
>          -Wl,-z,now \
>          -Wl,-fuse-ld=gold])
> -AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
> +AC_SUBST([OUR_LDFLAGS], "$SUID_LDFLAGS $with_ldflags $sanitizer_ldflags")
>  
>  AC_CHECK_SIZEOF(pid_t)
>  AC_CHECK_SIZEOF(uid_t)
> -- 
> 1.8.4.5
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list