* automount core's on strdup(NULL)
@ 2009-04-11 19:45 Marty Leisner
2009-04-12 3:26 ` Ian Kent
0 siblings, 1 reply; 5+ messages in thread
From: Marty Leisner @ 2009-04-11 19:45 UTC (permalink / raw)
To: autofs; +Cc: martyleisner
I just installed opensuse 11.1 -- couldn't get autofs to work...
I scratched my head - its using 5.03 --so I got 5.04 -- also core (but
I could build it -g).
So I got the head of the git tree....same problem...
(gdb) bt
#0 0xb7f37743 in strlen () from /lib/libc.so.6
#1 0xb7f37465 in strdup () from /lib/libc.so.6
#2 0xb80abaf5 in master_new_mapent (master=0xb80c4368, path=0x0,
age=1239478044) at master.c:666
#3 0xb80b18ab in master_parse_entry (buffer=0xb80e0aa0 "/net /etc/auto.net",
default_timeout=600, logging=0, age=1239478044) at master_parse.y:771
#4 0xb7eab462 in lookup_read_master (master=0xb80c4368, age=1239478044,
context=0xb80c5430) at lookup_file.c:469
#5 0xb809b744 in do_read_master (master=0xb80c4368, type=0xb80c4458 "files",
age=1239478044) at lookup.c:96
#6 0xb809b8a9 in read_master_map (master=0xb80c4368, type=0xb80c4458 "files",
age=1239478044) at lookup.c:135
#7 0xb809bc80 in lookup_nss_read_master (master=0xb80c4368, age=1239478044)
at lookup.c:223
#8 0xb80ac1cb in master_read_master (master=0xb80c4368, age=1239478044,
readall=0) at master.c:814
#9 0xb8091e2c in main (argc=0, argv=0xbfcbde40) at automount.c:2094
I ended up doing this:
: leisner@gateway 03:42:23;rcsdiff -u master.c
===================================================================
RCS file: master.c,v
retrieving revision 1.1
diff -u -r1.1 master.c
--- master.c 2009/04/11 19:35:35 1.1
+++ master.c 2009/04/11 19:36:20
@@ -657,6 +657,9 @@
int status;
char *tmp;
+ if(!path)
+ return NULL;
+
entry = malloc(sizeof(struct master_mapent));
if (!entry)
return NULL;
I think I ended up with a parse error at the end (not sure that was valid
when I started -- I had
misc /etc/auto.misc
instead of
/misc /etc/auto.misc
marty
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: automount core's on strdup(NULL)
2009-04-11 19:45 automount core's on strdup(NULL) Marty Leisner
@ 2009-04-12 3:26 ` Ian Kent
2009-04-13 1:09 ` marty
0 siblings, 1 reply; 5+ messages in thread
From: Ian Kent @ 2009-04-12 3:26 UTC (permalink / raw)
To: Marty Leisner; +Cc: autofs, martyleisner
Marty Leisner wrote:
> I just installed opensuse 11.1 -- couldn't get autofs to work...
>
> I scratched my head - its using 5.03 --so I got 5.04 -- also core (but
> I could build it -g).
>
> So I got the head of the git tree....same problem...
>
> (gdb) bt
> #0 0xb7f37743 in strlen () from /lib/libc.so.6
> #1 0xb7f37465 in strdup () from /lib/libc.so.6
> #2 0xb80abaf5 in master_new_mapent (master=0xb80c4368, path=0x0,
> age=1239478044) at master.c:666
> #3 0xb80b18ab in master_parse_entry (buffer=0xb80e0aa0 "/net /etc/auto.net",
> default_timeout=600, logging=0, age=1239478044) at master_parse.y:771
But buffer is a valid map entry in this case.
If path ends up as NULL after parsing a valid map entry then we would be
seeing a lot more problems.
So what exactly were the circumstances that lead to this?
> #4 0xb7eab462 in lookup_read_master (master=0xb80c4368, age=1239478044,
> context=0xb80c5430) at lookup_file.c:469
> #5 0xb809b744 in do_read_master (master=0xb80c4368, type=0xb80c4458 "files",
> age=1239478044) at lookup.c:96
> #6 0xb809b8a9 in read_master_map (master=0xb80c4368, type=0xb80c4458 "files",
> age=1239478044) at lookup.c:135
> #7 0xb809bc80 in lookup_nss_read_master (master=0xb80c4368, age=1239478044)
> at lookup.c:223
> #8 0xb80ac1cb in master_read_master (master=0xb80c4368, age=1239478044,
> readall=0) at master.c:814
> #9 0xb8091e2c in main (argc=0, argv=0xbfcbde40) at automount.c:2094
>
> I ended up doing this:
> : leisner@gateway 03:42:23;rcsdiff -u master.c
> ===================================================================
> RCS file: master.c,v
> retrieving revision 1.1
> diff -u -r1.1 master.c
> --- master.c 2009/04/11 19:35:35 1.1
> +++ master.c 2009/04/11 19:36:20
> @@ -657,6 +657,9 @@
> int status;
> char *tmp;
>
> + if(!path)
> + return NULL;
> +
> entry = malloc(sizeof(struct master_mapent));
> if (!entry)
> return NULL;
>
> I think I ended up with a parse error at the end (not sure that was valid
> when I started -- I had
> misc /etc/auto.misc
If that was the case the master map parser should have caught this as it
requires a "/" to even get started otherwise it returns a parse error.
We haven't got to the bottom of what caused the problem you saw and
putting in the check you have above is just going to hide the actual
problem so it can return to haunt us later.
Ian
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: automount core's on strdup(NULL)
2009-04-12 3:26 ` Ian Kent
@ 2009-04-13 1:09 ` marty
2009-04-13 6:06 ` Ian Kent
0 siblings, 1 reply; 5+ messages in thread
From: marty @ 2009-04-13 1:09 UTC (permalink / raw)
To: Marty Leisner, Ian Kent; +Cc: autofs
[-- Attachment #1.1: Type: text/plain, Size: 3238 bytes --]
Before I dig into the code, this causes a definite problem with my patch and the unpatched
git version:
At the end of the file, this works:
/net /etc/auto.net
#
/- /etc/auto.direct
This doesn't work
net /etc/auto.net
/- /etc/auto.direct
Note the "success" depended on whether the "bad line" was at the end of the file or not...
marty
--- On Sat, 4/11/09, Ian Kent <raven@themaw.net> wrote:
From: Ian Kent <raven@themaw.net>
Subject: Re: [autofs] automount core's on strdup(NULL)
To: "Marty Leisner" <leisner@rochester.rr.com>
Cc: autofs@linux.kernel.org, martyleisner@yahoo.com
Date: Saturday, April 11, 2009, 11:26 PM
Marty Leisner wrote:
> I just installed opensuse 11.1 -- couldn't get autofs to work...
>
> I scratched my head - its using 5.03 --so I got 5.04 -- also core (but
> I could build it -g).
>
> So I got the head of the git tree....same problem...
>
> (gdb) bt
> #0 0xb7f37743 in strlen () from /lib/libc.so.6
> #1 0xb7f37465 in strdup () from /lib/libc.so.6
> #2 0xb80abaf5 in master_new_mapent (master=0xb80c4368, path=0x0,
> age=1239478044) at master.c:666
> #3 0xb80b18ab in master_parse_entry (buffer=0xb80e0aa0 "/net
/etc/auto.net",
> default_timeout=600, logging=0, age=1239478044) at master_parse.y:771
But buffer is a valid map entry in this case.
If path ends up as NULL after parsing a valid map entry then we would be
seeing a lot more problems.
So what exactly were the circumstances that lead to this?
> #4 0xb7eab462 in lookup_read_master (master=0xb80c4368, age=1239478044,
> context=0xb80c5430) at lookup_file.c:469
> #5 0xb809b744 in do_read_master (master=0xb80c4368, type=0xb80c4458
"files",
> age=1239478044) at lookup.c:96
> #6 0xb809b8a9 in read_master_map (master=0xb80c4368, type=0xb80c4458
"files",
> age=1239478044) at lookup.c:135
> #7 0xb809bc80 in lookup_nss_read_master (master=0xb80c4368,
age=1239478044)
> at lookup.c:223
> #8 0xb80ac1cb in master_read_master (master=0xb80c4368, age=1239478044,
> readall=0) at master.c:814
> #9 0xb8091e2c in main (argc=0, argv=0xbfcbde40) at automount.c:2094
>
> I ended up doing this:
> : leisner@gateway 03:42:23;rcsdiff -u master.c
> ===================================================================
> RCS file: master.c,v
> retrieving revision 1.1
> diff -u -r1.1 master.c
> --- master.c 2009/04/11 19:35:35 1.1
> +++ master.c 2009/04/11 19:36:20
> @@ -657,6 +657,9 @@
> int status;
> char *tmp;
>
> + if(!path)
> + return NULL;
> +
> entry = malloc(sizeof(struct master_mapent));
> if (!entry)
> return NULL;
>
> I think I ended up with a parse error at the end (not sure that was valid
> when I started -- I had
> misc /etc/auto.misc
If that was the case the master map parser should have caught this as it
requires a "/" to even get started otherwise it returns a parse
error.
We haven't got to the bottom of what caused the problem you saw and
putting in the check you have above is just going to hide the actual
problem so it can return to haunt us later.
Ian
Ian
[-- Attachment #1.2: Type: text/html, Size: 3895 bytes --]
[-- Attachment #2: Type: text/plain, Size: 140 bytes --]
_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: automount core's on strdup(NULL)
2009-04-13 1:09 ` marty
@ 2009-04-13 6:06 ` Ian Kent
2009-04-13 9:09 ` Ian Kent
0 siblings, 1 reply; 5+ messages in thread
From: Ian Kent @ 2009-04-13 6:06 UTC (permalink / raw)
To: marty; +Cc: autofs, Marty Leisner
marty wrote:
> Before I dig into the code, this causes a definite problem with my patch and the unpatched
> git version:
>
> At the end of the file, this works:
> /net /etc/auto.net
> #
>
> /- /etc/auto.direct
>
>
> This doesn't work
> net /etc/auto.net
>
> /- /etc/auto.direct
>
> Note the "success" depended on whether the "bad line" was at the end of the file or not...
Don't understand what your saying.
Looks to me the syntax error of no leading "/" causes the master map
read to stop and exit with a fail.
I thought I fixed that ages ago.
I'll have a look again.
>
> marty
>
> --- On Sat, 4/11/09, Ian Kent <raven@themaw.net> wrote:
> From: Ian Kent <raven@themaw.net>
> Subject: Re: [autofs] automount core's on strdup(NULL)
> To: "Marty Leisner" <leisner@rochester.rr.com>
> Cc: autofs@linux.kernel.org, martyleisner@yahoo.com
> Date: Saturday, April 11, 2009, 11:26 PM
>
> Marty Leisner wrote:
>> I just installed opensuse 11.1 -- couldn't get autofs to work...
>>
>> I scratched my head - its using 5.03 --so I got 5.04 -- also core (but
>> I could build it -g).
>>
>> So I got the head of the git tree....same problem...
>>
>> (gdb) bt
>> #0 0xb7f37743 in strlen () from /lib/libc.so.6
>> #1 0xb7f37465 in strdup () from /lib/libc.so.6
>> #2 0xb80abaf5 in master_new_mapent (master=0xb80c4368, path=0x0,
>> age=1239478044) at master.c:666
>> #3 0xb80b18ab in master_parse_entry (buffer=0xb80e0aa0 "/net
> /etc/auto.net",
>> default_timeout=600, logging=0, age=1239478044) at master_parse.y:771
>
> But buffer is a valid map entry in this case.
>
> If path ends up as NULL after parsing a valid map entry then we would be
> seeing a lot more problems.
>
> So what exactly were the circumstances that lead to this?
>
>> #4 0xb7eab462 in lookup_read_master (master=0xb80c4368, age=1239478044,
>> context=0xb80c5430) at lookup_file.c:469
>> #5 0xb809b744 in do_read_master (master=0xb80c4368, type=0xb80c4458
> "files",
>> age=1239478044) at lookup.c:96
>> #6 0xb809b8a9 in read_master_map (master=0xb80c4368, type=0xb80c4458
> "files",
>> age=1239478044) at lookup.c:135
>> #7 0xb809bc80 in lookup_nss_read_master (master=0xb80c4368,
> age=1239478044)
>> at lookup.c:223
>> #8 0xb80ac1cb in master_read_master (master=0xb80c4368, age=1239478044,
>> readall=0) at master.c:814
>> #9 0xb8091e2c in main (argc=0, argv=0xbfcbde40) at automount.c:2094
>>
>> I ended up doing this:
>> : leisner@gateway 03:42:23;rcsdiff -u master.c
>> ===================================================================
>> RCS file: master.c,v
>> retrieving revision 1.1
>> diff -u -r1.1 master.c
>> --- master.c 2009/04/11 19:35:35 1.1
>> +++ master.c 2009/04/11 19:36:20
>> @@ -657,6 +657,9 @@
>> int status;
>> char *tmp;
>>
>> + if(!path)
>> + return NULL;
>> +
>> entry = malloc(sizeof(struct master_mapent));
>> if (!entry)
>> return NULL;
>>
>> I think I ended up with a parse error at the end (not sure that was valid
>> when I started -- I had
>> misc /etc/auto.misc
>
> If that was the case the master map parser should have caught this as it
> requires a "/" to even get started otherwise it returns a parse
> error.
>
> We haven't got to the bottom of what caused the problem you saw and
> putting in the check you have above is just going to hide the actual
> problem so it can return to haunt us later.
>
> Ian
>
>
> Ian
>
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: automount core's on strdup(NULL)
2009-04-13 6:06 ` Ian Kent
@ 2009-04-13 9:09 ` Ian Kent
0 siblings, 0 replies; 5+ messages in thread
From: Ian Kent @ 2009-04-13 9:09 UTC (permalink / raw)
To: marty; +Cc: autofs, Marty Leisner
On Mon, 13 Apr 2009, Ian Kent wrote:
> marty wrote:
> > Before I dig into the code, this causes a definite problem with my patch and the unpatched
> > git version:
> >
> > At the end of the file, this works:
> > /net /etc/auto.net
> > #
> >
> > /- /etc/auto.direct
> >
> >
> > This doesn't work
> > net /etc/auto.net
> >
> > /- /etc/auto.direct
> >
> > Note the "success" depended on whether the "bad line" was at the end of the file or not...
>
> Don't understand what your saying.
> Looks to me the syntax error of no leading "/" causes the master map
> read to stop and exit with a fail.
>
> I thought I fixed that ages ago.
> I'll have a look again.
>
So, the seemingly never ending story of working out haw to "really" reset
the flex scanner may ahve come to and end, at last (but somehow I doubt
that will be the end of it).
This patch may help.
It might apply cleanly to the source your using but will reject the
CHANGLOG hunk (as there are patches prior to this in my working tree that
aren't yet available).
Ian
autofs-5.0.4 - reset flex scanner when setting buffer
From: Ian Kent <raven@themaw.net>
We still have problems resetting the flex scan buffer after an error
is detected. This appears to fix the problem.
---
CHANGELOG | 1 +
lib/master_tok.l | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 9c3c472..50bfca8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -37,6 +37,7 @@
- clear rpc client on lookup fail.
- fix memory leak reading master map.
- fix st_remove_tasks() locking.
+- reset flex scanner when setting buffer.
4/11/2008 autofs-5.0.4
-----------------------
diff --git a/lib/master_tok.l b/lib/master_tok.l
index b6cc8be..373248b 100644
--- a/lib/master_tok.l
+++ b/lib/master_tok.l
@@ -130,7 +130,6 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo
\x00 {
if (optr != buff) {
*optr = '\0';
- optr = buff;
strcpy(master_lval.strtype, buff);
return NILL;
}
@@ -139,6 +138,11 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo
#.* { return COMMENT; }
"/" {
+ if (optr != buff) {
+ *optr = '\0';
+ strcpy(master_lval.strtype, buff);
+ return NILL;
+ }
BEGIN(PATHSTR);
bptr = buff;
yyless(0);
@@ -410,6 +414,9 @@ static void master_echo(void)
void master_set_scan_buffer(const char *buffer)
{
+ master_lex_destroy();
+ optr = buff;
+
line = buffer;
line_pos = &line[0];
/*
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-04-13 9:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-11 19:45 automount core's on strdup(NULL) Marty Leisner
2009-04-12 3:26 ` Ian Kent
2009-04-13 1:09 ` marty
2009-04-13 6:06 ` Ian Kent
2009-04-13 9:09 ` Ian Kent
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.