From patchwork Thu Jul 6 13:23:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 116708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2559267vqx; Thu, 6 Jul 2023 06:25:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlFshFzPb1UYiyAIDduNiIEJfY29yGHAHggdLZbgAscRovTFoQ5S/1riWA38TThaO228zKP5 X-Received: by 2002:a92:d40d:0:b0:33b:568a:2981 with SMTP id q13-20020a92d40d000000b0033b568a2981mr2053852ilm.8.1688649946490; Thu, 06 Jul 2023 06:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688649946; cv=none; d=google.com; s=arc-20160816; b=DHwTThg/FhqGKAdLlPG+7q1UK9Z6Gq9iyjjeKwk8Eea9A4L/PJLtAVUrUYvM4YBLL7 bRL40bBKcMhySUrN5OmUFtjj3gqgGAADw6k8TATuUc38ptxkrz4H9y0ODrYMlYPm7t64 jJg8JREzgGjp8pZ2r6L6dfxIJxdszudc9Lu8xaRp6hG30H+d45Y89rEMp5606WGGUP/1 CWYAb3tT3PH2Ft0sMsLB9b5A7cVmLdHpZfYVxXSMVxeUqD6ogGXa1LG/Lwwmyppu6QXl HFFMfshJWh76ExbIU6YldLBcfH/9ykv75ITSFrarDikbBSIJ584ck93GLAvp6KJzIM5M 6r9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Mc4qD9lCimMDS7+Q62W0sR+F1WbT4ndKWO0bdPK98Q4=; fh=fBY5D/IDrKFsN9mMQMRE3IlhWmhEeMbp24YlZR3fWbQ=; b=pMijw5ZrrLBSgzbFOdkvx/YkuI53Vq2LMqm1rxPp+AkLyI7jF3iQW2TPlJUtN9U+/h teETa1AKeSUBclEBIYiXZdYLvlg7xmmI5V6MzgxsfdXYYsNLoFPN6ZyHeaUbuVRiek9q fI/rtInoc7+XHXakb1KPM2KTjJkmMOhpn/fu7OEgOrDRMP1OOBLgrrz4odMvSQkNQtrM xdcYbTP5D0ZFnI9JMEsc9/zGl9PbSJt2lqonqFRjjL56OUZh0Q9EwptSuxDMlefqGbSN 5joM8+f8Mv+8uQsvoHx4cyTqtz5AJu6BFyNWa6jGedKRz6HEtd2wa9449ft7nU6C0WNZ 77yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b=KRgDtHb9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8-20020a632048000000b0055391572218si1484872pgm.26.2023.07.06.06.25.32; Thu, 06 Jul 2023 06:25:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b=KRgDtHb9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232641AbjGFNYc (ORCPT + 99 others); Thu, 6 Jul 2023 09:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232081AbjGFNYF (ORCPT ); Thu, 6 Jul 2023 09:24:05 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EEE01FC7; Thu, 6 Jul 2023 06:23:59 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-51dff848168so1037594a12.2; Thu, 06 Jul 2023 06:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1688649838; x=1691241838; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Mc4qD9lCimMDS7+Q62W0sR+F1WbT4ndKWO0bdPK98Q4=; b=KRgDtHb9NQWXvl9rwUjjK2ezvvvwgu54gELKHJeo/7F0Hm49R/sMwBHJ3uCk7eZ5Gp fRPuKzhfqvXzKlKnsnYj4b5w581neInaOjHVrH9+GYBonlJ7R0bFLnu6XBIJgYRR7yoC 9o+Shh2XAhSuMXED5erB4cjgQDJ7V/d3EKOxQjDbRmMayZyJM58LHVRqllTL2IH5lBv9 87+M9I4o7J8dhmNTTjag4+d8J7Rpg4RxbrUO8IsQ9m6QsYY5VPI8p8X7Waor5+HNCzfW y3q7qq4EdWlkYC4KpdhTB+G57J1d9XyRFBCB1ZSlBGyXZXTRzyJ9oaPY7x+Y+mtvCLh2 KZUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688649838; x=1691241838; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Mc4qD9lCimMDS7+Q62W0sR+F1WbT4ndKWO0bdPK98Q4=; b=he8FvstQ9tiT4x/ba4dnKrYfYGANK2NzadOFaFfe/aDw1WlKJtheecSN+OGCZQ7U1c IWXINlqe6Y8xcR5s4belJZFsU1FpIHvSGovtxVQaJhAtnET72KE3HuewbkioorcLYU3P N3pTICn4VfJ+/wRxS2Enx2kwsZlfoEQX2+t0AzcvoQ5dcBYpK3KqnB1xx9NjNcueEhkB eNOZvQ0qDfsZWvgGVQPJc6o4EEJU73Uk4Fh3vZg3Up/Sc31KuBUCZEy1xx0cxMgELC1s 6sPaqOZy9WORJmbcznVJtP6R1mypz/9megq8vs5Def1VHkdtnXu2wPpuRUFCahLzAX1y AxCg== X-Gm-Message-State: ABy/qLZjnNQ/siMoK0SSHf/A8gJzPinnnTuAaRbk2M5jNsx3w8gPdHPE a7+Na9GxyC3O8+6uh0WmNuvOmuYRx3cl2U/M X-Received: by 2002:a17:907:3d5:b0:992:764b:90d3 with SMTP id su21-20020a17090703d500b00992764b90d3mr1261371ejb.70.1688649837787; Thu, 06 Jul 2023 06:23:57 -0700 (PDT) Received: from debian_development.DebianHome (dynamic-077-008-088-179.77.8.pool.telefonica.de. [77.8.88.179]) by smtp.gmail.com with ESMTPSA id r2-20020a170906364200b00988dbbd1f7esm808024ejb.213.2023.07.06.06.23.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 06:23:57 -0700 (PDT) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Cc: Paul Moore , Stephen Smalley , Eric Paris , Ondrej Mosnacek , "GONG, Ruiqi" , linux-kernel@vger.kernel.org Subject: [RFC PATCH 14/20] selinux: use consistent type for AV rule specifier Date: Thu, 6 Jul 2023 15:23:29 +0200 Message-Id: <20230706132337.15924-14-cgzones@googlemail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230706132337.15924-1-cgzones@googlemail.com> References: <20230706132337.15924-1-cgzones@googlemail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770677806317705068?= X-GMAIL-MSGID: =?utf-8?q?1770677806317705068?= The specifier for avtab keys is always supplied with a type of u16, either as a macro to security_compute_sid() or the member specified of the struct avtab_key. Signed-off-by: Christian Göttsche --- security/selinux/ss/avtab.c | 2 +- security/selinux/ss/avtab.h | 2 +- security/selinux/ss/services.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c index 9c150fba3fa6..15a5d60fb1a5 100644 --- a/security/selinux/ss/avtab.c +++ b/security/selinux/ss/avtab.c @@ -248,7 +248,7 @@ struct avtab_node *avtab_search_node(struct avtab *h, } struct avtab_node* -avtab_search_node_next(struct avtab_node *node, int specified) +avtab_search_node_next(struct avtab_node *node, u16 specified) { struct avtab_node *cur; diff --git a/security/selinux/ss/avtab.h b/security/selinux/ss/avtab.h index d6742fd9c560..f265e9da18e2 100644 --- a/security/selinux/ss/avtab.h +++ b/security/selinux/ss/avtab.h @@ -111,7 +111,7 @@ struct avtab_node *avtab_insert_nonunique(struct avtab *h, struct avtab_node *avtab_search_node(struct avtab *h, const struct avtab_key *key); -struct avtab_node *avtab_search_node_next(struct avtab_node *node, int specified); +struct avtab_node *avtab_search_node_next(struct avtab_node *node, u16 specified); #define MAX_AVTAB_HASH_BITS 16 #define MAX_AVTAB_HASH_BUCKETS (1 << MAX_AVTAB_HASH_BITS) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 2e2b17b00298..823b000381a4 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -1694,7 +1694,7 @@ static void filename_compute_type(struct policydb *policydb, static int security_compute_sid(u32 ssid, u32 tsid, u16 orig_tclass, - u32 specified, + u16 specified, const char *objname, u32 *out_sid, bool kern)