Recent

Author Topic: FPC 3.2.0 or Higher on OpenBSD and Solaris  (Read 10529 times)

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #45 on: July 12, 2019, 07:38:00 pm »
Quote
Can you give kldstat and then dmesg on command line and post results? Thanks.

Code: Pascal  [Select][+][-]
  1. $ kldstat
  2. Id Refs Address                Size Name
  3.  1   21 0xffffffff80200000  243cd00 kernel
  4.  2    1 0xffffffff8263d000   3a9a10 zfs.ko
  5.  3    2 0xffffffff829e7000     a4f0 opensolaris.ko
  6.  4    1 0xffffffff82c19000    2ef63 vboxguest.ko
  7.  5    1 0xffffffff82c48000     2678 intpm.ko
  8.  6    1 0xffffffff82c4b000      b10 smbus.ko
  9.  7    1 0xffffffff82c4c000      acf mac_
  10.  


Code: Pascal  [Select][+][-]
  1. $ dmesg
  2. ---<<BOOT>>---
  3. Copyright (c) 1992-2018 The FreeBSD Project.
  4. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
  5.         The Regents of the University of California. All rights reserved.
  6. FreeBSD is a registered trademark of The FreeBSD Foundation.
  7. FreeBSD 12.0-RELEASE r341666 GENERIC amd64
  8. FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
  9. VT(vga): text 80x25
  10. CPU: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (2904.07-MHz K8-class CPU)
  11.   Origin="GenuineIntel"  Id=0x806e9  Family=0x6  Model=0x8e  Stepping=9
  12.   Features=0x1783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2,HTT>
  13.   Features2=0x5eda2203<SSE3,PCLMULQDQ,SSSE3,CX16,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,RDRAND>
  14.   AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  15.   AMD Features2=0x121<LAHF,ABM,Prefetch>
  16.   Structured Extended Features=0x842421<FSGSBASE,AVX2,INVPCID,NFPUSG,RDSEED,CLFLUSHOPT>
  17.   Structured Extended Features3=0x10000400<L1DFL>
  18.   TSC: P-state invariant
  19. real memory  = 4831838208 (4608 MB)
  20. avail memory = 4108746752 (3918 MB)
  21. Event timer "LAPIC" quality 100
  22. ACPI APIC Table: <VBOX   VBOXAPIC>
  23. FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
  24. FreeBSD/SMP: 1 package(s) x 2 cache groups x 1 core(s)
  25. random: unblocking device.
  26. ioapic0: Changing APIC ID to 2
  27. ioapic0 <Version 2.0> irqs 0-23 on motherboard
  28. Launching APs: 1
  29. random: entropy device external interface
  30. kbd1 at kbdmux0
  31. netmap: loaded module
  32. [ath_hal] loaded
  33. module_register_init: MOD_LOAD (vesa, 0xffffffff810f9770, 0) error 19
  34. random: registering fast source Intel Secure Key RNG
  35. random: fast provider: "Intel Secure Key RNG"
  36. nexus0
  37. vtvga0: <VT VGA driver> on motherboard
  38. cryptosoft0: <software crypto> on motherboard
  39. acpi0: <VBOX VBOXXSDT> on motherboard
  40. acpi0: Power Button (fixed)
  41. acpi0: Sleep Button (fixed)
  42. cpu0: <ACPI CPU> on acpi0
  43. attimer0: <AT timer> port 0x40-0x43,0x50-0x53 on acpi0
  44. Timecounter "i8254" frequency 1193182 Hz quality 0
  45. Event timer "i8254" frequency 1193182 Hz quality 100
  46. Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
  47. acpi_timer0: <32-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0
  48. pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
  49. pci0: <ACPI PCI bus> on pcib0
  50. isab0: <PCI-ISA bridge> at device 1.0 on pci0
  51. isa0: <ISA bus> on isab0
  52. atapci0: <Intel PIIX4 UDMA33 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xd000-0xd00f at device 1.1 on pci0
  53. ata0: <ATA channel> at channel 0 on atapci0
  54. ata1: <ATA channel> at channel 1 on atapci0
  55. vgapci0: <VGA-compatible display> mem 0xe0000000-0xe7ffffff irq 18 at device 2.0 on pci0
  56. vgapci0: Boot video device
  57. em0: <Intel(R) PRO/1000 Network Connection> port 0xd010-0xd017 mem 0xf0000000-0xf001ffff irq 19 at device 3.0 on pci0
  58. em0: attach_pre capping queues at 1
  59. em0: using 1024 tx descriptors and 1024 rx descriptors
  60. em0: allocated for 1 tx_queues
  61. em0: allocated for 1 rx_queues
  62. em0: Ethernet address: 08:00:27:a9:9c:c1
  63. em0: netmap queues/slots: TX 1/1024, RX 1/1024
  64. pcm0: <Intel ICH (82801AA)> port 0xd100-0xd1ff,0xd200-0xd23f irq 21 at device 5.0 on pci0
  65. pcm0: <SigmaTel STAC9700/83/84 AC97 Codec>
  66. ohci0: <Apple KeyLargo/Intrepid USB controller> mem 0xf0804000-0xf0804fff irq 22 at device 6.0 on pci0
  67. usbus0 on ohci0
  68. usbus0: 12Mbps Full Speed USB v1.0
  69. pci0: <bridge> at device 7.0 (no driver attached)
  70. ehci0: <Intel 82801FB (ICH6) USB 2.0 controller> mem 0xf0805000-0xf0805fff irq 19 at device 11.0 on pci0
  71. usbus1: EHCI version 1.0
  72. usbus1 on ehci0
  73. usbus1: 480Mbps High Speed USB v2.0
  74. battery0: <ACPI Control Method Battery> on acpi0
  75. acpi_acad0: <AC Adapter> on acpi0
  76. atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
  77. atkbd0: <AT Keyboard> irq 1 on atkbdc0
  78. kbd0 at atkbd0
  79. atkbd0: [GIANT-LOCKED]
  80. psm0: <PS/2 Mouse> irq 12 on atkbdc0
  81. psm0: [GIANT-LOCKED]
  82. psm0: model IntelliMouse Explorer, device ID 4
  83. orm0: <ISA Option ROMs> at iomem 0xc0000-0xc7fff,0xe2000-0xe2fff pnpid ORM0000 on isa0
  84. vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff pnpid PNP0900 on isa0
  85. atrtc0: <AT realtime clock> at port 0x70 irq 8 on isa0
  86. atrtc0: registered as a time-of-day clock, resolution 1.000000s
  87. Event timer "RTC" frequency 32768 Hz quality 0
  88. atrtc0: non-PNP ISA device will be removed from GENERIC in FreeBSD 12.
  89. ZFS NOTICE: Prefetch is disabled by default if less than 4GB of RAM is present;
  90.             to enable, add "vfs.zfs.prefetch_disable=0" to /boot/loader.conf.
  91. ZFS filesystem version: 5
  92. ZFS storage pool version: features support (5000)
  93. Timecounters tick every 10.000 msec
  94. pcm0: measured ac97 link rate at 8904347 Hz
  95. ugen0.1: <Apple OHCI root HUB> at usbus0
  96. ugen1.1: <Intel EHCI root HUB> at usbus1
  97. uhub0: <Apple OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
  98. uhub1: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
  99. ada0 at ata0 bus 0 scbus0 target 0 lun 0
  100. ada0: <VBOX HARDDISK 1.0> ATA-6 device
  101. ada0: Serial Number VBf6b3f334-e6fd7643
  102. ada0: 33.300MB/s transfers (UDMA2, PIO 65536bytes)
  103. ada0: 30720MB (62914560 512 byte sectors)
  104. cd0 at ata1 bus 0 scbus1 target 0 lun 0
  105. cd0: <VBOX CD-ROM 1.0> Removable CD-ROM SCSI device
  106. cd0: Serial Number VB2-01700376
  107. cd0: 33.300MB/s transfers (UDMA2, ATAPI 12bytes, PIO 65534bytes)
  108. cd0: Attempt to query device size failed: NOT READY, Medium not present
  109. Trying to mount root from zfs:zroot/ROOT/default []...
  110. Root mount waiting for: usbus1 usbus0
  111. uhub0: 12 ports with 12 removable, self powered
  112. Root mount waiting for: usbus1
  113. Root mount waiting for: usbus1
  114. Root mount waiting for: usbus1
  115. Root mount waiting for: usbus1
  116. uhub1: 12 ports with 12 removable, self powered
  117. vboxguest0 port 0xd020-0xd03f mem 0xf0400000-0xf07fffff,0xf0800000-0xf0803fff irq 20 at device 4.0 on pci0
  118. vboxguest: loaded successfully
  119. lo0: link state changed to UP
  120. em0: link state changed to UP
  121. intsmb0: <Intel PIIX4 SMBUS Interface> irq 23 at device 7.0 on pci0
  122. intsmb0: intr IRQ 9 enabled revision 0
  123. smbus0: <System Management Bus> on intsmb0
  124. Security policy loaded: MAC/ntpd (mac_ntpd)
  125. pid 1210 (tracker-miner-fs), uid 1001: exited on signal 11
  126. pid 1437 (gjs-console), uid 1001: exited on signal 11
  127. pid 1487 (gjs-console), uid 1001: exited on signal 11
  128. em0: link state changed to DOWN
  129. em0: link state changed to UP
  130.  

