From a0848150d3324723fa9f54b71ae94f20a3444f37 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 3 Jul 2013 12:15:47 +0200 Subject: [PATCH] Advertise clipboard line-endings for copy and paste line-ending conversion - Build spice-vdagentd as pie + relro --- ...-Add-printing-of-version-to-h-output.patch | 60 ++++++++++++++ ...ertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch | 26 ++++++ ...-vdagentd-as-pie-relro-when-possible.patch | 82 +++++++++++++++++++ spice-vdagent.spec | 20 ++++- 4 files changed, 184 insertions(+), 4 deletions(-) create mode 100644 0001-vdagent-d-Add-printing-of-version-to-h-output.patch create mode 100644 0002-vdagentd-Advertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch create mode 100644 0003-buildsys-Build-vdagentd-as-pie-relro-when-possible.patch diff --git a/0001-vdagent-d-Add-printing-of-version-to-h-output.patch b/0001-vdagent-d-Add-printing-of-version-to-h-output.patch new file mode 100644 index 0000000..211c0fc --- /dev/null +++ b/0001-vdagent-d-Add-printing-of-version-to-h-output.patch @@ -0,0 +1,60 @@ +From 256e01c8c7b0c386525a0fac71537bb7bb05d271 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 6 Jun 2013 17:00:22 +0200 +Subject: [linux-vdagent PATCH 1/3] vdagent[d]: Add printing of version to -h + output + +Signed-off-by: Hans de Goede +--- + src/vdagent.c | 6 +++--- + src/vdagentd.c | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/vdagent.c b/src/vdagent.c +index 7e1b474..9e238d3 100644 +--- a/src/vdagent.c ++++ b/src/vdagent.c +@@ -132,15 +132,15 @@ static void usage(FILE *fp) + { + fprintf(fp, + "Usage: spice-vdagent [OPTIONS]\n\n" +- "Spice guest agent X11 session agent.\n\n" ++ "Spice guest agent X11 session agent, version %s.\n\n" + "Options:\n" + " -h print this text\n" + " -d log debug messages\n" + " -s set virtio serial port\n" + " -x don't daemonize\n" + " -f file xfer save dir\n" +- " -o <0|1> open dir on file xfer completion\n" +- ); ++ " -o <0|1> open dir on file xfer completion\n", ++ VERSION); + } + + static void quit_handler(int sig) +diff --git a/src/vdagentd.c b/src/vdagentd.c +index 888a80a..da25329 100644 +--- a/src/vdagentd.c ++++ b/src/vdagentd.c +@@ -718,7 +718,7 @@ static void usage(FILE *fp) + { + fprintf(fp, + "Usage: spice-vdagentd [OPTIONS]\n\n" +- "Spice guest agent daemon.\n\n" ++ "Spice guest agent daemon, version %s.\n\n" + "Options:\n" + " -h print this text\n" + " -d log debug messages (use twice for extra info)\n" +@@ -731,7 +731,7 @@ static void usage(FILE *fp) + #ifdef HAVE_LIBSYSTEMD_LOGIN + " -X Disable systemd-logind integration\n" + #endif +- ,portdev, uinput_device); ++ ,VERSION, portdev, uinput_device); + } + + void daemonize(void) +-- +1.8.3.1 + diff --git a/0002-vdagentd-Advertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch b/0002-vdagentd-Advertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch new file mode 100644 index 0000000..da04db7 --- /dev/null +++ b/0002-vdagentd-Advertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch @@ -0,0 +1,26 @@ +From 43cde1cbedc56138a857100f634e7cb644477e7e Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 24 Jun 2013 10:34:27 +0200 +Subject: [linux-vdagent PATCH 2/3] vdagentd: Advertise + VD_AGENT_CAP_GUEST_LINEEND_LF + +Signed-off-by: Hans de Goede +--- + src/vdagentd.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/vdagentd.c b/src/vdagentd.c +index da25329..f4cea44 100644 +--- a/src/vdagentd.c ++++ b/src/vdagentd.c +@@ -95,6 +95,7 @@ static void send_capabilities(struct vdagent_virtio_port *vport, + VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND); + VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_SELECTION); + VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG); ++ VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_GUEST_LINEEND_LF); + + vdagent_virtio_port_write(vport, VDP_CLIENT_PORT, + VD_AGENT_ANNOUNCE_CAPABILITIES, 0, +-- +1.8.3.1 + diff --git a/0003-buildsys-Build-vdagentd-as-pie-relro-when-possible.patch b/0003-buildsys-Build-vdagentd-as-pie-relro-when-possible.patch new file mode 100644 index 0000000..9c38452 --- /dev/null +++ b/0003-buildsys-Build-vdagentd-as-pie-relro-when-possible.patch @@ -0,0 +1,82 @@ +From 71b8e75c6f1bc6c482d28cf29b82643d6b38cf34 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 3 Jul 2013 11:16:20 +0200 +Subject: [linux-vdagent PATCH 3/3] buildsys: Build vdagentd as pie + relro + when possible + +Signed-off-by: Hans de Goede +--- + Makefile.am | 6 ++++-- + configure.ac | 32 ++++++++++++++++++++++++++++++++ + 2 files changed, 36 insertions(+), 2 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index fa2803a..74cc313 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -8,8 +8,10 @@ src_spice_vdagent_CFLAGS = $(X_CFLAGS) $(SPICE_CFLAGS) $(GLIB2_CFLAGS) + src_spice_vdagent_LDADD = $(X_LIBS) $(SPICE_LIBS) $(GLIB2_LIBS) + src_spice_vdagent_SOURCES = src/vdagent.c src/vdagent-x11.c src/vdagent-x11-randr.c src/vdagent-file-xfers.c src/udscs.c + +-src_spice_vdagentd_CFLAGS = $(DBUS_CFLAGS) $(LIBSYSTEMD_LOGIN_CFLAGS) $(PCIACCESS_CFLAGS) $(SPICE_CFLAGS) $(GLIB2_CFLAGS) +-src_spice_vdagentd_LDADD = $(DBUS_LIBS) $(LIBSYSTEMD_LOGIN_LIBS) $(PCIACCESS_LIBS) $(SPICE_LIBS) $(GLIB2_LIBS) ++src_spice_vdagentd_CFLAGS = $(DBUS_CFLAGS) $(LIBSYSTEMD_LOGIN_CFLAGS) \ ++ $(PCIACCESS_CFLAGS) $(SPICE_CFLAGS) $(GLIB2_CFLAGS) $(PIE_CFLAGS) ++src_spice_vdagentd_LDADD = $(DBUS_LIBS) $(LIBSYSTEMD_LOGIN_LIBS) \ ++ $(PCIACCESS_LIBS) $(SPICE_LIBS) $(GLIB2_LIBS) $(PIE_LDFLAGS) + src_spice_vdagentd_SOURCES = src/vdagentd.c \ + src/vdagentd-uinput.c \ + src/vdagentd-xorg-conf.c \ +diff --git a/configure.ac b/configure.ac +index 91a24ff..a1ce6c0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -141,6 +141,37 @@ if test "$ac_test_CFLAGS" != set; then + done + fi + ++AC_ARG_ENABLE([pie], ++ AS_HELP_STRING([--enable-pie=@<:@auto/yes/no@:>@], ++ [Enable position-independent-executable support (for spice-vdagentd)@<:@default=auto@:>@]), ++ [], ++ [enable_pie="auto"]) ++ ++if test "x$enable_pie" != "xno"; then ++ save_CFLAGS="$CFLAGS" ++ save_LDFLAGS="$LDFLAGS" ++ CFLAGS="$CFLAGS -fPIE" ++ LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now" ++ AC_MSG_CHECKING([for PIE support]) ++ AC_LINK_IFELSE([AC_LANG_SOURCE([int main () { return 0; }])], ++ [have_pie=yes], ++ [have_pie=no]) ++ AC_MSG_RESULT([$have_pie]) ++ if test "x$have_pie" = "xno" && test "x$enable_pie" = "xyes"; then ++ AC_MSG_ERROR([pie support explicitly requested, but your toolchain does not support it]) ++ fi ++ if test "x$have_pie" = "xyes"; then ++ PIE_CFLAGS="-fPIE" ++ PIE_LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now" ++ AC_SUBST(PIE_CFLAGS) ++ AC_SUBST(PIE_LDFLAGS) ++ fi ++ CFLAGS="$save_CFLAGS" ++ LDFLAGS="$save_LDFLAGS" ++else ++ have_pie=no ++fi ++ + AC_CONFIG_FILES([ + Makefile + data/spice-vdagent.1 +@@ -160,6 +191,7 @@ AC_MSG_NOTICE([ + session-info: ${with_session_info} + pciaccess: ${enable_pciaccess} + static uinput: ${enable_static_uinput} ++ vdagentd pie + relro: ${have_pie} + + install RH initscript: ${init_redhat} + install systemd service: ${init_systemd} +-- +1.8.3.1 + diff --git a/spice-vdagent.spec b/spice-vdagent.spec index b30ff35..ba2f4ff 100644 --- a/spice-vdagent.spec +++ b/spice-vdagent.spec @@ -1,14 +1,18 @@ Name: spice-vdagent Version: 0.14.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Agent for Spice guests Group: Applications/System License: GPLv3+ URL: http://spice-space.org/ Source0: http://spice-space.org/download/releases/%{name}-%{version}.tar.bz2 -BuildRequires: systemd-devel glib2-devel spice-protocol libpciaccess-devel -BuildRequires: libXrandr-devel libXinerama-devel libXfixes-devel -BuildRequires: systemd-units desktop-file-utils +# Fixes from upstream git +Patch1: 0001-vdagent-d-Add-printing-of-version-to-h-output.patch +Patch2: 0002-vdagentd-Advertise-VD_AGENT_CAP_GUEST_LINEEND_LF.patch +Patch3: 0003-buildsys-Build-vdagentd-as-pie-relro-when-possible.patch +BuildRequires: systemd-devel glib2-devel spice-protocol >= 0.12.6 +BuildRequires: libpciaccess-devel libXrandr-devel libXinerama-devel +BuildRequires: libXfixes-devel systemd-units desktop-file-utils libtool Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units @@ -28,6 +32,10 @@ Features: %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +autoreconf -fi %build @@ -69,6 +77,10 @@ rm $RPM_BUILD_ROOT%{_sysconfdir}/modules-load.d/spice-vdagentd.conf %changelog +* Wed Jul 3 2013 Hans de Goede - 0.14.0-3 +- Advertise clipboard line-endings for copy and paste line-ending conversion +- Build spice-vdagentd as pie + relro + * Mon May 20 2013 Hans de Goede - 0.14.0-2 - Drop the no longer needed /etc/modules-load.d/spice-vdagentd.conf (#963201)