Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp159486imm; Thu, 12 Jul 2018 16:20:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdMUfoNuCumjq2jZ1cngHQ0Ycdfqn+cqM04A/NeVL7CSmhbYl7/WgsmuWqcd/JCYLl+XgQU X-Received: by 2002:a17:902:8c88:: with SMTP id t8-v6mr3959009plo.117.1531437659340; Thu, 12 Jul 2018 16:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531437659; cv=none; d=google.com; s=arc-20160816; b=iULxxD14ZqHHKdKKzc67Wn8a4CUaqCn20zAXgCQ6kyQbWB8v2B2WAQYtQLpkcj3F6e PN0fwdpAGKD3xin4Or6sS5jYeQf79rwlUtix/UN7dWpCtG4c7texiPAuw0r/j1/oM9iV E6YXNhsfHP3SOpUIiCB/nLz8ruOgx3EYe+R043b2PtA5YMHqIU2IjYIrAXTfPypycYvX S5u4WxPBQ7yEjvYdgVPORCl+U/jaP5F6bXKiMCEJXUDKY7m49usgUSTtpHF9u83bsg7G iHlPyK0GuQ9ka+Fb81RIE+tZkasdMAoA8mOi2iRpUyAy0edY8KrEe5ZgnFTdpsi3KBvD wnmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=DcK46Q99O7zg0qFywGK5ISuKvrCOmsvXy4TNoaEAQ0k=; b=hQm/p4trwYf9LiN9NatG5/k6h03GijcwxUUC6BzpdvgrTnpouneRvx8WCfRJu9EHL+ +iAlM9fIcPXy/tig537H7B6E/fIWIxBjgg8EK7IZHBiC1LVCWJbCCrSasHg5Vd3ILRcx SvAsemtI6QEPLp77EdT/wBUOsj9EdqzACF9gHLCU8St3ESAb1VQ7woOyiRORXRuXLXeV 7G5IAlK5DJhQCblSgAEcICWXf2b63cP4lisMYiD7xybdPc0VjuYLlnubKuq/hpJe4kiW BrOfVhhhUVFQLl3hI0tnGHst8uGuDWeGYXhBC4SytpzCIcT7QgKiGJV5PK5SS3asoUlF pgJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="nv/S24D/"; 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 c14-v6si24986599pfl.319.2018.07.12.16.20.43; Thu, 12 Jul 2018 16:20:59 -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=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="nv/S24D/"; 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 S2387604AbeGLXb5 (ORCPT + 99 others); Thu, 12 Jul 2018 19:31:57 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43151 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732464AbeGLXb5 (ORCPT ); Thu, 12 Jul 2018 19:31:57 -0400 Received: by mail-pg1-f195.google.com with SMTP id v13-v6so4352710pgr.10 for ; Thu, 12 Jul 2018 16:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DcK46Q99O7zg0qFywGK5ISuKvrCOmsvXy4TNoaEAQ0k=; b=nv/S24D/ymDVmWqNcKQgMMzKNb4B91ZckfdTrdqgtvXif/+77n3ISn2elOSIwUOYXz VkW0F7zys5YRuNgSbrO4FoHHasFj8hww6bP8zflbNprFUw6asBVJPiMVrDZFxuGXbcN+ C9VwPGzI5zcWo/UfBhgA4tkCi7hr/DYz/9/c8TVNjdRxTi0Om9vr/FAjo6OPJGjA88tm 7gpF5Ikshq116NUWytS9w8kVUFIMCac1F71cimNcK/dD5mjQmnwMSY26e5bkGAExKmAu T+zSpowuIQLBr5esbTB5W3qyFEsHtrWi3YsIKO3D6d1pbvfXjy5H9dFi0z8KwzKA7xOs IxuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DcK46Q99O7zg0qFywGK5ISuKvrCOmsvXy4TNoaEAQ0k=; b=OtaTG9lZEkBlY+nSQqRQo6wNEdVh9I2bDRtmuiX806PRvDjsRaIajS/2I82ssrC2pT UtcAzXeXQTSinkvJFLTIXTtJeyiw92Q5sMqAa7QgOhtBibWRT4e2GcW02CyhCvuKPB6c VJGIDyP3sDXV11JGtolk27Ne0XaVDyNlikaFNF1B53L+TJweYmuPX7P7Amv76rF6JO54 MCVw6EDSsWFHZtE2FrSisrzdcRXwsgjCTyjIZZEyXqDE0475lipg9cm7H4pMVoq/V1sL oAhj3dCNmyJtuEvGkg6A/Z1nmvTgmHqyPdS0W7Xs2UaV6PBUkNoTLNfT1SlG19inH9F9 DVOg== X-Gm-Message-State: AOUpUlF2SWkkRE98U5en6HLV5dMMUx1ZnOvvylQygDBmt9Z5tsTCCABj sygOdHnP/cmbdS/YwZhXLgPM8w== X-Received: by 2002:a63:8c0b:: with SMTP id m11-v6mr3854123pgd.372.1531437609695; Thu, 12 Jul 2018 16:20:09 -0700 (PDT) Received: from ?IPv6:2600:1011:b01e:e4d1:54df:ba07:cac1:aeab? ([2600:1011:b01e:e4d1:54df:ba07:cac1:aeab]) by smtp.gmail.com with ESMTPSA id p8-v6sm6040326pfk.186.2018.07.12.16.20.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 16:20:08 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] x86: vdso: Fix leaky vdso link with CC=clang From: Andy Lutomirski X-Mailer: iPhone Mail (15F79) In-Reply-To: <1432bfde-41b4-e8aa-037b-fca41a149cb8@zytor.com> Date: Thu, 12 Jul 2018 16:20:06 -0700 Cc: Alistair Strachan , linux-kernel@vger.kernel.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, Greg Kroah-Hartman , x86@kernel.org, kernel-team@android.com, joel@joelfernandes.com Content-Transfer-Encoding: 7bit Message-Id: <5AB78E47-BC62-4DA5-920B-00E9731AAE04@amacapital.net> References: <20180712201032.156997-1-astrachan@google.com> <47d4b24e-8c60-fb3b-3377-62d20c5f3dd1@zytor.com> <1432bfde-41b4-e8aa-037b-fca41a149cb8@zytor.com> To: "H. Peter Anvin" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 12, 2018, at 3:06 PM, H. Peter Anvin wrote: > >> On 07/12/18 13:37, Alistair Strachan wrote: >>> On Thu, Jul 12, 2018 at 1:25 PM H. Peter Anvin wrote: >>>> On 07/12/18 13:10, Alistair Strachan wrote: >>>> The vdso{32,64}.so can fail to link with CC=clang when clang tries to >>>> find a suitable GCC toolchain to link these libraries with. >>>> >>>> /usr/bin/ld: arch/x86/entry/vdso/vclock_gettime.o: >>>> access beyond end of merged section (782) >>>> >>>> This happens because the host environment leaked into the cross >>>> compiler environment due to the way clang searches for suitable GCC >>>> toolchains. >>>> >>> >>> Is this another clang bug that you want a workaround for in the kernel? >> >> Clang is a retargetable compiler (specified with --target=) >> and so it has a mechanism for searching for suitable binutils (from >> another "GCC toolchain") to perform assembly and linkage. This >> mechanism relies on both --target and --gcc-toolchain when >> cross-compiling, otherwise it will fall back to searching /usr. >> >> The --target and --gcc-toolchain flags are already specified correctly >> in the top level Makefile, but the vdso Makefile rolls its own linker >> flags and doesn't use KBUILD_CFLAGS. Therefore, these flags get >> incorrectly dropped from the vdso $CC link command line, and an >> inconsistency is created between the "GCC toolchain" used to generate >> the objects for the vdso, and the linker used to link them. >> > > It sounds like there needs to be a more fundamental symbol than > KBUILD_CFLAGS to contain these kinds of things. How about $(CC)? > > -hpa