From owner-freebsd-current@freebsd.org Fri Feb 26 03:21:27 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A042AB54FD for ; Fri, 26 Feb 2016 03:21:27 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 3BE56106E for ; Fri, 26 Feb 2016 03:21:27 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 3D194AB54FC; Fri, 26 Feb 2016 03:21:27 +0000 (UTC) Delivered-To: current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C9FAAB54FB for ; Fri, 26 Feb 2016 03:21:27 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08860106D for ; Fri, 26 Feb 2016 03:21:27 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: by mail-io0-x231.google.com with SMTP id l127so109698664iof.3 for ; Thu, 25 Feb 2016 19:21:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=CQweVq2dcP49jJBkD7OiNYT6IG/isFfFGkQreUEAZKk=; b=s1bwyAdJKappiBU939pbRNM/vh3laOh92YuxC0wS2EVl/nMRQd4yXmPOWwTwgMXmfd MLdd+/qEi3jSAzynYfADc6rVQVGerpwfBPUETNakwTsOvI1njJD1XW0cwQpg2qm9UkM8 UX2c7O9muQTMCkNF46FSGEC/b4tRuQ/kKxO96UHOxB6YssLSriXs3zhpf4bksjGOlV1X XzozBTbcaBbClVHmUFV9qPObW+Y8ro2sDD0eFKiZYh8IidSqujtqtwv7yVYzzy8+GSmR CuHCcxUTgfmoY9o0/OiipnAV8TPAs4hohOdFPIiyeZQWOaRzvfQ6+b9YGH3HMLddDhIJ ykuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=CQweVq2dcP49jJBkD7OiNYT6IG/isFfFGkQreUEAZKk=; b=VrWp3mvqcn38xIqn+nY8wdTV+rdR/6hjgFwLOH9aIsQ/waD+pAyq+x+5Nqxere/U8U lsDCG46Cbb8TKLDYQ+EQ1sWyUbO/HKobhW3x3/16gug3qm2U231/7zkIVQUkPenBhLGY 1B4aP4zCqAw6NYngUg/o/LxXlwt5O6EodUN+ISBmldJyvppLrGF+gWW7Ij0EB/Qi5/lP U5LuB4GCCOVl0gH951mF+KkRIhjFT7eSGMlM1MeC9k+K4Dsvi2If3Syc6CoCAfcn8flb l6eJ/ZeZOj7IH1vfF0lyV8WRpyr8HbOzu0pvB1aOEAncAR6iOiIzzkHsbuom08Dt2UO6 BuNg== X-Gm-Message-State: AG10YOScr/Ywq3iA3n0aEWmMWQz7rW4eZYciNuRW03hTEBPJdLT/8hTHJIIHZ7syFI/XFTI7xYO96tdkXcMU2Q== MIME-Version: 1.0 X-Received: by 10.107.2.198 with SMTP id 189mr5796413ioc.118.1456456886348; Thu, 25 Feb 2016 19:21:26 -0800 (PST) Received: by 10.50.181.137 with HTTP; Thu, 25 Feb 2016 19:21:26 -0800 (PST) Date: Fri, 26 Feb 2016 11:21:26 +0800 Message-ID: Subject: buffer overflow warning in /bin/sh From: Howard Su To: current@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2016 03:21:27 -0000 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 () 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 () *** [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