From patchwork Wed Apr 10 20:55:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1922225 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=V7Elp6Kn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VFFVk0Sjjz1yYB for ; Thu, 11 Apr 2024 06:56:27 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 004EC3849AE0 for ; Wed, 10 Apr 2024 20:56:25 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 45A8A384AB7C for ; Wed, 10 Apr 2024 20:55:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45A8A384AB7C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 45A8A384AB7C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712782564; cv=none; b=kAbQcoRvItaQSE1UdD/Bnh0qO4tUvp3zU3jqtu4iObfP0hXdqG5jBMqg5aDTQvt33dsxxPLrjMauq6oBjs5CzY9u0Bg4S0SNI5FF7s6+rPXeU7u6mqReWlyy5UkFZDkt55xwUgWgzqFO1JrDmymMZddPCFN+bez33GiCcmODdWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712782564; c=relaxed/simple; bh=7UWEDeCYpM9ZloXkkcyP/C1JLpGguSJDi0heZKXZI2c=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=cS4FRwRzAAoW1gKtEsx+fXRdxiU2rOnK5CkANGpHNuRCaoyg9k6ZTy1OX9iDZqeoiPsTcQoVy7FXBqnynw8eedzFhljg791WRlRoG+nI1IIfJC4suxYbCevOP3k1EGscIS+RjwwcFsex9wyGq7JlJEv5O9GHBDnVaC5mIH356N0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712782553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7nmhjijBKB0vBDDVclwqE70a7+tFGG3WkGpfzQEVhBc=; b=V7Elp6KnSLozkkkg3EKBo5WtcgNgTgcVLyPKuJeLoQKgukmjZj0TOwDtS30Vh9A8Fy4igs oZ5v7FfxvVc9aHp0GxJ5CRVbkCbfkwiWeWMiq/tigW+gDN2sYmoALNikcznhw/SOyOmHlb JzO65CLccqFT8GthYlOEkcMGSQCkZuA= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-100-ce2GfZ8cNjmAiirpmhamAg-1; Wed, 10 Apr 2024 16:55:52 -0400 X-MC-Unique: ce2GfZ8cNjmAiirpmhamAg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3DFF429AA3BA for ; Wed, 10 Apr 2024 20:55:52 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.33.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13CB710E4B; Wed, 10 Apr 2024 20:55:52 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [pushed] testsuite: add some missing -fanalyzer to plugin tests Date: Wed, 10 Apr 2024 16:55:50 -0400 Message-Id: <20240410205550.335646-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Successful run of analyzer integration tests on x86_64-pc-linux-gnu. Pushed to trunk as r14-9895-gd09d70cdb2a4bc. gcc/testsuite/ChangeLog: * gcc.dg/plugin/copy_from_user-1.c: Add missing directives for an analyzer test. * gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c: Add missing -fanalyzer to options. * gcc.dg/plugin/taint-CVE-2011-0521-1.c: Likewise. * gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c: Likewise. (dvb_usercopy): Add default case to avoid complaints about NULL derefs. * gcc.dg/plugin/taint-CVE-2011-0521-2.c: Likewise. * gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c: Add missing -fanalyzer to options. * gcc.dg/plugin/taint-CVE-2011-0521-3.c: Likewise. Drop xfail. Signed-off-by: David Malcolm --- gcc/testsuite/gcc.dg/plugin/copy_from_user-1.c | 4 ++++ gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c | 2 +- gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c | 2 +- gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c | 4 +++- gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c | 4 +++- gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c | 2 +- gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c | 5 ++--- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/gcc.dg/plugin/copy_from_user-1.c b/gcc/testsuite/gcc.dg/plugin/copy_from_user-1.c index a1415f38aa65..1acedc2e2ce8 100644 --- a/gcc/testsuite/gcc.dg/plugin/copy_from_user-1.c +++ b/gcc/testsuite/gcc.dg/plugin/copy_from_user-1.c @@ -1,3 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-fanalyzer" } */ +/* { dg-require-effective-target analyzer } */ + typedef __SIZE_TYPE__ size_t; #define __user diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c index 51526b831c02..9ad05ff670a2 100644 --- a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c +++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target analyzer } */ -/* { dg-additional-options "-Wno-pedantic" } */ +/* { dg-additional-options "-fanalyzer -Wno-pedantic" } */ /* See notes in this header. */ #include "taint-CVE-2011-0521.h" diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c index 3d11a75073c1..688d014956ec 100644 --- a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c +++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-additional-options "-Wno-pedantic" } */ +/* { dg-additional-options "-fanalyzer -Wno-pedantic" } */ /* { dg-require-effective-target analyzer } */ /* See notes in this header. */ diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c index d035266b16ad..7e597037ec24 100644 --- a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c +++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-additional-options "-Wno-pedantic" } */ +/* { dg-additional-options "-fanalyzer -Wno-pedantic" } */ /* { dg-require-effective-target analyzer } */ /* See notes in this header. */ @@ -67,6 +67,8 @@ int dvb_usercopy(struct file *file, if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd))) goto out; break; + default: + goto out; } /* call driver */ diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c index 5270e22f1a32..9189cdb2c37c 100644 --- a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c +++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target analyzer } */ -/* { dg-additional-options "-Wno-pedantic" } */ +/* { dg-additional-options "-fanalyzer -Wno-pedantic" } */ /* See notes in this header. */ #include "taint-CVE-2011-0521.h" @@ -67,6 +67,8 @@ int dvb_usercopy(struct file *file, if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd))) goto out; break; + default: + goto out; } /* call driver */ diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c index b8268fa4a826..d10ce28b40e2 100644 --- a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c +++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target analyzer } */ -/* { dg-additional-options "-Wno-pedantic" } */ +/* { dg-additional-options "-fanalyzer -Wno-pedantic" } */ /* See notes in this header. */ #include "taint-CVE-2011-0521.h" diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c index 86868a017c4c..5185ffd223d0 100644 --- a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c +++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target analyzer } */ -/* { dg-additional-options "-Wno-pedantic" } */ +/* { dg-additional-options "-fanalyzer -Wno-pedantic" } */ /* See notes in this header. */ #include "taint-CVE-2011-0521.h" @@ -19,8 +19,7 @@ int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg) if (info->num > 1) return -EINVAL; - av7110->ci_slot[info->num].num = info->num; /* { dg-warning "attacker-controlled value" "" { xfail *-*-* } } */ - /* TODO(xfail). */ + av7110->ci_slot[info->num].num = info->num; /* { dg-warning "attacker-controlled value" } */ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ? CA_CI_LINK : CA_CI; memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));