[MIR] libblockdev

Bug #1735499 reported by Jeremy Bícha
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libblockdev (Ubuntu)
Fix Released
Undecided
Unassigned
udisks2 (Ubuntu)
Fix Released
Undecided
Ubuntu Security Team

Bug Description

Availability
============
Built for all supported architectures. In sync with Debian.

Rationale
=========
udisks2 2.7 uses the "libblockdev library for all low level storage management tasks instead of calling command line tools." libblockdev appears to have the same maintainers ("storaged project") as udisks2.

It would be nice to have the new version to support GNOME Disks 3.26's new Resize and Repair features.
http://pothos.blogsport.eu/2017/08/22/last-project-phase-and-3-26-features/

There is some interest in dropping Gparted from the Ubuntu live ISO since it does not support Wayland and it still uses gtk2.

Security
========
No known security issues

https://security-tracker.debian.org/tracker/source-package/libblockdev
https://launchpad.net/ubuntu/+source/libblockdev/+cve

Quality assurance
=================
- Ubuntu Desktop bugs is the subscriber (although the Desktop Team thinks that Foundations should be responsible for udisks and friends)

https://bugs.launchpad.net/ubuntu/+source/libblockdev
https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=libblockdev
https://github.com/storaged-project/libblockdev/issues

dh_auto_test is run but I guess it's not actually running the upstream test suite yet. (I think the upstream test suite needs to be run as autopkgtests)
See http://storaged.org/libblockdev/ch03.html

No autopkgtests

Dependencies
============
Debian's udisks2 recommends libblockdev-crypto2 which depends on the universe libvolume-key1 (source: volume-key)

