Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4142364ybf; Tue, 3 Mar 2020 21:13:32 -0800 (PST) X-Google-Smtp-Source: ADFU+vtS3cRdwSFxBBWSiG8RnI10T+5vLsVgdIwyueJqb1SWHBhV28441hcwLBlESM25+++fl5Mh X-Received: by 2002:aca:2419:: with SMTP id n25mr626536oic.13.1583298812734; Tue, 03 Mar 2020 21:13:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583298812; cv=none; d=google.com; s=arc-20160816; b=vWoDQJKekvXkS8jz1T8BrkWlKEcoPP90U3HM+zl0J7z/TQPJU2bqxbgJJV5dQkD8zl 8S3oYCSD+B7o32rvHL4Mb/TTstbBYASXvgTiNCNtzCaP1Fc5hJ/BLef18cda9cxxjD/J i+UZbgikWWw0VC1mZigDTjtWzUFFPCcW65obrW1xA5oxEMdEiKqFYY05tC/W9d+Vkl2W 1/gFyt9Ey6UOzgMpvpNNH4D4KM14FI9vMNo/dEym4jdWo8kgPi1SLopE+k0+pAEySQZ6 ss3LqTvfK0iT0NtjMKyy4NYwrepmjbIqLxMC25uh4YAqwGy3xutNfJ9XqjOQ7C8hLN50 zNQA== 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=HxfKMRYycoYJCMjo+bMFWJRwnGnU13AVvKUckPyxeSo=; b=etaKemnw3MmEVZzOE+rJmdNRi/ny2ld8juenbr3hS06CdhK6Llsa+d9kMNr7W0njPv RK1BE+iF/eq7fMNwXMhTvJJab6zLfTdDXvXMHhyFKFLSbRhneYn6hW0dK3iDnh/9g9wc 4TDGbBknjJeSXl8YxoYK60YzupKGUYJCkkbE5goKWZwsyRlTzah4SbATS2Qtfd8Q31lC ScypKj7yLZhJraOoyRqVfXB3GIFXGDXb/RG+Bgg7J+BM2+j5LCvrDD/KWbbOeQVmrinQ dOHqu3OumMdnNLAomu/t8awwY9MdlcONUHXfaAsNzx4ONX0fH4vs+2wBDGs8VoMK6sII k9kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=K5Fn7w8S; 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 j2si438080otr.255.2020.03.03.21.13.20; Tue, 03 Mar 2020 21:13:32 -0800 (PST) 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=K5Fn7w8S; 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 S1725882AbgCDFNK (ORCPT + 99 others); Wed, 4 Mar 2020 00:13:10 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:41316 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725271AbgCDFNK (ORCPT ); Wed, 4 Mar 2020 00:13:10 -0500 Received: by mail-qk1-f194.google.com with SMTP id b5so430261qkh.8; Tue, 03 Mar 2020 21:13:09 -0800 (PST) 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=HxfKMRYycoYJCMjo+bMFWJRwnGnU13AVvKUckPyxeSo=; b=K5Fn7w8SmnIBj8Lc9FZok49SJWB6g/q/Iga7hGwmiFt+PvrkBDKrKfNigTp77YxG9X DPuvoDPY+71aruC/wBH3cVGt1rRCaJEXKOLVpxMsDTPajmm72QvPDOWHNN8zLSHzdtuG KFoCJVbiTmToQ5WIewb6q7t96jAnIeGAcol4qQRWHd994e9P/bnG8+ryfXWaHqoMcBTO dMml4IRUX9PPz/kzdO5V5UgWu4+yMXt3B8I3WPmTxvJhNurnND1C9wqIdue+KZk564qh OzvlIfr4noAmNfAOCdekZQe6ygE8ZqthS2f8MWN1pKfkJ9S6bLCEZ8aozzFOImi6VKr2 gk8w== 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=HxfKMRYycoYJCMjo+bMFWJRwnGnU13AVvKUckPyxeSo=; b=q5XfS03CdwdaB2aTikw8fhf7cSPbL4WijAv5cuPt8yoNtTcPNVMNSKscl2dSvbdc7D aV1+bioHBAAheDZkiZMpr2SiYyxtaFOGdXpNRvcEiQ+S82oGZLoIvEtnKmyovyG7XX15 Rw0wXpdf+vYFlbg5uAGPj9Amk9eNV0VmM1hIxvq/lR8NoDcCsgV2pXSPYTWJyU7B7VPJ 4Bg1RcVa6VWoCiw0iHDsBzYKlfXp/7gKzZyk0z+jJJxMT3uDS5H6tiapxLjY+8SjmCjn 8U60+VEmye88sm0PdzWI0fu4Mu5ChVSOUNqMZjcPZ8fAM7Anwn22KKZZ55b7PGnspoI9 FYJg== X-Gm-Message-State: ANhLgQ3ZwlnfXDm1E756thEnsakdJg95MPextP80aiVImWFSc5aubxSs VWdNqvmsZuXK9N55vYWZxTQlCleeOb17Iz16C6Q= X-Received: by 2002:a37:a70c:: with SMTP id q12mr1440438qke.36.1583298789150; Tue, 03 Mar 2020 21:13:09 -0800 (PST) MIME-Version: 1.0 References: <20200304015528.29661-1-kpsingh@chromium.org> <20200304015528.29661-5-kpsingh@chromium.org> In-Reply-To: <20200304015528.29661-5-kpsingh@chromium.org> From: Andrii Nakryiko Date: Tue, 3 Mar 2020 21:12:57 -0800 Message-ID: Subject: Re: [PATCH bpf-next v2 4/7] bpf: Attachment verification for BPF_MODIFY_RETURN To: KP Singh Cc: linux-security-module@vger.kernel.org, open list , bpf , Alexei Starovoitov , Daniel Borkmann , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman 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 Tue, Mar 3, 2020 at 5:56 PM KP Singh wrote: > > From: KP Singh > > - Allow BPF_MODIFY_RETURN attachment only to functions that are: > > * Whitelisted by for error injection i.e. by checking > within_error_injection_list. Similar disucssions happened for the > bpf_overrie_return helper. 2 typos: discussions and bpf_override_return ;) > > * security hooks, this is expected to be cleaned up with the LSM > changes after the KRSI patches introduce the LSM_HOOK macro: > > https://lore.kernel.org/bpf/20200220175250.10795-1-kpsingh@chromium.org/ > > - The attachment is currently limited to functions that return an int. > This can be extended later other types (e.g. PTR). > > Signed-off-by: KP Singh > --- Acked-by: Andrii Nakryiko > kernel/bpf/btf.c | 28 ++++++++++++++++++++-------- > kernel/bpf/verifier.c | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 51 insertions(+), 8 deletions(-) > [...]