Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Feb 2016 11:21:26 +0800
From:      Howard Su <howard0su@gmail.com>
To:        current@freebsd.org
Subject:   buffer overflow warning in /bin/sh
Message-ID:  <CAAvnz_owSKcJ71LJa2F4MnnWKjV251CH-mBsVMFcS=riN=bK_Q@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I got the error when compiling GENERIC kernel with address sanitizer
/bin/sh:
--- vers.c ---
MAKE=3Dmake sh /usr/home/howardsu/freebsd/sys/conf/newvers.sh
GENERIC=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D4132=3D=3DERROR: AddressSanitizer: stack-buffer-overflow on address
0x7fffffffc9c0 at pc 0x00000045fdc7 bp 0x7fffffffc930 sp 0x7fffffffc0f0
WRITE of size 312 at 0x7fffffffc9c0 thread T0
    #0 0x45fdc6  (/bin/sh+0x45fdc6)
    #1 0x801431767  (/lib/libc.so.7+0x7c767)
    #2 0x42ff5e  (/bin/sh+0x42ff5e)
    #3 0x4b6b00  (/bin/sh+0x4b6b00)
    #4 0x49686e  (/bin/sh+0x49686e)
    #5 0x495572  (/bin/sh+0x495572)
    #6 0x48c3f9  (/bin/sh+0x48c3f9)
    #7 0x489920  (/bin/sh+0x489920)
    #8 0x4acde8  (/bin/sh+0x4acde8)
    #9 0x4aca4d  (/bin/sh+0x4aca4d)
    #10 0x40fb0e  (/bin/sh+0x40fb0e)
    #11 0x80071afff  (<unknown module>)

Address 0x7fffffffc9c0 is located in stack of thread
T0=3D=3D4132=3D=3DAddressSanitizer CHECK failed:
/usr/home/howardsu/freebsd/lib/libclang_rt/asan/../../../contrib/compiler-r=
t/lib/asan/asan_thread.cc:246
"((ptr[0] =3D=3D kCurrentStackFrameMagic)) !=3D (0)" (0x0, 0x0)
    #0 0x422b9d  (/bin/sh+0x422b9d)
    #1 0x41de09  (/bin/sh+0x41de09)
    #2 0x41f301  (/bin/sh+0x41f301)
    #3 0x4728be  (/bin/sh+0x4728be)
    #4 0x474589  (/bin/sh+0x474589)
    #5 0x47502a  (/bin/sh+0x47502a)
    #6 0x45fdef  (/bin/sh+0x45fdef)
    #7 0x801431767  (/lib/libc.so.7+0x7c767)
    #8 0x42ff5e  (/bin/sh+0x42ff5e)
    #9 0x4b6b00  (/bin/sh+0x4b6b00)
    #10 0x49686e  (/bin/sh+0x49686e)
    #11 0x495572  (/bin/sh+0x495572)
    #12 0x48c3f9  (/bin/sh+0x48c3f9)
    #13 0x489920  (/bin/sh+0x489920)
    #14 0x4acde8  (/bin/sh+0x4acde8)
    #15 0x4aca4d  (/bin/sh+0x4aca4d)
    #16 0x40fb0e  (/bin/sh+0x40fb0e)
    #17 0x80071afff  (<unknown module>)

*** [vers.c] Error code 1

I am using latest -Current and add the following flags to /etc/make.conf.
# CFLAGS+=3D -g -fsanitize=3Daddress -fno-omit-frame-pointer

I rebuild /bin/sh as a first step. with the /bin/sh I got the above error.
I would like to understand how to get symbols. The following command
doesn't work at all.
 addr2line -e /bin/sh 0x422b9d

=E2=80=8BAny idea?=E2=80=8B

--=20
-Howard



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAvnz_owSKcJ71LJa2F4MnnWKjV251CH-mBsVMFcS=riN=bK_Q>