VirtualBox

Changeset 100498 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jul 11, 2023 7:51:53 AM (20 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
158279
Message:

Devices/EFI/Firmware: Workaround an issue in python causing the build to fail in a docker container when copying extended attributes blocked by SELinux, bugref:10400

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/Common/Misc.py

    r89983 r100498  
    6464#
    6565_TempInfs = []
     66
     67# VBox: BEGIN
     68#
     69#       Monkey patching copyxattr to also ignore errno.EACCES for older python versions.
     70#       Otherwise building in a docker container fails due to a PermissionError because SELinux
     71#       denies copying the security context extended attributes. This was just fixed 3 months ago
     72#       in python so all our python versions in the containers are too old to have it.
     73#
     74# [vbox@tinderlin ~]$ sudo ausearch -m AVC,USER_AVC -ts recent
     75# time->Tue Jul 11 07:44:16 2023
     76# type=AVC msg=audit(1689061456.361:1300563): avc:  denied  { relabelto } for  pid=1160256 comm="python3"
     77# name="PcdPeim.uni" dev="sda1" ino=186911506 scontext=system_u:system_r:container_t:s0:c100,c482
     78# tcontext=unconfined_u:object_r:container_file_t:s0 tclass=file permissive=0
     79#
     80# See for further reference:
     81#    https://github.com/python/cpython/issues/82814
     82#    https://bugs.python.org/issue38893
     83#    https://github.com/python/cpython/pull/21430
     84#
     85import errno
     86orig_copyxattr = shutil._copyxattr
     87def patched_copyxattr(src, dst, *, follow_symlinks=True):
     88    try:
     89        orig_copyxattr(src, dst, follow_symlinks=follow_symlinks)
     90    except OSError as ex:
     91        if ex.errno != errno.EACCES: raise
     92shutil._copyxattr = patched_copyxattr
     93# VBox: END
    6694
    6795def GetVariableOffset(mapfilepath, efifilepath, varnames):
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette