Unicorn with delicious cookie
Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter
to the top
>
>
>
Issues of 64-bit code in real applicati…

Issues of 64-bit code in real applications: and what about Linux?

11 Oct 2010

While telling programmers about 64-bit issues they may encounter when porting their programs, I often hear reproaches: "Yes, surely - such is your Windows... How good it is that Linux has had no problems with 64-bit code for a long time!".

"It is not so, my inquisitive readers". Today's post is about a 64-bit error in the Linux kernel. A wonderful site with bug tracking system by the kernel's developers contains the description of bug 16603 (send of data > 4 GB fails on 64 bit systems). The issue is simple: "Send of data using the Linux-function send() leads to an error if the data's size is too large". This is how the function looks in glibc:

ssize_t send(int sockfd, const void *buf, size_t len, int flags);

Everything is correct and the size is passed as a memsize-type size_t. But this argument is saved in the msgheader structure and after that there are the following lines inside the tcp_sendmsg function:

while (--iovlen >= 0) {
                int seglen = iov->iov_len;
                unsigned char __user *from = iov->iov_base;

Here, the length is saved in int and it is certainly a bad thing. That is, if you send a block of 5 Gbytes using send(), only 1 Gbyte will be sent while sending a 4-Gbyte block will have no result (due to truncation to zero).

Of course, the workaround is clear - we should specify length not larger than 0x8000000, but it is an error and of course we should fix it.

Yes, by the way, it is not a sample from the nineties - the bug was discovered in August, 2010, and refers to the kernel of version 2.5. And it is still (October 11, 2010) not fixed. And you tell me that Linux does not have 64-bit issues...

Popular related articles

S'abonner

Comments (0)

close comment form
close form

Remplissez le formulaire ci‑dessous en 2 étapes simples :

Vos coordonnées :

Étape 1
Félicitations ! Voici votre code promo !

Type de licence souhaité :

Étape 2
Team license
Enterprise licence
** En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité
close form
Demandez des tarifs
Nouvelle licence
Renouvellement de licence
--Sélectionnez la devise--
USD
EUR
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
La licence PVS‑Studio gratuit pour les spécialistes Microsoft MVP
close form
Pour obtenir la licence de votre projet open source, s’il vous plait rempliez ce formulaire
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
I want to join the test
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
check circle
Votre message a été envoyé.

Nous vous répondrons à


Si l'e-mail n'apparaît pas dans votre boîte de réception, recherchez-le dans l'un des dossiers suivants:

  • Promotion
  • Notifications
  • Spam