<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/firmware/efivars.c, branch v3.4.2</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>efivars: Improve variable validation</title>
<updated>2012-05-04T00:19:19+00:00</updated>
<author>
<name>Matthew Garrett</name>
<email>mjg@redhat.com</email>
</author>
<published>2012-05-03T20:50:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=54b3a4d311c98ad94b737802a8b5f2c8c6bfd627'/>
<id>54b3a4d311c98ad94b737802a8b5f2c8c6bfd627</id>
<content type='text'>
Ben Hutchings pointed out that the validation in efivars was inadequate -
most obviously, an entry with size 0 would server as a DoS against the
kernel. Improve this based on his suggestions.

Signed-off-by: Matthew Garrett &lt;mjg@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ben Hutchings pointed out that the validation in efivars was inadequate -
most obviously, an entry with size 0 would server as a DoS against the
kernel. Improve this based on his suggestions.

Signed-off-by: Matthew Garrett &lt;mjg@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>efi: Validate UEFI boot variables</title>
<updated>2012-04-30T22:30:18+00:00</updated>
<author>
<name>Matthew Garrett</name>
<email>mjg@redhat.com</email>
</author>
<published>2012-04-30T20:11:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fec6c20b570bcf541e581fc97f2e0cbdb9725b98'/>
<id>fec6c20b570bcf541e581fc97f2e0cbdb9725b98</id>
<content type='text'>
A common flaw in UEFI systems is a refusal to POST triggered by a malformed
boot variable. Once in this state, machines may only be restored by
reflashing their firmware with an external hardware device. While this is
obviously a firmware bug, the serious nature of the outcome suggests that
operating systems should filter their variable writes in order to prevent
a malicious user from rendering the machine unusable.

Signed-off-by: Matthew Garrett &lt;mjg@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A common flaw in UEFI systems is a refusal to POST triggered by a malformed
boot variable. Once in this state, machines may only be restored by
reflashing their firmware with an external hardware device. While this is
obviously a firmware bug, the serious nature of the outcome suggests that
operating systems should filter their variable writes in order to prevent
a malicious user from rendering the machine unusable.

Signed-off-by: Matthew Garrett &lt;mjg@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux</title>
<updated>2012-01-07T02:03:02+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2012-01-07T02:03:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6ed23fd6c08b3ffa17c1f841098d2fa2ab3a59dd'/>
<id>6ed23fd6c08b3ffa17c1f841098d2fa2ab3a59dd</id>
<content type='text'>
* 'pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux:
  pstore: gracefully handle NULL pstore_info functions
  pstore: pass reason to backend write callback
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 'pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux:
  pstore: gracefully handle NULL pstore_info functions
  pstore: pass reason to backend write callback
</pre>
</div>
</content>
</entry>
<entry>
<title>efivars: add missing parameter to efi_pstore_read()</title>
<updated>2011-11-28T23:33:32+00:00</updated>
<author>
<name>Christoph Fritz</name>
<email>chf.fritz@googlemail.com</email>
</author>
<published>2011-11-28T22:49:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=eee628da2ee3cbba6f14696278c92a464239eea6'/>
<id>eee628da2ee3cbba6f14696278c92a464239eea6</id>
<content type='text'>
In the case where CONFIG_PSTORE=n, the function efi_pstore_read() doesn't
have the correct list of parameters. This patch provides a definition
of efi_pstore_read() with 'char **buf' added to fix this warning:
"drivers/firmware/efivars.c:609: warning: initialization from".

problem introduced in commit f6f8285132907757ef84ef8dae0a1244b8cde6ac

Signed-off-by: Christoph Fritz &lt;chf.fritz@googlemail.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the case where CONFIG_PSTORE=n, the function efi_pstore_read() doesn't
have the correct list of parameters. This patch provides a definition
of efi_pstore_read() with 'char **buf' added to fix this warning:
"drivers/firmware/efivars.c:609: warning: initialization from".

problem introduced in commit f6f8285132907757ef84ef8dae0a1244b8cde6ac

