Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp340975yba; Wed, 3 Apr 2019 09:41:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9UL//RwSLGp9psJrxTUqCmckXvCkHp8ZfSXEIs9oNF6MLI+f9KRO/mwUIA+mME5KERA6/ X-Received: by 2002:a62:75c5:: with SMTP id q188mr451754pfc.76.1554309708472; Wed, 03 Apr 2019 09:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554309708; cv=none; d=google.com; s=arc-20160816; b=agdpuTOAyhs2sTqUrZGjZhH+wLWiiZf3bYe2/bAaQKruP/2r7oa5dfosErrKPx2ooG T8UMvGfLQKGq+ZGSqlKi8GwTtOdkUXkKnfY5mTzxELZHQRYsRi9As7aFU0bOEZeB62kM cqE3EtVKSFScJ76jlBmsBymq9NFRj30a1dH+OcWbyyfK2693kTST23WtZ4Rwsm9lBWmR 75vdE9Mmai3/lqCR1gthsyhyILm3A63H/kFt0H9oONkg+SSYoPtAJg4nlplv2d7j+xLI wuS4H7f1oQrY53yXple854TX3R6sAlbdt9n5SYIqziO76j0sLyKkk962N8h1T834HdlY A+6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=6CCS6Ad8hengQYIK+Cs6KJNOx4zF8Nw+BXALVhaDako=; b=gsB85HjeDhZBl67mcv/znAz8rbCfBf0c4xBkkhJPvvN1oIQzpWZsw9vUQB+jH0wFc5 r9HB3Aczb/j2LbnmUWiFSgQXn2SWoepTQXpdg+uZBHNk2VJ3ceetwoh6HZAwwdovbLfn rszx+K1dB+E3j/Yl7XDyRVWGGjU8i4mdwMKZlxiRaGOb00aGW22oXN24EEaltx9lJza/ /T02jAg9yFUxxeaeMlaZUl+cSddh9zWNsKs2xfppqCCeJSYPxG68vqNwd+m/D3AP5SVZ UTmTLMqkfYghaci5Y7Zh2EC7g1+EgDL4dBkwIHpTZcdqd1qNAM91Top6ElPjf4QUaCDP HSOA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f65si14417702pff.195.2019.04.03.09.41.33; Wed, 03 Apr 2019 09:41:48 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726462AbfDCQko (ORCPT + 99 others); Wed, 3 Apr 2019 12:40:44 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:41798 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbfDCQkn (ORCPT ); Wed, 3 Apr 2019 12:40:43 -0400 Received: by mail-lf1-f65.google.com with SMTP id 10so12207404lfr.8 for ; Wed, 03 Apr 2019 09:40:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6CCS6Ad8hengQYIK+Cs6KJNOx4zF8Nw+BXALVhaDako=; b=mlJPeTc2jDuJpSpEPnm/GeQFtacsy4x+biA2/aEYmrIu8Yn+HM0SnFJymTWyi0l856 z56lrIdQhZPZCoOnY2FhLCaM29wJkGwns1EZvhm91Hiz0XthFinpF5fUKFtIdGUFsXM7 VglYbap32IE+wruB0+GVX8KeJ3Hr0XDyrmv+vvBTep2kQWPBbRwE5eNeQ6EdKrDu87jA NJ7btCeHCMORaMSWctH8dxRRsMRMAxmRzpcNEWpAICB2Ya5+BBS63zG1E0l2Ff7ebmZm 8Tn8K3unp+q9AC1N5detSFjwGjyPAhz3vj8bgaEBBmQq/x+iF8SBTjWkuJSMkMzYIq1D ANhw== X-Gm-Message-State: APjAAAUxKilvB79xBFIkJzc08K3wEknU2IILkXK3Kn2EcIiq/anPfOiJ W0wbS1qNkgsoD0YNQZxTVfxNvomvyc2a9EpemsTrOw== X-Received: by 2002:a19:9145:: with SMTP id y5mr402273lfj.35.1554309641709; Wed, 03 Apr 2019 09:40:41 -0700 (PDT) MIME-Version: 1.0 References: <20190328130306.25384-1-mcroce@redhat.com> <20190403140203.qq37rgcikvoawb5f@brauner.io> <20190403155108.GI22763@bombadil.infradead.org> In-Reply-To: <20190403155108.GI22763@bombadil.infradead.org> From: Matteo Croce Date: Wed, 3 Apr 2019 18:40:04 +0200 Message-ID: Subject: Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max To: Matthew Wilcox Cc: Christian Brauner , linux-fsdevel@vger.kernel.org, LKML , Luis Chamberlain , Kees Cook , Zev Weiss , Andrew Morton Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 3, 2019 at 5:51 PM Matthew Wilcox wrote: > > On Wed, Apr 03, 2019 at 05:24:26PM +0200, Matteo Croce wrote: > > On Wed, Apr 3, 2019 at 4:02 PM Christian Brauner wrote: > > > Yeah, maybe but it still feels cleaner and more obvious to just add: > > > > > > static long long_zero; > > > > > > given that most callers actually seem to want an (unsigned) int. > > > > > > I don't have a strong opinion though so if others feel that it's just a > > > waste of space consider it acked. > > > > > > > Well, given that the value is zero, in this expectional case we could > > avoid duplicating the symbol and save 4 bytes. > > What the maintainers think? > > If we care about saving four bytes, we could just pass the address of > ZERO_PAGE(0). That would work, work too, maybe it's a bit overkill. int zero is always there and it's static, so enlarging it to long should be a straightforward fix. Obviously we can't do it for other numbers, but we can alias it just for the zero case.. Regards, -- Matteo Croce per aspera ad upstream