diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-10-03 00:54:45 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-10-18 16:09:35 +0300 |
commit | 004d49958a83b2ab92301b67134d6910313d94d8 (patch) | |
tree | 3ac325f55a24dad4ea8569be395fdb6b4a8248c8 /poky/scripts | |
parent | 6ad4e5bc647bd823fd10fca9022b7129df2fa369 (diff) | |
download | openbmc-004d49958a83b2ab92301b67134d6910313d94d8.tar.xz |
poky: sumo refresh 36d5cee56b..d240b885f2
Update poky to sumo HEAD.
Changqing Li (1):
libsndfile1: CVE-2018-13139
Chen Qi (2):
runqemu: add SIGTERM handler to make sure things are cleaned up
runqemu: fix handling of SIGTERM and the problem of line wrapping
Hongxu Jia (1):
nasm: fix CVE-2018-10016
Ioan-Adrian Ratiu (1):
rootfs: always update the opkg index
Jagadeesh Krishnanjanappa (1):
runqemu: exit gracefully with an error message if qemu system is not evaluated
Joe Slater (1):
libtiff: fix CVE-2017-17095
Khem Raj (1):
x264: Disable asm on musl/x86
Nicolas Dechesne (1):
checklayer: avoid recursive loop in add_layer_dependencies
Ola x Nilsson (1):
externalsrc.bbclass: Set BB_DONT_CACHE for non-target recipes
Richard Purdie (1):
recipes: Update git.gnome.org addresses after upstream changes
Sinan Kaya (3):
libxml2: CVE-2018-14404
python3: CVE-2018-1061
git: CVE-2018-11233
Change-Id: Ic2daa2803af197180e605346f59bab03f8264e19
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/scripts')
-rw-r--r-- | poky/scripts/lib/checklayer/__init__.py | 4 | ||||
-rwxr-xr-x | poky/scripts/runqemu | 42 |
2 files changed, 42 insertions, 4 deletions
diff --git a/poky/scripts/lib/checklayer/__init__.py b/poky/scripts/lib/checklayer/__init__.py index 2618416fab..7788041843 100644 --- a/poky/scripts/lib/checklayer/__init__.py +++ b/poky/scripts/lib/checklayer/__init__.py @@ -167,6 +167,10 @@ def add_layer_dependencies(bblayersconf, layer, layers, logger): # multiple errors at once if ret is not None and layer_depend not in ret: ret.append(layer_depend) + else: + # we might have processed this dependency already, in which case + # we should not do it again (avoid recursive loop) + continue # Recursively process... if 'collections' not in layer_depend: diff --git a/poky/scripts/runqemu b/poky/scripts/runqemu index d998494063..bd3aee0c2f 100755 --- a/poky/scripts/runqemu +++ b/poky/scripts/runqemu @@ -27,6 +27,7 @@ import fcntl import shutil import glob import configparser +import signal class RunQemuError(Exception): """Custom exception to raise on known errors.""" @@ -233,6 +234,10 @@ class BaseConfig(object): # slirp qemus are running. self.mac_tap = "52:54:00:12:34:" self.mac_slirp = "52:54:00:12:35:" + # pid of the actual qemu process + self.qemupid = None + # avoid cleanup twice + self.cleaned = False def acquire_lock(self, error=True): logger.debug("Acquiring lockfile %s..." % self.lock) @@ -1110,6 +1115,11 @@ class BaseConfig(object): qbsys = 'riscv64' elif mach == 'qemuriscv32': qbsys = 'riscv32' + else: + logger.error("Unable to determine QEMU PC System emulator for %s machine." % mach) + logger.error("As %s is not among valid QEMU machines such as," % mach) + logger.error("qemux86-64, qemux86, qemuarm64, qemuarm, qemumips64, qemumips64el, qemumipsel, qemumips, qemuppc") + raise RunQemuError("Set qb_system_name with suitable QEMU PC System emulator in .*qemuboot.conf.") return 'qemu-system-%s' % qbsys @@ -1189,6 +1199,7 @@ class BaseConfig(object): self.qemu_opt += " -serial mon:vc -serial null" def start_qemu(self): + import shlex if self.kernel: kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel, self.kernel_cmdline, self.kernel_cmdline_script, self.get('QB_KERNEL_CMDLINE_APPEND'), @@ -1198,12 +1209,25 @@ class BaseConfig(object): else: kernel_opts = "" cmd = "%s %s" % (self.qemu_opt, kernel_opts) + cmds = shlex.split(cmd) logger.info('Running %s\n' % cmd) - process = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) - if process.wait(): - logger.error("Failed to run qemu: %s", process.stderr.read().decode()) + process = subprocess.Popen(cmds, stderr=subprocess.PIPE) + self.qemupid = process.pid + retcode = process.wait() + if retcode: + if retcode == -signal.SIGTERM: + logger.info("Qemu terminated by SIGTERM") + else: + logger.error("Failed to run qemu: %s", process.stderr.read().decode()) def cleanup(self): + if self.cleaned: + return + + # avoid dealing with SIGTERM when cleanup function is running + signal.signal(signal.SIGTERM, signal.SIG_IGN) + + logger.info("Cleaning up") if self.cleantap: cmd = 'sudo %s %s %s' % (self.qemuifdown, self.tap, self.bindir_native) logger.debug('Running %s' % cmd) @@ -1227,6 +1251,8 @@ class BaseConfig(object): shutil.rmtree(self.rootfs) shutil.rmtree('%s.pseudo_state' % self.rootfs) + self.cleaned = True + def load_bitbake_env(self, mach=None): if self.bitbake_e: return @@ -1282,6 +1308,14 @@ def main(): return 0 try: config = BaseConfig() + + def sigterm_handler(signum, frame): + logger.info("SIGTERM received") + os.kill(config.qemupid, signal.SIGTERM) + config.cleanup() + subprocess.run(["tput", "smam"]) + signal.signal(signal.SIGTERM, sigterm_handler) + config.check_args() config.read_qemuboot() config.check_and_set() @@ -1300,8 +1334,8 @@ def main(): traceback.print_exc() return 1 finally: - print("Cleanup") config.cleanup() + subprocess.run(["tput", "smam"]) if __name__ == "__main__": sys.exit(main()) |