From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: ** X-Spam-Status: No, score=2.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76F0AC433DF for ; Sat, 4 Jul 2020 16:06:41 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5C1320739 for ; Sat, 4 Jul 2020 16:06:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mDUDmsfK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5C1320739 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94) (envelope-from ) id 1jrkgE-0000sc-DU; Sat, 04 Jul 2020 12:06:18 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1jrkgC-0000sW-0a for kernelnewbies@kernelnewbies.org; Sat, 04 Jul 2020 12:06:16 -0400 Received: by mail-lj1-x22e.google.com with SMTP id q7so27112251ljm.1 for ; Sat, 04 Jul 2020 09:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b5NEsRBsNx35jHpD83jrOk21hN9oWelawVbwjCC9qDo=; b=mDUDmsfKmQl6MQ7irUSjjsK5x4PqiIjzyTakRLDKV9HWf7NB08zruSjU+TjXPceeBJ 0SW5bETsCF2qfqQrPzgpRWBxzo7EFCdTzTyuV1UWK5UptPK+PnfrOqnzWoA6jYp65EGV 0EV8OzrdHND0OKDqGoZjcZ90maz5VOTtkUlDeHIHqse0CFMF9UmIK8XIuZAieACNQtw+ BChUaum4vdDQpnI7Ocu+lhwxreVvaNInrQm+zJDo9b499llKfTSgJYZWeo3TksNnmbzG 6wbQ3P3vCGJBsQcs+J2/sLKbv9Hj6im+KJXty1GuNCpxwe+N1O8nHFNNHs1JjPvdrqf4 hFgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b5NEsRBsNx35jHpD83jrOk21hN9oWelawVbwjCC9qDo=; b=GswhgQCDyrzv7q9B6c7LKpGvfLacqscUXqNII9r9ud3gPE7/5etP3CwB+SnTGW2WCl QjXhzLF4/s842LBdvznROOSx8UEIz0ydK78GYHn3lc6Mo7vy54p0zyzRjnM7iaT8j3FP q8l7GvfZUNV1AowjZuqKiggWDqodUlS0INkJQVvmkre6YpKE31E2NFKcwfTBQRs8WgpU 1Xpq8ObdirpGR15sFWuN5b4taiGOl+83JSTu3Cy/a8JgGfEuyHtyPbEdsPxtI0tpM/Uh OnPMw9dUNDrHgreWPNqDPJlxs/3K5cyQRXLk9W5XQOaKisibTFpeXncadSqA35WFtKh9 JsPQ== X-Gm-Message-State: AOAM530IH88xxq0SAAgvpOx0wXgqR65NdRp9kU4Hy8Pl2QnggU0602kx Kp8RZyswTAOktv1sbyxAGoweWbTki5VncMkPkHtN8ESZ X-Google-Smtp-Source: ABdhPJyEGhU9xvzW3T5vr+Ozh6igc0FkpU0E4MTFkbWV7BI3pcNCqTX4CqUNIAH9xc7w4mkituAHSS25pKaL86U/5UU= X-Received: by 2002:a2e:810a:: with SMTP id d10mr16826991ljg.144.1593878712364; Sat, 04 Jul 2020 09:05:12 -0700 (PDT) MIME-Version: 1.0 References: <20200704102910.GA6573@valentin-vidic.from.hr> In-Reply-To: <20200704102910.GA6573@valentin-vidic.from.hr> From: William Tambe Date: Sat, 4 Jul 2020 12:04:59 -0400 Message-ID: Subject: Re: printk() format %pS wrong symbol To: =?UTF-8?Q?Valentin_Vidi=C4=87?= Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============6191459885871200087==" Errors-To: kernelnewbies-bounces@kernelnewbies.org --===============6191459885871200087== Content-Type: multipart/alternative; boundary="0000000000007733bb05a99fce48" --0000000000007733bb05a99fce48 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Jul 4, 2020 at 6:29 AM Valentin Vidi=C4=87 wrote: > On Sat, Jul 04, 2020 at 06:11:19AM -0400, William Tambe wrote: > > I am seeing an issue in our Linux port where printk() format %pS will > print > > a symbol as: > > kernel_init+0x120/0x120 > > where the offset within the function 0x120, is the same as the function > > size 0x120; in fact, the largest offset within the function should be > 0x11f. > > > > When printing above symbol+offset in gdb, the correct symbol is > > displayed as follow: > > > > (gdb) p (void*)(kernel_init+0x120) > > $1 =3D (void *) 0x589a28 > > > > What could be the cause of printk() format %pS printing an incorrect > symbol. > > > > Where can I find in the Linux source code, the function handling the > format > > %pS ? > > Check lib/vsprintf.c > How or which function within that file translates an address to the string symbol+offset for the format %pS ? > > -- > Valentin > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > --0000000000007733bb05a99fce48 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Sat, Jul 4, 2020 at 6:29 AM Valentin V= idi=C4=87 <vvidic@valen= tin-vidic.from.hr> wrote:
On Sat, Jul 04, 2020 at 06:11:19AM -0400, William Tambe wr= ote:
> I am seeing an issue in our Linux port where printk() format %pS will = print
> a symbol as:
> kernel_init+0x120/0x120
> where the offset within the function 0x120, is the same as the functio= n
> size 0x120; in fact, the largest offset within the function should be = 0x11f.
>
> When printing above symbol+offset in gdb, the correct symbol is
> displayed as follow:
>
> (gdb) p (void*)(kernel_init+0x120)
> $1 =3D (void *) 0x589a28 <ret_for_syscall>
>
> What could be the cause of printk() format %pS printing an incorrect s= ymbol.
>
> Where can I find in the Linux source code, the function handling the f= ormat
> %pS ?

Check lib/vsprintf.c

How or which funct= ion=C2=A0within that file=C2=A0translates an address to the string symbol+o= ffset for the format %pS ?
=C2=A0

--
Valentin

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kern= elnewbies
--0000000000007733bb05a99fce48-- --===============6191459885871200087== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============6191459885871200087==--