Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp97670rbb; Fri, 23 Feb 2024 13:07:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUQCU0PWRk1Gf5mm1nNaQFJrT/Z20pyzs8taQKuISvhShSu7DI1Sl+H9IrL4v/LoLoWAIBtA+f7dhquC9aBG1oFdIVc1E3NSUP5B9uDwA== X-Google-Smtp-Source: AGHT+IEShDTeF+5biH+6QBQ3nxh917WL5d889abvOkYVyFrJ15K5KHNBi323LfMrTGnSnETPga3W X-Received: by 2002:a05:6a00:1790:b0:6e4:da27:785d with SMTP id s16-20020a056a00179000b006e4da27785dmr1466893pfg.8.1708722466902; Fri, 23 Feb 2024 13:07:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708722466; cv=pass; d=google.com; s=arc-20160816; b=T2XiTD1xiUr7nccSt4lMuWisHCR2HIBuwiYe8wwU0GYZMMk9FF/96Ppl6X9Lj2cbDX DgKQyHPR3jQEMmk3kBQfEgmulXCTPXQnQpoRK0DnycvjFiOBHPl2BMSNe+fQGr9C/FTJ uLK/XkOdbKdoZ4HStagkI0otFb1LFDxdHqOWMUV/PzGEMzByg7Bg9j+UlTX0NOyAra28 pBH5nOtBE5kQkNZYBF66Gc/Gk8W3WYJiiFBOhtCn8BEnG77D3JOE4TsvKy2HYhj7lEuE +2W78iD8hu+fiXnwYK8JGXEKZV5IOsLL8GxOB7DIz7cm0GxXe8e4EIJMKZiDrKgwGaYm 50Ww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=HTVIr1+DQqd7VndTuddH8HDUIEhAoCQ0AKItibRMycI=; fh=TVmieWCdBuuOeIGFA1Rs1oi3pU/ggYbynqAXe4fqM6s=; b=NO2523jYcjuXWVhaExXsV3dhU7M0yYGGh02ztAow98b4mV0TqvgpjDGBtmEx1uguzp 0H6+FtDh3fRFyXDSpHZpLJWKjeD8FGoi7yx8hIdJd0LxaTvKdRPXz1eGCmuNXJFb2IV1 Lb8mhgb6AM0M6T+IvzO2GZad8lo5ByCIzJv/wqEf7yBk5YLjnK8zSmnb3MXdix3aeCNV blEtg8HrBNJsD2PAPTQSqIUNO/awSrloKPKGu8bun2aiJo8J/PCuqtzQP/7zV6VNOK9B PXdFzXwCv9twdu1QP7TypkWa5IfkqK7aWGo8jgUl7RLyHtN/Nyx3jqv7U3MEK6SH4Luy txHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=CpbZ+1ON; arc=pass (i=1 spf=pass spfdomain=paul-moore.com dkim=pass dkdomain=paul-moore.com dmarc=pass fromdomain=paul-moore.com); spf=pass (google.com: domain of linux-kernel+bounces-79178-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79178-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b129-20020a633487000000b005dc7f609bb8si12692086pga.644.2024.02.23.13.07.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 13:07:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79178-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=CpbZ+1ON; arc=pass (i=1 spf=pass spfdomain=paul-moore.com dkim=pass dkdomain=paul-moore.com dmarc=pass fromdomain=paul-moore.com); spf=pass (google.com: domain of linux-kernel+bounces-79178-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79178-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 983F4287711 for ; Fri, 23 Feb 2024 21:07:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B27F8149386; Fri, 23 Feb 2024 21:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=paul-moore.com header.i=@paul-moore.com header.b="CpbZ+1ON" Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (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 38B67146E71 for ; Fri, 23 Feb 2024 21:07:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708722451; cv=none; b=XPywkOo2XwmjR3HT55T1BNgbNITq+EJ8CM7jYXxiSnS1cu5wTTiiCZ5n+aNvSqa3S5voabdWXdp752DfPMzdxOKJuEyDPvc5HGpgqrqN9t6870+A1iCmsie4tajI7yvjHEXMsKDZAIWi+mHBbDIxZKTbf5qr4JWxrg0Cl0oH5MY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708722451; c=relaxed/simple; bh=6VgQr8fJjg6fEs6AHFjmsFnIQHc5a5uEmdWg5mQPymA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=qUeXshgEz2gH/Y+hYwK961dCFLE8rnSlGre8QG9kFEz/dyq9paM1onvXf+mDQ+ehHxgn05HLwt2MwM5PnKJ8Xt86mi7WltmCWesOZvN0yuH8N5qcAS0zSMh043MzjPekOATz7IydI17s4fcygn/4EhDalsm7uN2vlSMcKo7ifdQ= 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=CpbZ+1ON; arc=none smtp.client-ip=209.85.128.182 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 Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-6087396e405so6931787b3.0 for ; Fri, 23 Feb 2024 13:07:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; t=1708722449; x=1709327249; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HTVIr1+DQqd7VndTuddH8HDUIEhAoCQ0AKItibRMycI=; b=CpbZ+1ONoL4hAF2MgBVMj9+mDIUgqyyn2Rm0f6MXSEW7qL6SCnfVpPtW/MwXPpa3NG kZWWX7CumzKC5qLo4sP3uyGIa7FtcWmhi7C0HxIaKTCwUAM5DeFmd5hgrOWCefMeeCHU gC60pChbSpNcR42yqtujInW2HBd8I2l9aTLH5jDZxYaU9hIpZhsb1se8Du8BoKhZfeuN djJuvHVC7vEc7XuVFqFbUKmMPtEWcoGWkkNg519RijfyNs8orSCX8XnAoaRBCBNHHzDq bfvuirSyKlz3isF1tLaVmflxPZa4PfKELAvanWuHsnD3HJoIRe4GKWCJ3tWFCjARswO8 Tfqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708722449; x=1709327249; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HTVIr1+DQqd7VndTuddH8HDUIEhAoCQ0AKItibRMycI=; b=uV9+ugiWzJ25I/X42mcMQ9URDkyho8HWxg6TUQzhzQ1eJrFf6JN1+vkKqAKeN2ADeB /igyZZ49tFstPRbrbAE3WhYnOfoC+icjAIx2/OTPeQj1AmgH7VE+WcNKXR/zTGPLHA1A EjVBIf+zq1sNzHAVXqMgHS+T2NtEgmYeoF1ovVKKQlH43lDOpT28SiMtSPIGZyGOBDL7 FrUSFayS3ZXwAQAs1utWrpRms/5SukalvN+Tp4aWMSL6Py6bfrOpdend2bU/F82LZbzn qAfxwjGftnL087ilhKS7myiSdpxBy3lH16nUrzzEVKUcE4lN8nxfvl4+JBv96aPYHhh8 9wpQ== X-Forwarded-Encrypted: i=1; AJvYcCWP5voIKHnblCNIOB0OaJOZGcd36hEtlOY5FDvCrQ0a7apvvMJHdhV/0ExwmKptnKLADk8LRt8ze0iLuOulBvOZAMuopZ2wL4zPUPrR X-Gm-Message-State: AOJu0YxXLjuyoZA7+ZZ8+jHEkuPJDJZCBoGtZoTvE6IfhymnM2IAs/5v U9nZP1PAIlRfIbf6eN1wIEqROuSXx98CQCVFPU7xL0QXXv2gLCCqy0tSyYoW7Q/okEK/mG5Ehn7 ZyxqjZXLQ4GhSclLanJua+IqkaZMVa+2bfJVw X-Received: by 2002:a25:b215:0:b0:dcc:97c:5754 with SMTP id i21-20020a25b215000000b00dcc097c5754mr892475ybj.5.1708722449224; Fri, 23 Feb 2024 13:07:29 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240223190546.3329966-1-mic@digikod.net> <20240223190546.3329966-2-mic@digikod.net> In-Reply-To: <20240223190546.3329966-2-mic@digikod.net> From: Paul Moore Date: Fri, 23 Feb 2024 16:07:18 -0500 Message-ID: Subject: Re: [PATCH 2/2] AppArmor: Fix lsm_get_self_attr() To: =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= Cc: Casey Schaufler , John Johansen , James Morris , "Serge E . Hallyn" , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 23, 2024 at 2:06=E2=80=AFPM Micka=C3=ABl Sala=C3=BCn wrote: > > aa_getprocattr() may not initialize the value's pointer in some case. > As for proc_pid_attr_read(), initialize this pointer to NULL in > apparmor_getselfattr() to avoid an UAF in the kfree() call. > > Cc: Casey Schaufler > Cc: John Johansen > Cc: Paul Moore > Cc: stable@vger.kernel.org > Fixes: 223981db9baf ("AppArmor: Add selfattr hooks") > Signed-off-by: Micka=C3=ABl Sala=C3=BCn > --- > security/apparmor/lsm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) If you like John, I can send this up to Linus with the related SELinux fix, I would just need an ACK from you. > diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c > index 98e1150bee9d..9a3dcaafb5b1 100644 > --- a/security/apparmor/lsm.c > +++ b/security/apparmor/lsm.c > @@ -784,7 +784,7 @@ static int apparmor_getselfattr(unsigned int attr, st= ruct lsm_ctx __user *lx, > int error =3D -ENOENT; > struct aa_task_ctx *ctx =3D task_ctx(current); > struct aa_label *label =3D NULL; > - char *value; > + char *value =3D NULL; > > switch (attr) { > case LSM_ATTR_CURRENT: > -- > 2.43.0 --=20 paul-moore.com