Merge changes from sid up to 3.2.41-1

Drop all changes to backported features and to rt.

svn path=/dists/trunk/linux/; revision=19940
This commit is contained in:
Ben Hutchings 2013-03-23 07:15:51 +00:00
commit 3937ca5280
29 changed files with 965 additions and 23 deletions

View File

@ -19,12 +19,15 @@ else
featureset=none
fi
eval "set -- $(getopt -n "$0" -- "f:j:s:" "$@")"
fuzz=0
eval "set -- $(getopt -n "$0" -o "f:j:s:" -l "fuzz:" -- "$@")"
while true; do
case "$1" in
-f) flavour="$2"; shift 2 ;;
-j) export MAKEFLAGS="$MAKEFLAGS -j$2"; shift 2 ;;
-s) featureset="$2"; shift 2 ;;
--fuzz) fuzz="$2"; shift 2;;
--) shift 1; break ;;
esac
done
@ -36,6 +39,7 @@ Options:
-f <flavour> specify the 'flavour' of kernel to build, e.g. 686-pae
-j <jobs> specify number of compiler jobs to run in parallel
-s <featureset> specify an optional featureset to apply, e.g. rt
--fuzz <num> set the maximum patch fuzz factor (default: 0)
EOF
exit 2
fi
@ -63,8 +67,9 @@ alias quilt='quilt --quiltrc -'
# Try to clean up any previous test patches
if [ "$featureset" = none ]; then
while quilt top 2>/dev/null | grep -q ^test/; do
quilt delete
while patch="$(quilt next 2>/dev/null || quilt top 2>/dev/null)" && \
[ "${patch#test/}" != "$patch" ]; do
quilt delete -r "$patch"
done
else
sed -i '/^test\//d' debian/patches/series-${featureset}
@ -89,7 +94,7 @@ for patch in "$@"; do
patch_abs="$(readlink -f "$patch")"
(cd "debian/build/source_${featureset}" && \
quilt import -P "test/$(basename "$patch")" "$patch_abs" && \
quilt push --fuzz=0)
quilt push --fuzz="$fuzz")
done
# Build selected binaries

150
debian/changelog vendored
View File

