[Bug sanitizer/98669] SIGSEGV on pc=0 in crypt() with -fsanitize=address

2022-09-06 Thread asn at samba dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98669

Andreas Schneider  changed:

   What|Removed |Added

 CC||asn at samba dot org

--- Comment #14 from Andreas Schneider  ---
I've run into this with a python script:

==9542==AddressSanitizer: failed to intercept 'crypt'
==9542==AddressSanitizer: failed to intercept 'crypt_r'

[..]

AddressSanitizer:DEADLYSIGNAL
=
==29768==ERROR: AddressSanitizer: SEGV on unknown address 0x (pc
0x bp 0x7ffcec4bf3c0 sp 0x7ffcec4beb58 T0)
==29768==Hint: pc points to the zero page.
==29768==The signal is caused by a READ memory access.
==29768==Hint: address points to the zero page.
#0 0x0  ()
#1 0x7f052cca4129 in crypt_crypt_impl
/usr/src/debug/python310-core-3.10.6-3.1.x86_64/Modules/_cryptmodule.c:44

In case someone runs into this as well. You can fix it by preloading
libcrypt.so.1!

[Bug c/85874] gcc points to wrong location when displaying error

2018-05-22 Thread asn at samba dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85874

--- Comment #2 from Andreas Schneider  ---
If I add -Wsystem-headers I get:

In file included from /usr/include/stdlib.h:822,
 from ../lib/replace/replace.h:40,
 from ../lib/util/debug.c:22:
/usr/include/bits/stdlib-bsearch.h: In function ‘bsearch’:
/usr/include/bits/stdlib-bsearch.h:32:13: error: cast discards ‘const’
qualifier from pointer target type [-Werror=cast-qual]  
   __p = (void *) (((const char *) __base) + (__idx * __size));
 ^
/usr/include/bits/stdlib-bsearch.h:39:9: error: cast discards ‘const’ qualifier
from pointer target type [-Werror=cast-qual]
  return (void *) __p;
 ^
../lib/util/debug.c: In function ‘debug_parse_levels’:
../lib/util/debug.c:796:6: error: assuming pointer wraparound does not occur
when comparing P +- C1 with P +- C2 [-Werror=strict-overflow]   
 bool debug_parse_levels(const char *params_str)
  ^~

[Bug c/85874] New: gcc points to wrong location when displaying error

2018-05-22 Thread asn at samba dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85874

Bug ID: 85874
   Summary: gcc points to wrong location when displaying error
   Product: gcc
   Version: 8.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asn at samba dot org
  Target Milestone: ---

Created attachment 44163
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44163=edit
debug.i

Compiling the latest upstream Samba with -O3, -Werror, among other flags, fails
but doesn't point to the correct error location.  The line it's giving us
doesn't make any sense for the error printed.


Below is the failing command and error messages.

gcc -O3 -g -ggdb -Wstrict-overflow -Wall -Wcomment -Wpointer-arith -Wcast-align
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
-Wdeclaration-after-statement -fstrict-aliasing -DDEVELOPER -DDEBUG_PASSWORD
-fPIC -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -fstack-protector -Wshadow
-Wcast-qual -fno-common -Werror=address -Werror=strict-prototypes
-Werror=write-strings -Werror-implicit-function-declaration
-Werror=pointer-arith -Werror=declaration-after-statement -Werror=return-type
-Wreturn-type -Werror=uninitialized -Wuninitialized -Wimplicit-fallthrough
-Werror=strict-overflow -Wstrict-overflow=2 -Wformat=2 -Wno-format-y2k
-Wno-format-zero-length -Werror=format-security -Wformat-security
-Werror=format -Werror -Wno-error=deprecated-declarations
-Wno-error=tautological-compare -DSTATIC_samba_debug_MODULES=NULL
-DSTATIC_samba_debug_MODULES_PROTO='extern void
__samba_debug_dummy_module_proto(void)' -MD -Idefault/include/public
-I../include/public -Idefault/source4 -I../source4 -Idefault/lib -I../lib
-Idefault/source4/lib -I../source4/lib -Idefault/source4/include
-I../source4/include -Idefault/include -I../include -Idefault/lib/replace
-I../lib/replace -Idefault -I.. -I/usr/local/include -D_SAMBA_BUILD_=4
-DHAVE_CONFIG_H=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1
../lib/util/debug.c -c -o default/lib/util/debug_11.o
../lib/util/debug.c: In function ‘debug_parse_levels’:
../lib/util/debug.c:788:5: error: assuming pointer wraparound does not occur
when comparing P +- C1 with P +- C2 [-Werror=strict-overflow]   
 bool debug_parse_levels(const char *params_str)
  ^~
cc1: all warnings being treated as errors