[Yaffs] yaffs2 and xattr support

Top Page
Attachments:
Message as email
+ (text/plain)
+ getxattr-trace.txt (text/plain)
Delete this message
Reply to this message
Author: Ketil Froyn
Date:  
To: yaffs
Subject: [Yaffs] yaffs2 and xattr support
Hi,

I'm trying to get yaffs2 working on an Ubuntu VM for a proof of
concept, and after trying the bundled kernels with the current release
(Ubuntu 18.04) I looked at the kernel versions and gave Ubuntu 12.04
with kernel 3.2.79 a try. Yaffs2 (commit 3439fa4) compiled fine with
the 3.2.79 kernel. So I installed the new kernel with yaffs2 support,
and created a nandsim device which I mounted with yaffs2 (just an
empty filesystem). This seemed to be working fine.

However, when did something trivial like "ls -l" in the yaffs2 mount,
ls failed with the message "Killed". It turns out that a call to
lgetxattr() failed with a kernel oops. This happened every time. I've
attached a stack trace of such an oops.

I tried disabling yaffs xattr support during make menuconfig, but this
doesn't appear to really switch xattr support off, despite the config
variable being disabled in the .config file:

# CONFIG_YAFFS_XATTR is not set

I attempted to _really_ disable xattr support with this patch,
successfully this time:

--- a/yaffs_vfs_multi.c
+++ b/yaffs_vfs_multi.c
@@ -240,9 +240,11 @@ MODULE_PARM(yaffs_gc_control, "i");
#define YAFFS_USE_DIR_ITERATE
#endif

+#if 0
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0))
#define YAFFS_USE_XATTR
#endif
+#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
#define YAFFS_NEW_PROCFS


Now things appear to be working much better. Calls to lgetxattr()
return EOPNOTSUPP, and everything works.

So I suspect there are two issues at play here:

1. DIsabling yaffs xattr support in the kernel config doesn't really disable it
2. There's a kernel oops in the xattr code

Best regards, Ketil
yaffs: yaffs_readdir: starting at 0
yaffs: yaffs_readdir: entry . ino 257
yaffs: yaffs_readdir: entry .. ino 1
BUG: unable to handle kernel paging request at 00000001ea84a0b7
IP: [<ffffffffa02009da>] yaffs_getxattr+0x8a/0xc0 [yaffs]
PGD 1ea8d7067 PUD 0
Oops: 0000 [#1] SMP
CPU 0
Modules linked in: nandsim nand nand_ids nand_bch bch nand_ecc mtdblock mtd_blkdevs yaffs mtd vboxsf(O) joydev snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm snd_seq_midi snd_rawmidi usbhid hid snd_seq_midi_event snd_seq video snd_seq_device snd_timer vboxguest(O) psmouse serio_raw mac_hid snd soundcore snd_page_alloc i2c_piix4 bluetooth parport_pc ppdev lp parport e1000 ahci libahci pata_acpi

Pid: 2380, comm: ls Tainted: G           O 3.2.79yaffs-noxattr2+ #1 innotek GmbH VirtualBox/VirtualBox
RIP: 0010:[<ffffffffa02009da>]  [<ffffffffa02009da>] yaffs_getxattr+0x8a/0xc0 [yaffs]
RSP: 0018:ffff8801ea8a7d68  EFLAGS: 00010202
RAX: ffffffffffffffa1 RBX: ffff8801f0be5400 RCX: 00000000000000ff
RDX: ffff8801f0be5400 RSI: ffff8801ea8a7df0 RDI: ffff8801f20a2600
RBP: ffff8801ea8a7d98 R08: ffffffffa0200950 R09: ffff8801f0be5400
R10: ffff8801f0be5400 R11: 0000000000000206 R12: 00000000000000ff
R13: 00000001ea84a067 R14: 00000000000000ff R15: ffffffffa0200950
FS:  00007effe9acd7c0(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00000001ea84a0b7 CR3: 00000001ea8a2000 CR4: 00000000000406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process ls (pid: 2380, threadinfo ffff8801ea8a6000, task ffff8801f9b08000)
Stack:
 00000000000080d0 ffff8801ea8a7df0 ffff8801f20a2600 ffff8801f20ba470
 00000000000000ff ffff8801f0be5400 ffff8801ea8a7dd8 ffffffff81169678
 ffff8801f9b08000 00000000000000ff ffff8801f0be5400 ffff8801f20a2600
Call Trace:
 [<ffffffff81169678>] vfs_getxattr+0xa8/0xd0
 [<ffffffff81169751>] getxattr+0xb1/0x170
 [<ffffffff81137d00>] ? unfreeze_partials+0xf0/0x1a0
 [<ffffffff81152043>] ? putname+0x33/0x50
 [<ffffffff811568b3>] ? user_path_at_empty+0x63/0xa0
 [<ffffffff81063022>] ? ptrace_notify+0x52/0x70
 [<ffffffff8116a1be>] sys_lgetxattr+0x4e/0x70
 [<ffffffff815bdf0b>] tracesys+0xd9/0xde
Code: 89 f7 89 c3 e8 18 f8 ff ff f6 05 55 96 01 00 02 75 30 48 63 c3 4c 8b 65 e0 48 8b 5d d8 4c 8b 6d e8 4c 8b 75 f0 4c 8b 7d f8 c9 c3 <41> 8b 55 50 48 89 de 48 c7 c7 60 55 21 a0 31 c0 e8 f3 a2 3a e1 
RIP  [<ffffffffa02009da>] yaffs_getxattr+0x8a/0xc0 [yaffs]
 RSP <ffff8801ea8a7d68>
CR2: 00000001ea84a0b7
---[ end trace 229c6d4b2905a57f ]---