Bug 1734057 - automount segfaults if a bad hosts entry is added in /etc/auto.master
Summary: automount segfaults if a bad hosts entry is added in /etc/auto.master
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: autofs
Version: 7.6
Hardware: All
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Ian Kent
QA Contact: Kun Wang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-29 14:27 UTC by Kenneth D'souza
Modified: 2019-09-09 06:20 UTC (History)
2 users (show)

Fixed In Version: autofs-5.0.7-107.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)
Patch - fix reset flex scan buffer on init (1.11 KB, patch)
2019-07-30 11:51 UTC, Ian Kent
no flags Details | Diff

Description Kenneth D'souza 2019-07-29 14:27:06 UTC
Description of problem:
automount segfaults if a bad hosts entry is added in /etc/auto.master

Version-Release number of selected component (if applicable):
# rpm -q autofs
autofs-5.0.7-99.el7.x86_64

How reproducible:
always 

Steps to Reproduce:
1. Add a bad entry in /etc/auto/master like below

# grep -v ^# /etc/auto.master  | grep -i hosts
/net	-hosts
@ -hosts  <---------------

2. Trigger a crash by running automount -m or simply automount

# automount -m
100000000|syntax error in map near [ @ -hosts  ]
Segmentation fault (core dumped)

# dmesg | tail -f
[ 1684.146282] automount[6707]: segfault at 0 ip 00007f023f9d2901 sp 00007ffc0f4b8638 error 4 in libc-2.17.so[7f023f864000+1c2000]


Actual results:

# automount -m
100000000|syntax error in map near [ @ -hosts  ]
Segmentation fault (core dumped)


Expected results:

To not segfault and return the correct maps.

# automount -m
100000000|syntax error in map near [ @ -hosts ]

autofs dump map information
===========================

global options: none configured

Mount point: /misc

source(s):

  instance type(s): file 
  map: /etc/auto.misc

  cd | -fstype=iso9660,ro,nosuid,nodev	:/dev/cdrom


Mount point: /net

source(s):

  type: hosts

  localhost | (null)


Additional info:

Unable to reproduce the issue on fedora.

# rpm -q autofs
autofs-5.1.5-4.fc30.x86_64

Comment 2 Ian Kent 2019-07-30 01:49:36 UTC
(In reply to Kenneth D'souza from comment #0)
> Description of problem:
> automount segfaults if a bad hosts entry is added in /etc/auto.master
> 
> Version-Release number of selected component (if applicable):
> # rpm -q autofs
> autofs-5.0.7-99.el7.x86_64
> 
> How reproducible:
> always 
> 
> Steps to Reproduce:
> 1. Add a bad entry in /etc/auto/master like below
> 
> # grep -v ^# /etc/auto.master  | grep -i hosts
> /net	-hosts
> @ -hosts  <---------------
> 
> 2. Trigger a crash by running automount -m or simply automount

Mmm ... I'm not able to reproduce this.

I tried on Centos7 with rev 99 and couldn't reproduce it, so I checked
out a RHEL-7.6 lab machine and still couldn't reproduce it.

I'll try installing 7.6 into a VM and apply any updates and see if I
can reproduce it then.

If I can't reproduce it we'll need to inspect a core on an install
that can reproduce it to see if we can get more information.

Ian

Comment 3 Kenneth D'souza 2019-07-30 05:07:12 UTC
(In reply to Ian Kent from comment #2)
> (In reply to Kenneth D'souza from comment #0)
> > Description of problem:
> > automount segfaults if a bad hosts entry is added in /etc/auto.master
> > 
> > Version-Release number of selected component (if applicable):
> > # rpm -q autofs
> > autofs-5.0.7-99.el7.x86_64
> > 
> > How reproducible:
> > always 
> > 
> > Steps to Reproduce:
> > 1. Add a bad entry in /etc/auto/master like below
> > 
> > # grep -v ^# /etc/auto.master  | grep -i hosts
> > /net	-hosts
> > @ -hosts  <---------------
> > 
> > 2. Trigger a crash by running automount -m or simply automount
> 
> Mmm ... I'm not able to reproduce this.
> 
> I tried on Centos7 with rev 99 and couldn't reproduce it, so I checked
> out a RHEL-7.6 lab machine and still couldn't reproduce it.
> 
> I'll try installing 7.6 into a VM and apply any updates and see if I
> can reproduce it then.
> 
> If I can't reproduce it we'll need to inspect a core on an install
> that can reproduce it to see if we can get more information.
> 
> Ian

Sorry I missed to update that the issue is seen only if I have a autofs file inside /etc/auto.master.d

# cat /etc/auto.master.d/direct.autofs 
/- /etc/auto.direct
 
# cat /etc/auto.direct 
/test/data -rw nfs-server:/example

# grep -v ^# /etc/auto.master
/misc	/etc/auto.misc
/net	-hosts
@ -hosts  <-------------------------------------- bad entry
+dir:/etc/auto.master.d <----------------------------------- this is necessary
+auto.master

I hope this helps.

Comment 4 Ian Kent 2019-07-30 10:23:30 UTC
(In reply to Kenneth D'souza from comment #3)
> 
> Sorry I missed to update that the issue is seen only if I have a autofs file
> inside /etc/auto.master.d
> 
> # cat /etc/auto.master.d/direct.autofs 
> /- /etc/auto.direct
>  
> # cat /etc/auto.direct 
> /test/data -rw nfs-server:/example
> 
> # grep -v ^# /etc/auto.master
> /misc	/etc/auto.misc
> /net	-hosts
> @ -hosts  <-------------------------------------- bad entry
> +dir:/etc/auto.master.d <----------------------------------- this is
> necessary
> +auto.master
> 
> I hope this helps.

That did the trick, I'll sort it out.

Thanks
Ian

Comment 5 Ian Kent 2019-07-30 11:51:52 UTC
Created attachment 1594586 [details]
Patch - fix reset flex scan buffer on init

Found it.

Comment 6 Ian Kent 2019-07-30 12:15:07 UTC
Change applied, built and verified to work for the case here.
The build can be found at:
https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=940222

Please test to make sure it really is ok.

Comment 7 Kenneth D'souza 2019-07-30 12:52:08 UTC
(In reply to Ian Kent from comment #6)
> Change applied, built and verified to work for the case here.
> The build can be found at:
> https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=940222
> 
> Please test to make sure it really is ok.

Works for me!


Note You need to log in before you can comment on or make changes to this bug.