All of lore.kernel.org
 help / color / mirror / Atom feed
* rpmdeps buffer overflow
@ 2018-08-09 18:34 Marc Ferland
  2018-08-10 14:50 ` Marc Ferland
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Ferland @ 2018-08-09 18:34 UTC (permalink / raw)
  To: Yocto discussion list

Hi,

I'm creating a recipe for a precompiled SDK. This SDK contains various
precompiled libraries and executables. When I get to the packaging
step bitbake aborts with the following error:

ERROR: pylon-5.0.12-r0 do_package: Error executing a python function
in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:package_do_filedeps(d)
     0003:
File: '/vagrant/yocto/poky/meta/classes/package.bbclass', lineno:
1484, function: package_do_filedeps
     1480:            continue
     1481:        for files in chunks(pkgfiles[pkg], 100):
     1482:            pkglist.append((pkg, files, rpmdeps, pkgdest))
     1483:
 *** 1484:    processed = oe.utils.multiprocess_exec( pkglist,
oe.package.filedeprunner)
     1485:
     1486:    provides_files = {}
     1487:    requires_files = {}
     1488:
File: '/vagrant/yocto/poky/meta/lib/oe/utils.py', lineno: 240,
function: multiprocess_exec
     0236:        mapresult = pool.map_async(function, commands,
error_callback=failures)
     0237:
     0238:        pool.close()
     0239:        pool.join()
 *** 0240:        results = mapresult.get()
     0241:    except KeyboardInterrupt:
     0242:        pool.terminate()
     0243:        pool.join()
     0244:        raise
File: '/usr/lib/python3.6/multiprocessing/pool.py', lineno: 644, function: get
     0640:            raise TimeoutError
     0641:        if self._success:
     0642:            return self._value
     0643:        else:
 *** 0644:            raise self._value
     0645:
     0646:    def _set(self, i, obj):
     0647:        self._success, self._value = obj
     0648:        if self._callback and self._success:
Exception: subprocess.CalledProcessError: Command
'['/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/lib/rpm/rpmdeps',
'--alldeps', '/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/lib64/libpylon_TL_bcon-5.0.12.so',

REMOVED FOR BREVITY

'/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/bin/platforms/libqxcb.so']'
died with <Signals.SIGABRT: 6>.

Subprocess output:
*** buffer overflow detected ***:
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/lib/rpm/rpmdeps
terminated

ERROR: pylon-5.0.12-r0 do_package: Function failed: package_do_filedeps
ERROR: Logfile of failure stored in:
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/temp/log.do_package.30101
ERROR: Task (/vagrant/yocto/meta-telops/recipes-basler/pylon5/pylon_5.0.12.bb:do_package)
failed with exit code '1'

Digging a little deeper, it looks like certain files cause rpmdeps to
blowup. For example, issuing:

rpmdeps --alldeps
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/bin/libQt5Core.so.5.6.2

I get the expected:
  0 /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/bin/libQt5Core.so.5.6.2
    P libQt5Core.so.5(Qt_5_PRIVATE_API)(64bit)
    P libQt5Core.so.5(Qt_5)(64bit)
    P libQt5Core.so.5(Qt_5.0)(64bit)
    P libQt5Core.so.5(Qt_5.0)(64bit)
....

But running rpmdeps on one of their proprietary lib:
rpmdeps --alldeps
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/bin/libPylonQtBase.so.1.0.0
*** buffer overflow detected ***:
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/lib/rpm/rpmdeps
terminated
Aborted (core dumped)

Any idea of what might be causing this?

Marc


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rpmdeps buffer overflow
  2018-08-09 18:34 rpmdeps buffer overflow Marc Ferland
@ 2018-08-10 14:50 ` Marc Ferland
  2018-08-10 15:01   ` Alexander Kanavin
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Ferland @ 2018-08-10 14:50 UTC (permalink / raw)
  To: Yocto discussion list

On Thu, Aug 9, 2018 at 2:34 PM, Marc Ferland <marc.ferland@gmail.com> wrote:
> Hi,
>
> I'm creating a recipe for a precompiled SDK. This SDK contains various
> precompiled libraries and executables. When I get to the packaging
> step bitbake aborts with the following error:
>
> ERROR: pylon-5.0.12-r0 do_package: Error executing a python function
> in exec_python_func() autogenerated:
>
> The stack trace of python calls that resulted in this exception/failure was:
> File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
>      0001:
>  *** 0002:package_do_filedeps(d)
>      0003:
> File: '/vagrant/yocto/poky/meta/classes/package.bbclass', lineno:
> 1484, function: package_do_filedeps
>      1480:            continue
>      1481:        for files in chunks(pkgfiles[pkg], 100):
>      1482:            pkglist.append((pkg, files, rpmdeps, pkgdest))
>      1483:
>  *** 1484:    processed = oe.utils.multiprocess_exec( pkglist,
> oe.package.filedeprunner)
>      1485:
>      1486:    provides_files = {}
>      1487:    requires_files = {}
>      1488:
> File: '/vagrant/yocto/poky/meta/lib/oe/utils.py', lineno: 240,
> function: multiprocess_exec
>      0236:        mapresult = pool.map_async(function, commands,
> error_callback=failures)
>      0237:
>      0238:        pool.close()
>      0239:        pool.join()
>  *** 0240:        results = mapresult.get()
>      0241:    except KeyboardInterrupt:
>      0242:        pool.terminate()
>      0243:        pool.join()
>      0244:        raise
> File: '/usr/lib/python3.6/multiprocessing/pool.py', lineno: 644, function: get
>      0640:            raise TimeoutError
>      0641:        if self._success:
>      0642:            return self._value
>      0643:        else:
>  *** 0644:            raise self._value
>      0645:
>      0646:    def _set(self, i, obj):
>      0647:        self._success, self._value = obj
>      0648:        if self._callback and self._success:
> Exception: subprocess.CalledProcessError: Command
> '['/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/lib/rpm/rpmdeps',
> '--alldeps', '/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/lib64/libpylon_TL_bcon-5.0.12.so',
>
> REMOVED FOR BREVITY
>
> '/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/bin/platforms/libqxcb.so']'
> died with <Signals.SIGABRT: 6>.
>
> Subprocess output:
> *** buffer overflow detected ***:
> /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/lib/rpm/rpmdeps
> terminated
>
> ERROR: pylon-5.0.12-r0 do_package: Function failed: package_do_filedeps
> ERROR: Logfile of failure stored in:
> /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/temp/log.do_package.30101
> ERROR: Task (/vagrant/yocto/meta-telops/recipes-basler/pylon5/pylon_5.0.12.bb:do_package)
> failed with exit code '1'
>
> Digging a little deeper, it looks like certain files cause rpmdeps to
> blowup. For example, issuing:
>
> rpmdeps --alldeps
> /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/bin/libQt5Core.so.5.6.2
>
> I get the expected:
>   0 /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/bin/libQt5Core.so.5.6.2
>     P libQt5Core.so.5(Qt_5_PRIVATE_API)(64bit)
>     P libQt5Core.so.5(Qt_5)(64bit)
>     P libQt5Core.so.5(Qt_5.0)(64bit)
>     P libQt5Core.so.5(Qt_5.0)(64bit)
> ....
>
> But running rpmdeps on one of their proprietary lib:
> rpmdeps --alldeps
> /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/packages-split/pylon/opt/pylon5/bin/libPylonQtBase.so.1.0.0
> *** buffer overflow detected ***:
> /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/lib/rpm/rpmdeps
> terminated
> Aborted (core dumped)
>

Got a little bit further by disabling filedeps with
SKIP_FILEDEPS_${PN} = "1". Now I get a buffer overflow from rpmbuild:

ERROR: pylon-5.0.12-r0 do_package_write_rpm: Function failed:
BUILDSPEC (log file is located at
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/temp/log.do_package_write_rpm.32236)
ERROR: Logfile of failure stored in:
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/temp/log.do_package_write_rpm.32236
Log data follows:
| DEBUG: Executing python function sstate_task_prefunc
| DEBUG: Python function sstate_task_prefunc finished
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are
['virtual:native:/vagrant/yocto/poky/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb:do_populate_sysroot',
'virtual:native:/vagrant/yocto/poky/meta/recipes-devtools/rpm/rpm_git.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['pseudo-native',
'rpm-native', 'dbus-native', 'popt-native', 'bzip2-native',
'db-native', 'gnu-config-native', 'quilt-native', 'autoconf-native',
'xz-native', 'elfutils-native', 'automake-native', 'python3-native',
'gettext-minimal-native', 'nss-native', 'pkgconfig-native',
'file-native', 'libarchive-native', 'libtool-native', 'expat-native',
'm4-native', 'texinfo-dummy-native', 'zlib-native', 'sqlite3-native',
'openssl-native', 'readline-native', 'nspr-native', 'lzo-native',
'e2fsprogs-native', 'pigz-native', 'makedepend-native',
'cryptodev-linux-native', 'ncurses-native', 'util-linux-native',
'attr-native', 'util-macros-native', 'xproto-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing python function do_package_write_rpm
| DEBUG: Executing python function read_subpackage_metadata
| DEBUG: Python function read_subpackage_metadata finished
| DEBUG: Executing python function do_package_rpm
| DEBUG: Executing python function write_specfile
| NOTE: Creating EMPTY RPM Package for pylon-dbg
| NOTE: Not creating empty RPM package for pylon-staticdev
| NOTE: Creating RPM package for pylon-dev
| NOTE: Creating RPM package for pylon-doc
| NOTE: Not creating empty RPM package for pylon-locale
| NOTE: Creating RPM package for pylon
| NOTE: Creating RPM package for pylon
| DEBUG: Python function write_specfile finished
| DEBUG: PKGWRITEDIR:
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/deploy-rpms/aarch64
| DEBUG: Executing shell function BUILDSPEC
| Building target platforms: aarch64-poky-linux
| Building for target aarch64-poky-linux
| Processing files: pylon-5.0.12-r0.aarch64
| *** buffer overflow detected ***:
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/rpmbuild
terminated
| Aborted (core dumped)
| WARNING: exit code 134 from a shell command.
| DEBUG: Python function do_package_rpm finished
| DEBUG: Python function do_package_write_rpm finished
| ERROR: Function failed: BUILDSPEC (log file is located at
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/temp/log.do_package_write_rpm.32236)
ERROR: Task (/vagrant/yocto/meta-telops/recipes-basler/pylon5/pylon_5.0.12.bb:do_package_write_rpm)
failed with exit code '1'

Any help appreciated!

Regards,

Marc


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rpmdeps buffer overflow
  2018-08-10 14:50 ` Marc Ferland
