Bug 14343 - vfs_full_audit panics when accessing Samba
Summary: vfs_full_audit panics when accessing Samba
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: 4.12.1
Hardware: x64 Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
: 14347 (view as bug list)
Depends on:
Reported: 2020-04-10 13:24 UTC by yannick
Modified: 2020-04-21 08:03 UTC (History)
2 users (show)

See Also:

Panic fix patch (466 bytes, patch)
2020-04-10 13:24 UTC, yannick
no flags Details
git-am fix for master. (4.46 KB, patch)
2020-04-10 21:24 UTC, Jeremy Allison
no flags Details
git-am fix for master (4.46 KB, patch)
2020-04-10 23:26 UTC, Jeremy Allison
no flags Details
git-am fix for 4.12.next. (4.67 KB, patch)
2020-04-15 17:17 UTC, Jeremy Allison
vl: review+

Note You need to log in before you can comment on or make changes to this bug.
Description yannick 2020-04-10 13:24:06 UTC
Created attachment 15903 [details]
Panic fix patch

While trying out Samba 4.12.1 on Debian Buster I seem to have found a bug in the full_audit VFS module. When trying to open the Samba server in my file browser (Gnome3's Files) it gave me an error and the following PANIC is thrown:

[2020/04/10 10:52:20.242346,  0] ../../source3/lib/util.c:830(smb_panic_s3)
  PANIC (pid 16323): vfs_full_audit.c: name table not in sync with vfs_op_type enums

While comparing the enum and array I found that "SMB_VFS_OP_FCNTL" was missing in the array. The following patch adds it to the array, after this the full_audit VFS module seems to work as expected:

--- ../temp/samba-4.12.1/source3/modules/vfs_full_audit.c	2020-02-28 09:59:35.000000000 +0100
+++ source3/modules/vfs_full_audit.c	2020-04-10 11:08:39.246639916 +0200
@@ -295,6 +295,7 @@
 	{ SMB_VFS_OP_FALLOCATE,"fallocate" },
 	{ SMB_VFS_OP_LOCK,	"lock" },
 	{ SMB_VFS_OP_KERNEL_FLOCK,	"kernel_flock" },
+	{ SMB_VFS_OP_FCNTL,	"fcntl"},
 	{ SMB_VFS_OP_LINUX_SETLEASE, "linux_setlease" },
 	{ SMB_VFS_OP_GETLOCK,	"getlock" },
 	{ SMB_VFS_OP_SYMLINKAT,	"symlinkat" },

How to reproduce:

- Get Samba 4.12.1 on Debian Buster, compile it
- In smb.conf under [global] add:

vfs objects = full_audit
full_audit:prefix = %u|%I|%m|%S
full_audit:success = mkdir rename unlink rmdir open pwrite
full_audit:failure = none
full_audit:facility = local7
full_audit:priority = NOTICE

- Start smbd.service
- Access a share

Actual results:

Not able to access the share

Expected results:

Get a directory listing of whatever share I'm accessing
Comment 1 Jeremy Allison 2020-04-10 20:22:51 UTC
Good catch, thanks. Sorry for the problem. I'll get this into master and then back-ported to 4.12.next.
Comment 2 Jeremy Allison 2020-04-10 21:24:22 UTC
Created attachment 15904 [details]
git-am fix for master.

OK, here's what I've got in gitlab-CI for this. It adds a test that should make sure we don't ever fail to add the values to the correct array again.
Comment 3 Jeremy Allison 2020-04-10 23:26:09 UTC
Created attachment 15905 [details]
git-am fix for master

Fixed static declaration.
Comment 4 Jeremy Allison 2020-04-15 17:17:34 UTC
Created attachment 15913 [details]
git-am fix for 4.12.next.

Cherry-picked and back-ported from master. Only needed in 4.12.next.
Comment 5 Andrew Bartlett 2020-04-15 20:44:42 UTC
I like the use of the unit test to validate the arrays, nice work!
Comment 6 Jeremy Allison 2020-04-16 17:19:33 UTC
*** Bug 14347 has been marked as a duplicate of this bug. ***
Comment 7 Karolin Seeger 2020-04-17 08:55:02 UTC
Pushed to autobuild-v4-12-test.
Comment 8 Karolin Seeger 2020-04-21 08:03:01 UTC
Pushed to v4-12-test.
Closing out bug report.