It might be ok to temporarily not recommend that plugin until the MIR for volume-key is approved. (LP: #1754422). (This was done in
https://launchpad.net/ubuntu/+source/udisks2/2.7.6-2 )

Some of the other plugins depend on libbytesize, but we don't need those plugins in main yet.

Standards compliance
====================
4.1.1, debhelper compat 10, simple dh7 style rules

Maintenance
===========
Maintained in Debian by the Debian Utopia team, which is a small team focused on cross-desktop freedesktop.org stuff.

upstream:
https://github.com/storaged-project/libblockdev

Jeremy Bícha (jbicha)
description: updated
Jeremy Bícha (jbicha)
description: updated
Jeremy Bícha (jbicha)
tags: added: bionic upgrade-software-version
Jeremy Bícha (jbicha)
description: updated
description: updated
Revision history for this message
Matthias Klose (doko) wrote :

 - missing bug subscriber

 - why don't we build the plugin on s390x? The Debian comment is
   terse, and we should not diverge a library package across
   architectures.

  - warning: Depends field of package python-blockdev: unknown \
       substitution variable ${python2:Depends}
    That one doesn't exist, leaving the package without dependencies.

 - the package maybe should get a security review.

Changed in libblockdev (Ubuntu):
status: New → Incomplete
Revision history for this message
Jeremy Bícha (jbicha) wrote :

Ubuntu Desktop Bugs is subscribed now although the Desktop Team thinks that Foundations should be responsible for udisks-related packages.

python-blockdev issue fixed by dropping that unused Python2 package.

libblockdev is built the same across architectures. Upstream offers an extra s390 plugin that didn't work correctly and that has been disabled.

description: updated
Changed in libblockdev (Ubuntu):
status: Incomplete → New
Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

Security review team is not subscribed if it needs so.

Revision history for this message
Matthias Klose (doko) wrote :

also please add symbols files for the library files

Changed in libblockdev (Ubuntu):
assignee: nobody → Ubuntu Security Team (ubuntu-security)
status: New → Incomplete
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Imho, s390 plugin should be built. It should not bring any more additional runtime dependencies, but without it, none of the s390 hard drives could be operated on with this package.

Revision history for this message
Jeremy Bícha (jbicha) wrote :

Dimitri, we tried to get the s390 plugin to work but it caused the package to FTBFS on s390x. If you want it, you're welcome to fix the issue.

See for instance https://launchpad.net/ubuntu/+source/libblockdev/2.12-3

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

@jbicha

That include is deprecated, and this got fixed in 2.14, see NEWS entry
- Do not include s390utils/vtoc.h in s390 plugin

See how it builds fine in e.g.:

https://launchpadlibrarian.net/357610446/buildlog_ubuntu-bionic-s390x.libblockdev_2.14-3ubuntu1+ppa1_BUILDING.txt.gz
dh_missing --fail-missing
dh_missing: usr/lib/s390x-linux-gnu/libbd_s390.so.2.0.0 exists in debian/tmp but is not installed to anywhere
dh_missing: usr/lib/s390x-linux-gnu/libbd_s390.so.2 exists in debian/tmp but is not installed to anywhere
dh_missing: usr/lib/s390x-linux-gnu/libbd_s390.so exists in debian/tmp but is not installed to anywhere
dh_missing: usr/include/blockdev/s390.h exists in debian/tmp but is not installed to anywhere
dh_missing: missing files, aborting

Built correctly, just needs shipping in a package.

Revision history for this message
Jeremy Bícha (jbicha) wrote :

Dimitri,

Michael Biebl would rather not build the s390 plugin in Debian. He pointed to this comment which says that it's currently not used by udisks but only by Fedora/Red Hat-specific utilities.

https://github.com/storaged-project/libblockdev/pull/275#issuecomment-328516293

Changed in libblockdev (Ubuntu):
status: Incomplete → New
Revision history for this message
Jeremy Bícha (jbicha) wrote :

symbols have been added in 2.16-1 which should auto-sync to bionic-proposed soon.

Revision history for this message
Seth Arnold (seth-arnold) wrote :
Download full text (3.6 KiB)

I reviewed libblockdev version 2.16-2 as checked into bionic. This should
not be considered a full security audit but rather a quick gauge of
maintainability.

- libblockdev is a plugin-based library to work with block devices,
  providing an API based interface that knows how to either perform
  underlying operations directly or call the necessary command line
  applications as appropriate.

- There are no CVEs in our database

- Build-Depends: debhelper, libtool, dh-python, python3:any, libglib2.0-dev
  libgirepository1.0-dev, libcryptsetup-dev libdevmapper-dev libudev-dev
  libsystemd-dev, libdmraid-dev, libvolume-key-dev, libbytesize-dev,
  libnss3-dev libparted-dev libmount-dev libblkid-dev libpython3-dev,
  libkmod-dev gtk-doc-tools, gobject-introspection, pylint

- libblockdev does not itself daemonize
- no networking
- automatically generated pre/post inst/rm scripts
- no initscripts
- no dbus services
- no setuid files
- no executables in PATH
- no sudo fragments
- no udev rules
- There is a test suite; it is not run during the build. I suspect keeping
  this test suite disabled is the right approach.
- No cronjobs
- Noisy build logs, primarily from the documentation tools; not ideal, but
  at least not much from the code itself

- Several plugins execute helper tools; the glib helpers make the
  resulting code fairly complex, but it looks like the executions were
  carefully written
- memory management is careful; allocated memory is quickly freed when it
  is no longer used to simplify error handling
- normally 'files' being opened are block devices
- Logging functions looked careful
- No environment variable use
- Does not itself do cryptography -- drives LUKS, VeraCrypt, etc via
  helpers
- Does not do networking
- Does not use temporary files
- Does not use WebKit
- Does not use PolicyKit
- Does not use JavaScript
- Mostly clean cppcheck results; s390 code has legitimate errors:
  [src/plugins/s390.c:293]: (error) Used file that is not opened.
  [src/plugins/s390.c:293]: (error) Resource handle 'fd' freed twice.
  [src/plugins/s390.c:968]: (error) Resource leak: fd

The s390 code does not feel as mature as the rest of the code base.
I suspect a deeper inspection of the s390 sources would find more issues.
If it can be disabled without significant loss of functionality then I
recommend we disable it.

Security team ACK for promoting libblockdev to main.

Here's some notes I took while reviewing the code, in the hopes that they
are useful:

- bd_s390_dasd_online() double-closes fd, uses fd when it isn't open
- bd_s390_zfcp_offline() leaks fd in rc == EOF branch
- bd_s390_zfcp_online() calls fclose(fd) in a branch when fd is known to
  be NULL
- bd_s390_zfcp_scsi_offline() does not check fopen(hba_path, "r") for an
  error return
- bd_s390_zfcp_scsi_offline() does not check fopen(wwpn_path, "r") for an
  error return
- bd_s390_zfcp_scsi_offline() does not check fopen(lun_path, "r") for an
  error return

- bd_crypto_tc_open(), luks_format(), (and other functions) do not zero
  out secrets such as passwords. (This is difficult to do; the goal is not
  to be perfect, but to try. Simply adding memset_s() calls would be a
  step in th...

Read more...

Changed in libblockdev (Ubuntu):
assignee: Ubuntu Security Team (ubuntu-security) → nobody
Jeremy Bícha (jbicha)
description: updated
Jeremy Bícha (jbicha)
description: updated
description: updated
Jeremy Bícha (jbicha)
description: updated
Revision history for this message
Jeremy Bícha (jbicha) wrote :

Here are a list of libblockdev's binary packages that depend on universe packages that I think we don't need in main now.

libblockdev-plugins-all
libblockdev-btrfs2
libblockdev-btrfs-dev
libblockdev-crypto2
libblockdev-crypto-dev
libblockdev-kbd2
libblockdev-kbd-dev
libblockdev-lvm2
libblockdev-lvm-dev
libblockdev-mdraid2
libblockdev-mdraid-dev

crypto requires volume-key (LP: #1754422)
mdraid requires thin-provisioning-tools
btrfs, kbd, and mdraid requires libbytesize

I updated the supported seed so that these won't try to be automatically pulled in.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Ack on libblockdev, provided only the listed binaries are promoted.

udisks2 also deals with crypto even though the libblockdev- packages are not installed; I do believe it should be reviewed as well.

Changed in libblockdev (Ubuntu):
status: New → Fix Committed
Changed in udisks2 (Ubuntu):
assignee: nobody → Ubuntu Security Team (ubuntu-security)
Revision history for this message
Matthias Klose (doko) wrote :
Download full text (16.2 KiB)

Override component to main
libblockdev 2.16-2 in bionic: universe/misc -> main
gir1.2-blockdev-2.0 2.16-2 in bionic amd64: universe/introspection/optional/100% -> main
gir1.2-blockdev-2.0 2.16-2 in bionic arm64: universe/introspection/optional/100% -> main
gir1.2-blockdev-2.0 2.16-2 in bionic armhf: universe/introspection/optional/100% -> main
gir1.2-blockdev-2.0 2.16-2 in bionic i386: universe/introspection/optional/100% -> main
gir1.2-blockdev-2.0 2.16-2 in bionic ppc64el: universe/introspection/optional/100% -> main
gir1.2-blockdev-2.0 2.16-2 in bionic s390x: universe/introspection/optional/100% -> main
libblockdev-btrfs-dev 2.16-2 in bionic amd64: universe/libdevel/optional/100% -> main
libblockdev-btrfs-dev 2.16-2 in bionic arm64: universe/libdevel/optional/100% -> main
libblockdev-btrfs-dev 2.16-2 in bionic armhf: universe/libdevel/optional/100% -> main
libblockdev-btrfs-dev 2.16-2 in bionic i386: universe/libdevel/optional/100% -> main
libblockdev-btrfs-dev 2.16-2 in bionic ppc64el: universe/libdevel/optional/100% -> main
libblockdev-btrfs-dev 2.16-2 in bionic s390x: universe/libdevel/optional/100% -> main
libblockdev-btrfs2 2.16-2 in bionic amd64: universe/libs/optional/100% -> main
libblockdev-btrfs2 2.16-2 in bionic arm64: universe/libs/optional/100% -> main
libblockdev-btrfs2 2.16-2 in bionic armhf: universe/libs/optional/100% -> main
libblockdev-btrfs2 2.16-2 in bionic i386: universe/libs/optional/100% -> main
libblockdev-btrfs2 2.16-2 in bionic ppc64el: universe/libs/optional/100% -> main
libblockdev-btrfs2 2.16-2 in bionic s390x: universe/libs/optional/100% -> main
libblockdev-crypto-dev 2.16-2 in bionic amd64: universe/libdevel/optional/100% -> main
libblockdev-crypto-dev 2.16-2 in bionic arm64: universe/libdevel/optional/100% -> main
libblockdev-crypto-dev 2.16-2 in bionic armhf: universe/libdevel/optional/100% -> main
libblockdev-crypto-dev 2.16-2 in bionic i386: universe/libdevel/optional/100% -> main
libblockdev-crypto-dev 2.16-2 in bionic ppc64el: universe/libdevel/optional/100% -> main
libblockdev-crypto-dev 2.16-2 in bionic s390x: universe/libdevel/optional/100% -> main
libblockdev-crypto2 2.16-2 in bionic amd64: universe/libs/optional/100% -> main
libblockdev-crypto2 2.16-2 in bionic arm64: universe/libs/optional/100% -> main
libblockdev-crypto2 2.16-2 in bionic armhf: universe/libs/optional/100% -> main
libblockdev-crypto2 2.16-2 in bionic i386: universe/libs/optional/100% -> main
libblockdev-crypto2 2.16-2 in bionic ppc64el: universe/libs/optional/100% -> main
libblockdev-crypto2 2.16-2 in bionic s390x: universe/libs/optional/100% -> main
libblockdev-dev 2.16-2 in bionic amd64: universe/libdevel/optional/100% -> main
libblockdev-dev 2.16-2 in bionic arm64: universe/libdevel/optional/100% -> main
libblockdev-dev 2.16-2 in bionic armhf: universe/libdevel/optional/100% -> main
libblockdev-dev 2.16-2 in bionic i386: universe/libdevel/optional/100% -> main
libblockdev-dev 2.16-2 in bionic ppc64el: universe/libdevel/optional/100% -> main
libblockdev-dev 2.16-2 in bionic s390x: universe/libdevel/optional/100% -> main
libblockdev-dm-dev 2.16-2 in bionic amd64: universe/libdevel/optional/1...

Changed in libblockdev (Ubuntu):
status: Fix Committed → Fix Released
Changed in udisks2 (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.