598a3740c6
virtualization on 32-bit exposes host crash CVE-2013-0151-xsa34.patch - bnc#797287 - VUL-0: Xen: XSA-35 (CVE-2013-0152) - Nested HVM exposes host to being driven out of memory by guest CVE-2013-0152-xsa35.patch - bnc#793717 - NetWare will not boot on Xen 4.2 xnloader.py domUloader.py pygrub-netware-xnloader.patch Removed reverse-24757-use-grant-references.patch - bnc#797523 - VUL-1: CVE-2012-6075: qemu / kvm-qemu: e1000 overflows under some conditions CVE-2012-6075-xsa41.patch - Mask the floating point exceptions for guests like NetWare on machines that support XSAVE. x86-fpu-context-conditional.patch - fate##313584: pass bios information to XEN HVM guest 26341-hvm-firmware-passthrough.patch 26342-hvm-firmware-passthrough.patch 26343-hvm-firmware-passthrough.patch 26344-hvm-firmware-passthrough.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=223
63 lines
1.8 KiB
Python
63 lines
1.8 KiB
Python
# NetWare-specific operations
|
|
#
|
|
# Copyright (c) 2013 Suse Linux Products.
|
|
# Author: Charles Arnold <carnold@suse.com>
|
|
#
|
|
# This software may be freely redistributed under the terms of the GNU
|
|
# general public license.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
# Binary patching of xnloader.sys
|
|
# For launching NetWare on Xen 4.2 and newer
|
|
|
|
import os, sys, base64
|
|
|
|
CODE_OFFSET=0x49F5
|
|
NUMBER_OF_CODE_BYTES=17
|
|
ORIGINAL_CODE="BA00080000C786FC1F0000FFFFFFFF31C9"
|
|
PATCHED_CODE="BAF8070000834C961CFFB9080000009090"
|
|
XNLOADER_SYS_MD5SUM="eb76cce2a2d45928ea2bf26e01430af2"
|
|
|
|
def patch_netware_loader(loader):
|
|
"""Open the given xnloader.sys file and patch the relevant code hunk."""
|
|
|
|
# domUloader calls this with all kernels so perhaps this is not the NetWare loader
|
|
md5sum_cmd = 'md5sum ' + loader
|
|
p = os.popen(md5sum_cmd)
|
|
sum = p.read().split()[0]
|
|
p.close()
|
|
if sum != XNLOADER_SYS_MD5SUM:
|
|
return
|
|
|
|
try:
|
|
fd = os.open(loader, os.O_RDWR)
|
|
except Exception, e:
|
|
print >>sys.stderr, e
|
|
raise
|
|
|
|
# Validate minimum size for I/O
|
|
stat = os.fstat(fd)
|
|
if stat.st_size < CODE_OFFSET+NUMBER_OF_CODE_BYTES:
|
|
os.close(fd)
|
|
return
|
|
|
|
# Seek to location of code hunk
|
|
os.lseek(fd, CODE_OFFSET, os.SEEK_SET)
|
|
|
|
# Read code bytes at offset
|
|
buf = os.read(fd, NUMBER_OF_CODE_BYTES)
|
|
|
|
code_as_hex = base64.b16encode(buf)
|
|
if code_as_hex == ORIGINAL_CODE:
|
|
# Seek back to start location of the code hunk
|
|
os.lseek(fd, CODE_OFFSET, os.SEEK_SET)
|
|
# Convert the PATCHED_CODE string to raw binary
|
|
code_as_bin = base64.b16decode(PATCHED_CODE)
|
|
# Write the patched code
|
|
os.write(fd, code_as_bin)
|
|
os.close(fd)
|
|
|