Bug 519002

Summary: samba trying to access /var/www and /proc/sys/fs/binfmt_misc
Product: [Fedora] Fedora Reporter: Ian Pilcher <ipilcher>
Component: sambaAssignee: Simo Sorce <ssorce>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: gdeschner, ssorce
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-28 14:16:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
smb.conf none

Description Ian Pilcher 2009-08-24 14:56:58 UTC
Created attachment 358470 [details]
smb.conf

Description of problem:
I am constantly receiving these two SELinux denials:

node=home.icp.selfip.net type=AVC msg=audit(1251038647.328:1121): avc: denied { search } for pid=16459 comm="smbd" name="www" dev=dm-9 ino=115701 scontext=unconfined_u:system_r:smbd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=dir node=home.icp.selfip.net type=SYSCALL msg=audit(1251038647.328:1121): arch=c000003e syscall=4 success=no exit=-13 a0=7f20197533bd a1=7fffc17832d0 a2=7fffc17832d0 a3=3 items=0 ppid=16322 pid=16459 auid=500 uid=0 gid=0 euid=1001 suid=1001 fsuid=1001 egid=1001 sgid=1001 fsgid=1001 tty=(none) ses=32 comm="smbd" exe="/usr/sbin/smbd" subj=unconfined_u:system_r:smbd_t:s0 key=(null) 

node=home.icp.selfip.net type=AVC msg=audit(1251038647.328:1122): avc: denied { getattr } for pid=16459 comm="smbd" path="/proc/sys/fs/binfmt_misc" dev=binfmt_misc ino=1 scontext=unconfined_u:system_r:smbd_t:s0 tcontext=system_u:object_r:binfmt_misc_fs_t:s0 tclass=dir node=home.icp.selfip.net type=SYSCALL msg=audit(1251038647.328:1122): arch=c000003e syscall=4 success=no exit=-13 a0=7f20197533a5 a1=7fffc17832d0 a2=7fffc17832d0 a3=3 items=0 ppid=16322 pid=16459 auid=500 uid=0 gid=0 euid=1001 suid=1001 fsuid=1001 egid=1001 sgid=1001 fsgid=1001 tty=(none) ses=32 comm="smbd" exe="/usr/sbin/smbd" subj=unconfined_u:system_r:smbd_t:s0 key=(null) 

I cannot figure out why samba is trying to access these files.  There is
no reference to either location in my (attached) smb.conf.

Version-Release number of selected component (if applicable):
samba-3.3.2-0.33.fc11.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Set up samba server with attached smb.conf
  
Actual results:
Samba tries to access /var/www and /proc/sys/fs/binfmt_misc; SELinux
denials.

Expected results:
Samba should not try to access these locations; no SELinux messages.

Additional info:

Comment 1 Simo Sorce 2009-08-27 12:18:18 UTC
Do you have any symlink in the shared directories that may point out to these locations ?

When does this happen? can you correlate it with any activity on the samba shares ?

As far as I know there is nothing in Samba that would try to open /var/www or 
/proc on it's own.

