Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3421403ybz; Mon, 27 Apr 2020 15:45:38 -0700 (PDT) X-Google-Smtp-Source: APiQypIFuO6pgFvrKbbnLw3XtXO9qSN30J6BUgpX4c8iwhmMc/yOcOHcaQGEbFkfhJAFSWZ3OqZk X-Received: by 2002:a50:9e2a:: with SMTP id z39mr192611ede.371.1588027538119; Mon, 27 Apr 2020 15:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588027538; cv=none; d=google.com; s=arc-20160816; b=kv78UpNAOJh1p1IDu/q+x6pbllMNGZXMhtlUcLoqsxOTiwwFKrWe4M/pox5aDIl+j1 EBVCx72tXsKl1/oq80DeojlDzdRSmZAyb6OEfDjOo/ctJbCajspcNcGq5WNzN4YUBX11 K3AlS++75sAl9F+jsQZ3zijyk1wx/i+2vZ3WIov9dttNddmly/9LTLa+yevQi7FHAjoL pSpTPq788BaJCuH+GfWtVH5hTr+UQqgDxKbvq4SjjJe/H5K4lIQSnErWAIMcX4CnpIK7 De8B4uMQsXUP+4BlLWBPE+u69Qnrd2zQN5RcxH1JueqcOX7IKzVj83Nv5hoFYSSyc92M GThw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=V8bdy/8J7spZA1EkUumYPrwY+kCGp5At/TMBq+j+0UA=; b=1BjxRQ4/MzCQaZS5gpn04PVeXcHS3TE1ObCbGrgMtKW6jHj+yOVpIu3Fc7azYpLMuJ qVttTER9eAx6RWDshzXJEP9XFUYxXCUlAVRnCVt/OjEnSPtaGbE0XXh7eiyALUlmvmBl OHaA6WZ1vlHZG0q5FKFoZ3ui+rF5zCy+n7HrM3GLDrM4Q7CXUetxhjLHrnPcJy7Mq8fV 1GXZ+ofE/EMRflcHOed4B/JRHC3P6nSga5BG4s4c83Bj7E8u5T2OHwmie9cQ62PwVr2p caTw9UMSo7W/FBe7xX4EIwt3lMcfzY23deqqVu8ApuMUZ3YYC43uye9wqidvsbEitK+M ioaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M1Bzf7im; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lc1si628187ejb.198.2020.04.27.15.45.13; Mon, 27 Apr 2020 15:45:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M1Bzf7im; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726282AbgD0Wkw (ORCPT + 99 others); Mon, 27 Apr 2020 18:40:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:34772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726262AbgD0Wkw (ORCPT ); Mon, 27 Apr 2020 18:40:52 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D8742075E; Mon, 27 Apr 2020 22:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588027251; bh=CC6rMEFyGSKGcmYNdgrkgIArdM9m2XSVKnBpMMN2Afc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=M1Bzf7imQ9+pFeCE+KA+cbdSB5d1Q5QGQB9MnKaltdtd5VWtUvFW7fQAnmE0URwl5 3BA6ohXMoMglNl9UZcTo0fBye8BSMjujqHnJjVYOuU0KjCzBVzKwaD+JYsXxpLWgrr AEvVdCbCW82EWkeE0LLaMEaXsLBh2Bd66+0Ooopg= Date: Mon, 27 Apr 2020 15:40:50 -0700 From: Andrew Morton To: Christoph Hellwig Cc: Alexander Viro , Jeremy Kerr , Arnd Bergmann , "Eric W . Biederman" , linuxppc-dev@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds Subject: Re: [PATCH 2/7] signal: factor copy_siginfo_to_external32 from copy_siginfo_to_user32 Message-Id: <20200427154050.e431ad7fb228610cc6b95973@linux-foundation.org> In-Reply-To: <20200426074039.GA31501@lst.de> References: <20200421154204.252921-1-hch@lst.de> <20200421154204.252921-3-hch@lst.de> <20200425214724.a9a00c76edceff7296df7874@linux-foundation.org> <20200426074039.GA31501@lst.de> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 26 Apr 2020 09:40:39 +0200 Christoph Hellwig wrote: > On Sat, Apr 25, 2020 at 09:47:24PM -0700, Andrew Morton wrote: > > I looked at fixing it but surely this sort of thing: > > > > > > int copy_siginfo_to_user32(struct compat_siginfo __user *to, > > const struct kernel_siginfo *from) > > #if defined(CONFIG_X86_X32_ABI) || defined(CONFIG_IA32_EMULATION) > > { > > return __copy_siginfo_to_user32(to, from, in_x32_syscall()); > > } > > int __copy_siginfo_to_user32(struct compat_siginfo __user *to, > > const struct kernel_siginfo *from, bool x32_ABI) > > #endif > > { > > ... > > > > > > is too ugly to live? > > I fixed it up in my earlier versions, but Eric insisted to keep it, > which is why I switched to his version given that he is the defacto > signal.c maintainer. > > Here is what I would have preferred: > > https://www.spinics.net/lists/kernel/msg3473847.html > https://www.spinics.net/lists/kernel/msg3473840.html > https://www.spinics.net/lists/kernel/msg3473843.html OK, but that doesn't necessitate the above monstrosity? How about static int __copy_siginfo_to_user32(struct compat_siginfo __user *to, const struct kernel_siginfo *from, bool x32_ABI) { struct compat_siginfo new; copy_siginfo_to_external32(&new, from); ... } int copy_siginfo_to_user32(struct compat_siginfo __user *to, const struct kernel_siginfo *from) { #if defined(CONFIG_X86_X32_ABI) || defined(CONFIG_IA32_EMULATION) return __copy_siginfo_to_user32(to, from, in_x32_syscall()); #else return __copy_siginfo_to_user32(to, from, 0); #endif } Or something like that - I didn't try very hard. We know how to do this stuff, and surely this thing isn't how!