Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp30297ybz; Thu, 16 Apr 2020 18:38:56 -0700 (PDT) X-Google-Smtp-Source: APiQypIkGNg2cOiV0T/56ojKu7sEqZVoidw1/uWvI6C6nzwBYdZ5xytKnMCGt/62/OpnQu3HLO8l X-Received: by 2002:a17:906:4548:: with SMTP id s8mr763132ejq.349.1587087536340; Thu, 16 Apr 2020 18:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587087536; cv=none; d=google.com; s=arc-20160816; b=lKkHGXE2Hc6x6J4qsvtdsQ6+us8eIdiXk5MGBZVhCwcNvVwsljF6H51Gc0pY/3HWzT mLJ+jpEdC9KB1DfgEjbzWoF+ocdATIgKCPyqvYDsiqqu1E3wYdd3iWWzwmoP+ZI9ZlLk +hiWcDEf6zsx3N5swOVu08r3DUWAmdaW/zJbEgctrX/MV4bvt8XsNbFoixQvfqUbzK71 uvvt2fz+Yr/R7WfV5ON300469CBpjWZhIs0+513uydCddLvxktYWK8R5UVZvn0LN+a6l UGyqf1NL7i6w9vL8jE+fB3DUAlmCIZiw1L6/+XZawEe6fMX22aVzwmL1pUZNYa91lj1l VKYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=RH8c9mlh1Nn23MD937ZQ+ys6TCD7ufyPWJobVezo3i4=; b=bydjb4Lp370VikgBlKZdYOBAF1IhVgM8NyiXBEQQwOBs42BNQda2Grl49lJachgLs0 zqm0LVgkbPqM9zF11FlvnEsdJSZ1IrkbTT+8KDBWUaFcuZxLYwpGCUsDz6iVgyxynTpu YygPtYxh/qTIfloOwkCwWfZUZlt1wBlvL/Lc5ShCScSwMCG8J856CBDtMGJcS6B+6me4 YQW5i7MQ951QI0JNE9fV4fp7SCwEO3dm0+tVxd/1LWAByoBPZYmIGY9m1eaYaixEdq+z 51uRCVdlhIXt2xiNlWIwFjSYJTs2AbKBGvkpT0HP4fP/w4hLXqqsUsoaOnoFqdO+A7Ee c2uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JBKZyw0G; 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 p18si13588565ejl.98.2020.04.16.18.38.32; Thu, 16 Apr 2020 18:38:56 -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=@redhat.com header.s=mimecast20190719 header.b=JBKZyw0G; 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 S1728728AbgDQBhY (ORCPT + 99 others); Thu, 16 Apr 2020 21:37:24 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34532 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728461AbgDQBhX (ORCPT ); Thu, 16 Apr 2020 21:37:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587087442; 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=RH8c9mlh1Nn23MD937ZQ+ys6TCD7ufyPWJobVezo3i4=; b=JBKZyw0GbFuNXE2vfTa0rJoACp0Ec62P1yYmnvpb1P0Tp2E4OWMgIJ6Ypd7ibhLTyO6N8a bpT92SRH3L0xqdtk4mq/en4b9m1vbRgp7Rfk7m4EqowH+4i84TG0UOUJF6sO0ADcHF2/SR 9ZUecEQyzTPnxBU0FkSe6i3i7gUtmh8= 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-183-pCZE9mC2NWCH7FJKXvCtGg-1; Thu, 16 Apr 2020 21:37:20 -0400 X-MC-Unique: pCZE9mC2NWCH7FJKXvCtGg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 561ED13F9; Fri, 17 Apr 2020 01:37:19 +0000 (UTC) Received: from treble (ovpn-116-146.rdu2.redhat.com [10.10.116.146]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 403D07E7EF; Fri, 17 Apr 2020 01:37:17 +0000 (UTC) Date: Thu, 16 Apr 2020 20:37:15 -0500 From: Josh Poimboeuf To: Miroslav Benes Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Jessica Yu , linux-s390@vger.kernel.org, heiko.carstens@de.ibm.com Subject: Re: [PATCH 4/7] s390/module: Use s390_kernel_write() for relocations Message-ID: <20200417013715.kj6g4byvdy5uzgev@treble> References: <20200416120651.wqmoaa35jft4prox@treble> <20200416131635.scbpuued6l4xb6qq@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200416131635.scbpuued6l4xb6qq@treble> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 16, 2020 at 08:16:35AM -0500, Josh Poimboeuf wrote: > On Thu, Apr 16, 2020 at 07:06:51AM -0500, Josh Poimboeuf wrote: > > On Thu, Apr 16, 2020 at 10:56:02AM +0200, Miroslav Benes wrote: > > > > + bool early = me->state == MODULE_STATE_UNFORMED; > > > > + > > > > + return __apply_relocate_add(sechdrs, strtab, symindex, relsec, me, > > > > + early ? memcpy : s390_kernel_write); > > > > > > The compiler warns about > > > > > > arch/s390/kernel/module.c: In function 'apply_relocate_add': > > > arch/s390/kernel/module.c:453:24: warning: pointer type mismatch in conditional expression > > > early ? memcpy : s390_kernel_write); > > > > Thanks, I'll get all that cleaned up. > > > > I could have sworn I got a SUCCESS message from the kbuild bot. Does it > > ignore warnings nowadays? > > Here's a fix on top of the original patch. > > I changed s390_kernel_write() to return "void *" to match memcpy() > (probably a separate patch). > > I also grabbed the text_mutex for the !early case in > apply_relocate_add() -- will do something similar for x86. > > Will try to test this on a 390 box. ...and that borked the box pretty nicely. Oops, big endian! Need something like this on top. Sorry about not testing the patch in the first place, it looked trivial and somehow I was thinking Peter writes exclusively bug-free code. diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c index ee0904a23e24..513e640430ae 100644 --- a/arch/s390/kernel/module.c +++ b/arch/s390/kernel/module.c @@ -198,21 +198,25 @@ static int apply_rela_bits(Elf_Addr loc, Elf_Addr val, } if (bits == 8) { - write(dest, &val, 1); + unsigned char tmp = val; + write(dest, &tmp, 1); } else if (bits == 12) { unsigned short tmp = (val & 0xfff) | (*(unsigned short *) loc & 0xf000); write(dest, &tmp, 2); } else if (bits == 16) { - write(dest, &val, 2); + unsigned short tmp = val; + write(dest, &tmp, 2); } else if (bits == 20) { unsigned int tmp = (val & 0xfff) << 16 | (val & 0xff000) >> 4 | (*(unsigned int *) loc & 0xf00000ff); write(dest, &tmp, 4); } else if (bits == 32) { - write(dest, &val, 4); + unsigned int tmp = val; + write(dest, &tmp, 4); } else if (bits == 64) { - write(dest, &val, 8); + unsigned long tmp = val; + write(dest, &tmp, 8); } return 0; } -- Josh