From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 0D5543857C71 for ; Thu, 1 Apr 2021 07:40:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0D5543857C71 Received: by mail-pj1-x1036.google.com with SMTP id q6-20020a17090a4306b02900c42a012202so555240pjg.5 for ; Thu, 01 Apr 2021 00:40:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=/a57lXnkEVOSyYZrk1Vx6OvoF8m5oAO+R+39cY+Io3s=; b=FB+9Hs34N1AvxD+KKKDtbws1WZniOXgLwCfZzp2sT/SK/aWMWPjz1C2ZBv7d/H/kGQ zK3ND5tQvcPIVk6i0bPFDqQiI90iqIwV7NFH92qOOYh4Pki3iQZ+wSveHw6ItFBfsB0s jFvUDhuVXnihKr0ql7CWhN6/z0H6v7MVnGbc8h3B5lBVdz11aFyt+OwzmMNsYt2s5u7p GgMLWkOc5YIxSdD+m4VWJ5/4oFkzkN7lkgY64AQboYnq6COR0nGMpEukMeJaK62CDQLW QWcyrFj2vuVkus+XQkNG6wWA8SeQAzcC414ibokIQxdxJJMCR69NGbvJvGCVAnI/Ztmu 13eA== X-Gm-Message-State: AOAM530oTaU3pphNzSV0BVl12iO2f7VJqzWiUxLjhv3a+arPA8ycTcUZ JF9ATIiZUjx2AP1pssDRivsUijG8iBDjPg== X-Google-Smtp-Source: ABdhPJyKqf0Mll84wI475HotqsxIphI0HBObRhAp+ybzak2WfaUxcZ7t/vF1AR78EavHaljTYCqxRQ== X-Received: by 2002:a17:90a:7e4:: with SMTP id m91mr7260392pjm.46.1617262807052; Thu, 01 Apr 2021 00:40:07 -0700 (PDT) Received: from localhost ([1.132.247.100]) by smtp.gmail.com with ESMTPSA id mz11sm4506859pjb.6.2021.04.01.00.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 00:40:06 -0700 (PDT) Date: Thu, 01 Apr 2021 17:40:01 +1000 From: Nicholas Piggin Subject: Re: [PATCH v2] powerpc: Add missing registers to clobbers list for syscalls [BZ #27623] To: libc-alpha@sourceware.org, Matheus Castanho Cc: schwab@linux-m68k.org, tuliom@linux.ibm.com, Segher Boessenkool References: <20210329133557.185178-1-msc@linux.ibm.com> In-Reply-To: <20210329133557.185178-1-msc@linux.ibm.com> MIME-Version: 1.0 Message-Id: <1617262589.sp64uzefnd.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 07:40:09 -0000 Excerpts from Matheus Castanho's message of March 29, 2021 11:35 pm: > Some registers that can be clobbered by the kernel during a syscall are n= ot > listed on the clobbers list in sysdeps/unix/sysv/linux/powerpc/sysdep.h. >=20 > For syscalls using sc: > - XER is zeroed by the kernel on exit >=20 > For syscalls using scv: > - XER is zeroed by the kernel on exit > - Different from the sc case, most CR fields can be clobbered (accord= ing to > the ELF ABI and the Linux kernel's syscall ABI for powerpc > (linux/Documentation/powerpc/syscall64-abi.rst) >=20 > The same should apply to vsyscalls, which effectively execute a function = call > but are not currently adding these registers as clobbers either. >=20 > These are likely not causing issues today, but they should be added to th= e > clobbers list just in case things change on the kernel side in the future= . >=20 > Reported-by: Nicholas Piggin As far as I can tell, this should be matching the kernel now. Thanks, Nick > --- >=20 > Changes from v1: > - Add XER, CR1, CR5-7 to vsyscall clobbers list >=20 > --- > sysdeps/unix/sysv/linux/powerpc/sysdep.h | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv= /linux/powerpc/sysdep.h > index 6b99464e61..2f31f9177b 100644 > --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h > +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h > @@ -56,7 +56,9 @@ > "0:" \ > : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), = \ > "+r" (r7), "+r" (r8) \ > - : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ > + : : "r9", "r10", "r11", "r12", \ > + "cr0", "cr1", "cr5", "cr6", "cr7", \ > + "xer", "lr", "ctr", "memory"); \ > __asm__ __volatile__ ("" : "=3Dr" (rval) : "r" (r3)); \ > (long int) r0 & (1 << 28) ? -rval : rval; \ > }) > @@ -86,7 +88,8 @@ > "=3D&r" (r6), "=3D&r" (r7), "=3D&r" (r8) \ > : ASM_INPUT_##nr \ > : "r9", "r10", "r11", "r12", \ > - "lr", "ctr", "memory"); \ > + "cr0", "cr1", "cr5", "cr6", "cr7", \ > + "xer", "lr", "ctr", "memory"); \ > r3; \ > }) >=20 > @@ -101,7 +104,7 @@ > "=3D&r" (r6), "=3D&r" (r7), "=3D&r" (r8) \ > : ASM_INPUT_##nr \ > : "r9", "r10", "r11", "r12", \ > - "cr0", "ctr", "memory"); \ > + "xer", "cr0", "ctr", "memory"); \ > r0 & (1 << 28) ? -r3 : r3; \ > }) >=20 > -- > 2.30.2 >=20