From owner-freebsd-hackers@freebsd.org Fri Apr 26 08:33:04 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9607D158D0AC for ; Fri, 26 Apr 2019 08:33:04 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 411F789258; Fri, 26 Apr 2019 08:33:02 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 1AC73202562B; Fri, 26 Apr 2019 08:32:56 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id x3Q8Wtvq023440 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 26 Apr 2019 08:32:55 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id x3Q8WtnR023439; Fri, 26 Apr 2019 08:32:55 GMT (envelope-from phk) To: Alan Somers cc: FreeBSD Hackers Subject: Re: buf(9) woes: when does bcopy do nothing at all? In-reply-to: From: "Poul-Henning Kamp" References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23437.1556267575.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Fri, 26 Apr 2019 08:32:55 +0000 Message-ID: <23438.1556267575@critter.freebsd.dk> X-Rspamd-Queue-Id: 411F789258 X-Spamd-Bar: ++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [4.64 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.88)[0.879,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.dk]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.39)[0.387,0]; RCVD_COUNT_THREE(0.00)[4]; IP_SCORE(0.08)[ip: (0.15), ipnet: 130.225.0.0/16(0.07), asn: 1835(0.20), country: EU(-0.01)]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[phk.freebsd.dk]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_SPAM_LONG(1.00)[0.998,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; RCVD_NO_TLS_LAST(0.10)[]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU]; SUBJECT_ENDS_QUESTION(1.00)[]; FROM_NEQ_ENVFROM(0.00)[phk@phk.freebsd.dk,phk@critter.freebsd.dk] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Apr 2019 08:33:04 -0000 -------- In message , Alan Somers writes: >How is it possible that bcopy() doesn't affect its output array at all? That conclusion does not follow from your example: >bcopy(cp, iov->iov_base, cnt); >r =3D memcmp(cp, iov->iov_base, cnt); >if (r) > printf("uiomove: miscompare\n"); If [cp:cp+cnt] and [iov_base:iov_base+cnt] overlap the bcopy result is undefined. Try memmove instead ? -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= .