summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/event.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2024-10-08 13:36:25 +0100
committerSteve Sakoman <steve@sakoman.com>2024-12-06 05:50:24 -0800
commitd77302b2fe94db6c132310771b7b97c7b534edec (patch)
tree9dfca5b2686eb7a96d6c53e4920502a0581efed4 /bitbake/lib/bb/event.py
parentfd5231a5445f0a61d3a7678d1980a94dc1c80544 (diff)
downloadpoky-d77302b2fe94db6c132310771b7b97c7b534edec.tar.gz
bitbake: Remove custom exception backtrace formatting
Removes the code in bitbake to show custom backtrace formatting for exceptions. In particular, the bitbake exception code prints function arguments, which while helpful is a security problem when passwords and other secrets can be passed as function arguments. As it turns out, the handling of the custom serialized exception stack frames was pretty much made obsolete by d7db75020ed ("event/msg: Pass formatted exceptions"), which changed the events to pass a preformatted stacktrack list of strings, but the passing of the serialized data was never removed. Change all the code to use the python traceback API to format exceptions instead of the custom code; conveniently traceback.format_exception() also returns a list of stack trace strings, so it can be used as a drop in replacement for bb.exception.format_exception() (Bitbake rev: c25e7ed128b9fd5b53d28d678238e2f3af52ef8b) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'bitbake/lib/bb/event.py')
-rw-r--r--bitbake/lib/bb/event.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 4761c86880..952c85c0bd 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -19,7 +19,6 @@ import sys
19import threading 19import threading
20import traceback 20import traceback
21 21
22import bb.exceptions
23import bb.utils 22import bb.utils
24 23
25# This is the pid for which we should generate the event. This is set when 24# This is the pid for which we should generate the event. This is set when
@@ -759,13 +758,7 @@ class LogHandler(logging.Handler):
759 758
760 def emit(self, record): 759 def emit(self, record):
761 if record.exc_info: 760 if record.exc_info:
762 etype, value, tb = record.exc_info 761 record.bb_exc_formatted = traceback.format_exception(*record.exc_info)
763 if hasattr(tb, 'tb_next'):
764 tb = list(bb.exceptions.extract_traceback(tb, context=3))
765 # Need to turn the value into something the logging system can pickle
766 record.bb_exc_info = (etype, value, tb)
767 record.bb_exc_formatted = bb.exceptions.format_exception(etype, value, tb, limit=5)
768 value = str(value)
769 record.exc_info = None 762 record.exc_info = None
770 fire(record, None) 763 fire(record, None)
771 764