From owner-freebsd-current@freebsd.org Fri Feb 26 03:31:04 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 D68D4AB57DD for ; Fri, 26 Feb 2016 03:31:04 +0000 (UTC) (envelope-from cse.cem@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 B6D7B1513 for ; Fri, 26 Feb 2016 03:31:04 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id B81CEAB57DC; Fri, 26 Feb 2016 03:31:04 +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 B7B11AB57DB for ; Fri, 26 Feb 2016 03:31:04 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-yw0-f171.google.com (mail-yw0-f171.google.com [209.85.161.171]) (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 807161511 for ; Fri, 26 Feb 2016 03:31:04 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-yw0-f171.google.com with SMTP id u200so60065335ywf.0 for ; Thu, 25 Feb 2016 19:31:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=d1q+1YIZgNRKaK0HphqxvNFPcN5uFZcb7hGjwjzYzzE=; b=ODHIz1xNd4U08ptzOy8Awm2glpWxU1svcx62hgbmDC8fICA/gjkDO5miPSUX85sCoJ 11OzfTJoyf76rl44kmgiuy4TcJhFyxZmF5TSuoPp3iz3HpRdHelCRMq+h/ARDVy3DSPC 0TN4oy8O14XlSaTH6mTgsceFgsYB0JhYN2Md/fmTx0a/mB/bCHD6bXQ4iRX25IQ41AoX kQ0juWkXnjemGg+RfpZNAEbyU6Anjm+5qwo1TKzey4dRnGgCq4rJ2D4g8dEpQ+y8I2Ze zmfeEAeqZpTOdPF5ywgUffGrcnwP0zMHX8TxvU3AgKZ4p95EO5B3kijgvaCjoJS/J6nX bbiw== X-Gm-Message-State: AG10YOTlLfY2uiRRnqP0FVtLVDhOTsMCv1ap4JE63AUjwZ99W1seSozxZ/5CqahQeeWtoA== X-Received: by 10.13.231.132 with SMTP id q126mr25044520ywe.203.1456457463125; Thu, 25 Feb 2016 19:31:03 -0800 (PST) Received: from mail-yk0-f177.google.com (mail-yk0-f177.google.com. [209.85.160.177]) by smtp.gmail.com with ESMTPSA id 204sm8506055ywr.32.2016.02.25.19.31.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Feb 2016 19:31:02 -0800 (PST) Received: by mail-yk0-f177.google.com with SMTP id z7so30962057yka.3 for ; Thu, 25 Feb 2016 19:31:02 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.37.109.68 with SMTP id i65mr26251620ybc.91.1456457462420; Thu, 25 Feb 2016 19:31:02 -0800 (PST) Reply-To: cem@FreeBSD.org Received: by 10.37.115.82 with HTTP; Thu, 25 Feb 2016 19:31:02 -0800 (PST) In-Reply-To: References: Date: Thu, 25 Feb 2016 19:31:02 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: buffer overflow warning in /bin/sh From: Conrad Meyer To: Howard Su Cc: current@freebsd.org Content-Type: text/plain; charset=UTF-8 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:31:04 -0000 I have /etc/src.conf: WITH_DEBUG_FILES=1 WITH_CTF=1 /etc/make.conf: CFLAGS=-fno-omit-frame-pointer WITH_CTF=1 WITH_DEBUG=yes Not sure which of those is relevant (or even correct), but I seem to get debuginfo in /usr/lib/debug/.debug. Best, Conrad On Thu, Feb 25, 2016 at 7:21 PM, Howard Su wrote: > I got the error when compiling GENERIC kernel with address sanitizer > /bin/sh: > --- vers.c --- > MAKE=make sh /usr/home/howardsu/freebsd/sys/conf/newvers.sh > GENERIC================================================================= > ==4132==ERROR: 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==4132==AddressSanitizer CHECK failed: > /usr/home/howardsu/freebsd/lib/libclang_rt/asan/../../../contrib/compiler-rt/lib/asan/asan_thread.cc:246 > "((ptr[0] == kCurrentStackFrameMagic)) != (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+= -g -fsanitize=address -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 > > Any idea? > > -- > -Howard > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"