@ 2018-08-10 15:01   ` Alexander Kanavin
  2018-08-10 17:41     ` Marc Ferland
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Kanavin @ 2018-08-10 15:01 UTC (permalink / raw)
  To: Marc Ferland; +Cc: Yocto discussion list

2018-08-10 16:50 GMT+02:00 Marc Ferland <marc.ferland@gmail.com>:
> | Processing files: pylon-5.0.12-r0.aarch64
> | *** buffer overflow detected ***:
> /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/rpmbuild
> terminated
> | Aborted (core dumped)

This is not a yocto issue, but a rpm issue. You need to deal with it
the hard way I'm afraid: inspect the core dump with gdb, and take the
result to rpm upstream.

Alex


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rpmdeps buffer overflow
  2018-08-10 15:01   ` Alexander Kanavin
@ 2018-08-10 17:41     ` Marc Ferland
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Ferland @ 2018-08-10 17:41 UTC (permalink / raw)
  To: alex.kanavin; +Cc: Yocto discussion list

On Fri, Aug 10, 2018 at 11:01 AM, Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
> 2018-08-10 16:50 GMT+02:00 Marc Ferland <marc.ferland@gmail.com>:
>> | Processing files: pylon-5.0.12-r0.aarch64
>> | *** buffer overflow detected ***:
>> /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/rpmbuild
>> terminated
>> | Aborted (core dumped)
>
> This is not a yocto issue, but a rpm issue. You need to deal with it
> the hard way I'm afraid: inspect the core dump with gdb, and take the
> result to rpm upstream.
>

