Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1090775ybl; Fri, 16 Aug 2019 08:44:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFTUAXdyPouFNAnLD1y8Ju4iGoIfOsJpf6IViY6EvDjf4cLYchJJIxWAXterkbagjNUfPY X-Received: by 2002:a63:b64:: with SMTP id a36mr8515942pgl.215.1565970291673; Fri, 16 Aug 2019 08:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565970291; cv=none; d=google.com; s=arc-20160816; b=Bz7glSYbSBGRHcCPUUB1ZPdKjh7p/9BfktxuVmUIMP0+Svpl/pooe8AP0Br0yHvz9u jYzl9lkqJ/R2CrdL/wWjo6ocfNgGLhuedH9GhScxm3EJTKyT2EDd500bGDD12jYO3cM4 raEz8yoBkZnogdfdfSTqNtTaboRmxU+Z5vaOavf0AHlwWkLEghKVTO0U8B+vOql3Ft8R G9yDAU5fW1DSH21e1wm3OPSinpmBVyfpmPFc3CTjXFqcpswPLDszNQY9LhkVgCPfkMPH 12Z+NIGI4/udjVhEEp/fm5IZs5Wi+ax1iirEl/I1kU/UKstcAajSlwor+mAmD2TPm2Ni +v9g== 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=lgS4J8tR/U8msMdX1m3cIxbU1oG3zyDcjkIshIPFp54=; b=mgIDy4m+ql4KSjVfI2GFpGphQ2oBCSPTQgoBBJs9KYgfat3Gn4OWXL35iH6p+E5thi pGHXhkNUc3LamD1uEadhTWljmIDMo+X4kxB1doNSsr5k9qYoPgf/Jo2cZh2nLPn6j/Hw LffMxPHf3C31avsI+0TGdaSh495Jmm8vb24620ZVGYwSIs4gvKqRZKO6MTiO9/3Y02FU UEXS/tFyP9+fAn9xCAOt5SZEuDJYH4luUoLKfvBzmrQUednRMs/iz9DBdV6tQE+UNSQ4 8V7vSTpT2yzZikqLS8EZrFffOLylFzbkvNvB5QMAVNSCOqdhwarQCionkTnoaZpqcQJV TiZA== 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 y18si2667385pjp.46.2019.08.16.08.44.36; Fri, 16 Aug 2019 08:44:51 -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 S1727421AbfHPPn6 (ORCPT + 99 others); Fri, 16 Aug 2019 11:43:58 -0400 Received: from mga04.intel.com ([192.55.52.120]:43813 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727311AbfHPPn6 (ORCPT ); Fri, 16 Aug 2019 11:43:58 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Aug 2019 08:43:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,393,1559545200"; d="scan'208";a="171449603" Received: from ppiatekx-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.39.24]) by orsmga008.jf.intel.com with ESMTP; 16 Aug 2019 08:43:45 -0700 Date: Fri, 16 Aug 2019 18:43:44 +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: <20190816154344.223mtts6jngx424d@linux.intel.com> References: <20190713170804.2340-1-jarkko.sakkinen@linux.intel.com> <20190713170804.2340-25-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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. /Jarkko