Accepting request 121665 from Virtualization

- check origin of netlink messages, use recvfrom() [bnc#761200]

- do not package modprobe.conf rule in main package
  prevents loading of ata_piix which is required for cdrom access

OBS-URL: https://build.opensuse.org/request/show/121665
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hyper-v?expand=0&rev=3
This commit is contained in:
Stephan Kulow 2012-05-22 06:15:53 +00:00 committed by Git OBS Bridge
commit 4ca7dd7a04
3 changed files with 43 additions and 1 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed May 16 20:44:36 CEST 2012 - ohering@suse.de
- check origin of netlink messages, use recvfrom() [bnc#761200]
------------------------------------------------------------------- -------------------------------------------------------------------
Wed May 2 12:13:03 CEST 2012 - ohering@suse.de Wed May 2 12:13:03 CEST 2012 - ohering@suse.de
@ -14,6 +19,12 @@ Mon Mar 26 19:05:48 CEST 2012 - ohering@suse.de
- update hv_kvp_daemon to 3.4-rc1 state - update hv_kvp_daemon to 3.4-rc1 state
use a copy linux/hyperv.h to compile the daemon use a copy linux/hyperv.h to compile the daemon
-------------------------------------------------------------------
Thu Dec 8 17:46:21 CET 2011 - ohering@suse.de
- do not package modprobe.conf rule in main package
prevents loading of ata_piix which is required for cdrom access
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Nov 18 21:49:57 CET 2011 - ohering@suse.de Fri Nov 18 21:49:57 CET 2011 - ohering@suse.de

View File

@ -17,6 +17,7 @@
%define with_kmp 0 %define with_kmp 0
%define with_modprobe 0
%if %{with_kmp} %if %{with_kmp}
%define with_drivers_in_kmp 0 %define with_drivers_in_kmp 0
%endif %endif
@ -49,6 +50,7 @@ Source5: hyper-v.kvptest.ps1.txt
Source9: hyper-v.include.linux.hyperv.h Source9: hyper-v.include.linux.hyperv.h
Source10: hyper-v.tools.hv.hv_kvp_daemon.c Source10: hyper-v.tools.hv.hv_kvp_daemon.c
Source11: hyper-v.init.sh Source11: hyper-v.init.sh
Patch761200: hyper-v.tools.hv.hv_kvp_daemon.c.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %{with_kmp} %if %{with_kmp}
%if %{with_drivers_in_kmp} %if %{with_drivers_in_kmp}
@ -82,11 +84,14 @@ This package contains the Microsoft Hyper-V drivers.
cp -avL %{S:5} kvptest.ps1.txt cp -avL %{S:5} kvptest.ps1.txt
cp -vL %{S:9} %{hv_kvp_daemon}.h cp -vL %{S:9} %{hv_kvp_daemon}.h
cp -vL %{S:10} %{hv_kvp_daemon}.c cp -vL %{S:10} %{hv_kvp_daemon}.c
sed -i~ '/#include <linux.hyperv.h>/d' %{hv_kvp_daemon}.c %patch761200 -p0
%build %build
sed -i~ '/#include <linux.hyperv.h>/d' %{hv_kvp_daemon}.c
gcc \ gcc \
$RPM_OPT_FLAGS \ $RPM_OPT_FLAGS \
-Wno-unused-variable \
-Wno-pointer-sign \
-g \ -g \
%{hv_kvp_daemon}.c \ %{hv_kvp_daemon}.c \
-include %{hv_kvp_daemon}.h \ -include %{hv_kvp_daemon}.h \
@ -123,16 +128,20 @@ install -m755 %{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin
mkdir -p $RPM_BUILD_ROOT/etc/init.d mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -m755 %{S:11} $RPM_BUILD_ROOT/etc/init.d/%{hv_kvp_daemon} install -m755 %{S:11} $RPM_BUILD_ROOT/etc/init.d/%{hv_kvp_daemon}
ln -sfvbn ../../etc/init.d/%{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin/rc%{hv_kvp_daemon} ln -sfvbn ../../etc/init.d/%{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin/rc%{hv_kvp_daemon}
%if %{with_modprobe}
mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
install -m644 %SOURCE1 $RPM_BUILD_ROOT/etc/modprobe.d/hyperv_pvdrivers.conf install -m644 %SOURCE1 $RPM_BUILD_ROOT/etc/modprobe.d/hyperv_pvdrivers.conf
%endif
%files %files
%defattr (-,root,root) %defattr (-,root,root)
%doc kvptest.ps1.txt %doc kvptest.ps1.txt
%if %{with_modprobe}
%if !%{with_kmp} %if !%{with_kmp}
%dir /etc/modprobe.d %dir /etc/modprobe.d
%config /etc/modprobe.d/hyperv_pvdrivers.conf %config /etc/modprobe.d/hyperv_pvdrivers.conf
%endif %endif
%endif
/etc/init.d/%{hv_kvp_daemon} /etc/init.d/%{hv_kvp_daemon}
/usr/sbin/rc%{hv_kvp_daemon} /usr/sbin/rc%{hv_kvp_daemon}
/usr/sbin/%{hv_kvp_daemon} /usr/sbin/%{hv_kvp_daemon}

View File

@ -0,0 +1,22 @@
--- hv_kvp_daemon.c.orig 2012-05-16 20:11:10.000000000 +0200
+++ hv_kvp_daemon.c 2012-05-16 20:40:08.000000000 +0200
@@ -701,14 +701,16 @@ int main(void)
pfd.fd = fd;
while (1) {
+ struct sockaddr *addr_p = (struct sockaddr *) &addr;
+ socklen_t addr_l = sizeof(addr);
pfd.events = POLLIN;
pfd.revents = 0;
poll(&pfd, 1, -1);
- len = recv(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0);
+ len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0, addr_p, &addr_l);
- if (len < 0) {
- syslog(LOG_ERR, "recv failed; error:%d", len);
+ if (len < 0 || addr.nl_pid) {
+ syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s", addr.nl_pid, errno, strerror(errno));
close(fd);
return -1;
}