From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Subject: Re: [PATCH] seccomp: Use -1 marker for end of mode 1 syscall list Date: Fri, 19 Jun 2020 12:53:46 -0700 Message-ID: <202006191253.B00874B22@keescook> References: <202006191236.AC3E22AAB@keescook> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-mips-owner@vger.kernel.org To: Andy Lutomirski Cc: LKML , Thomas Bogendoerfer , Arnd Bergmann , Will Drewry , "open list:MIPS" , linux-arch List-Id: linux-arch.vger.kernel.org On Fri, Jun 19, 2020 at 12:42:14PM -0700, Andy Lutomirski wrote: > On Fri, Jun 19, 2020 at 12:37 PM Kees Cook wrote: > > > > The terminator for the mode 1 syscalls list was a 0, but that could be > > a valid syscall number (e.g. x86_64 __NR_read). By luck, __NR_read was > > listed first and the loop construct would not test it, so there was no > > bug. However, this is fragile. Replace the terminator with -1 instead, > > and make the variable name for mode 1 syscall lists more descriptive. > > Could the architecture instead supply the length of the list? It could, but I didn't like the way the plumbing for that looked. -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731128AbgFSTxv (ORCPT ); Fri, 19 Jun 2020 15:53:51 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E60F8C06174E for ; Fri, 19 Jun 2020 12:53:49 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id d66so4863565pfd.6 for ; Fri, 19 Jun 2020 12:53:49 -0700 (PDT) Date: Fri, 19 Jun 2020 12:53:46 -0700 From: Kees Cook Subject: Re: [PATCH] seccomp: Use -1 marker for end of mode 1 syscall list Message-ID: <202006191253.B00874B22@keescook> References: <202006191236.AC3E22AAB@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andy Lutomirski Cc: LKML , Thomas Bogendoerfer , Arnd Bergmann , Will Drewry , "open list:MIPS" , linux-arch Message-ID: <20200619195346.q8Kyuw7lAHr9bERSjODZqkRlWgBHJCNDb1Unf3y0q-s@z> On Fri, Jun 19, 2020 at 12:42:14PM -0700, Andy Lutomirski wrote: > On Fri, Jun 19, 2020 at 12:37 PM Kees Cook wrote: > > > > The terminator for the mode 1 syscalls list was a 0, but that could be > > a valid syscall number (e.g. x86_64 __NR_read). By luck, __NR_read was > > listed first and the loop construct would not test it, so there was no > > bug. However, this is fragile. Replace the terminator with -1 instead, > > and make the variable name for mode 1 syscall lists more descriptive. > > Could the architecture instead supply the length of the list? It could, but I didn't like the way the plumbing for that looked. -- Kees Cook