From owner-svn-src-all@freebsd.org Thu Mar 30 05:51:31 2017 Return-Path: Delivered-To: svn-src-all@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 5D67AD255F8 for ; Thu, 30 Mar 2017 05:51:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm8-vm2.bullet.mail.ne1.yahoo.com (nm8-vm2.bullet.mail.ne1.yahoo.com [98.138.90.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27F46F94 for ; Thu, 30 Mar 2017 05:51:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1490853084; bh=fsjEbjtvTH+j3F8FrfrEs9WhfEKRO+pRfBhdXrswhWk=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=NTols793xML1oeDpUIGKQtH3Upmerx1rLqZku/rgW+HDXjaUUVWfZie2f1OSLMHRWz7PoDW6s/Dl9TLsz00X5hrfGRxJYH23/+cAvCPjd6dVE82186gcYQjZ9haiR1sM1JzhZiB5YqYmOXjMnToXMHxu82Wr2UA5tqo24VCjfmEInQJpsl7pHBpA/dcXpjaMfcsjIqwdlE5vwhLADnDRzb0o0BWRWOemwR9Ho3rNv8QNueBZRZdu0XF0l8M722TbfksGjfP5A70fUX3PI+jaTFrSYuYREP1qdVlR0ALSw8eI8TQ7T7z86aISdKXBg8JwBOXomxyilrqteFnUBfAcsA== Received: from [98.138.101.128] by nm8.bullet.mail.ne1.yahoo.com with NNFMP; 30 Mar 2017 05:51:24 -0000 Received: from [98.138.104.116] by tm16.bullet.mail.ne1.yahoo.com with NNFMP; 30 Mar 2017 05:51:24 -0000 Received: from [127.0.0.1] by smtp225.mail.ne1.yahoo.com with NNFMP; 30 Mar 2017 05:51:24 -0000 X-Yahoo-Newman-Id: 9323.64614.bm@smtp225.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: HlWszdMVM1nCfUKqMiY6nKVlA8yjbsdUVT7ZG_qPNd9eY5m .Sj_oitChO5_y28J.iRLkoQp7lfxDslComQ.Ur9Lh.qH.Rbo_CMFSFNHTIgD kQfW_KfAFNiZHLu2Dtm4hYac4f8Kk8rAK8UL1FblxABzg6mewaZFhBugEx7K m9ikg0h8uHfEVkvsNH99wgfXd9_5gT03_h_hRtclCQ2xmf9OEPZpxH5W7Zqo 0sUFH2JHmJozRUf4vHxfIhtdYawUEZt5XHZ5gu0Hs28fflCwW9x00jDWcDjt OUV_nu8Sm3kmawVy0RFATunA.fKsp2I1a2bOFy8fOWPdxrUsFCKrndXOUfNc w18jZjswYMaXxSupiDQHJcX4uUZmKi7ifdkyM1PHVVfQACPbKAjUyNGg5II4 MW4Db2Lk27pNDbg3v6iYhKfvrAC379dlIQmQInYH_pB3T4vIX6.swWKDxoKn n8bTF_UaixxMz3YBDA6kmhTQxyucMXms.RaH4u27VP8y7pdFlHBZamOisgXk ab8cSSBveCSCn5JFWUQYyzqL0BAI3ZZ.RY8Rj3WL5.DdF X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r316213 - in head: include lib/libc/include lib/libc/stdlib lib/libc/string lib/libc/tests/stdlib lib/libc/tests/string sys/sys To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201703300457.v2U4vQJw072106@repo.freebsd.org> <20170330050012.GW43712@kib.kiev.ua> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <82479073-92cf-380c-5f4c-c33aa31bb1b3@FreeBSD.org> Date: Thu, 30 Mar 2017 00:51:04 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170330050012.GW43712@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Mar 2017 05:51:31 -0000 Thanks! On 30/3/2017 00:00, Konstantin Belousov wrote: > On Thu, Mar 30, 2017 at 04:57:26AM +0000, Konstantin Belousov wrote: >> Author: kib >> Date: Thu Mar 30 04:57:26 2017 >> New Revision: 316213 >> URL: https://svnweb.freebsd.org/changeset/base/316213 >> >> Log: >> Implement the memset_s(3) function as specified by the C11 ISO/IEC >> 9899:2011 Appendix K 3.7.4.1. > Due to (somewhat) controversial nature of the specification, it > was agreed that only memset_s() is added, as the function which > has real users, even if outside the tree. There is no plans to > add other functions, unless somebody needs them. Apple's libc also implemented memset_s() based on some draft implementation from NetBSD. This one looks better. > If people are curious what are the issues with the Appendix K, > please see documents > N1173 Rationale for TR 24731 Extensions to the C Library Part I: > Bounds-checking interfaces > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1173.pdf > N1967 Field Experience With Annex K > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm > from the JTC1/SC22/WG14 - C working group. > > Very interesting, thanks! We looked at the spec for a GSoC but ultimately we ended up spending a lot more time on FORTIFY_SOURCE and left it aside. Ultimately we also left FORTIFY_SOURCE aside but someone has to try such experiments :). The annex K is basically a Microsoft thing (I think I read about glibc adopting it experimentally though). I think it should be useful to have it as an external library for portability, not part of libc or even base. I also find interesting that you included an error handler. Perhaps this may be useful for other types of runtime bounds checking like the stack canaries, safe stack or even the sanitizers. I haven't really looked but we still depend on a GCC library (libssp) for the stack protector so we have a can of worms there. Pedro.