Looking at the backtrace of rpmbuild in gdb I see that libmagic is the culprit:

*** buffer overflow detected ***:
/home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/rpmbuild
terminated

Program received signal SIGABRT, Aborted.
0x00007ffff6f6f66a in raise () from
/home/vagrant/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6
(gdb) bt
#0  0x00007ffff6f6f66a in raise () from
/home/vagrant/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6
#1  0x00007ffff6f70741 in abort () from
/home/vagrant/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6
#2  0x00007ffff6fb0a07 in ?? () from
/home/vagrant/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6
#3  0x00007ffff703dcde in ?? () from
/home/vagrant/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6
#4  0x00007ffff703dd11 in __fortify_fail () from
/home/vagrant/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6
#5  0x00007ffff703bdc0 in __chk_fail () from
/home/vagrant/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6
#6  0x00007ffff6d1e0b1 in ?? ()
   from /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/../lib/./libmagic.so.1
#7  0x00007ffff6d1f105 in ?? ()
   from /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/../lib/./libmagic.so.1
#8  0x00007ffff6d2a888 in ?? ()
   from /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/../lib/./libmagic.so.1
#9  0x00007ffff6d2c782 in ?? ()
   from /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/../lib/./libmagic.so.1
#10 0x00007ffff6d1fc43 in ?? ()
   from /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/../lib/./libmagic.so.1
#11 0x00007ffff7bca16d in rpmfcClassify ()
   from /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/../lib/librpmbuild.so.7
#12 0x00007ffff7bcab26 in ?? ()
   from /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/../lib/librpmbuild.so.7
#13 0x00007ffff7bbc671 in ?? ()
   from /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/../lib/librpmbuild.so.7
#14 0x00007ffff7bb8113 in ?? ()
   from /home/vagrant/build/tmp/work/aarch64-poky-linux/pylon/5.0.12-r0/recipe-sysroot-native/usr/bin/../lib/librpmbuild.so.7
#15 0x0000555555557abf in ?? ()
#16 0x0000555555557c5b in ?? ()

I did a quick test and bumped the file recipe (was 5.31 on rocko
branch) to 5.34 and the problem went away, no more buffer overflows
and now my recipe builds correctly.

Marc


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-10 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-09 18:34 rpmdeps buffer overflow Marc Ferland
2018-08-10 14:50 ` Marc Ferland
2018-08-10 15:01   ` Alexander Kanavin
2018-08-10 17:41     ` Marc Ferland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.