@ -427,6 +427,156 @@ linux-2.6 (3.3~rc6-1~experimental.1) experimental; urgency=low
-- Ben Hutchings <ben@decadent.org.uk> Sun, 04 Mar 2012 20:27:42 +0000
linux (3.2.41-1) unstable; urgency=low
* New upstream stable update:
http://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.2.40
- ext4: return ENOMEM if sb_getblk() fails
- ext4: fix possible use-after-free with AIO
- s390/kvm: Fix store status for ACRS/FPRS
- staging: comedi: disallow COMEDI_DEVCONFIG on non-board minors
- ext4: fix race in ext4_mb_add_n_trim()
- UBIFS: fix double free of ubifs_orphan objects
- hrtimer: Prevent hrtimer_enqueue_reprogram race
- nfsd: Fix memleak
- x86: Do not leak kernel page mapping locations
- USB: usb-storage: unusual_devs update for Super TOP SATA bridge
- posix-cpu-timers: Fix nanosleep task_struct leak
- NFSv4.1: Don't decode skipped layoutgets
- cgroup: fix exit() vs rmdir() race
- cpuset: fix cpuset_print_task_mems_allowed() vs rename() race
- ext4: fix xattr block allocation/release with bigalloc
- mm: fix pageblock bitmap allocation
- target: Add missing mapped_lun bounds checking during make_mappedlun
setup
- b43: Increase number of RX DMA slots
- posix-timer: Don't call idr_find() with out-of-range ID
- fs: Fix possible use-after-free with AIO
- powerpc/kexec: Disable hard IRQ before kexec
- mmu_notifier_unregister NULL Pointer deref and multiple ->release()
callouts
- tmpfs: fix use-after-free of mempolicy object (CVE-2013-1767)
- ocfs2: fix possible use-after-free with AIO
- ocfs2: fix ocfs2_init_security_and_acl() to initialize acl correctly
- ocfs2: ac->ac_allow_chain_relink=0 won't disable group relink
- idr: fix a subtle bug in idr_get_next()
- idr: make idr_get_next() good for rcu_read_lock()
- idr: fix top layer handling
- sysctl: fix null checking in bin_dn_node_address()
- nbd: fsync and kill block device on shutdown
- s390/timer: avoid overflow when programming clock comparator
(regression in 3.2.38)
- xen-pciback: rate limit error messages from xen_pcibk_enable_msi{,x}()
(CVE-2013-0231)
- xen-netback: correctly return errors from netbk_count_requests()
- xen-netback: cancel the credit timer when taking the vif down
- ipv6: use a stronger hash for tcp
- staging: comedi: ni_labpc: correct differential channel sequence for
AI commands
- staging: comedi: ni_labpc: set up command4 register *after* command3
- vhost: fix length for cross region descriptor (CVE-2013-0311)
http://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.2.41
- NFS: Don't allow NFS silly-renamed files to be deleted, no signal
- ARM: VFP: fix emulation of second VFP instruction
- md: fix two bugs when attempting to resize RAID0 array.
- proc connector: reject unprivileged listener bumps
- cifs: ensure that cifs_get_root() only traverses directories
- dm: fix truncated status strings
- hw_random: make buffer usable in scatterlist. (real fix for #701784)
- efi_pstore: Check remaining space with QueryVariableInfo() before
writing data
- efi: be more paranoid about available space when creating variables
(Closes: #703574)
- vfs: fix pipe counter breakage
- xen/pciback: Don't disable a PCI device that is already disabled.
- ALSA: seq: Fix missing error handling in snd_seq_timer_open()
- ext3: Fix format string issues (CVE-2013-1848)
- keys: fix race with concurrent install_user_keyrings() (CVE-2013-1792)
- USB: cdc-wdm: fix buffer overflow (CVE-2013-1860)
- signal: always clear sa_restorer on execve (CVE-2013-0914)
- crypto: user - fix info leaks in report API (CVE-2013-2546,
CVE-2013-2547, CVE-2013-2548)
- Fix: compat_rw_copy_check_uvector() misuse in aio, readv, writev, and
security keys
- batman-adv: bat_socket_read missing checks
- batman-adv: Only write requested number of byte to user buffer
- mm/hotplug: correctly add new zone to all other nodes' zone lists
(CVE-2012-5517)
- btrfs: use rcu_barrier() to wait for bdev puts at unmount
[ Aurelien Jarno]
* [mips,mipsel] Disable VGA_CONSOLE and ignore the corresponding ABI
change. It is completely broken on MIPS.
* headers: Include Kbuild.platforms and Platform files in -common to
fix out-of-tree building on mips and mipsel.
* [{mips,mipsel}/{4,5}kc-malta] Enable HW_RANDOM as module so that both
flavours have a consistent configuration.
[ Ben Hutchings ]
* [x86] ata_piix: reenable MS Virtual PC guests (fixes regression in
3.2.19-1)
* test-patches: Clean up all previous test patches, whether or not they
were applied
* test-patches: Add --fuzz option to allow testing patches that have fuzz
* [x86] efi: Fix processor-specific memcpy() build error (Closes: #698581)
* udeb: Add hid-topseed to input-modules (Closes: #702611)
* [x86] drm/i915: Unconditionally initialise the interrupt workers,
thanks to Bjørn Mork (Closes: #692607)
* efi: Ensure efivars is loaded on EFI systems (Closes: #703363)
- [x86] Use a platform device to trigger loading of efivars
- [ia64] Change EFI_VARS from module to built-in
* efivars: Work around serious firmware bugs
- Allow disabling use as a pstore backend
- Add module parameter to disable use as a pstore backend
* [x86] Set EFI_VARS_PSTORE_DEFAULT_DISABLE=y
- explicitly calculate length of VariableName
- Handle duplicate names from get_next_variable()
* efi_pstore: Introducing workqueue updating sysfs
* efivars: pstore: Do not check size when erasing variable
* efivars: Remove check for 50% full on write
* kmsg_dump: Only dump kernel log in error cases (Closes: #703386)
- kexec: remove KMSG_DUMP_KEXEC
- kmsg_dump: don't run on non-error paths by default
* [x86] i915: initialize CADL in opregion (Closes: #703271)
* drm, agp: Update to 3.4.37:
- drm/radeon/dce6: fix display powergating
- drm: don't add inferred modes for monitors that don't support them
- drm/i915: Increase the RC6p threshold.
* signal: Fix use of missing sa_restorer field (build regression
introduced by fix for CVE-2013-0914)
* rds: limit the size allocated by rds_message_alloc()
* rtnl: fix info leak on RTM_GETLINK request for VF devices
* dcbnl: fix various netlink info leaks
* [s390] mm: fix flush_tlb_kernel_range()
* [powerpc] Fix cputable entry for 970MP rev 1.0
* vhost/net: fix heads usage of ubuf_info
* udf: avoid info leak on export (CVE-2012-6548)
* isofs: avoid info leak on export (CVE-2012-6549)
* [x86,powerpc/powerpc64] random: Change HW_RANDOM back from built-in to
module, as we now have a real fix for #701784
* [rt] Update to 3.2.40-rt60
-- Ben Hutchings <ben@decadent.org.uk> Sat, 23 Mar 2013 03:54:34 +0000
linux (3.2.39-2) unstable; urgency=high
* [s390,s390x] virtio: Ignore ABI changes in 3.2.39 (fixes FTBFS)
* [sparc] drm: Ignore ABI changes in 3.2.39 (fixes FTBFS)
* [sparc] drm: Change from built-in to module
* [rt] Update to 3.2.39-rt59:
- acpi/rt: Convert acpi_gbl_hardware lock back to a raw_spinlock_t
- printk: Fix rq->lock vs logbuf_lock unlock lock inversion
- wait-simple: Simple waitqueue implementation
- rcutiny: Use simple waitqueue
* [x86] efi: Fix ABI change for introduction of efi_enabled() function
in 3.2.38 (Closes: #701690)
* [armel/versatile] i2c: Re-enable I2C_PCA_PLATFORM as module, erroneously
disabled in 3.2.39-1 (fixes FTBFS)
* [x86,powerpc/powerpc64] random: Change HW_RANDOM from module to built-in,
to work around virtio-rng bug (Closes: #701784)
-- Ben Hutchings <ben@decadent.org.uk> Wed, 27 Feb 2013 03:48:30 +0000
linux (3.2.39-1) unstable; urgency=high
* New upstream stable update:

View File

@ -154,7 +154,7 @@ CONFIG_I2C=m
##
# CONFIG_I2C_ISCH is not set
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_PCA_PLATFORM is not set
CONFIG_I2C_PCA_PLATFORM=m
# CONFIG_I2C_SIMTEC is not set
CONFIG_I2C_VERSATILE=m

View File

@ -155,7 +155,8 @@ CONFIG_IPMI_POWEROFF=m
##
## file: drivers/firmware/Kconfig
##
CONFIG_EFI_VARS=m
CONFIG_EFI_VARS=y
CONFIG_EFI_VARS_PSTORE=y
CONFIG_DMIID=y
##

View File

@ -14,6 +14,11 @@ CONFIG_SECCOMP=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
##
## file: drivers/video/console/Kconfig
##
# CONFIG_VGA_CONSOLE is not set
##
## file: fs/ext2/Kconfig
##

View File

@ -406,6 +406,9 @@ CONFIG_EDAC_AMD8111=m
CONFIG_EDD=m
# CONFIG_EDD_OFF is not set
CONFIG_EFI_VARS=m
CONFIG_EFI_VARS_PSTORE=y
#. Runtime-disabled by default
CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE=y
CONFIG_DELL_RBU=m
CONFIG_DCDBAS=m
CONFIG_DMIID=y

View File

@ -6,4 +6,3 @@ CONFIG_CPU_BIG_ENDIAN=y
# CONFIG_CPU_LITTLE_ENDIAN is not set
## end choice
# CONFIG_RAPIDIO is not set

View File

@ -198,6 +198,11 @@ CONFIG_PPDEV=m
CONFIG_R3964=m
CONFIG_APPLICOM=m
##
## file: drivers/char/hw_random/Kconfig
##
CONFIG_HW_RANDOM=m
##
## file: drivers/char/ipmi/Kconfig
##
@ -1018,8 +1023,6 @@ CONFIG_FB_VIRTUAL=m
##
## file: drivers/video/console/Kconfig
##
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
# CONFIG_FONTS is not set

View File

@ -201,6 +201,11 @@ CONFIG_PPDEV=m
CONFIG_R3964=m
CONFIG_APPLICOM=m
##
## file: drivers/char/hw_random/Kconfig
##
CONFIG_HW_RANDOM=m
##
## file: drivers/char/ipmi/Kconfig
##
@ -1022,8 +1027,6 @@ CONFIG_FB_VIRTUAL=m
##
## file: drivers/video/console/Kconfig
##
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
# CONFIG_FONTS is not set

View File

@ -441,7 +441,6 @@ CONFIG_FB=y
##
## file: drivers/video/console/Kconfig
##
# CONFIG_VGA_CONSOLE is not set
# CONFIG_MDA_CONSOLE is not set
CONFIG_SGI_NEWPORT_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y

View File

@ -557,7 +557,6 @@ CONFIG_FB_GBE_MEM=4
##
## file: drivers/video/console/Kconfig
##
# CONFIG_VGA_CONSOLE is not set
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
# CONFIG_FONTS is not set

View File

@ -702,7 +702,6 @@ CONFIG_FB_TRIDENT=m
##
## file: drivers/video/console/Kconfig
##
# CONFIG_VGA_CONSOLE is not set
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
# CONFIG_FONTS is not set

View File

@ -708,7 +708,6 @@ CONFIG_FB_TRIDENT=m
##
## file: drivers/video/console/Kconfig
##
# CONFIG_VGA_CONSOLE is not set
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
# CONFIG_FONTS is not set

View File

@ -5,4 +5,3 @@
# CONFIG_CPU_BIG_ENDIAN is not set
CONFIG_CPU_LITTLE_ENDIAN=y
## end choice

View File

@ -126,6 +126,5 @@ CONFIG_BACKLIGHT_GENERIC=m
##
## file: drivers/video/console/Kconfig
##
# CONFIG_VGA_CONSOLE is not set
CONFIG_FRAMEBUFFER_CONSOLE=y

View File

@ -671,11 +671,6 @@ CONFIG_USB_MON=y
CONFIG_FB=m
CONFIG_FB_COBALT=m
##
## file: drivers/video/console/Kconfig
##
# CONFIG_VGA_CONSOLE is not set
##
## file: drivers/w1/Kconfig
##

View File

@ -68,7 +68,7 @@ CONFIG_PRINTER=m
##
## file: drivers/gpu/drm/Kconfig
##
CONFIG_DRM=y
CONFIG_DRM=m
CONFIG_DRM_TDFX=m
CONFIG_DRM_R128=m
CONFIG_DRM_RADEON=m

View File

@ -20,5 +20,6 @@ hid-quanta ?
hid-samsung ?
hid-speedlink ?
hid-sunplus ?
hid-topseed ?
synaptics_usb ?
wistron_btns ?

View File

@ -0,0 +1,160 @@
From: Seiji Aguchi <seiji.aguchi@hds.com>
Date: Tue, 12 Feb 2013 13:04:41 -0800
Subject: efi_pstore: Introducing workqueue updating sysfs
commit a93bc0c6e07ed9bac44700280e65e2945d864fd4 upstream.
[Problem]
efi_pstore creates sysfs entries, which enable users to access to NVRAM,
in a write callback. If a kernel panic happens in an interrupt context,
it may fail because it could sleep due to dynamic memory allocations during
creating sysfs entries.
[Patch Description]
This patch removes sysfs operations from a write callback by introducing
a workqueue updating sysfs entries which is scheduled after the write
callback is called.
Also, the workqueue is kicked in a just oops case.
A system will go down in other cases such as panic, clean shutdown and emergency
restart. And we don't need to create sysfs entries because there is no chance for
users to access to them.
efi_pstore will be robust against a kernel panic in an interrupt context with this patch.
Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
Acked-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
[bwh: Backported to 3.8: adjust context]
---
drivers/firmware/efivars.c | 85 +++++++++++++++++++++++++++++++++++++++++---
include/linux/efi.h | 3 +-
2 files changed, 82 insertions(+), 6 deletions(-)
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -165,6 +165,13 @@ efivar_create_sysfs_entry(struct efivars
efi_char16_t *variable_name,
efi_guid_t *vendor_guid);
+/*
+ * Prototype for workqueue functions updating sysfs entry
+ */
+
+static void efivar_update_sysfs_entries(struct work_struct *);
+static DECLARE_WORK(efivar_work, efivar_update_sysfs_entries);
+
/* Return the number of unicode characters in data */
static unsigned long
utf16_strnlen(efi_char16_t *s, size_t maxlength)
@@ -1428,11 +1435,8 @@ static int efi_pstore_write(enum pstore_
spin_unlock_irqrestore(&efivars->lock, flags);
- if (size)
- ret = efivar_create_sysfs_entry(efivars,
- utf16_strsize(efi_name,
- DUMP_NAME_LEN * 2),
- efi_name, &vendor);
+ if (reason == KMSG_DUMP_OOPS)
+ schedule_work(&efivar_work);
*id = part;
return ret;
@@ -1670,6 +1674,75 @@ static ssize_t efivar_delete(struct file
return count;
}
+static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor)
+{
+ struct efivar_entry *entry, *n;
+ struct efivars *efivars = &__efivars;
+ unsigned long strsize1, strsize2;
+ bool found = false;
+
+ strsize1 = utf16_strsize(variable_name, 1024);
+ list_for_each_entry_safe(entry, n, &efivars->list, list) {
+ strsize2 = utf16_strsize(entry->var.VariableName, 1024);
+ if (strsize1 == strsize2 &&
+ !memcmp(variable_name, &(entry->var.VariableName),
+ strsize2) &&
+ !efi_guidcmp(entry->var.VendorGuid,
+ *vendor)) {
+ found = true;
+ break;
+ }
+ }
+ return found;
+}
+
+static void efivar_update_sysfs_entries(struct work_struct *work)
+{
+ struct efivars *efivars = &__efivars;
+ efi_guid_t vendor;
+ efi_char16_t *variable_name;
+ unsigned long variable_name_size = 1024;
+ efi_status_t status = EFI_NOT_FOUND;
+ bool found;
+
+ /* Add new sysfs entries */
+ while (1) {
+ variable_name = kzalloc(variable_name_size, GFP_KERNEL);
+ if (!variable_name) {
+ pr_err("efivars: Memory allocation failed.\n");
+ return;
+ }
+
+ spin_lock_irq(&efivars->lock);
+ found = false;
+ while (1) {
+ variable_name_size = 1024;
+ status = efivars->ops->get_next_variable(
+ &variable_name_size,
+ variable_name,
+ &vendor);
+ if (status != EFI_SUCCESS) {
+ break;
+ } else {
+ if (!variable_is_present(variable_name,
+ &vendor)) {
+ found = true;
+ break;
+ }
+ }
+ }
+ spin_unlock_irq(&efivars->lock);
+
+ if (!found) {
+ kfree(variable_name);
+ break;
+ } else
+ efivar_create_sysfs_entry(efivars,
+ variable_name_size,
+ variable_name, &vendor);
+ }
+}
+
/*
* Let's not leave out systab information that snuck into
* the efivars driver
@@ -2000,6 +2073,8 @@ err_put:
static void __exit
efivars_exit(void)
{
+ cancel_work_sync(&efivar_work);
+
if (efi_enabled(EFI_RUNTIME_SERVICES)) {
unregister_efivars(&__efivars);
kobject_put(efi_kobj);
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -740,7 +740,8 @@ struct efivars {
* 1) ->list - adds, removals, reads, writes
* 2) ops.[gs]et_variable() calls.
* It must not be held when creating sysfs entries or calling kmalloc.
- * ops.get_next_variable() is only called from register_efivars(),
+ * ops.get_next_variable() is only called from register_efivars()
+ * or efivar_update_sysfs_entries(),
* which is protected by the BKL, so that path is safe.
*/
spinlock_t lock;

View File

@ -0,0 +1,75 @@
From: Seth Forshee <seth.forshee@canonical.com>
Date: Mon, 11 Mar 2013 16:17:50 -0500
Subject: efivars: Add module parameter to disable use as a pstore backend
commit ec0971ba5372a4dfa753f232449d23a8fd98490e upstream.
We know that with some firmware implementations writing too much data to
UEFI variables can lead to bricking machines. Recent changes attempt to
address this issue, but for some it may still be prudent to avoid
writing large amounts of data until the solution has been proven on a
wide variety of hardware.
Crash dumps or other data from pstore can potentially be a large data
source. Add a pstore_module parameter to efivars to allow disabling its
use as a backend for pstore. Also add a config option,
CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE, to allow setting the default
value of this paramter to true (i.e. disabled by default).
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
---
drivers/firmware/Kconfig | 9 +++++++++
drivers/firmware/efivars.c | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 898023d..42c759a 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -62,6 +62,15 @@ config EFI_VARS_PSTORE
will allow writing console messages, crash dumps, or anything
else supported by pstore to EFI variables.
+config EFI_VARS_PSTORE_DEFAULT_DISABLE
+ bool "Disable using efivars as a pstore backend by default"
+ depends on EFI_VARS_PSTORE
+ default n
+ help
+ Saying Y here will disable the use of efivars as a storage
+ backend for pstore by default. This setting can be overridden
+ using the efivars module's pstore_disable parameter.
+
config EFI_PCDP
bool "Console device selection via EFI PCDP or HCDP table"
depends on ACPI && EFI && IA64
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 37b6f24..6607daf 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -103,6 +103,11 @@ MODULE_VERSION(EFIVARS_VERSION);
*/
#define GUID_LEN 36
+static bool efivars_pstore_disable =
+ IS_ENABLED(EFI_VARS_PSTORE_DEFAULT_DISABLE);
+
+module_param_named(pstore_disable, efivars_pstore_disable, bool, 0644);
+
/*
* The maximum size of VariableName + Data = 1024
* Therefore, it's reasonable to save that much
@@ -2009,7 +2014,8 @@ int register_efivars(struct efivars *efivars,
if (error)
unregister_efivars(efivars);
- efivar_pstore_register(efivars);
+ if (!efivars_pstore_disable)
+ efivar_pstore_register(efivars);
register_filesystem(&efivarfs_type);

View File

@ -0,0 +1,140 @@
From: Seth Forshee <seth.forshee@canonical.com>
Date: Thu, 7 Mar 2013 11:40:17 -0600
Subject: efivars: Allow disabling use as a pstore backend
commit ed9dc8ce7a1c8115dba9483a9b51df8b63a2e0ef upstream.
Add a new option, CONFIG_EFI_VARS_PSTORE, which can be set to N to
avoid using efivars as a backend to pstore, as some users may want to
compile out the code completely.
Set the default to Y to maintain backwards compatability, since this
feature has always been enabled until now.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
---
drivers/firmware/Kconfig | 9 +++++++
drivers/firmware/efivars.c | 64 ++++++++++++++------------------------------
2 files changed, 29 insertions(+), 44 deletions(-)
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 9b00072..898023d 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -53,6 +53,15 @@ config EFI_VARS
Subsequent efibootmgr releases may be found at:
<http://linux.dell.com/efibootmgr>
+config EFI_VARS_PSTORE
+ bool "Register efivars backend for pstore"
+ depends on EFI_VARS && PSTORE
+ default y
+ help
+ Say Y here to enable use efivars as a backend to pstore. This
+ will allow writing console messages, crash dumps, or anything
+ else supported by pstore to EFI variables.
+
config EFI_PCDP
bool "Console device selection via EFI PCDP or HCDP table"
depends on ACPI && EFI && IA64
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index fe62aa3..37b6f24 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -1309,9 +1309,7 @@ static const struct inode_operations efivarfs_dir_inode_operations = {
.create = efivarfs_create,
};
-static struct pstore_info efi_pstore_info;
-
-#ifdef CONFIG_PSTORE
+#ifdef CONFIG_EFI_VARS_PSTORE
static int efi_pstore_open(struct pstore_info *psi)
{
@@ -1514,38 +1512,6 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
return 0;
}
-#else
-static int efi_pstore_open(struct pstore_info *psi)
-{
- return 0;
-}
-
-static int efi_pstore_close(struct pstore_info *psi)
-{
- return 0;
-}
-
-static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, int *count,
- struct timespec *timespec,
- char **buf, struct pstore_info *psi)
-{
- return -1;
-}
-
-static int efi_pstore_write(enum pstore_type_id type,
- enum kmsg_dump_reason reason, u64 *id,
- unsigned int part, int count, size_t size,
- struct pstore_info *psi)
-{
- return 0;
-}
-
-static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
- struct timespec time, struct pstore_info *psi)
-{
- return 0;
-}
-#endif
static struct pstore_info efi_pstore_info = {
.owner = THIS_MODULE,
@@ -1557,6 +1523,24 @@ static struct pstore_info efi_pstore_info = {
.erase = efi_pstore_erase,
};
+static void efivar_pstore_register(struct efivars *efivars)
+{
+ efivars->efi_pstore_info = efi_pstore_info;
+ efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL);
+ if (efivars->efi_pstore_info.buf) {
+ efivars->efi_pstore_info.bufsize = 1024;
+ efivars->efi_pstore_info.data = efivars;
+ spin_lock_init(&efivars->efi_pstore_info.buf_lock);
+ pstore_register(&efivars->efi_pstore_info);
+ }
+}
+#else
+static void efivar_pstore_register(struct efivars *efivars)
+{
+ return;
+}
+#endif
+
static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
@@ -2025,15 +2009,7 @@ int register_efivars(struct efivars *efivars,
if (error)
unregister_efivars(efivars);
- efivars->efi_pstore_info = efi_pstore_info;
-
- efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL);
- if (efivars->efi_pstore_info.buf) {
- efivars->efi_pstore_info.bufsize = 1024;
- efivars->efi_pstore_info.data = efivars;
- spin_lock_init(&efivars->efi_pstore_info.buf_lock);
- pstore_register(&efivars->efi_pstore_info);
- }
+ efivar_pstore_register(efivars);
register_filesystem(&efivarfs_type);

View File

@ -0,0 +1,24 @@
From: Ben Hutchings <ben@decadent.org.uk>
Date: Fri, 22 Mar 2013 19:43:53 +0000
Subject: efivars: Fix check for CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE
The 'CONFIG_' prefix is not implicit in IS_ENABLED().
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Seth Forshee <seth.forshee@canonical.com>
Cc: <stable@vger.kernel.org>
---
drivers/firmware/efivars.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -105,7 +105,7 @@ MODULE_ALIAS("platform:efivars");
#define GUID_LEN 36
static bool efivars_pstore_disable =
- IS_ENABLED(EFI_VARS_PSTORE_DEFAULT_DISABLE);
+ IS_ENABLED(CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE);
module_param_named(pstore_disable, efivars_pstore_disable, bool, 0644);

View File

@ -0,0 +1,156 @@
From: Matt Fleming <matt.fleming@intel.com>
Date: Thu, 7 Mar 2013 11:59:14 +0000
Subject: efivars: Handle duplicate names from get_next_variable()
commit e971318bbed610e28bb3fde9d548e6aaf0a6b02e upstream.
Some firmware exhibits a bug where the same VariableName and
VendorGuid values are returned on multiple invocations of
GetNextVariableName(). See,
https://bugzilla.kernel.org/show_bug.cgi?id=47631
As a consequence of such a bug, Andre reports hitting the following
WARN_ON() in the sysfs code after updating the BIOS on his, "Gigabyte
Technology Co., Ltd. To be filled by O.E.M./Z77X-UD3H, BIOS F19e
11/21/2012)" machine,
[ 0.581554] EFI Variables Facility v0.08 2004-May-17
[ 0.584914] ------------[ cut here ]------------
[ 0.585639] WARNING: at /home/andre/linux/fs/sysfs/dir.c:536 sysfs_add_one+0xd4/0x100()
[ 0.586381] Hardware name: To be filled by O.E.M.
[ 0.587123] sysfs: cannot create duplicate filename '/firmware/efi/vars/SbAslBufferPtrVar-01f33c25-764d-43ea-aeea-6b5a41f3f3e8'
[ 0.588694] Modules linked in:
[ 0.589484] Pid: 1, comm: swapper/0 Not tainted 3.8.0+ #7
[ 0.590280] Call Trace:
[ 0.591066] [<ffffffff81208954>] ? sysfs_add_one+0xd4/0x100
[ 0.591861] [<ffffffff810587bf>] warn_slowpath_common+0x7f/0xc0
[ 0.592650] [<ffffffff810588bc>] warn_slowpath_fmt+0x4c/0x50
[ 0.593429] [<ffffffff8134dd85>] ? strlcat+0x65/0x80
[ 0.594203] [<ffffffff81208954>] sysfs_add_one+0xd4/0x100
[ 0.594979] [<ffffffff81208b78>] create_dir+0x78/0xd0
[ 0.595753] [<ffffffff81208ec6>] sysfs_create_dir+0x86/0xe0
[ 0.596532] [<ffffffff81347e4c>] kobject_add_internal+0x9c/0x220
[ 0.597310] [<ffffffff81348307>] kobject_init_and_add+0x67/0x90
[ 0.598083] [<ffffffff81584a71>] ? efivar_create_sysfs_entry+0x61/0x1c0
[ 0.598859] [<ffffffff81584b2b>] efivar_create_sysfs_entry+0x11b/0x1c0
[ 0.599631] [<ffffffff8158517e>] register_efivars+0xde/0x420
[ 0.600395] [<ffffffff81d430a7>] ? edd_init+0x2f5/0x2f5
[ 0.601150] [<ffffffff81d4315f>] efivars_init+0xb8/0x104
[ 0.601903] [<ffffffff8100215a>] do_one_initcall+0x12a/0x180
[ 0.602659] [<ffffffff81d05d80>] kernel_init_freeable+0x13e/0x1c6
[ 0.603418] [<ffffffff81d05586>] ? loglevel+0x31/0x31
[ 0.604183] [<ffffffff816a6530>] ? rest_init+0x80/0x80
[ 0.604936] [<ffffffff816a653e>] kernel_init+0xe/0xf0
[ 0.605681] [<ffffffff816ce7ec>] ret_from_fork+0x7c/0xb0
[ 0.606414] [<ffffffff816a6530>] ? rest_init+0x80/0x80
[ 0.607143] ---[ end trace 1609741ab737eb29 ]---
There's not much we can do to work around and keep traversing the
variable list once we hit this firmware bug. Our only solution is to
terminate the loop because, as Lingzhu reports, some machines get
stuck when they encounter duplicate names,
> I had an IBM System x3100 M4 and x3850 X5 on which kernel would
> get stuck in infinite loop creating duplicate sysfs files because,
> for some reason, there are several duplicate boot entries in nvram
> getting GetNextVariableName into a circle of iteration (with
> period > 2).
Also disable the workqueue, as efivar_update_sysfs_entries() uses
GetNextVariableName() to figure out which variables have been created
since the last iteration. That algorithm isn't going to work if
GetNextVariableName() returns duplicates. Note that we don't disable
EFI variable creation completely on the affected machines, it's just
that any pstore dump-* files won't appear in sysfs until the next
boot.
Reported-by: Andre Heider <a.heider@gmail.com>
Reported-by: Lingzhu Xiang <lxiang@redhat.com>
Tested-by: Lingzhu Xiang <lxiang@redhat.com>
Cc: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
---
drivers/firmware/efivars.c | 48 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 1e9d9b9..d64661f 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -170,6 +170,7 @@ efivar_create_sysfs_entry(struct efivars *efivars,
static void efivar_update_sysfs_entries(struct work_struct *);
static DECLARE_WORK(efivar_work, efivar_update_sysfs_entries);
+static bool efivar_wq_enabled = true;
/* Return the number of unicode characters in data */
static unsigned long
@@ -1444,7 +1445,7 @@ static int efi_pstore_write(enum pstore_type_id type,
spin_unlock_irqrestore(&efivars->lock, flags);
- if (reason == KMSG_DUMP_OOPS)
+ if (reason == KMSG_DUMP_OOPS && efivar_wq_enabled)
schedule_work(&efivar_work);
*id = part;
@@ -1975,6 +1976,35 @@ void unregister_efivars(struct efivars *efivars)
}
EXPORT_SYMBOL_GPL(unregister_efivars);
+/*
+ * Print a warning when duplicate EFI variables are encountered and
+ * disable the sysfs workqueue since the firmware is buggy.
+ */
+static void dup_variable_bug(efi_char16_t *s16, efi_guid_t *vendor_guid,
+ unsigned long len16)
+{
+ size_t i, len8 = len16 / sizeof(efi_char16_t);
+ char *s8;
+
+ /*
+ * Disable the workqueue since the algorithm it uses for
+ * detecting new variables won't work with this buggy
+ * implementation of GetNextVariableName().
+ */
+ efivar_wq_enabled = false;
+
+ s8 = kzalloc(len8, GFP_KERNEL);
+ if (!s8)
+ return;
+
+ for (i = 0; i < len8; i++)
+ s8[i] = s16[i];
+
+ printk(KERN_WARNING "efivars: duplicate variable: %s-%pUl\n",
+ s8, vendor_guid);
+ kfree(s8);
+}
+
int register_efivars(struct efivars *efivars,
const struct efivar_operations *ops,
struct kobject *parent_kobj)
@@ -2025,6 +2055,22 @@ int register_efivars(struct efivars *efivars,
case EFI_SUCCESS:
variable_name_size = var_name_strnsize(variable_name,
variable_name_size);
+
+ /*
+ * Some firmware implementations return the
+ * same variable name on multiple calls to
+ * get_next_variable(). Terminate the loop
+ * immediately as there is no guarantee that
+ * we'll ever see a different variable name,
+ * and may end up looping here forever.
+ */
+ if (variable_is_present(variable_name, &vendor_guid)) {
+ dup_variable_bug(variable_name, &vendor_guid,
+ variable_name_size);
+ status = EFI_NOT_FOUND;
+ break;
+ }
+
efivar_create_sysfs_entry(efivars,
variable_name_size,
variable_name,

View File

@ -0,0 +1,101 @@
From: Matt Fleming <matt.fleming@intel.com>
Date: Fri, 1 Mar 2013 14:49:12 +0000
Subject: efivars: explicitly calculate length of VariableName
commit ec50bd32f1672d38ddce10fb1841cbfda89cfe9a upstream.
It's not wise to assume VariableNameSize represents the length of
VariableName, as not all firmware updates VariableNameSize in the same
way (some don't update it at all if EFI_SUCCESS is returned). There
are even implementations out there that update VariableNameSize with
values that are both larger than the string returned in VariableName
and smaller than the buffer passed to GetNextVariableName(), which
resulted in the following bug report from Michael Schroeder,
> On HP z220 system (firmware version 1.54), some EFI variables are
> incorrectly named :
>
> ls -d /sys/firmware/efi/vars/*8be4d* | grep -v -- -8be returns
> /sys/firmware/efi/vars/dbxDefault-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
> /sys/firmware/efi/vars/KEKDefault-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
> /sys/firmware/efi/vars/SecureBoot-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
> /sys/firmware/efi/vars/SetupMode-Information8be4df61-93ca-11d2-aa0d-00e098032b8c
The issue here is that because we blindly use VariableNameSize without
verifying its value, we can potentially read garbage values from the
buffer containing VariableName if VariableNameSize is larger than the
length of VariableName.
Since VariableName is a string, we can calculate its size by searching
for the terminating NULL character.
Reported-by: Frederic Crozat <fcrozat@suse.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Michael Schroeder <mls@suse.com>
Cc: Lee, Chun-Yi <jlee@suse.com>
Cc: Lingzhu Xiang <lxiang@redhat.com>
Cc: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
---
drivers/firmware/efivars.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -1044,6 +1044,31 @@ static bool variable_is_present(efi_char
return found;
}
+/*
+ * Returns the size of variable_name, in bytes, including the
+ * terminating NULL character, or variable_name_size if no NULL
+ * character is found among the first variable_name_size bytes.
+ */
+static unsigned long var_name_strnsize(efi_char16_t *variable_name,
+ unsigned long variable_name_size)
+{
+ unsigned long len;
+ efi_char16_t c;
+
+ /*
+ * The variable name is, by definition, a NULL-terminated
+ * string, so make absolutely sure that variable_name_size is
+ * the value we expect it to be. If not, return the real size.
+ */
+ for (len = 2; len <= variable_name_size; len += sizeof(c)) {
+ c = variable_name[(len / sizeof(c)) - 1];
+ if (!c)
+ break;
+ }
+
+ return min(len, variable_name_size);
+}
+
static void efivar_update_sysfs_entries(struct work_struct *work)
{
struct efivars *efivars = &__efivars;
@@ -1084,10 +1109,13 @@ static void efivar_update_sysfs_entries(
if (!found) {
kfree(variable_name);
break;
- } else
+ } else {
+ variable_name_size = var_name_strnsize(variable_name,
+ variable_name_size);
efivar_create_sysfs_entry(efivars,
variable_name_size,
variable_name, &vendor);
+ }
}
}
@@ -1318,6 +1346,8 @@ int register_efivars(struct efivars *efi
&vendor_guid);
switch (status) {
case EFI_SUCCESS:
+ variable_name_size = var_name_strnsize(variable_name,
+ variable_name_size);
efivar_create_sysfs_entry(efivars,
variable_name_size,
variable_name,

View File

@ -0,0 +1,31 @@
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Sun, 17 Mar 2013 02:46:09 +0000
Subject: vhost/net: fix heads usage of ubuf_info
commit 46aa92d1ba162b4b3d6b7102440e459d4e4ee255 upstream.
ubuf info allocator uses guest controlled head as an index,
so a malicious guest could put the same head entry in the ring twice,
and we will get two callbacks on the same value.
To fix use upend_idx which is guaranteed to be unique.
Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/vhost/net.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -339,7 +339,8 @@ static void handle_tx(struct vhost_net *
msg.msg_controllen = 0;
ubufs = NULL;
} else {
- struct ubuf_info *ubuf = &vq->ubuf_info[head];
+ struct ubuf_info *ubuf;
+ ubuf = vq->ubuf_info + vq->upend_idx;
vq->heads[vq->upend_idx].len =
VHOST_DMA_IN_PROGRESS;

View File

@ -0,0 +1,56 @@
From: Ben Hutchings <ben@decadent.org.uk>
Subject: x86/efi: Autoload efivars
Date: Mon, 18 Mar 2013 22:59:14 +0000
Bug-Debian: http://bugs.debian.org/703363
efivars is generally useful to have on EFI systems, and in some cases
it may be impossible to load it after a kernel upgrade in order to
complete a boot loader update. At the same time we don't want to
waste memory on non-EFI systems by making it built-in.
Instead, give it a module alias as if it's a platform driver, and
register a corresponding platform device whenever EFI runtime services
are available. This should trigger udev to load it.
---
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -41,6 +41,7 @@
#include <linux/io.h>
#include <linux/reboot.h>
#include <linux/bcd.h>
+#include <linux/platform_device.h>
#include <asm/setup.h>
#include <asm/efi.h>
@@ -762,6 +763,20 @@ void __init efi_late_init(void)
efi_bgrt_init();
}
+#ifdef CONFIG_EFI_VARS_MODULE
+static int __init efi_load_efivars(void)
+{
+ struct platform_device *pdev;
+
+ if (!efi_enabled(EFI_RUNTIME_SERVICES))
+ return 0;
+
+ pdev = platform_device_register_simple("efivars", 0, NULL, 0);
+ return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
+}
+device_initcall(efi_load_efivars);
+#endif
+
void __init efi_set_executable(efi_memory_desc_t *md, bool executable)
{
u64 addr, npages;
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -94,6 +94,7 @@ MODULE_AUTHOR("Matt Domsch <Matt_Domsch@
MODULE_DESCRIPTION("sysfs interface to EFI Variables");
MODULE_LICENSE("GPL");
MODULE_VERSION(EFIVARS_VERSION);
+MODULE_ALIAS("platform:efivars");
#define DUMP_NAME_LEN 52

View File

@ -0,0 +1,29 @@
From: Ben Hutchings <ben@decadent.org.uk>
Subject: efivars: Remove check for 50% full on write
Date: Sat, 23 Mar 2013 02:18:42 +0000
On my EFI-booting system (AMI firmware/Asus board), the firmware does
not garbage-collect the variable store until it is rather more than
50% full, and it also updates a variable at every boot. This check
means that variable writes are guaranteed to fail after the system has
booted more than a few hundred times.
Since pstore integration is now disabled by default in Debian, we will
not normally write that much data before rebooting and giving the
firmware a chance to garbage-collect the variable store. Therefore,
until the check can be restricted to known-bad systems, it seems less
risky to disable it for now.
---
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -439,8 +439,7 @@ check_var_size_locked(struct efivars *ef
if (status != EFI_SUCCESS)
return status;
- if (!storage_size || size > remaining_size || size > max_size ||
- (remaining_size - size) < (storage_size / 2))
+ if (!storage_size || size > remaining_size || size > max_size)
return EFI_OUT_OF_RESOURCES;
return status;

View File

@ -79,3 +79,12 @@ features/all/alx/alx-update-for-3.8.patch
bugfix/mips/mips-add-dependencies-for-have_arch_transparent_hugepage.patch
bugfix/all/signal-fix-use-of-missing-sa_restorer-field.patch
bugfix/all/kernel-signal.c-use-__ARCH_HAS_SA_RESTORER-instead-o.patch
debian/efi-autoload-efivars.patch
bugfix/all/vhost-net-fix-heads-usage-of-ubuf_info.patch
bugfix/all/efivars-Allow-disabling-use-as-a-pstore-backend.patch
bugfix/all/efivars-Add-module-parameter-to-disable-use-as-a-pst.patch
bugfix/all/efivars-Fix-check-for-CONFIG_EFI_VARS_PSTORE_DEFAULT.patch
bugfix/all/efi_pstore-Introducing-workqueue-updating-sysfs.patch
bugfix/all/efivars-explicitly-calculate-length-of-VariableName.patch
bugfix/all/efivars-Handle-duplicate-names-from-get_next_variabl.patch
debian/efivars-remove-check-for-50-full-on-write.patch

2
debian/rules.real vendored
View File

@ -234,6 +234,8 @@ install-headers_$(ARCH)_$(FEATURESET): $(STAMPS_DIR)/source_$(FEATURESET)
echo Makefile; \
find arch/$(KERNEL_ARCH) -maxdepth 1 -name 'Makefile*' -print; \
find arch/$(KERNEL_ARCH) -name 'module.lds' -print; \
find arch/$(KERNEL_ARCH)/Kbuild.platforms -print; \
find arch/$(KERNEL_ARCH) -name 'Platform' -print; \
find $$(find arch/$(KERNEL_ARCH) \( -name include -o -name scripts \) -type d -print) -print; \
find include -print; \
) \