From nobody Fri Jan 12 21:19:11 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TBZD175MDz56Ncp; Fri, 12 Jan 2024 21:19:13 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oo1-xc35.google.com (mail-oo1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TBZD10zPsz4XPP; Fri, 12 Jan 2024 21:19:13 +0000 (UTC) (envelope-from mjguzik@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-oo1-xc35.google.com with SMTP id 006d021491bc7-5989e464910so1712286eaf.0; Fri, 12 Jan 2024 13:19:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705094351; x=1705699151; darn=freebsd.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VV6ZZW7lmIrkjMUcIRDSnrkffEAZJ6sU622Wr2Qxpk0=; b=Tlxm9B2qgPyYd/V2qpjJOQhQTxRT9aYS8b+BZi0VXVnKhhtgfsjF25FGqvNfbY+TMW hgItPjEmnWRRdio0pI41bOX9NroQh5v9zK88EvZdW8VJpEr4wWI0CamnacYH23ORL4uX Nrwe32am7O5Xa9ivM/Qhd3MfMELR7E/l4o95XP0fsr/kGr6kp50K/wegoJ8ixOlt3Ds0 FdS5JyL2YI6Hx04zMQVi4F/G27T7H0SXu5XUfPqDKzfwi3MIBgqHEfwCoKT/NVes5cdx u/jCiqzyZkIxzl8l6/xRJSVp5b6C5oWy4EnTQ0BW80KbUDRg6SMZm8TEuUCNlitbWGhL CV/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705094351; x=1705699151; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VV6ZZW7lmIrkjMUcIRDSnrkffEAZJ6sU622Wr2Qxpk0=; b=szAoNnmv3Sf3NOS8ZwZ3iYWHHTZ8S4ord8tBbt6XEBbNP1Mokt+AnQuO0wcIucJ0Zf 2OVfU29cdalikbp24RGWcSqtKmuILU8ll/3TJKBYaua+KcMjCmCYkX1jPwl5WIBO7OBe IC0GpNWesjGdzc6mUZQYcFmPDXBj2sLcb7/EMmcoW6LvqAoqM24C0TTVdJdi9bZk+jOC vOr7RIBjlzME15P5N1KZD4F3ENcsNTGrS2Op5Kf2l2Wgop6ZkKb0spYflQB6GtyELmPO +ebWrrRDgF99PxL88Q3wyhzX6pt4yRCEMNJXRmpd8hkb+mAFa2bcJ2pMk6k6yd+ktBRi 5H/Q== X-Gm-Message-State: AOJu0Yw96Xcib8MjAYWAuNM+yG0AX4oLJjakuNmVxuCld6jigqPBEN0G XEyLGzExUDWKclJrmz4uV1R5ufhR2gA7jlucqGEMZnrx X-Google-Smtp-Source: AGHT+IHIMJY8+6vgOdRqqUtEjefySae6IXRjN9PjY5wBrZpZTMU65TKcHhIPTK6nn8aqd1svgDXAQrXcWkd2zNj2Mac= X-Received: by 2002:a4a:241e:0:b0:598:b695:688a with SMTP id m30-20020a4a241e000000b00598b695688amr1161768oof.8.1705094351589; Fri, 12 Jan 2024 13:19:11 -0800 (PST) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Received: by 2002:a8a:dd3:0:b0:512:723e:b179 with HTTP; Fri, 12 Jan 2024 13:19:11 -0800 (PST) In-Reply-To: <202401122112.40CLC7nM039270@gitrepo.freebsd.org> References: <202401122112.40CLC7nM039270@gitrepo.freebsd.org> From: Mateusz Guzik Date: Fri, 12 Jan 2024 22:19:11 +0100 Message-ID: Subject: Re: git: d07acc58d898 - main - systm: Relax __result_use_check annotations To: Mark Johnston Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4TBZD10zPsz4XPP X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] just make it conditional on being compiled with clang On 1/12/24, Mark Johnston wrote: > The branch main has been updated by markj: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=d07acc58d8987e8e1205f4a82b77e847ea2d60d3 > > commit d07acc58d8987e8e1205f4a82b77e847ea2d60d3 > Author: Mark Johnston > AuthorDate: 2024-01-12 15:07:28 +0000 > Commit: Mark Johnston > CommitDate: 2024-01-12 20:56:00 +0000 > > systm: Relax __result_use_check annotations > > When compiling with gcc, functions annotated this way can not have > their > return values cast away, e.g., with `(void)copyout(...)`. clang > permits > it but gcc does not. Since we have a number of such casts for calls > which copy data out of the kernel, and since failing to check for > errors > when copying *in* is a much more severe bug, remove some of the > annotations in order to make the gcc build happy. > > Reviewed by: kib > Reported by: Jenkins > Fixes: 8e36732e6eb5 ("systm: Annotate copyin() and related functions > with __result_use_check") > Differential Revision: https://reviews.freebsd.org/D43418 > --- > sys/sys/systm.h | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/sys/sys/systm.h b/sys/sys/systm.h > index 2da177af91f0..508690cd639e 100644 > --- a/sys/sys/systm.h > +++ b/sys/sys/systm.h > @@ -289,9 +289,9 @@ int __result_use_check copyin(const void * __restrict > udaddr, > void * _Nonnull __restrict kaddr, size_t len); > int __result_use_check copyin_nofault(const void * __restrict udaddr, > void * _Nonnull __restrict kaddr, size_t len); > -int __result_use_check copyout(const void * _Nonnull __restrict kaddr, > +int copyout(const void * _Nonnull __restrict kaddr, > void * __restrict udaddr, size_t len); > -int __result_use_check copyout_nofault(const void * _Nonnull __restrict > kaddr, > +int copyout_nofault(const void * _Nonnull __restrict kaddr, > void * __restrict udaddr, size_t len); > > #ifdef SAN_NEEDS_INTERCEPTORS > @@ -313,11 +313,11 @@ int64_t fuword64(volatile const void *base); > int __result_use_check fueword(volatile const void *base, long *val); > int __result_use_check fueword32(volatile const void *base, int32_t *val); > int __result_use_check fueword64(volatile const void *base, int64_t *val); > -int __result_use_check subyte(volatile void *base, int byte); > -int __result_use_check suword(volatile void *base, long word); > -int __result_use_check suword16(volatile void *base, int word); > -int __result_use_check suword32(volatile void *base, int32_t word); > -int __result_use_check suword64(volatile void *base, int64_t word); > +int subyte(volatile void *base, int byte); > +int suword(volatile void *base, long word); > +int suword16(volatile void *base, int word); > +int suword32(volatile void *base, int32_t word); > +int suword64(volatile void *base, int64_t word); > uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t > newval); > u_long casuword(volatile u_long *p, u_long oldval, u_long newval); > int casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t > *oldvalp, > -- Mateusz Guzik