julkas

  • Guest
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #46 on: July 12, 2019, 07:55:00 pm »
@Xor-el may be my FPC is corrupted.

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #47 on: July 12, 2019, 08:00:29 pm »
@Xor-el may be my FPC is corrupted.

I guess so or a bug exists in your version, this is why I am trying to install the latest 3.2.0 fixes version with FPCUPDeluxe unfortunately no progress.

getting different issues here and there.

see here
https://forum.lazarus.freepascal.org/index.php/topic,34645.msg326781.html#msg326781
https://forum.lazarus.freepascal.org/index.php/topic,34645.msg326897.html#msg326897

julkas

  • Guest
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #48 on: July 13, 2019, 10:54:18 am »
@Xor-el may be my FPC is corrupted.

I guess so or a bug exists in your version, this is why I am trying to install the latest 3.2.0 fixes version with FPCUPDeluxe unfortunately no progress.

getting different issues here and there.

see here
https://forum.lazarus.freepascal.org/index.php/topic,34645.msg326781.html#msg326781
https://forum.lazarus.freepascal.org/index.php/topic,34645.msg326897.html#msg326897
Fantastic adventure.
Can you try following.
1. On clean FreeBSD 12.0 VM (without FPC, Lazarus) load linux compat modules (as above).
2. Using latest FPCUPDeluxe install your FPC and Lazarus.
3. If success sompile and run your project.
4. If success - exit Lazarus.
5. Unload modules kldunload linux, kldunload linux64
6. Open Lazarus. Run project.
Regards.

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #49 on: July 13, 2019, 11:03:21 am »
Fantastic adventure.
Can you try following.
1. On clean FreeBSD 12.0 VM (without FPC, Lazarus) load linux compat modules (as above).
2. Using latest FPCUPDeluxe install your FPC and Lazarus.
3. If success sompile and run your project.
4. If success - exit Lazarus.
5. Unload modules kldunload linux, kldunload linux64
6. Open Lazarus. Run project.
Regards.

