Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp522073ybh; Wed, 15 Jul 2020 08:11:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjWA+ahCksNMTxEN3uf5LvyQLUsdQobE/5A97bJD0mkj1nwkOuDDVSOK5wEwSc++DB6p52 X-Received: by 2002:a05:6402:1b1c:: with SMTP id by28mr87427edb.270.1594825870873; Wed, 15 Jul 2020 08:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594825870; cv=none; d=google.com; s=arc-20160816; b=sxS4nlfaNQGsNp1u8yMZa3ZUo5F2yuyqToKid9jVjgL+PR2EOzkAX+xB3uL20lmT35 k9xHkUYZShZeVweOGksmFc3+vkXdT3ajhDYKI3kIoSbr99KPPXVhnmCyP4C7MUWn4liO +973J5tGbaRcLIIugjpXO1IUM8Cb113hHovo4gE0qBycvgwsKWT4qsjWyuBgClnsSEAX aEw6JKsIH2l4nzNla06TKGrQA0UOTdyG0r7N5WEc6bYyCTNX626I5ZmgvLDIlS3djf2a RPTsAe2PrFJtpuoyGV2p/Fh9huJmPeqoB3akvWmE+g7D3jjgmP8FoZpjahV0DNcOU6+9 pXbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=UKtsJI5QB1xU8LCcwpkPI3i1klkSLGG5bCDazvEjLm4=; b=B5eyh5OiPEv4wojM0SSWXrKjYfRCJoxC2FP/FpBfB5fkUg5x/HMhcZahHd/4hmAOhn +KrcEk1f1xvMrZXjTEQJK04r/z5i4HiVupiuotiZU56olKKKQu7ir6py1t1vP2/m9840 9E0S03/PFsyyqsWvja+Ao/CcR8QOTPo6tLsLLUp+0uctoUfsuJmeE7NTuC7UXOKvEh/K zZ60nFaqimiNkEarYwRP7KJRQHXKbcueZlFNghZVJTWXiAAWfXHTteoza6lhQxRM3+eG 3fewCPZWc8wtbX8BZ25LF5y3WYMPqJUZejVtjtH7vwq+QSOfeMxZ79CkftE1wFa7sfwx oPUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=NKN85lyL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw28si1430779edb.424.2020.07.15.08.10.47; Wed, 15 Jul 2020 08:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=NKN85lyL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725834AbgGOOuE (ORCPT + 99 others); Wed, 15 Jul 2020 10:50:04 -0400 Received: from mail.efficios.com ([167.114.26.124]:52348 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbgGOOuE (ORCPT ); Wed, 15 Jul 2020 10:50:04 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id B8D4F2825C3; Wed, 15 Jul 2020 10:50:02 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id fd-ChUQ4y-j4; Wed, 15 Jul 2020 10:50:02 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 5681228245B; Wed, 15 Jul 2020 10:50:02 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 5681228245B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1594824602; bh=UKtsJI5QB1xU8LCcwpkPI3i1klkSLGG5bCDazvEjLm4=; h=Date:From:To:Message-ID:MIME-Version; b=NKN85lyLk2KAd0gJFrbdUMOJxNjH92cQP2mnUkcXuAHTjHHKlN8Pimon02tsp1st/ Ww+jEfodMeOWRm2KwjSxqDNdFytk5RM3UP6YXSacHVvpF4lwi8U+wfK6FEZ99ELYlU i5XsDFuUPQJnXNv9iOpuwYd+WBu+XMAfmlj9s+A71VJLECxtG7eE2UcWJwupbL431l 4Ut5XiyLInXmBJRfdo+CtDlMa9preGCRPqb543iLSgZs7K9anuAjBrSUvyB8GgUlC5 bGMcurpU/3SB6Lu2FPiWyvX3Jx6T3lu+4AmQuauDhbJ0LJyqsB/8spTU9cQNsvXdIS 2gVnB0eV2EIlQ== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ANSTUrHF-juH; Wed, 15 Jul 2020 10:50:02 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 3AA0B282458; Wed, 15 Jul 2020 10:50:02 -0400 (EDT) Date: Wed, 15 Jul 2020 10:50:02 -0400 (EDT) From: Mathieu Desnoyers To: Chris Kennelly Cc: Peter Oskolkov , Peter Oskolkov , Peter Zijlstra , linux-kernel , Thomas Gleixner , paulmck , Boqun Feng , "H. Peter Anvin" , Paul Turner , linux-api , Christian Brauner , Florian Weimer , carlos Message-ID: <601595827.14270.1594824602119.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20200714030348.6214-1-mathieu.desnoyers@efficios.com> <20200714030348.6214-3-mathieu.desnoyers@efficios.com> <775688146.12145.1594748580461.JavaMail.zimbra@efficios.com> Subject: Re: [RFC PATCH 2/4] rseq: Allow extending struct rseq MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3955 (ZimbraWebClient - FF78 (Linux)/8.8.15_GA_3953) Thread-Topic: rseq: Allow extending struct rseq Thread-Index: bPI+2deu99arGuPk6Okd/MCPJ67vKA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jul 14, 2020, at 10:34 PM, Chris Kennelly ckennelly@google.com wrote: > On Tue, Jul 14, 2020 at 2:33 PM Peter Oskolkov wrote: >> >> On Tue, Jul 14, 2020 at 10:43 AM Mathieu Desnoyers >> wrote: >> > >> > ----- On Jul 14, 2020, at 1:24 PM, Peter Oskolkov posk@posk.io wrote: >> > >> > > At Google, we actually extended struct rseq (I will post the patches >> > > here once they are fully deployed and we have specific >> > > benefits/improvements to report). We did this by adding several fields >> > > below __u32 flags (the last field currently), and correspondingly >> > > increasing rseq_len in rseq() syscall. If the kernel does not know of >> > > this extension, it will return -EINVAL due to an unexpected rseq_len; >> > > then the application can either fall-back to the standard/upstream >> > > rseq, or bail. If the kernel does know of this extension, it accepts >> > > it. If the application passes the old rseq_len (32), the kernel knows >> > > that this is an old application and treats it as such. >> > > >> > > I looked through the archives, but I did not find specifically why the >> > > pretty standard approach described above is considered inferior to the >> > > one taken in this patch (freeze rseq_len at 32, add additional length >> > > fields to struct rseq). Can these be summarized? >> > >> > I think you don't face the issues I'm facing with libc rseq integration >> > because you control the entire user-space software ecosystem at Google. >> > >> > The main issue we face is that the library responsible for registering >> > rseq (either glibc 2.32+, an early-adopter librseq library, or the >> > application) may very well not be the same library defining the __rseq_abi >> > symbol used in the global symbol table. Interposition with ld preload or >> > by defining the __rseq_abi in the program's executable are good examples >> > of this kind of scenario, and those use-cases are supported. > > Does this work if/when we run out of bytes in the current sizeof(__rseq_abi)? Only if all libraries/programs involved (including glibc) expect that the size of the __rseq_abi can be the smallest possible subset, and only consider it to be "extended" if specific information in the ABI tells them it is the case. > > Which library provides the TLS symbol (and N bytes of storage) seems > sensitive to the choices the linker makes for us, once the symbol > sizes diverge. AFAIU, a symbol defined in the main executable will have precedence over a preloaded library, which has precedence over shared library dependencies, e.g. glibc. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com