Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753243AbbEKPiI (ORCPT ); Mon, 11 May 2015 11:38:08 -0400 Received: from mail-db3on0091.outbound.protection.outlook.com ([157.55.234.91]:13238 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752758AbbEKPiD (ORCPT ); Mon, 11 May 2015 11:38:03 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; Message-ID: <5550CCC6.40200@ezchip.com> Date: Mon, 11 May 2015 11:37:42 -0400 From: Chris Metcalf User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Linus Torvalds CC: Al Viro , Fabian Frederick , Randy Dunlap , Rickard Strandqvist , , "Peter Zijlstra" , "David S. Miller" , Frederic Weisbecker , Andrew Morton , Sam Ravnborg , "Stephen Rothwell" , "Theodore Ts'o" , Grant Likely , Linux Kernel Mailing List , Subject: Re: [PATCH 0/3] add new strscpy() API for string copy References: <1430409677-13284-1-git-send-email-cmetcalf@ezchip.com> In-Reply-To: <1430409677-13284-1-git-send-email-cmetcalf@ezchip.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: CY1PR0801CA0036.namprd08.prod.outlook.com (25.163.136.174) To DB5PR02MB0776.eurprd02.prod.outlook.com (25.161.243.147) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB0776;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB0728; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:DB5PR02MB0776;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB0776; X-Forefront-PRVS: 05739BA1B5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(6009001)(479174004)(24454002)(51704005)(377454003)(77156002)(62966003)(15975445007)(33656002)(77096005)(40100003)(122386002)(23676002)(42186005)(36756003)(50466002)(65806001)(66066001)(65816999)(83506001)(86362001)(87976001)(54356999)(50986999)(76176999)(110136002)(92566002)(19580395003)(189998001)(5001960100002)(46102003)(4001350100001)(2950100001)(21314002)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR02MB0776;H:[10.7.0.41];FPR:;SPF:None;MLV:sfv;LANG:en; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2015 15:37:53.7984 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR02MB0776 X-OriginatorOrg: ezchip.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4116 Lines: 95 Ping! There was a little feedback on the strscpy() patch series, but I think at this point it boiled down to adding a __must_check on strscpy(), which I've done. Any further opinions? Would anyone like to volunteer to take this into their tree? Or Linus, are you ready to pull it directly when the merge window opens? git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile.git strscpy Thanks! On 04/30/2015 12:01 PM, Chris Metcalf wrote: > This patch series addresses limitations in strncpy() and strlcpy(); > both the old APIs are unpleasant, as Linus nicely summarized here > a couple of days ago: > > https://lkml.org/lkml/2015/4/28/570 > > and of course as other folks (Greg K-H and Linus again) said last year: > > https://plus.google.com/+gregkroahhartman/posts/1amLbuhWbh5 > > The proposed new API (strscpy(), for "s"afe string copy) has an > easy-to-use API for detecting buffer overflow, avoids unsafe truncation > by default, and isn't subject to thread-safety attacks like the current > strlcpy implementation. See patch 2/3 for more on why strscpy() is a > good thing. > > To make strscpy() work more efficiently I did the minimum tweaking > necessary to allow to work on all architectures, > though of course individual maintainers can still make their versions > more efficient as needed. > > It's likely not necessary for per-architecture implementations of > strscpy() to be written, but I stuck with the standard __HAVE_ARCH_XXX > model just for consistency with the rest of . > > I tested the implementation with a simple user-space harness, so I > believe it is correct for the corner cases I could think of. In > particular I pairwise-tested all the unaligned values of source and > dest, and tested the restriction on src page-crossing at all > unaligned offsets approaching the page boundary. > > This builds on an earlier version of strscpy() submitted as > a file-static method in the arch/tile/gxio tree last year, after > an attempt to gather interest in a new generic strscpy failed: > > https://lkml.org/lkml/2014/8/7/368 > > The patch series is available to be pulled from > > git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile.git strscpy > > Chris Metcalf (3): > Make asm/word-at-a-time.h available on all architectures > string: provide strscpy() and strscpy_truncate() > tile: use global strscpy() rather than private copy > > arch/arc/include/asm/Kbuild | 1 + > arch/avr32/include/asm/Kbuild | 1 + > arch/blackfin/include/asm/Kbuild | 1 + > arch/c6x/include/asm/Kbuild | 1 + > arch/cris/include/asm/Kbuild | 1 + > arch/frv/include/asm/Kbuild | 1 + > arch/hexagon/include/asm/Kbuild | 1 + > arch/ia64/include/asm/Kbuild | 1 + > arch/m32r/include/asm/Kbuild | 1 + > arch/metag/include/asm/Kbuild | 1 + > arch/microblaze/include/asm/Kbuild | 1 + > arch/mips/include/asm/Kbuild | 1 + > arch/mn10300/include/asm/Kbuild | 1 + > arch/nios2/include/asm/Kbuild | 1 + > arch/powerpc/include/asm/Kbuild | 1 + > arch/s390/include/asm/Kbuild | 1 + > arch/score/include/asm/Kbuild | 1 + > arch/tile/gxio/mpipe.c | 33 ++--------- > arch/tile/include/asm/Kbuild | 1 + > arch/um/include/asm/Kbuild | 1 + > arch/unicore32/include/asm/Kbuild | 1 + > arch/xtensa/include/asm/Kbuild | 1 + > include/asm-generic/word-at-a-time.h | 80 ++++++++++++++++++++++--- > include/linux/string.h | 6 ++ > lib/string.c | 109 +++++++++++++++++++++++++++++++++++ > 25 files changed, 212 insertions(+), 37 deletions(-) > -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/