From patchwork Fri Nov 1 08:58:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Lee X-Patchwork-Id: 2006083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xhm3m0Syrz1xyD for ; Mon, 4 Nov 2024 20:13:39 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1t7t9N-0002Aa-J5; Mon, 04 Nov 2024 09:13:29 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1t6nUV-0006yZ-6w for kernel-team@lists.ubuntu.com; Fri, 01 Nov 2024 08:58:47 +0000 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 13B853F31D for ; Fri, 1 Nov 2024 08:58:47 +0000 (UTC) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5cbadbef8edso1200080a12.3 for ; Fri, 01 Nov 2024 01:58:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730451526; x=1731056326; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PIrmWEHzlqqF1fq/PqUpK1OujbRnKcQNeXOp51L9RGc=; b=BdG6fFjsHUEI36KKpvuHISPVQd7lHngsz24ZnHggjK11CS4k0A3xYy65+T8j6NDNxg jTp3oQBCe89mccwRqRmk1e/tamqor1bdsvEcwdpQ091VVZ0xS87+Va3F4qWwxrxqip1T Z1MTv31HzAKtrHqDMynQzdYNCX42PxmybdyqH4r04N2jFxHOOoi4St2xk4wy143aRyep oGmG5JQOeB8MJghntvtwdxPFwSVck7ircjn0SnBiUkiuaPlenjvjv2bwlMOcxl+XuoAc /kBuqb5gU2c5FOzEWDM7op0aZoR2e8ee+JHozG3HwgKcRowBuYJvBy6nYzc7PtjmtHAZ fnVA== X-Gm-Message-State: AOJu0Yx8aaNPhNRaT+Dl+VYkQm/p53dkOBJSex1ziRk/pHa8c8SmYpH5 r6k46U2iKGgR1gkbqtyzhSjFwEdJubDeAXeUq5Ta4YqylL7ecgZqK4g77F7IDlJq5238dy1JD0M jk3S06kcBSP3JAJ87S+nZZvI2xuEC913DsoNfiNWi6lV+/FTcfhhQvlX2p2wMUwKQenYDEzkMru jkQXTVrTowJaqh X-Received: by 2002:a05:6402:34d1:b0:5c9:6ae4:332e with SMTP id 4fb4d7f45d1cf-5cea967a284mr4927213a12.8.1730451526572; Fri, 01 Nov 2024 01:58:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2ARPxa0A9af4sSBkmqQWVU+sXcujymgY5NtNs2hYN6mXLcN0CAQIpFusFjiYTBP0YaA4yvQ== X-Received: by 2002:a05:6402:34d1:b0:5c9:6ae4:332e with SMTP id 4fb4d7f45d1cf-5cea967a284mr4927201a12.8.1730451526161; Fri, 01 Nov 2024 01:58:46 -0700 (PDT) Received: from ryan-lee-laptop-13-amd.CtrlMice (43-114-103-145.static.glaslokaal.nl. [145.103.114.43]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ceac7c8d58sm1347786a12.73.2024.11.01.01.58.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 01:58:45 -0700 (PDT) From: Ryan Lee To: kernel-team@lists.ubuntu.com Subject: [SRU][N][PATCH 1/2] UBUNTU: SAUCE: apparmor4.0.0 [94/99]: apparmor: allocate xmatch for nullpdf inside aa_alloc_null Date: Fri, 1 Nov 2024 09:58:41 +0100 Message-ID: <20241101085842.453201-2-ryan.lee@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101085842.453201-1-ryan.lee@canonical.com> References: <20241101085842.453201-1-ryan.lee@canonical.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 04 Nov 2024 09:13:28 +0000 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2086210 attach->xmatch was not set when allocating a null profile, which is used in complain mode to allocate a learning profile. This was causing downstream failures in find_attach, which expected a valid xmatch but did not find one under a certain sequence of profile transitions in complain mode. This patch ensures the xmatch is set up properly for null profiles. Signed-off-by: Ryan Lee Signed-off-by: John Johansen Signed-off-by: Timo Aaltonen (cherry picked from commit 2de989ae726b14b6236fdb848563d607e12287b8) Signed-off-by: Ryan Lee --- security/apparmor/policy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index f503dcd3ac74..638b0d6753ef 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -659,6 +659,7 @@ struct aa_profile *aa_alloc_null(struct aa_profile *parent, const char *name, /* TODO: ideally we should inherit abi from parent */ profile->label.flags |= FLAG_NULL; + profile->attach.xmatch = aa_get_pdb(nullpdb); rules = list_first_entry(&profile->rules, typeof(*rules), list); rules->file = aa_get_pdb(nullpdb); rules->policy = aa_get_pdb(nullpdb);