Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2513860pxu; Fri, 9 Oct 2020 21:15:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx29wA/cET47L6L/MZlxHMqeIUPTVdAjIrdEkucJSImhpEXjnIunF7bFonZkQsK4+3v9Spj X-Received: by 2002:a17:906:7013:: with SMTP id n19mr17345704ejj.388.1602303322633; Fri, 09 Oct 2020 21:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602303322; cv=none; d=google.com; s=arc-20160816; b=09dIxPj3w5NQu7jZM7Jf4MlPdivdzlTfxEayWIMsBf07wI0j/iCbHPPfHtCoIp/jbN mK/vOLmCHruPV83GVpY3WpGhCkRYnOiP2+bauB04RnHM1ws9cCExYnnLaP2lNKLSSxkG j0fv1jfjVIHvFIJalB1Uk3h3+rkca4kYySAToD8NVT/yDTHuuoGbkYUsKDGiqpLMlWsa q+JXtJwkimc5o81HaTI+5om4YQRxipnqHimhbGnDRT8a6s1LZ+jk/c1jsafBJp14qUxi TvPta8TFlF8pugay4c3RADJ427475DZllUL8mIMrMxW+o4pWWj9cvmAZmITc0f2au8/O rgMQ== 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=v9IKSkrUBLN34PyZU6BkMdfUZT/ATf6pZPKTpubH7EM=; b=B+nM0vkAwi+Oo+XAd48h/tK0mVJqLlbqCG02/8eWMrI0AIKjKx3wA7ypBp4olpmbwH Zh6i6hBjRmbjRwCPxtZrvHqw57jfWKvuikkdIt3YSUbgXUhG0q2BuvvTShYTPNXYXUxb vSMyFl0+wIANNtwCW8lzwYvJ+HPTJHyh71MbRvrQAK+ffNxrl3Qk0MScdLWxUG3Pu1lu U2KrZAILiEXzjTd0ESjKw0hulk+C9hLZuSXW0av5fzgTOjHex1+cuB7v/ift+jaU4QVG ZQjZkOH7/hSLwMzk5dJDiuPrtN40eAGz1ttFCF6mGTXDZOhBaGcmRbGMc/kwDafTi/eZ DcFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0WbDWoyJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb11si7586183edb.274.2020.10.09.21.14.59; Fri, 09 Oct 2020 21:15:22 -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=@kernel.org header.s=default header.b=0WbDWoyJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732748AbgJIU7q (ORCPT + 99 others); Fri, 9 Oct 2020 16:59:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:57712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389072AbgJIU7p (ORCPT ); Fri, 9 Oct 2020 16:59:45 -0400 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF7EE223AB for ; Fri, 9 Oct 2020 20:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602277185; bh=K2FMVcPnwpnFdFTH0nWKguSV5alJGPLhcP/xaLhn8SY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=0WbDWoyJhSvlQ/9KmhcYAraUDQn9/GNW1Dgw0FK6r6Kx9ocUAq9ltOKxoWihM/jJM 9+PDgGyjK9I7t+Oag/P2EdOyb2jiNSR0r7uB4kouuLpmbA2wzxPexcXryPXXZBpSlp STMGl7CsXcGiTdduLMw4vkXoQtfsyhpJ6E0mJsgQ= Received: by mail-wr1-f48.google.com with SMTP id e18so11639509wrw.9 for ; Fri, 09 Oct 2020 13:59:44 -0700 (PDT) X-Gm-Message-State: AOAM533slwap3q/431/B5GyFdDGJSaFvZ5/X9oqaPUSDS7d6q1HxDZaQ 110+YnZgyPAZjHIDJ0GaSAW0Nj+U4wra7o4djXAUZg== X-Received: by 2002:a05:6000:1202:: with SMTP id e2mr16591334wrx.75.1602277183196; Fri, 09 Oct 2020 13:59:43 -0700 (PDT) MIME-Version: 1.0 References: <122e3e70cf775e461ebdfadb5fbb4b6813cca3dd.1602263422.git.yifeifz2@illinois.edu> In-Reply-To: From: Andy Lutomirski Date: Fri, 9 Oct 2020 13:59:31 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 seccomp 3/5] x86: Enable seccomp architecture tracking To: YiFei Zhu Cc: Linux Containers , YiFei Zhu , bpf , LKML , Aleksa Sarai , Andrea Arcangeli , David Laight , Dimitrios Skarlatos , Giuseppe Scrivano , Hubertus Franke , Jack Chen , Jann Horn , Josep Torrellas , Kees Cook , Tianyin Xu , Tobin Feldman-Fitzthum , Tycho Andersen , Valentin Rothberg , Will Drewry Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 9, 2020 at 11:32 AM YiFei Zhu wrote: > > On Fri, Oct 9, 2020 at 12:25 PM Andy Lutomirski wrote: > > Is the idea that any syscall that's out of range for this (e.g. all of > > the x32 syscalls) is unoptimized? I'm okay with this, but I think it > > could use a comment. > > Yes, any syscall number that is out of range is unoptimized. Where do > you think I should put a comment? seccomp_cache_check_allow_bitmap > above `if (unlikely(syscall_nr < 0 || syscall_nr >= bitmap_size))`, > with something like "any syscall number out of range is unoptimized"? > I was imagining a comment near the new macros explaining that this is the range of syscalls that seccomp will optimize, that behavior is still correct (albeit slower) for out of range syscalls, and that x32 is intentionally not optimized. This avoids people like future me reading this code, not remembering the context, and thinking it looks buggy.