Signed-off-by: Christoph Fritz &lt;chf.fritz@googlemail.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pstore: pass reason to backend write callback</title>
<updated>2011-11-17T21:13:29+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2011-11-17T21:13:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3d6d8d20ec4fd3b256632edb373a9c504724b8a9'/>
<id>3d6d8d20ec4fd3b256632edb373a9c504724b8a9</id>
<content type='text'>
This allows a backend to filter on the dmesg reason as well as the pstore
reason. When ramoops is switched to pstore, this is needed since it has
no interest in storing non-crash dmesg details.

Drop pstore_write() as it has no users, and handling the "reason" here
has no obviously correct value.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This allows a backend to filter on the dmesg reason as well as the pstore
reason. When ramoops is switched to pstore, this is needed since it has
no interest in storing non-crash dmesg details.

Drop pstore_write() as it has no users, and handling the "reason" here
has no obviously correct value.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pstore: pass allocated memory region back to caller</title>
<updated>2011-11-17T20:58:07+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2011-11-17T20:58:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f6f8285132907757ef84ef8dae0a1244b8cde6ac'/>
<id>f6f8285132907757ef84ef8dae0a1244b8cde6ac</id>
<content type='text'>
The buf_lock cannot be held while populating the inodes, so make the backend
pass forward an allocated and filled buffer instead. This solves the following
backtrace. The effect is that "buf" is only ever used to notify the backends
that something was written to it, and shouldn't be used in the read path.

To replace the buf_lock during the read path, isolate the open/read/close
loop with a separate mutex to maintain serialized access to the backend.

Note that is is up to the pstore backend to cope if the (*write)() path is
called in the middle of the read path.

[   59.691019] BUG: sleeping function called from invalid context at .../mm/slub.c:847
[   59.691019] in_atomic(): 0, irqs_disabled(): 1, pid: 1819, name: mount
[   59.691019] Pid: 1819, comm: mount Not tainted 3.0.8 #1
[   59.691019] Call Trace:
[   59.691019]  [&lt;810252d5&gt;] __might_sleep+0xc3/0xca
[   59.691019]  [&lt;810a26e6&gt;] kmem_cache_alloc+0x32/0xf3
[   59.691019]  [&lt;810b53ac&gt;] ? __d_lookup_rcu+0x6f/0xf4
[   59.691019]  [&lt;810b68b1&gt;] alloc_inode+0x2a/0x64
[   59.691019]  [&lt;810b6903&gt;] new_inode+0x18/0x43
[   59.691019]  [&lt;81142447&gt;] pstore_get_inode.isra.1+0x11/0x98
[   59.691019]  [&lt;81142623&gt;] pstore_mkfile+0xae/0x26f
[   59.691019]  [&lt;810a2a66&gt;] ? kmem_cache_free+0x19/0xb1
[   59.691019]  [&lt;8116c821&gt;] ? ida_get_new_above+0x140/0x158
[   59.691019]  [&lt;811708ea&gt;] ? __init_rwsem+0x1e/0x2c
[   59.691019]  [&lt;810b67e8&gt;] ? inode_init_always+0x111/0x1b0
[   59.691019]  [&lt;8102127e&gt;] ? should_resched+0xd/0x27
[   59.691019]  [&lt;8137977f&gt;] ? _cond_resched+0xd/0x21
[   59.691019]  [&lt;81142abf&gt;] pstore_get_records+0x52/0xa7
[   59.691019]  [&lt;8114254b&gt;] pstore_fill_super+0x7d/0x91
[   59.691019]  [&lt;810a7ff5&gt;] mount_single+0x46/0x82
[   59.691019]  [&lt;8114231a&gt;] pstore_mount+0x15/0x17
[   59.691019]  [&lt;811424ce&gt;] ? pstore_get_inode.isra.1+0x98/0x98
[   59.691019]  [&lt;810a8199&gt;] mount_fs+0x5a/0x12d
[   59.691019]  [&lt;810b9174&gt;] ? alloc_vfsmnt+0xa4/0x14a
[   59.691019]  [&lt;810b9474&gt;] vfs_kern_mount+0x4f/0x7d
[   59.691019]  [&lt;810b9d7e&gt;] do_kern_mount+0x34/0xb2
[   59.691019]  [&lt;810bb15f&gt;] do_mount+0x5fc/0x64a
[   59.691019]  [&lt;810912fb&gt;] ? strndup_user+0x2e/0x3f
[   59.691019]  [&lt;810bb3cb&gt;] sys_mount+0x66/0x99
[   59.691019]  [&lt;8137b537&gt;] sysenter_do_call+0x12/0x26

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The buf_lock cannot be held while populating the inodes, so make the backend
pass forward an allocated and filled buffer instead. This solves the following
backtrace. The effect is that "buf" is only ever used to notify the backends
that something was written to it, and shouldn't be used in the read path.

