Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2008030ybk; Sun, 17 May 2020 07:24:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBQDOpc2RZjobf2oiB6RxI5TmlGtdsG0BVb+ypzW1Y8/BUAyYgIHh8Hf4J0BUMyOoc10f0 X-Received: by 2002:a05:6402:a41:: with SMTP id bt1mr9832466edb.151.1589725499093; Sun, 17 May 2020 07:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589725499; cv=none; d=google.com; s=arc-20160816; b=k2mFSwCPPdSGrCeAvYxK1ny/Ai7jVbWTNs94+gHrko0U7+LqBH4Cwu0FP5J8LOVd1p FiNyHKKVtoPwqLkf3GDHuvU0lQMfO19JqFusr1aTQpY0lPQf/5jxR01lMo/diHRibjLn wTB1DB6fC6F9XM+WeMKSFrKpIuvExxunLOeCTID6ATnHgpZunZvLPRoJH0ucIYi17c73 Lm6Kolu4JpF14ONHW3Wi8rd5GAygmJ7Ga6KeiwXaWyCVYSH6JZXmJ1xbiyTuX++fuF2Q l3H43EMaq7ad1ub9MHOz7uy2I0uN1iI+JoLJV3T/qcoR/LDuVZ2QNqkOepM+GUbH02+r f56A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=IbfxFWmNaCFRv5atb1UVjA4fbxw7MwwdE/4yErlVGmg=; b=wshfKfh+Mrc19kQvhFa9ilTksoj0K4Jqwxvd6c/NgnP3v6vLiFwzcipevJ16U1B1NP 2mGd9Sdgp90ysS4TIEb/ErUAzZvX/whUcTZDgDhq//LKO2GM9fa8v8EOFDXI/0wPuzJR XUaWkxVwPcLyBrINN89703JnOszxTjG2gSuhRp7dkRE9J2DAGOPB10ToNNLdilNMkfiF ugQX/52fNNzI5+QoLHV+myja1jufLt9PC0VtyIEysnfcMklBX/3+xVVbJg7BP22ZnodC DfE5EgvOMvX8MVGy+Uvun6xqHlRb+vjmcoJ4TzFQweYxP51CeO0eSR601Hp5XqAIVXx5 gKMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=je7fiBAl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y22si4887854edv.198.2020.05.17.07.24.35; Sun, 17 May 2020 07:24:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=je7fiBAl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727969AbgEQOXT (ORCPT + 99 others); Sun, 17 May 2020 10:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727893AbgEQOXT (ORCPT ); Sun, 17 May 2020 10:23:19 -0400 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A4E8C061A0C for ; Sun, 17 May 2020 07:23:19 -0700 (PDT) Received: by mail-il1-x144.google.com with SMTP id t12so7274802ile.9 for ; Sun, 17 May 2020 07:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IbfxFWmNaCFRv5atb1UVjA4fbxw7MwwdE/4yErlVGmg=; b=je7fiBAlwjWMz5XOH6obv3seJ6Qc1ORc7AEna2ImpH6OqXUkGAqyKq8GUs3CsuYYXr KBg3CyPJpe6HvQWguYHHAHk3/VzpYEP37fKaUZ+OPo+z+V0R1gnnDq+Qtm0wMZidVsUJ X6WmzqTtBUq/oACqtHkCZbzRTaWsAR5uk7O9GZs7I2Nx31icT8zZtQWaxsfBYRGf2E4P PS+NgNCQgJB1iOzfXIbUoxtvRgWpM3ETaj18lriLt9WSB99bRQALzUT/8+De019DOL4e HRv2Sr+VqUp1VJq8OBs4hx2xEK79lLiabdfmgJfUofXyrOj0Dkr6RdB6S/aTVecXYRyQ Q7XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IbfxFWmNaCFRv5atb1UVjA4fbxw7MwwdE/4yErlVGmg=; b=d9ZcXlyRqRLCh6P16aSjOn40ZtpEuOrC4ZGbalqyt2XpaofvB6OyuZtDxG2P/z/axf v6Diyd1WKZQpwzxBjRTykuFfD8XBT+QmhbEZwNfgU8wf/ZtUXjCwMAZomrnrmATRu8XP W0gi+Fs7Sar857C4DI1pGdwc+/6rDLbvz9fRGyIapxytabkHhoeOz4dCRdTHqQpZGzMB uL+0c2PQwFLP9v00ZkLjAVJiWBvQJR5YA6V0YwvI8gECRxTnmVwysHhTYMlU3nzAWxwA fddQs+SharXmKSv96uOanAGkmMnoRf8is4g/Bcjr+YQeCFcsr0wrqTJ1j0K7vq/zdjbW CDOA== X-Gm-Message-State: AOAM532F+1crKVajFU7MfnJlhbfY+UQ6unF4MfGFWVFnNVOx2y0lIMeb JJnb3xqVtMoVbRXmnjIfVhaWSA== X-Received: by 2002:a92:9e51:: with SMTP id q78mr12641146ili.268.1589725397996; Sun, 17 May 2020 07:23:17 -0700 (PDT) Received: from cisco ([2601:282:b02:8120:6155:7c8c:3dc0:c56e]) by smtp.gmail.com with ESMTPSA id g205sm2861748iof.21.2020.05.17.07.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 07:23:17 -0700 (PDT) Date: Sun, 17 May 2020 08:23:16 -0600 From: Tycho Andersen To: Aleksa Sarai Cc: Christian Brauner , Kees Cook , linux-api@vger.kernel.org, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] seccomp: Add group_leader pid to seccomp_notif Message-ID: <20200517142316.GA1996744@cisco> References: <20200515234005.32370-1-sargun@sargun.me> <202005162344.74A02C2D@keescook> <20200517104701.bbn2d2rqaplwchdw@wittgenstein> <20200517112156.cphs2h33hx2wfcs4@yavin.dot.cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200517112156.cphs2h33hx2wfcs4@yavin.dot.cyphar.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 17, 2020 at 09:21:56PM +1000, Aleksa Sarai wrote: > On 2020-05-17, Christian Brauner wrote: > > Or... And that's more invasive but ultimately cleaner we v2 the whole > > thing so e.g. SECCOMP_IOCTL_NOTIF_RECV2, SECCOMP_IOCTL_NOTIF_SEND2, and > > embedd the size argument in the structs. Userspace sets the size > > argument, we use get_user() to get the size first and then > > copy_struct_from_user() to handle it cleanly based on that. A similar > > model as with sched (has other unrelated quirks because they messed up > > something too): > > > > static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *attr) > > { > > u32 size; > > int ret; > > > > /* Zero the full structure, so that a short copy will be nice: */ > > memset(attr, 0, sizeof(*attr)); > > > > ret = get_user(size, &uattr->size); > > if (ret) > > return ret; > > > > /* ABI compatibility quirk: */ > > if (!size) > > size = SCHED_ATTR_SIZE_VER0; > > if (size < SCHED_ATTR_SIZE_VER0 || size > PAGE_SIZE) > > goto err_size; > > > > ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size); > > if (ret) { > > if (ret == -E2BIG) > > goto err_size; > > return ret; > > } > > > > We're probably the biggest user of this right now and I'd be ok with > > that change. If it's a v2 than whatever. :) > > I'm :+1: on a new version and switch to copy_struct_from_user(). I was a > little surprised when I found out that user_notif doesn't do it this > way a while ago (and although in theory it is userspace's fault, ideally > we could have an API that doesn't have built-in footguns). But I thought the whole point was that we couldn't do that, because there's two things that can vary in length (struct seccomp_notif and struct seccomp_data)? https://lore.kernel.org/lkml/CAGXu5j+ZPxu6egE1fEr+N9+zLx3N+SJ_vbS_zzj9_hrdWrrrWQ@mail.gmail.com/ Tycho