Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1192956imm; Thu, 4 Oct 2018 09:32:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV62YssjzG+QWzZ+vhvYq5HN/e7+JPR8wI5omf2+4k5iD1DH2/RIroQXvZyF/BKMnWLBcdnZe X-Received: by 2002:a17:902:9893:: with SMTP id s19-v6mr7411370plp.130.1538670761663; Thu, 04 Oct 2018 09:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538670761; cv=none; d=google.com; s=arc-20160816; b=JeYckvhhtiBeBxR3XvkU5niAZv3QJChFF3bd6y9X+xptjU6k23JCU2+yXWWlKW4n2i T0Bz6G2qRAtjJQPnjR+No72wiznUFgvQFWP8EJJtZXzE/OcJ25G2IFvREM0saltFTu82 9vpc8duDAdlI2IsM0HhVLKq8wxB2RBaN3x35sIvycDucbRqWKGQ/MV1/d3rKaUIFYVRK hBOILSBzxQ0SEQwyJJq7pq0S/GGMcv7/kxizj8+eSYUeIwo2Zf8jDGb31CDsMYlZN41U ouPsQSFe6SHbd5d8DWspST8hD7x4E3t8XVSfiI3VrDYmTIFyIldP8TTC9aiZUZgntp7P T7Lg== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=93/hvkDlD2mYBzYW56rb4ISa33hELQq2VHDvhWNfPLw=; b=WNzmGsvrEmw8iKPs9bEAyQsCE7496TgycVfGDuXiLwwIPx4pYmtORNaC+V6fNME74I fZJisojeaXzChZHsx9zWrNLGQz5nKmhh20C9Di44ml9MFLGhGw2br/0W6oRrytqzk/kD AYffowVfXgjTU+yXTMW/bowqiPLzghxGvaJMm4O8JMeyqnXtp2OHUtL8IyWWOtUGvg/Q FZkodB4JTfH8dQMAIO28RRQaSBQIdRbcDqpmAYlhkCClbWvExGN4ldFQjw7O/GhdgxXv JThs5mtDWa9hByYg7PZg+6Q+/ImsqXoQlNWM8ISxC1qzPMKQxxCGenemc1Yknuml1AXY eCuA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l12-v6si5672856plc.332.2018.10.04.09.32.26; Thu, 04 Oct 2018 09:32:41 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727727AbeJDX0T (ORCPT + 99 others); Thu, 4 Oct 2018 19:26:19 -0400 Received: from mga03.intel.com ([134.134.136.65]:10903 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727415AbeJDX0S (ORCPT ); Thu, 4 Oct 2018 19:26:18 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2018 09:32:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,340,1534834800"; d="scan'208";a="78731131" Received: from 2b52.sc.intel.com ([143.183.136.147]) by orsmga008.jf.intel.com with ESMTP; 04 Oct 2018 09:30:13 -0700 Message-ID: <5fad8118868739a452b8f5834290a04f1b343775.camel@intel.com> Subject: Re: [RFC PATCH v4 6/9] x86/cet/ibt: Add arch_prctl functions for IBT From: Yu-cheng Yu To: Andy Lutomirski , Florian Weimer 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" , libc-alpha , Carlos O'Donell Date: Thu, 04 Oct 2018 09:25:32 -0700 In-Reply-To: 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> <87murtn19o.fsf@mid.deneb.enyo.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-10-04 at 09:12 -0700, Andy Lutomirski wrote: > On Thu, Oct 4, 2018 at 9:08 AM Florian Weimer wrote: > > > > * Yu-cheng Yu: > > > > > 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. > > > > In theory, you could, if you change the ARCH_CET_LEGACY_BITMAP > > constant, so that glibc will not use the different arch_prctl > > operation. We could backport the change into the glibc 2.28 dynamic > > linker, so that existing binaries will start using CET again. Then > > only statically linked binaries will be impacted. > > > > It's definitely not ideal, but it's doable if the interface is > > terminally broken or otherwise unacceptable. But to me it looks like > > this threshold isn't reached here. > > I tend to agree. > > But I do think there's a real problem that should be fixed and won't > affect ABI: the *name* of the prctl is pretty bad. I read the test > several times trying to decide if you meant > ARCH_GET_CET_LEGACY_BITMAP? But you don't. > > Maybe name it ARCH_CET_CREATE_LEGACY_BITMAP? And explicitly document > what it does if legacy bitmap already exists? I will fix it. Yu-cheng