Message ID | 20230706132337.15924-3-cgzones@googlemail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2559185vqx; Thu, 6 Jul 2023 06:25:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlE/oE9aO62zPmZPRscg+IuGbSGved63BM45SQtPbdLIp5JW0AGBQKZQeZECMUr/4sNIRMIi X-Received: by 2002:a05:6870:c225:b0:1b3:e04e:b5c7 with SMTP id z37-20020a056870c22500b001b3e04eb5c7mr2346477oae.42.1688649936704; Thu, 06 Jul 2023 06:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688649936; cv=none; d=google.com; s=arc-20160816; b=MVneFz7nhUJ5V01L6zswpZaV7cEnnW6/W98bnnHzAT++5AzejcFF0P5NTi7xo094FC eSraudsgdsgZhJ5piyxTYZEsFoNN4cfdl+DDVJeQabimmve5VL8TE87u5/sPMEK0Wir8 12+0NFlzbOmw/5IG1K1VUG3Ru4K9cV0u2vwdRJraF56+/w6GNyOSPnaJjn9rwb3S3tKL dGuhFueUPxgiN+3QM0aPH53aGKKVlI7RKK3wFkHYgAjslfd+E9rSc9jDhT9Yg1y98V62 qGm8a6Rk1x8/yaDDzsZkHElUG5wT4+IJmKKtDQcbhTjngn6BVgsh9mtbgRfTjhaNWgmb KP4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R5oF3uYoWt5EFgsUFvcffiR75yMh8VkfJwbZTgy76Mo=; fh=QKur2PFwoLuCt27JzfZM4LabS9ldoGoSAJNPH9t/KWI=; b=auhTcAUsbLfunyMDTgy5wQio0ZAUpe2lQ4YNaq5ogYG8v64WL7VXYOjZ5UIhKYJIqp ma6frm0ximKoggyQ3lC9+m+ceFi4BKxvM12Sc+G0Mb/Q0jpRLrGu9DvVb8d/cOnCtdHI CVZktgyPs7sTHYx0dIqNn6Y8ePIili1SlhN0iVT4W3tiZnfkIMMCR1NHr9nX9pfOuxGu 3GZ7240UB2k89pA4AgtjxPLxZsWkol5yAXpefQx+1oQigGhFcr0Q1lvX8eOGwAsT4T+a K7bXH2StBTLgn5CZqKz3JYIpcyY6lhAVrTNraA8gyXMdhVxvHA7l7zp/1gVyr4eKN3r4 jC2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b=PT13sW0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx16-20020a17090b4b1000b00263a643aaacsi1611959pjb.11.2023.07.06.06.25.21; Thu, 06 Jul 2023 06:25:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b=PT13sW0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231972AbjGFNXy (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Thu, 6 Jul 2023 09:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbjGFNXs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Jul 2023 09:23:48 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F5F619A0; Thu, 6 Jul 2023 06:23:47 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-51e278e344bso994513a12.0; Thu, 06 Jul 2023 06:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1688649826; x=1691241826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R5oF3uYoWt5EFgsUFvcffiR75yMh8VkfJwbZTgy76Mo=; b=PT13sW0cBxut5bnUu/G3ezlygIHXia0TGzgjOzSQGtt+nT1SaEv7BRGuIAtl0ZuW87 pIcsP97UF5QPd4CyAh23J0qtrUA/u9EhuNhmjH+1XWWI8S7+UGMQxNC1ZKu39vvbO4mM sOIS8CeLnJzM6/k6EbcdHNVbDRtEgxKbAwzsDEHmnjvAc6raB5DAgBnZs89h+bkXX5or q37foOx33BekiZbc5Uq8d9S2j/3XXH5UiEmuNpnQtivxbyHLqcGYWldUqa6GdIjBpKW+ mnhxd47pSPB033P5lzMi9XZGNvWB6nRXxrPG+D/UBhy63yb7f0tZTkjt6QprXw4NscfI 32mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688649826; x=1691241826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R5oF3uYoWt5EFgsUFvcffiR75yMh8VkfJwbZTgy76Mo=; b=SRdCIF/eeMX0vdCYJ2a6uVKzK44fbYY13cku7BVlMJ+7H+CQjjp8FSTVKAhqy24yh9 h4ChD7Tkt0WON8ahL/6N23wnX/Ac2mxjikvieIVfoOpFikREd04OZ+iwcV8QC7KwmPxy 3zvhLZ9PDt2HWcXNTsdWewB7bHlP5iSjCcwdKxJxDdg282lR/FHigKvWMSxo8dnYDwJ5 1r4jsfsVoUZtFtrno1lNVwshnZ5Xr/pxIKlQQZ9CmgQWHeQKo9gTGEcEkn+DTjoObZ2w NnplkSRUptHYVtNoWgyDHnzk4ey/QmmNg89I5bvJc8LNZVSBCDhIpQk18Mch0847U55m pM9A== X-Gm-Message-State: ABy/qLZHQSDW4xciUmfJK8s4yQUjDWrxjvO0PMBCk/ubp83d9hMu+sba HvOTgpcWpu4XSot3VIjQy82jvlx8KnazlVxA X-Received: by 2002:a17:906:943:b0:992:a9ba:b8da with SMTP id j3-20020a170906094300b00992a9bab8damr1326359ejd.70.1688649825646; Thu, 06 Jul 2023 06:23:45 -0700 (PDT) Received: from debian_development.DebianHome (dynamic-077-008-088-179.77.8.pool.telefonica.de. [77.8.88.179]) by smtp.gmail.com with ESMTPSA id r2-20020a170906364200b00988dbbd1f7esm808024ejb.213.2023.07.06.06.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 06:23:45 -0700 (PDT) From: =?utf-8?q?Christian_G=C3=B6ttsche?= <cgzones@googlemail.com> To: selinux@vger.kernel.org Cc: Paul Moore <paul@paul-moore.com>, Stephen Smalley <stephen.smalley.work@gmail.com>, Eric Paris <eparis@parisplace.org>, linux-kernel@vger.kernel.org Subject: [RFC PATCH 03/20] selinux: avoid avtab overflows Date: Thu, 6 Jul 2023 15:23:18 +0200 Message-Id: <20230706132337.15924-3-cgzones@googlemail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230706132337.15924-1-cgzones@googlemail.com> References: <20230706132337.15924-1-cgzones@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770677795896952726?= X-GMAIL-MSGID: =?utf-8?q?1770677795896952726?= |
Series |
[RFC,01/20] selinux: check for multiplication overflow in put_entry()
|
|
Commit Message
Christian Göttsche
July 6, 2023, 1:23 p.m. UTC
Prevent inserting more than the supported U32_MAX number of entries.
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
security/selinux/ss/avtab.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Jul 6, 2023 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com> wrote: > > Prevent inserting more than the supported U32_MAX number of entries. > > Signed-off-by: Christian Göttsche <cgzones@googlemail.com> > --- > security/selinux/ss/avtab.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Merged into selinux/next, thanks! -- paul-moore.com
diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c index fbf51986afcf..9c150fba3fa6 100644 --- a/security/selinux/ss/avtab.c +++ b/security/selinux/ss/avtab.c @@ -110,7 +110,7 @@ static int avtab_insert(struct avtab *h, const struct avtab_key *key, struct avtab_node *prev, *cur, *newnode; u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); - if (!h || !h->nslot) + if (!h || !h->nslot || h->nel == U32_MAX) return -EINVAL; hvalue = avtab_hash(key, h->mask); @@ -156,7 +156,7 @@ struct avtab_node *avtab_insert_nonunique(struct avtab *h, struct avtab_node *prev, *cur; u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); - if (!h || !h->nslot) + if (!h || !h->nslot || h->nel == U32_MAX) return NULL; hvalue = avtab_hash(key, h->mask); for (prev = NULL, cur = h->htable[hvalue];