<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic hp-ux 11.11 64bits printf oracle bug in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-11-11-64bits-printf-oracle-bug/m-p/5246307#M615089</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Our db team, passed us this problem they are having after updating oracle to version 9.2.0.8, oracle is dumping a core. Do you know if there is a SO patch for this bug?.&lt;BR /&gt;&lt;BR /&gt;hp-ux: 11.11. 64 bits&lt;BR /&gt;&lt;BR /&gt;# PHCO_27577                            1.0            printf(1) cumulative patch                           &lt;BR /&gt;# PHCO_32761                            1.0            libc cumulative patch&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Bug 6925880: ORA-7445: [__DOPRNT_WIDE()+12112]&lt;BR /&gt; &lt;BR /&gt;Bug Attributes&lt;BR /&gt;Type B - Defect Fixed in Product Version -&lt;BR /&gt;Severity 2 - Severe Loss of Service Product Version 9.2.0.8.0&lt;BR /&gt;Status 95 - Closed, Vendor OS Problem Platform 59 - HP-UX PA-RISC (64-bit)&lt;BR /&gt;Created 28-Mar-2008 Platform Version -&lt;BR /&gt;Updated 26-Jan-2009 Base Bug -&lt;BR /&gt;Database Version 9.2.0.8.0  &lt;BR /&gt;Affects Platforms Generic  &lt;BR /&gt;Product Source Oracle&lt;BR /&gt;   &lt;BR /&gt;This looks like a problem in HPUX but you could probably argue &lt;BR /&gt;about it. In the trace notice that we are attempting to write&lt;BR /&gt;out the bind value. For this we use vsnprintf() and the&lt;BR /&gt;dump occurs under there, notably on a page aligned address.&lt;BR /&gt;&lt;BR /&gt;The problem is that printf() and variants (vsnprintf, sprintf&lt;BR /&gt;etc..) have a problem on HPUX with a format string / args of &lt;BR /&gt;the form ("%.*s",N,P) if the address P+N is not accessible. For such &lt;BR /&gt;a call into printf() we are only asking to output the first N&lt;BR /&gt;characters and so printf() should only need to look at addresses&lt;BR /&gt;P+0 to P+N-1 inclusive, but on HPUX printf() is looking at address&lt;BR /&gt;P+N. For tracing bind values, and other places, strings in Oracle&lt;BR /&gt;are stored as a separate length and content and so there is no &lt;BR /&gt;trailing NULL and it is possible for a string content to end &lt;BR /&gt;on a page boundary such that the next byte is not accessible.&lt;BR /&gt;This is what is happening in the trace - the page after the&lt;BR /&gt;string content is not mapped to the process and so when printf&lt;BR /&gt;tries to access it (which it should not need to as it is&lt;BR /&gt;beyond the supplied length) it gets a fault.&lt;BR /&gt;I have uploaded a simple C program &lt;BR /&gt;that contains the following code to show the problem. This uses&lt;BR /&gt;page protection to show printf() reading past the length&lt;BR /&gt;supplied and only fails on HPUX. It works fine on Linux, &lt;BR /&gt;Solaris and AIX.&lt;BR /&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;char * p=(char *)valloc(2*8192);&lt;BR /&gt;char * p2=p+8192;&lt;BR /&gt;char * txt=p2-16;&lt;BR /&gt;int i;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; for (i=0; i&amp;lt;16; i++) txt[i]='A'+i;&lt;BR /&gt;&amp;nbsp; printf("Value before protection \"%.*s\"\n\n",16,txt);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; if (mprotect(p2,8192,PROT_NONE)&amp;lt;0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; perror("mprotect failed");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Cannot do test, mprotect failed\n");&amp;nbsp; exit(1);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; printf("txt=%p, Protected from=%p\n",txt,p2);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; printf("accessing one byte at a time: ");&lt;BR /&gt;&amp;nbsp; for (i=0; i&amp;lt;16; i++) printf("%c",txt[i]);&lt;BR /&gt;&amp;nbsp; printf("\n");&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; printf("\n");&lt;BR /&gt;&amp;nbsp; printf("Using %%.*s format with len=16\n");&lt;BR /&gt;&amp;nbsp; printf("\"%.*s\"\n",16,txt);&lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I would suggest that you contact HP with this test program&lt;BR /&gt;to see if they have a C library fix for printf() so that&lt;BR /&gt;it does not read more than N characters into a string buffer&lt;BR /&gt;when N has been supplied.&lt;BR /&gt;*** 03/31/08 04:37 am ***&lt;BR /&gt;The test program fails on HPUX compiled 64bit thus:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Value before protection "ABCDEFGHIJKLMNOP"&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; txt=8000000100007ff0, Protected from=8000000100008000&lt;BR /&gt;&amp;nbsp; accessing one byte at a time: ABCDEFGHIJKLMNOP&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Using %.*s format with len=16&lt;BR /&gt;&amp;nbsp; Bus error (core dumped)&lt;BR /&gt;&lt;BR /&gt;In this example there is a string of 16 characters at &lt;BR /&gt;8000000100007ff0 which read ABCDEFGHIJKLMNOP with &lt;BR /&gt;the P at 8000000100007fff. 8000000100008000 is not&lt;BR /&gt;accessible but we asked to printf the first 16 &lt;BR /&gt;characters of the string only so printf should not&lt;BR /&gt;need to access past 8000000100007fff, but it tries&lt;BR /&gt;to and dumps.&lt;BR /&gt;&lt;/STDLIB.H&gt;&lt;/SYS&gt;</description>
    <pubDate>Mon, 05 Jul 2010 09:14:15 GMT</pubDate>
    <dc:creator>likid0</dc:creator>
    <dc:date>2010-07-05T09:14:15Z</dc:date>
    <item>
      <title>hp-ux 11.11 64bits printf oracle bug</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-11-11-64bits-printf-oracle-bug/m-p/5246307#M615089</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Our db team, passed us this problem they are having after updating oracle to version 9.2.0.8, oracle is dumping a core. Do you know if there is a SO patch for this bug?.&lt;BR /&gt;&lt;BR /&gt;hp-ux: 11.11. 64 bits&lt;BR /&gt;&lt;BR /&gt;# PHCO_27577                            1.0            printf(1) cumulative patch                           &lt;BR /&gt;# PHCO_32761                            1.0            libc cumulative patch&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Bug 6925880: ORA-7445: [__DOPRNT_WIDE()+12112]&lt;BR /&gt; &lt;BR /&gt;Bug Attributes&lt;BR /&gt;Type B - Defect Fixed in Product Version -&lt;BR /&gt;Severity 2 - Severe Loss of Service Product Version 9.2.0.8.0&lt;BR /&gt;Status 95 - Closed, Vendor OS Problem Platform 59 - HP-UX PA-RISC (64-bit)&lt;BR /&gt;Created 28-Mar-2008 Platform Version -&lt;BR /&gt;Updated 26-Jan-2009 Base Bug -&lt;BR /&gt;Database Version 9.2.0.8.0  &lt;BR /&gt;Affects Platforms Generic  &lt;BR /&gt;Product Source Oracle&lt;BR /&gt;   &lt;BR /&gt;This looks like a problem in HPUX but you could probably argue &lt;BR /&gt;about it. In the trace notice that we are attempting to write&lt;BR /&gt;out the bind value. For this we use vsnprintf() and the&lt;BR /&gt;dump occurs under there, notably on a page aligned address.&lt;BR /&gt;&lt;BR /&gt;The problem is that printf() and variants (vsnprintf, sprintf&lt;BR /&gt;etc..) have a problem on HPUX with a format string / args of &lt;BR /&gt;the form ("%.*s",N,P) if the address P+N is not accessible. For such &lt;BR /&gt;a call into printf() we are only asking to output the first N&lt;BR /&gt;characters and so printf() should only need to look at addresses&lt;BR /&gt;P+0 to P+N-1 inclusive, but on HPUX printf() is looking at address&lt;BR /&gt;P+N. For tracing bind values, and other places, strings in Oracle&lt;BR /&gt;are stored as a separate length and content and so there is no &lt;BR /&gt;trailing NULL and it is possible for a string content to end &lt;BR /&gt;on a page boundary such that the next byte is not accessible.&lt;BR /&gt;This is what is happening in the trace - the page after the&lt;BR /&gt;string content is not mapped to the process and so when printf&lt;BR /&gt;tries to access it (which it should not need to as it is&lt;BR /&gt;beyond the supplied length) it gets a fault.&lt;BR /&gt;I have uploaded a simple C program &lt;BR /&gt;that contains the following code to show the problem. This uses&lt;BR /&gt;page protection to show printf() reading past the length&lt;BR /&gt;supplied and only fails on HPUX. It works fine on Linux, &lt;BR /&gt;Solaris and AIX.&lt;BR /&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;char * p=(char *)valloc(2*8192);&lt;BR /&gt;char * p2=p+8192;&lt;BR /&gt;char * txt=p2-16;&lt;BR /&gt;int i;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; for (i=0; i&amp;lt;16; i++) txt[i]='A'+i;&lt;BR /&gt;&amp;nbsp; printf("Value before protection \"%.*s\"\n\n",16,txt);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; if (mprotect(p2,8192,PROT_NONE)&amp;lt;0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; perror("mprotect failed");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Cannot do test, mprotect failed\n");&amp;nbsp; exit(1);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; printf("txt=%p, Protected from=%p\n",txt,p2);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; printf("accessing one byte at a time: ");&lt;BR /&gt;&amp;nbsp; for (i=0; i&amp;lt;16; i++) printf("%c",txt[i]);&lt;BR /&gt;&amp;nbsp; printf("\n");&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; printf("\n");&lt;BR /&gt;&amp;nbsp; printf("Using %%.*s format with len=16\n");&lt;BR /&gt;&amp;nbsp; printf("\"%.*s\"\n",16,txt);&lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I would suggest that you contact HP with this test program&lt;BR /&gt;to see if they have a C library fix for printf() so that&lt;BR /&gt;it does not read more than N characters into a string buffer&lt;BR /&gt;when N has been supplied.&lt;BR /&gt;*** 03/31/08 04:37 am ***&lt;BR /&gt;The test program fails on HPUX compiled 64bit thus:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Value before protection "ABCDEFGHIJKLMNOP"&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; txt=8000000100007ff0, Protected from=8000000100008000&lt;BR /&gt;&amp;nbsp; accessing one byte at a time: ABCDEFGHIJKLMNOP&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Using %.*s format with len=16&lt;BR /&gt;&amp;nbsp; Bus error (core dumped)&lt;BR /&gt;&lt;BR /&gt;In this example there is a string of 16 characters at &lt;BR /&gt;8000000100007ff0 which read ABCDEFGHIJKLMNOP with &lt;BR /&gt;the P at 8000000100007fff. 8000000100008000 is not&lt;BR /&gt;accessible but we asked to printf the first 16 &lt;BR /&gt;characters of the string only so printf should not&lt;BR /&gt;need to access past 8000000100007fff, but it tries&lt;BR /&gt;to and dumps.&lt;BR /&gt;&lt;/STDLIB.H&gt;&lt;/SYS&gt;</description>
      <pubDate>Mon, 05 Jul 2010 09:14:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-11-11-64bits-printf-oracle-bug/m-p/5246307#M615089</guid>
      <dc:creator>likid0</dc:creator>
      <dc:date>2010-07-05T09:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: hp-ux 11.11 64bits printf oracle bug</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-11-11-64bits-printf-oracle-bug/m-p/5246308#M615090</link>
      <description>Fixed with patch PHCO_40310</description>
      <pubDate>Mon, 05 Jul 2010 14:53:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-11-11-64bits-printf-oracle-bug/m-p/5246308#M615090</guid>
      <dc:creator>likid0</dc:creator>
      <dc:date>2010-07-05T14:53:19Z</dc:date>
    </item>
  </channel>
</rss>

