From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (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 CD5233ACEF4 for ; Mon, 3 Aug 2026 20:03:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785787436; cv=none; b=fFtNfMV0x7Saiv+1azymlFpqEn4xYdNFD5kSE0rHCLzKSGTsqgdc+EpB0FFMgkSgHod40QaJZybLPQ+Cni8Xd32PokE3LRtMoOr//ecj7co3qxKo0GWBhxAedWcGnfe4k+sBJjOMVmFwIGYQQSmXYoZBXV1CgzciDp4aKSZlMQw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785787436; c=relaxed/simple; bh=D516SGOh5LEe2YDu7Tzxgp/6hoEADOVnMzuWwzJQFro=; h=Date:Message-ID:MIME-Version:Content-Type:From:To:Cc:Subject: References:In-Reply-To; b=DBNA0uQAX2OkXKoBpms7BWNz/9KO/RvK0pKE0vovtLAWNiNB9rsHkLog3oRA0eHd21yIkg3hnpMbSC8W4qRUxt1eLKDsF1hQefwFL85fTBZ482HGpUCgwCm4YKwmkiwcaRpsq0usZMqsuGvLcacqUkA37xr/K+wqH4qXQkaF2FQ= 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=DrH1XR2H; arc=none smtp.client-ip=209.85.219.49 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="DrH1XR2H" Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-90873ce5278so1215226d6.0 for ; Mon, 03 Aug 2026 13:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; t=1785787433; x=1786392233; 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=DA7FRPW6SbI40IUIoqyw1m2eYtidoQail71J/7sr0aA=; b=DrH1XR2HEKyZHmL5SpRLYD+0/7Wd9ps8nkCV9SagHttOsKa3ENa0moHvAjU7iNPEOV +E8rRDshgIyuY+Qa4RGKEXXpLK4T348AZvnPqOvGiluHvx3Yyl29Kl2sNB3ewjgIHlH5 6UmfGT4cLoY9F48vZ7cM+T06L+r9VjUVRWlRu6f+w59zJ/1ezIELKjqU/oGpydK3DiK0 rjH6hIJ+gpTEavssLTbuhv/geKOoIWhXUSRpvmNld0FbeASr2qILxV6bMicE1iV+DmXn koM25ZxA5FRTIBGhSiiGDrlCRGBoweJFgj1zN918vrbxtyrQplHtVyn6vNOWyq2bNlfE 3aYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785787433; x=1786392233; 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=DA7FRPW6SbI40IUIoqyw1m2eYtidoQail71J/7sr0aA=; b=JV1GYp55mAWyew9H+dZSlR3/KE1gKrrNxeRCbzttGqMlFvMsoKuASqCrlC6uA2jla8 SZeDBmlAxZ2fOvYryDgxj2CMfmFRPZIUx6Qo+n0FMBECWufRpVXZ+iBFGKwXJPtYoPls JKd51nvBoDr2zLFWhu5tCl8nWFjixcZIvPwEFIf1FeYPRM1lrjqeOE/v+TDRMtk3/s5p gHqq2nIHXftAEz6JNb1vUrekke+ptHy49YmD4A6CWRhF4xyaypWFLCsaPXPUWPv+TYn2 Zjn7iPvgdhMkW5Vx51V6Q4Gql+C78or+fZy0jXNRKIw5QKeI7n+nWfI6PlVh5jCSZu9g JZpA== X-Gm-Message-State: AOJu0YwIFDXhTkEWCl43x4W9AhRkwZzZM0WqIgQI9UqGsPsIFPEn2iQA w7KV4iIgj8cJjzOAXndBvIhfXSbzS1cZa4t3aDOZBoCbm+TZqcaIytRyT1tCmVRsNg== X-Gm-Gg: AR+sD13rKsS0GfXaGSeQ/9gtjJAYNFZ/ULFpBfKxUW9TIeDrij2yNYDEP85wShCXSnt mo7cVicNOVMn9DWxaMzjrlzVBxcFv6lm3dOdPaHPuCMroepYsz/ngd+tuhrAweL5AO2J1WVTYYm r9to6e9IvGlWRpDn5YCYVBxwMhdo2W1kFg0mAMg/IbmGMwNdnpuZWMLoj495pDr53/Io1NTVOwU YmEH6M9opODwc2iPCa/zHjTJG5ROd2wBB7QJh7WPnUhnRZwP8RqcAbvgwRwzs3MMqMOW3vV3fhF 1xCi4uA1IVHg3DWKa4lcCHfEzFPdKJkHmDabxMxM1cJ8KNstybSLEVOkRiZqEI/jmdGWRMc3BpR ZsYbpmRsnGQVTP1hLaM1RSn+pAnvDFi7m49f39rma/qF/YHprSmNFTLsYg1If6vOPDRriVaA5/B esp0kEfmxs2iRHlPSlKUvwN5Jf04/c2HsN1eJCY6Ori2hbcNf3yHFtl0o6Jzo+uz8Tey9lwdsE0 Y0Le5HoQEHX0t4T+UwBydc++P60JjZeRQ== X-Received: by 2002:a05:6214:2aa4:b0:905:6e01:b9a3 with SMTP id 6a1803df08f44-90849712a51mr189306596d6.31.1785787432714; Mon, 03 Aug 2026 13:03:52 -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 6a1803df08f44-908432a0ddfsm82522546d6.10.2026.08.03.13.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 13:03:49 -0700 (PDT) Date: Mon, 03 Aug 2026 16:03:48 -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 3/4] selinux: reject an unclaimed class value in security_get_classes() References: <20260731-b4-disp-d32e997b-v1-3-0341d038ee47@proton.me> In-Reply-To: <20260731-b4-disp-d32e997b-v1-3-0341d038ee47@proton.me> On Jul 31, 2026 Bryam Vargas wrote: > > security_get_classes() sizes an array by p_classes.nprim and fills it at > value - 1, so a class value the policy never defines leaves a NULL. > sel_make_classes() passes every entry to sel_make_dir(), reaching the same > d_alloc_name() dereference as the permission array. The class symbol table > is allowed to be sparse (policydb_class_isvalid() exists to absorb that), > but this getter builds its own array straight from the hash table and has > no such predicate. > > Fail the lookup when a value went unclaimed instead of handing out the > NULL. Conforming policies define every class they declare and 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/services.c | 24 +++++++++++++++++++----- > 1 file changed, 19 insertions(+), 5 deletions(-) Merged into selinux/stable-7.2, thanks. -- paul-moore.com