Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1556783iol; Fri, 10 Jun 2022 09:49:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPMx4CTcp4lihHs08SEFE1NC6PvG4cXpBdDRbEelG+91EDdj9xuurW2SGzVTco8EytTdAh X-Received: by 2002:a17:90a:a390:b0:1ea:8405:1fad with SMTP id x16-20020a17090aa39000b001ea84051fadmr616032pjp.232.1654879772597; Fri, 10 Jun 2022 09:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654879772; cv=none; d=google.com; s=arc-20160816; b=nAmSpyYzUQnnJyP6WmSvrCseaHnFc0MR2JJKuuTQr5g92Rrd7v1fXrVZCalQbQbVb6 FONbkPmZkj59B7xfwHQNmCjkgYTOCT+Bwl1yQk7jULkA2XQo/fz1Pm3chWgMwrxVY7+T Wo0eZNxIysCm6998ccQ1O6IIZNHSnRAuf3kPNovk0vM+mlAxaDUqWnarbyZz7Iqj5jT9 jB+DPww/3c3pXsizRM21TQ2wEWQxDvttwImdWomaWiHcJYK5KZ/phgsahwOnMLgnUgRS QIU4ZiWzKIHbcaPlWE4ErGPOdBU9ZFepFjymFqoonvN0lywKDNhTnhsC1p1AiNl8VLby ZzUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=dsz7BLFfG2oDPkvGvetFh42i9n6sbqi6LYnQ4Q8V5Nw=; b=xWsT9moKjm5VrXw8LDddfwPXnJqyOH21afTlH2jbvgxGSBxknLFetOKR8deoTi+cmE jwP6CIQKGMldVuOtdEtkLvnhC29Pjveu40P70JFFBQjT/v79O0PJUXvlyFxarsKXDh12 qlwXjUulaT78VtxJuviElNMX+fHKbAc8uqrpaksPyBnrrWzHkuKqSczC3MD9n1kOrQ8v TwKx+lxRmFuzOrAQDNPnT05Z8nTwsiaNudHV1y/xkMyWgY90n7QAg+PMlOjcj2NS0fdJ 4HmYdn0xghu/vvYNGo1PvIEE6AcXTEaoF4YF6OmwiIHH/9u2cnU8CFsKxWsue44GijoX r42w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iVQ5rq62; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pj6-20020a17090b4f4600b001e33af25e04si4123517pjb.108.2022.06.10.09.49.19; Fri, 10 Jun 2022 09:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iVQ5rq62; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239333AbiFJQar (ORCPT + 99 others); Fri, 10 Jun 2022 12:30:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240625AbiFJQap (ORCPT ); Fri, 10 Jun 2022 12:30:45 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1C5D5676F; Fri, 10 Jun 2022 09:30:42 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id bg6so34671888ejb.0; Fri, 10 Jun 2022 09:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dsz7BLFfG2oDPkvGvetFh42i9n6sbqi6LYnQ4Q8V5Nw=; b=iVQ5rq62texvFkMsTIBY380T29UAa1mfCM5uJRzZfThalwM7JfUG6a61eWKvURYPxN 3zp2AUnuu3MGfVljxTr77/XBl643VdY4Be/qlSqXv9QCDyaqf7rEtTbtZpfCLsxbCr8K 3jBNfvOpKUrG+frMXcqgWnJ3pgXph8F9UaEob2wfVPDynCd7pUlJtBOkTV+ZAjQcGQx2 SPZCE+ZNq9a1xOiwab8cpCTJtGPG/ucqQlqkgnu1Xw5qx83NHFOhCFT3UIbSEYlYqY5o Dpm+pDbLjq8/NPqWaOBT4LezSGCgAANlBLOAz0V1cHeIHhuCRfl75AZHKxlkjSYl0MHp SY+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dsz7BLFfG2oDPkvGvetFh42i9n6sbqi6LYnQ4Q8V5Nw=; b=h4bk5GCgaUSPVQl7GNtD/Hi88ey6lxNu5IvVrTkoitLisRKuSMuUs4/pITl5V5Vdtt 2qBo6cyB+vhihrEvbqLZ3IYAoXEwYwZk5bX5fEujB4QbvXHQQZsM1H7e7hXQdcUkNFRG jq5d5EXhFs/Pb57b4tDGEOmZBa7PN1C4rhBiKHfgS0dE75gp8LluMW8IYrm3ET5DIA8o cOe85op9y0fI17t1jRHiLvg57x7jJeb0OnXgSa+81pzmsarUvLlChFvjFIeJHYkPmdSA Etlg5QgvUiwhHvyYKn4+bz3P1th9m87bi3QUjI/yrnqgXTfvo5O1Gr/VMuq5XsX7SE1j 87Uw== X-Gm-Message-State: AOAM530ZMOKPTWv/b1vrVjJpxixeyhDNjLTqy2FQwPZKjGwR7eBZyvdU shSe9SKRhj5Ld0Jzir8pBx56N99vTkmKXPBkL6g= X-Received: by 2002:a17:906:14d5:b0:711:c55a:998 with SMTP id y21-20020a17090614d500b00711c55a0998mr27458446ejc.708.1654878638548; Fri, 10 Jun 2022 09:30:38 -0700 (PDT) MIME-Version: 1.0 References: <20220610135916.1285509-1-roberto.sassu@huawei.com> <20220610135916.1285509-2-roberto.sassu@huawei.com> In-Reply-To: <20220610135916.1285509-2-roberto.sassu@huawei.com> From: Alexei Starovoitov Date: Fri, 10 Jun 2022 09:30:26 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] bpf: Add bpf_verify_signature() helper To: Roberto Sassu Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , KP Singh , bpf , Network Development , "open list:KERNEL SELFTEST FRAMEWORK" , LKML , kernel test robot Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 10, 2022 at 6:59 AM Roberto Sassu wrote: > + keyring = (keyring_id == U16_MAX) ? > + cred->session_keyring : (struct key *)keyring_id; This is too limiting. bpf prog should be able to do what *key syscalls can do. By doing lookup_user_key(id) -> keyring. Maybe it's ok to have a special reserved id that does cred->sessions_keyring as a shortcut, but that's an optimization.