To replace the buf_lock during the read path, isolate the open/read/close
loop with a separate mutex to maintain serialized access to the backend.

Note that is is up to the pstore backend to cope if the (*write)() path is
called in the middle of the read path.

[   59.691019] BUG: sleeping function called from invalid context at .../mm/slub.c:847
[   59.691019] in_atomic(): 0, irqs_disabled(): 1, pid: 1819, name: mount
[   59.691019] Pid: 1819, comm: mount Not tainted 3.0.8 #1
[   59.691019] Call Trace:
[   59.691019]  [&lt;810252d5&gt;] __might_sleep+0xc3/0xca
[   59.691019]  [&lt;810a26e6&gt;] kmem_cache_alloc+0x32/0xf3
[   59.691019]  [&lt;810b53ac&gt;] ? __d_lookup_rcu+0x6f/0xf4
[   59.691019]  [&lt;810b68b1&gt;] alloc_inode+0x2a/0x64
[   59.691019]  [&lt;810b6903&gt;] new_inode+0x18/0x43
[   59.691019]  [&lt;81142447&gt;] pstore_get_inode.isra.1+0x11/0x98
[   59.691019]  [&lt;81142623&gt;] pstore_mkfile+0xae/0x26f
[   59.691019]  [&lt;810a2a66&gt;] ? kmem_cache_free+0x19/0xb1
[   59.691019]  [&lt;8116c821&gt;] ? ida_get_new_above+0x140/0x158
[   59.691019]  [&lt;811708ea&gt;] ? __init_rwsem+0x1e/0x2c
[   59.691019]  [&lt;810b67e8&gt;] ? inode_init_always+0x111/0x1b0
[   59.691019]  [&lt;8102127e&gt;] ? should_resched+0xd/0x27
[   59.691019]  [&lt;8137977f&gt;] ? _cond_resched+0xd/0x21
[   59.691019]  [&lt;81142abf&gt;] pstore_get_records+0x52/0xa7
[   59.691019]  [&lt;8114254b&gt;] pstore_fill_super+0x7d/0x91
[   59.691019]  [&lt;810a7ff5&gt;] mount_single+0x46/0x82
[   59.691019]  [&lt;8114231a&gt;] pstore_mount+0x15/0x17
[   59.691019]  [&lt;811424ce&gt;] ? pstore_get_inode.isra.1+0x98/0x98
[   59.691019]  [&lt;810a8199&gt;] mount_fs+0x5a/0x12d
[   59.691019]  [&lt;810b9174&gt;] ? alloc_vfsmnt+0xa4/0x14a
[   59.691019]  [&lt;810b9474&gt;] vfs_kern_mount+0x4f/0x7d
[   59.691019]  [&lt;810b9d7e&gt;] do_kern_mount+0x34/0xb2
[   59.691019]  [&lt;810bb15f&gt;] do_mount+0x5fc/0x64a
[   59.691019]  [&lt;810912fb&gt;] ? strndup_user+0x2e/0x3f
[   59.691019]  [&lt;810bb3cb&gt;] sys_mount+0x66/0x99
[   59.691019]  [&lt;8137b537&gt;] sysenter_do_call+0x12/0x26

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pstore: make pstore write function return normal success/fail value</title>
<updated>2011-10-12T16:17:24+00:00</updated>
<author>
<name>Chen Gong</name>
<email>gong.chen@linux.intel.com</email>
</author>
<published>2011-10-12T16:17:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b238b8fa93353ab50c9a2b1e2fa47a0ab01c37cd'/>
<id>b238b8fa93353ab50c9a2b1e2fa47a0ab01c37cd</id>
<content type='text'>
Currently pstore write interface employs record id as return
value, but it is not enough because it can't tell caller if
the write operation is successful. Pass the record id back via
an argument pointer and return zero for success, non-zero for
failure.

