From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32E3BEB64DD for ; Wed, 5 Jul 2023 18:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233330AbjGESCl (ORCPT ); Wed, 5 Jul 2023 14:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233283AbjGESCh (ORCPT ); Wed, 5 Jul 2023 14:02:37 -0400 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A467819A2; Wed, 5 Jul 2023 11:02:32 -0700 (PDT) Received: from [192.168.192.83] (unknown [50.47.134.245]) (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-canonical-0.canonical.com (Postfix) with ESMTPSA id C2F0E414C5; Wed, 5 Jul 2023 18:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1688580150; bh=Ml6u5VGqvgonexNAqzQPeVeGEc4fEqTY9Ir/lPqp668=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AzfHjPOox/m5CoOulzZnHpGWwEKBBxqulnzx2rQ2j1AYoBK1KhcgztMTACpRInTn0 xx7EU/9BRkeGy2QGWjuDDUrjCVThjXLQrjq8UVAKOppxbD9uy9gSk2V35n3vz35Ema LEFJHwuJowPA6ZayZDET+gFpG9BZtQ8G2QpqfleIgEFwTRuntLyS7m9P6OBOaTAf1C ZRfyMWZami/mCsutIfPqphb8dagEYXv7GSx0/a5CczOUuhakm4B161EEbF4PPU6V+j huJeHxppPElk79gu8QRdQKHC/eNEClVXqAuIhhVnCvP+AI/NlalhwgQxj4ViLlYZ0x sp0FDsk8t2xTQ== Message-ID: <30faaa83-bdb3-69b8-1fa9-7c1f4f011045@canonical.com> Date: Wed, 5 Jul 2023 11:02:26 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v1] security: remove duplicate logical judgments in return To: Minjie Du , Paul Moore , James Morris , "Serge E. Hallyn" , Nick Terrell , "moderated list:APPARMOR SECURITY MODULE" , "open list:SECURITY SUBSYSTEM" , open list Cc: opensource.kernel@vivo.com References: <20230704085653.6443-1-duminjie@vivo.com> Content-Language: en-US From: John Johansen Organization: Canonical In-Reply-To: <20230704085653.6443-1-duminjie@vivo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/4/23 01:56, Minjie Du wrote: > Fix: delate duplicate logical judgments: > aa_unpack_u32(e, &perm->allow, NULL); > Please check this. Thank you! > > Signed-off-by: Minjie Du NAK, it is a bug but not in a way that we can do this, which will break the unpack. The first entry is reserved, and for the moment should be skipped. Double loading to &perm->allow, effectively does that but was not what was intended either. There is a patch coming that loads the first entry to a tmp variable and does a check that it is 0. > --- > security/apparmor/policy_unpack.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c > index 694fb7a09..2069adf0a 100644 > --- a/security/apparmor/policy_unpack.c > +++ b/security/apparmor/policy_unpack.c > @@ -646,7 +646,6 @@ static bool unpack_perm(struct aa_ext *e, u32 version, struct aa_perms *perm) > return false; > > return aa_unpack_u32(e, &perm->allow, NULL) && > - aa_unpack_u32(e, &perm->allow, NULL) && > aa_unpack_u32(e, &perm->deny, NULL) && > aa_unpack_u32(e, &perm->subtree, NULL) && > aa_unpack_u32(e, &perm->cond, NULL) &&