Ecryptfs kernel BUG when saving file with Emacs

Bug #415252 reported by Øyvind Stegard
16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
eCryptfs
Fix Released
Medium
Tyler Hicks
ecryptfs-utils (Ubuntu)
Invalid
Undecided
Unassigned
Jaunty
Invalid
Undecided
Unassigned
linux (Ubuntu)
Fix Released
High
Unassigned
Jaunty
Fix Released
High
Surbhi Palande

Bug Description

SRU Justification:

Impact: Bug in the Ecryptfs disallowed saving the file under the ecryptfs directory ~/Private using Emacs.

Fix: The cherry picked patch from the upstream commit id "b0105eaefa7cce8f4a941d0fc6354b250d30e745" fixed this bug. Previous to this fix a cipher code was not recognized and as a result memory was not allocated to some pointer. However this pointer was freed without allocation. This fix, prevents the freeing of memory when it is not allocated for the case of this particular cipher.

Testcase: The reporter of the bug, has verified that this patch has fixed this bug for him.

===

Binary package hint: linux-image

Kernel BUG'ed on me when saving a file under ecryptfs directory ~/Private using Emacs.

Here's the kernel log output:
[204479.018768] ecryptfs_init_crypt_ctx: cryptfs: init_crypt_ctx(): Error initializing cipher [aes]
[204479.018778] ecryptfs_new_file_context: Error initializing cryptographic context for cipher [aes]: rc = [-4]
[204479.018785] ecryptfs_initialize_file: Error creating new file context; rc = [-4]
[204479.018967] ------------[ cut here ]------------
[204479.018973] kernel BUG at /build/buildd/linux-2.6.28/fs/ecryptfs/read_write.c:234!
[204479.018978] invalid opcode: 0000 [#1] SMP
[204479.018985] last sysfs file: /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rfkill/rfkill0/state
[204479.018992] Dumping ftrace buffer:
[204479.018997] (ftrace buffer empty)
[204479.019000] Modules linked in: aes_i586 aes_generic cdc_ether cdc_acm cdc_wdm usbnet mii usbhid binfmt_misc radeon ppdev drm bridge stp bnep input_polldev dm_crypt joydev lp parport snd_hda_intel arc4 ecb snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi iwl3945 snd_rawmidi snd_seq_midi_event pcmcia iTCO_wdt iTCO_vendor_support snd_seq mac80211 tifm_7xx1 psmouse snd_timer snd_seq_device pcspkr sdhci_pci sdhci video tifm_core output serio_raw yenta_socket rsrc_nonstatic pcmcia_core snd soundcore thinkpad_acpi led_class nvram intel_agp agpgart snd_page_alloc cfg80211 ohci1394 ieee1394 tg3 fbcon tileblit font bitblit softcursor
[204479.019112]
[204479.019117] Pid: 18182, comm: emacs Not tainted (2.6.28-15-generic #48-Ubuntu) 94503HG
[204479.019123] EIP: 0060:[<c026867d>] EFLAGS: 00010246 CPU: 0
[204479.019133] EIP is at ecryptfs_read_lower+0x7d/0xb0
[204479.019137] EAX: 00000000 EBX: 00000000 ECX: 00000000 EDX: 00000000
[204479.019143] ESI: 00000000 EDI: f675c500 EBP: d367bda4 ESP: d367bd80
[204479.019148] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[204479.019153] Process emacs (pid: 18182, ti=d367a000 task=dbe27110 task.ti=d367a000)
[204479.019158] Stack:
[204479.019161] d367bda4 00000296 c0269ea4 c200f23c ef873000 f675c65c ef873000 f675c740
[204479.019174] f675c500 d367bdc8 c0269ec6 00001000 f675c500 c4ed7330 f675c66c c4ed7330
[204479.019189] f675c740 d367be54 d367be04 c0266418 00000000 00000000 d367bde0 c05001f8
[204479.019204] Call Trace:
[204479.019208] [<c0269ea4>] ? ecryptfs_read_metadata+0x44/0x160
[204479.019217] [<c0269ec6>] ? ecryptfs_read_metadata+0x66/0x160
[204479.019225] [<c0266418>] ? ecryptfs_setattr+0xf8/0x1e0
[204479.019232] [<c05001f8>] ? _spin_lock+0x8/0x10
[204479.019240] [<c01d15e4>] ? fnotify_change+0x384/0x3b0
[204479.019248] [<c01c548c>] ? path_permission+0x2c/0x40
[204479.019256] [<c01bc941>] ? do_truncate+0x71/0x90
[204479.019263] [<c02a978a>] ? apparmor_path_permission+0x5a/0x80
[204479.019272] [<c01c5cfb>] ? may_open+0x18b/0x200
[204479.019279] [<c01c90e2>] ? do_filp_open+0x192/0x7b0
[204479.019287] [<c01d2230>] ? alloc_fd+0xe0/0x100
[204479.019294] [<c01bb9af>] ? do_sys_open+0x5f/0x130
[204479.019301] [<c01bbae9>] ? sys_open+0x29/0x40
[204479.019308] [<c0103f6b>] ? sysenter_do_call+0x12/0x2f
[204479.019316] Code: 55 ec e8 f7 58 f5 ff 89 c2 89 e0 25 00 e0 ff ff 89 58 18 31 db 85 d2 78 1d 8b 45 f0 e8 9d 68 29 00 89 d8 83 c4 18 5b 5e 5f 5d c3 <0f> 0b eb fe 8d b4 26 00 00 00 00 8b 45 08 bb ea ff ff ff 89 54
[204479.019397] EIP: [<c026867d>] ecryptfs_read_lower+0x7d/0xb0 SS:ESP 0068:d367bd80
[204479.019409] ---[ end trace 4f4b2efc3a7aabf0 ]---

Using Ubuntu Jaunty.

$ LANG=C apt-cache policy linux-image-2.6.28-15-generic
linux-image-2.6.28-15-generic:
  Installed: 2.6.28-15.48
  Candidate: 2.6.28-15.48
  Version table:
 *** 2.6.28-15.48 0
        500 http://archive.ubuntu.com jaunty-updates/main Packages
        100 /var/lib/dpkg/status

$ LANG=C apt-cache policy ecryptfs-utils
ecryptfs-utils:
  Installed: 73-0ubuntu6.1
  Candidate: 73-0ubuntu6.1
  Version table:
 *** 73-0ubuntu6.1 0
        500 http://archive.ubuntu.com jaunty-updates/main Packages
        500 http://archive.ubuntu.com jaunty-security/main Packages
        100 /var/lib/dpkg/status
     73-0ubuntu6 0
        500 http://archive.ubuntu.com jaunty/main Packages

description: updated
Revision history for this message
Øyvind Stegard (oyvindstegard) wrote :

It's completely reproducible. I am not able to save files under ~/Private when using Emacs. So it must be something Emacs does when saving that triggers the bug.

Revision history for this message
Andy Whitcroft (apw) wrote :

Kernel is Ooops'ing this is therefore a real kernel issue, not an issue with linux-meta. Moving to the right package.

affects: linux-meta (Ubuntu) → linux (Ubuntu)
Changed in linux (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Changed in ecryptfs-utils (Ubuntu):
status: New → Invalid
Changed in ecryptfs:
importance: Undecided → Medium
status: New → Triaged
tags: added: kernel
Changed in ecryptfs:
assignee: nobody → Tyler Hicks (tyhicks)
Revision history for this message
Tyler Hicks (tyhicks) wrote :

This patch was initially written to fix an fsfuzzer-induced bug. It also happens to address this bug.

Changed in ecryptfs:
status: Triaged → In Progress
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Tim-

Tyler has a fix committed to solve this. Can you git pull this fix for Karmic?

:-Dustin

Changed in linux (Ubuntu):
assignee: nobody → Tim Gardner (timg-tpi)
Revision history for this message
Tim Gardner (timg-tpi) wrote :

@Dustin - I'll get Stefan to have a look at this.

Changed in linux (Ubuntu):
assignee: Tim Gardner (timg-tpi) → Stefan Bader (stefan-bader-canonical)
importance: Medium → High
milestone: none → jaunty-updates
status: Triaged → In Progress
Changed in linux (Ubuntu Jaunty):
assignee: nobody → Stefan Bader (stefan-bader-canonical)
importance: Undecided → High
milestone: none → jaunty-updates
status: New → In Progress
Revision history for this message
Tyler Hicks (tyhicks) wrote :
Changed in ecryptfs:
status: In Progress → Fix Committed
Revision history for this message
Tyler Hicks (tyhicks) wrote :

Released in 2.6.32-rc1.

Changed in ecryptfs:
status: Fix Committed → Fix Released
Revision history for this message
Surbhi Palande (csurbhi) wrote :

@Øyvind Stegard or @anyone who has this bug:
Can you please check if the kernel at this location: http://people.canonical.com/~surbhi/bug415252/
fix this bug for you ?

Revision history for this message
Stefan Bader (smb) wrote :

For Karmic this has now come through importing the stable updates from upstream. For Jaunty we must go through the SRU process. Surbhi can you build test kernels which are based on Jaunty and make them available for verification?

Changed in linux (Ubuntu Jaunty):
assignee: Stefan Bader (stefan-bader-canonical) → Surbhi Palande (csurbhi)
Changed in linux (Ubuntu):
assignee: Stefan Bader (stefan-bader-canonical) → nobody
status: In Progress → Fix Released
milestone: jaunty-updates → none
Revision history for this message
Øyvind Stegard (oyvindstegard) wrote :

Would the Karmic-kernel work properly with a Jaunty-install ? If so, I could give it a test-spin. The best would of course be if I could get a Jaunty-based kernel including the patch for this problem. Don't have time to compile myself or install Karmic, sorry.

Revision history for this message
Stefan Bader (smb) wrote : Re: [Bug 415252] Re: Ecryptfs kernel BUG when saving file with Emacs

While a Karmic kernel would work, it would be good to have the Jaunty based
kernel tested as it comes by.

Revision history for this message
Surbhi Palande (csurbhi) wrote :

@Øyvind Stegard or @anyone who has this bug:
Can you please check if the jaunty based kernel at this location: http://people.canonical.com/~surbhi/bug415252/jaunty/ fixes this bug for you ?

Revision history for this message
Øyvind Stegard (oyvindstegard) wrote :

Yes, I'll give it a spin, probably later today.

Revision history for this message
Øyvind Stegard (oyvindstegard) wrote :

I can confirm that the kernel image found at http://people.canonical.com/~surbhi/bug415252/jaunty/ fixes the problem with saving files on ecryptfs-mount using Emacs.

Andy Whitcroft (apw)
description: updated
Andy Whitcroft (apw)
description: updated
Surbhi Palande (csurbhi)
Changed in linux (Ubuntu Jaunty):
status: In Progress → Won't Fix
status: Won't Fix → Fix Committed
Surbhi Palande (csurbhi)
Changed in ecryptfs-utils (Ubuntu Jaunty):
status: New → Invalid
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted linux into jaunty-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 2.6.28-16.57

---------------
linux (2.6.28-16.57) jaunty-proposed; urgency=low

  [ Leann Ogasawara ]

  * SAUCE: Enable speakers for Toshiba NB200 (Realtek ALC272)
    - LP: #438318
  * SAUCE: Toshiba NB200 (Realtek ALC272) mute speakers when headphones are
    plugged in
    - LP: #438318
  * SAUCE: Toshiba NB200 (Realtek ALC272) enable microphone
    - LP: #438318

linux (2.6.28-16.56) jaunty-proposed; urgency=low

  [ Upstream Kernel Changes ]

  * eCryptfs: Handle unrecognized tag 3 cipher codes
    - LP: #415252

  [ Zoltan Devai ]

  * Input: pcspkr - fix PIT lockup on some chipsets
    - LP: #227806
 -- Stefan Bader <email address hidden> Thu, 05 Nov 2009 12:01:41 +0100

Changed in linux (Ubuntu Jaunty):
status: Fix Committed → 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.