From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 950BE3AB29D for ; Mon, 3 Aug 2026 20:03:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785787431; cv=none; b=DD77HnyTSaHJI3L0O3fXSs/ziR9SvHFcu3mpl5EwxItIy2Fvt3FlZAvgtE9HjX/reClmPCzFe4gYro05HMGAXIt77D6KuZTMihp8YBhYTgxq7naow4NIv2Pb5kgPIJkpV+fVrncaYsKz4WXZ4+Hb5U1rUyQ7TrbUCNP5ingj1uU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785787431; c=relaxed/simple; bh=aT49OffwABkWVv4EIBGwYpySJxRUFX9qeA7/ajUZryI=; h=Date:Message-ID:MIME-Version:Content-Type:From:To:Cc:Subject: References:In-Reply-To; b=mbCwwTCfl28+il3zjLse12zW1Hpkof9HVX2fCFMUhyRXHc8Uu6gYeyE2DecEn2GleokA5igTKASEmpUQVVzYacy1z3m1mBvZcJ5E2ktNk3R0VT3ybZa/LIn3i9qFuBn7IyNbpKwPxkeVHWagyAl5Gu+dhCVcYjp7ImD0izG6UmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=paul-moore.com; spf=pass smtp.mailfrom=paul-moore.com; dkim=pass (2048-bit key) header.d=paul-moore.com header.i=@paul-moore.com header.b=VIefU4hD; arc=none smtp.client-ip=209.85.219.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=paul-moore.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paul-moore.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=paul-moore.com header.i=@paul-moore.com header.b="VIefU4hD" Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-8f256eaedf8so33972676d6.2 for ; Mon, 03 Aug 2026 13:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; t=1785787428; x=1786392228; darn=vger.kernel.org; h=in-reply-to:references:subject:cc:to:from:content-transfer-encoding :content-type:mime-version:message-id:date:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GrM8OuNgXXrb+t+iBt1N92EV6KvYbox2YuCkBhGF2R0=; b=VIefU4hDDYdnnjJHjHBmwMqSbSTY7fFydOuP2yjxGzNZq/8nYLhebD0vyBFxU1w6Hl ATh+LKzItUSdI+9NxpX6MlBcpY9ndzILmyjeJ+CUZISXU7vMVQ6eDNmrQtiO4IvWg4RO efXDSvOPnkpspjwjLq52Qj54d+gP3KFG4qdy3S4tpcPMCZ3gcWD2KcLAUqfSON7pVkJg wE7u6pHvIPsmmxY+fyeO4n8EhM1RSd/by+31suDDEJ26WY7/FfUfkIv3pUQOwVCXTpdq dHVRrURJfI1zPdtUupALkDqM5/0M5HzaXNnlpilsHeBTzkKtv538DGxNZgYEbnaTUl31 g82Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785787428; x=1786392228; h=in-reply-to:references:subject:cc:to:from:content-transfer-encoding :content-type:mime-version:message-id:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=GrM8OuNgXXrb+t+iBt1N92EV6KvYbox2YuCkBhGF2R0=; b=N6B4IcqT8ExnqYbAgFANlzpPxq99+gZjr6JZRII+9kOTiYX/9N1/MQxEvoehKz5PuA x/xo2Sabzu/DDyICZWSHvGiAu+6h0JQxiLHUE5/8Y0Nc2u+5LtOAakZzXeNjDjmwyXvW 0THNZzucQhOCu5H2oBkH4N4YBf99tYPqN+Yat+j57UO2wsk4sSX30OxNIoo6QqziFlLy 5YlkYykAfgVXL3JZGk16q283JiV57On26WnT7xoz/ChnrlwVOlwNAaJmimtmiDUTNMvB BWmDRpuQymCAC4PYctKkml6iun68uP7xQ1cGwDYuSGuU15s7Xe6/365H/LwsBmNuoKmC jZwA== X-Gm-Message-State: AOJu0YzeQeesT1gKfpQHozma55DCqYpAPk/TYkcG2o9Z+d7hIJOj7W5i sQOSLxJrB7LDv2cJ8In0JCDsS8dSSZDEov6mPuhy3uJCxupLyuBQ4vcAGzeyk0b8jg== X-Gm-Gg: AR+sD13v+8HAqMwZRN7io//MSA8mFmLVPLxWgdfIwol8Wh2AqQ984zv/k2YBEgQsCms CAP0jOLZDSfvhnqPxbAc2njnd1/fMq+3yy4LdTNCfBcPFSV9kkBJPQStK8A85L5MEIowGBG9GjD 1llTci4YT4welfbZ/FiKBfVz2PTVGI9I6tqwb7MYTca+kCyRLnFQV3V4hV3NlKQ8EZ2xi4s6uh2 UbfkqHRE4ejPkuA/vdY8z4JzT/vLRXvC+Z92l0rRq+gG4masUjd+0f8ISD+uWoxqQsfyWLFm/tV PMqTbT8m0z5Yf+iISRJzye3DmW4h0XSZyJlAtLdCgJqxRd5BrYJnnVS44BjlypM+HiTRkzrGndL wX04R7MnkZ/PvXnJxMNSdDGF7AUxbqH/2BUrZI+VFkfAm1NeQyLGicY7xUSu8QACL+ARCySXSek mPE2LyqJ4EalMv2IdgOJodyODlVE8MrVI4k9tX1CHLgndl7b5VT34oESe+WP6cfYSajyFIrOYh5 pyi9iEsa3uRKYiJdEwjxO7k3jTYDO8gMA== X-Received: by 2002:a05:620a:a407:20b0:914:bd27:2d1 with SMTP id af79cd13be357-934a0783490mr1787176385a.11.1785787428305; Mon, 03 Aug 2026 13:03:48 -0700 (PDT) Received: from localhost (pool-71-126-255-178.bstnma.fios.verizon.net. [71.126.255.178]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9349c199b76sm735839985a.24.2026.08.03.13.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 13:03:47 -0700 (PDT) Date: Mon, 03 Aug 2026 16:03:46 -0400 Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailer: pstg-pwork:20260803_1511/pstg-lib:20260803_1500/pstg-pwork:20260803_1511 From: Paul Moore To: Bryam Vargas , Stephen Smalley Cc: linux-kernel@vger.kernel.org, Ondrej Mosnacek , Kees Cook , selinux@vger.kernel.org, =?utf-8?q?Christian_G=C3=B6ttsche?= Subject: Re: [PATCH 2/4] selinux: require a class's permission values to cover its permission count References: <20260731-b4-disp-d32e997b-v1-2-0341d038ee47@proton.me> In-Reply-To: <20260731-b4-disp-d32e997b-v1-2-0341d038ee47@proton.me> On Jul 31, 2026 Bryam Vargas wrote: > > security_get_permissions() sizes an array by the class's permissions.nprim > and fills it at value - 1, from the inherited common's permission table and > then the class's own. A value no permission defines leaves a NULL that > sel_make_perm_files() passes to d_alloc_name(), an oops inside > sel_write_load() that strands selinux_state.policy_mutex and leaves every > later load in uninterruptible sleep; two permissions sharing a value > overwrite the first kstrdup(). Bounding each value by nprim catches > neither, and neither would a count: the symbol table is keyed on the > permission name, so duplicates pass. > > Track the values each permission table claims and require them to cover > exactly what its count declares, rejecting a count no value can reach. > Conforming policies are unaffected. > > Fixes: 55fcf09b3fe4 ("selinux: add support for querying object classes and permissions from the running policy") > Cc: stable@vger.kernel.org > Signed-off-by: Bryam Vargas > Acked-by: Stephen Smalley > --- > security/selinux/ss/policydb.c | 51 +++++++++++++++++++++++++++++++++++++----- > 1 file changed, 46 insertions(+), 5 deletions(-) Merged into selinux/stable-7.2, thanks. -- paul-moore.com