Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3537897pxu; Sun, 20 Dec 2020 06:24:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6Z0VzUKpGzmGVEapB0C9Y8tc4TXMRwPCOhpBqpBbHe2LZebfdInKoOGEx1rV/d7kdfUAH X-Received: by 2002:a17:906:d101:: with SMTP id b1mr12086886ejz.80.1608474293669; Sun, 20 Dec 2020 06:24:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608474293; cv=none; d=google.com; s=arc-20160816; b=t0/fT9VkXX+0hWHh0OvRro05sGyEZmyMPdcLA54gzSYmfe9xtqi2Q66aa9Ul6pRQ/j mGe5B6Reqlqo56j1NGEVbmRDgSL6zPrbSvTpq1raICQOkH7zGsArx1J7GxSAifP0xlTX BRzrENRe5MXc4rnGQjD0Ae9wGB96yjckKGHQQC7syFzzMoxb7Bu/fEeeU1O2CFkX5VC8 Vre1nhGzcyeuiFYpjoW/TjU/vth5gxDMrid2ixDjd5FUcnErMQZ/J238Z0gF9hgeT5l3 n92YrkoH4GbI9MoTkjNEFF4GXXK+/hM2SD8hFnhvl8zEDyIAoO6HV7PkVIa7M5nbO2FE tEqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=MDbwUf+8XstD8OivjaozAkwTO9Z6ZWRHeP6xHB5dtGU=; b=Sx9LdaKSZSzh62CdKpTzdWeHuH8df/i2ljd7jDj/C28qQb9cJ2ckz/D1vZwWoYIIog fXiaQxi/XGLi7eyiMFcqMF6KkzNqfCzB2rSZj9ktfVXQWbBZUfZbTaLWtl4aY4QIIq7Z +O9Iwg9R9P8Xc3OVJAuSdeAHUfnEB0qf6NAnIWmPojm4v4123kJMix+J+Z23usewKdMe 9uLMKhfA3EU4qPQ+Fkdjav6c9tkAWoWYBCfZUelmyvuzgpyXY7YCcMJJ2uOw15BUQPpn RkWigBfemSGWIbOQLjpOg7ayDkFxx7frXOgPAebnpR2u0hDz2y+XgFy+pGIdl+hek58e GitQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VrdcPmP1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si6506888edq.175.2020.12.20.06.24.30; Sun, 20 Dec 2020 06:24:53 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=VrdcPmP1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727519AbgLTOXL (ORCPT + 99 others); Sun, 20 Dec 2020 09:23:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21610 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727489AbgLTOXL (ORCPT ); Sun, 20 Dec 2020 09:23:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608474103; 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=MDbwUf+8XstD8OivjaozAkwTO9Z6ZWRHeP6xHB5dtGU=; b=VrdcPmP1TtNr7vWPJmSNnj9M2deMy1VLXmRdyzyCATJpF+9ZO1n0w9v5eXcCe1VUmglg8Y VIst4UCorv7XC9RDlL+dVdK8dXiLPtx6NZscHlOkJP/uAtJUOBvtfeODILav+e64MNhdnE ayGqUhJXHsaSh1PJRLMhM2ise1kfDt4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-QteUgzOOPxa2LRiPmB4QGg-1; Sun, 20 Dec 2020 09:21:41 -0500 X-MC-Unique: QteUgzOOPxa2LRiPmB4QGg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89FA815720; Sun, 20 Dec 2020 14:21:39 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.9]) by smtp.corp.redhat.com (Postfix) with SMTP id 9958619715; Sun, 20 Dec 2020 14:21:36 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 20 Dec 2020 15:21:39 +0100 (CET) Date: Sun, 20 Dec 2020 15:21:35 +0100 From: Oleg Nesterov To: Leesoo Ahn Cc: linux-kernel@vger.kernel.org, Leesoo Ahn , Christian Brauner , "Eric W. Biederman" , Jens Axboe , Peter Collingbourne , Zhiqiang Liu Subject: Re: [PATCH] signal: Don't init struct kernel_siginfo fields to zero again Message-ID: <20201220142134.GB16470@redhat.com> References: <20201220074555.12655-1-lsahn@ooseel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201220074555.12655-1-lsahn@ooseel.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/20, Leesoo Ahn wrote: > > clear_siginfo() is responsible for clearing struct kernel_siginfo object. > It's obvious that manually initializing those fields is needless as > a commit[1] explains why the function introduced and its guarantee that > all bits in the struct are cleared after it. > > [1]: commit 8c5dbf2ae00b ("signal: Introduce clear_siginfo") > > Signed-off-by: Leesoo Ahn Acked-by: Oleg Nesterov > --- > kernel/signal.c | 21 --------------------- > 1 file changed, 21 deletions(-) > > diff --git a/kernel/signal.c b/kernel/signal.c > index 5736c55aaa1a..8f49fa3ade33 100644 > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -603,10 +603,7 @@ static void collect_signal(int sig, struct sigpending *list, kernel_siginfo_t *i > */ > clear_siginfo(info); > info->si_signo = sig; > - info->si_errno = 0; > info->si_code = SI_USER; > - info->si_pid = 0; > - info->si_uid = 0; > } > } > > @@ -1120,7 +1117,6 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc > case (unsigned long) SEND_SIG_NOINFO: > clear_siginfo(&q->info); > q->info.si_signo = sig; > - q->info.si_errno = 0; > q->info.si_code = SI_USER; > q->info.si_pid = task_tgid_nr_ns(current, > task_active_pid_ns(t)); > @@ -1133,10 +1129,7 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc > case (unsigned long) SEND_SIG_PRIV: > clear_siginfo(&q->info); > q->info.si_signo = sig; > - q->info.si_errno = 0; > q->info.si_code = SI_KERNEL; > - q->info.si_pid = 0; > - q->info.si_uid = 0; > break; > default: > copy_siginfo(&q->info, info); > @@ -1623,10 +1616,7 @@ void force_sig(int sig) > > clear_siginfo(&info); > info.si_signo = sig; > - info.si_errno = 0; > info.si_code = SI_KERNEL; > - info.si_pid = 0; > - info.si_uid = 0; > force_sig_info(&info); > } > EXPORT_SYMBOL(force_sig); > @@ -1659,7 +1649,6 @@ int force_sig_fault_to_task(int sig, int code, void __user *addr > > clear_siginfo(&info); > info.si_signo = sig; > - info.si_errno = 0; > info.si_code = code; > info.si_addr = addr; > #ifdef __ARCH_SI_TRAPNO > @@ -1691,7 +1680,6 @@ int send_sig_fault(int sig, int code, void __user *addr > > clear_siginfo(&info); > info.si_signo = sig; > - info.si_errno = 0; > info.si_code = code; > info.si_addr = addr; > #ifdef __ARCH_SI_TRAPNO > @@ -1712,7 +1700,6 @@ int force_sig_mceerr(int code, void __user *addr, short lsb) > WARN_ON((code != BUS_MCEERR_AO) && (code != BUS_MCEERR_AR)); > clear_siginfo(&info); > info.si_signo = SIGBUS; > - info.si_errno = 0; > info.si_code = code; > info.si_addr = addr; > info.si_addr_lsb = lsb; > @@ -1726,7 +1713,6 @@ int send_sig_mceerr(int code, void __user *addr, short lsb, struct task_struct * > WARN_ON((code != BUS_MCEERR_AO) && (code != BUS_MCEERR_AR)); > clear_siginfo(&info); > info.si_signo = SIGBUS; > - info.si_errno = 0; > info.si_code = code; > info.si_addr = addr; > info.si_addr_lsb = lsb; > @@ -1740,7 +1726,6 @@ int force_sig_bnderr(void __user *addr, void __user *lower, void __user *upper) > > clear_siginfo(&info); > info.si_signo = SIGSEGV; > - info.si_errno = 0; > info.si_code = SEGV_BNDERR; > info.si_addr = addr; > info.si_lower = lower; > @@ -1755,7 +1740,6 @@ int force_sig_pkuerr(void __user *addr, u32 pkey) > > clear_siginfo(&info); > info.si_signo = SIGSEGV; > - info.si_errno = 0; > info.si_code = SEGV_PKUERR; > info.si_addr = addr; > info.si_pkey = pkey; > @@ -1934,7 +1918,6 @@ bool do_notify_parent(struct task_struct *tsk, int sig) > > clear_siginfo(&info); > info.si_signo = sig; > - info.si_errno = 0; > /* > * We are under tasklist_lock here so our parent is tied to > * us and cannot change. > @@ -2033,7 +2016,6 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, > > clear_siginfo(&info); > info.si_signo = SIGCHLD; > - info.si_errno = 0; > /* > * see comment in do_notify_parent() about the following 4 lines > */ > @@ -2506,7 +2488,6 @@ static int ptrace_signal(int signr, kernel_siginfo_t *info) > if (signr != info->si_signo) { > clear_siginfo(info); > info->si_signo = signr; > - info->si_errno = 0; > info->si_code = SI_USER; > rcu_read_lock(); > info->si_pid = task_pid_vnr(current->parent); > @@ -3660,7 +3641,6 @@ static inline void prepare_kill_siginfo(int sig, struct kernel_siginfo *info) > { > clear_siginfo(info); > info->si_signo = sig; > - info->si_errno = 0; > info->si_code = SI_USER; > info->si_pid = task_tgid_vnr(current); > info->si_uid = from_kuid_munged(current_user_ns(), current_uid()); > @@ -3833,7 +3813,6 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig) > > clear_siginfo(&info); > info.si_signo = sig; > - info.si_errno = 0; > info.si_code = SI_TKILL; > info.si_pid = task_tgid_vnr(current); > info.si_uid = from_kuid_munged(current_user_ns(), current_uid()); > -- > 2.26.2 >