Signed-off-by: Chen Gong &lt;gong.chen@linux.intel.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently pstore write interface employs record id as return
value, but it is not enough because it can't tell caller if
the write operation is successful. Pass the record id back via
an argument pointer and return zero for success, non-zero for
failure.

Signed-off-by: Chen Gong &lt;gong.chen@linux.intel.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pstore: change mutex locking to spin_locks</title>
<updated>2011-08-16T18:55:58+00:00</updated>
<author>
<name>Don Zickus</name>
<email>dzickus@redhat.com</email>
</author>
<published>2011-08-12T17:54:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=abd4d5587be911f63592537284dad78766d97d62'/>
<id>abd4d5587be911f63592537284dad78766d97d62</id>
<content type='text'>
pstore was using mutex locking to protect read/write access to the
backend plug-ins.  This causes problems when pstore is executed in
an NMI context through panic() -&gt; kmsg_dump().

This patch changes the mutex to a spin_lock_irqsave then also checks to
see if we are in an NMI context.  If we are in an NMI and can't get the
lock, just print a message stating that and blow by the locking.

All this is probably a hack around the bigger locking problem but it
solves my current situation of trying to sleep in an NMI context.

Tested by loading the lkdtm module and executing a HARDLOCKUP which
will cause the machine to panic inside the nmi handler.

Signed-off-by: Don Zickus &lt;dzickus@redhat.com&gt;
Acked-by: Matthew Garrett &lt;mjg@redhat.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
pstore was using mutex locking to protect read/write access to the
backend plug-ins.  This causes problems when pstore is executed in
an NMI context through panic() -&gt; kmsg_dump().

This patch changes the mutex to a spin_lock_irqsave then also checks to
see if we are in an NMI context.  If we are in an NMI and can't get the
lock, just print a message stating that and blow by the locking.

All this is probably a hack around the bigger locking problem but it
solves my current situation of trying to sleep in an NMI context.

Tested by loading the lkdtm module and executing a HARDLOCKUP which
will cause the machine to panic inside the nmi handler.

Signed-off-by: Don Zickus &lt;dzickus@redhat.com&gt;
Acked-by: Matthew Garrett &lt;mjg@redhat.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>efivars: fix warnings when CONFIG_PSTORE=n</title>
<updated>2011-08-02T22:08:30+00:00</updated>
<author>
<name>Tony Luck</name>
<email>tony.luck@intel.com</email>
</author>
<published>2011-08-02T22:08:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b728a5c806fb36f9adebf2a862bbd015e074afca'/>
<id>b728a5c806fb36f9adebf2a862bbd015e074afca</id>
<content type='text'>
drivers/firmware/efivars.c:161: warning: ‘utf16_strlen’ defined but not used
utf16_strlen() is only used inside CONFIG_PSTORE - make this "static inline"
to shut the compiler up [thanks to hpa for the suggestion].

drivers/firmware/efivars.c:602: warning: initialization from incompatible pointer type
Between v1 and v2 of this patch series we decided to make the "part" number
unsigned - but missed fixing the stub version of efi_pstore_write()

Acked-by: Matthew Garrett &lt;mjg@redhat.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
drivers/firmware/efivars.c:161: warning: ‘utf16_strlen’ defined but not used
utf16_strlen() is only used inside CONFIG_PSTORE - make this "static inline"
to shut the compiler up [thanks to hpa for the suggestion].

drivers/firmware/efivars.c:602: warning: initialization from incompatible pointer type
Between v1 and v2 of this patch series we decided to make the "part" number
unsigned - but missed fixing the stub version of efi_pstore_write()

Acked-by: Matthew Garrett &lt;mjg@redhat.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>efivars: Introduce PSTORE_EFI_ATTRIBUTES</title>
<updated>2011-07-22T23:15:49+00:00</updated>
<author>
<name>Mike Waychison</name>
<email>mikew@google.com</email>
</author>
<published>2011-07-21T20:58:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7644c16c7e7431fa398e834109dbb76dc1b51617'/>
<id>7644c16c7e7431fa398e834109dbb76dc1b51617</id>
<content type='text'>
Consolidate the attributes listed for pstore operations in one place,
PSTORE_EFI_ATTRIBUTES.

Signed-off-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Consolidate the attributes listed for pstore operations in one place,
PSTORE_EFI_ATTRIBUTES.

Signed-off-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