Comment 2 Ian Pilcher 2009-08-31 15:12:56 UTC
(In reply to comment #1)
> Do you have any symlink in the shared directories that may point out to these
> locations ?

"find . -type l" returns no results in either of the shared directories.

> When does this happen? can you correlate it with any activity on the samba
> shares ?

It seems to only happen when the shares are accessed.  I can't say beyond that.

> As far as I know there is nothing in Samba that would try to open /var/www or 
> /proc on it's own.  

It's definitely weird.  How would I go about stracing Samba?

Comment 3 Simo Sorce 2009-08-31 15:32:29 UTC
Each connection spawns an smbd process
You can use smbcontrol to check which proess correspond to which connection and then attach strace to the process.

Comment 4 Ian Pilcher 2009-09-01 12:41:05 UTC
strace found this:

[pid 20782] open("/proc/mounts", O_RDONLY) = 27                                                                   
[pid 20782] fstat(27, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0                                                 
[pid 20782] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f70edbda000             
[pid 20782] read(27, "rootfs / rootfs rw 0 0\n/dev/root "..., 1024) = 952                                         
[pid 20782] read(27, ""..., 1024)       = 0                                                                       
[pid 20782] lseek(27, 0, SEEK_SET)      = 0                                                                       
[pid 20782] read(27, "rootfs / rootfs rw 0 0\n/dev/root "..., 1024) = 952                                         
[pid 20782] stat("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0                                              
[pid 20782] stat("/boot", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0                                          
[pid 20782] stat("/var/www/html/music", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0                            
[pid 20782] stat("/mnt/scratch", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0                           
[pid 20782] stat("/srv", {st_mode=S_IFDIR|0755, st_size=61440, ...}) = 0                                          
[pid 20782] close(27)                   = 0                                                                       
[pid 20782] munmap(0x7f70edbda000, 4096) = 0                                                                      
[pid 20782] geteuid()                   = 1000                                                                    
[pid 20782] stat(".", {st_mode=S_IFDIR|S_ISUID|S_ISVTX|0770, st_size=61440, ...}) = 0                             
[pid 20782] open("/etc/mtab", O_RDONLY) = 27                                                                      
[pid 20782] futex(0x7f70eab30020, FUTEX_WAKE_PRIVATE, 2147483647) = 0                                             
[pid 20782] fstat(27, {st_mode=S_IFREG|0644, st_size=538, ...}) = 0                                               
[pid 20782] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f70edbda000             
[pid 20782] read(27, "/dev/mapper/home_vg-f11_root_lv /"..., 4096) = 538                                          
[pid 20782] stat("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0                                              
[pid 20782] stat("/proc", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0                                             
[pid 20782] stat("/sys", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0                                              
[pid 20782] stat("/dev/pts", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0                                          
[pid 20782] stat("/boot", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0                                          
[pid 20782] stat("/dev/shm", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=100, ...}) = 0                                
[pid 20782] stat("/var/www/html/music", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0                            
[pid 20782] stat("/mnt/scratch", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0                           
[pid 20782] stat("/srv", {st_mode=S_IFDIR|0755, st_size=61440, ...}) = 0
[pid 20782] close(27)                   = 0
[pid 20782] munmap(0x7f70edbda000, 4096) = 0
[pid 20782] quotactl(Q_GETQUOTA|USRQUOTA, "/dev/mapper/home_vg-srv_lv", 1000, 0x7fff4e791ba0) = -1 ESRCH (No such process)
[pid 20782] quotactl(Q_V2_GETQUOTA|USRQUOTA, "/dev/mapper/home_vg-srv_lv", 1000, 0x7fff4e791bc0) = -1 EINVAL (Invalid argument)
[pid 20782] quotactl(Q_V1_GETQUOTA|USRQUOTA, "/dev/mapper/home_vg-srv_lv", 1000, 0x7fff4e791bc0) = -1 EINVAL (Invalid argument)
[pid 20782] getegid()                   = 1000
[pid 20782] stat(".", {st_mode=S_IFDIR|S_ISUID|S_ISVTX|0770, st_size=61440, ...}) = 0
[pid 20782] open("/etc/mtab", O_RDONLY) = 27
[pid 20782] fstat(27, {st_mode=S_IFREG|0644, st_size=538, ...}) = 0
[pid 20782] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f70edbda000
[pid 20782] read(27, "/dev/mapper/home_vg-f11_root_lv /"..., 4096) = 538
[pid 20782] stat("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
[pid 20782] stat("/proc", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
[pid 20782] stat("/sys", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
[pid 20782] stat("/dev/pts", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
[pid 20782] stat("/boot", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
[pid 20782] stat("/dev/shm", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=100, ...}) = 0
[pid 20782] stat("/var/www/html/music", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
[pid 20782] stat("/mnt/scratch", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
[pid 20782] stat("/srv", {st_mode=S_IFDIR|0755, st_size=61440, ...}) = 0
[pid 20782] close(27)                   = 0

It looks to me like Samba is trying to access everything listed in
/proc/mounts or /etc/mtab.

Comment 5 Bug Zapper 2010-04-28 09:56:36 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 6 Bug Zapper 2010-06-28 14:16:46 UTC
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.