From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 6A8743857811 for ; Fri, 14 Oct 2022 08:14:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A8743857811 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665735280; 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: in-reply-to:in-reply-to:references:references; bh=r7fZNMVjQyFV8mMs8nGmRVTFkT98xWyeUSksPVXemhU=; b=MBRC/mu5lCrQ16N46+1Xim0dq/4CEJqgw0Faa3tfn/DPZLeP3tbmhsbXnJxOCaoBYREbYJ gAhA/5lB+h8YSm0jZ7A60+IDAk+6PlahNEIwIGo4PuVupODlMQfeReiHAIhbVuavnwilU5 dJSzI6BfZVtNWxbYKwcBjZZeKEWfeBs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-227-fwAXwXcBOJmkDaH6-AlsoA-1; Fri, 14 Oct 2022 04:14:38 -0400 X-MC-Unique: fwAXwXcBOJmkDaH6-AlsoA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 747B018F0241 for ; Fri, 14 Oct 2022 08:14:38 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B799B40398B9; Fri, 14 Oct 2022 08:14:37 +0000 (UTC) From: Florian Weimer To: DJ Delorie Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 2/3] Introduce , extracted from References: Date: Fri, 14 Oct 2022 10:14:35 +0200 In-Reply-To: (DJ Delorie's message of "Thu, 13 Oct 2022 23:30:14 -0400") Message-ID: <87fsfqq0t0.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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 List-Id: * DJ Delorie: > Florian Weimer via Libc-alpha writes: >> +++ b/sysdeps/generic/pointer_guard.h >> +#ifndef __ASSEMBLER__ >> +# define PTR_MANGLE(x) (void) (x) >> +# define PTR_DEMANGLE(x) (void) (x) >> +#endif > > These macros will always be called standalone, i.e. > > inline uintptr_t demangle_ptr (uintptr_t x) > { > PTR_DEMANGLE (x); > return x; > } > > If that's the expectation, is there a reason why we need to even > reference X at all? Would an empty declaration be valid? This should > only affect volatile variables, but those would be referenced shortly > after anyway. Atomic boundaries aren't an issue as atomics are not used > in the mangling compuation. > > I can see having a non-empty body as a valid way to validate the usage, > but in that case something that actually validates it makes more sense > by only accepting a LHS: > >> +# define PTR_MANGLE(x) (void) (&(x)) > > (the non-generic usages should enforce this through their assignments) > > Also, is there any case where code could be corrupted by the lack of > overall parens? I.e. is this better: > >> +# define PTR_MANGLE(x) ((void) (x)) I copied this from the existing macros, e.g. #define PTR_MANGLE(var) (void) (var) in sysdeps/unix/sysv/linux/mips/mips64/sysdep.h. I would rather not tweak this and focus on replacing it with a generic version (that won't protect setjmp/longjmp, but global variables). Thanks, Florian