[SSSD] [PATCH] DEBUG: Fix crash after fallback from journal log
Jakub Hrozek
jhrozek at redhat.com
Thu Feb 20 20:23:19 UTC 2014
On Thu, Feb 20, 2014 at 05:33:12PM +0100, Sumit Bose wrote:
> On Thu, Feb 20, 2014 at 05:00:59PM +0100, Lukas Slebodnik wrote:
> > ehlo,
> >
> > It was not easy to reproduce this crash in the find-uid-test (log attached)
> >
> > Here is a backtrace:
> > #0 0x00007fbeaf7850cf in _IO_vfprintf_internal (s=<optimized out>, format=<optimized out>, ap=<optimized out>) at vfprintf.c:1635
> > #1 0x00007fbeaf788b01 in buffered_vfprintf (s=s at entry=0x7fbeafaf51c0 <_IO_2_1_stderr_>, format=format at entry=0x7fbeb119c1a8 "Proc file [%s] is not available anymore, continuing.\n", args=args at entry=0x7fff2d20b668) at vfprintf.c:2328
> > #2 0x00007fbeaf783ffe in _IO_vfprintf_internal (s=s at entry=0x7fbeafaf51c0 <_IO_2_1_stderr_>, format=0x7fbeb119c1a8 "Proc file [%s] is not available anymore, continuing.\n", ap=0x7fff2d20b668) at vfprintf.c:1289
> > #3 0x00007fbeaf840a06 in ___vfprintf_chk (fp=0x7fbeafaf51c0 <_IO_2_1_stderr_>, flag=1, format=<optimized out>, ap=<optimized out>) at vfprintf_chk.c:33
> > #4 0x00007fbeb0d7461a in debug_fn (file=file at entry=0x7fbeb119bfcf "src/util/find_uid.c", line=line at entry=90, function=function at entry=0x7fbeb119c270 <__FUNCTION__.8600> "get_uid_from_pid", level=level at entry=4096, format=format at entry=0x7fbeb119c1a8 "Proc file [%s] is not available anymore, continuing.\n") at src/util/debug.c:257
> > #5 0x00007fbeb119ae74 in get_uid_from_pid (pid=<optimized out>, uid=uid at entry=0x7fff2d20c9a4) at src/util/find_uid.c:88
> > #6 0x00007fbeb119b381 in get_active_uid_linux (table=table at entry=0x0, search_uid=search_uid at entry=4294967292) at src/util/find_uid.c:236
> > #7 0x00007fbeb119b69f in check_if_uid_is_active (uid=uid at entry=4294967292, result=result at entry=0x7fff2d20ca67) at src/util/find_uid.c:333
> > #8 0x00007fbeb119a9ab in test_check_if_uid_is_active_fail (_i=<optimized out>) at src/tests/find_uid-tests.c:58
> > #9 0x00007fbeb054887e in tcase_run_tfun_fork (i=0, tfun=0x7fbeb14a0300, tc=0x7fbeb14a00a0, sr=0x7fbeb14a0390) at check_run.c:396
> > #10 srunner_iterate_tcase_tfuns (tc=0x7fbeb14a00a0, sr=0x7fbeb14a0390) at check_run.c:181
> > #11 srunner_run_tcase (tc=0x7fbeb14a00a0, sr=0x7fbeb14a0390) at check_run.c:313
> > #12 srunner_iterate_suites (print_mode=CK_SILENT, tcname=0x0, sname=0x0, sr=0x7fbeb14a0390) at check_run.c:156
> > #13 srunner_run (sr=sr at entry=0x7fbeb14a0390, sname=sname at entry=0x0, tcname=tcname at entry=0x0, print_mode=print_mode at entry=CK_ENV) at check_run.c:618
> > #14 0x00007fbeb054892b in srunner_run_all (sr=sr at entry=0x7fbeb14a0390, print_mode=print_mode at entry=CK_ENV) at check_run.c:587
> > #15 0x00007fbeb119a685 in main () at src/tests/find_uid-tests.c:125
> >
> >
> > (gdb) l src/util/find_uid.c:88
> > 83
> > 84 fd = open(path, O_RDONLY);
> > 85 if (fd == -1) {
> > 86 error = errno;
> > 87 if (error == ENOENT) {
> > 88 DEBUG(SSSDBG_TRACE_LIBS,
> > 89 "Proc file [%s] is not available anymore, continuing.\n",
> > 90 path);
> > 91 return EOK;
> > 92 }
> >
> > As you can see in frame 5, it was caused by DEBUG macro. It was strange
> > because variable path was declared on stack "char path[PATHLEN];"
> >
> > But it looks like va_list should not be used twice.
> > http://en.cppreference.com/w/cpp/utility/variadic/va_copy
>
> yes, this can also be seen from the vsprintf man page: "Because they
> invoke the va_arg macro, the value of ap is undefined after the call."
>
> very good catch, ACK to the patch.
>
> bye,
> Sumit
Pushed to master.
More information about the sssd-devel
mailing list