From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C36703858C50; Wed, 8 Feb 2023 15:25:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C36703858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675869943; bh=dJR2KANiUqCtoJmLhn3EPjEtOkukrCbla9qcJoeDgfM=; h=From:To:Subject:Date:From; b=uGX+AYZx5+In/ITgkRxXnu+PQFHIi+v1DG1xDMG8olBo2+Kr2ofsS5/zGXVHBc7e8 dxNtC6Sr3fqy8y/ON5XIvZX21fzCRcOEiQP6/1RyZ6NH+jqvKtfg/eiE371CRCTtaa EPwQx44/LI7iiQ8aMfgqF6INcpBjSjebyPtqAySg= From: "clopez at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/108719] New: RFE: allow specifying argument indexes for __attribute__((tainted_args)) Date: Wed, 08 Feb 2023 15:25:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: clopez at suse dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108719 Bug ID: 108719 Summary: RFE: allow specifying argument indexes for __attribute__((tainted_args)) Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: clopez at suse dot de Target Milestone: --- Consider allowing developers to specify which function arguments are tainte= d, very much like the nonnull attribute, e.g.: __attribute__((tainted_args (2, 3))) When no indexes are specified, all arguments should be considered tainted - this is the behavior currently implemented. Specifically, there is a common pattern for callbacks where the first argum= ent corresponds to untainted data (often either a structure provided by caller = of the callback or some opaque pointer requested by the callee). A prime examp= le of this are Linux device drivers, where the first parameter is a kernel-provided structure: struct file_operations { ... ssize_t (*read) (struct file *, char *, size_t, loff_t *); ssize_t (*write) (struct file *, const char *, size_t, loff_t *); ... } Another example would be qemu MMIO callbacks: struct MemoryRegionOps { uint64_t (*read)(void *opaque, hwaddr addr, unsigned size); void (*write)(void *opaque, hwaddr addr, uint64_t data, unsigned si= ze); ... }=