Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2924985yba; Tue, 16 Apr 2019 00:30:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYuES4PqwKlJV5PIqygvIMoQJwMgcnyfYwhTGv8kFECHaEgZdfpOS4xUtCoA8BocrnsHfc X-Received: by 2002:aa7:9a89:: with SMTP id w9mr73150111pfi.213.1555399845671; Tue, 16 Apr 2019 00:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555399845; cv=none; d=google.com; s=arc-20160816; b=kKXgJLgY3Yr3rV+cjc9OAUA8/SKLsL/0v6Cn52QeQ7jL5zPgGe+Fint8XGrA9m6L79 ibu755XYgPEmHuL/rCluoWrhl/sKPeRwqjbqFjzblbxczm9mWXnJTvn5MWjSplbkEIYH aYsoUbVmKmRSZq9f3p21ORupFsnBO7gdtilJTfUNfcmTUbZBSCmOy6+jZ7y+vPGYpTBn zzrgqqjHiaB8DdXmx9yFYtSWVEYbRAeDrU6QPtOZ6XUV4WI+hDWfustrkT5rSTorIyA8 SLMTfpWIknpEhXz59LwQd7ZsDGHKOt8kPeebSmRzjZ3wgYSNtbJ4FFLabRgRYoxHRuHp ju+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=iSo05Jt5RnAXOby2ru8viiose9aGvqFZsI6rZkMZre8=; b=KPerL+ygv1sGH1kGWMXN08USIyWZwsrHVde24uGL31O71AfJfRKrYm1q/PhHV9pT67 r6pqy9pqLmNDhfM6AmGeiwIBZWpeccRpuX6Q+UITPbpScuesH8cojU8moqZj1ayC15W8 uvllfKb/Q02u0D/1x53vzHKe2YIQgOZ7cgfTl/l5bpXiuYEuSFs+OzqdU5sjdpQ1dZuf 2ZTw1BJWSTtk/cak3rfv0V1zd+niFM6gU6zb4RBApvWyOSqhGlBcXUBp3x5u9f3MTemg yZ4fwYu5ZKog/al3zLjIwCg99AtK/beXAwHTaTBrKxwtUZfYbRy2jY0p/I2qaupTvFSj PB/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ncIxQhDf; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si27103352pgr.202.2019.04.16.00.30.29; Tue, 16 Apr 2019 00:30:45 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ncIxQhDf; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728550AbfDPH1u (ORCPT + 99 others); Tue, 16 Apr 2019 03:27:50 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43668 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726775AbfDPH1t (ORCPT ); Tue, 16 Apr 2019 03:27:49 -0400 Received: by mail-wr1-f65.google.com with SMTP id k17so20782240wrx.10 for ; Tue, 16 Apr 2019 00:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=iSo05Jt5RnAXOby2ru8viiose9aGvqFZsI6rZkMZre8=; b=ncIxQhDfEo1k5qTMVIrNV31WUnjG2KFlbshj7pVKd82+qcBDfmUmXkxh91hwQBM6ao GalhBIvaU7rOQ59ne9KDebLuzQGVdJJK/1Klt37uY4km44lMSaH1u9BiUJjVCcBLanJF sbdhnZ3oDimQsyZabvDUe7oYBO621DxMDehyeVbJhlAyaYpNA4+/A9UnMVhikmONcaiE LABRuktZjDisyBzVleiga23BQb122xtr77DfPEpgpxKsNg2L2YyzADNFta7NeG55tTs0 2u2b2raB5x1yxLOCFqrv8UnLNcwL/QJauAQ6kRqGQKu6YzLaP1/jJs0F63M8gf49U1Z2 0luw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=iSo05Jt5RnAXOby2ru8viiose9aGvqFZsI6rZkMZre8=; b=gO0fsMTJ3o+G6TrjCc0ZUUlCShhHntxjkpAiYhj9KDbgO5GIE5yaZOkjxIleUT8bw7 jCMp2YOiH5bn/VK+XACCAioXkWWBRMgrR3f6dlbAZxexLm99ASqt9+eZZ0Of+5b4++h8 cLySpLDSzpcjKdhfz+RktJY64hUzuCX7uUJQOusq3Ar2Qg9L9TxBCgmGZFKuPPwQEW87 qC0ZzpNWavUeqQZm/9EqXRgeVjyt54nOjocADhzCiSk6+ZXityD1JB/ZLdgutBVNK5up b51smDrmHUBRaA89kcBqY7Q4dCFOlrGwrKSh98cxf/xJXAFucxSksimePmVVl5badj9C Uwtw== X-Gm-Message-State: APjAAAWrdpisjFIQpTEqwLx3xbzavjgcg2PSJS6DnftJ68BNwrtWs3sT dYg1lPNNVgYVg+kSyMnyulg= X-Received: by 2002:a5d:4446:: with SMTP id x6mr49905438wrr.147.1555399668228; Tue, 16 Apr 2019 00:27:48 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id s21sm21302057wra.45.2019.04.16.00.27.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2019 00:27:47 -0700 (PDT) Date: Tue, 16 Apr 2019 09:27:44 +0200 From: Ingo Molnar To: Andy Lutomirski Cc: Elena Reshetova , LKML , Josh Poimboeuf , Kees Cook , Jann Horn , "Perla, Enrico" , Ingo Molnar , Borislav Petkov , Thomas Gleixner , Peter Zijlstra , Greg KH Subject: Re: [PATCH 1/1] x86/entry/64: randomize kernel stack offset upon syscall Message-ID: <20190416072744.GB127769@gmail.com> References: <20190410112103.15170-1-elena.reshetova@intel.com> <20190410112103.15170-2-elena.reshetova@intel.com> <20190410114259.GB9293@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski wrote: > On Wed, Apr 10, 2019 at 4:43 AM Ingo Molnar wrote: > > > > > > * Elena Reshetova wrote: > > > > > 2) Andy's tests, misc-tests: ./timing_test_64 10M sys_enosys > > > base: 10000000 loops in 1.62224s = 162.22 nsec / loop > > > random_offset (prandom_u32() every syscall): 10000000 loops in 1.64660s = 166.26 nsec / loop > > > > Stupid question, how did you manage to buil timing_test_64? Here it fails > > with a bog standard gcc 7.3.0 x86-64 distro toolchain: > > > > dagon:~/luto-misc-tests.git> make timing_test_64 > > g++ -m64 -o timing_test_64 -O2 -g -std=gnu++11 -pthread -Wall timing_test.cc -lrt -ldl > > /usr/bin/ld: /tmp/cc8VRkuV.o: relocation R_X86_64_32S against `.text.startup' can not be used when making a PIE object; recompile with -fPIC > > /usr/bin/ld: final link failed: Nonrepresentable section on outputcollect2: error: ld returned 1 exit status > > Makefile:39: recipe for target 'timing_test_64' failed > > > > I think your toolchain is screwy. If I create this file as ingo.c: > > #include > > int main(int argc, char **argv) > { > printf("Hello world!"); > > return 0; > } > > And build it like this, it fails: > > $ gcc -o ingo -g ingo.c -pie > /usr/bin/ld: /tmp/ccofYU9N.o: relocation R_X86_64_32 against `.rodata' > can not be used when making a PIE object; recompile with -fPIC > /usr/bin/ld: final link failed: nonrepresentable section on output > collect2: error: ld returned 1 exit status > > Which I assume means that -pie requires -fPIC, and your toolchain is > screwed up and is defaulting to useless options. I'm guessing you > should file a bug against your distro gcc package. For me, it works > if I remove -pie. It's just a bog standard Ubuntu x86-64 installation. Thanks, Ingo