You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2024/03/13 01:22:50 UTC

[Bug 68763] New: ring warnings with CFLAGS=-fsanitize=undefined

https://bz.apache.org/bugzilla/show_bug.cgi?id=68763

            Bug ID: 68763
           Summary: ring warnings with CFLAGS=-fsanitize=undefined
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: covener@gmail.com
  Target Milestone: ---

clang with CFLAGS=-fsanitize=undefined complains about a few things at startup
and shutdown (with apr 1.7.4 and clang 1:14.0-55~exp2)


mpm_common.c:480:19: runtime error: member access within null pointer of type
'struct mpm_gen_info_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior mpm_common.c:480:19 in
mpm_common.c:485:16: runtime error: member access within null pointer of type
'struct mpm_gen_info_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior mpm_common.c:485:16 in
[Tue Mar 12 18:05:04.747718 2024] [core:trace4] [pid 256504] mpm_common.c(462):
end of generation 0
mpm_common.c:466:5: runtime error: member access within null pointer of type
'struct mpm_gen_info_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior mpm_common.c:466:5 in
mpm_common.c:466:5: runtime error: member access within null pointer of type
'struct mpm_gen_info_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior mpm_common.c:466:5 in
mpm_common.c:466:5: runtime error: member access within null pointer of type
'struct mpm_gen_info_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior mpm_common.c:466:5 in
mpm_common.c:466:5: runtime error: member access within null pointer of type
'struct mpm_gen_info_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior mpm_common.c:466:5 in

mpm_fdqueue.c:364:5: runtime error: member access within null pointer of type
'struct timer_event_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior mpm_fdqueue.c:364:5 in
mpm_fdqueue.c:445:9: runtime error: member access within null pointer of type
'struct timer_event_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior mpm_fdqueue.c:445:9 in
mpm_fdqueue.c:450:13: runtime error: member access within null pointer of type
'struct timer_event_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior mpm_fdqueue.c:450:13 in

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 68763] ring warnings with CFLAGS=-fsanitize=undefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68763

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Core                        |APR
            Product|Apache httpd-2              |APR
           Assignee|bugs@httpd.apache.org       |bugs@apr.apache.org
            Version|2.5-HEAD                    |1.7.4

--- Comment #3 from Eric Covener <co...@gmail.com> ---
After some confusing results along the way:

* -fno-strict-aliasing no affect
* 1.7.4 fails and trunk works
* just testpoll in apr is enough to hit presumably the same warning (at least
if epoll is built).


The difference seems to be APR_OFFSETOF being used in my 1.7.4 vs
__builtin_offsetof


-E output

1.7.4:

        do { ((&pollset->p->query_ring))->next = (struct pfd_elem_t *)((char
*)(&((&pollset->p->query_ring))->next) - ((long) (((char *) (&(((struct
pfd_elem_t*)((void*)0))->link))) - ((char *) ((void*)0)))));
((&pollset->p->query_ring))->prev = (struct pfd_elem_t *)((char
*)(&((&pollset->p->query_ring))->next) - ((long) (((char *) (&(((struct
pfd_elem_t*)((void*)0))->link))) - ((char *) ((void*)0))))); } while (0);

trunk:
        do { ((&pollset->p->query_ring))->next = (struct pfd_elem_t *)((char
*)(&((&pollset->p->query_ring))->next) - __builtin_offsetof(struct pfd_elem_t,
link)); ((&pollset->p->query_ring))->prev = (struct pfd_elem_t *)((char
*)(&((&pollset->p->query_ring))->next) - __builtin_offsetof(struct pfd_elem_t,
link)); } while (0);

But I couldn't spot what makes them different (I am just configuring both with:
env CC=clang CFLAGS="-fsanitize=undefined" ./configure --prefix=$PWD/built

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 68763] ring warnings with CFLAGS=-fsanitize=undefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68763

--- Comment #2 from Yann Ylavic <yl...@gmail.com> ---
Also does it happen with -fno-strict-aliasing too?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 68763] ring warnings with CFLAGS=-fsanitize=undefined

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68763

--- Comment #1 from Yann Ylavic <yl...@gmail.com> ---
I cannot reproduce this with clang (tried v14 and v16) with httpd/apr both
trunk. Does it happen with apr-1.7.4 only?

Not sure what it's complaining about either, it looks like it finds a
NULL-deref through APR_RING_SENTINEL(ring, ...) where the ring cannot possibly
be NULL where reported, and AFAICT it's the only thing dereferenced by
APR_RING_SENTINEL()..

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org