Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1557614imm; Wed, 23 May 2018 19:18:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqcDrv2TZOBL8MxuuzKGmo2p+gTHyR+HAj49U/rMDlI+whorF5bNM88zVBPSKiA3Y25rvGo X-Received: by 2002:a63:6741:: with SMTP id b62-v6mr4218057pgc.5.1527128282627; Wed, 23 May 2018 19:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527128282; cv=none; d=google.com; s=arc-20160816; b=v55735RWsddrmZfbOp7hTBZAoVHWM6HvxgzVirje35iZ+CBooAStYO47ajZb/yQV34 /iw7RAzarwqGAcbpciiX0lBf1NUO2nOiE/umoKRIDq19xpsZTGlEwp2KldPqLkUibWkM SKs+xNrViqItb3s0fw5JTJKiUrZzT11NMCeS1eILJj0WR7HljngtgZuZNDi1Y0Tuc0F8 /ZLYcHG7/FX0hJN8RIeikoQCuz/txbBSu1kBV+Qr0IK7Vx/cEZJ6SPtjGlIgU4Yrc47f zj482rH75HapJYlo+LwPN+IRGgSLVtC6HLXLRFiKson0ytfVvkR4TlngeMdbS3f0F8AF ZEpw== 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:arc-authentication-results; bh=kD/UTeqNppM2Wlvo/83+iG9XfRS6207qfTopBAxw6nc=; b=kyfDu9Yy5PhGbXDjbNUh66IqxzWuJ98h+akxEHe1XM8D1ifQlSRp8pcWs86q1DFqwr 2ryi5+pu6P7sKb9WmNWNRvfwsK1jBTfjUF5ZTEbs+9b1YBXTycZExEyOHseyko1ztFRv zElzqql3O5jgbZnx9z2XFq5VxutwmrwIc7NjhD8//MwHsp2FsKtZJBpAEdrCXpuYsyfg 338nAqSR83FplBaBkYzwQPXQBOWyrOeJnJOreIhzc/Sv2DZZuj+MkNvL9MRhtMM4jJ2V JUh7ZzkQ7E5R2pv8/mrPzSlcUoWe2xOd5+OhR320YjhBfnuNfd5QtOZm4UbmUYjS6YkP odvQ== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a4-v6si19896248plp.219.2018.05.23.19.17.48; Wed, 23 May 2018 19:18:02 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935568AbeEXCQI (ORCPT + 99 others); Wed, 23 May 2018 22:16:08 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:33461 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935126AbeEXCQF (ORCPT ); Wed, 23 May 2018 22:16:05 -0400 Received: by mail-oi0-f66.google.com with SMTP id k5-v6so76756oiw.0 for ; Wed, 23 May 2018 19:16:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kD/UTeqNppM2Wlvo/83+iG9XfRS6207qfTopBAxw6nc=; b=cHsHtrE4cP7PQ8xuAKBEe+nWgwemGyANAA29JkrGugmcbaR1M/PHwgCYpRko+LyYfl AD0nzpwfpwm3wlchI5eK7NnsdofC+LH8nN5uQFf6jAFrgS62EQwipHdiKqjpuG1nYxti MFf78EB9epWEUazPfzr4WC4OMnTDcjRym4vV1rKIVbknM6JYao9anjHNYTVVGFfv2aYW zbKwrgeSFPEtCm1sithzANo9Lqi3wdDrsa8J+KsC8qiEBRE38j34VFrN6RblOgA3xG+r lKAFSLBSomo6zRu4knN+2JDewYdMNpr4Y/Xx6oIO+I8AAG52Q3rs4snGyyM6U4YufRfQ pTcw== X-Gm-Message-State: ALKqPwf9m8YgTSVvXENKOLAfBCbngBAA7Rt6gC7gTQlaDu35t8YGNqeu 3TtR5UjaN+47+jL0X6Bz3KdOBg== X-Received: by 2002:aca:b40a:: with SMTP id d10-v6mr2706379oif.310.1527128164840; Wed, 23 May 2018 19:16:04 -0700 (PDT) Received: from ?IPv6:2601:602:9802:a8dc::d2dd? ([2601:602:9802:a8dc::d2dd]) by smtp.gmail.com with ESMTPSA id d201-v6sm10920750oig.18.2018.05.23.19.16.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 19:16:03 -0700 (PDT) Subject: Re: [PATCHv3 2/2] x86/vdso: Add build salt to the vDSO To: Masahiro Yamada Cc: Andy Lutomirski , Mark Wielaard , "H. J. Lu" , Linus Torvalds , X86 ML , LKML , Nick Clifton , Cary Coutant , Linux Kbuild mailing list References: <20180523001939.9431-1-labbott@redhat.com> <20180523001939.9431-3-labbott@redhat.com> <15dcff14-ea1b-18c8-4cd1-06586cf6f05b@redhat.com> From: Laura Abbott Message-ID: Date: Wed, 23 May 2018 19:16:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed 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 05/23/2018 06:43 PM, Masahiro Yamada wrote: > 2018-05-24 9:11 GMT+09:00 Masahiro Yamada : >> 2018-05-24 7:53 GMT+09:00 Laura Abbott : >>> On 05/22/2018 05:33 PM, Andy Lutomirski wrote: >>>> >>>> On Tue, May 22, 2018 at 5:19 PM Laura Abbott wrote: >>>> >>>> >>>>> The vDSO is linked separately from the kernel and modules. Ensure it >>>>> picks >>>>> up the comment section, if available. >>>> >>>> >>>> Did you end up preferring this to just sticking the kernel version in a >>>> .comment in the vDSO for some reason? >>>> >>> >>> Actually I remember now why this is necessary: there is not a simple way >>> to encode a string into a linker file as it has to be spit out byte >>> by byte. The autogeneration was the easiest way to make that happen. >>> Maybe there's some horrific c preprocessing or other generation that >>> could happen but I doubt that's any worse than the generated linker >>> script. >>> >> >> >> I am personally prefer CONFIG option (as you did in v2) to KERNELVERSION. >> >> >> If you use "hex" type instead of "string" type in Kconfig, >> and LONG() instead of BYTE() in the script script, >> this can be much simpler, right? >> >> >> >> >> >> config BUILD_ID_SALT >> hex "Build ID Salt" >> help >> ... >> >> >> >> >> Then, in scripts/Makefile, >> >> >> define filechk_build-salt.lds >> { \ >> echo "SECTIONS {"; \ >> echo ".comment (INFO) : { LONG($(CONFIG_BUILD_ID_SALT)); }"; \ >> echo "}"; \ >> } >> endef >> >> $(obj)/build-salt.lds: $(src)/Makefile FORCE >> $(call filechk,build-salt.lds) >> >> >> >> >> This is now so simple that we can even remove the shell script. > > > > I had not noticed the comments from Linus and Andy > before I posted mine. > > > Maybe, we should not add binary data into the .comment section. > > > The comments from Linus and Andy apply to the vDSO but I don't think they work for the kernel/modules. We need something that can apply to every module and the kernel and the linker script seems like easiest way to do that. The vDSO is a self-contained binary so it makes sense to not use the linker script there and instead throw something in one of the existing files. I'm kind of iffy about making the build-id salt a hex string since that requires bit more work to generate. I'll experiment in a new version. Thanks, Laura