From nobody Sun Jan 2 21:01:56 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5AF7C191CDE2 for ; Sun, 2 Jan 2022 21:01:59 +0000 (UTC) (envelope-from ricky@rickysquid.org) Received: from mail.rickysquid.org (mail.rickysquid.org [104.168.201.163]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4JRrsd4wBxz3FMH for ; Sun, 2 Jan 2022 21:01:57 +0000 (UTC) (envelope-from ricky@rickysquid.org) Received: by mail.rickysquid.org (Postfix, from userid 1000) id C670545643; Sun, 2 Jan 2022 21:01:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rickysquid.org; s=default; t=1641157316; bh=JMpZeqQ5dfkRJHHfb/mHqA4R+W3oQkjbd6g6v49xzkE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NYtcd4cUgbGFYUnO/t/L2CKOeZcmC8ib3eqP5eNJ/eEg40B0MCg3f4EYRankZGlZ7 2jLwecdPULCAYnfftUQ5SEt/63KxougauXIeXbWzm6IFKIm6PlqLlI2e3nj+qmZLwb cogcZdAl4zJlXytmy3J9/7mXWRggscSUjcUDbU3PH6tgPYbJxX/+3VFMK//eCzfgnx T2cHf8xNVk6Xs2izXvaRVbCF5i1KEmYuj2stxyqDZlmFd+qA8r7Yj7Od4AM1hJfWkg 5sSdZ4cD8xbUe6e8w8toJGMI4nEPZ0Uu/n2Xbu0ynVnp9mfle/x60qbiIZaypjoLuw Vx/L1egKZJBBA== Date: Sun, 2 Jan 2022 21:01:56 +0000 From: rickygee To: Luoqi Chen Cc: freebsd-hackers@freebsd.org Subject: Re: leak sanitizer support Message-ID: <20220102210156.GA16266@rickysquid.org> References: <20211230201614.z4bsknfgdde7ufwu@mutt-hbsd> <20220102002851.GA32472@rickysquid.org> <20220102193506.GA6478@rickysquid.org> List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220102193506.GA6478@rickysquid.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 4JRrsd4wBxz3FMH X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=rickysquid.org header.s=default header.b=NYtcd4cU; dmarc=pass (policy=none) header.from=rickysquid.org; spf=pass (mx1.freebsd.org: domain of ricky@rickysquid.org designates 104.168.201.163 as permitted sender) smtp.mailfrom=ricky@rickysquid.org X-Spamd-Result: default: False [-0.00 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[rickysquid.org:s=default]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_MEDIUM(1.00)[0.999]; NEURAL_SPAM_SHORT(1.00)[1.000]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[rickysquid.org:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[rickysquid.org,none]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:54290, ipnet:104.168.128.0/17, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sun, Jan 02, 2022 at 07:35:06PM +0000, Eric Gullufsen wrote: > Awesome sounds great - will test with your new diff & module files posted & > report back here in a few - thanks! > > On Sun, Jan 02, 2022 at 09:53:06AM -0800, Luoqi Chen wrote: > > locking issue and also to cleanup some unused code, would you mind trying > > out the new version? I've updated the diff files. > > > > -luoqi > Hey Luoqi, Dang you rock - I applied your updated patch against -current (commit 642f77be1d), and everything went swimmingly in initial testing: //GRABBED PATCH & APPLIED & BUILT/INSTALLED libclang_rt libs https://people.freebsd.org/~luoqi/lsan/ //TWIST SYSCTL KNOBS (PIE & ASLR) # sysctl kern.elf64.aslr.pie_enable=0 # sysctl kern.elf64.aslr.enable=0 //COMPILE # clang -fsanitize=address -g -o leaky3 leaky.c /* leaky.c */ #include void *p; int main() { p = malloc(7); p = 0; return 0; } //RUN # ASAN_OPTIONS=detect_leaks=1:verbosity=3 ./leaky3 [output cut] ================================================================= ==785==ERROR: LeakSanitizer: detected memory leaks Direct leak of 7 byte(s) in 1 object(s) allocated from: #0 0x28fcdd in malloc /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:129:3 #1 0x2be638 in main /root/mem-leaky/leaky.c:6:6 #2 0x2373df in _start /usr/src/lib/csu/amd64/crt1_c.c:73:7 #3 0x8002e4007 () SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s). //END TESTING Sweet! I'm not much of a c++ person but I am stoked to read up a bit more and see how you made this work - it is super cool from what I can glean so far - learning times for me - thanks! -Eric