Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1166102imm; Thu, 4 Oct 2018 09:09:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV63MRsCrqZWlY2Vh4V2m52h/xJJjgbwpQ7hAejghoUhFo7TcOo8nGQWloRiCistHVnDjR2VG X-Received: by 2002:a63:c44a:: with SMTP id m10-v6mr6397535pgg.416.1538669358569; Thu, 04 Oct 2018 09:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538669358; cv=none; d=google.com; s=arc-20160816; b=fQB54lgcM86A1VwUnIubOxeLBGBHvH9cud6PA8wKGKMT9jNGbKftZemO5rYB4PpLNc BMT5DuzU0JP/97raHDNuwj+OnC1LfkGD25BwnkCQ+kLtl/er++G06v0J/IA+e5bJ5oLK m/hvr+kjRHAvSczPF8n5YCOjL+noXv1Mzgtf9PzOKzJBmyct8CtZOF4tLeZCmyvVTz8H G/HnWLi+poY1KpIJp6zbcnGG3JtBZrD4TXNP0/3Xxeudf+mj7kePNYvmA2avdbU+JXiv 7qCm8CniY63gssKx+kp7mMMOSY0kKiAiZHimQ3vf+YccXEd9+f3N8P35sAAWMeFRb0PC QFVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=i+0GDFaWyaVAWibhcokMeNLKDEVPsek4de8zwdua3m8=; b=gIftcscT2q1nVmRxnv0SQsy/GS459oY9aUYM1G9eO6WSpu/ERrYh+6BMLZWqdlwnDJ 8eafUxdG0XYnxP+LaW5QKqThp3P3tdIE15d/zsNjI/xff+27nLC/aMoUgWL9xh4RpWP3 cjlv4WgCwJTn3rMeFVSjH+nx1BuU0KAc4jbR7v1gTJ/2zoqmJtv2UnuWuMLloPBVLjQa IEe31JwdVA0s3SjsH8KqDnd/PYj89JpQ9uOriaCMaH2gKyKxWCvofcctIWCF8TVzywFK 7DbDYV0qqUI0wBvduofGJyg7FufjTECBVvE0iG3j0zH32dZ+wOZ5Tv5OBCRNBBecxgow v34g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h9S+j84r; 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=pass (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 c68-v6si2597902pfa.45.2018.10.04.09.09.03; Thu, 04 Oct 2018 09:09:18 -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=@kernel.org header.s=default header.b=h9S+j84r; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727830AbeJDXCY (ORCPT + 99 others); Thu, 4 Oct 2018 19:02:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:60392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727729AbeJDXCX (ORCPT ); Thu, 4 Oct 2018 19:02:23 -0400 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 21AA121470 for ; Thu, 4 Oct 2018 16:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1538669307; bh=jNrCRitcO3wT7VnwH79c3INnhO3XKOC5TGVuaohfz8A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=h9S+j84rYz/1pX3G+Mb/lHscdi5VTZg+8Q35lfJ52lhzq77QHKMIU9N6wheVg4yJT OgpsHW4etYppfEfBKmFG/HObK8Fg8HzUiYCXBR6mN4Zf01uXhl5smpE1YhVuJbWqSe 39rfFFhzBUQUQZex+KhEKn5LL5u7Pf4suMUzmkVs= Received: by mail-wm1-f43.google.com with SMTP id q8-v6so9586607wmq.4 for ; Thu, 04 Oct 2018 09:08:27 -0700 (PDT) X-Gm-Message-State: ABuFfogVt9j1pUSHf7kcqC/RD8SbxAiPjgGBNJMJ/WPDx8TvpVSYOXNk +iW8X3sp9oB/fK8wBihT5Wz4q/GMdTz8xx2YfdP/PQ== X-Received: by 2002:a1c:f312:: with SMTP id q18-v6mr5190582wmq.14.1538669305459; Thu, 04 Oct 2018 09:08:25 -0700 (PDT) MIME-Version: 1.0 References: <20180921150553.21016-1-yu-cheng.yu@intel.com> <20180921150553.21016-7-yu-cheng.yu@intel.com> <20181004132811.GJ32759@asgard.redhat.com> <3350f7b42b32f3f7a1963a9c9c526210c24f7b05.camel@intel.com> In-Reply-To: <3350f7b42b32f3f7a1963a9c9c526210c24f7b05.camel@intel.com> From: Andy Lutomirski Date: Thu, 4 Oct 2018 09:08:12 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v4 6/9] x86/cet/ibt: Add arch_prctl functions for IBT To: Yu-cheng Yu Cc: Eugene Syromiatnikov , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , linux-doc@vger.kernel.org, Linux-MM , linux-arch , Linux API , Arnd Bergmann , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Florian Weimer , "H. J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , "Shanbhogue, Vedvyas" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Oct 4, 2018, at 8:37 AM, Yu-cheng Yu wrote: > >> On Thu, 2018-10-04 at 15:28 +0200, Eugene Syromiatnikov wrote: >>> On Fri, Sep 21, 2018 at 08:05:50AM -0700, Yu-cheng Yu wrote: >>> Update ARCH_CET_STATUS and ARCH_CET_DISABLE to include Indirect >>> Branch Tracking features. >>> >>> Introduce: >>> >>> arch_prctl(ARCH_CET_LEGACY_BITMAP, unsigned long *addr) >>> Enable the Indirect Branch Tracking legacy code bitmap. >>> >>> The parameter 'addr' is a pointer to a user buffer. >>> On returning to the caller, the kernel fills the following: >>> >>> *addr = IBT bitmap base address >>> *(addr + 1) = IBT bitmap size >> >> Again, some structure with a size field would be better from >> UAPI/extensibility standpoint. >> >> One additional point: "size" in the structure from kernel should have >> structure size expected by kernel, and at least providing there "0" from >> user space shouldn't lead to failure (in fact, it is possible to provide >> structure size back to userspace even if buffer is too small, along >> with error). > > This has been in GLIBC v2.28. We cannot change it anymore. Sure you can. Just change ARCH_CET_LEGACY_BITMAP to a new number. You might need to change all the constants. And if the ELF note by itself causes a problem too, you may need to rename it. And maybe ask glibc to kindly not enable code that depends on non-upstreamed kernel features. There is not, and has never been, any ABI compatibility requirement that says that, if glibc 2.28 "enables" a feature, that the kernel will ever enable it in a way that makes glibc 2.28 actually support it. All the kernel needs to do is avoid making glibc 2.28 *crash*.