Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1098701ybl; Fri, 16 Aug 2019 08:53:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVaO6BKw7rMC/4crKTjHmInRfDoFdv4X4fk8holxz1l++oQysjC7KPCFM2tkwZNEuro5l+ X-Received: by 2002:a17:902:20cc:: with SMTP id v12mr9270495plg.188.1565970786889; Fri, 16 Aug 2019 08:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565970786; cv=none; d=google.com; s=arc-20160816; b=j333fvM9pSx29G4/Fl6CU8ygOTxB6yVJLD36NrF9JhNZ1mIQaTb+6m8wvl5wiuh0uM OfnISNd4580Lwm5T0PMoz5PWmBAGlK6sDMlbtc4G8UUDvYBA76n2QXHG8+3LwtfsjJA6 dmWyMr05aC2VgAg7ekx3o6OVc1DJyJu192n8wDf6I/WrNVPvCzb9a2YzmPoGK1BOMbh3 sHeRmuZA/Tsgj7MtRGVfNBtWPSqUVak3UIdebtTeVvF5/vbzhLvygEhojnhXqZhdDgDC bvm03xyibVvCD3Pn/tuWMc1jReILX6p43vCbrJSAKCBbPvDhfn2N4h4vLxuMPMzYr/9F GQVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=C/668QtCDKUNj93FNrHTENdxL9o0c3XphtoETLGLdAA=; b=KkMKD0Waip0yloNoxc+jtrov4YhYpdGmvx60lKnLMmuDypkXoLHxnFZazjOF/49MMK lJK2FdvHEzWoqkWDbBNmLXSOWmlockiHCZvgVBN0VkNeTdNszllOGD0OzluXkQHkn4wY 2OYav9O+T9cPdb1IDYU/d/fRe/3hRllZM2DdVG5qRWp2bbxS6/LznL0j7mgKCK7cbf8X wsf6F6o2BefnSC65IzgJG1jrrt0EerJglFlYPnUZRsejamLqBedf/R/yl0oRuvynU3uW C5QSRMwcIJCqFFQE84bjc2pStNyzhqOBdlzqPvo0jVSqP7CtVTJZEfoJfWC3p6Cf9hh6 Bxvw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c41si3002795plj.209.2019.08.16.08.52.51; Fri, 16 Aug 2019 08:53:06 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727441AbfHPPwQ (ORCPT + 99 others); Fri, 16 Aug 2019 11:52:16 -0400 Received: from mga18.intel.com ([134.134.136.126]:61553 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727312AbfHPPwP (ORCPT ); Fri, 16 Aug 2019 11:52:15 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Aug 2019 08:51:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,393,1559545200"; d="scan'208";a="168084887" Received: from ppiatekx-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.39.24]) by orsmga007.jf.intel.com with ESMTP; 16 Aug 2019 08:51:37 -0700 Date: Fri, 16 Aug 2019 18:51:36 +0300 From: Jarkko Sakkinen To: "Xing, Cedric" Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, sean.j.christopherson@intel.com, nhorman@redhat.com, npmccallum@redhat.com, serge.ayoun@intel.com, shay.katz-zamir@intel.com, haitao.huang@intel.com, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, kai.svahn@intel.com, bp@alien8.de, josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com, rientjes@google.com Subject: Re: [PATCH v21 24/28] selftests/x86: Add a selftest for SGX Message-ID: <20190816155136.po23te4zi3k263wm@linux.intel.com> References: <20190713170804.2340-1-jarkko.sakkinen@linux.intel.com> <20190713170804.2340-25-jarkko.sakkinen@linux.intel.com> <20190816154344.223mtts6jngx424d@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190816154344.223mtts6jngx424d@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 16, 2019 at 06:43:44PM +0300, Jarkko Sakkinen wrote: > On Wed, Jul 17, 2019 at 03:37:03PM -0700, Xing, Cedric wrote: > > > +$(OUTPUT)/encl.bin: $(OUTPUT)/encl.elf $(OUTPUT)/sgxsign > > > + objcopy --remove-section=.got.plt -O binary $< $@ > > > > .got.plt section will never be present for statically linked binaries. > > You are right that it should not be there because the enclave does not > use any library calls. And if it did, we would want to assert that and > fail the compilation if it is the case. > > Assuming that .got.plt can never exist in a static binary, however, is > simply not true. A common example are library calls such as strncpy(). > The default handler selects the fastest implementation and substitutes > that to the GOT. > > The right way to fix this is to assert it in the linker script. In addition, objcopy should be replaced with $(OBJCOPY). /Jarkko