Received: by 10.192.165.148 with SMTP id m20csp1456788imm; Thu, 10 May 2018 10:58:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpmMAzvbvQuhZ1fwiz1AMH69UCtHD0k5XmgbYvRhkR0/zMh3nouCGKSZifImA1G4WOwFKKm X-Received: by 2002:a65:608c:: with SMTP id t12-v6mr1816819pgu.182.1525975129179; Thu, 10 May 2018 10:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525975129; cv=none; d=google.com; s=arc-20160816; b=FqfMl9G4EY+iCsggMSDSIZhnDkPxekxD0Ib8RWRD7iDN0fDYqJ7wzXzaqkpC1yWYck cq1g2hjTVlJiR1Qdn1iJq/hBW6JEvoE6VuJ+KaTGYAMJlwx3wwngRIfcPmZnWOkgp0Lz CkYkaJpKiT0hQpWnulPOTMKRGrjc0yTZ60bzeZL/14NypcxaVotkaCGXU6+Pd07yeL0P yYUP+1X95MMkjPCZZmwqnE6gJf71o7VaRu0aBW6PSUt9qjROY+Mvh1XqGUcqF4b4fiRM AyarJJg2hbOmwhFH/0Nf8hqmf/or1Os/0XJ8tTZ9gvy+eTu85Du/efFZ1zJq/k5ESGz/ 1pzg== 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 :arc-authentication-results; bh=fEKoFWUyLeL3/G6ZsBvOWYDV/j5SXe5R8Yq+a5d3Lg8=; b=jkNA3pyYZxFV3NUnI6ZOkE7oq7WtGDJR5S1hvYXQ8sgt/5QQh+RMTC337WeracoOAy l5Ce+0sIq35tqBKChIhOLH2UlrlUKVQh/qYo5d89TrUDzvfWMC8hNLu+KDaDjjstkr3n nSWbzyukDQUa/zRiSeK2neFZcuOP3kL2m8BZRIPke/7koWMhi3ymyHmd0VzXNuAbGSIM E4Sx8QO94rdi3B+EkSJCimyTeTvWnEwHhRbDvtGFjIpTHCmr9Hbg1KqCpNt+Ctjs+jx8 jhmZ4zOykccPhh2ziBIIVYG2kVYTKo/QLpz96g/ubYXSTBP6B+m2RyIWe6St6tLIwnbY zX5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=efJx7mDg; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15-v6si1349966pln.533.2018.05.10.10.58.34; Thu, 10 May 2018 10:58:49 -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=@gmail.com header.s=20161025 header.b=efJx7mDg; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966777AbeEJR6W (ORCPT + 99 others); Thu, 10 May 2018 13:58:22 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:46291 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965017AbeEJR6U (ORCPT ); Thu, 10 May 2018 13:58:20 -0400 Received: by mail-lf0-f65.google.com with SMTP id x7-v6so4168454lff.13; Thu, 10 May 2018 10:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fEKoFWUyLeL3/G6ZsBvOWYDV/j5SXe5R8Yq+a5d3Lg8=; b=efJx7mDggJZC/1JyZsLrxSEF8rXAHuApnXKUMQr9Wuv/Y453GpqmkTbwYIYQQJ5SLJ vcB2Y4Eo3cURRjb7oFVCE/IkBcxv/c81eOixb4P/RMX0ikM5CznwKHb5HiZhVm8WCYcx 98saYn77Aor0x+uxBa4sy6PtbQ7z0i9uYiQCXacylhtaqoyCXoUbtWtXdvvPeYDODOGU NtO4qpOrzflXDIaSZaiI1lCI2J/bCN3tCuHD2JWWc6UmyGL5d4sAl5z1jRRUZWd5RKvg 87gh5UNGB//aHsG2FuoQoZeQHEd19HyMLVerVgzeWKw34Ws91bH0XU676rmBHWTy4iH0 V7ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fEKoFWUyLeL3/G6ZsBvOWYDV/j5SXe5R8Yq+a5d3Lg8=; b=J8HH0ADUt0UwY60vXVVQ21OOBT1fxiDykz0C+OKfUgAunL/zowy3F3wk0yokwnu5Lt tSybr0O0rDhyKKtNpkhCSYf3gIvh7/P0U6hXwJ7IiHo+X6fDBxd8Y8v1pO63d2PP3H+P W4wrbjZhtF7ya3eySjOmItxtih8NACBssz7d1TbvgAw0+5e6rf/HjYZAoLiAf5NmuwYj 25WLdneUhW0LFAQwZA0sEM+ewt5qNsBLXkGLUDc0l/cZHKNEIlVgTZuoCGGgF8lDpbqO q6TIEXCYwzuGlzHNTNb9QGlnvAxWsBbzpit4uayORyFGdbT/zxfzPcZ3vQZo+1ebul9L KmGQ== X-Gm-Message-State: ALKqPweUnKL9qU3IkIDO2f63j8/xjKAGeDV3iFC+fNSNlF8Kw/f5o3vg epxyIMMW0IWV+Xf9D5k6b/VntNbCL+s9vW/732U= X-Received: by 2002:a2e:638f:: with SMTP id s15-v6mr1768402lje.78.1525975099064; Thu, 10 May 2018 10:58:19 -0700 (PDT) MIME-Version: 1.0 References: <20180504033119.2130788-1-yhs@fb.com> <20180510100634.GZ12217@hirez.programming.kicks-ass.net> <20180510155240.5s2fpgm2fwal3jlj@ast-mbp.dhcp.thefacebook.com> <20180510162028.GB16130@pd.tnic> In-Reply-To: <20180510162028.GB16130@pd.tnic> From: Gianluca Borello Date: Thu, 10 May 2018 17:57:43 +0000 Message-ID: Subject: Re: [PATCH bpf v3] x86/cpufeature: bpf hack for clang not supporting asm goto To: bp@alien8.de Cc: Alexei Starovoitov , peterz@infradead.org, Yonghong Song , mingo@kernel.org, torvalds@linux-foundation.org, Alexei Starovoitov , Daniel Borkmann , linux-kernel@vger.kernel.org, x86@kernel.org, Linux Networking Development Mailing List , kernel-team@fb.com, tglx@linutronix.de 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 Thu, May 10, 2018 at 9:28 AM Borislav Petkov wrote: > As someone already pointed out on IRC, arch/x86/include/asm/cpufeature.h > is solely a kernel header so nothing but kernel should include it. So > forget the userspace breakage "argument". For what is worth, I have the same exact problem in a relatively popular open source system call tracer, and my attempt to fix the issue from user space has been: https://github.com/draios/sysdig/commit/2958eb1d52e047f4b93d1238be803e7c405bdec2 While I can definitely live with that (and I'd be happy to submit a patch to samples/ following the same approach) and absolutely respect the technical authority of the reviewers here, it would be nice to recognize that these changes actually affect users to a certain degree, even if from a technical point of view they don't break userspace. From a practical point of view, BPF is widely used from userspace programs to access some kernel data structures to gather visibility information, and even the simplest use case, such as including linux/sched.h to access some task_struct members, ends up pulling in arch/x86/include/asm/cpufeature.h, thus (ab)using that file. Adding these quirks definitely increases the complexity a developer needs to keep in mind in order to take advantage of a BPF based instrumentation. Thanks