Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1539561ybp; Wed, 9 Oct 2019 16:07:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzdXxc/YlYshcuQn6RPaszjmlVdfHTQ3P9yl1f5VpLLvILZMv9IvVQQ3k0YEaBkuMRbkJu X-Received: by 2002:aa7:d842:: with SMTP id f2mr5320665eds.27.1570662421390; Wed, 09 Oct 2019 16:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570662421; cv=none; d=google.com; s=arc-20160816; b=MrhoFmNsDjrhTd1NGoDDMjASBcUVbrQg35plbfGu5ZGiPbBNDPY2jvaDt0uAeyMOl6 3gnRfw7aF0nn14u5bm3i+aEIfre364vc3GUUVeUVtBeR51RQMbpMEK5z497FGSz42Zhq o8/BKUVwPv7uR9cRAVq6GDbxb54LZKE26M0VazQg1TmERp5uOso8RSiVOX1LB2jnKIIf I3aWk50Cf8/jYooN5ZHIbJu26DTtp/kLpM4fRSOqu2qHiupnjos0L5mSrX2eTZ44Oh8T +7yH4Z7k42t3/6Go42pLPNoNYi0tULXd2Ew16xksiM8P67tTLoTRNVG6vVr3p03YniB1 Cbyg== 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=8s1tJBc8q1/SxFYyW+OjF++gC55iovEKVHxLXRLrnfo=; b=zd40Jb0oNlmkDe3ZTa0rIGwQMBOjQgm6N7ii5VT5Wuq9IKt2Wf+ru2Uug0Fkq56khm Rr5zw/685sHnOnN3swy+GVxrrjwma/T9BUBi7UC5+EnfOBGqOqc0nkhf1/bnqMdZAABg mO/9B5a9otm1W4JLNqZDwWmLFnHurGAoXc+maPB2AQ2eZueI9erFPoJ+bfC3quMom6BR qnFCVXY3kf953tHlD3xCb/54g1GkLvjdLw43iMHkUBdwExMd0yr9HzSYbGBfp+RIk6IB /Y7DroZFc15S4S+7Ii7ZZy9WMRNWOhkpaCohN/siKRQVwMnAJ1A7/+uLN5Y7yhAaqW++ hbPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CRzXPzDA; 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 h50si2091263ede.423.2019.10.09.16.06.34; Wed, 09 Oct 2019 16:07:01 -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=CRzXPzDA; 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 S1732231AbfJIXGc (ORCPT + 99 others); Wed, 9 Oct 2019 19:06:32 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:40852 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730815AbfJIXGc (ORCPT ); Wed, 9 Oct 2019 19:06:32 -0400 Received: by mail-lf1-f67.google.com with SMTP id d17so2890785lfa.7; Wed, 09 Oct 2019 16:06:31 -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=8s1tJBc8q1/SxFYyW+OjF++gC55iovEKVHxLXRLrnfo=; b=CRzXPzDAp1BKUeBcS1UensR6cHYpzE5XLAbY3Zb/7M7ednucPx/CAXgJf5GHYz/Qju EypVX/9ssK1GNOP9MO5LjJPoh1j7vcT0MxxXiSOgLsnO6SvKxMLk2hRxjP9ptbXiH2OE IbpFJTVGq4vVmdk4gs6AkirZrdwvFx8CQnAUO3uZX2QE+e8xyA58Nxjj0LxBFFRM1f4F YvD1RraSbJ5IhOtm2TlyzVOXnY70u82mFoaMFQB8eEfBenjLJvcnjD5vpDBXPabEso3A gdAca78SfKwGBsqhT/WgWvLHXXaGDh4WV1PEz5nWh6+1Cx4UvTIj3nhJgs0Z0C2xXqBe VD8g== 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=8s1tJBc8q1/SxFYyW+OjF++gC55iovEKVHxLXRLrnfo=; b=MWLiowEOw0CqmP6BsuNF81Xnn4Z1RvrD8IlSE/gDVegGQuq1U2E8iYlhs3vpr6cUC/ 69V4Cq26wUVObvqqaX8IwFHPuHRSt55inVwj8l+yA+u49t5sZ1BSfJErdRgeiiLPVkYG S3NhApKEdvqFM9oWIe5QOUzPnxVRax9/aaUCOe16MLqB3ovhQ1NWNfaxf6AD0txhM8WI YK6ViugvRMqlMJ+h+cAbzcJ+Cgg9AOqK5TvNGkvxFuTH2lMDk9ZLJZPrZK6O4phRviem mttM57s/fb28CxdLtl7HCkFfBvzm5wIIK2ZeFG43eLj/PJxU2iHMpxpAbIO21oVe4Rhv ZsmQ== X-Gm-Message-State: APjAAAWg082g8BwxCrY5bGK5VxuAUMMeBRv4ZOgl9V4AFlW2RxxyWp5v /G1y+DKTJFVX79n8/rWXsX2JF2jCXzwEuAV3pGcleJAy X-Received: by 2002:a19:4f06:: with SMTP id d6mr3702768lfb.15.1570662390203; Wed, 09 Oct 2019 16:06:30 -0700 (PDT) MIME-Version: 1.0 References: <20191009160907.10981-1-christian.brauner@ubuntu.com> In-Reply-To: <20191009160907.10981-1-christian.brauner@ubuntu.com> From: Alexei Starovoitov Date: Wed, 9 Oct 2019 16:06:18 -0700 Message-ID: Subject: Re: [PATCH 0/3] bpf: switch to new usercopy helpers To: Christian Brauner Cc: Alexei Starovoitov , Daniel Borkmann , bpf , Martin KaFai Lau , Song Liu , Yonghong Song , Network Development , LKML 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 Wed, Oct 9, 2019 at 9:09 AM Christian Brauner wrote: > > Hey everyone, > > In v5.4-rc2 we added two new helpers check_zeroed_user() and > copy_struct_from_user() including selftests (cf. [1]). It is a generic > interface designed to copy a struct from userspace. The helpers will be > especially useful for structs versioned by size of which we have quite a > few. > > The most obvious benefit is that this helper lets us get rid of > duplicate code. We've already switched over sched_setattr(), perf_event_open(), > and clone3(). More importantly it will also help to ensure that users > implementing versioning-by-size end up with the same core semantics. > > This point is especially crucial since we have at least one case where > versioning-by-size is used but with slighly different semantics: > sched_setattr(), perf_event_open(), and clone3() all do do similar > checks to copy_struct_from_user() while rt_sigprocmask(2) always rejects > differently-sized struct arguments. > > This little series switches over bpf codepaths that have hand-rolled > implementations of these helpers. check_zeroed_user() is not in bpf-next. we will let this set sit in patchworks for some time until bpf-next is merged back into net-next and we fast forward it. Then we can apply it (assuming no conflicts).