head 1.4; access; symbols pkgsrc-2013Q2:1.4.0.10 pkgsrc-2013Q2-base:1.4 pkgsrc-2012Q4:1.4.0.8 pkgsrc-2012Q4-base:1.4 pkgsrc-2011Q4:1.4.0.6 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q2:1.4.0.4 pkgsrc-2011Q2-base:1.4 pkgsrc-2009Q4:1.4.0.2 pkgsrc-2009Q4-base:1.4 pkgsrc-2009Q2:1.3.0.4 pkgsrc-2009Q2-base:1.3 pkgsrc-2009Q1:1.3.0.2 pkgsrc-2009Q1-base:1.3 pkgsrc-2008Q4:1.1.0.4 pkgsrc-2008Q4-base:1.1 pkgsrc-2008Q3:1.1.0.2; locks; strict; comment @# @; 1.4 date 2009.08.07.12.49.21; author cegger; state dead; branches; next 1.3; 1.3 date 2009.02.20.23.22.47; author cegger; state Exp; branches; next 1.2; 1.2 date 2009.01.13.13.48.33; author cegger; state dead; branches; next 1.1; 1.1 date 2008.10.08.19.13.41; author cegger; state Exp; branches 1.1.2.1; next ; 1.1.2.1 date 2008.10.08.19.13.41; author tron; state dead; branches; next 1.1.2.2; 1.1.2.2 date 2008.10.11.18.27.49; author tron; state Exp; branches; next ; desc @@ 1.4 log @Update to Xen 3.3.2. This is a mainenance release with a number of stability fixes. @ text @$NetBSD: patch-ga,v 1.3 2009/02/20 23:22:47 cegger Exp $ --- python/xen/xend/XendBootloader.py.orig 2009-01-05 11:26:59.000000000 +0000 +++ python/xen/xend/XendBootloader.py @@@@ -67,9 +67,23 @@@@ def bootloader(blexec, disk, dom, quiet # listening on the bootloader's fifo for the results. (m1, s1) = pty.openpty() - tty.setraw(m1); - fcntl.fcntl(m1, fcntl.F_SETFL, os.O_NDELAY); - os.close(s1) + + # On Solaris, the pty master side will get cranky if we try + # to write to it while there is no slave. To work around this, + # keep the slave descriptor open until we're done. Set it + # to raw terminal parameters, otherwise it will echo back + # characters, which will confuse the I/O loop below. + # Furthermore, a raw master pty device has no terminal + # semantics on Solaris, so don't try to set any attributes + # for it. + if os.uname()[0] != 'SunOS' and os.uname()[0] != 'NetBSD': + tty.setraw(m1) + os.close(s1) + else: + tty.setraw(s1) + + fcntl.fcntl(m1, fcntl.F_SETFL, os.O_NDELAY) + slavename = ptsname.ptsname(m1) dom.storeDom("console/tty", slavename) @@@@ -108,7 +122,11 @@@@ def bootloader(blexec, disk, dom, quiet # record that this domain is bootloading dom.bootloader_pid = child - tty.setraw(m2); + # On Solaris, the master pty side does not have terminal semantics, + # so don't try to set any attributes, as it will fail. + if os.uname()[0] != 'SunOS': + tty.setraw(m2); + fcntl.fcntl(m2, fcntl.F_SETFL, os.O_NDELAY); while True: try: @@@@ -117,32 +135,55 @@@@ def bootloader(blexec, disk, dom, quiet if e.errno == errno.EINTR: continue break + + fcntl.fcntl(r, fcntl.F_SETFL, os.O_NDELAY); + ret = "" inbuf=""; outbuf=""; + # filedescriptors: + # r - input from the bootloader (bootstring output) + # m1 - input/output from/to xenconsole + # m2 - input/output from/to pty that controls the bootloader + # The filedescriptors are NDELAY, so it's ok to try to read + # bigger chunks than may be available, to keep e.g. curses + # screen redraws in the bootloader efficient. m1 is the side that + # gets xenconsole input, which will be keystrokes, so a small number + # is sufficient. m2 is pygrub output, which will be curses screen + # updates, so a larger number (1024) is appropriate there. + # + # For writeable descriptors, only include them in the set for select + # if there is actual data to write, otherwise this would loop too fast, + # eating up CPU time. + while True: - sel = select.select([r, m1, m2], [m1, m2], []) + wsel = [] + if len(outbuf) != 0: + wsel = wsel + [m1] + if len(inbuf) != 0: + wsel = wsel + [m2] + sel = select.select([r, m1, m2], wsel, []) try: if m1 in sel[0]: - s = os.read(m1, 1) + s = os.read(m1, 16) inbuf += s - if m2 in sel[1] and len(inbuf) != 0: - os.write(m2, inbuf[0]) - inbuf = inbuf[1:] + if m2 in sel[1]: + n = os.write(m2, inbuf) + inbuf = inbuf[n:] except OSError, e: if e.errno == errno.EIO: pass try: if m2 in sel[0]: - s = os.read(m2, 1) + s = os.read(m2, 1024) outbuf += s - if m1 in sel[1] and len(outbuf) != 0: - os.write(m1, outbuf[0]) - outbuf = outbuf[1:] + if m1 in sel[1]: + n = os.write(m1, outbuf) + outbuf = outbuf[n:] except OSError, e: if e.errno == errno.EIO: pass if r in sel[0]: - s = os.read(r, 1) + s = os.read(r, 128) ret = ret + s if len(s) == 0: break @@@@ -152,6 +193,8 @@@@ def bootloader(blexec, disk, dom, quiet os.close(r) os.close(m2) os.close(m1) + if os.uname()[0] == 'SunOS' or os.uname()[0] == 'NetBSD': + os.close(s1) os.unlink(fifo) # Re-acquire the lock to cover the changes we're about to make @ 1.3 log @apply fixes from hannken@@ - make pygrub in interactive mode working (upstream c/s 18586) - PR port-xen/40675: make xen guest console visible (upstream c/s 18591) @ text @d1 1 a1 1 $NetBSD$ @ 1.2 log @Update to Xen 3.3.1. This is a mainenance release with a number of stability fixes. @ text @d1 1 a1 1 $NetBSD: patch-ga,v 1.1 2008/10/08 19:13:41 cegger Exp $ d3 115 a117 108 --- python/xen/xend/XendDomainInfo.py.orig 2008-08-22 09:49:08.000000000 +0000 +++ python/xen/xend/XendDomainInfo.py @@@@ -455,8 +455,8 @@@@ class XendDomainInfo: try: self._constructDomain() self._storeVmDetails() - self._createDevices() self._createChannels() + self._createDevices() self._storeDomDetails() self._endRestore() except: @@@@ -1232,31 +1232,6 @@@@ class XendDomainInfo: def permissionsVm(self, *args): return xstransact.SetPermissions(self.vmpath, *args) - - def _readVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.read(*paths) - - def _writeVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.write(*paths) - - def _removeVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.remove(*paths) - - def _gatherVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.gather(paths) - - def storeVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.store(*paths) - - def permissionsVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.set_permissions(*paths) - # # Function to update xenstore /dom/* # @@@@ -1304,8 +1279,11 @@@@ class XendDomainInfo: def _recreateDomFunc(self, t): t.remove() t.mkdir() - t.set_permissions({'dom' : self.domid}) + t.set_permissions({'dom' : self.domid, 'read' : True}) t.write('vm', self.vmpath) + for i in [ 'device', 'control', 'error' ]: + t.mkdir(i) + t.set_permissions(i, {'dom' : self.domid}) def _storeDomDetails(self): to_store = { @@@@ -2390,11 +2368,11 @@@@ class XendDomainInfo: paths = self._prepare_phantom_paths() - self._cleanupVm() if self.dompath is not None: self.destroyDomain() self._cleanup_phantom_devs(paths) + self._cleanupVm() if "transient" in self.info["other_config"] \ and bool(self.info["other_config"]["transient"]): @@@@ -2731,7 +2709,6 @@@@ class XendDomainInfo: self._writeVm(to_store) self._setVmPermissions() - def _setVmPermissions(self): """Allow the guest domain to read its UUID. We don't allow it to access any other entry, for security.""" @@@@ -2750,7 +2727,7 @@@@ class XendDomainInfo: log.warn("".join(traceback.format_stack())) return self._stateGet() else: - raise AttributeError() + raise AttributeError(name) def __setattr__(self, name, value): if name == "state": @@@@ -2864,12 +2841,6 @@@@ class XendDomainInfo: ignore_devices = ignore_store, legacy_only = legacy_only) - #if not ignore_store and self.dompath: - # vnc_port = self.readDom('console/vnc-port') - # if vnc_port is not None: - # result.append(['device', - # ['console', ['vnc-port', str(vnc_port)]]]) - return result # Xen API @@@@ -3135,7 +3106,7 @@@@ class XendDomainInfo: if not config.has_key('device'): devid = config.get('id') if devid != None: - config['device'] = 'eth%d' % devid + config['device'] = 'eth%s' % devid else: config['device'] = '' d119 1 @ 1.1 log @Apply changeset 18434 from upstream xen-3.3-testing tree. This fixes security issue http://secunia.com/advisories/32064/ @ text @d1 1 a1 1 $NetBSD$ @ 1.1.2.1 log @file patch-ga was added on branch pkgsrc-2008Q3 on 2008-10-11 18:27:49 +0000 @ text @d1 111 @ 1.1.2.2 log @Pullup ticket #2548 - requested by cegger xentools33: security patch Revisions pulled up: - sysutils/xentools33/Makefile 1.10 - sysutils/xentools33/distinfo 1.13 - sysutils/xentools33/patches/patch-ga 1.1 - sysutils/xentools33/patches/patch-gc 1.1 - sysutils/xentools33/patches/patch-gd 1.1 --- Module Name: pkgsrc Committed By: cegger Date: Wed Oct 8 19:13:41 UTC 2008 Modified Files: pkgsrc/sysutils/xentools33: Makefile distinfo Added Files: pkgsrc/sysutils/xentools33/patches: patch-ga patch-gb patch-gc patch-gd Log Message: Apply changeset 18434 from upstream xen-3.3-testing tree. This fixes security issue http://secunia.com/advisories/32064/ @ text @a0 111 $NetBSD: patch-ga,v 1.1 2008/10/08 19:13:41 cegger Exp $ --- python/xen/xend/XendDomainInfo.py.orig 2008-08-22 09:49:08.000000000 +0000 +++ python/xen/xend/XendDomainInfo.py @@@@ -455,8 +455,8 @@@@ class XendDomainInfo: try: self._constructDomain() self._storeVmDetails() - self._createDevices() self._createChannels() + self._createDevices() self._storeDomDetails() self._endRestore() except: @@@@ -1232,31 +1232,6 @@@@ class XendDomainInfo: def permissionsVm(self, *args): return xstransact.SetPermissions(self.vmpath, *args) - - def _readVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.read(*paths) - - def _writeVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.write(*paths) - - def _removeVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.remove(*paths) - - def _gatherVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.gather(paths) - - def storeVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.store(*paths) - - def permissionsVmTxn(self, transaction, *args): - paths = map(lambda x: self.vmpath + "/" + x, args) - return transaction.set_permissions(*paths) - # # Function to update xenstore /dom/* # @@@@ -1304,8 +1279,11 @@@@ class XendDomainInfo: def _recreateDomFunc(self, t): t.remove() t.mkdir() - t.set_permissions({'dom' : self.domid}) + t.set_permissions({'dom' : self.domid, 'read' : True}) t.write('vm', self.vmpath) + for i in [ 'device', 'control', 'error' ]: + t.mkdir(i) + t.set_permissions(i, {'dom' : self.domid}) def _storeDomDetails(self): to_store = { @@@@ -2390,11 +2368,11 @@@@ class XendDomainInfo: paths = self._prepare_phantom_paths() - self._cleanupVm() if self.dompath is not None: self.destroyDomain() self._cleanup_phantom_devs(paths) + self._cleanupVm() if "transient" in self.info["other_config"] \ and bool(self.info["other_config"]["transient"]): @@@@ -2731,7 +2709,6 @@@@ class XendDomainInfo: self._writeVm(to_store) self._setVmPermissions() - def _setVmPermissions(self): """Allow the guest domain to read its UUID. We don't allow it to access any other entry, for security.""" @@@@ -2750,7 +2727,7 @@@@ class XendDomainInfo: log.warn("".join(traceback.format_stack())) return self._stateGet() else: - raise AttributeError() + raise AttributeError(name) def __setattr__(self, name, value): if name == "state": @@@@ -2864,12 +2841,6 @@@@ class XendDomainInfo: ignore_devices = ignore_store, legacy_only = legacy_only) - #if not ignore_store and self.dompath: - # vnc_port = self.readDom('console/vnc-port') - # if vnc_port is not None: - # result.append(['device', - # ['console', ['vnc-port', str(vnc_port)]]]) - return result # Xen API @@@@ -3135,7 +3106,7 @@@@ class XendDomainInfo: if not config.has_key('device'): devid = config.get('id') if devid != None: - config['device'] = 'eth%d' % devid + config['device'] = 'eth%s' % devid else: config['device'] = '' @