Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 511728 - app-crypt/efitools-1.4.2-r2 (Update) - patch to fix mount -l output parsing in kernel_variable_init()
Summary: app-crypt/efitools-1.4.2-r2 (Update) - patch to fix mount -l output parsing i...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Greg Kroah-Hartman (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-05-28 19:54 UTC by sakaki
Modified: 2016-05-21 18:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix "mount -l" parsing in kernel_variable_init() function (efitools-1.4.2-recognize-efivarfs.patch,593 bytes, patch)
2014-05-28 19:54 UTC, sakaki
Details | Diff
Ebuild modified to apply patch (inherit eutils etc.) (efitools-1.4.2-r2.ebuild,684 bytes, text/plain)
2014-05-28 19:55 UTC, sakaki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sakaki 2014-05-28 19:54:25 UTC
Created attachment 377792 [details, diff]
Patch to fix "mount -l" parsing in kernel_variable_init() function

Hello

efitools v1.4.2 has two serious bugs, which have fixes commited in git upstream but not yet available in a release tarball. Both affect the kernel_variable_init() function, which attempts to parse the output of "mount -l" to determine the path of the efivarfs filesystem. If this call fails, none of the efitools functions will work.

The two problems are:
1) Unless the efivarfs filesystem is the last line reported by mount -l, it will not be detected (fixed by commit 9af07a90a3e2246be5a7d01e3a037cfa731eb5dc upstream); and
2) If LVM is in use, mount -l can display an extra field in the output (such as '[root]', '[home]' etc) which messes up the parsing (fixed by commit c33fc28e6be00ac0bfae7fcff48170830a4730d8 upstream)

I have created a patch file (attached) which applies these commits from the 1.4.2 baseline, and a modified ebuild (as r2, also attached), which applies the patch (has eutils inherited, so that src_prepare() can call epatch()/epatch_user()). It passes repoman full.

The patch should go at the top level in the files/ directory, as usual.

If this bug report or the ebuild is in an incorrect format, apologies, this is my first submission!

Best

sakaki
Comment 1 sakaki 2014-05-28 19:55:22 UTC
Created attachment 377794 [details]
Ebuild modified to apply patch (inherit eutils etc.)
Comment 2 paul g. 2015-01-08 13:56:46 UTC
Maybe this could belong to here:

When I run "efi-readvar" (efitools (1.4.2-r1) latest in portage).  I get the error:

"No efivarfs filesystem is mounted"

but:
I can read the vars by "cat /sys/firmware/efi/efivars/db-.....".
and:

#lsmod
Module Size Used by
efivarfs 5294 0

#cat /etc/fstab
efivarfs /sys/firmware/efi/efivars efivarfs rw,relatime 0 0

#mount
...
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,relatime)
... 

Kernel: 3.16.5-aufs

I git compiled latest efitools (seems version is 1.5.1) which does work for me now. I dont know whats causeing this nor how to fix it.
Comment 3 sainz 2015-01-29 20:35:57 UTC
Very similar situation as paul g., my kernel is an hardened monolithic (latest longterm) and I can see the efivars in /sys/firmware/efi/efivars without needing to setup /etc/fstab, as the efivarfs is automatically managed by /etc/init.d/sysfs .

# zgrep EFI /proc/config.gz | grep VAR | grep -v ^#
CONFIG_EFI_VARS=y
CONFIG_EFI_VARS_PSTORE=y
CONFIG_EFIVAR_FS=y

# uname -r
3.14.29-hardened

# mount | grep ^efi
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)

# ls -l /sys/firmware/efi/efivars
total 0
-rw-r--r-- 1 root root    8 Jan 29 07:26 AcpiGlobalVariable-af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e
-rw-r--r-- 1 root root   85 Jan 29 07:26 AMITSESetup-c811fa38-42c8-4579-a9bb-60e94eddfb34
-rw-r--r-- 1 root root  122 Jan 29 07:26 Boot0002-8be4df61-93ca-11d2-aa0d-00e098032b8c
...

# efi-readvar 
No efivarfs filesystem is mounted

# eix efitools
[I] app-crypt/efitools
     Available versions:  (~)1.4.1 (~)1.4.1-r1 (~)1.4.1-r2 (~)1.4.2 (~)1.4.2-r1
     Installed versions:  1.4.2-r1(07:55:05 AM 01/29/2015)
...

A version bump would be nice.
Thanks
Comment 4 Gabriel Marcano 2015-02-16 23:18:07 UTC
For a version bump, try the ebuild in bug 533572. I believe the patch mentioned in this ebuild is incorporated in the upstream project now.
Comment 5 Gabriel Marcano 2015-02-16 23:22:49 UTC
(In reply to Gabriel Marcano from comment #4)
> For a version bump, try the ebuild in bug 533572. I believe the patch
> mentioned in this ebuild is incorporated in the upstream project now.

I meant to say the patch mentioned in this bug report.
Comment 6 Greg Kroah-Hartman (RETIRED) gentoo-dev 2016-05-21 18:09:39 UTC
resolved a while ago.