as strange as it sounds, I did this same thing yesterday night and got stuck when trying to build FPC and Lazarus using FPCUPDeluxe.

my procedures are below.

1. created a clean fresh FreeBSD 12.0 VM (without FPC, Lazarus) and loaded linux compat modules (kldload linux64).
2. downloaded latest FreeBSD FPCUPDeluxe and try to install FPC and Lazarus using it.
3. Encountered the same blocker issues I discussed in the links above (issues building Lazarus/FPC on FreeBSD using FPCUPDeluxe)  :'( :'( :'( :'( :'( :'(

« Last Edit: July 13, 2019, 11:05:41 am by Xor-el »

julkas

  • Guest
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #50 on: July 13, 2019, 11:14:53 am »
@Xor-el Can you test FreeBSD 9.0 (I will try next week)?
« Last Edit: July 13, 2019, 11:18:21 am by julkas »

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #51 on: July 13, 2019, 11:20:57 am »
Can you test FreeBSD 9.0 (I will try next week)?

Unfortunately, I don't have FreeBSD 9.0, I guess I will have to wait till you are able to test this.

Thanks.

julkas

  • Guest
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #52 on: July 13, 2019, 11:28:59 am »
Can you test FreeBSD 9.0 (I will try next week)?

Unfortunately, I don't have FreeBSD 9.0, I guess I will have to wait till you are able to test this.

Thanks.
Offtopic question - why 3.2.0? I think for best portability you must use rel. ver only.

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #53 on: July 13, 2019, 11:33:01 am »
Offtopic question - why 3.2.0? I think for best portability you must use rel. ver only.

1. FPC 3.2.0 fixes a compiler bug that exists in previous versions and affects an algorithm in the library.

2. FPC 3.2.0 has generics.collections inbuilt so I don't have to worry about another external dependency to install.

julkas

  • Guest
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #54 on: July 13, 2019, 11:38:41 am »
Offtopic question - why 3.2.0? I think for best portability you must use rel. ver only.

1. FPC 3.2.0 fixes a compiler bug that exists in previous versions and affects an algorithm in the library.

2. FPC 3.2.0 has generics.collections inbuilt so I don't worry about another external dependency to install.

1. Can you give more details about bug.
2. You can use other classes from 3.0.4 (fcl-stl, fgl, ...).

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #55 on: July 13, 2019, 11:49:10 am »

1. Can you give more details about bug.
2. You can use other classes from 3.0.4 (fcl-stl, fgl, ...).


1. It has to do with finalization of records and interfaces saved in arrays and functions in some specific cases that causes some access violations (at least that is what I can deduce it as)

Do note that this bug only affects ED25519 and X25519 implementations, other algorithms work well with 3.0.4


2. Yes I can but do remember I support Delphi too so this would introduce a large amount of unnecessary ifdefs to say the least.
Also generics.collections is way faster and more modern that fgl library.

Lastly there is an implementation of generics.collections in the Lazarus packages (can't remember name exactly) but using that will mean that the library has a dependency to Lazarus which I don't want.

julkas

  • Guest
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #56 on: July 13, 2019, 12:06:19 pm »

1. It has to do with finalization of records and interfaces saved in arrays and functions in some specific cases that causes some access violations (at least that is what I can deduce it as)

Do note that this bug only affects ED25519 and X25519 implementations, other algorithms work well with 3.0.4
Please give code example (good homework).

2. Yes I can but do remember I support Delphi too so this would introduce a large amount of unnecessary ifdefs to say the least.
Also generics.collections is way faster and more modern that fgl library.

Faster and modern. Any benchmark, reference? What do you mean 'faster and more modern'?

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #57 on: July 13, 2019, 12:27:17 pm »
Quote
Please give code example (good homework).

Well, I didn't really bother to investigate it further to be able to draft a small compilable example to reproduce the bug, to be sincere it was not worth the effort because the issue was already fixed in later versions of the compiler (3.2.0 upwards).

But if it you are really interested in investigating the bug (it seems you are), you can debug the ED25519HigherLevelTest to reproduce the error.

Quote
Faster and modern. Any benchmark, reference? What do you mean 'faster and more modern'?

Well, I did some personal benchmarks sometime back, you can also take a look at here http://www.benibela.de/fpc-map-benchmark_en.html for some benchmarks done by benibela.
Also see here https://forum.lazarus.freepascal.org/index.php/topic,34348.msg226229.html
« Last Edit: July 13, 2019, 12:34:36 pm by Xor-el »

julkas

  • Guest
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #58 on: July 13, 2019, 07:32:30 pm »
I suggest create new branch and replace call to arc4random_buf with more portable  functions.

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: FPC 3.2.0 or Higher on OpenBSD and Solaris
« Reply #59 on: July 13, 2019, 09:05:52 pm »
I suggest create new branch and replace call to arc4random_buf with more portable  functions.

@julkas, that function 'arc4random_buf' is a CSPRNG (Cryptographically Secure Pseudo Random Number Generator) for BSD systems used to get secure random bytes from the OS.
This simply means there is no room for compromises as this is the determining security factor of most asymmetric cryptographic codes.

that been said, we can't use any just any random number generator for this, an alternative we have is reading from /dev/urandom or /dev/random which has problems of it's own which are

If you're chroot'ed, chances are you won't have read access (or see) /dev/urandom or /dev/random. Furthermore,
if you've run out of file handles (maybe intentionally - because someone figures they can try to DOS you to attack the PRNG), it is not a given you'll be able to open it even if it's visible.

so this been said, I really want to avoid reading from /dev/urandom or /dev/random and only use that as fallback if and only if the recommended OS API is not available in the said OS.
« Last Edit: July 14, 2019, 12:23:25 pm by Xor-el »

 

TinyPortal © 2005-2018