Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp14517347ybl; Mon, 30 Dec 2019 11:34:50 -0800 (PST) X-Google-Smtp-Source: APXvYqysG7guTn64tZ+b8N8RoZLXcGTuLWpPecmCp2ztVrCCFf2Bd6lXFY3prNlmDimopNu0o5vS X-Received: by 2002:a05:6830:128e:: with SMTP id z14mr73360263otp.184.1577734490636; Mon, 30 Dec 2019 11:34:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577734490; cv=none; d=google.com; s=arc-20160816; b=s0pyM1jZmUdiWNzztgABYZnWDNf56QVFkS7tRXP7581c2yGjCoUejLd/TJKEUgaXxK TCy+cyqMLftXoNtoulxBnIHH+VZPnNn6XrOyDURChYvVTLYZWVKxxxnSsi8G3fwtpF+y NbmBZ+CBPAehckeNhkzfX380yvBXJ2vHK9o3Tkm0DfcuG16Cv15WFJo56dT/cJkO+kIW aoORGekBTDnVkk6hj48Z7CeasGRUGPR+r7PQ4bx1aYrOq2QchR8lkXEmaNHR1UEakIni XUFclkXtn3MINuEv8QZum6FwLKL/8MFs8MDL6ognf7yNBTrVNA5sFnNj5Wmbkobj9R2p g/nA== 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=9mNn9nURZI+7bF8xI34SvARdK0zc98BlyBAff05Zwow=; b=RvEvJSE7uEhVahh6cLGIGWkpgI/gjNhaUpsTh6wzo0rQJ9yKsasx9cJQi2xvIfOXNs QJulFsdiU5T1foXbIuoc8T5T4v+pdlCoUIgZ9QP9MnDiaDKhx9dfSrh5fNrz58uZJnz4 U2AtvZ9ZtnSTUsrcRjUgeB+OxxRywC5tsvinFczuRVpfZ6gWOid5cUqATlbqk8RinaHA RtUY2Lf7wdCUJ0qGPRjJCRRonHxZ0M4O0h5pWa8UBQIAH6mDuG4H0mrsn9VG6bc8QaSb UTdIQFgTanVpKUCdWHK1dnZN4EC6ZKimHO8lsxc1Zy+LWbSz24I8fDAejXFKE49R8J+D 9fdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YV085ZOO; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si23410055oto.205.2019.12.30.11.34.39; Mon, 30 Dec 2019 11:34:50 -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=@chromium.org header.s=google header.b=YV085ZOO; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727708AbfL3Tde (ORCPT + 99 others); Mon, 30 Dec 2019 14:33:34 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:34308 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727278AbfL3Tde (ORCPT ); Mon, 30 Dec 2019 14:33:34 -0500 Received: by mail-ot1-f68.google.com with SMTP id a15so47427117otf.1 for ; Mon, 30 Dec 2019 11:33:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9mNn9nURZI+7bF8xI34SvARdK0zc98BlyBAff05Zwow=; b=YV085ZOOvhc6d7lXQ0SBArTWIZoH8sYIamOti1KC9sHJJJ+d/rvFCoE55WfIvMkNNP OSD298oJWMMz/40hbSmOxuUqPIVB+eBibxKww9917VHEsbn3sSamO4XvE6a6L7YyeuFt GSGpITqm8hPZVEOetsAKoF7x54l97GAa6AtLA= 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=9mNn9nURZI+7bF8xI34SvARdK0zc98BlyBAff05Zwow=; b=gE/29EfzieZMRgVgD3tBl9gmGuyOkUe3hC9Gl7v+DHZoFEnYPUytWlq8A9EVjxDhC2 MjJ0Ye3CyZuS84eZUd6oDQ0wkPrPOKjycUJs7MBcnSMn+EbZM/raV1dJAw+zAgwyCZwC U3SERhiTkJOmpb/biS0i1eQ0uVQfutZFf/3DlcLwBiyR1xcLWjpXC652ApLtobeNRiBP gt1undKCMHd58y7OWn1NQxVOjnFeV0J7JRySnaDqqH33DmOe8EygUyqycyoLAyiXf+oz Ekh94hur7J6o+Do2/1Adz+gLlAAugky8O/C9D/NL+Uqptw8EegqHE8NBJNauctSiRo4j 9sgg== X-Gm-Message-State: APjAAAXdetkVRQwehK6/v0efhZzCmsc6qyx0cv0LSOgyCetcRbsCPprl b6y2xTdRD6vp/r7xyGR6RNn1Yg== X-Received: by 2002:a05:6830:2099:: with SMTP id y25mr73259465otq.87.1577734413863; Mon, 30 Dec 2019 11:33:33 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id z12sm16083437oti.22.2019.12.30.11.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2019 11:33:33 -0800 (PST) Date: Mon, 30 Dec 2019 11:33:31 -0800 From: Kees Cook To: Sargun Dhillon Cc: Tycho Andersen , LKML , Linux API , Jann Horn , Christian Brauner , Aleksa Sarai Subject: Re: [PATCH v2 1/2] samples, selftests/seccomp: Zero out seccomp_notif Message-ID: <201912301132.5C97DD231B@keescook> References: <20191228014837.GA31774@ircssh-2.c.rugged-nimbus-611.internal> <20191228181825.GB6746@cisco> <20191229001818.GC6746@cisco> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 30, 2019 at 11:14:44AM -0800, Sargun Dhillon wrote: > On Sat, Dec 28, 2019 at 4:18 PM Tycho Andersen wrote: > > > > On Sat, Dec 28, 2019 at 07:10:29PM -0500, Sargun Dhillon wrote: > > > On Sat, Dec 28, 2019 at 1:18 PM Tycho Andersen wrote: > > > > > > > > > > > > I know it's unrelated, but it's probably worth sending a patch to fix > > > > this to be sizes.seccomp_notif_resp instead of sizeof(*resp), since if > > > > the kernel is older this will over-zero things. I can do that, or you > > > > can add the patch to this series, just let me know which. > > > > > > I was thinking about this, and initially, I chose to make the smaller > > > change. I think it might make more sense to combine the patch, > > > given that the memset behaviour is "incorrect" if we do it based on > > > sizeof(*req), or sizeof(*resp). > > > > > > I'll go ahead and respin this patch with the change to call memset > > > based on sizes. > > > > I think it would be good to keep it as a separate patch, since it's an > > unrelated bug fix. That way if we have to revert these because of some > > breakage, we won't lose the fix. > > > > Cheers, > > > > Tycho > > As I was doing this, I noticed that the self-tests all use hard-coded struct > sizes. When I was playing with extending the API, all of a sudden all the > self-tests started failing (until I recompiled them against newer headers). > > Should we also change the self-tests to operate against the seccomp > sizes API, or was it intentional for the self-tests hard-coded the struct > definitions, and locked to the kernel version? I intend the seccomp selftests to be kernel-version tied, but I'd like them to fail as gracefully as possible on mismatched kernel versions... -- Kees Cook