Received: by 10.223.185.116 with SMTP id b49csp5292766wrg; Wed, 7 Mar 2018 09:19:31 -0800 (PST) X-Google-Smtp-Source: AG47ELvsKQpQX5sn+1KYAK4SmzGjXX8EcbXSdJi/Olo0ccDL6IhsxaniyZ1BisBKksi9GVdUHLM2 X-Received: by 10.98.249.10 with SMTP id o10mr23283174pfh.222.1520443171263; Wed, 07 Mar 2018 09:19:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520443171; cv=none; d=google.com; s=arc-20160816; b=otKVxFchbjlijZDqvvinjj6FVE3TYYWRSLxEdeZc6bfMFyrZranXgNLmWbRANgl6at fmmdKVs2vQyM/vdbJTCMgIrKv9ZPzbBZku+iFok2NTQCNxsEJkAT1dslpvKAfLxzvtQb pgefs/SHgRouf6HzrwxZTA6SAs7kyL/y1E6hMdBNnvSl+BEDyM7Y8oVUe1Gtyw7KRJXt PHfM3bYh+AwYuiak3NEal83Pp5X7boygP9gkKBfbi9gC1w8JMImqxwLSq3N4ych9+JeP Z4gjmGSlR/n+tDSNGnKwKmrzXTv6GEDw2LUt9BnEKCpg20giI4+JPEVRFUYlpHVbNq1w +DqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to :arc-authentication-results; bh=rh7ZkSLlRrbVqyNCxXwILuf6GYEnZrI477xjx7ZceYM=; b=hmFBuR5QE71LIu70k8iQSbeJnKZeNlEt2nVXTEVaELeEyHXlWm1LK26hiGuqoD4bNx 5QxkaUYyhLEDxm5IVNIuatJ3KQSC2B6024s/LOe/uLntM9ZIUEoYjfcAFgSYXEhoDaxb +fwrC+gU4U4EyRkVs75Qgshtt6SLIsKrpBSsj/e6y4Vq/fU+j2mNEv8dVzdsztMi3feR ro27wDANzmLoGM7tZNsAMg3PAVUN7pgbcz6R57LA8fNFqZ1Z6+B2v51V/uCjzuDb7TT5 8zmou/z9gU1A44fGGMz70G5b3JdL6JH3y+lWXwq0I+BiVRNgaBEDP2x5gY6x+mzbeSBg vQ/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f30-v6si13262945plf.654.2018.03.07.09.19.16; Wed, 07 Mar 2018 09:19:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754763AbeCGPMK (ORCPT + 99 others); Wed, 7 Mar 2018 10:12:10 -0500 Received: from mailout.easymail.ca ([64.68.200.34]:50913 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754645AbeCGPMH (ORCPT ); Wed, 7 Mar 2018 10:12:07 -0500 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id AAE6EC0E70; Wed, 7 Mar 2018 15:12:06 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo01-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XLnjfJEa4JC5; Wed, 7 Mar 2018 15:12:06 +0000 (UTC) Received: from mail.gonehiking.org (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) by mailout.easymail.ca (Postfix) with ESMTPA id D80B7C0E65; Wed, 7 Mar 2018 15:11:58 +0000 (UTC) Received: from [192.168.1.87] (shuah-xps.internal [192.168.1.87]) by mail.gonehiking.org (Postfix) with ESMTP id 9EC369F3E4; Wed, 7 Mar 2018 08:11:57 -0700 (MST) Reply-To: shuah@kernel.org Subject: Re: [PATCH] selftests/size: rework to use main instead of _start To: Anders Roxell , tbird20d@gmail.com Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Shuah Khan References: <20180307130725.8267-1-anders.roxell@linaro.org> From: Shuah Khan Message-ID: <613a519a-9c2b-fb11-ecb9-f3c464d0af43@kernel.org> Date: Wed, 7 Mar 2018 08:11:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180307130725.8267-1-anders.roxell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/2018 06:07 AM, Anders Roxell wrote: > In a -ffreestanding environment without glibc, we shouldn't be able to > call either getenv or printf. It seems that printf() happens to work > fine, but it ends up using the glibc getenv(), which doesn't work unless > we call the glibc _start() function first. > Using _start() was originally meant as an optimization to reduce the > memory consumption of the test program itself, in order to get a more > accurate representation of the available RAM at system boot time. > However, it causes more problems than it helps, especially when run from > a shell script that also consumes some memory. > > get_size[2838]: segfault at ffffffffffffffd0 ip 000000000040538b > sp 00007ffc41980668 error 5 in get_size[400000+b0000] > audit: type=1701 audit(1521532923.838:4): auid=0 uid=0 gid=0 ses=2 > subj=kernel pid=2838 comm=\"get_size\" > exe=\"/opt/kselftests/next/size/get_size\" sig=11 res=1 > get_size[2840]: segfault at ffffffffffffffd0 ip 000000000040538b > sp 00007ffdace9b378 error 5 in get_size[400000+b0000] > audit: type=1701 audit(1521532932.057:5): auid=0 uid=0 gid=0 ses=2 > subj=kernel pid=2840 comm=\"get_size\" > exe=\"/opt/kselftests/next/size/get_size\" sig=11 res=1 > > Rework to get_size test to use main (and printf) instead of _start. All > other seftest tests uses main and not _start. > > Fixes: 0081901af95f ("selftests: size call ksft_print_header() to print TAP header") > Signed-off-by: Anders Roxell Andres, Thanks for finding and reporting the problem. This patch is in linux-kselftest next for 4.17-rc1. I would rather revert the patch than fix it a this time. I knew there was a reason why Tim didn't use printf() in the first, I couldn't remember. I won't be sending 0081901af95f ("selftests: size call ksft_print_header() to print TAP header") for inclusion into 4.17-rc1 thanks, -- Shuah